[POWERPC] Add a check for keyboard/mouse device nodes in check_legacy_ioport()
[safe/jmp/linux-2.6] / arch / powerpc / kernel / rtas.c
index 14353b8..2147807 100644 (file)
@@ -182,7 +182,7 @@ void rtas_progress(char *s, unsigned short hex)
        char *os;
        static int display_character, set_indicator;
        static int display_width, display_lines, form_feed;
-       const static int *row_width;
+       static const int *row_width;
        static DEFINE_SPINLOCK(progress_lock);
        static int current_line;
        static int pending_newline = 0;  /* did last write end with unprinted newline? */
@@ -192,18 +192,19 @@ void rtas_progress(char *s, unsigned short hex)
 
        if (display_width == 0) {
                display_width = 0x10;
-               if ((root = find_path_device("/rtas"))) {
-                       if ((p = get_property(root,
+               if ((root = of_find_node_by_path("/rtas"))) {
+                       if ((p = of_get_property(root,
                                        "ibm,display-line-length", NULL)))
                                display_width = *p;
-                       if ((p = get_property(root,
+                       if ((p = of_get_property(root,
                                        "ibm,form-feed", NULL)))
                                form_feed = *p;
-                       if ((p = get_property(root,
+                       if ((p = of_get_property(root,
                                        "ibm,display-number-of-lines", NULL)))
                                display_lines = *p;
-                       row_width = get_property(root,
+                       row_width = of_get_property(root,
                                        "ibm,display-truncation-length", NULL);
+                       of_node_put(root);
                }
                display_character = rtas_token("display-character");
                set_indicator = rtas_token("set-indicator");
@@ -298,11 +299,17 @@ int rtas_token(const char *service)
        const int *tokp;
        if (rtas.dev == NULL)
                return RTAS_UNKNOWN_SERVICE;
-       tokp = get_property(rtas.dev, service, NULL);
+       tokp = of_get_property(rtas.dev, service, NULL);
        return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
 }
 EXPORT_SYMBOL(rtas_token);
 
+int rtas_service_present(const char *service)
+{
+       return rtas_token(service) != RTAS_UNKNOWN_SERVICE;
+}
+EXPORT_SYMBOL(rtas_service_present);
+
 #ifdef CONFIG_RTAS_ERROR_LOGGING
 /*
  * Return the firmware-specified size of the error log buffer
@@ -571,6 +578,27 @@ int rtas_set_indicator(int indicator, int index, int new_value)
 }
 EXPORT_SYMBOL(rtas_set_indicator);
 
+/*
+ * Ignoring RTAS extended delay
+ */
+int rtas_set_indicator_fast(int indicator, int index, int new_value)
+{
+       int rc;
+       int token = rtas_token("set-indicator");
+
+       if (token == RTAS_UNKNOWN_SERVICE)
+               return -ENOENT;
+
+       rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
+
+       WARN_ON(rc == -2 || (rc >= 9900 && rc <= 9905));
+
+       if (rc < 0)
+               return rtas_error_rc(rc);
+
+       return rc;
+}
+
 void rtas_restart(char *cmd)
 {
        if (rtas_flash_term_hook)
@@ -607,6 +635,9 @@ void rtas_os_term(char *str)
 {
        int status;
 
+       if (panic_timeout)
+               return;
+
        if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term"))
                return;
 
@@ -786,31 +817,6 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
        return 0;
 }
 
-/* This version can't take the spinlock, because it never returns */
-
-struct rtas_args rtas_stop_self_args = {
-       /* The token is initialized for real in setup_system() */
-       .token = RTAS_UNKNOWN_SERVICE,
-       .nargs = 0,
-       .nret = 1,
-       .rets = &rtas_stop_self_args.args[0],
-};
-
-void rtas_stop_self(void)
-{
-       struct rtas_args *rtas_args = &rtas_stop_self_args;
-
-       local_irq_disable();
-
-       BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE);
-
-       printk("cpu %u (hwid %u) Ready to die...\n",
-              smp_processor_id(), hard_smp_processor_id());
-       enter_rtas(__pa(rtas_args));
-
-       panic("Alas, I survived.\n");
-}
-
 /*
  * Call early during boot, before mem init or bootmem, to retrieve the RTAS
  * informations from the device-tree and allocate the RMO buffer for userland
@@ -827,12 +833,12 @@ void __init rtas_initialize(void)
        if (rtas.dev) {
                const u32 *basep, *entryp, *sizep;
 
-               basep = get_property(rtas.dev, "linux,rtas-base", NULL);
-               sizep = get_property(rtas.dev, "rtas-size", NULL);
+               basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
+               sizep = of_get_property(rtas.dev, "rtas-size", NULL);
                if (basep != NULL && sizep != NULL) {
                        rtas.base = *basep;
                        rtas.size = *sizep;
-                       entryp = get_property(rtas.dev,
+                       entryp = of_get_property(rtas.dev,
                                        "linux,rtas-entry", NULL);
                        if (entryp == NULL) /* Ugh */
                                rtas.entry = rtas.base;
@@ -855,9 +861,6 @@ void __init rtas_initialize(void)
 #endif
        rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
 
-#ifdef CONFIG_HOTPLUG_CPU
-       rtas_stop_self_args.token = rtas_token("stop-self");
-#endif /* CONFIG_HOTPLUG_CPU */
 #ifdef CONFIG_RTAS_ERROR_LOGGING
        rtas_last_error_token = rtas_token("rtas-last-error");
 #endif
@@ -889,6 +892,11 @@ int __init early_init_dt_scan_rtas(unsigned long node,
        basep = of_get_flat_dt_prop(node, "get-term-char", NULL);
        if (basep)
                rtas_getchar_token = *basep;
+
+       if (rtas_putchar_token != RTAS_UNKNOWN_SERVICE &&
+           rtas_getchar_token != RTAS_UNKNOWN_SERVICE)
+               udbg_init_rtas_console();
+
 #endif
 
        /* break now */