/* Firmware doesn't set up card-mode dino, so we have to */
        if (is_card_dino(&dino_dev->hba.dev->id)) {
                dino_card_setup(bus, dino_dev->hba.base_addr);
-       } else if(bus->parent == NULL) {
-               /* must have a dino above it, reparent the resources
-                * into the dino window */
-               int i;
-               struct resource *res = &dino_dev->hba.lmmio_space;
-
-               bus->resource[0] = &(dino_dev->hba.io_space);
-               for(i = 0; i < DINO_MAX_LMMIO_RESOURCES; i++) {
-                       if(res[i].flags == 0)
-                               break;
-                       bus->resource[i+1] = &res[i];
-               }
-
        } else if (bus->parent) {
                int i;
 
        const char *version = "unknown";
        char *name;
        int is_cujo = 0;
+       LIST_HEAD(resources);
        struct pci_bus *bus;
        unsigned long hpa = dev->hpa.start;
 
 
        dev->dev.platform_data = dino_dev;
 
+       pci_add_resource(&resources, &dino_dev->hba.io_space);
+       if (dino_dev->hba.lmmio_space.flags)
+               pci_add_resource(&resources, &dino_dev->hba.lmmio_space);
+       if (dino_dev->hba.elmmio_space.flags)
+               pci_add_resource(&resources, &dino_dev->hba.elmmio_space);
+       if (dino_dev->hba.gmmio_space.flags)
+               pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
+
        /*
        ** It's not used to avoid chicken/egg problems
        ** with configuration accessor functions.
        */
-       dino_dev->hba.hba_bus = bus = pci_create_bus(&dev->dev,
-                        dino_current_bus, &dino_cfg_ops, NULL);
+       dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+                        dino_current_bus, &dino_cfg_ops, NULL, &resources);
        if (!bus) {
                printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
                       dev_name(&dev->dev), dino_current_bus);
+               pci_free_resource_list(&resources);
                /* increment the bus number in case of duplicates */
                dino_current_bus++;
                return 0;