Don't attach vga and keyboard if the domain is not privileged.

Also cleanup print command if attachment fails.
This commit is contained in:
cl 2004-04-25 00:24:08 +00:00
parent 8a0aba4304
commit a9154d4a78
3 changed files with 20 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hypervisor.c,v 1.4 2004/04/24 21:33:32 cl Exp $ */
/* $NetBSD: hypervisor.c,v 1.5 2004/04/25 00:24:08 cl Exp $ */
/*
*
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.4 2004/04/24 21:33:32 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.5 2004/04/25 00:24:08 cl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -165,13 +165,13 @@ hypervisor_attach(parent, self, aux)
}
int
hypervisor_print(aux, pnp)
hypervisor_print(aux, parent)
void *aux;
const char *pnp;
const char *parent;
{
union hypervisor_attach_cookie *hac = aux;
if (pnp)
aprint_normal("XXXXXXXXx %s at %s", hac->hac_device, pnp);
if (parent)
aprint_normal("%s at %s", hac->hac_device, parent);
return (UNCONF);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vga_xen.c,v 1.1 2004/04/24 20:58:59 cl Exp $ */
/* $NetBSD: vga_xen.c,v 1.2 2004/04/25 00:24:08 cl Exp $ */
/*
*
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vga_xen.c,v 1.1 2004/04/24 20:58:59 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: vga_xen.c,v 1.2 2004/04/25 00:24:08 cl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -41,6 +41,9 @@ __KERNEL_RCSID(0, "$NetBSD: vga_xen.c,v 1.1 2004/04/24 20:58:59 cl Exp $");
#include <sys/device.h>
#include <sys/malloc.h>
#include <machine/xen.h>
#include <machine/hypervisor.h>
#include <machine/bus.h>
#include <dev/ic/mc6845reg.h>
@ -76,6 +79,9 @@ vga_xen_match(struct device *parent, struct cfdata *match, void *aux)
{
struct xen_vga_attach_args *xa = aux;
if ((xen_start_info.flags & SIF_PRIVILEGED) == 0)
return 0;
if (strcmp(xa->xa_device, "vga_xen"))
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xenkbc.c,v 1.1 2004/04/24 21:33:32 cl Exp $ */
/* $NetBSD: xenkbc.c,v 1.2 2004/04/25 00:24:08 cl Exp $ */
/*
*
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xenkbc.c,v 1.1 2004/04/24 21:33:32 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: xenkbc.c,v 1.2 2004/04/25 00:24:08 cl Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -135,6 +135,9 @@ xenkbc_match(struct device *parent, struct cfdata *cf, void *aux)
{
struct xenkbc_attach_args *xa = aux;
if ((xen_start_info.flags & SIF_PRIVILEGED) == 0)
return 0;
if (strcmp(xa->xa_device, "xenkbc"))
return 0;
@ -154,7 +157,7 @@ xenkbc_attach(struct device *parent, struct device *self, void *aux)
xi = malloc(sizeof(struct xenkbc_internal), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (xi == NULL) {
aprint_error(": no memory");
aprint_error(": no memory\n");
return;
}
xi->xi_slot = PCKBPORT_KBD_SLOT;