/*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* Please see the License for the specific language governing rights and
* limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
#include <machine/machparam.h> /* spl definitions */
#include <types.h>
#include <console/video_console.h>
+#include <console/serial_protos.h>
#include <kern/kalloc.h>
#include <kern/thread.h>
#include <ppc/misc_protos.h>
*/
const int console_unit = 0;
-const int console_chan_default = CONSOLE_PORT;
+const uint32_t console_chan_default = CONSOLE_PORT;
#define console_chan (console_chan_default) /* ^ cpu_number()) */
-#define OPS(putc, getc, nosplputc, nosplgetc) putc, getc
-
-const struct console_ops {
- int (*putc)(int, int, int);
- int (*getc)(int, int, boolean_t, boolean_t);
-} cons_ops[] = {
-#define SCC_CONS_OPS 0
- {OPS(scc_putc, scc_getc, no_spl_scputc, no_spl_scgetc)},
-#define VC_CONS_OPS 1
- {OPS(vcputc, vcgetc, no_spl_vcputc, no_spl_vcgetc)},
-};
-#define NCONSOPS (sizeof cons_ops / sizeof cons_ops[0])
-
-#if SERIAL_CONSOLE_DEFAULT
-#define CONS_OPS SCC_CONS_OPS
-#define CONS_NAME "com"
-#else
-#define CONS_OPS VC_CONS_OPS
-#define CONS_NAME "vc"
-#endif
#define MP_SAFE_CONSOLE 1 /* Set this to 1 to allow more than 1 processor to print at once */
#if MP_SAFE_CONSOLE
#endif
+#define OPS(putc, getc, nosplputc, nosplgetc) putc, getc
+
+console_ops_t cons_ops[] = {
+ {OPS(scc_putc, scc_getc, no_spl_scputc, no_spl_scgetc)},
+ {OPS(vcputc, vcgetc, no_spl_vcputc, no_spl_vcgetc)},
+};
+
+uint32_t nconsops = (sizeof cons_ops / sizeof cons_ops[0]);
+
+uint32_t cons_ops_index = VC_CONS_OPS;
-unsigned int cons_ops_index = CONS_OPS;
unsigned int killprint = 0;
unsigned int debcnputc = 0;
extern unsigned int mappingdeb0;
FALSE, FALSE);
}
-boolean_t console_is_serial()
-{
- return cons_ops_index == SCC_CONS_OPS;
-}
-
-int
-switch_to_video_console()
-{
- int old_cons_ops = cons_ops_index;
- cons_ops_index = VC_CONS_OPS;
- return old_cons_ops;
-}
-
-int
-switch_to_serial_console()
-{
- int old_cons_ops = cons_ops_index;
- cons_ops_index = SCC_CONS_OPS;
- return old_cons_ops;
-}
-
-/* The switch_to_{video,serial,kgdb}_console functions return a cookie that
- can be used to restore the console to whatever it was before, in the
- same way that splwhatever() and splx() work. */
-void
-switch_to_old_console(int old_console)
-{
- static boolean_t squawked;
- unsigned int ops = old_console;
-
- if (ops >= NCONSOPS && !squawked) {
- squawked = TRUE;
- printf("switch_to_old_console: unknown ops %d\n", ops);
- } else
- cons_ops_index = ops;
-}
-
int
vcgetc(__unused int l,