Author: rminnich
Date: 2008-02-13 22:00:20 +0100 (Wed, 13 Feb 2008)
New Revision: 593

Modified:
   coreboot-v3/Makefile
   coreboot-v3/device/device_util.c
   coreboot-v3/device/pci_device.c
   coreboot-v3/include/device/path.h
   coreboot-v3/mainboard/emulation/qemu-x86/dts
   coreboot-v3/northbridge/intel/i440bxemulation/dts
   coreboot-v3/northbridge/intel/i440bxemulation/i440bx.c
   coreboot-v3/util/dtc/flattree.c
   coreboot-v3/util/x86emu/vm86.c
Log:
The real change here is that paths can now be part of the node label 
in dts. This gets rid of the ugly pcipath etc. properties. 

So, instead of

  somedevice {pcipath="1,0";};

We say [EMAIL PROTECTED],0{ etc. etc. };

As per my agreement I agree to document this in the design doc. 
The alix1c compiles but is untested, and will probably need some work. 
I will do these additional tasks on friday.

Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>
Acked-by:  Carl-Daniel Hailfinger <[EMAIL PROTECTED]>

M    include/device/path.h
Add LPC path type, replacing SUPERIO path type, since SUPERIO is only
one type of LPC. Clean up tabbing in parts of the file (cosmetic).

M    mainboard/emulation/qemu-x86/dts
Modify this dts for the new path naming scheme.

M    device/pci_device.c
Change what used to be a BIOS_ERR (but is no longer) to a BIOS_NOTICE. 
The change is that the device tree includes more than just PCI devices, 
so finding a non-PCI device is no longer fatal; a notice is useful. 

M    device/device_util.c
Add string creation for PCI_BUS nad LPC.

M    northbridge/intel/i440bxemulation/dts
Add ID info for the chip. 

M    northbridge/intel/i440bxemulation/i440bx.c
Change initialization so it is explicitly for the .ops struct member. 

M    util/dtc/flattree.c
Add support for the new path naming scheme. 
I'm in the middle of this commit so I'll fix the hard-coded lengths 
next commit. 
Also delete dead code between #if 0 and /* and //

M    util/x86emu/vm86.c
comment out unused variables. these may someday be use, not ready
to delete them yet. 

M    Makefile
Change -O2 to -g. We need debugging on LAR far more than we need performance. 



Modified: coreboot-v3/Makefile
===================================================================
--- coreboot-v3/Makefile        2008-02-13 17:30:49 UTC (rev 592)
+++ coreboot-v3/Makefile        2008-02-13 21:00:20 UTC (rev 593)
@@ -43,7 +43,7 @@
 
 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

Modified: coreboot-v3/device/device_util.c
===================================================================
--- coreboot-v3/device/device_util.c    2008-02-13 17:30:49 UTC (rev 592)
+++ coreboot-v3/device/device_util.c    2008-02-13 21:00:20 UTC (rev 593)
@@ -221,6 +221,10 @@
                        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 @@
                        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);

Modified: coreboot-v3/device/pci_device.c
===================================================================
--- coreboot-v3/device/pci_device.c     2008-02-13 17:30:49 UTC (rev 592)
+++ coreboot-v3/device/pci_device.c     2008-02-13 21:00:20 UTC (rev 593)
@@ -900,7 +900,7 @@
                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);

Modified: coreboot-v3/include/device/path.h
===================================================================
--- coreboot-v3/include/device/path.h   2008-02-13 17:30:49 UTC (rev 592)
+++ coreboot-v3/include/device/path.h   2008-02-13 21:00:20 UTC (rev 593)
@@ -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 @@
        unsigned domain;
 };
 
+struct pci_bus_path
+{
+       unsigned bus;
+};
+
 struct pci_path
 {
        unsigned devfn;
@@ -74,18 +81,25 @@
        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;
 };
 

Modified: coreboot-v3/mainboard/emulation/qemu-x86/dts
===================================================================
--- coreboot-v3/mainboard/emulation/qemu-x86/dts        2008-02-13 17:30:49 UTC 
(rev 592)
+++ coreboot-v3/mainboard/emulation/qemu-x86/dts        2008-02-13 21:00:20 UTC 
(rev 593)
@@ -21,24 +21,16 @@
 /{
        mainboard-vendor = "Emulation";
        mainboard-name = "QEMU x86";
-       enabled;
        constructor = "qemuvga_constructors";
-       cpus {
-               enabled;
-       };
-       domain0 {
+       cpus {};
+       [EMAIL PROTECTED] {
                /config/("northbridge/intel/i440bxemulation/dts");
-               ops = "i440bxemulation_pcidomainops";
-               enabled;
-               pcidomain = "0";
-               device0,0 {
-                       enabled;
-                       pcipath = "0,0";
+               [EMAIL PROTECTED] {
+                       [EMAIL PROTECTED],0 {
+                       };
+                       [EMAIL PROTECTED],0 {
+                               /config/("southbridge/intel/i82371eb/dts");
+                       };
                };
-               southbridge,intel,i82371eb {
-                       /config/("southbridge/intel/i82371eb/dts");
-                       pcipath = "1,0";
-                       enabled;
-               };
        };
 };

Modified: coreboot-v3/northbridge/intel/i440bxemulation/dts
===================================================================
--- coreboot-v3/northbridge/intel/i440bxemulation/dts   2008-02-13 17:30:49 UTC 
(rev 592)
+++ coreboot-v3/northbridge/intel/i440bxemulation/dts   2008-02-13 21:00:20 UTC 
(rev 593)
@@ -21,4 +21,5 @@
 {
        ramsize = "128";
        constructor = "i440bx_constructors";
+       domainid = "0x8086, 0x7190";
 };

Modified: coreboot-v3/northbridge/intel/i440bxemulation/i440bx.c
===================================================================
--- coreboot-v3/northbridge/intel/i440bxemulation/i440bx.c      2008-02-13 
17:30:49 UTC (rev 592)
+++ coreboot-v3/northbridge/intel/i440bxemulation/i440bx.c      2008-02-13 
21:00:20 UTC (rev 593)
@@ -81,10 +81,10 @@
 /* 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},
 };

Modified: coreboot-v3/util/dtc/flattree.c
===================================================================
--- coreboot-v3/util/dtc/flattree.c     2008-02-13 17:30:49 UTC (rev 592)
+++ coreboot-v3/util/dtc/flattree.c     2008-02-13 21:00:20 UTC (rev 593)
@@ -521,6 +521,8 @@
        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 @@
                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,21 +596,16 @@
         * 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")){
                        fprintf(f, "\t.device_configuration = &%s,\n", 
clean(tree->label, 1));
@@ -634,6 +661,7 @@
                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 @@
        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 @@
                  * 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 @@
                                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 @@
        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)

Modified: coreboot-v3/util/x86emu/vm86.c
===================================================================
--- coreboot-v3/util/x86emu/vm86.c      2008-02-13 17:30:49 UTC (rev 592)
+++ coreboot-v3/util/x86emu/vm86.c      2008-02-13 21:00:20 UTC (rev 593)
@@ -559,7 +559,9 @@
 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;


-- 
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to