diff --git a/Makefile b/Makefile index 9afa5b2834..7bca25af09 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ CFLAGS := -Os -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ HOSTCC := gcc HOSTCXX := g++ -HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ +HOSTCFLAGS := -Wall -Wstrict-prototypes -g -fomit-frame-pointer \ -Wno-unused -Wno-sign-compare LEX := flex diff --git a/device/device_util.c b/device/device_util.c index 09c56ae821..bb95908bb1 100644 --- a/device/device_util.c +++ b/device/device_util.c @@ -221,6 +221,10 @@ const char *dev_path(struct device *dev) sprintf(buffer, "PCI_DOMAIN: %04x", dev->path.u.pci_domain.domain); break; + case DEVICE_PATH_PCI_BUS: + sprintf(buffer, "PCI_BUS: %04x", + dev->path.u.pci_bus.bus); + break; case DEVICE_PATH_APIC_CLUSTER: sprintf(buffer, "APIC_CLUSTER: %01x", dev->path.u.apic_cluster.cluster); @@ -232,6 +236,10 @@ const char *dev_path(struct device *dev) sprintf(buffer, "CPU_BUS: %02x", dev->path.u.cpu_bus.id); break; + case DEVICE_PATH_LPC: + sprintf(buffer, "LPC: %02x", + dev->path.u.lpc.iobase); + break; default: printk(BIOS_ERR, "%s: Unknown device path type: %d\n", dev->dtsname, dev->path.type); diff --git a/device/pci_device.c b/device/pci_device.c index d698c87cf5..e31a26066e 100644 --- a/device/pci_device.c +++ b/device/pci_device.c @@ -900,7 +900,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn) printk(BIOS_SPEW, "%s: check dev %s \n", __func__, (*list)->dtsname); if ((*list)->path.type != DEVICE_PATH_PCI) { - printk(BIOS_ERR, + printk(BIOS_NOTICE, "%s: child %s(%s) not a pci device: it's type %d\n", __FUNCTION__, (*list)->dtsname, dev_path(*list), (*list)->path.type); diff --git a/include/device/path.h b/include/device/path.h index b59431fd1c..5af5023354 100644 --- a/include/device/path.h +++ b/include/device/path.h @@ -21,14 +21,16 @@ enum device_path_type { DEVICE_PATH_NONE = 0, DEVICE_PATH_ROOT, + DEVICE_PATH_PCI_DOMAIN, + DEVICE_PATH_PCI_BUS, DEVICE_PATH_PCI, DEVICE_PATH_PNP, DEVICE_PATH_I2C, DEVICE_PATH_APIC, - DEVICE_PATH_PCI_DOMAIN, DEVICE_PATH_APIC_CLUSTER, DEVICE_PATH_CPU, DEVICE_PATH_CPU_BUS, + DEVICE_PATH_LPC, }; struct pci_domain_path @@ -36,6 +38,11 @@ struct pci_domain_path unsigned domain; }; +struct pci_bus_path +{ + unsigned bus; +}; + struct pci_path { unsigned devfn; @@ -74,18 +81,25 @@ struct cpu_bus_path unsigned id; }; +struct lpc_path +{ + unsigned iobase; +}; + struct device_path { enum device_path_type type; union { - struct pci_path pci; - struct pnp_path pnp; - struct i2c_path i2c; - struct apic_path apic; - struct pci_domain_path pci_domain; + struct pci_path pci; + struct pnp_path pnp; + struct i2c_path i2c; + struct apic_path apic; + struct pci_domain_path pci_domain; + struct pci_bus_path pci_bus; struct apic_cluster_path apic_cluster; - struct cpu_path cpu; - struct cpu_bus_path cpu_bus; + struct cpu_path cpu; + struct cpu_bus_path cpu_bus; + struct lpc_path lpc; } u; }; diff --git a/mainboard/emulation/qemu-x86/dts b/mainboard/emulation/qemu-x86/dts index f981705a11..17011d9383 100644 --- a/mainboard/emulation/qemu-x86/dts +++ b/mainboard/emulation/qemu-x86/dts @@ -21,24 +21,16 @@ /{ mainboard-vendor = "Emulation"; mainboard-name = "QEMU x86"; - enabled; constructor = "qemuvga_constructors"; - cpus { - enabled; - }; - domain0 { + cpus {}; + domain@0 { /config/("northbridge/intel/i440bxemulation/dts"); - ops = "i440bxemulation_pcidomainops"; - enabled; - pcidomain = "0"; - device0,0 { - enabled; - pcipath = "0,0"; - }; - southbridge,intel,i82371eb { - /config/("southbridge/intel/i82371eb/dts"); - pcipath = "1,0"; - enabled; + bus@0 { + pci@0,0 { + }; + pci@1,0 { + /config/("southbridge/intel/i82371eb/dts"); + }; }; }; }; diff --git a/northbridge/intel/i440bxemulation/dts b/northbridge/intel/i440bxemulation/dts index 161621161d..f49cb7901e 100644 --- a/northbridge/intel/i440bxemulation/dts +++ b/northbridge/intel/i440bxemulation/dts @@ -21,4 +21,5 @@ { ramsize = "128"; constructor = "i440bx_constructors"; + domainid = "0x8086, 0x7190"; }; diff --git a/northbridge/intel/i440bxemulation/i440bx.c b/northbridge/intel/i440bxemulation/i440bx.c index c1eb862d75..5d7316c99c 100644 --- a/northbridge/intel/i440bxemulation/i440bx.c +++ b/northbridge/intel/i440bxemulation/i440bx.c @@ -81,10 +81,10 @@ struct device_operations i440bxemulation_pcidomainops = { /* The plain PCI device uses the standard PCI operations. */ struct constructor i440bx_constructors[] = { {.id = {.type = DEVICE_ID_PCI_DOMAIN, - .u = {.pci = {.vendor = 0x8086,.device = 0x7190}}}, - &i440bxemulation_pcidomainops}, + .u = {.pci_domain = {.vendor = 0x8086,.device = 0x7190}}}, + .ops = &i440bxemulation_pcidomainops}, {.id = {.type = DEVICE_ID_PCI, .u = {.pci = {.vendor = 0x8086,.device = 0x7190}}}, - &default_pci_ops_bus}, + .ops = &default_pci_ops_bus}, {.ops = 0}, }; diff --git a/util/dtc/flattree.c b/util/dtc/flattree.c index 356b06c065..0063022496 100644 --- a/util/dtc/flattree.c +++ b/util/dtc/flattree.c @@ -521,6 +521,8 @@ static void coreboot_emit_special(FILE *e, struct node *tree) int ops_set = 0; int is_root = 0; char *configname; + char *path; + int enabled = 1; fprintf(f, "struct device dev_%s = {\n", tree->label); /* special case -- the root has a distinguished path */ @@ -529,6 +531,36 @@ static void coreboot_emit_special(FILE *e, struct node *tree) fprintf(f, "\t.path = { .type = DEVICE_PATH_ROOT },\n"); } + /* from the node names (tree->name) we derive the path */ + path = index(tree->name, '@'); + if (path && path[1]) { + path++; + if (!strncmp(tree->name, "cpu", 3)){ + fprintf(f, "\t.path = {.type=DEVICE_PATH_CPU,.u={.cpu={ .id = %s }}},\n", + path); + } + if (!strncmp(tree->name, "bus", 3)){ + fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_BUS,.u={.pci_bus={ .bus = %s }}},\n", + path); + } + if (!strncmp(tree->name, "apic", 4)){ + fprintf(f, "\t.path = {.type=DEVICE_PATH_APIC,.u={.apic={ %s }}},\n", + path); + } + if (!strncmp(tree->name, "domain", 6)){ + fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_DOMAIN,.u={.pci_domain={ .domain = %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); + } + if (!strncmp(tree->name, "lpc", 3)){ + fprintf(f, "\t.path = {.type=DEVICE_PATH_SUPERIO,.u={.superio={.iobase=%s}}},\n", + path); + } + } + if (tree->config){ configname = clean(tree->label, 0); printf("\t.device_configuration = &%s,\n", configname); @@ -564,20 +596,15 @@ static void coreboot_emit_special(FILE *e, struct node *tree) * and some are just set directly into the code (e.g. ops_pci). */ for_each_property(tree, prop) { - if (streq(prop->name, "pcidomain")){ - fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_DOMAIN,.u={.pci_domain={ .domain = %s }}},\n", - prop->val.val); - } - if (streq(prop->name, "pcipath")){ - fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI,.u={.pci={ .devfn = PCI_DEVFN(%s)}}},\n", - prop->val.val); - } /* to do: check the value, maybe. Kinda pointless though. */ if (streq(prop->name, "on_mainboard")){ fprintf(f, "\t.on_mainboard = 1,\n"); } if (streq(prop->name, "enabled")){ - fprintf(f, "\t.enabled = 1,\n"); + enabled = 1; + } + if (streq(prop->name, "disabled")){ + enabled = 0; } if (streq(prop->name, "config")){ @@ -634,6 +661,7 @@ static void coreboot_emit_special(FILE *e, struct node *tree) fprintf(f, "\t.ops = &default_dev_ops_root,\n"); fprintf(f, "\t.dtsname = \"%s\",\n", tree->label); + fprintf(f, "\t.enabled = %d\n", enabled); fprintf(f, "};\n"); } @@ -796,18 +824,6 @@ static void flatten_tree_emit_structinits(struct node *tree, struct emitter *emi struct node *child; int seen_name_prop = 0; FILE *f = etarget; -/* - treename = clean(tree->name, 0); - fprintf(f, "struct %s %s = {\n", treename, tree->label); - free(treename); - -*/ -#if 0 - if (vi->flags & FTF_FULLPATH) - emit->string(etarget, tree->fullpath, 0); - else - emit->string(etarget, tree->name, 0); -#endif /* here is the real action. What we have to do, given a -> config entry, is this: * foreach property(tree->config) * search for the property in this node's property list @@ -826,24 +842,13 @@ static void flatten_tree_emit_structinits(struct node *tree, struct emitter *emi * the operator should take the node itself, not a string. */ printf("struct %s %s = {\n", structname, treelabel); -// emit->beginnode(etarget, treename); -#if 0 - if (vi->flags & FTF_FULLPATH) - emit->string(etarget, tree->fullpath, 0); - else - emit->string(etarget, tree->name, 0); -#endif for_each_config(tree, configprop) { char *cleanname; int found = 0; if (streq(configprop->name, "constructor")) /* this is special */ continue; -#if 0 - cleanname = clean(configprop->name, 0); - fprintf(f, "\tu32 %s = \n", cleanname); - free(cleanname); -#endif + for_each_property(tree, dtsprop) { if (streq(dtsprop->name,configprop->name)){ emit->data(etarget, dtsprop); @@ -854,28 +859,8 @@ static void flatten_tree_emit_structinits(struct node *tree, struct emitter *emi emit->data(etarget, configprop); } -#if 0 - if ((vi->flags & FTF_NAMEPROPS) && !seen_name_configprop) { - fprintf(f, "\tu8 %s[%d];\n", configprop->name, configprop->val.len); - } -#endif emit->endnode(etarget, treelabel); } -/* - for_each_property(tree, prop) { - if (streq(prop->name, "name")) - seen_name_prop = 1; - emit->data(etarget, prop); - } - */ -#if 0 - if ((vi->flags & FTF_NAMEPROPS) && !seen_name_prop) { - fprintf(f, "\tu8 %s[%d]\n", prop->name, prop->data.len); - } -#endif -/* - emit->endnode(etarget, tree->label); -*/ /* now emit the device for this node, with sibling and child pointers etc. */ emit->special(f, tree); @@ -1253,7 +1238,7 @@ void dt_to_C(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys) data_free(strbuf); } -/* the label is not really used. So go ahead and make clean names for all labels */ +/*Set up the clean label */ void labeltree(struct node *tree) diff --git a/util/x86emu/vm86.c b/util/x86emu/vm86.c index fe0db7a678..cdb048fe0f 100644 --- a/util/x86emu/vm86.c +++ b/util/x86emu/vm86.c @@ -559,7 +559,9 @@ int biosint(unsigned long intnumber, void setup_realmode_idt(void) { extern unsigned char idthandle, end_idthandle; +#if 0 extern unsigned char debughandle, end_debughandle; +#endif int i; struct realidt *idts = (struct realidt *) 0;