diff options
author | Ian Romanick <idr@umwelt.(none)> | 2006-08-07 13:27:48 -0700 |
---|---|---|
committer | Ian Romanick <idr@umwelt.(none)> | 2006-08-07 13:27:48 -0700 |
commit | 31939c4c516124bfca0de7db4278b6b16df5e70f (patch) | |
tree | c02a54ece6b6930cf469d7766f8cdcdb9131825e /src | |
parent | 3a7f84ac41e93a9395891913cec1c5acb30937d0 (diff) |
Introduce the savage_region structure, which is used to track mappable
regions of PCI space.
Diffstat (limited to 'src')
-rw-r--r-- | src/savage_driver.c | 57 | ||||
-rw-r--r-- | src/savage_driver.h | 10 |
2 files changed, 51 insertions, 16 deletions
diff --git a/src/savage_driver.c b/src/savage_driver.c index 9d89fa2..912540c 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -2819,14 +2819,48 @@ static Bool SavageMapMem(ScrnInfoPtr pScrn) psav = SAVPTR(pScrn); if( S3_SAVAGE3D_SERIES(psav->Chipset) ) { - psav->MmioBase = psav->PciInfo->memBase[0] + SAVAGE_NEWMMIO_REGBASE_S3; - psav->FrameBufferBase = psav->PciInfo->memBase[0]; + psav->MmioRegion.bar = 0; + psav->MmioRegion.offset = SAVAGE_NEWMMIO_REGBASE_S3; + + psav->FbRegion.bar = 0; + psav->FbRegion.offset = 0; + + psav->last_bar = 0; + } else { + psav->MmioRegion.bar = 0; + psav->MmioRegion.offset = SAVAGE_NEWMMIO_REGBASE_S4; + + psav->FbRegion.bar = 1; + psav->FbRegion.offset = 0; + + psav->last_bar = 1; } - else { - psav->MmioBase = psav->PciInfo->memBase[0] + SAVAGE_NEWMMIO_REGBASE_S4; - psav->FrameBufferBase = psav->PciInfo->memBase[1]; + + /* On Paramount and Savage 2000, aperture 0 is PCI base 2. On other + * chipsets it's in the same BAR as the framebuffer. + */ + if ((psav->Chipset == S3_SUPERSAVAGE) + || (psav->Chipset == S3_SAVAGE2000)) { + psav->ApertureRegion.bar = 2; + psav->ApertureRegion.offset = 0; + + psav->last_bar = 2; + } else { + psav->ApertureRegion.bar = psav->FbRegion.bar; + psav->ApertureRegion.offset = 0x02000000; } + + psav->MmioBase = psav->PciInfo->memBase[ psav->MmioRegion.bar ] + + psav->MmioRegion.offset; + + psav->FrameBufferBase = psav->PciInfo->memBase[ psav->FbRegion.bar ] + + psav->FbRegion.offset; + + psav->ApertureBase = psav->PciInfo->memBase[ psav->FbRegion.bar ] + + psav->ApertureRegion.offset; + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "mapping MMIO @ 0x%lx with size 0x%x\n", psav->MmioBase, SAVAGE_NEWMMIO_REGSIZE); @@ -2863,12 +2897,6 @@ static Bool SavageMapMem(ScrnInfoPtr pScrn) psav->FBStart = psav->FBBase; } - if ((psav->Chipset == S3_SUPERSAVAGE) || (psav->Chipset == S3_SAVAGE2000)) - /* paramount, savage2000 aperture 0 is pci base 2 */ - psav->ApertureBase = psav->PciInfo->memBase[2]; - else - psav->ApertureBase = psav->FrameBufferBase + 0x02000000; - if (psav->IsSecondary) { psav->ApertureMap = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, psav->PciTag, psav->ApertureBase, @@ -2889,12 +2917,9 @@ static Bool SavageMapMem(ScrnInfoPtr pScrn) "Internal error: could not map aperture\n"); return FALSE; } - else - { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "map aperture:%p\n",psav->ApertureMap); - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "map aperture: %p\n", + psav->ApertureMap); if (psav->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; diff --git a/src/savage_driver.h b/src/savage_driver.h index 805aa64..3e97106 100644 --- a/src/savage_driver.h +++ b/src/savage_driver.h @@ -266,6 +266,11 @@ typedef struct _StatInfo { int realOff;
} StatInfoRec,*StatInfoPtr;
+struct savage_region {
+ unsigned bar;
+ unsigned long offset;
+};
+
typedef struct _Savage {
SavageRegRec SavedReg;
SavageRegRec ModeReg;
@@ -293,6 +298,11 @@ typedef struct _Savage { unsigned long ShadowPhysical;
/* These are linear addresses. */
+ struct savage_region MmioRegion;
+ struct savage_region FbRegion;
+ struct savage_region ApertureRegion;
+ unsigned last_bar;
+
unsigned char* MapBase;
unsigned char* BciMem;
unsigned char* FBBase;
|