]> git.saurik.com Git - apple/xnu.git/blobdiff - pexpert/ppc/pe_kprintf.c
xnu-792.10.96.tar.gz
[apple/xnu.git] / pexpert / ppc / pe_kprintf.c
index 57794ef8eb162efa1ad8636e80efce3dfa55de83..58154df8a632881b8ccceafa41b9d08c04acc587 100644 (file)
 #include <pexpert/protos.h>
 #include <pexpert/pexpert.h>
 #include <pexpert/ppc/powermac.h>
+#include <pexpert/device_tree.h>
 #include <kern/debug.h>
 #include <kern/simple_lock.h>
+#include <vm/pmap.h>
 
 /* extern references */
 extern void init_display_putc(unsigned char*, int, int);
@@ -52,16 +54,48 @@ struct slock kprintf_lock;
 void PE_init_kprintf(boolean_t vm_initialized)
 {
        unsigned int    boot_arg;
+       int32_t                 cnt, size, serial_baud = -1;
+       DTEntry         options;
+       char            *str, baud[7];
 
        if (PE_state.initialized == FALSE)
                panic("Platform Expert not initialized");
 
-       if (PE_parse_boot_arg("debug", &boot_arg)) 
+       if (PE_parse_boot_arg("debug", &boot_arg))
                if(boot_arg & DB_KPRT) disableSerialOuput = FALSE; 
 
+       if (DTLookupEntry(0, "/options", &options) == kSuccess) {
+         if (DTGetProperty(options, "input-device", &str, &size) == kSuccess) {
+               if ((size > 5) && !strncmp("scca:", str, 5)) {
+                 size -= 5;
+                 str += 5;
+                 if (size <= 6) {
+                       strncpy(baud, str, size);
+                       baud[size] = '\0';
+                       gPESerialBaud = strtol(baud, 0, 0);
+                 }
+               }
+         }
+         if (DTGetProperty(options, "output-device", &str, &size) == kSuccess) {
+               if ((size > 5) && !strncmp("scca:", str, 5)) {
+                 size -= 5;
+                 str += 5;
+                 if (size <= 6) {
+                       strncpy(baud, str, size);
+                       baud[size] = '\0';
+                       gPESerialBaud = strtol(baud, 0, 0);
+                 }
+               }
+         }       
+       }
+
+       /* Check the boot-args for new serial baud. */
+       if (PE_parse_boot_arg("serialbaud", &serial_baud))
+               if (serial_baud != -1) gPESerialBaud = serial_baud; 
+
        if( (scc = PE_find_scc())) {                            /* See if we can find the serial port */
-               scc = io_map_spec(scc, 0x1000);                 /* Map it in */
-               initialize_serial((void *)scc);                 /* Start up the serial driver */
+               scc = io_map_spec(scc, 0x1000, VM_WIMG_IO);     /* Map it in */
+               initialize_serial((void *)scc, gPESerialBaud); /* Start up the serial driver */
                PE_kputc = serial_putc;
 
                simple_lock_init(&kprintf_lock, 0);