X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8f6c56a50524aa785f7e596d52dddfb331e18961..c331a0bec715536613c8dd5f34a4e115d5b15824:/osfmk/ppc/serial_io.c diff --git a/osfmk/ppc/serial_io.c b/osfmk/ppc/serial_io.c index 425570b12..2f03aa110 100644 --- a/osfmk/ppc/serial_io.c +++ b/osfmk/ppc/serial_io.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -102,39 +102,35 @@ struct scc_tty scc_tty[NSCC_LINE]; #define scc_dev_no(chan) ((chan)^0x01) #define scc_chan(dev_no) ((dev_no)^0x01) -extern unsigned int disableSerialOuput; - int serial_initted = 0; unsigned int scc_parm_done = 0; -extern unsigned int serialmode; - static struct scc_byte { unsigned char reg; unsigned char val; } scc_init_hw[] = { - 9, 0x80, - 4, 0x44, - 3, 0xC0, - 5, 0xE2, - 2, 0x00, - 10, 0x00, - 11, 0x50, - 12, 0x0A, - 13, 0x00, - 3, 0xC1, - 5, 0xEA, - 14, 0x01, - 15, 0x00, - 0, 0x10, - 0, 0x10, + {9, 0x80}, + {4, 0x44}, + {3, 0xC0}, + {5, 0xE2}, + {2, 0x00}, + {10, 0x00}, + {11, 0x50}, + {12, 0x0A}, + {13, 0x00}, + {3, 0xC1}, + {5, 0xEA}, + {14, 0x01}, + {15, 0x00}, + {0, 0x10}, + {0, 0x10}, #if 0 - 1, 0x12, /* int or Rx, Tx int enable */ + {1, 0x12}, /* int or Rx, Tx int enable */ #else - 1, 0x10, /* int or Rx, no Tx int enable */ + {1, 0x10}, /* int or Rx, no Tx int enable */ #endif - 9, 0x0A + {9, 0x0A} }; static int scc_init_hw_count = sizeof(scc_init_hw)/sizeof(scc_init_hw[0]); @@ -260,8 +256,8 @@ int scc_probe(int32_t serial_baud) { scc_softc_t scc; - register int val, i; - register scc_regmap_t regs; + int i; + scc_regmap_t regs; spl_t s; DECL_FUNNEL_VARS @@ -324,12 +320,11 @@ scc_probe(int32_t serial_baud) */ int -scc_getc(int unit, int line, boolean_t wait, boolean_t raw) +scc_getc(__unused int unit, int line, boolean_t wait, __unused boolean_t raw) { - register scc_regmap_t regs; + scc_regmap_t regs; unsigned char c, value; - int rcvalue, from_line; - uint32_t fcrmunge; + int rcvalue; spl_t s = splhigh(); DECL_FUNNEL_VARS @@ -405,23 +400,33 @@ again: return c; } + +/* + * This front-ends scc_getc to make some intel changes easier + */ + +int _serial_getc(int unit, int line, boolean_t wait, boolean_t raw) { + + return(scc_getc(unit, line, wait, raw)); + +} + /* * Put a char on a specific SCC line * use splhigh since we might be doing a printf in high spl'd code */ -int -scc_putc(int unit, int line, int c) +void +scc_putc(__unused int unit, int line, int c) { scc_regmap_t regs; spl_t s; unsigned char value; - uint32_t fcrmunge; DECL_FUNNEL_VARS - if (disableSerialOuput) - return 0; + if (disable_serial_output) + return; s = splhigh(); FUNNEL_ENTER(&SCC_FUNNEL); @@ -450,7 +455,6 @@ scc_putc(int unit, int line, int c) splx(s); FUNNEL_EXIT(&SCC_FUNNEL); - return 0; } @@ -505,7 +509,7 @@ scc_param(struct scc_tty *tp) /* Do a quick check to see if the hardware needs to change */ if ((sr->flags & (TF_ODDP|TF_EVENP)) == (tp->t_flags & (TF_ODDP|TF_EVENP)) - && sr->speed == tp->t_ispeed) { + && sr->speed == (unsigned long)tp->t_ispeed) { assert(FUNNEL_IN_USE(&SCC_FUNNEL)); simple_unlock(&scc_stomp); splx(s); @@ -652,56 +656,4 @@ scc_param(struct scc_tty *tp) return 0; } - -/* - * This routine will start a thread that polls the serial port, listening for - * characters that have been typed. - */ - -void -serial_keyboard_init(void) -{ - kern_return_t result; - thread_t thread; - - if(!(serialmode & 2)) return; /* Leave if we do not want a serial console */ - - kprintf("Serial keyboard started\n"); - result = kernel_thread_start_priority((thread_continue_t)serial_keyboard_start, NULL, MAXPRI_KERNEL, &thread); - if (result != KERN_SUCCESS) - panic("serial_keyboard_init"); - - thread_deallocate(thread); -} - -void -serial_keyboard_start(void) -{ - serial_keyboard_poll(); /* Go see if there are any characters pending now */ - panic("serial_keyboard_start: we can't get back here\n"); -} - -static int ptestxxx = 0; - -void -serial_keyboard_poll(void) -{ - int chr; - uint64_t next; - extern void cons_cinput(char ch); /* The BSD routine that gets characters */ - - - while(1) { /* Do this for a while */ - chr = scc_getc(0, 1, 0, 1); /* Get a character if there is one */ - if(chr < 0) break; /* The serial buffer is empty */ - cons_cinput((char)chr); /* Buffer up the character */ - } - - clock_interval_to_deadline(16, 1000000, &next); /* Get time of pop */ - - assert_wait_deadline((event_t)serial_keyboard_poll, THREAD_UNINT, next); /* Show we are "waiting" */ - thread_block((thread_continue_t)serial_keyboard_poll); /* Wait for it */ - panic("serial_keyboard_poll: Shouldn't never ever get here...\n"); -} - #endif /* NSCC > 0 */