diff options
author | Yinghai Lu <yinghai@kernel.org> | 2014-01-03 20:28:06 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-01-07 13:36:55 -0500 |
commit | 545b0a746b79f54a45cd3b595dce67abbf35233f (patch) | |
tree | da9b8ceb1a94fe321bfd5308d557d2f09533e449 | |
parent | 5acc4ce44cd0a9cf5dbcfe50085708e9156e0177 (diff) |
agp/intel: Support 64-bit GMADR
Per the Intel 915G/915GV/... Chipset spec (document number 301467-005),
GMADR is a standard PCI BAR.
The PCI core reads GMADR 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 GMADR, but
Yinghai's patch (link below) indicates some devices have a 64-bit GMADR.
[bhelgaas: reworked starting from http://lkml.kernel.org/r/1385851238-21085-13-git-send-email-yinghai@kernel.org]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/char/agp/intel-agp.h | 4 | ||||
-rw-r--r-- | drivers/char/agp/intel-gtt.c | 12 |
2 files changed, 6 insertions, 10 deletions
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index 1042c1b90376..0bf5590fd0f9 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -55,7 +55,7 @@ | |||
55 | #define INTEL_I860_ERRSTS 0xc8 | 55 | #define INTEL_I860_ERRSTS 0xc8 |
56 | 56 | ||
57 | /* Intel i810 registers */ | 57 | /* Intel i810 registers */ |
58 | #define I810_GMADDR 0x10 | 58 | #define I810_GMADR_BAR 0 |
59 | #define I810_MMADDR 0x14 | 59 | #define I810_MMADDR 0x14 |
60 | #define I810_PTE_BASE 0x10000 | 60 | #define I810_PTE_BASE 0x10000 |
61 | #define I810_PTE_MAIN_UNCACHED 0x00000000 | 61 | #define I810_PTE_MAIN_UNCACHED 0x00000000 |
@@ -113,7 +113,7 @@ | |||
113 | #define INTEL_I850_ERRSTS 0xc8 | 113 | #define INTEL_I850_ERRSTS 0xc8 |
114 | 114 | ||
115 | /* intel 915G registers */ | 115 | /* intel 915G registers */ |
116 | #define I915_GMADDR 0x18 | 116 | #define I915_GMADR_BAR 2 |
117 | #define I915_MMADDR 0x10 | 117 | #define I915_MMADDR 0x10 |
118 | #define I915_PTEADDR 0x1C | 118 | #define I915_PTEADDR 0x1C |
119 | #define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) | 119 | #define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 54202ffcf467..560f66bffebb 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -608,9 +608,8 @@ static bool intel_gtt_can_wc(void) | |||
608 | 608 | ||
609 | static int intel_gtt_init(void) | 609 | static int intel_gtt_init(void) |
610 | { | 610 | { |
611 | u32 gma_addr; | ||
612 | u32 gtt_map_size; | 611 | u32 gtt_map_size; |
613 | int ret; | 612 | int ret, bar; |
614 | 613 | ||
615 | ret = intel_private.driver->setup(); | 614 | ret = intel_private.driver->setup(); |
616 | if (ret != 0) | 615 | if (ret != 0) |
@@ -660,14 +659,11 @@ static int intel_gtt_init(void) | |||
660 | } | 659 | } |
661 | 660 | ||
662 | if (INTEL_GTT_GEN <= 2) | 661 | if (INTEL_GTT_GEN <= 2) |
663 | pci_read_config_dword(intel_private.pcidev, I810_GMADDR, | 662 | bar = I810_GMADR_BAR; |
664 | &gma_addr); | ||
665 | else | 663 | else |
666 | pci_read_config_dword(intel_private.pcidev, I915_GMADDR, | 664 | bar = I915_GMADR_BAR; |
667 | &gma_addr); | ||
668 | |||
669 | intel_private.gma_bus_addr = (gma_addr & PCI_BASE_ADDRESS_MEM_MASK); | ||
670 | 665 | ||
666 | intel_private.gma_bus_addr = pci_bus_address(intel_private.pcidev, bar); | ||
671 | return 0; | 667 | return 0; |
672 | } | 668 | } |
673 | 669 | ||