From 692789a293970f70b88ccb6adcf0676d8b495ae2 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Thu, 7 Feb 2008 18:03:37 +0200 Subject: mach64: factor out BIOS multimedia parsing --- src/atipreinit.c | 101 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/atipreinit.c b/src/atipreinit.c index 1c92f5d1..8c67932f 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -316,6 +316,60 @@ ati_bios_clock } } +/* + * Pick up multimedia information, which will be at different + * displacements depending on table revision. + */ +static void +ati_bios_mmedia +( + ScrnInfoPtr pScreenInfo, + ATIPtr pATI, + CARD8 *BIOS, + unsigned int VideoTable +) +{ + pATI->Audio = ATI_AUDIO_NONE; + + if (VideoTable > 0) + { + switch (BIOSByte(VideoTable - 0x02U)) + { + case 0x00U: + pATI->Tuner = BIOSByte(VideoTable) & 0x1FU; + + /* + * XXX The VideoTable[1] byte is known to have been + * omitted in LTPro and Mobility BIOS'es. Any others? + */ + switch (pATI->Chip) + { + case ATI_CHIP_264LTPRO: + case ATI_CHIP_MOBILITY: + pATI->Decoder = BIOSByte(VideoTable + 0x01U) & 0x07U; + pATI->Audio = BIOSByte(VideoTable + 0x02U) & 0x0FU; + break; + + default: + pATI->Decoder = BIOSByte(VideoTable + 0x02U) & 0x07U; + pATI->Audio = BIOSByte(VideoTable + 0x03U) & 0x0FU; + break; + } + + break; + + case 0x01U: + pATI->Tuner = BIOSByte(VideoTable) & 0x1FU; + pATI->Audio = BIOSByte(VideoTable + 0x01U) & 0x0FU; + pATI->Decoder = BIOSByte(VideoTable + 0x05U) & 0x0FU; + break; + + default: + break; + } + } +} + /* * ATIPreInit -- * @@ -604,7 +658,6 @@ ATIPreInit pATI->LCDPanelID = -1; pATI->nFIFOEntries = 16; /* For now */ - pATI->Audio = ATI_AUDIO_NONE; /* Finish probing the adapter */ { @@ -811,51 +864,7 @@ ATIPreInit ati_bios_clock(pScreenInfo, pATI, BIOS, ClockTable, pGDev); - /* - * Pick up multimedia information, which will be at different - * displacements depending on table revision. - */ - if (VideoTable > 0) - { - switch (BIOSByte(VideoTable - 0x02U)) - { - case 0x00U: - pATI->Tuner = BIOSByte(VideoTable) & 0x1FU; - - /* - * XXX The VideoTable[1] byte is known to have been - * omitted in LTPro and Mobility BIOS'es. Any others? - */ - switch (pATI->Chip) - { - case ATI_CHIP_264LTPRO: - case ATI_CHIP_MOBILITY: - pATI->Decoder = - BIOSByte(VideoTable + 0x01U) & 0x07U; - pATI->Audio = - BIOSByte(VideoTable + 0x02U) & 0x0FU; - break; - - default: - pATI->Decoder = - BIOSByte(VideoTable + 0x02U) & 0x07U; - pATI->Audio = - BIOSByte(VideoTable + 0x03U) & 0x0FU; - break; - } - - break; - - case 0x01U: - pATI->Tuner = BIOSByte(VideoTable) & 0x1FU; - pATI->Audio = BIOSByte(VideoTable + 0x01U) & 0x0FU; - pATI->Decoder = BIOSByte(VideoTable + 0x05U) & 0x0FU; - break; - - default: - break; - } - } + ati_bios_mmedia(pScreenInfo, pATI, BIOS, VideoTable); /* Determine panel dimensions */ if (pATI->LCDPanelID >= 0) -- cgit v1.2.3