drm/i915: Clean up PCI config register handling
Subsystems (2)
Joonas Lahtinen
maintainerPATCH 1/1 drm/i915: Clean up PCI config register handling
Do not use magic numbers, do not prefix stuff with "PCI_", do not declare registers in implementation files. Also move the PCI registers under correct comment in i915_reg.h.
--- drivers/gpu/drm/i915/i915_dma.c | 15 ++++---------- drivers/gpu/drm/i915/i915_gem_stolen.c | 9 ++++---- drivers/gpu/drm/i915/i915_reg.h | 38 +++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_opregion.c | 24 ++++++++------------- drivers/gpu/drm/i915/intel_panel.c | 4 ++-- 5 files changed, 48 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +4 -11
@@ -257,13 +257,6 @@ static int i915_get_bridge_dev(struct drm_device *dev)return 0 ; } -#define MCHBAR_I915 0x44 -#define MCHBAR_I965 0x48 -#define MCHBAR_SIZE (4*4096) - -#define DEVEN_REG 0x54 -#define DEVEN_MCHBAR_EN (1 << 28) -/* Allocate space for the MCH regs if needed, return nonzero on error */ static int intel_alloc_mchbar_resource (struct drm_device *dev)
@@ -325,7 +318,7 @@ intel_setup_mchbar(struct drm_device *dev) dev_priv->mchbar_need_disable = false;if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); enabled = !!(temp &DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);
@@ -343,7 +336,7 @@ intel_setup_mchbar(struct drm_device *dev)/* Space is allocated or reserved, so enable it. */ if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp |DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);
@@ -360,9 +353,9 @@ intel_teardown_mchbar(struct drm_device *dev)if (dev_priv->mchbar_need_disable) {if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); temp &= ~DEVEN_MCHBAR_EN ; -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , temp); +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp); temp &= ~1 ;
drivers/gpu/drm/i915/i915_gem_stolen.c +5 -4
@@ -95,7 +95,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)u32 base;/* Almost universally we can find the Graphics Base of Stolen Memory -* at offset 0x5c in the igfx configuration space. On a few (desktop) +* at register BDSM in the igfx configuration space. On a few (desktop) * machines this is also mirrored in the bridge device at different * locations, or in the MCHBAR. *
@@ -107,9 +107,10 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)*/ base =0 ;if (INTEL_INFO (dev)->gen >=3 ) { -/* Read Graphics Base of Stolen Memory directly */ -pci_read_config_dword (dev->pdev,0x5c , &base); - base &= ~((1 <<20 ) -1 ); +u32 bsm; +pci_read_config_dword (dev->pdev,BSM , &bsm); + + base = bsm &BSM_MASK ; }else if (IS_I865G (dev)) {u16 toud =0 ;
drivers/gpu/drm/i915/i915_reg.h +28 -10
@@ -79,6 +79,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)/* PCI config space */ +#define MCHBAR_I915 0x44 +#define MCHBAR_I965 0x48 +#define MCHBAR_SIZE (4*4096) + +#define DEVEN 0x54 +#define DEVEN_MCHBAR_EN (1 << 28) + +#define BSM 0x5c +#define BSM_MASK (0xFFFF << 20) +#define HPLLCC 0xc0/* 85x only */ #define GC_CLOCK_CONTROL_MASK (0x7 << 0)#define GC_CLOCK_133_200 (0 << 0)
@@ -90,6 +100,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define GC_CLOCK_166_266 (6 << 0)#define GC_CLOCK_166_250 (7 << 0) +#define I915_GDRST 0xc0/* PCI config register */ +#define GRDOM_FULL (0<<2) +#define GRDOM_RENDER (1<<2) +#define GRDOM_MEDIA (3<<2) +#define GRDOM_MASK (3<<2) +#define GRDOM_RESET_STATUS (1<<1) +#define GRDOM_RESET_ENABLE (1<<0) + +#define GCDGMBUS 0xcc +#define GCFGC2 0xda#define GCFGC 0xf0/* 915+ only */ #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
@@ -121,18 +141,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)#define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)#define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0) -#define GCDGMBUS 0xcc -#define PCI_LBPC 0xf4/* legacy/combination backlight modes, also called LBB */ +#define ASLE 0xe4 +#define ASLS 0xfc + +#define SWSCI 0xe8 +#define SWSCI_SCISEL (1 << 15) +#define SWSCI_GSSCIE (1 << 0) + +#define LBPC 0xf4/* legacy/combination backlight modes, also called LBB */ -/* Graphics reset regs */ -#define I915_GDRST 0xc0/* PCI config register */ -#define GRDOM_FULL (0<<2) -#define GRDOM_RENDER (1<<2) -#define GRDOM_MEDIA (3<<2) -#define GRDOM_MASK (3<<2) -#define GRDOM_RESET_STATUS (1<<1) -#define GRDOM_RESET_ENABLE (1<<0)#define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)#define ILK_GRDOM_FULL (0<<1)
drivers/gpu/drm/i915/intel_opregion.c +9 -15
@@ -34,12 +34,6 @@#include "i915_drv.h" #include "intel_drv.h" -#define PCI_ASLE 0xe4 -#define PCI_ASLS 0xfc -#define PCI_SWSCI 0xe8 -#define PCI_SWSCI_SCISEL (1 << 15) -#define PCI_SWSCI_GSSCIE (1 << 0) -#define OPREGION_HEADER_OFFSET 0#define OPREGION_ACPI_OFFSET 0x100#define ACPI_CLID 0x01ac/* current lid state indicator */
@@ -251,7 +245,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)struct drm_i915_private *dev_priv = dev->dev_private;struct opregion_swsci *swsci = dev_priv->opregion.swsci;u32 main_function, sub_function, scic; -u16 pci_swsci; +u16 swsci_reg;u32 dslp;if (!swsci)
@@ -299,16 +293,16 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) swsci->scic = scic;/* Ensure SCI event is selected and event trigger is cleared. */ -pci_read_config_word (dev->pdev,PCI_SWSCI , &pci_swsci); -if (!(pci_swsci &PCI_SWSCI_SCISEL ) || (pci_swsci &PCI_SWSCI_GSSCIE )) { - pci_swsci |=PCI_SWSCI_SCISEL ; - pci_swsci &= ~PCI_SWSCI_GSSCIE ; -pci_write_config_word (dev->pdev,PCI_SWSCI , pci_swsci); +pci_read_config_word (dev->pdev,SWSCI , &swsci_reg); +if (!(swsci_reg &SWSCI_SCISEL ) || (swsci_reg &SWSCI_GSSCIE )) { + swsci_reg |=SWSCI_SCISEL ; + swsci_reg &= ~SWSCI_GSSCIE ; +pci_write_config_word (dev->pdev,SWSCI , swsci_reg); }/* Use event trigger to tell bios to check the mail. */ - pci_swsci |=PCI_SWSCI_GSSCIE ; -pci_write_config_word (dev->pdev,PCI_SWSCI , pci_swsci); + swsci_reg |=SWSCI_GSSCIE ; +pci_write_config_word (dev->pdev,SWSCI , swsci_reg);/* Poll for the result. */ #define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
@@ -939,7 +933,7 @@ int intel_opregion_setup(struct drm_device *dev)BUILD_BUG_ON (sizeof (struct opregion_asle ) !=0x100 );BUILD_BUG_ON (sizeof (struct opregion_asle_ext ) !=0x400 ); -pci_read_config_dword (dev->pdev,PCI_ASLS , &asls); +pci_read_config_dword (dev->pdev,ASLS , &asls);DRM_DEBUG_DRIVER ("graphic opregion physical addr: 0x%x\n" , asls);if (asls ==0 ) {DRM_DEBUG_DRIVER ("ACPI OpRegion not supported!\n" );
drivers/gpu/drm/i915/intel_panel.c +2 -2
@@ -504,7 +504,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)if (panel->backlight.combination_mode) {u8 lbpc; -pci_read_config_byte (dev_priv->dev->pdev,PCI_LBPC , &lbpc); +pci_read_config_byte (dev_priv->dev->pdev,LBPC , &lbpc); val *= lbpc; }
@@ -592,7 +592,7 @@ static void i9xx_set_backlight(struct intel_connector *connector, u32 level) lbpc = level *0xfe / panel->backlight.max +1 ; level /= lbpc; -pci_write_config_byte (dev_priv->dev->pdev,PCI_LBPC , lbpc); +pci_write_config_byte (dev_priv->dev->pdev,LBPC , lbpc); }if (IS_GEN4 (dev_priv)) {
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Clean up PCI config register handling
== Series Details ==
== Series Details ==
Series: drm/i915: Clean up PCI config register handling
URL : https://patchwork.freedesktop.org/series/5768/
State : failure
== Summary ==
Series 5768v1 drm/i915: Clean up PCI config register handling
http://patchwork.freedesktop.org/api/1.0/series/5768/revisions/1/mbox/
Test kms_force_connector_basic:
Subgroup force-edid:
pass -> SKIP (ivb-t430s)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
pass -> DMESG-WARN (byt-nuc)bdw-nuci7 total:203 pass:190 dwarn:0 dfail:0 fail:1 skip:12 bdw-ultra total:203 pass:179 dwarn:0 dfail:0 fail:1 skip:23 bsw-nuc-2 total:202 pass:162 dwarn:0 dfail:0 fail:1 skip:39 byt-nuc total:202 pass:162 dwarn:1 dfail:0 fail:1 skip:38 hsw-brixbox total:203 pass:178 dwarn:0 dfail:0 fail:1 skip:24 ilk-hp8440p total:203 pass:134 dwarn:0 dfail:0 fail:1 skip:68 ivb-t430s total:203 pass:173 dwarn:0 dfail:0 fail:1 skip:29 skl-i7k-2 total:203 pass:177 dwarn:0 dfail:0 fail:1 skip:25 skl-nuci5 total:203 pass:191 dwarn:0 dfail:0 fail:1 skip:11 snb-dellxps total:203 pass:164 dwarn:0 dfail:0 fail:1 skip:38 snb-x220t total:203 pass:164 dwarn:0 dfail:0 fail:2 skip:37
BOOT FAILED for hsw-gt2
Results at /archive/results/CI_IGT_test/Patchwork_1911/
93007879016173240c35d81572d1fec8c8376f07 drm-intel-nightly: 2016y-04m-15d-07h-43m-11s UTC integration manifest 82751e8 drm/i915: Clean up PCI config register handling
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 69 lines · Joonas Lahtinen
Do not use magic numbers, do not prefix stuff with "
PCI_", do not declare registers in implementation files. Also move the PCI registers under correct comment ini915_reg.h.Cc Jani Nikula <[email protected]>Cc Chris Wilson <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 15 ++++---------- drivers/gpu/drm/i915/i915_gem_stolen.c | 9 ++++---- drivers/gpu/drm/i915/i915_reg.h | 38 +++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_opregion.c | 24 ++++++++------------- drivers/gpu/drm/i915/intel_panel.c | 4 ++-- 5 files changed, 48 insertions(+), 42 deletions(-)drivers/gpu/drm/i915/i915_dma.c +4
-11@@ -257,13 +257,6 @@ static int i915_get_bridge_dev(struct drm_device *dev)return 0 ; } -#define MCHBAR_I915 0x44 -#define MCHBAR_I965 0x48 -#define MCHBAR_SIZE (4*4096) - -#define DEVEN_REG 0x54 -#define DEVEN_MCHBAR_EN (1 << 28) -/* Allocate space for the MCH regs if needed, return nonzero on error */ static int intel_alloc_mchbar_resource (struct drm_device *dev)@@ -325,7 +318,7 @@ intel_setup_mchbar(struct drm_device *dev) dev_priv->mchbar_need_disable = false;if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); enabled = !!(temp &DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);@@ -343,7 +336,7 @@ intel_setup_mchbar(struct drm_device *dev)/* Space is allocated or reserved, so enable it. */ if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp |DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);@@ -360,9 +353,9 @@ intel_teardown_mchbar(struct drm_device *dev)if (dev_priv->mchbar_need_disable) {if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); temp &= ~DEVEN_MCHBAR_EN ; -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , temp); +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp); temp &= ~1 ;drivers/gpu/drm/i915/i915_gem_stolen.c +0
-0
drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 98
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +1
-1@@ -95,7 +95,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)u32 base;/* Almost universally we can find the Graphics Base of Stolen Memory -* at offset 0x5c in the igfx configuration space. On a few (desktop) +* at register BDSM in the igfx configuration space. On a few (desktop)
Offset is easier to find in cspec, so please include both.
BDSM? That doesn't match your usage and cpsec refers to GBSM, iirc. I know the code is bad, but it is not naughty!
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerPATCH 1/1 drm/i915: Clean up PCI config register handling
In reply to Joonas LahtinenDo not use magic numbers, do not prefix stuff with "PCI_", do not declare registers in implementation files. Also move the PCI registers under correct comment in i915_reg.h.
v2:
- Consistently use BSM (not BDSM or other variants from PRM) (Chris)
- Also include register address to help identify the register (Chris)
--- drivers/gpu/drm/i915/i915_dma.c | 15 ++++---------- drivers/gpu/drm/i915/i915_gem_stolen.c | 13 ++++++------ drivers/gpu/drm/i915/i915_reg.h | 38 +++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_opregion.c | 24 ++++++++------------- drivers/gpu/drm/i915/intel_panel.c | 4 ++-- 5 files changed, 50 insertions(+), 44 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +4 -11
@@ -257,13 +257,6 @@ static int i915_get_bridge_dev(struct drm_device *dev)return 0 ; } -#define MCHBAR_I915 0x44 -#define MCHBAR_I965 0x48 -#define MCHBAR_SIZE (4*4096) - -#define DEVEN_REG 0x54 -#define DEVEN_MCHBAR_EN (1 << 28) -/* Allocate space for the MCH regs if needed, return nonzero on error */ static int intel_alloc_mchbar_resource (struct drm_device *dev)
@@ -325,7 +318,7 @@ intel_setup_mchbar(struct drm_device *dev) dev_priv->mchbar_need_disable = false;if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); enabled = !!(temp &DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);
@@ -343,7 +336,7 @@ intel_setup_mchbar(struct drm_device *dev)/* Space is allocated or reserved, so enable it. */ if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp |DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);
@@ -360,9 +353,9 @@ intel_teardown_mchbar(struct drm_device *dev)if (dev_priv->mchbar_need_disable) {if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); temp &= ~DEVEN_MCHBAR_EN ; -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , temp); +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp); temp &= ~1 ;
drivers/gpu/drm/i915/i915_gem_stolen.c +7 -6
@@ -95,9 +95,9 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)u32 base;/* Almost universally we can find the Graphics Base of Stolen Memory -* at offset 0x5c in the igfx configuration space. On a few (desktop) -* machines this is also mirrored in the bridge device at different -* locations, or in the MCHBAR. +* at register BSM (0x5c) in the igfx configuration space. On a few +* (desktop) machines this is also mirrored in the bridge device at +* different locations, or in the MCHBAR. * * On 865 we just check the TOUD register. *
@@ -107,9 +107,10 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)*/ base =0 ;if (INTEL_INFO (dev)->gen >=3 ) { -/* Read Graphics Base of Stolen Memory directly */ -pci_read_config_dword (dev->pdev,0x5c , &base); - base &= ~((1 <<20 ) -1 ); +u32 bsm; +pci_read_config_dword (dev->pdev,BSM , &bsm); + + base = bsm &BSM_MASK ; }else if (IS_I865G (dev)) {u16 toud =0 ;
drivers/gpu/drm/i915/i915_reg.h +28 -10
@@ -79,6 +79,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)/* PCI config space */ +#define MCHBAR_I915 0x44 +#define MCHBAR_I965 0x48 +#define MCHBAR_SIZE (4*4096) + +#define DEVEN 0x54 +#define DEVEN_MCHBAR_EN (1 << 28) + +#define BSM 0x5c +#define BSM_MASK (0xFFFF << 20) +#define HPLLCC 0xc0/* 85x only */ #define GC_CLOCK_CONTROL_MASK (0x7 << 0)#define GC_CLOCK_133_200 (0 << 0)
@@ -90,6 +100,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define GC_CLOCK_166_266 (6 << 0)#define GC_CLOCK_166_250 (7 << 0) +#define I915_GDRST 0xc0/* PCI config register */ +#define GRDOM_FULL (0<<2) +#define GRDOM_RENDER (1<<2) +#define GRDOM_MEDIA (3<<2) +#define GRDOM_MASK (3<<2) +#define GRDOM_RESET_STATUS (1<<1) +#define GRDOM_RESET_ENABLE (1<<0) + +#define GCDGMBUS 0xcc +#define GCFGC2 0xda#define GCFGC 0xf0/* 915+ only */ #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
@@ -121,18 +141,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)#define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)#define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0) -#define GCDGMBUS 0xcc -#define PCI_LBPC 0xf4/* legacy/combination backlight modes, also called LBB */ +#define ASLE 0xe4 +#define ASLS 0xfc + +#define SWSCI 0xe8 +#define SWSCI_SCISEL (1 << 15) +#define SWSCI_GSSCIE (1 << 0) + +#define LBPC 0xf4/* legacy/combination backlight modes, also called LBB */ -/* Graphics reset regs */ -#define I915_GDRST 0xc0/* PCI config register */ -#define GRDOM_FULL (0<<2) -#define GRDOM_RENDER (1<<2) -#define GRDOM_MEDIA (3<<2) -#define GRDOM_MASK (3<<2) -#define GRDOM_RESET_STATUS (1<<1) -#define GRDOM_RESET_ENABLE (1<<0)#define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)#define ILK_GRDOM_FULL (0<<1)
drivers/gpu/drm/i915/intel_opregion.c +9 -15
@@ -34,12 +34,6 @@#include "i915_drv.h" #include "intel_drv.h" -#define PCI_ASLE 0xe4 -#define PCI_ASLS 0xfc -#define PCI_SWSCI 0xe8 -#define PCI_SWSCI_SCISEL (1 << 15) -#define PCI_SWSCI_GSSCIE (1 << 0) -#define OPREGION_HEADER_OFFSET 0#define OPREGION_ACPI_OFFSET 0x100#define ACPI_CLID 0x01ac/* current lid state indicator */
@@ -251,7 +245,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)struct drm_i915_private *dev_priv = dev->dev_private;struct opregion_swsci *swsci = dev_priv->opregion.swsci;u32 main_function, sub_function, scic; -u16 pci_swsci; +u16 swsci_reg;u32 dslp;if (!swsci)
@@ -299,16 +293,16 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) swsci->scic = scic;/* Ensure SCI event is selected and event trigger is cleared. */ -pci_read_config_word (dev->pdev,PCI_SWSCI , &pci_swsci); -if (!(pci_swsci &PCI_SWSCI_SCISEL ) || (pci_swsci &PCI_SWSCI_GSSCIE )) { - pci_swsci |=PCI_SWSCI_SCISEL ; - pci_swsci &= ~PCI_SWSCI_GSSCIE ; -pci_write_config_word (dev->pdev,PCI_SWSCI , pci_swsci); +pci_read_config_word (dev->pdev,SWSCI , &swsci_reg); +if (!(swsci_reg &SWSCI_SCISEL ) || (swsci_reg &SWSCI_GSSCIE )) { + swsci_reg |=SWSCI_SCISEL ; + swsci_reg &= ~SWSCI_GSSCIE ; +pci_write_config_word (dev->pdev,SWSCI , swsci_reg); }/* Use event trigger to tell bios to check the mail. */ - pci_swsci |=PCI_SWSCI_GSSCIE ; -pci_write_config_word (dev->pdev,PCI_SWSCI , pci_swsci); + swsci_reg |=SWSCI_GSSCIE ; +pci_write_config_word (dev->pdev,SWSCI , swsci_reg);/* Poll for the result. */ #define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
@@ -939,7 +933,7 @@ int intel_opregion_setup(struct drm_device *dev)BUILD_BUG_ON (sizeof (struct opregion_asle ) !=0x100 );BUILD_BUG_ON (sizeof (struct opregion_asle_ext ) !=0x400 ); -pci_read_config_dword (dev->pdev,PCI_ASLS , &asls); +pci_read_config_dword (dev->pdev,ASLS , &asls);DRM_DEBUG_DRIVER ("graphic opregion physical addr: 0x%x\n" , asls);if (asls ==0 ) {DRM_DEBUG_DRIVER ("ACPI OpRegion not supported!\n" );
drivers/gpu/drm/i915/intel_panel.c +2 -2
@@ -504,7 +504,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)if (panel->backlight.combination_mode) {u8 lbpc; -pci_read_config_byte (dev_priv->dev->pdev,PCI_LBPC , &lbpc); +pci_read_config_byte (dev_priv->dev->pdev,LBPC , &lbpc); val *= lbpc; }
@@ -592,7 +592,7 @@ static void i9xx_set_backlight(struct intel_connector *connector, u32 level) lbpc = level *0xfe / panel->backlight.max +1 ; level /= lbpc; -pci_write_config_byte (dev_priv->dev->pdev,PCI_LBPC , lbpc); +pci_write_config_byte (dev_priv->dev->pdev,LBPC , lbpc); }if (IS_GEN4 (dev_priv)) {
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
drivers/gpu/drm/i915/intel_opregion.c static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) · line 248
Quoted 6 lines · Joonas Lahtinen
drivers/gpu/drm/i915/intel_opregion.c +1
-1@@ -251,7 +245,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)struct drm_i915_private *dev_priv = dev->dev_private;struct opregion_swsci *swsci = dev_priv->opregion.swsci;u32 main_function, sub_function, scic; -u16 pci_swsci; +u16 swsci_reg;
This threw me. In other places _reg means the register offset and _val means the value we want to poke into the register.
Happy with everything else.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Chris Wilson
[ text/plain ]
drivers/gpu/drm/i915/intel_opregion.c static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) · line 248
Quoted 6 lines · Joonas Lahtinen
drivers/gpu/drm/i915/intel_opregion.c +1
-1@@ -251,7 +245,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)struct drm_i915_private *dev_priv = dev->dev_private;struct opregion_swsci *swsci = dev_priv->opregion.swsci;u32 main_function, sub_function, scic; -u16 pci_swsci; +u16 swsci_reg;This threw me. In other places
_regmeans the register offset and_valmeans the value we want to poke into the register.
IMO you could just leave it as pci_swsci.
BR,
Jani.
Quoted 3 lines
Happy with everything else.
-Chris
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerPATCH v3 1/1 drm/i915: Clean up PCI config register handling
In reply to Chris WilsonDo not use magic numbers, do not prefix stuff with "PCI_", do not declare registers in implementation files. Also move the PCI registers under correct comment in i915_reg.h.
v2:
- Consistently use BSM (not BDSM or other variants from PRM) (Chris)
- Also include register address to help identify the register (Chris) v3:
- Refer to register value as *_val instead of *_reg (Chris)
--- drivers/gpu/drm/i915/i915_dma.c | 15 ++++---------- drivers/gpu/drm/i915/i915_gem_stolen.c | 13 ++++++------ drivers/gpu/drm/i915/i915_reg.h | 38 +++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_opregion.c | 24 ++++++++------------- drivers/gpu/drm/i915/intel_panel.c | 4 ++-- 5 files changed, 50 insertions(+), 44 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +4 -11
@@ -257,13 +257,6 @@ static int i915_get_bridge_dev(struct drm_device *dev)return 0 ; } -#define MCHBAR_I915 0x44 -#define MCHBAR_I965 0x48 -#define MCHBAR_SIZE (4*4096) - -#define DEVEN_REG 0x54 -#define DEVEN_MCHBAR_EN (1 << 28) -/* Allocate space for the MCH regs if needed, return nonzero on error */ static int intel_alloc_mchbar_resource (struct drm_device *dev)
@@ -325,7 +318,7 @@ intel_setup_mchbar(struct drm_device *dev) dev_priv->mchbar_need_disable = false;if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); enabled = !!(temp &DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);
@@ -343,7 +336,7 @@ intel_setup_mchbar(struct drm_device *dev)/* Space is allocated or reserved, so enable it. */ if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp |DEVEN_MCHBAR_EN ); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp);
@@ -360,9 +353,9 @@ intel_teardown_mchbar(struct drm_device *dev)if (dev_priv->mchbar_need_disable) {if (IS_I915G (dev) ||IS_I915GM (dev)) { -pci_read_config_dword (dev_priv->bridge_dev,DEVEN_REG , &temp); +pci_read_config_dword (dev_priv->bridge_dev,DEVEN , &temp); temp &= ~DEVEN_MCHBAR_EN ; -pci_write_config_dword (dev_priv->bridge_dev,DEVEN_REG , temp); +pci_write_config_dword (dev_priv->bridge_dev,DEVEN , temp); }else {pci_read_config_dword (dev_priv->bridge_dev, mchbar_reg, &temp); temp &= ~1 ;
drivers/gpu/drm/i915/i915_gem_stolen.c +7 -6
@@ -95,9 +95,9 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)u32 base;/* Almost universally we can find the Graphics Base of Stolen Memory -* at offset 0x5c in the igfx configuration space. On a few (desktop) -* machines this is also mirrored in the bridge device at different -* locations, or in the MCHBAR. +* at register BSM (0x5c) in the igfx configuration space. On a few +* (desktop) machines this is also mirrored in the bridge device at +* different locations, or in the MCHBAR. * * On 865 we just check the TOUD register. *
@@ -107,9 +107,10 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)*/ base =0 ;if (INTEL_INFO (dev)->gen >=3 ) { -/* Read Graphics Base of Stolen Memory directly */ -pci_read_config_dword (dev->pdev,0x5c , &base); - base &= ~((1 <<20 ) -1 ); +u32 bsm; +pci_read_config_dword (dev->pdev,BSM , &bsm); + + base = bsm &BSM_MASK ; }else if (IS_I865G (dev)) {u16 toud =0 ;
drivers/gpu/drm/i915/i915_reg.h +28 -10
@@ -79,6 +79,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)/* PCI config space */ +#define MCHBAR_I915 0x44 +#define MCHBAR_I965 0x48 +#define MCHBAR_SIZE (4*4096) + +#define DEVEN 0x54 +#define DEVEN_MCHBAR_EN (1 << 28) + +#define BSM 0x5c +#define BSM_MASK (0xFFFF << 20) +#define HPLLCC 0xc0/* 85x only */ #define GC_CLOCK_CONTROL_MASK (0x7 << 0)#define GC_CLOCK_133_200 (0 << 0)
@@ -90,6 +100,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define GC_CLOCK_166_266 (6 << 0)#define GC_CLOCK_166_250 (7 << 0) +#define I915_GDRST 0xc0/* PCI config register */ +#define GRDOM_FULL (0<<2) +#define GRDOM_RENDER (1<<2) +#define GRDOM_MEDIA (3<<2) +#define GRDOM_MASK (3<<2) +#define GRDOM_RESET_STATUS (1<<1) +#define GRDOM_RESET_ENABLE (1<<0) + +#define GCDGMBUS 0xcc +#define GCFGC2 0xda#define GCFGC 0xf0/* 915+ only */ #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
@@ -121,18 +141,16 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)#define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)#define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0) -#define GCDGMBUS 0xcc -#define PCI_LBPC 0xf4/* legacy/combination backlight modes, also called LBB */ +#define ASLE 0xe4 +#define ASLS 0xfc + +#define SWSCI 0xe8 +#define SWSCI_SCISEL (1 << 15) +#define SWSCI_GSSCIE (1 << 0) + +#define LBPC 0xf4/* legacy/combination backlight modes, also called LBB */ -/* Graphics reset regs */ -#define I915_GDRST 0xc0/* PCI config register */ -#define GRDOM_FULL (0<<2) -#define GRDOM_RENDER (1<<2) -#define GRDOM_MEDIA (3<<2) -#define GRDOM_MASK (3<<2) -#define GRDOM_RESET_STATUS (1<<1) -#define GRDOM_RESET_ENABLE (1<<0)#define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)#define ILK_GRDOM_FULL (0<<1)
drivers/gpu/drm/i915/intel_opregion.c +9 -15
@@ -34,12 +34,6 @@#include "i915_drv.h" #include "intel_drv.h" -#define PCI_ASLE 0xe4 -#define PCI_ASLS 0xfc -#define PCI_SWSCI 0xe8 -#define PCI_SWSCI_SCISEL (1 << 15) -#define PCI_SWSCI_GSSCIE (1 << 0) -#define OPREGION_HEADER_OFFSET 0#define OPREGION_ACPI_OFFSET 0x100#define ACPI_CLID 0x01ac/* current lid state indicator */
@@ -251,7 +245,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)struct drm_i915_private *dev_priv = dev->dev_private;struct opregion_swsci *swsci = dev_priv->opregion.swsci;u32 main_function, sub_function, scic; -u16 pci_swsci; +u16 swsci_val;u32 dslp;if (!swsci)
@@ -299,16 +293,16 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) swsci->scic = scic;/* Ensure SCI event is selected and event trigger is cleared. */ -pci_read_config_word (dev->pdev,PCI_SWSCI , &pci_swsci); -if (!(pci_swsci &PCI_SWSCI_SCISEL ) || (pci_swsci &PCI_SWSCI_GSSCIE )) { - pci_swsci |=PCI_SWSCI_SCISEL ; - pci_swsci &= ~PCI_SWSCI_GSSCIE ; -pci_write_config_word (dev->pdev,PCI_SWSCI , pci_swsci); +pci_read_config_word (dev->pdev,SWSCI , &swsci_val); +if (!(swsci_val &SWSCI_SCISEL ) || (swsci_val &SWSCI_GSSCIE )) { + swsci_val |=SWSCI_SCISEL ; + swsci_val &= ~SWSCI_GSSCIE ; +pci_write_config_word (dev->pdev,SWSCI , swsci_val); }/* Use event trigger to tell bios to check the mail. */ - pci_swsci |=PCI_SWSCI_GSSCIE ; -pci_write_config_word (dev->pdev,PCI_SWSCI , pci_swsci); + swsci_val |=SWSCI_GSSCIE ; +pci_write_config_word (dev->pdev,SWSCI , swsci_val);/* Poll for the result. */ #define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
@@ -939,7 +933,7 @@ int intel_opregion_setup(struct drm_device *dev)BUILD_BUG_ON (sizeof (struct opregion_asle ) !=0x100 );BUILD_BUG_ON (sizeof (struct opregion_asle_ext ) !=0x400 ); -pci_read_config_dword (dev->pdev,PCI_ASLS , &asls); +pci_read_config_dword (dev->pdev,ASLS , &asls);DRM_DEBUG_DRIVER ("graphic opregion physical addr: 0x%x\n" , asls);if (asls ==0 ) {DRM_DEBUG_DRIVER ("ACPI OpRegion not supported!\n" );
drivers/gpu/drm/i915/intel_panel.c +2 -2
@@ -504,7 +504,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)if (panel->backlight.combination_mode) {u8 lbpc; -pci_read_config_byte (dev_priv->dev->pdev,PCI_LBPC , &lbpc); +pci_read_config_byte (dev_priv->dev->pdev,LBPC , &lbpc); val *= lbpc; }
@@ -592,7 +592,7 @@ static void i9xx_set_backlight(struct intel_connector *connector, u32 level) lbpc = level *0xfe / panel->backlight.max +1 ; level /= lbpc; -pci_write_config_byte (dev_priv->dev->pdev,PCI_LBPC , lbpc); +pci_write_config_byte (dev_priv->dev->pdev,LBPC , lbpc); }if (IS_GEN4 (dev_priv)) {
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Clean up PCI config register handling (rev2)
In reply to Joonas Lahtinen== Series Details ==
== Series Details ==
Series: drm/i915: Clean up PCI config register handling (rev2)
URL : https://patchwork.freedesktop.org/series/5768/
State : failure
== Summary ==
Series 5768v2 drm/i915: Clean up PCI config register handling
http://patchwork.freedesktop.org/api/1.0/series/5768/revisions/2/mbox/
Test gem_exec_whisper:
Subgroup basic:
incomplete -> PASS (bdw-nuci7)
Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
pass -> FAIL (snb-x220t)
Test kms_force_connector_basic:
Subgroup prune-stale-modes:
pass -> SKIP (ivb-t430s)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
pass -> INCOMPLETE (hsw-brixbox)bdw-nuci7 total:203 pass:191 dwarn:0 dfail:0 fail:0 skip:12 bdw-ultra total:203 pass:180 dwarn:0 dfail:0 fail:0 skip:23 bsw-nuc-2 total:202 pass:163 dwarn:0 dfail:0 fail:0 skip:39 byt-nuc total:202 pass:164 dwarn:0 dfail:0 fail:0 skip:38 hsw-brixbox total:33 pass:29 dwarn:0 dfail:0 fail:0 skip:3 hsw-gt2 total:203 pass:184 dwarn:0 dfail:0 fail:0 skip:19 ivb-t430s total:203 pass:174 dwarn:0 dfail:0 fail:0 skip:29 skl-i7k-2 total:203 pass:178 dwarn:0 dfail:0 fail:0 skip:25 skl-nuci5 total:203 pass:192 dwarn:0 dfail:0 fail:0 skip:11 snb-dellxps total:203 pass:165 dwarn:0 dfail:0 fail:0 skip:38 snb-x220t total:203 pass:164 dwarn:0 dfail:0 fail:2 skip:37
Results at /archive/results/CI_IGT_test/Patchwork_1930/
78673b24b60c1a884c947ee5a45ad860ca618418 drm-intel-nightly: 2016y-04m-18d-12h-32m-33s UTC integration manifest a315022 drm/i915: Clean up PCI config register handling
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Clean up PCI config register handling (rev3)
In reply to Joonas Lahtinen== Series Details ==
== Series Details ==
Series: drm/i915: Clean up PCI config register handling (rev3)
URL : https://patchwork.freedesktop.org/series/5768/
State : failure
== Summary ==
Series 5768v3 drm/i915: Clean up PCI config register handling
http://patchwork.freedesktop.org/api/1.0/series/5768/revisions/3/mbox/
bdw-nuci7 total:192 pass:180 dwarn:0 dfail:0 fail:0 skip:12 bdw-ultra total:127 pass:105 dwarn:0 dfail:0 fail:0 skip:22 bsw-nuc-2 total:191 pass:152 dwarn:0 dfail:0 fail:0 skip:39 byt-nuc total:191 pass:153 dwarn:0 dfail:0 fail:0 skip:38 hsw-brixbox total:192 pass:168 dwarn:0 dfail:0 fail:0 skip:24 hsw-gt2 total:192 pass:173 dwarn:0 dfail:0 fail:0 skip:19 ivb-t430s total:192 pass:164 dwarn:0 dfail:0 fail:0 skip:28 skl-i7k-2 total:192 pass:167 dwarn:0 dfail:0 fail:0 skip:25 skl-nuci5 total:192 pass:181 dwarn:0 dfail:0 fail:0 skip:11 snb-dellxps total:192 pass:154 dwarn:0 dfail:0 fail:0 skip:38 snb-x220t total:192 pass:154 dwarn:0 dfail:0 fail:1 skip:37
BOOT FAILED for ilk-hp8440p
Results at /archive/results/CI_IGT_test/Patchwork_1942/
83dde235b9d8bbe1cabf7ad002a6c48ff5a699fc drm-intel-nightly: 2016y-04m-19d-11h-58m-43s UTC integration manifest 6711989 drm/i915: Clean up PCI config register handling
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: ✗ Fi.CI.BAT: failure for drm/i915: Clean up PCI config register handling (rev3)
Quoted 12 lines · Patchwork
== Series Details ==
Series: drm/i915: Clean up PCI config register handling (rev3) URL : https://patchwork.freedesktop.org/series/5768/
State : failure== Summary ==
Series 5768v3 drm/i915: Clean up PCI config register handling
http://patchwork.freedesktop.org/api/1.0/series/5768/revisions/3/mbox/
Quoted 12 lines
bdw-nuci7 total:192 pass:180 dwarn:0 dfail:0 fail:0 skip:12 bdw-ultra total:127 pass:105 dwarn:0 dfail:0 fail:0 skip:22 bsw-nuc-2 total:191 pass:152 dwarn:0 dfail:0 fail:0 skip:39 byt-nuc total:191 pass:153 dwarn:0 dfail:0 fail:0 skip:38 hsw-brixbox total:192 pass:168 dwarn:0 dfail:0 fail:0 skip:24 hsw-gt2 total:192 pass:173 dwarn:0 dfail:0 fail:0 skip:19 ivb-t430s total:192 pass:164 dwarn:0 dfail:0 fail:0 skip:28 skl-i7k-2 total:192 pass:167 dwarn:0 dfail:0 fail:0 skip:25 skl-nuci5 total:192 pass:181 dwarn:0 dfail:0 fail:0 skip:11 snb-dellxps total:192 pass:154 dwarn:0 dfail:0 fail:0 skip:38 snb-x220t total:192 pass:154 dwarn:0 dfail:0 fail:1 skip:37 BOOT FAILED for ilk-hp8440p
Could not possibly be caused by the series. So all good, merging in.
Regards, Joonas
Quoted 6 lines
Results at /archive/results/CI_IGT_test/Patchwork_1942/
83dde235b9d8bbe1cabf7ad002a6c48ff5a699fcdrm-intel-nightly: 2016y-04m-19d-11h-58m-43s UTC integration manifest 6711989 drm/i915: Clean up PCI config register handling
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx