From f53151522ed73485f6bd5ea08a1ad47797579317 Mon Sep 17 00:00:00 2001 From: cl Date: Sat, 24 Apr 2004 21:45:58 +0000 Subject: [PATCH] Enable keyboard and vga display as console when running as domain-0. --- sys/arch/xen/conf/GENERIC | 16 ++++-------- sys/arch/xen/conf/XEN | 4 +-- sys/arch/xen/x86/consinit.c | 52 +++++++++++++++++++++++++++---------- 3 files changed, 46 insertions(+), 26 deletions(-) diff --git a/sys/arch/xen/conf/GENERIC b/sys/arch/xen/conf/GENERIC index a3f8e5a3eaef..12931d8c2884 100644 --- a/sys/arch/xen/conf/GENERIC +++ b/sys/arch/xen/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.7 2004/04/24 21:33:32 cl Exp $ +# $NetBSD: GENERIC,v 1.8 2004/04/24 21:45:58 cl Exp $ # NetBSD: GENERIC,v 1.596 2004/04/07 13:13:59 augustss Exp # # GENERIC machine description file @@ -23,7 +23,7 @@ include "arch/xen/conf/std.xen" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.7 $" +#ident "GENERIC-$Revision: 1.8 $" maxusers 32 # estimated number of users @@ -45,15 +45,9 @@ options I686_CPU # delay between "rebooting ..." message and hardware reset, in milliseconds #options CPURESET_DELAY=2000 -# force Xen console -options CONSDEVNAME="\"xencons\"" - -# This option allows you to force a serial console at the specified -# I/O address. see console(4) for details. -#options CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600 -# you don't want the option below ON iff you are using the -# serial console option of the new boot strap code. -#options CONS_OVERRIDE # Always use above! independent of boot info +# This option allows you to force the Xen virtual console +#options CONSDEVNAME="\"xencons\"" +#options CONS_OVERRIDE # Always use above! independent of commandline # Standard system options diff --git a/sys/arch/xen/conf/XEN b/sys/arch/xen/conf/XEN index f338be3efb1d..50cf3d110148 100644 --- a/sys/arch/xen/conf/XEN +++ b/sys/arch/xen/conf/XEN @@ -1,4 +1,4 @@ -# $NetBSD: XEN,v 1.7 2004/04/24 21:33:32 cl Exp $ +# $NetBSD: XEN,v 1.8 2004/04/24 21:45:58 cl Exp $ include "arch/xen/conf/std.xen" @@ -22,7 +22,7 @@ options I686_CPU #options MTRR # memory-type range register syscall support -options CONSDEVNAME="\"xencons\"" +#options CONSDEVNAME="\"xencons\"" #options CONS_OVERRIDE options INSECURE # disable kernel security levels - X needs this diff --git a/sys/arch/xen/x86/consinit.c b/sys/arch/xen/x86/consinit.c index cf6cd7bbfe09..1e498b0f9786 100644 --- a/sys/arch/xen/x86/consinit.c +++ b/sys/arch/xen/x86/consinit.c @@ -1,5 +1,5 @@ -/* $NetBSD: consinit.c,v 1.2 2004/04/24 18:24:14 cl Exp $ */ -/* NetBSD: consinit.c,v 1.3 2003/06/14 17:01:15 thorpej Exp */ +/* $NetBSD: consinit.c,v 1.3 2004/04/24 21:45:58 cl Exp $ */ +/* NetBSD: consinit.c,v 1.4 2004/03/13 17:31:34 bjh21 Exp */ /* * Copyright (c) 1998 @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.2 2004/04/24 18:24:14 cl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.3 2004/04/24 21:45:58 cl Exp $"); #include "opt_kgdb.h" @@ -73,7 +73,13 @@ __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.2 2004/04/24 18:24:14 cl Exp $"); #include "opt_xen.h" #if (XEN > 0) +#include "vga_xen.h" +#include "xenkbc.h" #include +#include +#include +#include +#include #endif #include "com.h" @@ -154,6 +160,33 @@ consinit() return; initted = 1; +#if (XEN > 0) +#if (NVGA_XEN > 0) && (NXENKBC > 0) +#ifndef CONS_OVERRIDE + if (xen_start_info.flags & SIF_CONSOLE) { + union xen_cmdline_parseinfo xcp; + + xen_parse_cmdline(XEN_PARSE_CONSOLE, &xcp); + if (strcmp(xcp.xcp_console, "xencons") == 0) { + xenconscn_attach(); + return; + } + } +#endif + if ((xen_start_info.flags & SIF_CONSOLE) && + strcmp(default_consinfo.devname, "xencons") != 0) { + if ((xen_start_info.flags & SIF_PRIVILEGED) == 0) + panic("Console access without privileged status"); + + vga_xen_cnattach(X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM); + xenkbc_cnattach(PCKBPORT_KBD_SLOT); + return; + } +#endif + xenconscn_attach(); + return; +#endif + #ifndef CONS_OVERRIDE consinfo = lookup_bootinfo(BTINFO_CONSOLE); if (!consinfo) @@ -200,13 +233,6 @@ dokbd: return; } -#endif -#if (XEN > 0) - if (!strcmp(consinfo->devname, "xencons")) { - xenconscn_attach(); - printf("NetBSD Xen console attached.\n"); - return; - } #endif panic("invalid console device %s", consinfo->devname); } @@ -217,9 +243,9 @@ dokbd: * mi keyboard controller driver */ int -pckbc_machdep_cnattach(kbctag, kbcslot) - pckbc_tag_t kbctag; - pckbc_slot_t kbcslot; +pckbport_machdep_cnattach(kbctag, kbcslot) + pckbport_tag_t kbctag; + pckbport_slot_t kbcslot; { #if (NPC > 0) && (NPCCONSKBD > 0) return (pcconskbd_cnattach(kbctag, kbcslot));