Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / powerpc / kernel / setup-common.c
index 0af3fc1bdcc929fd37a457d6c05ef1521bf5ab0d..370803722e4773f9f69a09e8b2fa8d7ab8d3d3f0 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/delay.h>
 #include <linux/initrd.h>
 #include <linux/platform_device.h>
-#include <linux/ide.h>
 #include <linux/seq_file.h>
 #include <linux/ioport.h>
 #include <linux/console.h>
@@ -304,26 +303,8 @@ struct seq_operations cpuinfo_op = {
 void __init check_for_initrd(void)
 {
 #ifdef CONFIG_BLK_DEV_INITRD
-       const unsigned int *prop;
-       int len;
-
-       DBG(" -> check_for_initrd()\n");
-
-       if (of_chosen) {
-               prop = get_property(of_chosen, "linux,initrd-start", &len);
-               if (prop != NULL) {
-                       initrd_start = (unsigned long)
-                               __va(of_read_ulong(prop, len / 4));
-                       prop = get_property(of_chosen,
-                                       "linux,initrd-end", &len);
-                       if (prop != NULL) {
-                               initrd_end = (unsigned long)
-                                       __va(of_read_ulong(prop, len / 4));
-                               initrd_below_start_ok = 1;
-                       } else
-                               initrd_start = 0;
-               }
-       }
+       DBG(" -> check_for_initrd()  initrd_start=0x%lx  initrd_end=0x%lx\n",
+           initrd_start, initrd_end);
 
        /* If we were passed an initrd, set the ROOT_DEV properly if the values
         * look sensible. If not, clear initrd reference.
@@ -371,11 +352,12 @@ void __init smp_setup_cpu_maps(void)
                const int *intserv;
                int j, len = sizeof(u32), nthreads = 1;
 
-               intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len);
+               intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s",
+                               &len);
                if (intserv)
                        nthreads = len / sizeof(int);
                else {
-                       intserv = get_property(dn, "reg", NULL);
+                       intserv = of_get_property(dn, "reg", NULL);
                        if (!intserv)
                                intserv = &cpu; /* assume logical == phys */
                }
@@ -398,10 +380,10 @@ void __init smp_setup_cpu_maps(void)
                int num_addr_cell, num_size_cell, maxcpus;
                const unsigned int *ireg;
 
-               num_addr_cell = prom_n_addr_cells(dn);
-               num_size_cell = prom_n_size_cells(dn);
+               num_addr_cell = of_n_addr_cells(dn);
+               num_size_cell = of_n_size_cells(dn);
 
-               ireg = get_property(dn, "ibm,lrdr-capacity", NULL);
+               ireg = of_get_property(dn, "ibm,lrdr-capacity", NULL);
 
                if (!ireg)
                        goto out;
@@ -442,31 +424,6 @@ void __init smp_setup_cpu_maps(void)
 }
 #endif /* CONFIG_SMP */
 
-int __initdata do_early_xmon;
-#ifdef CONFIG_XMON
-extern int xmon_no_auto_backtrace;
-
-static int __init early_xmon(char *p)
-{
-       /* ensure xmon is enabled */
-       if (p) {
-               if (strncmp(p, "on", 2) == 0)
-                       xmon_init(1);
-               if (strncmp(p, "off", 3) == 0)
-                       xmon_init(0);
-               if (strncmp(p, "nobt", 4) == 0)
-                       xmon_no_auto_backtrace = 1;
-               if (strncmp(p, "early", 5) != 0)
-                       return 0;
-       }
-       xmon_init(1);
-       do_early_xmon = 1;
-
-       return 0;
-}
-early_param("xmon", early_xmon);
-#endif
-
 static __init int add_pcspkr(void)
 {
        struct device_node *np;
@@ -521,11 +478,39 @@ void probe_machine(void)
        printk(KERN_INFO "Using %s machine description\n", ppc_md.name);
 }
 
+/* Match a class of boards, not a specific device configuration. */
 int check_legacy_ioport(unsigned long base_port)
 {
-       if (ppc_md.check_legacy_ioport == NULL)
-               return 0;
-       return ppc_md.check_legacy_ioport(base_port);
+       struct device_node *parent, *np = NULL;
+       int ret = -ENODEV;
+
+       switch(base_port) {
+       case I8042_DATA_REG:
+               np = of_find_node_by_type(NULL, "8042");
+               break;
+       case FDC_BASE: /* FDC1 */
+               np = of_find_node_by_type(NULL, "fdc");
+               break;
+#ifdef CONFIG_PPC_PREP
+       case _PIDXR:
+       case _PNPWRP:
+       case PNPBIOS_BASE:
+               /* implement me */
+#endif
+       default:
+               /* ipmi is supposed to fail here */
+               break;
+       }
+       if (!np)
+               return ret;
+       parent = of_get_parent(np);
+       if (parent) {
+               if (strcmp(parent->type, "isa") == 0)
+                       ret = 0;
+               of_node_put(parent);
+       }
+       of_node_put(np);
+       return ret;
 }
 EXPORT_SYMBOL(check_legacy_ioport);