diff options
author | Francisco Jerez <currojerez@gmail.com> | 2008-08-16 12:25:18 +0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-08-16 19:16:28 -0300 |
commit | 772e899e71efab208b844b09c75f9f49ff453386 (patch) | |
tree | 30eac54609e174447b8fbb3b407a2d874b215921 | |
parent | d28ed6aa0d28fdcf8f555b2bb8a58fe28d1b464b (diff) |
Memory detection moved before memory mapping in SMI_PreInit.
Take into account the VideoRam configuration option.
Signed-off-by: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
-rw-r--r-- | src/smi_driver.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/smi_driver.c b/src/smi_driver.c index ec2af1a..12be909 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -879,9 +879,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) } } - SMI_MapMem(pScrn); - SMI_DisableVideo(pScrn); - hwp = VGAHWPTR(pScrn); vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; @@ -890,6 +887,57 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, " "MMIOBase=%p\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase); + /* Next go on to detect amount of installed ram */ + config = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x71); + + /* And compute the amount of video memory and offscreen memory */ + pSmi->videoRAMKBytes = 0; + + pScrn->videoRam=pScrn->confScreen->device->videoRam; + if (!pScrn->videoRam) { + switch (pSmi->Chipset) { + default: + { + int mem_table[4] = { 1, 2, 4, 0 }; + pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024; + break; + } + case SMI_LYNX3D: + { + int mem_table[4] = { 0, 2, 4, 6 }; + pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024 + 512; + break; + } + case SMI_LYNX3DM: + { + int mem_table[4] = { 16, 2, 4, 8 }; + pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024; + break; + } + case SMI_COUGAR3DR: + { + /* DANGER - Cougar3DR BIOS is broken - hardcode video ram size */ + /* per instructions from Silicon Motion engineers */ + pSmi->videoRAMKBytes = 16 * 1024; + break; + } + } + pSmi->videoRAMBytes = pSmi->videoRAMKBytes * 1024; + pScrn->videoRam = pSmi->videoRAMKBytes; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "videoram: %dkB\n", + pSmi->videoRAMKBytes); + } else { + pSmi->videoRAMKBytes = pScrn->videoRam; + pSmi->videoRAMBytes = pScrn->videoRam * 1024; + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "videoram: %dk\n", + pSmi->videoRAMKBytes); + } + + SMI_MapMem(pScrn); + SMI_DisableVideo(pScrn); + /* detect the panel size */ SMI_DetectPanelSize(pScrn); @@ -954,54 +1002,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) } } - - /* Next go on to detect amount of installed ram */ - config = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x71); - - /* And compute the amount of video memory and offscreen memory */ - pSmi->videoRAMKBytes = 0; - - if (!pScrn->videoRam) { - switch (pSmi->Chipset) { - default: - { - int mem_table[4] = { 1, 2, 4, 0 }; - pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024; - break; - } - case SMI_LYNX3D: - { - int mem_table[4] = { 0, 2, 4, 6 }; - pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024 + 512; - break; - } - case SMI_LYNX3DM: - { - int mem_table[4] = { 16, 2, 4, 8 }; - pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024; - break; - } - case SMI_COUGAR3DR: - { - /* DANGER - Cougar3DR BIOS is broken - hardcode video ram size */ - /* per instructions from Silicon Motion engineers */ - pSmi->videoRAMKBytes = 16 * 1024; - break; - } - } - pSmi->videoRAMBytes = pSmi->videoRAMKBytes * 1024; - pScrn->videoRam = pSmi->videoRAMKBytes; - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "videoram: %dkB\n", - pSmi->videoRAMKBytes); - } else { - pSmi->videoRAMKBytes = pScrn->videoRam; - pSmi->videoRAMBytes = pScrn->videoRam * 1024; - - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "videoram: %dk\n", - pSmi->videoRAMKBytes); - } - /* Detect current MCLK and print it for user */ m = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6A); n = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6B); |