summaryrefslogtreecommitdiff
path: root/src/nv_setup.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-07-06 20:25:23 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-07-07 08:05:51 +1000
commit4b6e0b96188e32cb2a13f8d2bd5973f0287c827b (patch)
treec8089a5c09d230ee22375e4d6b637fc6dca1d401 /src/nv_setup.c
parent1e22673f43acd0f02ba36e189b39e28b635cd50c (diff)
No need for pci access wrappers now..
Diffstat (limited to 'src/nv_setup.c')
-rw-r--r--src/nv_setup.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/nv_setup.c b/src/nv_setup.c
index 7e31c2c..f0478ca 100644
--- a/src/nv_setup.c
+++ b/src/nv_setup.c
@@ -50,6 +50,18 @@ static void nv10GetConfig(ScrnInfoPtr pScrn)
{
NVPtr pNv = NVPTR(pScrn);
uint32_t implementation = pNv->Chipset & 0x0ff0;
+ struct pci_device *dev = NULL;
+ uint32_t data;
+
+ if (implementation == CHIPSET_NFORCE ||
+ implementation == CHIPSET_NFORCE2) {
+ dev = pci_device_find_by_slot(0, 0, 0, 1);
+ if (!dev) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "couldn't find bridge device\n");
+ return;
+ }
+ }
#if X_BYTE_ORDER == X_BIG_ENDIAN
if (!(nvReadMC(pNv, 0x0004) & 0x01000001))
@@ -57,12 +69,16 @@ static void nv10GetConfig(ScrnInfoPtr pScrn)
"Card is in big endian mode, something is very wrong !\n");
#endif
- if (implementation == CHIPSET_NFORCE)
- pNv->RamAmountKBytes = (((PCI_SLOT_READ_LONG(1, 0x7c) >> 6) & 31) + 1) * 1024;
- else if (implementation == CHIPSET_NFORCE2)
- pNv->RamAmountKBytes = (((PCI_SLOT_READ_LONG(1, 0x84) >> 4) & 127) + 1) * 1024;
- else
- pNv->RamAmountKBytes = (nvReadFB(pNv, NV_PFB_CSTATUS) & 0xFFF00000) >> 10;
+ if (implementation == CHIPSET_NFORCE) {
+ pci_device_cfg_read_u32(dev, &data, 0x7c);
+ pNv->RamAmountKBytes = (((data >> 6) & 31) + 1) * 1024;
+ } else if (implementation == CHIPSET_NFORCE2) {
+ pci_device_cfg_read_u32(dev, &data, 0x84);
+ pNv->RamAmountKBytes = (((data >> 4) & 127) + 1) * 1024;
+ } else {
+ pNv->RamAmountKBytes =
+ (nvReadFB(pNv, NV_PFB_CSTATUS) & 0xFFF00000) >> 10;
+ }
if (pNv->RamAmountKBytes > 256*1024)
pNv->RamAmountKBytes = 256*1024;