1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2023 Intel Corporation
6 #ifndef _XE_REG_DEFS_H_
7 #define _XE_REG_DEFS_H_
9 #include "compat-i915-headers/i915_reg_defs.h"
12 * struct xe_reg - Register definition
14 * Register defintion to be used by the individual register. Although the same
15 * definition is used for xe_reg and xe_reg_mcr, they use different internal
24 * @masked: register is "masked", with upper 16bits used
25 * to identify the bits that are updated on the lower
30 * @mcr: register is multicast/replicated in the
31 * hardware and needs special handling. Any register
32 * with this set should also use a type of xe_reg_mcr_t.
33 * It's only here so the few places that deal with MCR
34 * registers specially (xe_sr.c) and tests using the raw
35 * value can inspect it.
39 * @ext: access MMIO extension space for current register.
43 /** @raw: Raw value with both address and options */
49 * struct xe_reg_mcr - MCR register definition
51 * MCR register is the same as a regular register, but uses another type since
52 * the internal API used for accessing them is different: it's never correct to
53 * use regular MMIO access.
56 /** @__reg: The register */
62 * XE_REG_OPTION_MASKED - Register is "masked", with upper 16 bits marking the
63 * read/written bits on the lower 16 bits.
65 * To be used with XE_REG(). XE_REG_MCR() and XE_REG_INITIALIZER()
67 #define XE_REG_OPTION_MASKED .masked = 1
70 * XE_REG_INITIALIZER - Initializer for xe_reg_t.
71 * @r_: Register offset
72 * @...: Additional options like access mode. See struct xe_reg for available
75 * Register field is mandatory, and additional options may be passed as
76 * arguments. Usually ``XE_REG()`` should be preferred since it creates an
77 * object of the right type. However when initializing static const storage,
78 * where a compound statement is not allowed, this can be used instead.
80 #define XE_REG_INITIALIZER(r_, ...) { .addr = r_, __VA_ARGS__ }
84 * XE_REG - Create a struct xe_reg from offset and additional flags
85 * @r_: Register offset
86 * @...: Additional options like access mode. See struct xe_reg for available
89 #define XE_REG(r_, ...) ((const struct xe_reg)XE_REG_INITIALIZER(r_, ##__VA_ARGS__))
92 * XE_REG_EXT - Create a struct xe_reg from extension offset and additional
94 * @r_: Register extension offset
95 * @...: Additional options like access mode. See struct xe_reg for available
98 #define XE_REG_EXT(r_, ...) \
99 ((const struct xe_reg)XE_REG_INITIALIZER(r_, ##__VA_ARGS__, .ext = 1))
102 * XE_REG_MCR - Create a struct xe_reg_mcr from offset and additional flags
103 * @r_: Register offset
104 * @...: Additional options like access mode. See struct xe_reg for available
107 #define XE_REG_MCR(r_, ...) ((const struct xe_reg_mcr){ \
108 .__reg = XE_REG_INITIALIZER(r_, ##__VA_ARGS__, .mcr = 1) \