[PATCH] fix to pcibios.c

SONE Takeshi ts1 at tsn.or.jp
Fri Aug 1 04:26:01 CEST 2003

A realmode BIOS function in the LinuxBIOS didn't work properly
(at least for me while trying to call int10h ax=4f01 of VGA BIOS),
and below is the fix.
With this fix, more boards and video cards might
be able to use built-in VGA BIOS support of LinuxBIOS.

Also I'm writing some code to switch video mode to VESA SuperVGA
and get mode information (address of framebuffer etc) from VGA BIOS,
then load 256-color logo image into the SuperVGA screen.
It would be nice if it can pass mode information to the kernel
(via LinuxBIOS table?) so we can use vesafb...

Index: pcibios.c
RCS file: /cvsroot/freebios/freebios/src/bioscall/pcibios.c,v
retrieving revision 1.3
diff -u -r1.3 pcibios.c
--- pcibios.c	22 May 2003 12:59:58 -0000	1.3
+++ pcibios.c	1 Aug 2003 08:17:10 -0000
@@ -50,7 +50,7 @@
 	unsigned short func = (unsigned short) eax;
 	int retval = -1;
 	unsigned short devid, vendorid, devfn;
-	int devindex;
+	short devindex; /* Use short to get rid of gabage in upper half of 32-bit register */
 	unsigned char bus;
 	struct pci_dev *dev;
@@ -76,7 +76,8 @@
 			*peax = 0;
 				// busnum is an unsigned char;
 				// devfn is an int, so we mask it off. 
-			busdevfn = dev->bus->secondary | (dev->devfn & 0xff);
+			busdevfn = (dev->bus->secondary << 8)
+					| (dev->devfn & 0xff);
 			printk_debug("0x%x: return 0x%x\n", func, busdevfn);
 			*pebx = busdevfn;
 			retval = 0;

More information about the coreboot mailing list