[Top] [All Lists]

vga initialization

To: "" <>
Subject: vga initialization
From: Zhang Fuxin <>
Date: Wed, 24 Apr 2002 9:11:38 +0800
  I find most code is already there in scitech's x86emu-0.8.
in one day it is adapted into linux kernel.

  If anybody is interested,my code can be fetched from

For a short description,the READ in the package is paste here:

This is x86/bios emulator adapted for used in 2.4 kernel
to do initialize pc VGA cards.

Port it to pmon/yamon should be easy,if you want an userland
executable,please download the original x86emu-0.8 from SciTech 
Software, Inc.

 here is my choice:
  1.add code in new directory arch/mips/freebiosvga/
     add config option CONFIG_VGA_POST to proper place
         bool '  Support for VGA POST' CONFIG_VGA_POST

     add directory and target objects of freevgabios

     ifdef CONFIG_VGA_POST
     SUBDIRS      += arch/mips/freebiosvga
     LIBS         += arch/mips/freebiosvga/vga.o
     SUBDIRS      += arch/mips/freebiosvga/x86emu
     LIBS         += arch/mips/freebiosvga/x86emu/x86emu.o

    add call to vgabios_init (right after pci_init)
    #ifdef CONFIG_VGA_POST
    #endif 'VGA text console' or proper framebuffer, you may need to
  slightly modify the code,because many of them is for x86

    for 'VGA text console',the file is drivers/video/vgacon.c,propably
  you need to comment out the check for card's presence in vgacon_startup.
  Because card initialization is later than console_init,so at that time
  pci address 0xa0000-0xc0000 may not response to your requests.

Problems & limits:
  1.currently the code rely on system's pci resource allocator to assign
    a valid address to rom base register(offset 0x30 in pci header).
    I have modified the pci_auto.c to handle rom. Patch is here:

     diff -r1.2 pci_auto.c
     >       u32 bases[7] = 
     >                       PCI_ROM_ADDRESS};
     <       for (bar = PCI_BASE_ADDRESS_0; bar <= PCI_BASE_ADDRESS_5; bar+=4) {
     >       for (bar_nr=0; bar_nr<7; bar_nr++) {
     >               bar = bases[bar_nr];
     <               if (bar_response & PCI_BASE_ADDRESS_SPACE) {
     >               if (bar_nr != 6 && (bar_response & 
     <               bar_nr++;
     <                       DBG("Skipping legacy mode IDE controller\n");

   if you don't use pci_auto,then make sure your pmon/yamon do it.

   Of course,you can write an absolute,safe value for your specific platform
   to see it works:)

   If the base address read from your card is invalid,you will get message 
     "No address assigned to rom" or "No valid bios found"
 2. i am assuming ioremap(a_pci_address) will return a valid cpu virtue 
   address for accessing memory located at 'a_pci_address'.

 3. Multiple cards are not supported currently,though it may be a piece of
 cake.Complex cards,e.g. those contain bridges,may fail.

 4. cards tested here include: 
   trident 3Dimage9750,S3virge,Riva TNT2

  It is provided "as is" without express or implied warranty.

  Any problems you can contact

Happy hacking and good luck.


Zhang Fuxin
System Architecture Lab
Institute of Computing Technology
Chinese Academy of Sciences,China

            Zhang Fuxin

<Prev in Thread] Current Thread [Next in Thread>