- First stab at running linuxbios without the old static device tree.
authorEric Biederman <ebiederm@xmission.com>
Sat, 16 Oct 2004 06:20:29 +0000 (06:20 +0000)
committerEric Biederman <ebiederm@xmission.com>
Sat, 16 Oct 2004 06:20:29 +0000 (06:20 +0000)
  Things are close but not quite there yet.

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1681 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

86 files changed:
src/arch/i386/init/crt0.S.lb
src/arch/i386/smp/mpspec.c
src/boot/hardwaremain.c
src/cpu/amd/model_fxx/model_fxx_init.c
src/cpu/amd/socket_940/chip.h
src/cpu/amd/socket_940/socket_940.c
src/cpu/intel/model_6xx/model_6xx_init.c
src/cpu/intel/model_f0x/model_f0x_init.c
src/cpu/intel/model_f1x/model_f1x_init.c
src/cpu/intel/model_f2x/model_f2x_init.c
src/cpu/intel/model_f3x/model_f3x_init.c
src/cpu/intel/slot_2/slot_2.c
src/cpu/intel/socket_mPGA603/socket_mPGA603_400Mhz.c
src/cpu/intel/socket_mPGA604_533Mhz/socket_mPGA604_533Mhz.c
src/cpu/intel/socket_mPGA604_800Mhz/socket_mPGA604_800Mhz.c
src/cpu/simple_init/simple_cpu_init.c
src/cpu/x86/lapic/lapic_cpu_init.c
src/devices/Config.lb
src/devices/chip.c [deleted file]
src/devices/device.c
src/devices/device_util.c
src/devices/hypertransport.c
src/devices/pci_device.c
src/devices/pnp_device.c
src/devices/root_device.c
src/include/cpu/cpu.h
src/include/device/chip.h [deleted file]
src/include/device/device.h
src/include/device/path.h
src/include/device/pnp.h
src/include/device/smbus.h
src/lib/version.c
src/mainboard/Iwill/DK8S2/mainboard.c
src/mainboard/Iwill/DK8X/mainboard.c
src/mainboard/amd/quartet/mainboard.c
src/mainboard/amd/serenade/mainboard.c
src/mainboard/amd/solo/mainboard.c
src/mainboard/arima/hdama/Options.lb
src/mainboard/arima/hdama/chip.h
src/mainboard/arima/hdama/mainboard.c
src/mainboard/densitron/dpx114/mainboard.c
src/mainboard/digitallogic/adl855pc/mainboard.c
src/mainboard/emulation/qemu-i386/mainboard.c
src/mainboard/ibm/e325/mainboard.c
src/mainboard/newisys/khepri/mainboard.c
src/mainboard/technologic/ts5300/mainboard.c
src/mainboard/tyan/s2735/mainboard.c
src/mainboard/tyan/s2850/mainboard.c
src/mainboard/tyan/s2875/mainboard.c
src/mainboard/tyan/s2880/mainboard.c
src/mainboard/tyan/s2881/mainboard.c
src/mainboard/tyan/s2882/mainboard.c
src/mainboard/tyan/s2885/mainboard.c
src/mainboard/tyan/s4880/mainboard.c
src/mainboard/tyan/s4882/mainboard.c
src/mainboard/via/epia-m/mainboard.c
src/mainboard/via/epia/mainboard.c
src/northbridge/amd/amdk8/chip.h
src/northbridge/amd/amdk8/northbridge.c
src/northbridge/emulation/qemu-i386/northbridge.c
src/northbridge/intel/855pm/northbridge.c
src/northbridge/intel/e7501/northbridge.c
src/northbridge/intel/i855pm/northbridge.c
src/northbridge/transmeta/tm5800/northbridge.c
src/northbridge/via/vt8601/northbridge.c
src/northbridge/via/vt8623/northbridge.c
src/southbridge/amd/amd8111/Config.lb
src/southbridge/amd/amd8111/amd8111.c
src/southbridge/amd/amd8111/amd8111.h
src/southbridge/amd/amd8111/amd8111_lpc.c
src/southbridge/intel/i82801dbm/i82801dbm.c
src/southbridge/intel/i82801dbm/i82801dbm_lpc.c
src/southbridge/intel/i82801er/i82801er.c
src/southbridge/intel/i82801er/i82801er_lpc.c
src/southbridge/ricoh/rl5c476/rl5c476.c
src/southbridge/via/vt8231/vt8231.c
src/southbridge/via/vt8235/vt8235.c
src/southbridge/winbond/w83c553/w83c553f.c
src/superio/NSC/pc87360/chip.h
src/superio/NSC/pc87360/superio.c
src/superio/NSC/pc87366/superio.c
src/superio/NSC/pc97307/superio.c
src/superio/via/vt1211/vt1211.c
src/superio/winbond/w83627hf/superio.c
src/superio/winbond/w83627thf/superio.c
util/newconfig/config.g

index 4d9face092b8bde100ba5672c82ad3bea719ca5b..29e3e28277fd39be93487c7f7fe07aa08ae94f97 100644 (file)
 
 #include "crt0_includes.h"
 
+       /* uses:         esp, ebx, ax, dx */
+#define __CONSOLE_TX_STRING(string)    \
+       mov     string, %ebx    ; \
+       CALLSP(console_tx_string)
+
+#if ASM_CONSOLE_LOGLEVEL > BIOS_DEBUG
+#define CONSOLE_DEBUG_TX_STRING(string)        __CONSOLE_TX_STRING(string)
+#else
+#define CONSOLE_DEBUG_TX_STRING(string)
+#endif
 
        /* clear boot_complete flag */
        xorl    %ebp, %ebp
 __main:
-       mov     $str_copying_to_ram, %ebx
-       CALLSP(console_tx_string)
+       CONSOLE_DEBUG_TX_STRING($str_copying_to_ram)
 
        /*
         *      Copy data into RAM and clear the BSS. Since these segments
@@ -149,8 +158,7 @@ decompr_end_n2b:
        movl    %esp, %ebp
 #endif
 
-       mov     $str_pre_main, %ebx
-       CALLSP(console_tx_string)
+       CONSOLE_DEBUG_TX_STRING($str_pre_main)
        leal    _iseg, %edi
        jmp     %edi
 
@@ -159,12 +167,9 @@ decompr_end_n2b:
        hlt
        jmp     .Lhlt
 
-
+#if ASM_CONSOLE_LOGLEVEL > BIOS_DEBUG
        /* Uses esp, ebx, ax, dx  */
 console_tx_string:
-#if ASM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
-       RETSP
-#else  
        mov     (%ebx), %al
        inc     %ebx
        cmp     $0, %al
@@ -210,4 +215,3 @@ str_pre_main:        .string "Jumping to LinuxBIOS.\r\n"
 .previous
 
 #endif /* ASM_CONSOLE_LOGLEVEL > BIOS_DEBUG */
-       
\ No newline at end of file
index babfcbdca2fb2439564218efc1570dd867d65ff9..c674cf58f547d46007ef4475a1814e66c3883240 100644 (file)
@@ -1,4 +1,6 @@
 #include <console/console.h>
+#include <device/device.h>
+#include <device/path.h>
 #include <cpu/cpu.h>
 #include <arch/smp/mpspec.h>
 #include <string.h>
@@ -101,14 +103,17 @@ void smp_write_processors(struct mp_config_table *mc)
        unsigned cpu_feature_flags;
        struct cpuid_result result;
        device_t cpu;
+       
        boot_apic_id = lapicid();
        apic_version = lapic_read(LAPIC_LVR) & 0xff;
        result = cpuid(1);
        cpu_features = result.eax;
        cpu_feature_flags = result.edx;
