Skip to content

Commit b5e350f

Browse files
committed
agp/intel: Use pci_bus_address() to get GTTADR bus address
Per the Intel 915G/915GV/... Chipset spec (document number 301467-005), GTTADR is a standard PCI BAR. The PCI core reads GTTADR at enumeration-time. Use pci_bus_address() instead of reading it again in the driver. This works correctly for both 32-bit and 64-bit BARs. The spec above only mentions 32-bit GTTADR, but we should still use the standard interface. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 5ef6d8f commit b5e350f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

drivers/char/agp/intel-agp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
/* intel 915G registers */
116116
#define I915_GMADR_BAR 2
117117
#define I915_MMADR_BAR 0
118-
#define I915_PTEADDR 0x1C
118+
#define I915_PTE_BAR 3
119119
#define I915_GMCH_GMS_STOLEN_48M (0x6 << 4)
120120
#define I915_GMCH_GMS_STOLEN_64M (0x7 << 4)
121121
#define G33_GMCH_GMS_STOLEN_128M (0x8 << 4)

drivers/char/agp/intel-gtt.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ static void i965_write_entry(dma_addr_t addr,
11021102

11031103
static int i9xx_setup(void)
11041104
{
1105-
u32 reg_addr, gtt_addr;
1105+
u32 reg_addr;
11061106
int size = KB(512);
11071107

11081108
reg_addr = pci_bus_address(intel_private.pcidev, I915_MMADR_BAR);
@@ -1113,9 +1113,8 @@ static int i9xx_setup(void)
11131113

11141114
switch (INTEL_GTT_GEN) {
11151115
case 3:
1116-
pci_read_config_dword(intel_private.pcidev,
1117-
I915_PTEADDR, &gtt_addr);
1118-
intel_private.gtt_phys_addr = gtt_addr;
1116+
intel_private.gtt_phys_addr =
1117+
pci_bus_address(intel_private.pcidev, I915_PTE_BAR);
11191118
break;
11201119
case 5:
11211120
intel_private.gtt_phys_addr = reg_addr + MB(2);

0 commit comments

Comments
 (0)