X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/e5568f75972dfc723778653c11cb6b4dc825716a..c0fea4742e91338fffdcf79f86a7c1d5e2b97eb1:/pexpert/ppc/pe_kprintf.c diff --git a/pexpert/ppc/pe_kprintf.c b/pexpert/ppc/pe_kprintf.c index 57794ef8e..58154df8a 100644 --- a/pexpert/ppc/pe_kprintf.c +++ b/pexpert/ppc/pe_kprintf.c @@ -28,8 +28,10 @@ #include #include #include +#include #include #include +#include /* 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);