-       for(cpu = dev_root.link[1].children; cpu; cpu = cpu->sibling) {
+       for(cpu = all_devices; cpu; cpu = cpu->next) {
                unsigned long cpu_flag;
-               if (cpu->path.type != DEVICE_PATH_APIC) {
+               if ((cpu->path.type != DEVICE_PATH_APIC) || 
+                       (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER))
+               {
                        continue;
                }
                if (!cpu->enabled) {
index d292e5dcd4ecd8dc3c40ce6138c23353c88364be..ecff677c8849f2e0eefdd5920e906aab3e2d4c27 100644 (file)
@@ -32,7 +32,6 @@ it with the version available from LANL.
 #include <boot/tables.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/chip.h>
 #include <delay.h>
 #include <stdlib.h>
 #include <part/hard_reset.h>
@@ -52,8 +51,6 @@ void hardwaremain(int boot_complete)
 
        post_code(0x80);
 
-       CONFIGURE(CONF_PASS_PRE_CONSOLE);
-
        /* displayinit MUST PRECEDE ALL PRINTK! */
        console_init();
        
@@ -69,13 +66,13 @@ void hardwaremain(int boot_complete)
                hard_reset();
        }
 
-       CONFIGURE(CONF_PASS_PRE_PCI);
+       /* FIXME: Is there a better way to handle this? */
+       init_timer(); 
 
        /* pick how to scan the bus. This is first so we can get at memory size. */
        printk_info("Finding PCI configuration type.\n");
        pci_set_method();
        post_code(0x5f);
-       enumerate_static_devices();
        dev_enumerate();
        post_code(0x66);
        /* Now do the real bus.
@@ -90,15 +87,11 @@ void hardwaremain(int boot_complete)
        dev_initialize();
        post_code(0x89);
 
-       CONFIGURE(CONF_PASS_POST_PCI);
-
        /* Now that we have collected all of our information
         * write our configuration tables.
         */
        lb_mem = write_tables();
 
-       CONFIGURE(CONF_PASS_PRE_BOOT);
-
 #if CONFIG_FS_STREAM == 1
        filo(lb_mem);
 #else
index e2c864f06a36c96e82a655fd94efd06d75d0d66c..c0915fc5231ad67219fd58a47b7e350c56f1bbff 100644 (file)
@@ -3,7 +3,6 @@
 #include <cpu/x86/msr.h>
 #include <cpu/amd/mtrr.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <string.h>
index 69002a27f12714b65623887e0a05cd571d2e10e8..7154dd15931b115593d67081fa1c2ed5277ecddf 100644 (file)
@@ -1,4 +1,4 @@
-extern struct chip_control cpu_amd_socket_940_control;
+extern struct chip_operations cpu_amd_socket_940_ops;
 
 struct cpu_amd_socket_940_config {
 };
index 91bfc37ec8c11e317307aaea59c978c595e85b80..d62834f4e734c9aa1ae0f5952a6a08aec29cc12d 100644 (file)
@@ -1,7 +1,7 @@
-#include <device/chip.h>
+#include <device/device.h>
 #include "chip.h"
 
 
-struct chip_control cpu_amd_socket_940_control = {
+struct chip_operations cpu_amd_socket_940_ops = {
        .name = "socket 940",
 };
index 95be3b701c3908dc99d07dbd1ca76cb63986e248..43baf6e3461e7ac3be27ccc8bb8c7f9d8c3f5fd5 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <string.h>
index ef64688625b9a2c62e4dcf2ea9c424bdb98bab7e..55504a1049fedd9a14d884fde21d595341a913e2 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <string.h>
index 4045345d358ce410e84de63c4193ca4e84c8b5fe..53cee4fe688d0a0e6c04c9dbe9afad5929b3a8cc 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <string.h>
index ecc454c974a3bf34df7059123dd881a42fa4bb0f..db8dc184e3a379393c35e03a51c3401c8c120bcc 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <string.h>
index ce5705b0819b2a0301cca611ff88b687c11b0ff4..a89e7d17822c1866220b1a27caf21bf9a984ecc5 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <string.h>
index f47767b01635bf0ee1a730d65e77aa2f801f6029..2d4fb9373cb7fa34989532255cfff096bb8614c8 100644 (file)
@@ -1,4 +1,4 @@
-#include <device/chip.h>
+#include <device/device.h>
 #include "chip.h"
 
 
index 73265eab1ffa311db353933068c4db1a04374024..8d736bbc79cac4bc542ff548deef3ef6c5880eb9 100644 (file)
@@ -1,4 +1,4 @@
-#include <device/chip.h>
+#include <device/device.h>
 #include "chip.h"
 
 
index fd5dbe41d58ceb428b591b4026b9c11b741b1572..6dc325ce0b7f9be06dd5be067a8c1c13da843df5 100644 (file)
@@ -1,4 +1,4 @@
-#include <device/chip.h>
+#include <device/device.h>
 #include "chip.h"
 
 
index c638a93874dc2f6255f12bb56c8e06e8f542d5ba..3d82276d058ac41615c7327ce98ef349dd3ae9b2 100644 (file)
@@ -1,4 +1,4 @@
-#include <device/chip.h>
+#include <device/device.h>
 #include "chip.h"
 
 
index 39b5832971515560d486da6a2da08b4f1f5fa051..02eb73f39102519648c8d52f906b7f4e431784be 100644 (file)
@@ -7,7 +7,7 @@
 #error "This Configuration does not support SMP"
 #endif
 
-void initialize_cpus(device_t root)
+void initialize_cpus(struct bus *cpu_bus)
 {
        struct device_path cpu_path;
        struct cpu_info *info;
@@ -19,7 +19,7 @@ void initialize_cpus(device_t root)
        cpu_path.type = DEVICE_PATH_BOOT_CPU;
 
        /* Find the device struct for the boot cpu */
-       info->cpu = alloc_find_dev(root->link[1], &cpu_path);
+       info->cpu = alloc_find_dev(bus, &cpu_path);
        
        /* Initialize the bootstrap processor */
        cpu_initialize();
index 963b1cf7295485a5ac2b05ccb49d23af5d2f5613..db0cecbd0652709876f4a4922190a51667e017d4 100644 (file)
@@ -234,12 +234,12 @@ void secondary_cpu_init(void)
        stop_this_cpu();
 }
 
-static void initialize_other_cpus(device_t root)
+static void initialize_other_cpus(struct bus *cpu_bus)
 {
        int old_active_count, active_count;
        device_t cpu;
        /* Loop through the cpus once getting them started */
-       for(cpu = root->link[1].children; cpu ; cpu = cpu->sibling) {
+       for(cpu = cpu_bus->children; cpu ; cpu = cpu->sibling) {
                if (cpu->path.type != DEVICE_PATH_APIC) {
                        continue;
                }
@@ -267,7 +267,7 @@ static void initialize_other_cpus(device_t root)
                udelay(10);
                active_count = atomic_read(&active_cpus);
        }
-       for(cpu = root->link[1].children; cpu; cpu = cpu->sibling) {
+       for(cpu = cpu_bus->children; cpu; cpu = cpu->sibling) {
                if (cpu->path.type != DEVICE_PATH_APIC) {
                        continue;
                }
@@ -284,7 +284,7 @@ static void initialize_other_cpus(device_t root)
 #define initialize_other_cpus(root) do {} while(0)
 #endif /* CONFIG_SMP */
 
-void initialize_cpus(device_t root)
+void initialize_cpus(struct bus *cpu_bus)
 {
        struct device_path cpu_path;
        struct cpu_info *info;
@@ -305,12 +305,12 @@ void initialize_cpus(device_t root)
 #endif
        
        /* Find the device structure for the boot cpu */
-       info->cpu = alloc_find_dev(&root->link[1], &cpu_path);
+       info->cpu = alloc_find_dev(cpu_bus, &cpu_path);
        
        /* Initialize the bootstrap processor */
        cpu_initialize();
 
        /* Now initialize the rest of the cpus */
-       initialize_other_cpus(root);
+       initialize_other_cpus(cpu_bus);
 }
 
index 50d05579e56ca5787ddabec2bac173e4bb8450ae..80b64a0d44868ebd854a2622e9639d14b0fb1f0b 100644 (file)
@@ -4,4 +4,3 @@ object device_util.o
 object pci_device.o
 object pnp_device.o
 object hypertransport.o
-object chip.o
diff --git a/src/devices/chip.c b/src/devices/chip.c
deleted file mode 100644 (file)
index 6882a4b..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/* chips are arbitrary chips (superio, southbridge, etc.)
- * They have private structures that define chip resources and default 
- * settings. They have four externally visible functions for control. 
- * They have a generic component which applies to all chips for 
- * path, etc. 
- */
-
-#include <console/console.h>
-#include <device/chip.h>
-#include <device/pci.h>
-
-/**
- * @brief Configure static devices
- *
- * Starting from the static device 'root', walk the tree and configure each
- * device by calling the device specific chip_control::enable().
- *
- * This function is only an iterator, the exact definition of 'configure'
- * depends on the device specific implementation of chip_control::enable(). 
- *
- * @param root root of the static device tree to be configured.
- * @param pass pass of the configuration operation to be perfromed.
- *
- * @see chip_pass
- * @see chip_control::enable
- */  
-void chip_configure(struct chip *root, enum chip_pass pass)
-{
-       struct chip *c;
-
-       for (c = root; c; c = c->next) {
-               if (c->control && c->control->enable)
-                       c->control->enable(c, pass);
-       }
-
-       for (c = root; c; c = c->next) {
-               if (c->children)
-                       chip_configure(c->children, pass);
-       }
-}
-
-/**
- * @brief Convert static device structures to dynamic structures.
- *
- * A static device may contain one or more dynamic devices. Dynamic device
- * structures of these devices have to be generated before the enumeration
- * of dynamic devices. This function converts a static chip structure to a
- * set of dynamic device structures.
- *
- * This function is the generic method called by enumerate_static_device_chain()
- * for static devices. Devices extend this default behavior by defining their
- * own chip_controll::enumerate(). Generally, device specific
- * chip_control::enumerate() method calls this function as its last operation.
- *
- * @param chip static chip structure to be converted.
- *
- */
-void chip_enumerate(struct chip *chip)
-{
-       struct chip *child;
-       device_t dev;
-       int link;
-       int i;
-
-       dev = 0;
-       link = 0;
-
-       if (chip->control && chip->control->name) {
-               printk_debug("Enumerating: %s\n", chip->control->name);
-       }
-
-       for(i = 0; i < MAX_CHIP_PATHS; i++) {
-               int identical_paths;
-               identical_paths = 
-                       (i > 0) &&
-                       (path_eq(&chip->path[i - 1].path, &chip->path[i].path));
-               if (!identical_paths) {
-                       struct bus *parent;
-                       int bus;
-                       link = 0;
-                       dev = 0;
-                       parent = chip->bus;
-                       switch(chip->path[i].path.type) {
-                       case DEVICE_PATH_NONE:
-                               /* no dynamic device associated */
-                               break;
-                       case DEVICE_PATH_PCI:
-                               bus = chip->path[i].path.u.pci.bus;
-                               if (bus != 0) {
-                                       device_t dev;
-                                       int i = 1;
-                                       dev = chip->dev;
-                                       while(dev && (i != bus)) {
-                                               dev = dev->next;
-                                               i++;
-                                       }
-                                       if ((i == bus) && dev) {
-                                               parent = &dev->link[0];
-                                       }
-                               }
-                               /* Fall through */
-                       default:
-                               dev = alloc_dev(parent, &chip->path[i].path);
-                               break;
-                       }
-               }
-               else {
-                       link += 1;
-               }
-
-               if (dev) {
-                       struct chip_resource *res, *res_limit;
-                       printk_spew("path (%p) %s %s", 
-                               dev, dev_path(dev), identical_paths?"identical":"");
-                       printk_spew(" parent: (%p):%d %s\n",
-                               dev->bus->dev,  dev->bus->link,
-                               dev_path(dev->bus->dev));
-                       dev->chip = chip;
-                       dev->enabled = chip->path[i].enabled;
-                       dev->links = link + 1;
-                       for(child = chip->children; child; child = child->next) {
-                               if (!child->bus && child->link == i) {
-                                       child->bus = &dev->link[link];
-                               }
-                       }
-                       res = &chip->path[i].resource[0];
-                       res_limit = &chip->path[i].resource[MAX_RESOURCES];
-                       for(; res < res_limit; res++) {
-                               if (res->flags) {
-                                       struct resource *resource;
-                                       resource = new_resource(dev, res->index);
-                                       resource->flags = res->flags | IORESOURCE_FIXED | IORESOURCE_ASSIGNED;
-                                       resource->base = res->base;
-                               }
-                       }
-               }
-
-               if (dev && !chip->dev) {
-                       chip->dev = dev;
-               }
-       }
-       if (chip->children && !chip->dev) {
-               die("No device but children?");
-       }
-       for(child = chip->children; child; child = child->next) {
-               if (!child->bus) {
-                       child->bus = &chip->dev->link[0];
-               }
-       }
-}
-
-/**
- * @brief Enumerate a static device tree.
- *
- * A static device chain is a linked list of static device structures which are
- * on the same branch of the static device tree. This function does not only
- * enumerate the devices on a single chain, as its name suggest, it also walks
- * into the subordinary chains by recursion. It calls the device specific
- * chip_control::enumerate() of the device if one exists or calls the generic
- * chip_enumerate(). 
- *
- * This function is only an iterator, the exact definition of 'enumerate'
- * depends on the implementation of the generic chip_enumerate() and/or device
- * specific chip_control::enumerate(). 
- *
- * @param root static chip structure to start with.
- *
- * @see chip_control::enumerate()
- */
-static void enumerate_static_device_chain(struct chip *root)
-{
-       struct chip *chip;
-       for(chip = root; chip; chip = chip->next) {
-               void (*enumerate)(struct chip *chip);
-               enumerate = chip_enumerate;
-               if (chip->control && chip->control->enumerate) {
-                       enumerate = chip->control->enumerate;
-               }
-               enumerate(chip);
-       }
-
-       for(chip = root; chip; chip = chip->next) {
-               if (chip->children) {
-                       enumerate_static_device_chain(chip->children);
-               }
-       }
-}
-
-/**
- * @brief Enumerate static devices in the system.
- *
- * Static device is . Static devices are actually enumerated or "listed" in
- * the Config.lb config file and the corresponding data structures are
- * generated by config tool in the static.c. 
- *
- * \note The definition of 'enumerate' is not clear in this context. Does it
- * mean probe ?
- *
- * \note How do we determine the existence of the static devices ? Static
- * devices are listed in the config file and generated at compile time by config
- * tool. This function is called at certain point in the early stage of
- * LinuxBIOS. It uses the chip_enumerate() function to convert the static
- * structures into dynamic ones. What if the static devices listed in the config
- * file does actually not exist in the system ? Is there any side effect of
- * these 'phantom' device structures
- *
- * The static device does not necesarry conform to the dynamic device tree in
- * the system.
- */
-void enumerate_static_devices(void)
-{
-       struct chip *child;
-       int i;
-       printk_info("Enumerating static devices...\n");
-       static_root.dev = &dev_root;
-       dev_root.links  = MAX_LINKS;
-       for(i = 0; i < MAX_LINKS; i++) {
-               dev_root.link[i].link = i;
-               dev_root.link[i].dev = &dev_root;
-               for(child = static_root.children; child; child = child->next) {
-                       if (!child->bus && child->link == i) {
-                               child->bus = &dev_root.link[i];
-                       }
-               }
-       }
-       for(child = static_root.children; child; child = child->next) {
-               if (!child->bus) {
-                       child->bus = &dev_root.link[0];
-               }
-       }
-       enumerate_static_device_chain(&static_root);
-}
index 796aafb6ff384aa89ddf51d2c6049b5cc191448a..a2ded6d17c35e7a62f2a6c9f43e05cef70802b0e 100644 (file)
@@ -27,7 +27,7 @@
 /** Linked list of ALL devices */
 struct device *all_devices = &dev_root;
 /** Pointer to the last device */
-static struct device **last_dev_p = &dev_root.next;
+extern struct device **last_dev_p;
 
 /** The upper limit of MEM resource of the devices.
  * Reserve 20M for the system */
@@ -504,6 +504,9 @@ void dev_enumerate(void)
        unsigned subordinate;
        printk_info("Enumerating buses...\n");
        root = &dev_root;
+       if (root->chip_ops && root->chip_ops->enable_dev) {
+               root->chip_ops->enable_dev(root);
+       }
        if (!root->ops || !root->ops->scan_bus) {
                printk_err("dev_root missing scan_bus operation");
                return;
index 7a942b457ee5b8d3231e077c54d8b3b7bc3d8497..56a96015b8cb45e73bcf0846a248e053474d6117 100644 (file)
@@ -133,6 +133,14 @@ const char *dev_path(device_t dev)
                        sprintf(buffer, "APIC: %02x",
                                dev->path.u.apic.apic_id);
                        break;
+               case DEVICE_PATH_PCI_DOMAIN:
+                       sprintf(buffer, "PCI_DOMAIN: %04x",
+                               dev->path.u.pci_domain.domain);
+                       break;
+               case DEVICE_PATH_APIC_CLUSTER:
+                       sprintf(buffer, "APIC_CLUSTER: %01x",
+                               dev->path.u.apic_cluster.cluster);
+                       break;
                default:
                        printk_err("Unknown device path type: %d\n", dev->path.type);
                        break;
@@ -155,8 +163,7 @@ int path_eq(struct device_path *path1, struct device_path *path2)
                        equal = 1;
                        break;
                case DEVICE_PATH_PCI:
-                       equal = (path1->u.pci.bus == path2->u.pci.bus) &&
-                               (path1->u.pci.devfn == path2->u.pci.devfn);
+                       equal = (path1->u.pci.devfn == path2->u.pci.devfn);
                        break;
                case DEVICE_PATH_PNP:
                        equal = (path1->u.pnp.port == path2->u.pnp.port) &&
@@ -168,6 +175,12 @@ int path_eq(struct device_path *path1, struct device_path *path2)
                case DEVICE_PATH_APIC:
                        equal = (path1->u.apic.apic_id == path2->u.apic.apic_id);
                        break;
+               case DEVICE_PATH_PCI_DOMAIN:
+                       equal = (path1->u.pci_domain.domain == path2->u.pci_domain.domain);
+                       break;
+               case DEVICE_PATH_APIC_CLUSTER:
+                       equal = (path1->u.apic_cluster.cluster == path2->u.apic_cluster.cluster);
+                       break;
                default:
                        printk_err("Uknown device type: %d\n", path1->type);
                        break;
index 344f23fec438c17ee1eed4eb6b8dbcdd45e4fba9..e8cf432cb1ea781d6d1f95329ebcbc3b22cb2c2f 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/hypertransport.h>
-#include <device/chip.h>
 #include <part/hard_reset.h>
 #include <part/fallback_boot.h>
 
@@ -263,8 +262,8 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int max)
                        /* Add this device to the pci bus chain */
                        *chain_last = dev;
                        /* Run the magice enable sequence for the device */
-                       if (dev->chip && dev->chip->control && dev->chip->control->enable_dev) {
-                               dev->chip->control->enable_dev(dev);
+                       if (dev->chip_ops && dev->chip_ops->enable_dev) {
+                               dev->chip_ops->enable_dev(dev);
                        }
                        /* Now read the vendor and device id */
                        id = pci_read_config32(dev, PCI_VENDOR_ID);
index 5d72f03ccd719579a9a348e35a401fdcfcc6c8e1..a7b2ff3e89ecfb87318bb67ecc8d4a272d8ee032 100644 (file)
@@ -18,7 +18,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <part/hard_reset.h>
 #include <part/fallback_boot.h>
 #include <delay.h>
@@ -486,7 +485,7 @@ void pci_dev_enable_resources(struct device *dev)
 
        /* Set the subsystem vendor and device id for mainboard devices */
        ops = ops_pci(dev);
-       if (dev->chip && ops && ops->set_subsystem) {
+       if (dev->chip_ops && ops && ops->set_subsystem) {
                printk_debug("%s subsystem <- %02x/%02x\n",
                        dev_path(dev), 
                        MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID,
@@ -740,10 +739,9 @@ unsigned int pci_scan_bus(struct bus *bus,
                         * it may be absent and enable_dev must cope.
                         * 
                         */
-                       if (    dev->chip && dev->chip->control && 
-                               dev->chip->control->enable_dev) 
+                       if (dev->chip_ops && dev->chip_ops->enable_dev) 
                        {
-                               dev->chip->control->enable_dev(dev);
+                               dev->chip_ops->enable_dev(dev);
                        }
                        /* Now read the vendor and device id */
                        id = pci_read_config32(dev, PCI_VENDOR_ID);
index 9ecfe63a52ebdc0f2630d3e08295cde5031cacbc..70286ad7acb9ada3712dea8cf840a6ede15c98ac 100644 (file)
@@ -185,22 +185,24 @@ static void get_resources(device_t dev, struct pnp_info *info)
        }       
 } 
 
-void pnp_enumerate(struct chip *chip, unsigned functions, 
-       struct device_operations *ops, struct pnp_info *info)
+void pnp_enable_devices(device_t base_dev, struct device_operations *ops, 
+       unsigned functions, struct pnp_info *info)
 {
        struct device_path path;
        device_t dev;
        int i;
 
-       chip_enumerate(chip);
-
        path.type       = DEVICE_PATH_PNP;
-       path.u.pnp.port = chip->dev->path.u.pnp.port;
+       path.u.pnp.port = base_dev->path.u.pnp.port;
        
        /* Setup the ops and resources on the newly allocated devices */
        for(i = 0; i < functions; i++) {
                path.u.pnp.device = info[i].function;
-               dev = alloc_find_dev(chip->bus, &path);
+               dev = alloc_find_dev(base_dev->bus, &path);
+               
+               /* Don't initialize a device multiple times */
+               if (dev->ops) 
+                       continue;
 
                if (info[i].ops == 0) {
                        dev->ops = ops;
index 1642e8beda874bb3f48b731a25f37c1cf7e91e76..8e85212506b129fb629250fd01481079059b1bfc 100644 (file)
@@ -76,6 +76,9 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
 
        for(link = 0; link < bus->links; link++) {
                for(child = bus->link[link].children; child; child = child->sibling) {
+                       if (child->chip_ops && child->chip_ops->enable_dev) {
+                               child->chip_ops->enable_dev(child);
+                       }
                        if (child->ops && child->ops->enable) {
                                child->ops->enable(child);
                        }
@@ -142,7 +145,6 @@ unsigned int root_dev_scan_bus(device_t root, unsigned int max)
 
 void root_dev_init(device_t root)
 {
-       initialize_cpus(root);
 }
 
 /**
@@ -169,9 +171,4 @@ struct device_operations default_dev_ops_root = {
  * This is the root of the dynamic device tree. A PCI tree always has 
  * one bus, bus 0. Bus 0 contains devices and bridges. 
  */
-struct device dev_root = {
-       .ops = &default_dev_ops_root,
-       .bus = &dev_root.link[0],
-       .path = { .type = DEVICE_PATH_ROOT },
-       .enabled = 1,
-};
+extern struct device dev_root;
index 85603750b51e1df452b98f3942d4eb7c0bc44ef3..e211d990e04aa3f644fe348035d664b36990291f 100644 (file)
@@ -5,7 +5,7 @@ struct device;
 #include <arch/cpu.h>
 
 void cpu_initialize(void);
-void initialize_cpus(struct device *root);
+void initialize_cpus(struct bus *cpu_bus);
 
 #define __cpu_driver __attribute__ ((used,__section__(".rodata.cpu_driver")))
 /** start of compile time generated pci driver array */
diff --git a/src/include/device/chip.h b/src/include/device/chip.h
deleted file mode 100644 (file)
index 5f4e36b..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef DEVICE_CHIP_H
-#define DEVICE_CHIP_H
-
-#include <device/path.h>
-#include <device/device.h>
-
-/* chips are arbitrary chips (superio, southbridge, etc.)
- * They have private structures that define chip resources and default 
- * settings. They have four externally visible functions for control. 
- * They have a generic component which applies to all chips for 
- * path, etc. 
- */
-
-/* some of the types of resources chips can control */
-#if CONFIG_CHIP_CONFIGURE == 1
-#define CONFIGURE(pass) chip_configure(&static_root, pass)
-#else
-#define CONFIGURE(pass)
-#endif
-
-enum chip_pass {
-       CONF_PASS_PRE_CONSOLE,
-       CONF_PASS_PRE_PCI,
-       CONF_PASS_PRE_DEVICE_ENUMERATE,
-       CONF_PASS_PRE_DEVICE_CONFIGURE,
-       CONF_PASS_PRE_DEVICE_ENABLE,
-       CONF_PASS_PRE_DEVICE_INITIALIZE,
-       CONF_PASS_POST_PCI,
-       CONF_PASS_PRE_BOOT
-};
-
-
-/* linkages from devices of a type (e.g. superio devices) 
- * to the actual physical PCI device. This type is used in an array of 
- * structs built by NLBConfig.py. We owe this idea to Plan 9.
- */
-
-struct chip;
-struct device;
-
-/* there is one of these for each TYPE of chip */
-struct chip_control {
-       /* This is the print name for debugging */
-       char *name;
-       void (*enable)(struct chip *, enum chip_pass);
-       void (*enumerate)(struct chip *chip);
-       void (*enable_dev)(struct device *dev);
-};
-
-struct chip_resource {
-       unsigned long flags;
-       unsigned long index;
-       unsigned long base;
-};
-
-struct chip_device_path {
-       struct device_path path;
-       unsigned channel;
-       int enabled;
-       struct chip_resource resource[MAX_RESOURCES];
-};
-
-struct device;
-struct bus;
-
-#ifndef MAX_CHIP_PATHS
-#define MAX_CHIP_PATHS 16
-#endif
-struct chip {
-       unsigned link;
-       struct chip_control *control; /* for this device */
-       struct chip_device_path path[MAX_CHIP_PATHS]; /* can be 0, in which case the default is taken */
-       char *configuration; /* can be 0. */
-       struct chip *next, *children;
-       /* there is one of these for each INSTANCE of a chip */
-       void *chip_info; /* the dreaded "void *" */
-       /* bus and device links into the device tree */
-       struct bus *bus;
-       struct device *dev;
-};
-
-extern struct chip static_root;
-extern void chip_configure(struct chip *, enum chip_pass);
-extern void chip_enumerate(struct chip *chip);
-#endif /* DEVICE_CHIP_H */
index c5a18c298e4e4687c17db87d26838d274e7a5a67..d5d2e8d946e3b002f4c7ef6e300d462f3825e102 100644 (file)
@@ -5,11 +5,18 @@
 #include <device/resource.h>
 #include <device/path.h>
 
+
 struct device;
 typedef struct device * device_t;
 struct pci_operations;
 struct smbus_bus_operations;
 
+/* Chip operations */
+struct chip_operations {
+       char *name;     /* This is the print name for debugging */
+       void (*enable_dev)(struct device *dev);
+};
+
 struct device_operations {
        void (*read_resources)(device_t dev);
        void (*set_resources)(device_t dev);
@@ -67,7 +74,7 @@ struct device {
 
        unsigned long rom_address;
        struct device_operations *ops;
-       struct chip_control *chip_control;
+       struct chip_operations *chip_ops;
        void *chip_info;
 };
 
index 9df1d9fa67e92c46ca3ee4cf4e89223d1428fd91..cdb98ee8a84e60c1b0f4f147b52700f369f87757 100644 (file)
@@ -10,7 +10,7 @@ enum device_path_type {
        DEVICE_PATH_I2C,
        DEVICE_PATH_APIC,
        DEVICE_PATH_PCI_DOMAIN,
-       DEVICE_APIC_CLUSTER,
+       DEVICE_PATH_APIC_CLUSTER,
 };
 
 struct pci_domain_path
index 89c0a730f5832185c973121a2e5b95a126b118f4..757b240c323bad2a8dd0732af476ecfc49aada1b 100644 (file)
@@ -4,7 +4,6 @@
 #include <stdint.h>
 #include <device/device.h>
 #include <device/pnp_def.h>
-#include <device/chip.h>
 
 /* Primitive pnp resource manipulation */
 void    pnp_write_config(device_t dev, uint8_t reg, uint8_t value);
@@ -45,7 +44,7 @@ struct pnp_info {
        struct io_info io0, io1, io2, io3;
 };
 struct resource *pnp_get_resource(device_t dev, unsigned index);
-void pnp_enumerate(struct chip *chip, unsigned functions, 
-       struct device_operations *ops, struct pnp_info *info);
+void pnp_enable_devices(struct device *dev, struct device_operations *ops,
+       unsigned functions, struct pnp_info *info);
 
 #endif /* DEVICE_PNP_H */
index 230f0619002be446b4c548d665e7068666d68cf2..40e49eefae71c7775c86745b22c2abb8fe4f182b 100644 (file)
@@ -4,7 +4,6 @@
 #include <stdint.h>
 #include <device/device.h>
 #include <device/path.h>
-#include <device/chip.h>
 #include <device/smbus_def.h>
 
 /* Common smbus bus operations */
index 73d52ca84316fc3931045e2dc6d785ea2990f33e..028e0062b2f9b0aa97371304c88803974121ebd4 100644 (file)
@@ -1,8 +1,5 @@
 #include <version.h>
 
-#define __STR(X) #X
-#define STR(X) __STR(X)
-
 #ifndef MAINBOARD_VENDOR
 #error MAINBOARD_VENDOR not defined
 #endif
 
 
 #ifndef  LINUXBIOS_EXTRA_VERSION
-#define LINUXBIOS_EXTRA_VERSION
+#define LINUXBIOS_EXTRA_VERSION ""
 #endif
 
-const char mainboard_vendor[] = STR(MAINBOARD_VENDOR);
-const char mainboard_part_number[] = STR(MAINBOARD_PART_NUMBER);
+const char mainboard_vendor[] = MAINBOARD_VENDOR;
+const char mainboard_part_number[] = MAINBOARD_PART_NUMBER;
 
-const char linuxbios_version[] = STR(LINUXBIOS_VERSION);
-const char linuxbios_extra_version[] = STR(LINUXBIOS_EXTRA_VERSION);
-const char linuxbios_build[] = STR(LINUXBIOS_BUILD);
+const char linuxbios_version[] = LINUXBIOS_VERSION;
+const char linuxbios_extra_version[] = LINUXBIOS_EXTRA_VERSION;
+const char linuxbios_build[] = LINUXBIOS_BUILD;
 
-const char linuxbios_compile_time[]   = STR(LINUXBIOS_COMPILE_TIME);
-const char linuxbios_compile_by[]     = STR(LINUXBIOS_COMPILE_BY);
-const char linuxbios_compile_host[]   = STR(LINUXBIOS_COMPILE_HOST);
-const char linuxbios_compile_domain[] = STR(LINUXBIOS_COMPILE_DOMAIN);
-const char linuxbios_compiler[]       = STR(LINUXBIOS_COMPILER);
-const char linuxbios_linker[]         = STR(LINUXBIOS_LINKER);
-const char linuxbios_assembler[]      = STR(LINUXBIOS_ASSEMBLER);
+const char linuxbios_compile_time[]   = LINUXBIOS_COMPILE_TIME;
+const char linuxbios_compile_by[]     = LINUXBIOS_COMPILE_BY;
+const char linuxbios_compile_host[]   = LINUXBIOS_COMPILE_HOST;
+const char linuxbios_compile_domain[] = LINUXBIOS_COMPILE_DOMAIN;
+const char linuxbios_compiler[]       = LINUXBIOS_COMPILER;
+const char linuxbios_linker[]         = LINUXBIOS_LINKER;
+const char linuxbios_assembler[]      = LINUXBIOS_ASSEMBLER;
 
 
 
index 48ea1ac88bd251825592fefb966a3891dfa474bf..0f609b3f69a0487dc5a1d6477a42ec502f5e80c3 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index 82041282f643b60e2b7ab1a403b6c33be95c396a..6153ce08aa511be0ba6ab752f1449da1467cb460 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index 917a2ac792e339bc6c8296f6bca6215422293886..cf5b475e9501742e1f187b9e0c7440b73812c92e 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index 27146e79b0f345e194a23310213af576245dd04b..cce62a28e82fd508fcfd6f3a43cbf89e07fe7c80 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index 2c3ccc94eb9e51c91a4394976053043c54b19a61..75e66c1d03097559500ffef7806534f5cf71dce3 100644 (file)
@@ -6,7 +6,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index 1406a48b8646e2169a91f1159462233e28ce73f3..5bb0bc34856d356cc84fe3f6876eb7d9946de5db 100644 (file)
@@ -34,15 +34,31 @@ uses MAINBOARD_VENDOR
 uses MAINBOARD
 uses LINUXBIOS_EXTRA_VERSION
 uses _RAMBASE
+uses CC
+uses HOSTCC
+uses TTYS0_BAUD
+uses TTYS0_BASE
+uses TTYS0_LCS
+uses DEFAULT_CONSOLE_LOGLEVEL
+uses MAXIMUM_CONSOLE_LOGLEVEL
+uses MAINBOARD_POWER_ON_AFTER_POWER_FAIL
+uses CONFIG_CONSOLE_SERIAL8250
 
 
-## ROM_SIZE is the size of boot ROM that this board will use.
-default ROM_SIZE=524288
-
 ###
 ### Build options
 ###
 
+##
+## ROM_SIZE is the size of boot ROM that this board will use.
+##
+default ROM_SIZE=524288
+
+##
+## FALLBACK_SIZE is the amount of the ROM the complete fallback image will use
+##
+default FALLBACK_SIZE=131072
+
 ##
 ## Build code for the fallback boot
 ##
@@ -123,6 +139,10 @@ default HEAP_SIZE=0x4000
 ## Only use the option table in a normal image
 ##
 default USE_OPTION_TABLE = !USE_FALLBACK_IMAGE
+
+##
+## LinuxBIOS C code runs at this location in RAM
+##
 default _RAMBASE=0x00004000
 
 ##
@@ -130,5 +150,61 @@ default _RAMBASE=0x00004000
 ##
 default CONFIG_ROM_STREAM = 1
 
+###
+### Defaults of options that you may want to override in the target config file
+### 
+
+##
+## The default compiler
+##
+default CC="gcc"
+default HOSTCC="gcc"
+
+##
+## The Serial Console
+##
+
+# To Enable the Serial Console
+default CONFIG_CONSOLE_SERIAL8250=1
+
+## Select the serial console baud rate
+default TTYS0_BAUD=115200
+#default TTYS0_BAUD=57600
+#default TTYS0_BAUD=38400
+#default TTYS0_BAUD=19200
+#default TTYS0_BAUD=9600
+#default TTYS0_BAUD=4800
+#default TTYS0_BAUD=2400
+#default TTYS0_BAUD=1200
+
+# Select the serial console base port
+default TTYS0_BASE=0x3f8
+
+# Select the serial protocol
+# This defaults to 8 data bits, 1 stop bit, and no parity
+default TTYS0_LCS=0x3
+
+##
+### Select the linuxBIOS loglevel
+##
+## EMERG      1   system is unusable               
+## ALERT      2   action must be taken immediately 
+## CRIT       3   critical conditions              
+## ERR        4   error conditions                 
+## WARNING    5   warning conditions               
+## NOTICE     6   normal but significant condition 
+## INFO       7   informational                    
+## DEBUG      8   debug-level messages             
+## SPEW       9   Way too many details             
+
+## Request this level of debugging output
+default  DEFAULT_CONSOLE_LOGLEVEL=8
+## At a maximum only compile in this level of debugging
+default  MAXIMUM_CONSOLE_LOGLEVEL=8
+
+##
+## Select power on after power fail setting
+default MAINBOARD_POWER_ON_AFTER_POWER_FAIL="MAINBOARD_POWER_ON"
 
+### End Options.lb
 end
index ba52d6dbdb0e770ea7c3d16f79d2d803936d8ca1..c3792f41e978d1566e3072b035d47a22d6c6f670 100644 (file)
@@ -1,4 +1,4 @@
-extern struct chip_control mainboard_arima_hdama_control;
+extern struct chip_operations mainboard_arima_hdama_ops;
 
 struct mainboard_arima_hdama_config {
        int nothing;
index 81f82b3d75cab16dca939284614ad01ab39fc520..78b871564092b10972f650e5dbb52ddd2fcb637d 100644 (file)
@@ -9,7 +9,6 @@
 #include <delay.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "../../../northbridge/amd/amdk8/cpu_rev.c"
 #include "chip.h"
@@ -312,13 +311,12 @@ static struct device_operations mainboard_operations = {
        .enable           = 0,
 };
 
-static void enumerate(struct chip *chip)
+static void enable_dev(struct chip *chip)
 {
        dev_root.ops = &mainboard_operations;
-       chip_enumerate(chip);
 }
-struct chip_control mainboard_arima_hdama_control = {
-       .enumerate = enumerate, 
+struct chip_operations mainboard_arima_hdama_ops = {
        .name      = "Arima HDAMA mainboard ",
+       .enable_dev = enable_dev, 
 };
 
index df52081ac7f74cde65060c2883a2f3d1b417b2d9..5abb8fcec20cbae9467b5adf1f04e6f1bde24687 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -6,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "chip.h"
 
 static int
index 137c49a0fff391ed4c46984fe82cf6fdbe1cc164..aa7428300b5c25645fb4e5c3003b885b8d919beb 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -6,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "chip.h"
 
 static int
index 270e5df9eb31320a4b8d8dc236d81460ba2d5d34..4e5c84c4bc8b0dc15008da452495205d502fcbdc 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "chip.h"
 
 void cpufixup(unsigned long mem)
index 01969d64486c9059d9e99d86e33115bf92d8082c..83f44ec623219043d3ceb57c449678d78ccf8d45 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index 5e58ebcd184670d9d2ca0a3f44ad786d8f6016fe..d170f48eb31049277e08c3f82fdd8a1c4a348208 100644 (file)
@@ -5,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "../../../northbridge/amd/amdk8/northbridge.h"
 #include "chip.h"
 
index ca05fa086128433a196b851cea166da5e1f60eff..88cf9861c4c4be3d2f8b143b8b03c5cc3f786696 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -6,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "chip.h"
 
 static int
index 143909f1a561c8615398ba8fd47095f558d358df..c53681d9e6bdcd63c8d1e830521ad8c9f36af7da 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 6864a0333d4a5ba013e5914925c990e60772dd17..87cb2908e7d9636d130f077e3b82f0c063819db0 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index bb1eba3b9b2525c42c2fd40a7edea583c3fe35e6..8a7c3d0ffff962d4d5f70c27d30115974c786cda 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 17ceb5d916dc5fa6c4ecb5db917baad872e13321..d15ae19997ece2a7505e9ba7de90b219bf890b7f 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 86158b75518b2bf72a991a66e22f585323daa1ef..231f33777cd6dfb8a80606479800e63065eaddef 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 0f440856af9f9ec4607104f580197129a0b927cd..914d30242283cce7b9a7341d376fe12cf1c8b2c3 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 2c015843101a6404043d9adfb688dcece0f5c1db..f29f486896393aa808bd123607523aaac505c8d7 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 2ed9eb9c2f6e1cc97a5cc90090e4d6a01cdd9ca7..cf2b3bcf21472b434ea39b50f679052d4a2d7b99 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 32e1a31fd25592f5b8cd683a4ad99611235f2c52..dcabd840e20b4db30cd5ee5b1e852d4bf6f5e6ec 100644 (file)
@@ -1,6 +1,5 @@
 #include <console/console.h>
 #include <device/device.h>
-#include <device/chip.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
index 95973925935eff0aae571508163a1378194c23e2..443a7cbf3db0c4d558fcc614ed472018bcf2e79e 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -6,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "chip.h"
 
 void vga_enable_console();
index df52081ac7f74cde65060c2883a2f3d1b417b2d9..5abb8fcec20cbae9467b5adf1f04e6f1bde24687 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -6,7 +5,6 @@
 #include <device/pci_ops.h>
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include "chip.h"
 
 static int
index a6111c98c94f2038f93021c03c1bb34d59890e2a..26d4e53ac6b2cae430cc83f543181d0776190b2d 100644 (file)
@@ -2,4 +2,4 @@ struct northbridge_amd_amdk8_config
 {
 };
 
-extern struct chip_control northbridge_amd_amdk8_control;
+extern struct chip_operations northbridge_amd_amdk8_ops;
index 4933b161b7c5903002452f79044145e1422ff8ef..cb2f9fa0a714f85008a06e651ae4b566d34333ca 100644 (file)
@@ -6,10 +6,10 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/hypertransport.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
+#include <cpu/cpu.h>
 #include "chip.h"
 #include "northbridge.h"
 #include "amdk8.h"
@@ -487,7 +487,7 @@ static struct pci_driver mcf0_driver __pci_driver = {
 
 #define BRIDGE_IO_MASK (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH)
 
-static void bridge_read_resources(device_t dev)
+static void pci_domain_read_resources(device_t dev)
 {
        struct resource *resource;
        unsigned reg;
@@ -556,7 +556,7 @@ static void ram_resource(device_t dev, unsigned long index,
                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
 }
 
-static void bridge_set_resources(device_t dev)
+static void pci_domain_set_resources(device_t dev)
 {
        struct resource *io, *mem1, *mem2;
        struct resource *resource, *last;
@@ -577,7 +577,7 @@ static void bridge_set_resources(device_t dev)
        mem2 = find_resource(dev, 2);
        /* See if both resources have roughly the same limits */
        if (((mem1->limit <= 0xffffffff) && (mem2->limit <= 0xffffffff)) ||
-               (mem1->limit > 0xffffffff) && (mem2->limit > 0xffffffff))
+               ((mem1->limit > 0xffffffff) && (mem2->limit > 0xffffffff)))
        {
                /* If so place the one with the most stringent alignment first
                 */
@@ -682,21 +682,34 @@ static void bridge_set_resources(device_t dev)
        assign_resources(&dev->link[0]);
 }
 
-
-
-static unsigned int bridge_scan_bus(device_t root, unsigned int max)
+static unsigned int pci_domain_scan_bus(device_t dev, unsigned int max)
 {
-       struct bus *cpu_bus;
        unsigned reg;
        int i;
        /* Unmap all of the HT chains */
        for(reg = 0xe0; reg <= 0xec; reg += 4) {
                f1_write_config32(reg, 0);
        }
-       max = pci_scan_bus(&root->link[0], PCI_DEVFN(0x18, 0), 0xff, max);
+       max = pci_scan_bus(&dev->link[0], PCI_DEVFN(0x18, 0), 0xff, max);
+       return max;
+}
+
+static struct device_operations pci_domain_ops = {
+       .read_resources   = pci_domain_read_resources,
+       .set_resources    = pci_domain_set_resources,
+       .enable_resources = enable_childrens_resources,
+       .init             = 0,
+       .scan_bus         = pci_domain_scan_bus,
+};
+
+static unsigned int scan_cpu_bus(device_t dev, unsigned int max)
+{
+       struct bus *cpu_bus;
+       unsigned reg;
+       int i;
 
        /* Find which cpus are present */
-       cpu_bus = &dev_root.link[1];
+       cpu_bus = &dev->link[0];
        for(i = 0; i < 7; i++) {
                device_t dev, cpu;
                struct device_path cpu_path;
@@ -732,40 +745,39 @@ static unsigned int bridge_scan_bus(device_t root, unsigned int max)
                                dev_path(cpu), cpu->enabled?"enabled":"disabled");
                }
        }
-
        return max;
 }
 
+static void cpu_bus_init(device_t dev)
+{
+       printk_debug("cpu_bus_init\n");
+#if 0
+       initialize_cpus(&dev->link[0]);
+#endif
+}
 
-static struct device_operations bridge_ops = {
-       .read_resources   = bridge_read_resources,
-       .set_resources    = bridge_set_resources,
-       .enable_resources = enable_childrens_resources,
-       .init             = 0,
-       .scan_bus         = bridge_scan_bus,
+static struct device_operations cpu_bus_ops = {
+       .read_resources   = 0,
+       .set_resources    = 0,
+       .enable_resources = 0,
+       .init             = cpu_bus_init,       
+       .scan_bus         = scan_cpu_bus,
 };
 
-static void enumerate(struct chip *chip)
+static void enable_dev(struct device *dev)
 {
        struct device_path path;
-       device_t bridge;
-       chip_enumerate(chip);
 
-       /* Get the path for the bridge device */
-       path.type         = DEVICE_PATH_PNP;
-       path.u.pnp.port   = 0xcf8;
-       path.u.pnp.device = 0;
-
-       /* Lookup the bridge device */
-       bridge = find_dev_path(&dev_root.link[0], &path);
-
-       /* Set the bridge operations */
-       if (bridge) {
-               bridge->ops = &bridge_ops;
+       /* Set the operations if it is a special bus type */
+       if (dev->path.type == DEVICE_PATH_PCI_DOMAIN) {
+               dev->ops = &pci_domain_ops;
+       }
+       else if (dev->path.type == DEVICE_PATH_APIC_CLUSTER) {
+               dev->ops = &cpu_bus_ops;
        }
 }
 
-struct chip_control northbridge_amd_amdk8_control = {
-       .name   = "AMD K8 Northbridge",
-       .enumerate = enumerate,
+struct chip_operations northbridge_amd_amdk8_ops = {
+       .name       = "AMD K8 Northbridge",
+       .enable_dev = enable_dev,
 };
index 9a8f55730280332b03e22fc43a5f2305872658f1..78ec64e310741bc2d8f97efb4d0738a81e7ab955 100644 (file)
@@ -6,7 +6,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/hypertransport.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index d4f73df3d2bbc6d284dfda7e68eec7bbd860a2f2..906617ad8e74c389785377c291e058ea294c7134 100644 (file)
@@ -5,7 +5,6 @@
 #include <part/sizeram.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index 452166ba288025d6cfae03349e2110aa376619ee..79068310c832163b69ffd9a69ab27eaea81fc5de 100644 (file)
@@ -5,7 +5,6 @@
 #include <part/sizeram.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index eb03266ae1e21800a68c2f1ece4a874887600d72..f980c5436a9fe675920ae5d07c3524caf229c1e3 100644 (file)
@@ -5,7 +5,6 @@
 #include <part/sizeram.h>
 #include <device/device.h>
 #include <device/pci.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index ccce795da4842e58a7d6fbe6c47c82114edbe378..af101eb64bb8198b70e9645628b906aa8e3e509c 100644 (file)
@@ -7,7 +7,6 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/hypertransport.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index 5f5e5d9dd82ce8909d3b25b74957913b3c5eed6f..16a7ea8530356ec5802192627776f4eca52d4889 100644 (file)
@@ -6,7 +6,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/hypertransport.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index cba7278066ecb809fac81efffbf8681b9e44c122..c026197973815e37db8712c5fd47e0b6c7f3c1ac 100644 (file)
@@ -7,7 +7,6 @@
 #include <device/pci.h>
 #include <device/hypertransport.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <stdlib.h>
 #include <string.h>
 #include <bitops.h>
index 2a55714eec0328786582e7dec1373a070e92e83a..8575c2b1ebb90b9dda3eb0274b80a4813e402876 100644 (file)
@@ -1,4 +1,4 @@
-config amd8111.h
+config chip.h
 driver amd8111.o
 #driver amd8111_usb.o
 driver amd8111_lpc.o
index 2c5d1e80fec3286d82e5b5c4111dc8241356146c..afb02f1fecd0d8215ed9c98887559418e0738dc3 100644 (file)
@@ -2,7 +2,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include "amd8111.h"
 
 void amd8111_enable(device_t dev)
@@ -62,7 +61,7 @@ void amd8111_enable(device_t dev)
        
 }
 
-struct chip_control southbridge_amd_amd8111_control = {
+struct chip_operations southbridge_amd_amd8111_ops = {
        .name       = "AMD 8111 Southbridge",
        .enable_dev = amd8111_enable,
 };
index 10e152954fa7a34f800cdcddbb4e722ea9821d92..da4fa1d84001a39b7a19ff368ef06c860e30db86 100644 (file)
@@ -1,11 +1,7 @@
 #ifndef AMD8111_H
 #define AMD8111_H
 
-struct southbridge_amd_amd8111_config 
-{
-};
-struct chip_control;
-extern struct chip_control southbridge_amd_amd8111_control;
+#include "chip.h"
 
 void amd8111_enable(device_t dev);
 
index 9c5b5a674ebda7b9f974be311da37a3cc6f30b3d..ff767c7cc42bf98cb57cb2d62ae5b7772929d330 100644 (file)
@@ -6,7 +6,6 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
-#include <device/chip.h>
 #include <pc80/mc146818rtc.h>
 #include "amd8111.h"
 
index 328d0eec07aaebb61f9fe9940052b72b4cfa82b8..281836b09983fffff1b20af59e2cf92d3392e83e 100644 (file)
@@ -2,7 +2,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include "i82801dbm.h"
 
 void i82801dbm_enable(device_t dev)
index 1f43ff7532143a3ed38d3e4de186d31e5cac0af0..2d272db6d81f76751d2b66f3d71f65721e2e1cfc 100644 (file)
@@ -7,7 +7,6 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
-#include <device/chip.h>
 #include <pc80/mc146818rtc.h>
 #include "i82801dbm.h"
 
index 565d6722606d5502bf3700b46ec774a82d323953..0e4e3b3a56f6c3fdafe7207c070982f056b4766d 100644 (file)
@@ -2,7 +2,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include "i82801er.h"
 
 void i82801er_enable(device_t dev)
index c1ee7410ede497f75ebdc67bd3bf2a216a77cbd8..7a449421b0cecbd81478c33e0b4d28f5e2371644 100644 (file)
@@ -7,7 +7,6 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
-#include <device/chip.h>
 #include <pc80/mc146818rtc.h>
 #include "i82801er.h"
 
index c6cb55cba3eb1de604944d8302684c215141572b..1eed3681c74bff66854051572e9abc778ef055b4 100644 (file)
@@ -25,7 +25,6 @@
 #include <device/pci.h>
 #include <device/pci_ops.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include "rl5c476.h"
 #include "chip.h"
index 89445d6a2aced405e324aa8b750225db2006c277..99fef4c0cc59ca371d55c43ac7e61e9a3a046d16 100644 (file)
@@ -4,7 +4,6 @@
 #include <device/pci.h>
 #include <device/pci_ops.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include "vt8231.h"
 #include "chip.h"
index fc4c6a6186f7f43f77306fbc03024c82db11dfa3..a8dc4bae6e8864f92b3e60dcf2a5331a861001fb 100644 (file)
@@ -4,7 +4,6 @@
 #include <device/pci.h>
 #include <device/pci_ops.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include "vt8235.h"
 #include "chip.h"
index 054fc25d3204ae447f0d7007d284783a42fc52c0..bd0b569b54a03596eceff141fed33b8e54235be1 100644 (file)
@@ -34,7 +34,6 @@
 #include <arch/io.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include "w83c553f.h"
 
index 9e0ef6f9763be665dd30f5a8fa7cdf893920ab39..0a9846b1377b8a953330b49fff5662fc6fa71d89 100644 (file)
@@ -5,7 +5,8 @@
 #define SIO_COM2_BASE   0x2F8
 #endif
 
-extern struct chip_control superio_NSC_pc87360_control;
+struct chip_operations;
+extern struct chip_operations superio_NSC_pc87360_ops;
 
 #include <pc80/keyboard.h>
 #include <uart8250.h>
index c2c33765eb4ae6d8185d7f05f9042b8fb2cdd3c6..69eeb31e09a48597807f85081fad3dc1a775787f 100644 (file)
@@ -5,7 +5,6 @@
 #include <arch/io.h>
 #include <device/device.h>
 #include <device/pnp.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include <string.h>
 #include <bitops.h>
@@ -24,7 +23,7 @@ static void init(device_t dev)
        if (!dev->enabled) {
                return;
        }
-       conf = dev->chip->chip_info;
+       conf = dev->chip_info;
        switch(dev->path.u.pnp.device) {
        case PC87360_SP1: 
                res0 = find_resource(dev, PNP_IDX_IO0);
@@ -65,13 +64,13 @@ static struct pnp_info pnp_dev_info[] = {
 };
 
 
-static void enumerate(struct chip *chip)
+static void enable_dev(struct device *dev)
 {
-       pnp_enumerate(chip, sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), 
-               &pnp_ops, pnp_dev_info);
+       pnp_enable_devices(dev, &pnp_ops,
+               sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info);
 }
 
-struct chip_control superio_NSC_pc87360_control = {
-       .enumerate = enumerate,
-       .name      = "NSC 87360"
+struct chip_operations superio_NSC_pc87360_ops = {
+       .name       = "NSC 87360",
+       .enable_dev = enable_dev,
 };
index 7c492583f3ee15900938ae20b7bfc4e3f83bdba6..0d1f878ec89e35600f838be7b525753a54a4105a 100644 (file)
@@ -5,7 +5,6 @@
 #include <arch/io.h>
 #include <device/device.h>
 #include <device/pnp.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include <string.h>
 #include <bitops.h>
index 124dd5c89cce6dbc0d120e57f9817eef8694716d..2fb62e1c937beb9bd67e5cd01b0019884885ab8c 100644 (file)
@@ -2,7 +2,6 @@
 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
 
 #include <arch/io.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include "chip.h"
 
index 26d9356a61f156d980a6bb9296e4a8a7698cfc5d..923a09831712799bc79fd31d38bfee2da5e80e28 100644 (file)
@@ -26,7 +26,6 @@
 #include <device/pci.h>
 #include <device/pci_ops.h>
 #include <device/pci_ids.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include "vt1211.h"
 #include "chip.h"
index ee0a6872e3e63cf9a7cb46ca601b66b602892ecc..c70c4ea8ba2770c43abf26a4bf2c67a1bf1ea4d6 100644 (file)
@@ -7,7 +7,6 @@
 #include <arch/io.h>
 #include <device/device.h>
 #include <device/pnp.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include <string.h>
 #include <bitops.h>
index 1d057137fbbd44033b878d92dad974ad83354468..db0b308ec1d1a5f8841719c2fe3d2ccfdc7eddde 100644 (file)
@@ -7,7 +7,6 @@
 #include <arch/io.h>
 #include <device/device.h>
 #include <device/pnp.h>
-#include <device/chip.h>
 #include <console/console.h>
 #include <string.h>
 #include <bitops.h>
index 8caeb3bf84c89cd24decc991d23e0d50db5baf9b..3f9b5a379ef3bd5a8d534eda2f56321108879523 100644 (file)
@@ -259,6 +259,9 @@ class romimage:
                # exported options
                self.exported_options = []
 
+               # Last device built
+               self.last_device = 0
+
        def getname(self):
                return self.name
 
@@ -282,7 +285,6 @@ class romimage:
                if (o):
                        warning("rule %s previously defined" % id)
                o = makerule(id)
-               print "We are in addmakerule, add %s\n" % id
                setdict(self.makebaserules, id, o)
 
        def getmakerules(self):
@@ -579,6 +581,7 @@ class partobj:
                # links for static device tree
                self.children = 0
                self.siblings = 0
+               self.next_device = 0
                self.chip_or_device = chip_or_device
 
                # list of init code files
@@ -639,7 +642,13 @@ class partobj:
                else:
                        self.instance_name = instance_name
                        self.chipinfo_name = "%s_info_%d" % (self.instance_name, self.instance)
-               
+                       
+               # Link this part into the device list
+               if (self.chip_or_device == 'device'):
+                       if (image.last_device):
+                               image.last_device.next_device = self
+                       image.last_device = self
+
                # Link this part into the tree
                if (parent and (part != 'arch')):
                        debug.info(debug.gencode, "add to parent")
@@ -769,7 +778,7 @@ class partobj:
 
                if (self.instance == 0):
                        self.instance_name = "dev_root"
-                       file.write("struct %s_config %s_info_%s;\n" % (self.type_name, self.type_name, self.instance))
+                       file.write("struct device **last_dev_p = &%s.next;\n" % (self.image.last_device.instance_name))
                        file.write("struct device dev_root = {\n")
                        file.write("\t.ops = &default_dev_ops_root,\n")
                        file.write("\t.bus = &dev_root.link[0],\n")
@@ -780,9 +789,10 @@ class partobj:
                        file.write("\t\t\t.children = &%s,\n" % self.firstchilddevice().instance_name)
                        file.write("\t\t},\n")
                        file.write("\t},\n")
-                       if (self.chipconfig != 0):
-                               file.write("\t.chip_control = &%s_control,\n" % self.type_name)
+                       if (self.chipconfig):
+                               file.write("\t.chip_ops = &%s_ops,\n" % self.type_name)
                                file.write("\t.chip_info = &%s_info_%s,\n" % (self.type_name, self.instance))
+                       file.write("\t.next = &%s,\n" % self.firstchilddevice().instance_name)
                        file.write("};\n")
                        return
 
@@ -804,9 +814,12 @@ class partobj:
                sibling = self.firstsiblingdevice();
                if (sibling):
                        file.write("\t.sibling = &%s,\n" % sibling.instance_name)
-               if (self.chipconfig != 0):
-                       file.write("\t.chip_control = &%s_control,\n" % self.firstparentchip().type_name)
-                       file.write("\t.chip_info = &%s_info_%s,\n" % (self.firstparentchip().type_name, self.firstparentchip().instance))
+               chip = self.firstparentchip()
+               if (chip and chip.chipconfig):
+                       file.write("\t.chip_ops = &%s_ops,\n" % chip.type_name)
+                       file.write("\t.chip_info = &%s_info_%s,\n" % (chip.type_name, chip.instance))
+               if (self.next_device):  
+                       file.write("\t.next=&%s\n" % self.next_device.instance_name)
                file.write("};\n")
                return
 
@@ -1288,7 +1301,7 @@ def mainboard():
        type_name = flatten_name(partdir)
        newpart = partobj(curimage, fulldir, partstack.tos(), 'mainboard', \
                type_name, 0, 0, 'chip')
-       print "Configuring PART %s" % (type)
+       #print "Configuring PART %s" % (type)
        partstack.push(newpart)
        #print "  new PART tos is now %s\n" %partstack.tos().info()
        dirstack.push(fulldir)
@@ -1342,7 +1355,7 @@ def devicepart(type):
        global curimage, dirstack, partstack
        newpart = partobj(curimage, 0, partstack.tos(), type, \
                        '', 0, 0, 'device')
-       print "Configuring PART %s" % (type)
+       #print "Configuring PART %s" % (type)
        partstack.push(newpart)
        #print "  new PART tos is now %s\n" %partstack.tos().info()
        # just push TOS, so that we can pop later. 
@@ -1374,7 +1387,7 @@ def partpop():
        curpart = partstack.tos()
        if (curpart == 0):
                fatal("Trying to pop non-existent part")
-       print "End PART %s" % curpart.part
+       #print "End PART %s" % curpart.part
        # Warn if options are used without being set in this part
        for op in curpart.uses_options.keys():
                if (not isset(op, curpart)):
@@ -1406,7 +1419,6 @@ def lookup(name):
 
 def addrule(id):
        global curimage
-       print "ADDRULE: %s\n" %id
        curimage.addmakerule(id)
        
 def adduserdefine(str):
@@ -2167,7 +2179,7 @@ def writecode(image):
        filename = os.path.join(img_dir, "static.c")
        print "Creating", filename
        file = safe_open(filename, 'w+')
-       file.write("#include <device/chip.h>\n")
+       file.write("#include <device/device.h>\n")
        file.write("#include <device/pci.h>\n")
        for path in image.getconfigincludes().values():
                file.write("#include \"%s\"\n" % path)