printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / mainboard / via / epia-m / vgabios.c
index 8565ba2236108d4d491504835477a43dca95690c..3af59547a8ad7d52ffbce8527ad637ca8c56ed2c 100644 (file)
@@ -7,6 +7,7 @@
 //#include <printk.h>
 #include <string.h>
 #include "vgachip.h"
+#include <cbfs.h>
 
 /* vgabios.c. Derived from: */
 
@@ -32,7 +33,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * Portions related to the alpha architecture are:
  *
@@ -66,7 +67,7 @@
  *--------------------------------------------------------------------*/
 
 /* Modified to be a self sufficient plug in so that it can be used 
-   without reliance on other parts of core Linuxbios 
+   without reliance on other parts of core coreboot 
    (C) 2005 Nick.Barker9@btinternet.com
 
   Used initially for epia-m where there are problems getting the bios
@@ -348,17 +349,17 @@ void do_vgabios(void)
        dev = dev_find_class(PCI_CLASS_DISPLAY_VGA<<8 , 0);
 
        if (!dev) {
-               printk_debug("NO VGA FOUND\n");
+               printk(BIOS_DEBUG, "NO VGA FOUND\n");
                return;
        }
-       printk_debug("found VGA: vid=%x, did=%x\n", dev->vendor, dev->device);
+       printk(BIOS_DEBUG, "found VGA: vid=%x, did=%x\n", dev->vendor, dev->device);
 
        /* declare rom address here - keep any config data out of the way
         * of core LXB stuff */
 
-       rom = 0xfffc0000;
+       rom = (unsigned int)cbfs_load_optionrom(dev->vendor, dev->device, 0); 
        pci_write_config32(dev, PCI_ROM_ADDRESS, rom|1);
-       printk_debug("rom base, size: %x\n", rom);
+       printk(BIOS_DEBUG, "rom base, size: %x\n", rom);
 
        buf = (unsigned char *) rom;
        if ((buf[0] == 0x55) && (buf[1] == 0xaa)) {
@@ -369,14 +370,14 @@ void do_vgabios(void)
                // check signature again
                buf = (unsigned char *) 0xc0000;
                if (buf[0]==0x55 && buf[1]==0xAA) {
-                       busdevfn = (dev->bus->secondary << 8) | dev->path.u.pci.devfn;
-                       printk_debug("bus/devfn = %#x\n", busdevfn);
+                       busdevfn = (dev->bus->secondary << 8) | dev->path.pci.devfn;
+                       printk(BIOS_DEBUG, "bus/devfn = %#x\n", busdevfn);
 
                        real_mode_switch_call_vga(busdevfn);
                } else
-                       printk_debug("Failed to copy VGA BIOS to 0xc0000\n");
+                       printk(BIOS_DEBUG, "Failed to copy VGA BIOS to 0xc0000\n");
        } else 
-               printk_debug("BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
+               printk(BIOS_DEBUG, "BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
 
        pci_write_config32(dev, PCI_ROM_ADDRESS, 0);
 }
@@ -399,10 +400,10 @@ struct realidt {
 // that simplifies a lot of things ...
 // we'll just push all the registers on the stack as longwords, 
 // and pop to protected mode. 
-// second, since this only ever runs as part of linuxbios
+// second, since this only ever runs as part of coreboot
 // we know all the segment register values -- so we don't save any.
 // keep the handler that calls things small. It can do a call to 
-// more complex code in linuxbios itself. This helps a lot as we don't
+// more complex code in coreboot itself. This helps a lot as we don't
 // have to do address fixup in this little stub, and calls are absolute
 // so the handler is relocatable.
 void handler(void)
@@ -561,28 +562,28 @@ int biosint(unsigned long intnumber,
        cs = cs_ip >> 16;
        flags = stackflags;
        
-       printk_debug("biosint: INT# 0x%lx\n", intnumber);
-       printk_debug("biosint: eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n", 
+       printk(BIOS_DEBUG, "biosint: INT# 0x%lx\n", intnumber);
+       printk(BIOS_DEBUG, "biosint: eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n", 
                      eax, ebx, ecx, edx);
-       printk_debug("biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
+       printk(BIOS_DEBUG, "biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
                     ebp, esp, edi, esi);
-       printk_debug("biosint:  ip 0x%x   cs 0x%x  flags 0x%x\n",
+       printk(BIOS_DEBUG, "biosint:  ip 0x%x   cs 0x%x  flags 0x%x\n",
                     ip, cs, flags);
 
        // cases in a good compiler are just as good as your own tables. 
        switch (intnumber) {
        case 0 ... 15:
                // These are not BIOS service, but the CPU-generated exceptions
-               printk_info("biosint: Oops, exception %u\n", intnumber);
+               printk(BIOS_INFO, "biosint: Oops, exception %u\n", intnumber);
                if (esp < 0x1000) {
-                       printk_debug("Stack contents: ");
+                       printk(BIOS_DEBUG, "Stack contents: ");
                        while (esp < 0x1000) {
-                               printk_debug("0x%04x ", *(unsigned short *) esp);
+                               printk(BIOS_DEBUG, "0x%04x ", *(unsigned short *) esp);
                                esp += 2;
                        }
-                       printk_debug("\n");
+                       printk(BIOS_DEBUG, "\n");
                }
-               printk_debug("biosint: Bailing out\n");
+               printk(BIOS_DEBUG, "biosint: Bailing out\n");
                // "longjmp"
                vga_exit();
                break;
@@ -601,7 +602,7 @@ int biosint(unsigned long intnumber,
                                &ebx, &edx, &ecx, &eax, &flags);
                break;
        default:
-               printk_info("BIOSINT: Unsupport int #0x%x\n", 
+               printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%x\n", 
                            intnumber);
                break;
        }
@@ -726,8 +727,8 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
                        // busnum is an unsigned char;
                        // devfn is an int, so we mask it off. 
                        busdevfn = (dev->bus->secondary << 8)
-                               | (dev->path.u.pci.devfn & 0xff);
-                       printk_debug("0x%x: return 0x%x\n", func, busdevfn);
+                               | (dev->path.pci.devfn & 0xff);
+                       printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn);
                        *pebx = busdevfn;
                        retval = 0;
                } else {
@@ -753,7 +754,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
                reg = *pedi;
                dev = dev_find_slot(bus, devfn);
                if (! dev) {
-                       printk_debug("0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
+                       printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
                        // idiots. the pcibios guys assumed you'd never pass a bad bus/devfn!
                        *peax = PCIBIOS_BADREG;
                        retval = -1;
@@ -787,14 +788,14 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
                
                if (retval) 
                        retval = PCIBIOS_BADREG;
-               printk_debug("0x%x: bus %d devfn 0x%x reg 0x%x val 0x%lx\n",
+               printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%lx\n",
                             func, bus, devfn, reg, *pecx);
                *peax = 0;
                retval = 0;
        }
        break;
        default:
-               printk_err("UNSUPPORTED PCIBIOS FUNCTION 0x%x\n",  func);
+               printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n",  func);
                break;
        }