mirror of https://gitee.com/openkylin/linux.git
drm/i915: Type safe register read/write
Make I915_READ and I915_WRITE more type safe by wrapping the register offset in a struct. This should eliminate most of the fumbles we've had with misplaced parens. This only takes care of normal mmio registers. We could extend the idea to other register types and define each with its own struct. That way you wouldn't be able to accidentally pass the wrong thing to a specific register access function. The gpio_reg setup is probably the ugliest thing left. But I figure I'd just leave it for now, and wait for some divine inspiration to strike before making it nice. As for the generated code, it's actually a bit better sometimes. Eg. looking at i915_irq_handler(), we can see the following change: lea 0x70024(%rdx,%rax,1),%r9d mov $0x1,%edx - movslq %r9d,%r9 - mov %r9,%rsi - mov %r9,-0x58(%rbp) - callq *0xd8(%rbx) + mov %r9d,%esi + mov %r9d,-0x48(%rbp) callq *0xd8(%rbx) So previously gcc thought the register offset might be signed and decided to sign extend it, just in case. The rest appears to be mostly just minor shuffling of instructions. v2: i915_mmio_reg_{offset,equal,valid}() helpers added s/_REG/_MMIO/ in the register defines mo more switch statements left to worry about ring_emit stuff got sorted in a prep patch cmd parser, lrc context and w/a batch buildup also in prep patch vgpu stuff cleaned up and moved to a prep patch all other unrelated changes split out v3: Rebased due to BXT DSI/BLC, MOCS, etc. v4: Rebased due to churn, s/i915_mmio_reg_t/i915_reg_t/ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/1447853606-2751-1-git-send-email-ville.syrjala@linux.intel.com
This commit is contained in:
parent
9bca5d0ca7
commit
f0f59a00a1
|
@ -32,8 +32,8 @@ struct intel_dvo_device {
|
|||
const char *name;
|
||||
int type;
|
||||
/* DVOA/B/C output register */
|
||||
u32 dvo_reg;
|
||||
u32 dvo_srcdim_reg;
|
||||
i915_reg_t dvo_reg;
|
||||
i915_reg_t dvo_srcdim_reg;
|
||||
/* GPIO register used for i2c bus to control this device */
|
||||
u32 gpio;
|
||||
int slave_addr;
|
||||
|
|
|
@ -407,7 +407,7 @@ static const struct drm_i915_cmd_table hsw_blt_ring_cmds[] = {
|
|||
* LRI.
|
||||
*/
|
||||
struct drm_i915_reg_descriptor {
|
||||
u32 addr;
|
||||
i915_reg_t addr;
|
||||
u32 mask;
|
||||
u32 value;
|
||||
};
|
||||
|
@ -597,7 +597,7 @@ static bool check_sorted(int ring_id,
|
|||
bool ret = true;
|
||||
|
||||
for (i = 0; i < reg_count; i++) {
|
||||
u32 curr = reg_table[i].addr;
|
||||
u32 curr = i915_mmio_reg_offset(reg_table[i].addr);
|
||||
|
||||
if (curr < previous) {
|
||||
DRM_ERROR("CMD: table not sorted ring=%d entry=%d reg=0x%08X prev=0x%08X\n",
|
||||
|
@ -852,7 +852,7 @@ find_reg(const struct drm_i915_reg_descriptor *table,
|
|||
int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (table[i].addr == addr)
|
||||
if (i915_mmio_reg_offset(table[i].addr) == addr)
|
||||
return &table[i];
|
||||
}
|
||||
}
|
||||
|
@ -1028,7 +1028,7 @@ static bool check_cmd(const struct intel_engine_cs *ring,
|
|||
* to the register. Hence, limit OACONTROL writes to
|
||||
* only MI_LOAD_REGISTER_IMM commands.
|
||||
*/
|
||||
if (reg_addr == OACONTROL) {
|
||||
if (reg_addr == i915_mmio_reg_offset(OACONTROL)) {
|
||||
if (desc->cmd.value == MI_LOAD_REGISTER_MEM) {
|
||||
DRM_DEBUG_DRIVER("CMD: Rejected LRM to OACONTROL\n");
|
||||
return false;
|
||||
|
|
|
@ -3267,7 +3267,8 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
|
|||
|
||||
seq_printf(m, "Workarounds applied: %d\n", dev_priv->workarounds.count);
|
||||
for (i = 0; i < dev_priv->workarounds.count; ++i) {
|
||||
u32 addr, mask, value, read;
|
||||
i915_reg_t addr;
|
||||
u32 mask, value, read;
|
||||
bool ok;
|
||||
|
||||
addr = dev_priv->workarounds.reg[i].addr;
|
||||
|
@ -3276,7 +3277,7 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
|
|||
read = I915_READ(addr);
|
||||
ok = (value & mask) == (read & mask);
|
||||
seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X, read: 0x%08x, status: %s\n",
|
||||
addr, value, mask, read, ok ? "OK" : "FAIL");
|
||||
i915_mmio_reg_offset(addr), value, mask, read, ok ? "OK" : "FAIL");
|
||||
}
|
||||
|
||||
intel_runtime_pm_put(dev_priv);
|
||||
|
|
|
@ -685,18 +685,18 @@ struct intel_uncore_funcs {
|
|||
void (*force_wake_put)(struct drm_i915_private *dev_priv,
|
||||
enum forcewake_domains domains);
|
||||
|
||||
uint8_t (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
|
||||
uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
|
||||
uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
|
||||
uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
|
||||
uint8_t (*mmio_readb)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
|
||||
uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
|
||||
uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
|
||||
uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
|
||||
|
||||
void (*mmio_writeb)(struct drm_i915_private *dev_priv, off_t offset,
|
||||
void (*mmio_writeb)(struct drm_i915_private *dev_priv, i915_reg_t r,
|
||||
uint8_t val, bool trace);
|
||||
void (*mmio_writew)(struct drm_i915_private *dev_priv, off_t offset,
|
||||
void (*mmio_writew)(struct drm_i915_private *dev_priv, i915_reg_t r,
|
||||
uint16_t val, bool trace);
|
||||
void (*mmio_writel)(struct drm_i915_private *dev_priv, off_t offset,
|
||||
void (*mmio_writel)(struct drm_i915_private *dev_priv, i915_reg_t r,
|
||||
uint32_t val, bool trace);
|
||||
void (*mmio_writeq)(struct drm_i915_private *dev_priv, off_t offset,
|
||||
void (*mmio_writeq)(struct drm_i915_private *dev_priv, i915_reg_t r,
|
||||
uint64_t val, bool trace);
|
||||
};
|
||||
|
||||
|
@ -713,11 +713,11 @@ struct intel_uncore {
|
|||
enum forcewake_domain_id id;
|
||||
unsigned wake_count;
|
||||
struct timer_list timer;
|
||||
u32 reg_set;
|
||||
i915_reg_t reg_set;
|
||||
u32 val_set;
|
||||
u32 val_clear;
|
||||
u32 reg_ack;
|
||||
u32 reg_post;
|
||||
i915_reg_t reg_ack;
|
||||
i915_reg_t reg_post;
|
||||
u32 val_reset;
|
||||
} fw_domain[FW_DOMAIN_ID_COUNT];
|
||||
};
|
||||
|
@ -743,7 +743,7 @@ struct intel_csr {
|
|||
uint32_t dmc_fw_size;
|
||||
uint32_t version;
|
||||
uint32_t mmio_count;
|
||||
uint32_t mmioaddr[8];
|
||||
i915_reg_t mmioaddr[8];
|
||||
uint32_t mmiodata[8];
|
||||
};
|
||||
|
||||
|
@ -996,7 +996,7 @@ struct intel_gmbus {
|
|||
struct i2c_adapter adapter;
|
||||
u32 force_bit;
|
||||
u32 reg0;
|
||||
u32 gpio_reg;
|
||||
i915_reg_t gpio_reg;
|
||||
struct i2c_algo_bit_data bit_algo;
|
||||
struct drm_i915_private *dev_priv;
|
||||
};
|
||||
|
@ -1645,7 +1645,7 @@ struct i915_frontbuffer_tracking {
|
|||
};
|
||||
|
||||
struct i915_wa_reg {
|
||||
u32 addr;
|
||||
i915_reg_t addr;
|
||||
u32 value;
|
||||
/* bitmask representing WA bits */
|
||||
u32 mask;
|
||||
|
@ -3434,16 +3434,16 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val);
|
|||
|
||||
#define __raw_read(x, s) \
|
||||
static inline uint##x##_t __raw_i915_read##x(struct drm_i915_private *dev_priv, \
|
||||
uint32_t reg) \
|
||||
i915_reg_t reg) \
|
||||
{ \
|
||||
return read##s(dev_priv->regs + reg); \
|
||||
return read##s(dev_priv->regs + i915_mmio_reg_offset(reg)); \
|
||||
}
|
||||
|
||||
#define __raw_write(x, s) \
|
||||
static inline void __raw_i915_write##x(struct drm_i915_private *dev_priv, \
|
||||
uint32_t reg, uint##x##_t val) \
|
||||
i915_reg_t reg, uint##x##_t val) \
|
||||
{ \
|
||||
write##s(val, dev_priv->regs + reg); \
|
||||
write##s(val, dev_priv->regs + i915_mmio_reg_offset(reg)); \
|
||||
}
|
||||
__raw_read(8, b)
|
||||
__raw_read(16, w)
|
||||
|
@ -3474,7 +3474,7 @@ __raw_write(64, q)
|
|||
#define INTEL_BROADCAST_RGB_FULL 1
|
||||
#define INTEL_BROADCAST_RGB_LIMITED 2
|
||||
|
||||
static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev)
|
||||
static inline i915_reg_t i915_vgacntrl_reg(struct drm_device *dev)
|
||||
{
|
||||
if (IS_VALLEYVIEW(dev))
|
||||
return VLV_VGACNTRL;
|
||||
|
|
|
@ -59,7 +59,7 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
|
|||
struct drm_i915_gem_object *obj)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int fence_reg_lo, fence_reg_hi;
|
||||
i915_reg_t fence_reg_lo, fence_reg_hi;
|
||||
int fence_pitch_shift;
|
||||
|
||||
if (INTEL_INFO(dev)->gen >= 6) {
|
||||
|
|
|
@ -910,7 +910,7 @@ static void i915_record_ring_state(struct drm_device *dev,
|
|||
ering->ctl = I915_READ_CTL(ring);
|
||||
|
||||
if (I915_NEED_GFX_HWS(dev)) {
|
||||
int mmio;
|
||||
i915_reg_t mmio;
|
||||
|
||||
if (IS_GEN7(dev)) {
|
||||
switch (ring->id) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/* Definitions of GuC H/W registers, bits, etc */
|
||||
|
||||
#define GUC_STATUS 0xc000
|
||||
#define GUC_STATUS _MMIO(0xc000)
|
||||
#define GS_BOOTROM_SHIFT 1
|
||||
#define GS_BOOTROM_MASK (0x7F << GS_BOOTROM_SHIFT)
|
||||
#define GS_BOOTROM_RSA_FAILED (0x50 << GS_BOOTROM_SHIFT)
|
||||
|
@ -39,41 +39,41 @@
|
|||
#define GS_MIA_MASK (0x07 << GS_MIA_SHIFT)
|
||||
#define GS_MIA_CORE_STATE (1 << GS_MIA_SHIFT)
|
||||
|
||||
#define SOFT_SCRATCH(n) (0xc180 + ((n) * 4))
|
||||
#define SOFT_SCRATCH(n) _MMIO(0xc180 + (n) * 4)
|
||||
|
||||
#define UOS_RSA_SCRATCH(i) (0xc200 + (i) * 4)
|
||||
#define UOS_RSA_SCRATCH(i) _MMIO(0xc200 + (i) * 4)
|
||||
#define UOS_RSA_SCRATCH_MAX_COUNT 64
|
||||
#define DMA_ADDR_0_LOW 0xc300
|
||||
#define DMA_ADDR_0_HIGH 0xc304
|
||||
#define DMA_ADDR_1_LOW 0xc308
|
||||
#define DMA_ADDR_1_HIGH 0xc30c
|
||||
#define DMA_ADDR_0_LOW _MMIO(0xc300)
|
||||
#define DMA_ADDR_0_HIGH _MMIO(0xc304)
|
||||
#define DMA_ADDR_1_LOW _MMIO(0xc308)
|
||||
#define DMA_ADDR_1_HIGH _MMIO(0xc30c)
|
||||
#define DMA_ADDRESS_SPACE_WOPCM (7 << 16)
|
||||
#define DMA_ADDRESS_SPACE_GTT (8 << 16)
|
||||
#define DMA_COPY_SIZE 0xc310
|
||||
#define DMA_CTRL 0xc314
|
||||
#define DMA_COPY_SIZE _MMIO(0xc310)
|
||||
#define DMA_CTRL _MMIO(0xc314)
|
||||
#define UOS_MOVE (1<<4)
|
||||
#define START_DMA (1<<0)
|
||||
#define DMA_GUC_WOPCM_OFFSET 0xc340
|
||||
#define DMA_GUC_WOPCM_OFFSET _MMIO(0xc340)
|
||||
#define GUC_WOPCM_OFFSET_VALUE 0x80000 /* 512KB */
|
||||
#define GUC_MAX_IDLE_COUNT 0xC3E4
|
||||
#define GUC_MAX_IDLE_COUNT _MMIO(0xC3E4)
|
||||
|
||||
#define GUC_WOPCM_SIZE 0xc050
|
||||
#define GUC_WOPCM_SIZE _MMIO(0xc050)
|
||||
#define GUC_WOPCM_SIZE_VALUE (0x80 << 12) /* 512KB */
|
||||
|
||||
/* GuC addresses below GUC_WOPCM_TOP don't map through the GTT */
|
||||
#define GUC_WOPCM_TOP (GUC_WOPCM_SIZE_VALUE)
|
||||
|
||||
#define GEN8_GT_PM_CONFIG 0x138140
|
||||
#define GEN9LP_GT_PM_CONFIG 0x138140
|
||||
#define GEN9_GT_PM_CONFIG 0x13816c
|
||||
#define GEN8_GT_PM_CONFIG _MMIO(0x138140)
|
||||
#define GEN9LP_GT_PM_CONFIG _MMIO(0x138140)
|
||||
#define GEN9_GT_PM_CONFIG _MMIO(0x13816c)
|
||||
#define GT_DOORBELL_ENABLE (1<<0)
|
||||
|
||||
#define GEN8_GTCR 0x4274
|
||||
#define GEN8_GTCR _MMIO(0x4274)
|
||||
#define GEN8_GTCR_INVALIDATE (1<<0)
|
||||
|
||||
#define GUC_ARAT_C6DIS 0xA178
|
||||
#define GUC_ARAT_C6DIS _MMIO(0xA178)
|
||||
|
||||
#define GUC_SHIM_CONTROL 0xc064
|
||||
#define GUC_SHIM_CONTROL _MMIO(0xc064)
|
||||
#define GUC_DISABLE_SRAM_INIT_TO_ZEROES (1<<0)
|
||||
#define GUC_ENABLE_READ_CACHE_LOGIC (1<<1)
|
||||
#define GUC_ENABLE_MIA_CACHING (1<<2)
|
||||
|
@ -90,21 +90,21 @@
|
|||
GUC_ENABLE_READ_CACHE_FOR_WOPCM_DATA | \
|
||||
GUC_ENABLE_MIA_CLOCK_GATING)
|
||||
|
||||
#define HOST2GUC_INTERRUPT 0xc4c8
|
||||
#define HOST2GUC_INTERRUPT _MMIO(0xc4c8)
|
||||
#define HOST2GUC_TRIGGER (1<<0)
|
||||
|
||||
#define DRBMISC1 0x1984
|
||||
#define DOORBELL_ENABLE (1<<0)
|
||||
|
||||
#define GEN8_DRBREGL(x) (0x1000 + (x) * 8)
|
||||
#define GEN8_DRBREGL(x) _MMIO(0x1000 + (x) * 8)
|
||||
#define GEN8_DRB_VALID (1<<0)
|
||||
#define GEN8_DRBREGU(x) (GEN8_DRBREGL(x) + 4)
|
||||
#define GEN8_DRBREGU(x) _MMIO(0x1000 + (x) * 8 + 4)
|
||||
|
||||
#define DE_GUCRMR 0x44054
|
||||
#define DE_GUCRMR _MMIO(0x44054)
|
||||
|
||||
#define GUC_BCS_RCS_IER 0xC550
|
||||
#define GUC_VCS2_VCS1_IER 0xC554
|
||||
#define GUC_WD_VECS_IER 0xC558
|
||||
#define GUC_PM_P24C_IER 0xC55C
|
||||
#define GUC_BCS_RCS_IER _MMIO(0xC550)
|
||||
#define GUC_VCS2_VCS1_IER _MMIO(0xC554)
|
||||
#define GUC_WD_VECS_IER _MMIO(0xC558)
|
||||
#define GUC_PM_P24C_IER _MMIO(0xC55C)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -258,7 +258,7 @@ static void guc_disable_doorbell(struct intel_guc *guc,
|
|||
struct drm_i915_private *dev_priv = guc_to_i915(guc);
|
||||
struct guc_doorbell_info *doorbell;
|
||||
void *base;
|
||||
int drbreg = GEN8_DRBREGL(client->doorbell_id);
|
||||
i915_reg_t drbreg = GEN8_DRBREGL(client->doorbell_id);
|
||||
int value;
|
||||
|
||||
base = kmap_atomic(i915_gem_object_get_page(client->client_obj, 0));
|
||||
|
|
|
@ -139,7 +139,8 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
|
|||
/*
|
||||
* We should clear IMR at preinstall/uninstall, and just check at postinstall.
|
||||
*/
|
||||
static void gen5_assert_iir_is_zero(struct drm_i915_private *dev_priv, u32 reg)
|
||||
static void gen5_assert_iir_is_zero(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg)
|
||||
{
|
||||
u32 val = I915_READ(reg);
|
||||
|
||||
|
@ -147,7 +148,7 @@ static void gen5_assert_iir_is_zero(struct drm_i915_private *dev_priv, u32 reg)
|
|||
return;
|
||||
|
||||
WARN(1, "Interrupt register 0x%x is not zero: 0x%08x\n",
|
||||
reg, val);
|
||||
i915_mmio_reg_offset(reg), val);
|
||||
I915_WRITE(reg, 0xffffffff);
|
||||
POSTING_READ(reg);
|
||||
I915_WRITE(reg, 0xffffffff);
|
||||
|
@ -283,17 +284,17 @@ void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask)
|
|||
ilk_update_gt_irq(dev_priv, mask, 0);
|
||||
}
|
||||
|
||||
static u32 gen6_pm_iir(struct drm_i915_private *dev_priv)
|
||||
static i915_reg_t gen6_pm_iir(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return INTEL_INFO(dev_priv)->gen >= 8 ? GEN8_GT_IIR(2) : GEN6_PMIIR;
|
||||
}
|
||||
|
||||
static u32 gen6_pm_imr(struct drm_i915_private *dev_priv)
|
||||
static i915_reg_t gen6_pm_imr(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return INTEL_INFO(dev_priv)->gen >= 8 ? GEN8_GT_IMR(2) : GEN6_PMIMR;
|
||||
}
|
||||
|
||||
static u32 gen6_pm_ier(struct drm_i915_private *dev_priv)
|
||||
static i915_reg_t gen6_pm_ier(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return INTEL_INFO(dev_priv)->gen >= 8 ? GEN8_GT_IER(2) : GEN6_PMIER;
|
||||
}
|
||||
|
@ -350,7 +351,7 @@ void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask)
|
|||
void gen6_reset_rps_interrupts(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
uint32_t reg = gen6_pm_iir(dev_priv);
|
||||
i915_reg_t reg = gen6_pm_iir(dev_priv);
|
||||
|
||||
spin_lock_irq(&dev_priv->irq_lock);
|
||||
I915_WRITE(reg, dev_priv->pm_rps_events);
|
||||
|
@ -477,7 +478,7 @@ static void
|
|||
__i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
|
||||
u32 enable_mask, u32 status_mask)
|
||||
{
|
||||
u32 reg = PIPESTAT(pipe);
|
||||
i915_reg_t reg = PIPESTAT(pipe);
|
||||
u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
|
||||
|
||||
assert_spin_locked(&dev_priv->irq_lock);
|
||||
|
@ -504,7 +505,7 @@ static void
|
|||
__i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
|
||||
u32 enable_mask, u32 status_mask)
|
||||
{
|
||||
u32 reg = PIPESTAT(pipe);
|
||||
i915_reg_t reg = PIPESTAT(pipe);
|
||||
u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
|
||||
|
||||
assert_spin_locked(&dev_priv->irq_lock);
|
||||
|
@ -665,8 +666,7 @@ static u32 i8xx_get_vblank_counter(struct drm_device *dev, int pipe)
|
|||
static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
unsigned long high_frame;
|
||||
unsigned long low_frame;
|
||||
i915_reg_t high_frame, low_frame;
|
||||
u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal;
|
||||
struct intel_crtc *intel_crtc =
|
||||
to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
|
||||
|
@ -1186,7 +1186,7 @@ static void ivybridge_parity_work(struct work_struct *work)
|
|||
POSTING_READ(GEN7_MISCCPCTL);
|
||||
|
||||
while ((slice = ffs(dev_priv->l3_parity.which_slice)) != 0) {
|
||||
u32 reg;
|
||||
i915_reg_t reg;
|
||||
|
||||
slice--;
|
||||
if (WARN_ON_ONCE(slice >= NUM_L3_SLICES(dev_priv->dev)))
|
||||
|
@ -1622,7 +1622,7 @@ static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir)
|
|||
|
||||
spin_lock(&dev_priv->irq_lock);
|
||||
for_each_pipe(dev_priv, pipe) {
|
||||
int reg;
|
||||
i915_reg_t reg;
|
||||
u32 mask, iir_bit = 0;
|
||||
|
||||
/*
|
||||
|
@ -3870,7 +3870,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
|
|||
DRM_DEBUG("Command parser error, iir 0x%08x\n", iir);
|
||||
|
||||
for_each_pipe(dev_priv, pipe) {
|
||||
int reg = PIPESTAT(pipe);
|
||||
i915_reg_t reg = PIPESTAT(pipe);
|
||||
pipe_stats[pipe] = I915_READ(reg);
|
||||
|
||||
/*
|
||||
|
@ -4051,7 +4051,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
|
|||
DRM_DEBUG("Command parser error, iir 0x%08x\n", iir);
|
||||
|
||||
for_each_pipe(dev_priv, pipe) {
|
||||
int reg = PIPESTAT(pipe);
|
||||
i915_reg_t reg = PIPESTAT(pipe);
|
||||
pipe_stats[pipe] = I915_READ(reg);
|
||||
|
||||
/* Clear the PIPE*STAT regs before the IIR */
|
||||
|
@ -4272,7 +4272,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
|
|||
DRM_DEBUG("Command parser error, iir 0x%08x\n", iir);
|
||||
|
||||
for_each_pipe(dev_priv, pipe) {
|
||||
int reg = PIPESTAT(pipe);
|
||||
i915_reg_t reg = PIPESTAT(pipe);
|
||||
pipe_stats[pipe] = I915_READ(reg);
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -35,7 +35,8 @@
|
|||
#define dev_to_drm_minor(d) dev_get_drvdata((d))
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static u32 calc_residency(struct drm_device *dev, const u32 reg)
|
||||
static u32 calc_residency(struct drm_device *dev,
|
||||
i915_reg_t reg)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u64 raw_time; /* 32b value may overflow during fixed point math */
|
||||
|
|
|
@ -664,7 +664,7 @@ TRACE_EVENT(i915_flip_complete,
|
|||
);
|
||||
|
||||
TRACE_EVENT_CONDITION(i915_reg_rw,
|
||||
TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace),
|
||||
TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
|
||||
|
||||
TP_ARGS(write, reg, val, len, trace),
|
||||
|
||||
|
@ -679,7 +679,7 @@ TRACE_EVENT_CONDITION(i915_reg_rw,
|
|||
|
||||
TP_fast_assign(
|
||||
__entry->val = (u64)val;
|
||||
__entry->reg = reg;
|
||||
__entry->reg = i915_mmio_reg_offset(reg);
|
||||
__entry->write = write;
|
||||
__entry->len = len;
|
||||
),
|
||||
|
|
|
@ -104,7 +104,7 @@ struct vgt_if {
|
|||
} __packed;
|
||||
|
||||
#define vgtif_reg(x) \
|
||||
(VGT_PVINFO_PAGE + (long)&((struct vgt_if *)NULL)->x)
|
||||
_MMIO((VGT_PVINFO_PAGE + (long)&((struct vgt_if *)NULL)->x))
|
||||
|
||||
/* vGPU display status to be used by the host side */
|
||||
#define VGT_DRV_DISPLAY_NOT_READY 0
|
||||
|
|
|
@ -161,9 +161,9 @@ static bool audio_rate_need_prog(struct intel_crtc *crtc,
|
|||
}
|
||||
|
||||
static bool intel_eld_uptodate(struct drm_connector *connector,
|
||||
int reg_eldv, uint32_t bits_eldv,
|
||||
int reg_elda, uint32_t bits_elda,
|
||||
int reg_edid)
|
||||
i915_reg_t reg_eldv, uint32_t bits_eldv,
|
||||
i915_reg_t reg_elda, uint32_t bits_elda,
|
||||
i915_reg_t reg_edid)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = connector->dev->dev_private;
|
||||
uint8_t *eld = connector->eld;
|
||||
|
@ -364,8 +364,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder)
|
|||
enum port port = intel_dig_port->port;
|
||||
enum pipe pipe = intel_crtc->pipe;
|
||||
uint32_t tmp, eldv;
|
||||
int aud_config;
|
||||
int aud_cntrl_st2;
|
||||
i915_reg_t aud_config, aud_cntrl_st2;
|
||||
|
||||
DRM_DEBUG_KMS("Disable audio codec on port %c, pipe %c\n",
|
||||
port_name(port), pipe_name(pipe));
|
||||
|
@ -416,10 +415,7 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
|
|||
uint32_t eldv;
|
||||
uint32_t tmp;
|
||||
int len, i;
|
||||
int hdmiw_hdmiedid;
|
||||
int aud_config;
|
||||
int aud_cntl_st;
|
||||
int aud_cntrl_st2;
|
||||
i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2;
|
||||
|
||||
DRM_DEBUG_KMS("Enable audio codec on port %c, pipe %c, %u bytes ELD\n",
|
||||
port_name(port), pipe_name(pipe), drm_eld_size(eld));
|
||||
|
|
|
@ -50,7 +50,7 @@ struct intel_crt {
|
|||
* encoder's enable/disable callbacks */
|
||||
struct intel_connector *connector;
|
||||
bool force_hotplug_required;
|
||||
u32 adpa_reg;
|
||||
i915_reg_t adpa_reg;
|
||||
};
|
||||
|
||||
static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder)
|
||||
|
@ -501,12 +501,8 @@ intel_crt_load_detect(struct intel_crt *crt)
|
|||
uint32_t vsample;
|
||||
uint32_t vblank, vblank_start, vblank_end;
|
||||
uint32_t dsl;
|
||||
uint32_t bclrpat_reg;
|
||||
uint32_t vtotal_reg;
|
||||
uint32_t vblank_reg;
|
||||
uint32_t vsync_reg;
|
||||
uint32_t pipeconf_reg;
|
||||
uint32_t pipe_dsl_reg;
|
||||
i915_reg_t bclrpat_reg, vtotal_reg,
|
||||
vblank_reg, vsync_reg, pipeconf_reg, pipe_dsl_reg;
|
||||
uint8_t st00;
|
||||
enum drm_connector_status status;
|
||||
|
||||
|
@ -539,7 +535,7 @@ intel_crt_load_detect(struct intel_crt *crt)
|
|||
/* Wait for next Vblank to substitue
|
||||
* border color for Color info */
|
||||
intel_wait_for_vblank(dev, pipe);
|
||||
st00 = I915_READ8(VGA_MSR_WRITE);
|
||||
st00 = I915_READ8(_VGA_MSR_WRITE);
|
||||
status = ((st00 & (1 << 4)) != 0) ?
|
||||
connector_status_connected :
|
||||
connector_status_disconnected;
|
||||
|
@ -584,7 +580,7 @@ intel_crt_load_detect(struct intel_crt *crt)
|
|||
do {
|
||||
count++;
|
||||
/* Read the ST00 VGA status register */
|
||||
st00 = I915_READ8(VGA_MSR_WRITE);
|
||||
st00 = I915_READ8(_VGA_MSR_WRITE);
|
||||
if (st00 & (1 << 4))
|
||||
detect++;
|
||||
} while ((I915_READ(pipe_dsl_reg) == dsl));
|
||||
|
|
|
@ -334,7 +334,7 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
|
|||
dmc_header->mmioaddr[i]);
|
||||
return NULL;
|
||||
}
|
||||
csr->mmioaddr[i] = dmc_header->mmioaddr[i];
|
||||
csr->mmioaddr[i] = _MMIO(dmc_header->mmioaddr[i]);
|
||||
csr->mmiodata[i] = dmc_header->mmiodata[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
|
|||
static bool
|
||||
intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port)
|
||||
{
|
||||
return intel_dig_port->hdmi.hdmi_reg;
|
||||
return i915_mmio_reg_valid(intel_dig_port->hdmi.hdmi_reg);
|
||||
}
|
||||
|
||||
static const struct ddi_buf_trans *skl_get_buf_trans_dp(struct drm_device *dev,
|
||||
|
@ -576,7 +576,7 @@ void intel_prepare_ddi(struct drm_device *dev)
|
|||
static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
uint32_t reg = DDI_BUF_CTL(port);
|
||||
i915_reg_t reg = DDI_BUF_CTL(port);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
|
@ -931,7 +931,8 @@ static void hsw_wrpll_update_rnp(uint64_t freq2k, unsigned budget,
|
|||
/* Otherwise a < c && b >= d, do nothing */
|
||||
}
|
||||
|
||||
static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv, int reg)
|
||||
static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg)
|
||||
{
|
||||
int refclk = LC_FREQ;
|
||||
int n, p, r;
|
||||
|
@ -967,7 +968,7 @@ static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv, int reg)
|
|||
static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv,
|
||||
uint32_t dpll)
|
||||
{
|
||||
uint32_t cfgcr1_reg, cfgcr2_reg;
|
||||
i915_reg_t cfgcr1_reg, cfgcr2_reg;
|
||||
uint32_t cfgcr1_val, cfgcr2_val;
|
||||
uint32_t p0, p1, p2, dco_freq;
|
||||
|
||||
|
@ -1930,7 +1931,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc)
|
|||
void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
|
||||
enum transcoder cpu_transcoder)
|
||||
{
|
||||
uint32_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
|
||||
i915_reg_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
|
||||
uint32_t val = I915_READ(reg);
|
||||
|
||||
val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_PORT_MASK | TRANS_DDI_DP_VC_PAYLOAD_ALLOC);
|
||||
|
@ -2507,7 +2508,7 @@ static const char * const skl_ddi_pll_names[] = {
|
|||
};
|
||||
|
||||
struct skl_dpll_regs {
|
||||
u32 ctl, cfgcr1, cfgcr2;
|
||||
i915_reg_t ctl, cfgcr1, cfgcr2;
|
||||
};
|
||||
|
||||
/* this array is indexed by the *shared* pll id */
|
||||
|
|
|
@ -1095,7 +1095,7 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
|
|||
static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 reg = PIPEDSL(pipe);
|
||||
i915_reg_t reg = PIPEDSL(pipe);
|
||||
u32 line1, line2;
|
||||
u32 line_mask;
|
||||
|
||||
|
@ -1135,7 +1135,7 @@ static void intel_wait_for_pipe_off(struct intel_crtc *crtc)
|
|||
enum pipe pipe = crtc->pipe;
|
||||
|
||||
if (INTEL_INFO(dev)->gen >= 4) {
|
||||
int reg = PIPECONF(cpu_transcoder);
|
||||
i915_reg_t reg = PIPECONF(cpu_transcoder);
|
||||
|
||||
/* Wait for the Pipe State to go off */
|
||||
if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0,
|
||||
|
@ -1285,7 +1285,7 @@ void assert_panel_unlocked(struct drm_i915_private *dev_priv,
|
|||
enum pipe pipe)
|
||||
{
|
||||
struct drm_device *dev = dev_priv->dev;
|
||||
int pp_reg;
|
||||
i915_reg_t pp_reg;
|
||||
u32 val;
|
||||
enum pipe panel_pipe = PIPE_A;
|
||||
bool locked = true;
|
||||
|
@ -1480,8 +1480,7 @@ static bool dp_pipe_enabled(struct drm_i915_private *dev_priv,
|
|||
return false;
|
||||
|
||||
if (HAS_PCH_CPT(dev_priv->dev)) {
|
||||
u32 trans_dp_ctl_reg = TRANS_DP_CTL(pipe);
|
||||
u32 trans_dp_ctl = I915_READ(trans_dp_ctl_reg);
|
||||
u32 trans_dp_ctl = I915_READ(TRANS_DP_CTL(pipe));
|
||||
if ((trans_dp_ctl & TRANS_DP_PORT_SEL_MASK) != port_sel)
|
||||
return false;
|
||||
} else if (IS_CHERRYVIEW(dev_priv->dev)) {
|
||||
|
@ -1545,12 +1544,13 @@ static bool adpa_pipe_enabled(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
|
||||
static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv,
|
||||
enum pipe pipe, int reg, u32 port_sel)
|
||||
enum pipe pipe, i915_reg_t reg,
|
||||
u32 port_sel)
|
||||
{
|
||||
u32 val = I915_READ(reg);
|
||||
I915_STATE_WARN(dp_pipe_enabled(dev_priv, pipe, port_sel, val),
|
||||
"PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n",
|
||||
reg, pipe_name(pipe));
|
||||
i915_mmio_reg_offset(reg), pipe_name(pipe));
|
||||
|
||||
I915_STATE_WARN(HAS_PCH_IBX(dev_priv->dev) && (val & DP_PORT_EN) == 0
|
||||
&& (val & DP_PIPEB_SELECT),
|
||||
|
@ -1558,12 +1558,12 @@ static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
|
||||
static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv,
|
||||
enum pipe pipe, int reg)
|
||||
enum pipe pipe, i915_reg_t reg)
|
||||
{
|
||||
u32 val = I915_READ(reg);
|
||||
I915_STATE_WARN(hdmi_pipe_enabled(dev_priv, pipe, val),
|
||||
"PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n",
|
||||
reg, pipe_name(pipe));
|
||||
i915_mmio_reg_offset(reg), pipe_name(pipe));
|
||||
|
||||
I915_STATE_WARN(HAS_PCH_IBX(dev_priv->dev) && (val & SDVO_ENABLE) == 0
|
||||
&& (val & SDVO_PIPE_B_SELECT),
|
||||
|
@ -1599,7 +1599,7 @@ static void vlv_enable_pll(struct intel_crtc *crtc,
|
|||
{
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int reg = DPLL(crtc->pipe);
|
||||
i915_reg_t reg = DPLL(crtc->pipe);
|
||||
u32 dpll = pipe_config->dpll_hw_state.dpll;
|
||||
|
||||
assert_pipe_disabled(dev_priv, crtc->pipe);
|
||||
|
@ -1688,7 +1688,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
|
|||
{
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int reg = DPLL(crtc->pipe);
|
||||
i915_reg_t reg = DPLL(crtc->pipe);
|
||||
u32 dpll = crtc->config->dpll_hw_state.dpll;
|
||||
|
||||
assert_pipe_disabled(dev_priv, crtc->pipe);
|
||||
|
@ -1828,7 +1828,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
|
|||
unsigned int expected_mask)
|
||||
{
|
||||
u32 port_mask;
|
||||
int dpll_reg;
|
||||
i915_reg_t dpll_reg;
|
||||
|
||||
switch (dport->port) {
|
||||
case PORT_B:
|
||||
|
@ -1953,7 +1953,8 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
|
|||
struct drm_device *dev = dev_priv->dev;
|
||||
struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
uint32_t reg, val, pipeconf_val;
|
||||
i915_reg_t reg;
|
||||
uint32_t val, pipeconf_val;
|
||||
|
||||
/* PCH only available on ILK+ */
|
||||
BUG_ON(!HAS_PCH_SPLIT(dev));
|
||||
|
@ -2042,7 +2043,8 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,
|
|||
enum pipe pipe)
|
||||
{
|
||||
struct drm_device *dev = dev_priv->dev;
|
||||
uint32_t reg, val;
|
||||
i915_reg_t reg;
|
||||
uint32_t val;
|
||||
|
||||
/* FDI relies on the transcoder */
|
||||
assert_fdi_tx_disabled(dev_priv, pipe);
|
||||
|
@ -2099,7 +2101,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
|
|||
enum pipe pipe = crtc->pipe;
|
||||
enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
|
||||
enum pipe pch_transcoder;
|
||||
int reg;
|
||||
i915_reg_t reg;
|
||||
u32 val;
|
||||
|
||||
DRM_DEBUG_KMS("enabling pipe %c\n", pipe_name(pipe));
|
||||
|
@ -2160,7 +2162,7 @@ static void intel_disable_pipe(struct intel_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
|
||||
enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
|
||||
enum pipe pipe = crtc->pipe;
|
||||
int reg;
|
||||
i915_reg_t reg;
|
||||
u32 val;
|
||||
|
||||
DRM_DEBUG_KMS("disabling pipe %c\n", pipe_name(pipe));
|
||||
|
@ -2659,7 +2661,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
|
|||
int plane = intel_crtc->plane;
|
||||
unsigned long linear_offset;
|
||||
u32 dspcntr;
|
||||
u32 reg = DSPCNTR(plane);
|
||||
i915_reg_t reg = DSPCNTR(plane);
|
||||
int pixel_size;
|
||||
|
||||
if (!visible || !fb) {
|
||||
|
@ -2789,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
|
|||
int plane = intel_crtc->plane;
|
||||
unsigned long linear_offset;
|
||||
u32 dspcntr;
|
||||
u32 reg = DSPCNTR(plane);
|
||||
i915_reg_t reg = DSPCNTR(plane);
|
||||
int pixel_size;
|
||||
|
||||
if (!visible || !fb) {
|
||||
|
@ -3340,7 +3342,8 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp;
|
||||
i915_reg_t reg;
|
||||
u32 temp;
|
||||
|
||||
/* enable normal train */
|
||||
reg = FDI_TX_CTL(pipe);
|
||||
|
@ -3382,7 +3385,8 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp, tries;
|
||||
i915_reg_t reg;
|
||||
u32 temp, tries;
|
||||
|
||||
/* FDI needs bits from pipe first */
|
||||
assert_pipe_enabled(dev_priv, pipe);
|
||||
|
@ -3482,7 +3486,8 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp, i, retry;
|
||||
i915_reg_t reg;
|
||||
u32 temp, i, retry;
|
||||
|
||||
/* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
|
||||
for train result */
|
||||
|
@ -3614,7 +3619,8 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp, i, j;
|
||||
i915_reg_t reg;
|
||||
u32 temp, i, j;
|
||||
|
||||
/* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
|
||||
for train result */
|
||||
|
@ -3731,8 +3737,8 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc)
|
|||
struct drm_device *dev = intel_crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp;
|
||||
|
||||
i915_reg_t reg;
|
||||
u32 temp;
|
||||
|
||||
/* enable PCH FDI RX PLL, wait warmup plus DMI latency */
|
||||
reg = FDI_RX_CTL(pipe);
|
||||
|
@ -3768,7 +3774,8 @@ static void ironlake_fdi_pll_disable(struct intel_crtc *intel_crtc)
|
|||
struct drm_device *dev = intel_crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp;
|
||||
i915_reg_t reg;
|
||||
u32 temp;
|
||||
|
||||
/* Switch from PCDclk to Rawclk */
|
||||
reg = FDI_RX_CTL(pipe);
|
||||
|
@ -3798,7 +3805,8 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp;
|
||||
i915_reg_t reg;
|
||||
u32 temp;
|
||||
|
||||
/* disable CPU FDI tx and PCH FDI rx */
|
||||
reg = FDI_TX_CTL(pipe);
|
||||
|
@ -4108,7 +4116,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp;
|
||||
u32 temp;
|
||||
|
||||
assert_pch_transcoder_disabled(dev_priv, pipe);
|
||||
|
||||
|
@ -4158,7 +4166,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
|
|||
const struct drm_display_mode *adjusted_mode =
|
||||
&intel_crtc->config->base.adjusted_mode;
|
||||
u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
|
||||
reg = TRANS_DP_CTL(pipe);
|
||||
i915_reg_t reg = TRANS_DP_CTL(pipe);
|
||||
temp = I915_READ(reg);
|
||||
temp &= ~(TRANS_DP_PORT_SEL_MASK |
|
||||
TRANS_DP_SYNC_MASK |
|
||||
|
@ -4315,7 +4323,7 @@ static void intel_shared_dpll_commit(struct drm_atomic_state *state)
|
|||
static void cpt_verify_modeset(struct drm_device *dev, int pipe)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int dslreg = PIPEDSL(pipe);
|
||||
i915_reg_t dslreg = PIPEDSL(pipe);
|
||||
u32 temp;
|
||||
|
||||
temp = I915_READ(dslreg);
|
||||
|
@ -4625,7 +4633,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
|
|||
}
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
u32 palreg;
|
||||
i915_reg_t palreg;
|
||||
|
||||
if (HAS_GMCH_DISPLAY(dev))
|
||||
palreg = PALETTE(pipe, i);
|
||||
|
@ -5032,7 +5040,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
|
|||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
struct intel_encoder *encoder;
|
||||
int pipe = intel_crtc->pipe;
|
||||
u32 reg, temp;
|
||||
|
||||
if (intel_crtc->config->has_pch_encoder)
|
||||
intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
|
||||
|
@ -5058,6 +5065,9 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
|
|||
ironlake_disable_pch_transcoder(dev_priv, pipe);
|
||||
|
||||
if (HAS_PCH_CPT(dev)) {
|
||||
i915_reg_t reg;
|
||||
u32 temp;
|
||||
|
||||
/* disable TRANS_DP_CTL */
|
||||
reg = TRANS_DP_CTL(pipe);
|
||||
temp = I915_READ(reg);
|
||||
|
@ -7413,7 +7423,7 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
|
|||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int pipe = crtc->pipe;
|
||||
int dpll_reg = DPLL(crtc->pipe);
|
||||
i915_reg_t dpll_reg = DPLL(crtc->pipe);
|
||||
enum dpio_channel port = vlv_pipe_to_channel(pipe);
|
||||
u32 loopfilter, tribuf_calcntr;
|
||||
u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
|
||||
|
@ -11226,10 +11236,9 @@ static void ilk_do_mmio_flip(struct intel_crtc *intel_crtc,
|
|||
struct intel_framebuffer *intel_fb =
|
||||
to_intel_framebuffer(intel_crtc->base.primary->fb);
|
||||
struct drm_i915_gem_object *obj = intel_fb->obj;
|
||||
i915_reg_t reg = DSPCNTR(intel_crtc->plane);
|
||||
u32 dspcntr;
|
||||
u32 reg;
|
||||
|
||||
reg = DSPCNTR(intel_crtc->plane);
|
||||
dspcntr = I915_READ(reg);
|
||||
|
||||
if (obj->tiling_mode != I915_TILING_NONE)
|
||||
|
@ -14991,7 +15000,7 @@ static void i915_disable_vga(struct drm_device *dev)
|
|||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u8 sr1;
|
||||
u32 vga_reg = i915_vgacntrl_reg(dev);
|
||||
i915_reg_t vga_reg = i915_vgacntrl_reg(dev);
|
||||
|
||||
/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
|
||||
vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
|
||||
|
@ -15193,10 +15202,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
|
|||
{
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 reg;
|
||||
i915_reg_t reg = PIPECONF(crtc->config->cpu_transcoder);
|
||||
|
||||
/* Clear any frame start delays used for debugging left by the BIOS */
|
||||
reg = PIPECONF(crtc->config->cpu_transcoder);
|
||||
I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
|
||||
|
||||
/* restore vblank interrupts to correct state */
|
||||
|
@ -15350,7 +15358,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
|
|||
void i915_redisable_vga_power_on(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 vga_reg = i915_vgacntrl_reg(dev);
|
||||
i915_reg_t vga_reg = i915_vgacntrl_reg(dev);
|
||||
|
||||
if (!(I915_READ(vga_reg) & VGA_DISP_DISABLE)) {
|
||||
DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
|
||||
|
|
|
@ -541,7 +541,8 @@ void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv)
|
|||
}
|
||||
}
|
||||
|
||||
static u32 _pp_ctrl_reg(struct intel_dp *intel_dp)
|
||||
static i915_reg_t
|
||||
_pp_ctrl_reg(struct intel_dp *intel_dp)
|
||||
{
|
||||
struct drm_device *dev = intel_dp_to_dev(intel_dp);
|
||||
|
||||
|
@ -553,7 +554,8 @@ static u32 _pp_ctrl_reg(struct intel_dp *intel_dp)
|
|||
return VLV_PIPE_PP_CONTROL(vlv_power_sequencer_pipe(intel_dp));
|
||||
}
|
||||
|
||||
static u32 _pp_stat_reg(struct intel_dp *intel_dp)
|
||||
static i915_reg_t
|
||||
_pp_stat_reg(struct intel_dp *intel_dp)
|
||||
{
|
||||
struct drm_device *dev = intel_dp_to_dev(intel_dp);
|
||||
|
||||
|
@ -582,7 +584,7 @@ static int edp_notify_handler(struct notifier_block *this, unsigned long code,
|
|||
|
||||
if (IS_VALLEYVIEW(dev)) {
|
||||
enum pipe pipe = vlv_power_sequencer_pipe(intel_dp);
|
||||
u32 pp_ctrl_reg, pp_div_reg;
|
||||
i915_reg_t pp_ctrl_reg, pp_div_reg;
|
||||
u32 pp_div;
|
||||
|
||||
pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe);
|
||||
|
@ -652,7 +654,7 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq)
|
|||
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
|
||||
struct drm_device *dev = intel_dig_port->base.base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
|
||||
i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg;
|
||||
uint32_t status;
|
||||
bool done;
|
||||
|
||||
|
@ -789,7 +791,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
|
|||
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
|
||||
struct drm_device *dev = intel_dig_port->base.base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
|
||||
i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg;
|
||||
uint32_t aux_clock_divider;
|
||||
int i, ret, recv_bytes;
|
||||
uint32_t status;
|
||||
|
@ -1004,8 +1006,8 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static uint32_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
switch (port) {
|
||||
case PORT_B:
|
||||
|
@ -1018,8 +1020,8 @@ static uint32_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t g4x_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
static i915_reg_t g4x_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
{
|
||||
switch (port) {
|
||||
case PORT_B:
|
||||
|
@ -1032,8 +1034,8 @@ static uint32_t g4x_aux_data_reg(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
static i915_reg_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
switch (port) {
|
||||
case PORT_A:
|
||||
|
@ -1048,8 +1050,8 @@ static uint32_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
{
|
||||
switch (port) {
|
||||
case PORT_A:
|
||||
|
@ -1088,8 +1090,8 @@ static enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
if (port == PORT_E)
|
||||
port = skl_porte_aux_port(dev_priv);
|
||||
|
@ -1106,8 +1108,8 @@ static uint32_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
{
|
||||
if (port == PORT_E)
|
||||
port = skl_porte_aux_port(dev_priv);
|
||||
|
@ -1124,8 +1126,8 @@ static uint32_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
static i915_reg_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
if (INTEL_INFO(dev_priv)->gen >= 9)
|
||||
return skl_aux_ctl_reg(dev_priv, port);
|
||||
|
@ -1135,8 +1137,8 @@ static uint32_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
|||
return g4x_aux_ctl_reg(dev_priv, port);
|
||||
}
|
||||
|
||||
static uint32_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
{
|
||||
if (INTEL_INFO(dev_priv)->gen >= 9)
|
||||
return skl_aux_data_reg(dev_priv, port, index);
|
||||
|
@ -1755,7 +1757,7 @@ static void wait_panel_status(struct intel_dp *intel_dp,
|
|||
{
|
||||
struct drm_device *dev = intel_dp_to_dev(intel_dp);
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 pp_stat_reg, pp_ctrl_reg;
|
||||
i915_reg_t pp_stat_reg, pp_ctrl_reg;
|
||||
|
||||
lockdep_assert_held(&dev_priv->pps_mutex);
|
||||
|
||||
|
@ -1845,7 +1847,7 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
enum intel_display_power_domain power_domain;
|
||||
u32 pp;
|
||||
u32 pp_stat_reg, pp_ctrl_reg;
|
||||
i915_reg_t pp_stat_reg, pp_ctrl_reg;
|
||||
bool need_to_disable = !intel_dp->want_panel_vdd;
|
||||
|
||||
lockdep_assert_held(&dev_priv->pps_mutex);
|
||||
|
@ -1921,7 +1923,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
|
|||
struct intel_encoder *intel_encoder = &intel_dig_port->base;
|
||||
enum intel_display_power_domain power_domain;
|
||||
u32 pp;
|
||||
u32 pp_stat_reg, pp_ctrl_reg;
|
||||
i915_reg_t pp_stat_reg, pp_ctrl_reg;
|
||||
|
||||
lockdep_assert_held(&dev_priv->pps_mutex);
|
||||
|
||||
|
@ -2008,7 +2010,7 @@ static void edp_panel_on(struct intel_dp *intel_dp)
|
|||
struct drm_device *dev = intel_dp_to_dev(intel_dp);
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 pp;
|
||||
u32 pp_ctrl_reg;
|
||||
i915_reg_t pp_ctrl_reg;
|
||||
|
||||
lockdep_assert_held(&dev_priv->pps_mutex);
|
||||
|
||||
|
@ -2070,7 +2072,7 @@ static void edp_panel_off(struct intel_dp *intel_dp)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
enum intel_display_power_domain power_domain;
|
||||
u32 pp;
|
||||
u32 pp_ctrl_reg;
|
||||
i915_reg_t pp_ctrl_reg;
|
||||
|
||||
lockdep_assert_held(&dev_priv->pps_mutex);
|
||||
|
||||
|
@ -2121,7 +2123,7 @@ static void _intel_edp_backlight_on(struct intel_dp *intel_dp)
|
|||
struct drm_device *dev = intel_dig_port->base.base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 pp;
|
||||
u32 pp_ctrl_reg;
|
||||
i915_reg_t pp_ctrl_reg;
|
||||
|
||||
/*
|
||||
* If we enable the backlight right away following a panel power
|
||||
|
@ -2162,7 +2164,7 @@ static void _intel_edp_backlight_off(struct intel_dp *intel_dp)
|
|||
struct drm_device *dev = intel_dp_to_dev(intel_dp);
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 pp;
|
||||
u32 pp_ctrl_reg;
|
||||
i915_reg_t pp_ctrl_reg;
|
||||
|
||||
if (!is_edp(intel_dp))
|
||||
return;
|
||||
|
@ -2364,7 +2366,7 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder,
|
|||
}
|
||||
|
||||
DRM_DEBUG_KMS("No pipe for dp port 0x%x found\n",
|
||||
intel_dp->output_reg);
|
||||
i915_mmio_reg_offset(intel_dp->output_reg));
|
||||
} else if (IS_CHERRYVIEW(dev)) {
|
||||
*pipe = DP_PORT_TO_PIPE_CHV(tmp);
|
||||
} else {
|
||||
|
@ -2783,7 +2785,7 @@ static void vlv_detach_power_sequencer(struct intel_dp *intel_dp)
|
|||
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
|
||||
struct drm_i915_private *dev_priv = intel_dig_port->base.base.dev->dev_private;
|
||||
enum pipe pipe = intel_dp->pps_pipe;
|
||||
int pp_on_reg = VLV_PIPE_PP_ON_DELAYS(pipe);
|
||||
i915_reg_t pp_on_reg = VLV_PIPE_PP_ON_DELAYS(pipe);
|
||||
|
||||
edp_panel_vdd_off_sync(intel_dp);
|
||||
|
||||
|
@ -5134,7 +5136,7 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
|
|||
struct edp_power_seq cur, vbt, spec,
|
||||
*final = &intel_dp->pps_delays;
|
||||
u32 pp_on, pp_off, pp_div = 0, pp_ctl = 0;
|
||||
int pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg = 0;
|
||||
i915_reg_t pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg;
|
||||
|
||||
lockdep_assert_held(&dev_priv->pps_mutex);
|
||||
|
||||
|
@ -5256,7 +5258,7 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 pp_on, pp_off, pp_div, port_sel = 0;
|
||||
int div = HAS_PCH_SPLIT(dev) ? intel_pch_rawclk(dev) : intel_hrawclk(dev);
|
||||
int pp_on_reg, pp_off_reg, pp_div_reg = 0, pp_ctrl_reg;
|
||||
i915_reg_t pp_on_reg, pp_off_reg, pp_div_reg, pp_ctrl_reg;
|
||||
enum port port = dp_to_dig_port(intel_dp)->port;
|
||||
const struct edp_power_seq *seq = &intel_dp->pps_delays;
|
||||
|
||||
|
@ -5418,7 +5420,7 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
|
|||
DRM_ERROR("Unsupported refreshrate type\n");
|
||||
}
|
||||
} else if (INTEL_INFO(dev)->gen > 6) {
|
||||
u32 reg = PIPECONF(intel_crtc->config->cpu_transcoder);
|
||||
i915_reg_t reg = PIPECONF(intel_crtc->config->cpu_transcoder);
|
||||
u32 val;
|
||||
|
||||
val = I915_READ(reg);
|
||||
|
@ -5986,7 +5988,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
|
|||
}
|
||||
|
||||
void
|
||||
intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
|
||||
intel_dp_init(struct drm_device *dev,
|
||||
i915_reg_t output_reg, enum port port)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_digital_port *intel_dig_port;
|
||||
|
|
|
@ -696,7 +696,7 @@ struct cxsr_latency {
|
|||
#define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL)
|
||||
|
||||
struct intel_hdmi {
|
||||
u32 hdmi_reg;
|
||||
i915_reg_t hdmi_reg;
|
||||
int ddc_bus;
|
||||
bool limited_color_range;
|
||||
bool color_range_auto;
|
||||
|
@ -739,9 +739,9 @@ enum link_m_n_set {
|
|||
};
|
||||
|
||||
struct intel_dp {
|
||||
uint32_t output_reg;
|
||||
uint32_t aux_ch_ctl_reg;
|
||||
uint32_t aux_ch_data_reg[5];
|
||||
i915_reg_t output_reg;
|
||||
i915_reg_t aux_ch_ctl_reg;
|
||||
i915_reg_t aux_ch_data_reg[5];
|
||||
uint32_t DP;
|
||||
int link_rate;
|
||||
uint8_t lane_count;
|
||||
|
@ -1221,7 +1221,7 @@ void intel_csr_load_program(struct drm_i915_private *);
|
|||
void intel_csr_ucode_fini(struct drm_i915_private *);
|
||||
|
||||
/* intel_dp.c */
|
||||
void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
|
||||
void intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
|
||||
bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
|
||||
struct intel_connector *intel_connector);
|
||||
void intel_dp_set_link_params(struct intel_dp *intel_dp,
|
||||
|
@ -1331,7 +1331,7 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv,
|
|||
void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);
|
||||
|
||||
/* intel_hdmi.c */
|
||||
void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port);
|
||||
void intel_hdmi_init(struct drm_device *dev, i915_reg_t hdmi_reg, enum port port);
|
||||
void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
|
||||
struct intel_connector *intel_connector);
|
||||
struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
|
||||
|
@ -1465,7 +1465,8 @@ void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
|
|||
uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config);
|
||||
|
||||
/* intel_sdvo.c */
|
||||
bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, enum port port);
|
||||
bool intel_sdvo_init(struct drm_device *dev,
|
||||
i915_reg_t reg, enum port port);
|
||||
|
||||
|
||||
/* intel_sprite.c */
|
||||
|
|
|
@ -60,7 +60,8 @@ static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi, enum port port)
|
|||
DRM_ERROR("DPI FIFOs are not empty\n");
|
||||
}
|
||||
|
||||
static void write_data(struct drm_i915_private *dev_priv, u32 reg,
|
||||
static void write_data(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg,
|
||||
const u8 *data, u32 len)
|
||||
{
|
||||
u32 i, j;
|
||||
|
@ -75,7 +76,8 @@ static void write_data(struct drm_i915_private *dev_priv, u32 reg,
|
|||
}
|
||||
}
|
||||
|
||||
static void read_data(struct drm_i915_private *dev_priv, u32 reg,
|
||||
static void read_data(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg,
|
||||
u8 *data, u32 len)
|
||||
{
|
||||
u32 i, j;
|
||||
|
@ -98,7 +100,8 @@ static ssize_t intel_dsi_host_transfer(struct mipi_dsi_host *host,
|
|||
struct mipi_dsi_packet packet;
|
||||
ssize_t ret;
|
||||
const u8 *header, *data;
|
||||
u32 data_reg, data_mask, ctrl_reg, ctrl_mask;
|
||||
i915_reg_t data_reg, ctrl_reg;
|
||||
u32 data_mask, ctrl_mask;
|
||||
|
||||
ret = mipi_dsi_create_packet(&packet, msg);
|
||||
if (ret < 0)
|
||||
|
@ -377,10 +380,10 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder)
|
|||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
|
||||
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
|
||||
enum port port;
|
||||
u32 temp;
|
||||
u32 port_ctrl;
|
||||
|
||||
if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) {
|
||||
u32 temp;
|
||||
|
||||
temp = I915_READ(VLV_CHICKEN_3);
|
||||
temp &= ~PIXEL_OVERLAP_CNT_MASK |
|
||||
intel_dsi->pixel_overlap <<
|
||||
|
@ -389,8 +392,9 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder)
|
|||
}
|
||||
|
||||
for_each_dsi_port(port, intel_dsi->ports) {
|
||||
port_ctrl = IS_BROXTON(dev) ? BXT_MIPI_PORT_CTRL(port) :
|
||||
MIPI_PORT_CTRL(port);
|
||||
i915_reg_t port_ctrl = IS_BROXTON(dev) ?
|
||||
BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(port);
|
||||
u32 temp;
|
||||
|
||||
temp = I915_READ(port_ctrl);
|
||||
|
||||
|
@ -416,13 +420,13 @@ static void intel_dsi_port_disable(struct intel_encoder *encoder)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
|
||||
enum port port;
|
||||
u32 temp;
|
||||
u32 port_ctrl;
|
||||
|
||||
for_each_dsi_port(port, intel_dsi->ports) {
|
||||
i915_reg_t port_ctrl = IS_BROXTON(dev) ?
|
||||
BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(port);
|
||||
u32 temp;
|
||||
|
||||
/* de-assert ip_tg_enable signal */
|
||||
port_ctrl = IS_BROXTON(dev) ? BXT_MIPI_PORT_CTRL(port) :
|
||||
MIPI_PORT_CTRL(port);
|
||||
temp = I915_READ(port_ctrl);
|
||||
I915_WRITE(port_ctrl, temp & ~DPI_ENABLE);
|
||||
POSTING_READ(port_ctrl);
|
||||
|
@ -580,11 +584,13 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
|
|||
struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
|
||||
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
|
||||
enum port port;
|
||||
u32 val;
|
||||
u32 port_ctrl = 0;
|
||||
|
||||
DRM_DEBUG_KMS("\n");
|
||||
for_each_dsi_port(port, intel_dsi->ports) {
|
||||
/* Common bit for both MIPI Port A & MIPI Port C on VLV/CHV */
|
||||
i915_reg_t port_ctrl = IS_BROXTON(dev) ?
|
||||
BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(PORT_A);
|
||||
u32 val;
|
||||
|
||||
I915_WRITE(MIPI_DEVICE_READY(port), DEVICE_READY |
|
||||
ULPS_STATE_ENTER);
|
||||
|
@ -598,12 +604,6 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
|
|||
ULPS_STATE_ENTER);
|
||||
usleep_range(2000, 2500);
|
||||
|
||||
if (IS_BROXTON(dev))
|
||||
port_ctrl = BXT_MIPI_PORT_CTRL(port);
|
||||
else if (IS_VALLEYVIEW(dev))
|
||||
/* Common bit for both MIPI Port A & MIPI Port C */
|
||||
port_ctrl = MIPI_PORT_CTRL(PORT_A);
|
||||
|
||||
/* Wait till Clock lanes are in LP-00 state for MIPI Port A
|
||||
* only. MIPI Port C has no similar bit for checking
|
||||
*/
|
||||
|
@ -656,7 +656,6 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
|
|||
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
enum intel_display_power_domain power_domain;
|
||||
u32 dpi_enabled, func, ctrl_reg;
|
||||
enum port port;
|
||||
|
||||
DRM_DEBUG_KMS("\n");
|
||||
|
@ -667,9 +666,11 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
|
|||
|
||||
/* XXX: this only works for one DSI output */
|
||||
for_each_dsi_port(port, intel_dsi->ports) {
|
||||
i915_reg_t ctrl_reg = IS_BROXTON(dev) ?
|
||||
BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(port);
|
||||
u32 dpi_enabled, func;
|
||||
|
||||
func = I915_READ(MIPI_DSI_FUNC_PRG(port));
|
||||
ctrl_reg = IS_BROXTON(dev) ? BXT_MIPI_PORT_CTRL(port) :
|
||||
MIPI_PORT_CTRL(port);
|
||||
dpi_enabled = I915_READ(ctrl_reg) & DPI_ENABLE;
|
||||
|
||||
/* Due to some hardware limitations on BYT, MIPI Port C DPI
|
||||
|
|
|
@ -178,7 +178,7 @@ static void intel_disable_dvo(struct intel_encoder *encoder)
|
|||
{
|
||||
struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
|
||||
struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
|
||||
u32 dvo_reg = intel_dvo->dev.dvo_reg;
|
||||
i915_reg_t dvo_reg = intel_dvo->dev.dvo_reg;
|
||||
u32 temp = I915_READ(dvo_reg);
|
||||
|
||||
intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, false);
|
||||
|
@ -191,7 +191,7 @@ static void intel_enable_dvo(struct intel_encoder *encoder)
|
|||
struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
|
||||
struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
|
||||
struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
|
||||
u32 dvo_reg = intel_dvo->dev.dvo_reg;
|
||||
i915_reg_t dvo_reg = intel_dvo->dev.dvo_reg;
|
||||
u32 temp = I915_READ(dvo_reg);
|
||||
|
||||
intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev,
|
||||
|
@ -262,8 +262,8 @@ static void intel_dvo_pre_enable(struct intel_encoder *encoder)
|
|||
struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
|
||||
int pipe = crtc->pipe;
|
||||
u32 dvo_val;
|
||||
u32 dvo_reg = intel_dvo->dev.dvo_reg;
|
||||
u32 dvo_srcdim_reg = intel_dvo->dev.dvo_srcdim_reg;
|
||||
i915_reg_t dvo_reg = intel_dvo->dev.dvo_reg;
|
||||
i915_reg_t dvo_srcdim_reg = intel_dvo->dev.dvo_srcdim_reg;
|
||||
|
||||
/* Save the data order, since I don't know what it should be set to. */
|
||||
dvo_val = I915_READ(dvo_reg) &
|
||||
|
|
|
@ -87,7 +87,7 @@ static bool cpt_can_enable_serr_int(struct drm_device *dev)
|
|||
static void i9xx_check_fifo_underruns(struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
u32 reg = PIPESTAT(crtc->pipe);
|
||||
i915_reg_t reg = PIPESTAT(crtc->pipe);
|
||||
u32 pipestat = I915_READ(reg) & 0xffff0000;
|
||||
|
||||
assert_spin_locked(&dev_priv->irq_lock);
|
||||
|
@ -106,7 +106,7 @@ static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev,
|
|||
bool enable, bool old)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 reg = PIPESTAT(pipe);
|
||||
i915_reg_t reg = PIPESTAT(pipe);
|
||||
u32 pipestat = I915_READ(reg) & 0xffff0000;
|
||||
|
||||
assert_spin_locked(&dev_priv->irq_lock);
|
||||
|
|
|
@ -113,10 +113,11 @@ static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type)
|
|||
}
|
||||
}
|
||||
|
||||
static u32 hsw_dip_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum transcoder cpu_transcoder,
|
||||
enum hdmi_infoframe_type type,
|
||||
int i)
|
||||
static i915_reg_t
|
||||
hsw_dip_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum transcoder cpu_transcoder,
|
||||
enum hdmi_infoframe_type type,
|
||||
int i)
|
||||
{
|
||||
switch (type) {
|
||||
case HDMI_INFOFRAME_TYPE_AVI:
|
||||
|
@ -127,7 +128,7 @@ static u32 hsw_dip_data_reg(struct drm_i915_private *dev_priv,
|
|||
return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i);
|
||||
default:
|
||||
DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
|
||||
return 0;
|
||||
return INVALID_MMIO_REG;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,8 +194,9 @@ static void ibx_write_infoframe(struct drm_encoder *encoder,
|
|||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
int i;
|
||||
|
||||
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
|
||||
|
||||
|
@ -229,7 +231,7 @@ static bool ibx_infoframe_enabled(struct drm_encoder *encoder)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
|
||||
int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
|
||||
if ((val & VIDEO_DIP_ENABLE) == 0)
|
||||
|
@ -251,8 +253,9 @@ static void cpt_write_infoframe(struct drm_encoder *encoder,
|
|||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
int i;
|
||||
|
||||
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
|
||||
|
||||
|
@ -289,8 +292,7 @@ static bool cpt_infoframe_enabled(struct drm_encoder *encoder)
|
|||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
u32 val = I915_READ(TVIDEO_DIP_CTL(intel_crtc->pipe));
|
||||
|
||||
if ((val & VIDEO_DIP_ENABLE) == 0)
|
||||
return false;
|
||||
|
@ -308,8 +310,9 @@ static void vlv_write_infoframe(struct drm_encoder *encoder,
|
|||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
int i, reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
int i;
|
||||
|
||||
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
|
||||
|
||||
|
@ -344,8 +347,7 @@ static bool vlv_infoframe_enabled(struct drm_encoder *encoder)
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
|
||||
int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
u32 val = I915_READ(VLV_TVIDEO_DIP_CTL(intel_crtc->pipe));
|
||||
|
||||
if ((val & VIDEO_DIP_ENABLE) == 0)
|
||||
return false;
|
||||
|
@ -367,13 +369,13 @@ static void hsw_write_infoframe(struct drm_encoder *encoder,
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
|
||||
u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
|
||||
u32 data_reg;
|
||||
i915_reg_t ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
|
||||
i915_reg_t data_reg;
|
||||
int i;
|
||||
u32 val = I915_READ(ctl_reg);
|
||||
|
||||
data_reg = hsw_dip_data_reg(dev_priv, cpu_transcoder, type, 0);
|
||||
if (data_reg == 0)
|
||||
if (i915_mmio_reg_valid(data_reg))
|
||||
return;
|
||||
|
||||
val &= ~hsw_infoframe_enable(type);
|
||||
|
@ -401,8 +403,7 @@ static bool hsw_infoframe_enabled(struct drm_encoder *encoder)
|
|||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
|
||||
u32 val = I915_READ(ctl_reg);
|
||||
u32 val = I915_READ(HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder));
|
||||
|
||||
return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
|
||||
VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
|
||||
|
@ -513,7 +514,7 @@ static void g4x_set_infoframes(struct drm_encoder *encoder,
|
|||
struct drm_i915_private *dev_priv = encoder->dev->dev_private;
|
||||
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
|
||||
struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
|
||||
u32 reg = VIDEO_DIP_CTL;
|
||||
i915_reg_t reg = VIDEO_DIP_CTL;
|
||||
u32 val = I915_READ(reg);
|
||||
u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
|
||||
|
||||
|
@ -633,7 +634,8 @@ static bool intel_hdmi_set_gcp_infoframe(struct drm_encoder *encoder)
|
|||
{
|
||||
struct drm_i915_private *dev_priv = encoder->dev->dev_private;
|
||||
struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
|
||||
u32 reg, val = 0;
|
||||
i915_reg_t reg;
|
||||
u32 val = 0;
|
||||
|
||||
if (HAS_DDI(dev_priv))
|
||||
reg = HSW_TVIDEO_DIP_GCP(crtc->config->cpu_transcoder);
|
||||
|
@ -666,7 +668,7 @@ static void ibx_set_infoframes(struct drm_encoder *encoder,
|
|||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
|
||||
struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
|
||||
u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
|
||||
|
||||
|
@ -717,7 +719,7 @@ static void cpt_set_infoframes(struct drm_encoder *encoder,
|
|||
struct drm_i915_private *dev_priv = encoder->dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
|
||||
assert_hdmi_port_disabled(intel_hdmi);
|
||||
|
@ -760,7 +762,7 @@ static void vlv_set_infoframes(struct drm_encoder *encoder,
|
|||
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
i915_reg_t reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
|
||||
u32 val = I915_READ(reg);
|
||||
u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
|
||||
|
||||
|
@ -811,7 +813,7 @@ static void hsw_set_infoframes(struct drm_encoder *encoder,
|
|||
struct drm_i915_private *dev_priv = encoder->dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
|
||||
i915_reg_t reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
|
||||
u32 val = I915_READ(reg);
|
||||
|
||||
assert_hdmi_port_disabled(intel_hdmi);
|
||||
|
@ -2138,7 +2140,8 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
|
|||
}
|
||||
}
|
||||
|
||||
void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
|
||||
void intel_hdmi_init(struct drm_device *dev,
|
||||
i915_reg_t hdmi_reg, enum port port)
|
||||
{
|
||||
struct intel_digital_port *intel_dig_port;
|
||||
struct intel_encoder *intel_encoder;
|
||||
|
@ -2209,7 +2212,7 @@ void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
|
|||
|
||||
intel_dig_port->port = port;
|
||||
intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
|
||||
intel_dig_port->dp.output_reg = 0;
|
||||
intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
|
||||
|
||||
intel_hdmi_init_connector(intel_dig_port, intel_connector);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
struct gmbus_pin {
|
||||
const char *name;
|
||||
int reg;
|
||||
i915_reg_t reg;
|
||||
};
|
||||
|
||||
/* Map gmbus pin pairs to names and registers. */
|
||||
|
@ -96,7 +96,8 @@ bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv,
|
|||
else
|
||||
size = ARRAY_SIZE(gmbus_pins);
|
||||
|
||||
return pin < size && get_gmbus_pin(dev_priv, pin)->reg;
|
||||
return pin < size &&
|
||||
i915_mmio_reg_valid(get_gmbus_pin(dev_priv, pin)->reg);
|
||||
}
|
||||
|
||||
/* Intel GPIO access functions */
|
||||
|
@ -240,9 +241,8 @@ intel_gpio_setup(struct intel_gmbus *bus, unsigned int pin)
|
|||
|
||||
algo = &bus->bit_algo;
|
||||
|
||||
bus->gpio_reg = dev_priv->gpio_mmio_base +
|
||||
get_gmbus_pin(dev_priv, pin)->reg;
|
||||
|
||||
bus->gpio_reg = _MMIO(dev_priv->gpio_mmio_base +
|
||||
i915_mmio_reg_offset(get_gmbus_pin(dev_priv, pin)->reg));
|
||||
bus->adapter.algo_data = algo;
|
||||
algo->setsda = set_data;
|
||||
algo->setscl = set_clock;
|
||||
|
@ -631,8 +631,10 @@ int intel_setup_gmbus(struct drm_device *dev)
|
|||
|
||||
if (IS_VALLEYVIEW(dev))
|
||||
dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE;
|
||||
else if (!HAS_GMCH_DISPLAY(dev))
|
||||
dev_priv->gpio_mmio_base = PCH_GPIOA - GPIOA;
|
||||
else if (!HAS_GMCH_DISPLAY(dev_priv))
|
||||
dev_priv->gpio_mmio_base =
|
||||
i915_mmio_reg_offset(PCH_GPIOA) -
|
||||
i915_mmio_reg_offset(GPIOA);
|
||||
|
||||
mutex_init(&dev_priv->gmbus_mutex);
|
||||
init_waitqueue_head(&dev_priv->gmbus_wait_queue);
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
#define GEN8_CTX_PRIVILEGE (1<<8)
|
||||
|
||||
#define ASSIGN_CTX_REG(reg_state, pos, reg, val) do { \
|
||||
(reg_state)[(pos)+0] = (reg); \
|
||||
(reg_state)[(pos)+0] = i915_mmio_reg_offset(reg); \
|
||||
(reg_state)[(pos)+1] = (val); \
|
||||
} while (0)
|
||||
|
||||
|
@ -1124,7 +1124,7 @@ static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req)
|
|||
} while (0)
|
||||
|
||||
#define wa_ctx_emit_reg(batch, index, reg) \
|
||||
wa_ctx_emit((batch), (index), (reg))
|
||||
wa_ctx_emit((batch), (index), i915_mmio_reg_offset(reg))
|
||||
|
||||
/*
|
||||
* In this WA we need to set GEN8_L3SQCREG4[21:21] and reset it after
|
||||
|
|
|
@ -27,16 +27,16 @@
|
|||
#define GEN8_LR_CONTEXT_ALIGN 4096
|
||||
|
||||
/* Execlists regs */
|
||||
#define RING_ELSP(ring) ((ring)->mmio_base+0x230)
|
||||
#define RING_EXECLIST_STATUS_LO(ring) ((ring)->mmio_base+0x234)
|
||||
#define RING_EXECLIST_STATUS_HI(ring) ((ring)->mmio_base+0x234 + 4)
|
||||
#define RING_CONTEXT_CONTROL(ring) ((ring)->mmio_base+0x244)
|
||||
#define RING_ELSP(ring) _MMIO((ring)->mmio_base + 0x230)
|
||||
#define RING_EXECLIST_STATUS_LO(ring) _MMIO((ring)->mmio_base + 0x234)
|
||||
#define RING_EXECLIST_STATUS_HI(ring) _MMIO((ring)->mmio_base + 0x234 + 4)
|
||||
#define RING_CONTEXT_CONTROL(ring) _MMIO((ring)->mmio_base + 0x244)
|
||||
#define CTX_CTRL_INHIBIT_SYN_CTX_SWITCH (1 << 3)
|
||||
#define CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT (1 << 0)
|
||||
#define CTX_CTRL_RS_CTX_ENABLE (1 << 1)
|
||||
#define RING_CONTEXT_STATUS_BUF_LO(ring, i) ((ring)->mmio_base+0x370 + (i) * 8)
|
||||
#define RING_CONTEXT_STATUS_BUF_HI(ring, i) ((ring)->mmio_base+0x370 + (i) * 8 + 4)
|
||||
#define RING_CONTEXT_STATUS_PTR(ring) ((ring)->mmio_base+0x3a0)
|
||||
#define RING_CONTEXT_STATUS_BUF_LO(ring, i) _MMIO((ring)->mmio_base + 0x370 + (i) * 8)
|
||||
#define RING_CONTEXT_STATUS_BUF_HI(ring, i) _MMIO((ring)->mmio_base + 0x370 + (i) * 8 + 4)
|
||||
#define RING_CONTEXT_STATUS_PTR(ring) _MMIO((ring)->mmio_base + 0x3a0)
|
||||
|
||||
/* Logical Rings */
|
||||
int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request);
|
||||
|
@ -69,9 +69,9 @@ static inline void intel_logical_ring_emit(struct intel_ringbuffer *ringbuf,
|
|||
ringbuf->tail += 4;
|
||||
}
|
||||
static inline void intel_logical_ring_emit_reg(struct intel_ringbuffer *ringbuf,
|
||||
u32 reg)
|
||||
i915_reg_t reg)
|
||||
{
|
||||
intel_logical_ring_emit(ringbuf, reg);
|
||||
intel_logical_ring_emit(ringbuf, i915_mmio_reg_offset(reg));
|
||||
}
|
||||
|
||||
/* Logical Ring Contexts */
|
||||
|
|
|
@ -51,7 +51,7 @@ struct intel_lvds_encoder {
|
|||
struct intel_encoder base;
|
||||
|
||||
bool is_dual_link;
|
||||
u32 reg;
|
||||
i915_reg_t reg;
|
||||
u32 a3_power;
|
||||
|
||||
struct intel_lvds_connector *attached_connector;
|
||||
|
@ -210,7 +210,7 @@ static void intel_enable_lvds(struct intel_encoder *encoder)
|
|||
struct intel_connector *intel_connector =
|
||||
&lvds_encoder->attached_connector->base;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 ctl_reg, stat_reg;
|
||||
i915_reg_t ctl_reg, stat_reg;
|
||||
|
||||
if (HAS_PCH_SPLIT(dev)) {
|
||||
ctl_reg = PCH_PP_CONTROL;
|
||||
|
@ -235,7 +235,7 @@ static void intel_disable_lvds(struct intel_encoder *encoder)
|
|||
struct drm_device *dev = encoder->base.dev;
|
||||
struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
u32 ctl_reg, stat_reg;
|
||||
i915_reg_t ctl_reg, stat_reg;
|
||||
|
||||
if (HAS_PCH_SPLIT(dev)) {
|
||||
ctl_reg = PCH_PP_CONTROL;
|
||||
|
@ -939,7 +939,7 @@ void intel_lvds_init(struct drm_device *dev)
|
|||
struct drm_display_mode *downclock_mode = NULL;
|
||||
struct edid *edid;
|
||||
struct drm_crtc *crtc;
|
||||
u32 lvds_reg;
|
||||
i915_reg_t lvds_reg;
|
||||
u32 lvds;
|
||||
int pipe;
|
||||
u8 pin;
|
||||
|
|
|
@ -159,7 +159,7 @@ static bool get_mocs_settings(struct drm_device *dev,
|
|||
return result;
|
||||
}
|
||||
|
||||
static uint32_t mocs_register(enum intel_ring_id ring, int index)
|
||||
static i915_reg_t mocs_register(enum intel_ring_id ring, int index)
|
||||
{
|
||||
switch (ring) {
|
||||
case RCS:
|
||||
|
@ -174,7 +174,7 @@ static uint32_t mocs_register(enum intel_ring_id ring, int index)
|
|||
return GEN9_MFX1_MOCS(index);
|
||||
default:
|
||||
MISSING_CASE(ring);
|
||||
return 0;
|
||||
return INVALID_MMIO_REG;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3285,7 +3285,8 @@ static void skl_compute_wm_results(struct drm_device *dev,
|
|||
r->wm_linetime[pipe] = p_wm->linetime;
|
||||
}
|
||||
|
||||
static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, uint32_t reg,
|
||||
static void skl_ddb_entry_write(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg,
|
||||
const struct skl_ddb_entry *entry)
|
||||
{
|
||||
if (entry->end)
|
||||
|
@ -3759,7 +3760,7 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc)
|
|||
struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
|
||||
struct intel_pipe_wm *active = &cstate->wm.optimal.ilk;
|
||||
enum pipe pipe = intel_crtc->pipe;
|
||||
static const unsigned int wm0_pipe_reg[] = {
|
||||
static const i915_reg_t wm0_pipe_reg[] = {
|
||||
[PIPE_A] = WM0_PIPEA_ILK,
|
||||
[PIPE_B] = WM0_PIPEB_ILK,
|
||||
[PIPE_C] = WM0_PIPEC_IVB,
|
||||
|
|
|
@ -80,7 +80,7 @@ static void intel_psr_write_vsc(struct intel_dp *intel_dp,
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
|
||||
enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
|
||||
u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
|
||||
i915_reg_t ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
|
||||
uint32_t *data = (uint32_t *) vsc_psr;
|
||||
unsigned int i;
|
||||
|
||||
|
@ -151,8 +151,8 @@ static void vlv_psr_enable_sink(struct intel_dp *intel_dp)
|
|||
DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE);
|
||||
}
|
||||
|
||||
static uint32_t psr_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
static i915_reg_t psr_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
if (INTEL_INFO(dev_priv)->gen >= 9)
|
||||
return DP_AUX_CH_CTL(port);
|
||||
|
@ -160,8 +160,8 @@ static uint32_t psr_aux_ctl_reg(struct drm_i915_private *dev_priv,
|
|||
return EDP_PSR_AUX_CTL;
|
||||
}
|
||||
|
||||
static uint32_t psr_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
static i915_reg_t psr_aux_data_reg(struct drm_i915_private *dev_priv,
|
||||
enum port port, int index)
|
||||
{
|
||||
if (INTEL_INFO(dev_priv)->gen >= 9)
|
||||
return DP_AUX_CH_DATA(port, index);
|
||||
|
@ -175,7 +175,7 @@ static void hsw_psr_enable_sink(struct intel_dp *intel_dp)
|
|||
struct drm_device *dev = dig_port->base.base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
uint32_t aux_clock_divider;
|
||||
uint32_t aux_ctl_reg;
|
||||
i915_reg_t aux_ctl_reg;
|
||||
int precharge = 0x3;
|
||||
static const uint8_t aux_msg[] = {
|
||||
[0] = DP_AUX_NATIVE_WRITE << 4,
|
||||
|
|
|
@ -479,7 +479,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *ring)
|
|||
{
|
||||
struct drm_device *dev = ring->dev;
|
||||
struct drm_i915_private *dev_priv = ring->dev->dev_private;
|
||||
u32 mmio = 0;
|
||||
i915_reg_t mmio;
|
||||
|
||||
/* The ring status page addresses are no longer next to the rest of
|
||||
* the ring registers as of gen7.
|
||||
|
@ -522,7 +522,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *ring)
|
|||
* invalidating the TLB?
|
||||
*/
|
||||
if (INTEL_INFO(dev)->gen >= 6 && INTEL_INFO(dev)->gen < 8) {
|
||||
u32 reg = RING_INSTPM(ring->mmio_base);
|
||||
i915_reg_t reg = RING_INSTPM(ring->mmio_base);
|
||||
|
||||
/* ring should be idle before issuing a sync flush*/
|
||||
WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0);
|
||||
|
@ -764,7 +764,8 @@ static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
|
|||
}
|
||||
|
||||
static int wa_add(struct drm_i915_private *dev_priv,
|
||||
const u32 addr, const u32 mask, const u32 val)
|
||||
i915_reg_t addr,
|
||||
const u32 mask, const u32 val)
|
||||
{
|
||||
const u32 idx = dev_priv->workarounds.count;
|
||||
|
||||
|
@ -1309,9 +1310,11 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req,
|
|||
return ret;
|
||||
|
||||
for_each_ring(useless, dev_priv, i) {
|
||||
u32 mbox_reg = signaller->semaphore.mbox.signal[i];
|
||||
if (mbox_reg != GEN6_NOSYNC) {
|
||||
i915_reg_t mbox_reg = signaller->semaphore.mbox.signal[i];
|
||||
|
||||
if (i915_mmio_reg_valid(mbox_reg)) {
|
||||
u32 seqno = i915_gem_request_get_seqno(signaller_req);
|
||||
|
||||
intel_ring_emit(signaller, MI_LOAD_REGISTER_IMM(1));
|
||||
intel_ring_emit_reg(signaller, mbox_reg);
|
||||
intel_ring_emit(signaller, seqno);
|
||||
|
|
|
@ -249,7 +249,7 @@ struct intel_engine_cs {
|
|||
/* our mbox written by others */
|
||||
u32 wait[I915_NUM_RINGS];
|
||||
/* mboxes this ring signals to */
|
||||
u32 signal[I915_NUM_RINGS];
|
||||
i915_reg_t signal[I915_NUM_RINGS];
|
||||
} mbox;
|
||||
u64 signal_ggtt[I915_NUM_RINGS];
|
||||
};
|
||||
|
@ -444,9 +444,9 @@ static inline void intel_ring_emit(struct intel_engine_cs *ring,
|
|||
ringbuf->tail += 4;
|
||||
}
|
||||
static inline void intel_ring_emit_reg(struct intel_engine_cs *ring,
|
||||
u32 reg)
|
||||
i915_reg_t reg)
|
||||
{
|
||||
intel_ring_emit(ring, reg);
|
||||
intel_ring_emit(ring, i915_mmio_reg_offset(reg));
|
||||
}
|
||||
static inline void intel_ring_advance(struct intel_engine_cs *ring)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ struct intel_sdvo {
|
|||
struct i2c_adapter ddc;
|
||||
|
||||
/* Register for the SDVO device: SDVOB or SDVOC */
|
||||
uint32_t sdvo_reg;
|
||||
i915_reg_t sdvo_reg;
|
||||
|
||||
/* Active outputs controlled by this SDVO output */
|
||||
uint16_t controlled_output;
|
||||
|
@ -2954,7 +2954,8 @@ static void assert_sdvo_port_valid(const struct drm_i915_private *dev_priv,
|
|||
WARN_ON(port != PORT_B && port != PORT_C);
|
||||
}
|
||||
|
||||
bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, enum port port)
|
||||
bool intel_sdvo_init(struct drm_device *dev,
|
||||
i915_reg_t sdvo_reg, enum port port)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_encoder *intel_encoder;
|
||||
|
|
|
@ -60,7 +60,7 @@ assert_device_not_suspended(struct drm_i915_private *dev_priv)
|
|||
static inline void
|
||||
fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
|
||||
{
|
||||
WARN_ON(d->reg_set == 0);
|
||||
WARN_ON(!i915_mmio_reg_valid(d->reg_set));
|
||||
__raw_i915_write32(d->i915, d->reg_set, d->val_reset);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ static inline void
|
|||
fw_domain_posting_read(const struct intel_uncore_forcewake_domain *d)
|
||||
{
|
||||
/* something from same cacheline, but not from the set register */
|
||||
if (d->reg_post)
|
||||
if (i915_mmio_reg_valid(d->reg_post))
|
||||
__raw_posting_read(d->i915, d->reg_post);
|
||||
}
|
||||
|
||||
|
@ -592,8 +592,8 @@ ilk_dummy_write(struct drm_i915_private *dev_priv)
|
|||
}
|
||||
|
||||
static void
|
||||
hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read,
|
||||
bool before)
|
||||
hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg, bool read, bool before)
|
||||
{
|
||||
const char *op = read ? "reading" : "writing to";
|
||||
const char *when = before ? "before" : "after";
|
||||
|
@ -603,7 +603,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read,
|
|||
|
||||
if (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM) {
|
||||
WARN(1, "Unclaimed register detected %s %s register 0x%x\n",
|
||||
when, op, reg);
|
||||
when, op, i915_mmio_reg_offset(reg));
|
||||
__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
|
||||
i915.mmio_debug--; /* Only report the first N failures */
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv)
|
|||
|
||||
#define __gen2_read(x) \
|
||||
static u##x \
|
||||
gen2_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
gen2_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
GEN2_READ_HEADER(x); \
|
||||
val = __raw_i915_read##x(dev_priv, reg); \
|
||||
GEN2_READ_FOOTER; \
|
||||
|
@ -644,7 +644,7 @@ gen2_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
|||
|
||||
#define __gen5_read(x) \
|
||||
static u##x \
|
||||
gen5_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
gen5_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
GEN2_READ_HEADER(x); \
|
||||
ilk_dummy_write(dev_priv); \
|
||||
val = __raw_i915_read##x(dev_priv, reg); \
|
||||
|
@ -667,7 +667,7 @@ __gen2_read(64)
|
|||
#undef GEN2_READ_HEADER
|
||||
|
||||
#define GEN6_READ_HEADER(x) \
|
||||
u32 offset = reg; \
|
||||
u32 offset = i915_mmio_reg_offset(reg); \
|
||||
unsigned long irqflags; \
|
||||
u##x val = 0; \
|
||||
assert_device_not_suspended(dev_priv); \
|
||||
|
@ -704,7 +704,7 @@ static inline void __force_wake_get(struct drm_i915_private *dev_priv,
|
|||
|
||||
#define __gen6_read(x) \
|
||||
static u##x \
|
||||
gen6_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
gen6_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
GEN6_READ_HEADER(x); \
|
||||
hsw_unclaimed_reg_debug(dev_priv, reg, true, true); \
|
||||
if (NEEDS_FORCE_WAKE(offset)) \
|
||||
|
@ -716,7 +716,7 @@ gen6_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
|||
|
||||
#define __vlv_read(x) \
|
||||
static u##x \
|
||||
vlv_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
vlv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
enum forcewake_domains fw_engine = 0; \
|
||||
GEN6_READ_HEADER(x); \
|
||||
if (!NEEDS_FORCE_WAKE(offset)) \
|
||||
|
@ -733,7 +733,7 @@ vlv_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
|||
|
||||
#define __chv_read(x) \
|
||||
static u##x \
|
||||
chv_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
chv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
enum forcewake_domains fw_engine = 0; \
|
||||
GEN6_READ_HEADER(x); \
|
||||
if (!NEEDS_FORCE_WAKE(offset)) \
|
||||
|
@ -755,7 +755,7 @@ chv_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
|||
|
||||
#define __gen9_read(x) \
|
||||
static u##x \
|
||||
gen9_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
gen9_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
enum forcewake_domains fw_engine; \
|
||||
GEN6_READ_HEADER(x); \
|
||||
hsw_unclaimed_reg_debug(dev_priv, reg, true, true); \
|
||||
|
@ -813,7 +813,7 @@ __gen6_read(64)
|
|||
|
||||
#define __vgpu_read(x) \
|
||||
static u##x \
|
||||
vgpu_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
|
||||
vgpu_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
|
||||
VGPU_READ_HEADER(x); \
|
||||
val = __raw_i915_read##x(dev_priv, reg); \
|
||||
VGPU_READ_FOOTER; \
|
||||
|
@ -836,7 +836,7 @@ __vgpu_read(64)
|
|||
|
||||
#define __gen2_write(x) \
|
||||
static void \
|
||||
gen2_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
|
||||
gen2_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
|
||||
GEN2_WRITE_HEADER; \
|
||||
__raw_i915_write##x(dev_priv, reg, val); \
|
||||
GEN2_WRITE_FOOTER; \
|
||||
|
@ -844,7 +844,7 @@ gen2_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace
|
|||
|
||||
#define __gen5_write(x) \
|
||||
static void \
|
||||
gen5_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
|
||||
gen5_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
|
||||
GEN2_WRITE_HEADER; \
|
||||
ilk_dummy_write(dev_priv); \
|
||||
__raw_i915_write##x(dev_priv, reg, val); \
|
||||
|
@ -867,7 +867,7 @@ __gen2_write(64)
|
|||
#undef GEN2_WRITE_HEADER
|
||||
|
||||
#define GEN6_WRITE_HEADER \
|
||||
u32 offset = reg; \
|
||||
u32 offset = i915_mmio_reg_offset(reg); \
|
||||
unsigned long irqflags; \
|
||||
trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
|
||||
assert_device_not_suspended(dev_priv); \
|
||||
|
@ -878,7 +878,7 @@ __gen2_write(64)
|
|||
|
||||
#define __gen6_write(x) \
|
||||
static void \
|
||||
gen6_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
|
||||
gen6_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
|
||||
u32 __fifo_ret = 0; \
|
||||
GEN6_WRITE_HEADER; \
|
||||
if (NEEDS_FORCE_WAKE(offset)) { \
|
||||
|
@ -893,7 +893,7 @@ gen6_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace
|
|||
|
||||
#define __hsw_write(x) \
|
||||
static void \
|
||||
hsw_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
|
||||
hsw_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
|
||||
u32 __fifo_ret = 0; \
|
||||
GEN6_WRITE_HEADER; \
|
||||
if (NEEDS_FORCE_WAKE(offset)) { \
|
||||
|
@ -909,7 +909,7 @@ hsw_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace)
|
|||
GEN6_WRITE_FOOTER; \
|
||||
}
|
||||
|
||||
static const u32 gen8_shadowed_regs[] = {
|
||||
static const i915_reg_t gen8_shadowed_regs[] = {
|
||||
FORCEWAKE_MT,
|
||||
GEN6_RPNSWREQ,
|
||||
GEN6_RC_VIDEO_FREQ,
|
||||
|
@ -920,11 +920,12 @@ static const u32 gen8_shadowed_regs[] = {
|
|||
/* TODO: Other registers are not yet used */
|
||||
};
|
||||
|
||||
static bool is_gen8_shadowed(struct drm_i915_private *dev_priv, u32 reg)
|
||||
static bool is_gen8_shadowed(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(gen8_shadowed_regs); i++)
|
||||
if (reg == gen8_shadowed_regs[i])
|
||||
if (i915_mmio_reg_equal(reg, gen8_shadowed_regs[i]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -932,7 +933,7 @@ static bool is_gen8_shadowed(struct drm_i915_private *dev_priv, u32 reg)
|
|||
|
||||
#define __gen8_write(x) \
|
||||
static void \
|
||||
gen8_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
|
||||
gen8_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
|
||||
GEN6_WRITE_HEADER; \
|
||||
hsw_unclaimed_reg_debug(dev_priv, reg, false, true); \
|
||||
if (NEEDS_FORCE_WAKE(offset) && !is_gen8_shadowed(dev_priv, reg)) \
|
||||
|
@ -945,7 +946,7 @@ gen8_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace
|
|||
|
||||
#define __chv_write(x) \
|
||||
static void \
|
||||
chv_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
|
||||
chv_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
|
||||
enum forcewake_domains fw_engine = 0; \
|
||||
GEN6_WRITE_HEADER; \
|
||||
if (!NEEDS_FORCE_WAKE(offset) || \
|
||||
|
@ -963,7 +964,7 @@ chv_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace)
|
|||
GEN6_WRITE_FOOTER; \
|
||||
}
|
||||
|
||||
static const u32 gen9_shadowed_regs[] = {
|
||||
static const i915_reg_t gen9_shadowed_regs[] = {
|
||||
RING_TAIL(RENDER_RING_BASE),
|
||||
RING_TAIL(GEN6_BSD_RING_BASE),
|
||||
RING_TAIL(VEBOX_RING_BASE),
|
||||
|
@ -976,11 +977,12 @@ static const u32 gen9_shadowed_regs[] = {
|
|||
/* TODO: Other registers are not yet used */
|
||||
};
|
||||
|
||||
static bool is_gen9_shadowed(struct drm_i915_private *dev_priv, u32 reg)
|
||||
static bool is_gen9_shadowed(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t reg)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(gen9_shadowed_regs); i++)
|
||||
if (reg == gen9_shadowed_regs[i])
|
||||
if (i915_mmio_reg_equal(reg, gen9_shadowed_regs[i]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -988,7 +990,7 @@ static bool is_gen9_shadowed(struct drm_i915_private *dev_priv, u32 reg)
|
|||
|
||||
#define __gen9_write(x) \
|
||||
static void \
|
||||
gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \
|
||||
gen9_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, \
|
||||
bool trace) { \
|
||||
enum forcewake_domains fw_engine; \
|
||||
GEN6_WRITE_HEADER; \
|
||||
|
@ -1052,7 +1054,7 @@ __gen6_write(64)
|
|||
|
||||
#define __vgpu_write(x) \
|
||||
static void vgpu_write##x(struct drm_i915_private *dev_priv, \
|
||||
off_t reg, u##x val, bool trace) { \
|
||||
i915_reg_t reg, u##x val, bool trace) { \
|
||||
VGPU_WRITE_HEADER; \
|
||||
__raw_i915_write##x(dev_priv, reg, val); \
|
||||
VGPU_WRITE_FOOTER; \
|
||||
|
@ -1086,7 +1088,8 @@ do { \
|
|||
|
||||
static void fw_domain_init(struct drm_i915_private *dev_priv,
|
||||
enum forcewake_domain_id domain_id,
|
||||
u32 reg_set, u32 reg_ack)
|
||||
i915_reg_t reg_set,
|
||||
i915_reg_t reg_ack)
|
||||
{
|
||||
struct intel_uncore_forcewake_domain *d;
|
||||
|
||||
|
@ -1116,8 +1119,6 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
|
|||
d->reg_post = FORCEWAKE_ACK_VLV;
|
||||
else if (IS_GEN6(dev_priv) || IS_GEN7(dev_priv) || IS_GEN8(dev_priv))
|
||||
d->reg_post = ECOBUS;
|
||||
else
|
||||
d->reg_post = 0;
|
||||
|
||||
d->i915 = dev_priv;
|
||||
d->id = domain_id;
|
||||
|
@ -1291,7 +1292,7 @@ void intel_uncore_fini(struct drm_device *dev)
|
|||
#define GEN_RANGE(l, h) GENMASK(h, l)
|
||||
|
||||
static const struct register_whitelist {
|
||||
uint32_t offset_ldw, offset_udw;
|
||||
i915_reg_t offset_ldw, offset_udw;
|
||||
uint32_t size;
|
||||
/* supported gens, 0x10 for 4, 0x30 for 4 and 5, etc. */
|
||||
uint32_t gen_bitmask;
|
||||
|
@ -1308,11 +1309,11 @@ int i915_reg_read_ioctl(struct drm_device *dev,
|
|||
struct drm_i915_reg_read *reg = data;
|
||||
struct register_whitelist const *entry = whitelist;
|
||||
unsigned size;
|
||||
uint32_t offset_ldw, offset_udw;
|
||||
i915_reg_t offset_ldw, offset_udw;
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) {
|
||||
if (entry->offset_ldw == (reg->offset & -entry->size) &&
|
||||
if (i915_mmio_reg_offset(entry->offset_ldw) == (reg->offset & -entry->size) &&
|
||||
(1 << INTEL_INFO(dev)->gen & entry->gen_bitmask))
|
||||
break;
|
||||
}
|
||||
|
@ -1327,7 +1328,7 @@ int i915_reg_read_ioctl(struct drm_device *dev,
|
|||
offset_ldw = entry->offset_ldw;
|
||||
offset_udw = entry->offset_udw;
|
||||
size = entry->size;
|
||||
size |= reg->offset ^ offset_ldw;
|
||||
size |= reg->offset ^ i915_mmio_reg_offset(offset_ldw);
|
||||
|
||||
intel_runtime_pm_get(dev_priv);
|
||||
|
||||
|
@ -1502,7 +1503,7 @@ static int gen6_do_reset(struct drm_device *dev)
|
|||
}
|
||||
|
||||
static int wait_for_register(struct drm_i915_private *dev_priv,
|
||||
const u32 reg,
|
||||
i915_reg_t reg,
|
||||
const u32 mask,
|
||||
const u32 value,
|
||||
const unsigned long timeout_ms)
|
||||
|
|
Loading…
Reference in New Issue