From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org, Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>, Yinghai Lu <yinghai@kernel.org>,
Guo Chao <yan@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v7 08/15] agp/intel: Support 64-bit GMADR
Date: Mon, 06 Jan 2014 17:56:09 -0700 [thread overview]
Message-ID: <20140107005609.10786.29922.stgit@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20140107005003.10786.85164.stgit@bhelgaas-glaptop.roam.corp.google.com>
From: Yinghai Lu <yinghai@kernel.org>
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>
---
drivers/char/agp/intel-agp.h | 4 ++--
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 @@
#define INTEL_I860_ERRSTS 0xc8
/* Intel i810 registers */
-#define I810_GMADDR 0x10
+#define I810_GMADR_BAR 0
#define I810_MMADDR 0x14
#define I810_PTE_BASE 0x10000
#define I810_PTE_MAIN_UNCACHED 0x00000000
@@ -113,7 +113,7 @@
#define INTEL_I850_ERRSTS 0xc8
/* intel 915G registers */
-#define I915_GMADDR 0x18
+#define I915_GMADR_BAR 2
#define I915_MMADDR 0x10
#define I915_PTEADDR 0x1C
#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)
static int intel_gtt_init(void)
{
- u32 gma_addr;
u32 gtt_map_size;
- int ret;
+ int ret, bar;
ret = intel_private.driver->setup();
if (ret != 0)
@@ -660,14 +659,11 @@ static int intel_gtt_init(void)
}
if (INTEL_GTT_GEN <= 2)
- pci_read_config_dword(intel_private.pcidev, I810_GMADDR,
- &gma_addr);
+ bar = I810_GMADR_BAR;
else
- pci_read_config_dword(intel_private.pcidev, I915_GMADDR,
- &gma_addr);
-
- intel_private.gma_bus_addr = (gma_addr & PCI_BASE_ADDRESS_MEM_MASK);
+ bar = I915_GMADR_BAR;
+ intel_private.gma_bus_addr = pci_bus_address(intel_private.pcidev, bar);
return 0;
}
next prev parent reply other threads:[~2014-01-07 0:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 0:55 [PATCH v7 00/15] PCI: Allocate 64-bit BARs above 4G when possible Bjorn Helgaas
2014-01-07 0:55 ` [PATCH v7 01/15] PCI: Change pci_bus_region addresses to dma_addr_t Bjorn Helgaas
2014-01-07 0:55 ` [PATCH v7 02/15] PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev Bjorn Helgaas
2014-01-07 0:55 ` [PATCH v7 03/15] PCI: Add pci_bus_address() to get bus address of a BAR Bjorn Helgaas
2014-01-07 0:55 ` [PATCH v7 04/15] agp: Support 64-bit APBASE Bjorn Helgaas
2014-01-07 0:55 ` [PATCH v7 05/15] agp: Use pci_resource_start() to get CPU physical address for BAR Bjorn Helgaas
2014-01-07 0:55 ` [PATCH v7 06/15] drm/i915: Rename gtt_bus_addr to gtt_phys_addr Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 07/15] agp/intel: " Bjorn Helgaas
2014-01-07 0:56 ` Bjorn Helgaas [this message]
2014-01-07 0:56 ` [PATCH v7 09/15] agp/intel: Use pci_bus_address() to get MMADR bus address Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 10/15] agp/intel: Use pci_bus_address() to get GTTADR " Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 11/15] agp/intel: Use CPU physical address, not bus address, for ioremap() Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 12/15] agp/ati: Use PCI_COMMAND instead of hard-coded 4 Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 13/15] PCI: Split out bridge window override of minimum allocation address Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 14/15] PCI: Enforce bus address limits in resource allocation Bjorn Helgaas
2014-01-07 0:56 ` [PATCH v7 15/15] PCI: Allocate 64-bit BARs above 4G when possible Bjorn Helgaas
2014-01-07 10:46 ` [PATCH v7 00/15] " Daniel Vetter
2014-01-07 18:46 ` Bjorn Helgaas
2014-01-10 21:34 ` Bjorn Helgaas
2014-01-15 5:14 ` Dave Airlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140107005609.10786.29922.stgit@bhelgaas-glaptop.roam.corp.google.com \
--to=bhelgaas@google.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=yan@linux.vnet.ibm.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®