Here's the usage:

# Tyan s2892
romimage "fallback"
        option USE_FALLBACK_IMAGE=1
        option COREBOOT_EXTRA_VERSION="$(shell cat ../../VERSION)_Fallback"
        payload ../payload.elf
end

buildrom ./coreboot.rom ROM_SIZE "fallback"

pci_rom ../ragexl.rom vendor_id = 0x1002 device_id = 0x4752
pci_rom ../nic.rom vendor_id = 0x1100 device_id = 0x4152

Here are the results:

rm -f coreboot.cbfs
./cbfstool ./coreboot.romfs create 1048576 98304 ./coreboot.rom.bootblock
if [ -f coreboot.romfs ]; then ./cbfstool coreboot.romfs add
../ragexl.rom pci1002,4752.rom 48; fi
if [ -f coreboot.romfs ]; then ./cbfstool coreboot.romfs add
../nic.rom pci1100,4152.rom 48; fi
if [ -f fallback/cbfs-support ]; then ./cbfstool ./coreboot.romfs
add-payload ../payload.elf fallback/payload `cat
fallback/cbfs-support`; fi
./cbfstool ./coreboot.romfs print
./coreboot.romfs: 1024 kB, bootblocksize 98304, romsize 1048576, offset 0x0
Alignment: 16 bytes

Name                           Offset     Type         Size
pci1002,4752.rom               0x0        optionrom    36864
pci1100,4152.rom               0x9040     optionrom    36864
fallback/payload               0x12080    payload      65620

Signed-off-by: Myles Watson <[email protected]>

Thanks,
Myles
Index: ../util/newconfig/config.g
===================================================================
--- ../util/newconfig/config.g	(revision 4123)
+++ ../util/newconfig/config.g	(working copy)
@@ -22,6 +22,7 @@
 global_exported_options = []
 romimages = {}
 buildroms = []
+pciroms = []
 rommapping = {}
 curimage = 0
 bootblocksize = 0
@@ -480,6 +481,13 @@
 	def __getitem__(self,i):
 		return self.roms[i]
 
+class pci_rom:
+	"""A pci_rom statement"""
+	def __init__ (self, filename, vendor, device):
+		self.name = filename
+		self.pci_vid = vendor
+		self.pci_did = device
+	
 class initinclude:
 	"""include file for initialization code"""
 	def __init__ (self, str, path):
@@ -1403,6 +1411,12 @@
 	b = buildrom(filename, size, roms)
 	buildroms.append(b)
 
+def addpci_rom(filename, vendor, device):
+	global pciroms
+	print "Add PCI ROM %s" %filename
+	p = pci_rom(filename, vendor, device)
+	pciroms.append(p)
+
 def addinitobject(object_name):
 	global curimage
 	curimage.addinitobjectrule(object_name)
@@ -1610,6 +1624,7 @@
     token DEFINE:		'define'
     token DEPENDS:		'depends'
     token DEVICE:		'device'
+    token DEVICE_ID:		'device_id'
     token DIR:			'dir'
     token DRIVER:		'driver'
     token DRQ:			'drq'
@@ -1638,6 +1653,7 @@
     token OBJECT:		'object'
     token OPTION:		'option'
     token PAYLOAD:		'payload'
+    token PCI_ROM:		'pci_rom'
     token PMC:			'pmc'
     token PRINT:		'print'
     token REGISTER:		'register'
@@ -1648,6 +1664,7 @@
     token TARGET:		'target'
     token USED:			'used'
     token USES:			'uses'
+    token VENDOR_ID:		'vendor_id'
     token WRITE:		'write'
     token NUM:			'[0-9]+'
     token HEX_NUM:		'[0-9a-fA-F]+'
@@ -1939,9 +1956,17 @@
 
     rule buildrom:	BUILDROM DIRPATH expr roms	{{ addbuildrom(DIRPATH, expr, roms) }}
 
+    rule pci_vid:	VENDOR_ID EQ term	{{ return term }}
+
+    rule pci_did:	DEVICE_ID EQ term	{{ return term }}
+
+
+    rule pci_rom:	PCI_ROM DIRPATH pci_vid pci_did	{{ addpci_rom(DIRPATH, pci_vid, pci_did) }}
+
     rule romstmts:	romimage 
 		|	buildrom
 		|	opstmt<<1>>
+		|	pci_rom
 
     # ENTRY for parsing root part
     rule board:		{{ loadoptions("config", "Options.lb", "options") }}
@@ -2281,6 +2306,8 @@
 	file.write("%sfs: %s cbfstool\n" %(i.name,i.name));
 	file.write("\trm -f coreboot.cbfs\n");
 	file.write("\t./cbfstool %sfs create %s %s %s.bootblock\n" % (i.name, romsize, bootblocksize, i.name))
+	for i in pciroms:
+		file.write("\tif [ -f coreboot.romfs ]; then ./cbfstool coreboot.romfs add %s pci%04x,%04x.rom 48; fi\n" % (i.name, i.pci_vid, i.pci_did))
 	for i in buildroms:
 		for j in i.roms:
 			#failover is a hack that will go away soon. 
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to