attached.

ron
I misunderstood the dts when I wrote this code. 
The @ values are implicitly hex. Correctly emit hex constants for all cases, 
including the pci a,b syntax. 

Tested on dbe62. Note that before this patch goes in we need to change ALL 
dts files to be hex. 

Also a small buglet:  fix the strcmp on ioport to match 6, not 3, chars. 

Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>


Index: util/dtc/flattree.c
===================================================================
--- util/dtc/flattree.c	(revision 698)
+++ util/dtc/flattree.c	(working copy)
@@ -551,27 +551,40 @@
 	if (path && path[1]) {
 		path++;
 		if (!strncmp(tree->name, "cpu", 3)){
-			fprintf(f, "\t.path = {.type=DEVICE_PATH_CPU,.u={.cpu={ .id = %s }}},\n", 
+			fprintf(f, "\t.path = {.type=DEVICE_PATH_CPU,.u={.cpu={ .id = 0x%s }}},\n", 
 				path);
 		}
 		if (!strncmp(tree->name, "bus", 3)){
-			fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_BUS,.u={.pci_bus={ .bus = %s }}},\n", 
+			fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_BUS,.u={.pci_bus={ .bus = 0x%s }}},\n", 
 				path);
 		}
 		if (!strncmp(tree->name, "apic", 4)){
-			fprintf(f, "\t.path = {.type=DEVICE_PATH_APIC,.u={.apic={ %s }}},\n", 
+			fprintf(f, "\t.path = {.type=DEVICE_PATH_APIC,.u={.apic={ 0x%s }}},\n", 
 				path);
 		}
 		if (!strncmp(tree->name, "domain", 6)){
-			fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_DOMAIN,.u={.pci_domain={ .domain = %s }}},\n", 
+			fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_DOMAIN,.u={.pci_domain={ .domain = 0x%s }}},\n", 
 				path);
 		}
 		if (!strncmp(tree->name, "pci", 3)){
-			fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI,.u={.pci={ .devfn = PCI_DEVFN(%s)}}},\n", 
-				path);
+			/* it's in two parts */
+			char *devfn = strdup(path);
+			char *dev = devfn;
+			char *fn;
+
+			fn = index(devfn, ',');
+			/* if there is no fn we assume 0 */
+			/* the Rules are unclear on this point */
+			if (fn)
+				*fn++ = 0;
+			else
+				fn = "0";
+
+			fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI,.u={.pci={ .devfn = PCI_DEVFN(0x%s, 0x%s)}}},\n", 
+				dev, fn);
 		}
-		if (!strncmp(tree->name, "ioport", 3)){
-			fprintf(f, "\t.path = {.type=DEVICE_PATH_IOPORT,.u={.ioport={.iobase=%s}}},\n", 
+		if (!strncmp(tree->name, "ioport", 6)){
+			fprintf(f, "\t.path = {.type=DEVICE_PATH_IOPORT,.u={.ioport={.iobase=0x%s}}},\n", 
 				path);
 		}
 	}
--
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to