diff options
author | Luc Verhaegen <libv@skynet.be> | 2005-11-04 11:05:38 +0000 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2005-11-04 11:05:38 +0000 |
commit | 816598b6c3d4e5350f7f19fc2a5296f85c35f0b0 (patch) | |
tree | 1b9dfa902d5f8858992bb59fef5a532d2ecb88b1 | |
parent | cc9a4a0533dfc5abc8459b4bb08b1bd73162b90a (diff) |
[devel-p4m800_bandwidth]
- P4M800 turns out to be a VT7205A but on an intel northbridge. VT7205
revision says that it's a plain VT7205. Adjust ViaGetMemoryBandwidth to
check for host bridge device id and get the appropriate bandwidth.
- Move bandwith checking to via_driver.c, right after the memory clock
check.
-rw-r--r-- | src/via_bios.h | 1 | ||||
-rw-r--r-- | src/via_driver.c | 74 | ||||
-rw-r--r-- | src/via_mode.c | 32 | ||||
-rw-r--r-- | src/via_mode.h | 32 |
4 files changed, 74 insertions, 65 deletions
diff --git a/src/via_bios.h b/src/via_bios.h index 33797ed..f54560a 100644 --- a/src/via_bios.h +++ b/src/via_bios.h @@ -121,7 +121,6 @@ typedef struct _VIABIOSINFO { void ViaOutputsDetect(ScrnInfoPtr pScrn); Bool ViaOutputsSelect(ScrnInfoPtr pScrn); void ViaModesAttach(ScrnInfoPtr pScrn, MonPtr monitorp); -CARD32 ViaGetMemoryBandwidth(ScrnInfoPtr pScrn); ModeStatus ViaValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); void ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode); void ViaModeSecondary(ScrnInfoPtr pScrn, DisplayModePtr mode); diff --git a/src/via_driver.c b/src/via_driver.c index c4b9975..533aeed 100644 --- a/src/via_driver.c +++ b/src/via_driver.c @@ -648,6 +648,80 @@ ViaGetMemoryClock(ScrnInfoPtr pScrn) return MemClk; } +/* + * Bandwidth + * + */ +/* used for impossible entries: allow a minimum bandwidth in case this does happen */ +#define VIA_BW_MIN 74000000 /* > 640x480@60Hz@32bpp */ + +/* index to table */ +#define VIA_BW_VT3122A 0 +#define VIA_BW_VT3122C 1 +#define VIA_BW_VT7205 2 +#define VIA_BW_VT7205A 3 +#define VIA_BW_VT3108 4 +#define VIA_BW_VT3118 5 +#define VIA_BW_ALL 6 + +/* + * 393216000 is for SDR133 in via_refresh.h + * 460800000 is for DDR266 + */ +static struct { + CARD8 Device; /* equal to index */ + CARD32 Bandwidth[VIA_MEM_END]; +} ViaBandwidthTable[VIA_BW_ALL] = { + { VIA_BW_VT3122A, { 394000000, 461000000, VIA_BW_MIN, VIA_BW_MIN } }, + { VIA_BW_VT3122C, { 394000000, 461000000, VIA_BW_MIN, VIA_BW_MIN } }, + { VIA_BW_VT7205, { 394000000, 461000000, 461000000, VIA_BW_MIN } }, + { VIA_BW_VT7205A, { 394000000, 461000000, 461000000, 461000000 } }, + { VIA_BW_VT3108, { 394000000, 461000000, 461000000, 461000000 } }, + { VIA_BW_VT3118, { 394000000, 461000000, 461000000, 461000000 } } +}; + +/* + * + */ +static CARD32 +ViaGetMemoryBandwidth(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + + VIAFUNC(pScrn->scrnIndex); + + switch (pVia->Chipset) { + case VT3122: + if (VT3122_REV_IS_AX(pVia->ChipRev)) + return ViaBandwidthTable[VIA_BW_VT3122A].Bandwidth[pVia->MemClk]; + else + return ViaBandwidthTable[VIA_BW_VT3122C].Bandwidth[pVia->MemClk]; + case VT7205: + { + /* is this a KM400 or a P4M800 ? */ + Bool KM400 = FALSE; + + /* check host bridge pci device id. */ + if (pciReadWord(0x00000000, 0x02) == 0x3205) + KM400 = TRUE; + + /* 0x84 is earliest known KM400A device, 0x80 is more likely though */ + if (KM400 && (pVia->ChipRev < 0x84)) + return ViaBandwidthTable[VIA_BW_VT7205].Bandwidth[pVia->MemClk]; + else + return ViaBandwidthTable[VIA_BW_VT7205A].Bandwidth[pVia->MemClk]; + } + case VT3108: + return ViaBandwidthTable[VIA_BW_VT3108].Bandwidth[pVia->MemClk]; + case VT3118: + return ViaBandwidthTable[VIA_BW_VT3118].Bandwidth[pVia->MemClk]; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: Unknown Chipset.\n", + __FUNCTION__); + return VIA_BW_MIN; + } +} + static int LookupChipID(PciChipsets* pset, int ChipID) { /* Is there a function to do this for me? */ diff --git a/src/via_mode.c b/src/via_mode.c index b661042..1ca70e7 100644 --- a/src/via_mode.c +++ b/src/via_mode.c @@ -739,38 +739,6 @@ ViaModesAttach(ScrnInfoPtr pScrn, MonPtr monitorp) } /* - * - */ -CARD32 -ViaGetMemoryBandwidth(ScrnInfoPtr pScrn) -{ - VIAPtr pVia = VIAPTR(pScrn); - - VIAFUNC(pScrn->scrnIndex); - - switch (pVia->Chipset) { - case VT3122: - if (VT3122_REV_IS_AX(pVia->ChipRev)) - return ViaBandwidthTable[VIA_BW_VT3122A].Bandwidth[pVia->MemClk]; - else - return ViaBandwidthTable[VIA_BW_VT3122C].Bandwidth[pVia->MemClk]; - case VT7205: - /* 0x84 is earliest public device, 0x80 is more likely though */ - if (pVia->ChipRev < 0x84) - return ViaBandwidthTable[VIA_BW_VT7205].Bandwidth[pVia->MemClk]; - else - return ViaBandwidthTable[VIA_BW_VT7205A].Bandwidth[pVia->MemClk]; - case VT3108: - return ViaBandwidthTable[VIA_BW_VT3108].Bandwidth[pVia->MemClk]; - case VT3118: - return ViaBandwidthTable[VIA_BW_VT3118].Bandwidth[pVia->MemClk]; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaBandwidthAllowed: Unknown Chipset.\n"); - return VIA_BW_MIN; - } -} - -/* * Checks for limitations imposed by the available VGA timing registers. * */ diff --git a/src/via_mode.h b/src/via_mode.h index 1e4e303..0eb9534 100644 --- a/src/via_mode.h +++ b/src/via_mode.h @@ -27,38 +27,6 @@ #define _VIA_MODE_H_ 1 /* - * Bandwidth - * - */ -/* used for impossible entries: allow a minimum bandwidth in case this does happen */ -#define VIA_BW_MIN 74000000 /* > 640x480@60Hz@32bpp */ - -/* index to table */ -#define VIA_BW_VT3122A 0 -#define VIA_BW_VT3122C 1 -#define VIA_BW_VT7205 2 -#define VIA_BW_VT7205A 3 -#define VIA_BW_VT3108 4 -#define VIA_BW_VT3118 5 -#define VIA_BW_ALL 6 - -/* - * 393216000 is for SDR133 in via_refresh.h - * 460800000 is for DDR266 - */ -static struct { - CARD8 Device; /* equal to index */ - CARD32 Bandwidth[VIA_MEM_END]; -} ViaBandwidthTable[VIA_BW_ALL] = { - { VIA_BW_VT3122A, { 394000000, 461000000, VIA_BW_MIN, VIA_BW_MIN } }, - { VIA_BW_VT3122C, { 394000000, 461000000, VIA_BW_MIN, VIA_BW_MIN } }, - { VIA_BW_VT7205, { 394000000, 461000000, 461000000, VIA_BW_MIN } }, - { VIA_BW_VT7205A, { 394000000, 461000000, 461000000, 461000000 } }, - { VIA_BW_VT3108, { 394000000, 461000000, 461000000, 461000000 } }, - { VIA_BW_VT3118, { 394000000, 461000000, 461000000, 461000000 } } -}; - -/* * simple lookup table for dotclocks * */ |