build and boot tested on qemu.

Backwards-compatible, I have not even tested with a rom in romfs yet :-)

ron
Fix bug in pci_rom.c. it is now utterly backwards compatible. 

Move qemu over to ROMFS. It works fine and it's time to 
start showing people how to make the transition. Next step will be to demo
how to put option romfs in ROMFS. 

This is build and boot tested on qemu.

Signed-off-by: Ronald G. Minnich <[email protected]>

Index: src/devices/pci_rom.c
===================================================================
--- src/devices/pci_rom.c	(revision 4077)
+++ src/devices/pci_rom.c	(working copy)
@@ -31,32 +31,40 @@
 
 struct rom_header * pci_rom_probe(struct device *dev)
 {
-	unsigned long rom_address;
+	unsigned long rom_address = 0;
 	struct rom_header *rom_header;
 	struct pci_data *rom_data;
 
 	if (CONFIG_ROMFS) {
-		rom_address = (unsigned long) romfs_load_optionrom(dev->vendor, dev->device, NULL);
+		void *v;
 		/* if it's in FLASH, then it's as if dev->on_mainboard was true */
-		dev->on_mainboard = 1;
-		/* and we might as well set the address correctly */
-		dev->rom_address = rom_address;
-	} else if (dev->on_mainboard) {
+		v = romfs_load_optionrom(dev->vendor, dev->device, NULL);
+		printk_debug("In cbfs, rom address for %s = %lx\n", 
+				dev_path(dev), rom_address);
+		if (v) {
+			dev->rom_address = v;
+			dev->on_mainboard = 1;
+		}
+	} 
+
+	if (dev->on_mainboard) {
 		/* this is here as a legacy path. We hope it goes away soon. Users should not have to 
 		 * compute the ROM address at build time!
 		 */
                 // in case some device PCI_ROM_ADDRESS can not be set or readonly 
 		rom_address = dev->rom_address;
+		printk_debug("On mainboard, rom address for %s = %lx\n", 
+			dev_path(dev), rom_address);
         } else {
 		rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
+		printk_debug("On card, rom address for %s = %lx\n", 
+				dev_path(dev), rom_address);
 	}
 
 	if (rom_address == 0x00000000 || rom_address == 0xffffffff) {
 		return NULL;
 	}
 
-	printk_debug("rom address for %s = %lx\n", dev_path(dev), rom_address);
-	
 	if(!dev->on_mainboard) {
 		/* enable expansion ROM address decoding */
 		pci_write_config32(dev, PCI_ROM_ADDRESS,
Index: src/mainboard/emulation/qemu-x86/Options.lb
===================================================================
--- src/mainboard/emulation/qemu-x86/Options.lb	(revision 4077)
+++ src/mainboard/emulation/qemu-x86/Options.lb	(working copy)
@@ -49,7 +49,7 @@
 default CONFIG_CONSOLE_SERIAL8250=1
 default DEFAULT_CONSOLE_LOGLEVEL=8
 default MAXIMUM_CONSOLE_LOGLEVEL=8
-default CONFIG_ROMFS=0
+default CONFIG_ROMFS=1
 
 ## ROM_SIZE is the size of boot ROM that this board will use.
 default ROM_SIZE  = 256*1024
Index: targets/emulation/qemu-x86/Config.lb
===================================================================
--- targets/emulation/qemu-x86/Config.lb	(revision 4077)
+++ targets/emulation/qemu-x86/Config.lb	(working copy)
@@ -10,12 +10,12 @@
 option HAVE_PIRQ_TABLE=1
 option IRQ_SLOT_COUNT=6
 
-romimage "image" 
+romimage "normal" 
 	option ROM_IMAGE_SIZE=0x10000
 	option COREBOOT_EXTRA_VERSION="-GRUB2"
 #	payload /home/stepan/core.img
 	payload ../payload.elf
 end
 
-buildrom ./coreboot.rom ROM_SIZE "image"
+buildrom ./coreboot.rom ROM_SIZE "normal"
 
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to