Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / parisc / kernel / inventory.c
index ff3b9fe..4e847ba 100644 (file)
@@ -25,7 +25,9 @@
 #include <linux/mm.h>
 #include <asm/hardware.h>
 #include <asm/io.h>
+#include <asm/mmzone.h>
 #include <asm/pdc.h>
+#include <asm/pdcpat.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/parisc-device.h>
@@ -36,7 +38,7 @@
 */
 #undef DEBUG_PAT
 
-int pdc_type = PDC_TYPE_ILLEGAL;
+int pdc_type __read_mostly = PDC_TYPE_ILLEGAL;
 
 void __init setup_pdc(void)
 {
@@ -118,8 +120,8 @@ set_pmem_entry(physmem_range_t *pmem_ptr, unsigned long start,
         * pdc info is bad in this case).
         */
 
-       if (   ((start & (PAGE_SIZE - 1)) != 0)
-           || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) ) {
+       if (unlikely( ((start & (PAGE_SIZE - 1)) != 0)
+           || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) )) {
 
                panic("Memory range doesn't align with page size!\n");
        }
@@ -186,7 +188,7 @@ pat_query_module(ulong pcell_loc, ulong mod_index)
        temp = pa_pdc_cell.cba;
        dev = alloc_pa_dev(PAT_GET_CBA(temp), &pa_pdc_cell.mod_path);
        if (!dev) {
-               return PDC_NE_MOD;
+               return PDC_OK;
        }
 
        /* alloc_pa_dev sets dev->hpa */
@@ -516,7 +518,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs,
 }
 
 /**
- * do_system_map_inventory - Retrieve firmware devices via SYSTEM_MAP.
+ * system_map_inventory - Retrieve firmware devices via SYSTEM_MAP.
  *
  * This function attempts to retrieve and register all the devices firmware
  * knows about via the SYSTEM_MAP PDC call.
@@ -526,16 +528,18 @@ static void __init system_map_inventory(void)
        int i;
        long status = PDC_OK;
     
-       for (i = 0; status != PDC_BAD_PROC && status != PDC_NE_MOD; i++) {
+       for (i = 0; i < 256; i++) {
                struct parisc_device *dev;
                struct pdc_system_map_mod_info module_result;
                struct pdc_module_path module_path;
 
                status = pdc_system_map_find_mods(&module_result,
                                &module_path, i);
+               if ((status == PDC_BAD_PROC) || (status == PDC_NE_MOD))
+                       break;
                if (status != PDC_OK)
                        continue;
-               
+
                dev = alloc_pa_dev(module_result.mod_addr, &module_path.path);
                if (!dev)
                        continue;
@@ -582,10 +586,10 @@ void __init do_memory_inventory(void)
 
 void __init do_device_inventory(void)
 {
-       extern void parisc_generic_device_register(void);
-
        printk(KERN_INFO "Searching for devices...\n");
 
+       init_parisc_bus();
+
        switch (pdc_type) {
 
        case PDC_TYPE_PAT:
@@ -603,7 +607,6 @@ void __init do_device_inventory(void)
        default:
                panic("Unknown PDC type!\n");
        }
-       parisc_generic_device_register();
        printk(KERN_INFO "Found devices:\n");
        print_parisc_devices();
 }