Make PCI devices usable for non-domain0 kernels. Based on patches sent by
Ceri Storey to port-xen, with some additionnal changes by me: - include bus_dma.c, bus_space.c and pci_machdep.c if pci is defined instead of dom0ops - Make various initialisations, and probe/attach pci busses based on NPCI instead of DOM0OPS - in conf/files.xen, move xen-specific devices before non-xen specific devices so that the xen-specific match function is called first, to avoid false attachement from too liberal match function in non-xen code.
This commit is contained in:
parent
74929b7809
commit
fa7d49200e
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.xen,v 1.26 2005/07/15 07:56:22 yamt Exp $
|
||||
# $NetBSD: files.xen,v 1.27 2005/08/19 16:06:12 bouyer Exp $
|
||||
# NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp
|
||||
# NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp
|
||||
|
||||
|
@ -82,8 +82,8 @@ include "dev/ata/files.ata"
|
|||
# Memory Disk for install floppy
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
|
||||
file arch/x86/x86/bus_dma.c dom0ops
|
||||
file arch/xen/x86/bus_space.c dom0ops
|
||||
file arch/x86/x86/bus_dma.c pci
|
||||
file arch/xen/x86/bus_space.c pci
|
||||
file arch/x86/x86/cacheinfo.c
|
||||
file arch/xen/x86/consinit.c
|
||||
file arch/xen/x86/intr.c
|
||||
|
@ -128,6 +128,22 @@ file arch/xen/xen/xencons.c xencons needs-flag
|
|||
# Xen event peudo-device
|
||||
defpseudo xenevt
|
||||
|
||||
# Xen Network driver
|
||||
device xennet: arp, ether, ifnet
|
||||
attach xennet at hypervisor
|
||||
file arch/xen/xen/if_xennet.c xennet needs-flag
|
||||
|
||||
# Xen Block device driver and wd/sd/cd identities
|
||||
device xbd: disk
|
||||
attach xbd at hypervisor
|
||||
file arch/xen/xen/xbd.c xbd | wd_xen | sd_xen | cd_xen needs-flag
|
||||
|
||||
#attach wd at hypervisor with wd_xen
|
||||
#attach sd at hypervisor with sd_xen
|
||||
#attach cd at hypervisor with cd_xen
|
||||
|
||||
# Non-Xen specific devices and options
|
||||
|
||||
include "dev/wscons/files.wscons"
|
||||
include "dev/wsfont/files.wsfont"
|
||||
|
||||
|
@ -243,29 +259,13 @@ file arch/i386/i386/rbus_machdep.c cardbus
|
|||
#
|
||||
include "dev/pcmcia/files.pcmcia"
|
||||
|
||||
# Xen devices
|
||||
|
||||
# Network driver
|
||||
device xennet: arp, ether, ifnet
|
||||
attach xennet at hypervisor
|
||||
file arch/xen/xen/if_xennet.c xennet needs-flag
|
||||
|
||||
# Block device driver and wd/sd/cd identities
|
||||
device xbd: disk
|
||||
attach xbd at hypervisor
|
||||
file arch/xen/xen/xbd.c xbd | wd_xen | sd_xen | cd_xen needs-flag
|
||||
|
||||
#attach wd at hypervisor with wd_xen
|
||||
#attach sd at hypervisor with sd_xen
|
||||
#attach cd at hypervisor with cd_xen
|
||||
|
||||
# Domain-0 operations
|
||||
defflag opt_xen.h DOM0OPS
|
||||
file arch/xen/xen/privcmd.c dom0ops
|
||||
file arch/xen/i386/xen_shm_machdep.c dom0ops
|
||||
file arch/xen/xen/xbdback.c dom0ops
|
||||
file arch/xen/xen/xennetback.c dom0ops
|
||||
file arch/xen/xen/pci_machdep.c hypervisor & dom0ops
|
||||
file arch/xen/xen/pci_machdep.c hypervisor & pci
|
||||
file arch/xen/xen/isa_machdep.c hypervisor & dom0ops
|
||||
file arch/xen/xen/xenevt.c xenevt & dom0ops
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.17 2005/06/15 22:08:08 bouyer Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.18 2005/08/19 16:06:12 bouyer Exp $ */
|
||||
/* NetBSD: machdep.c,v 1.559 2004/07/22 15:12:46 mycroft Exp */
|
||||
|
||||
/*-
|
||||
|
@ -73,7 +73,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2005/06/15 22:08:08 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.18 2005/08/19 16:06:12 bouyer Exp $");
|
||||
|
||||
#include "opt_beep.h"
|
||||
#include "opt_compat_ibcs2.h"
|
||||
|
@ -91,6 +91,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2005/06/15 22:08:08 bouyer Exp $");
|
|||
#include "opt_user_ldt.h"
|
||||
#include "opt_vm86.h"
|
||||
#include "opt_xen.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1486,9 +1488,9 @@ init386(paddr_t first_avail)
|
|||
XENPRINTK(("ptdpaddr %p atdevbase %p\n", (void *)PDPpaddr,
|
||||
(void *)atdevbase));
|
||||
|
||||
#if defined(XEN) && defined(DOM0OPS)
|
||||
#if defined(XEN) && (NISA > 0 || NPCI > 0)
|
||||
x86_bus_space_init();
|
||||
#endif /* defined(XEN) && defined(DOM0OPS) */
|
||||
#endif
|
||||
consinit(); /* XXX SHOULD NOT BE DONE HERE */
|
||||
xen_parse_cmdline(XEN_PARSE_BOOTFLAGS, NULL);
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: evtchn.c,v 1.15 2005/07/15 09:16:23 yamt Exp $ */
|
||||
/* $NetBSD: evtchn.c,v 1.16 2005/08/19 16:06:12 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.15 2005/07/15 09:16:23 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.16 2005/08/19 16:06:12 bouyer Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -54,6 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.15 2005/07/15 09:16:23 yamt Exp $");
|
|||
#include <machine/xenfunc.h>
|
||||
|
||||
#include "opt_xen.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
|
||||
/*
|
||||
* This lock protects updates to the following mapping and reference-count
|
||||
|
@ -71,7 +73,7 @@ static u_int8_t evtch_bindcount[NR_EVENT_CHANNELS];
|
|||
static int virq_to_evtch[NR_VIRQS];
|
||||
|
||||
|
||||
#ifdef DOM0OPS
|
||||
#if NPCI > 0 || NISA > 0
|
||||
/* event-channel <-> PIRQ mapping */
|
||||
static int pirq_to_evtch[NR_PIRQS];
|
||||
/* PIRQ needing notify */
|
||||
|
@ -97,7 +99,7 @@ events_default_setup()
|
|||
for (i = 0; i < NR_VIRQS; i++)
|
||||
virq_to_evtch[i] = -1;
|
||||
|
||||
#ifdef DOM0OPS
|
||||
#if NPCI > 0 || NISA > 0
|
||||
/* No PIRQ -> event mappings. */
|
||||
for (i = 0; i < NR_PIRQS; i++)
|
||||
pirq_to_evtch[i] = -1;
|
||||
|
@ -289,7 +291,7 @@ unbind_virq_from_evtch(int virq)
|
|||
splx(s);
|
||||
}
|
||||
|
||||
#ifdef DOM0OPS
|
||||
#if NPCI > 0 || NISA > 0
|
||||
int
|
||||
bind_pirq_to_evtch(int pirq)
|
||||
{
|
||||
|
@ -402,7 +404,7 @@ pirq_interrupt(void *arg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif /* DOM0OPS */
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
|
||||
int
|
||||
event_set_handler(int evtch, int (*func)(void *), void *arg, int level,
|
||||
|
@ -548,7 +550,7 @@ hypervisor_enable_event(unsigned int evtch)
|
|||
#endif
|
||||
|
||||
hypervisor_unmask_event(evtch);
|
||||
#ifdef DOM0OPS
|
||||
#if NPCI > 0 || NISA > 0
|
||||
if (pirq_needs_unmask_notify[evtch >> 5] & (1 << (evtch & 0x1f))) {
|
||||
#ifdef IRQ_DEBUG
|
||||
if (evtch == IRQ_DEBUG)
|
||||
|
@ -556,7 +558,7 @@ hypervisor_enable_event(unsigned int evtch)
|
|||
#endif
|
||||
(void)HYPERVISOR_physdev_op(&physdev_op_notify);
|
||||
}
|
||||
#endif /* DOM0OPS */
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hypervisor.c,v 1.14 2005/04/18 21:33:21 bouyer Exp $ */
|
||||
/* $NetBSD: hypervisor.c,v 1.15 2005/08/19 16:06:12 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Manuel Bouyer.
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.14 2005/04/18 21:33:21 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.15 2005/08/19 16:06:12 bouyer Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -93,9 +93,11 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.14 2005/04/18 21:33:21 bouyer Exp $
|
|||
#include <miscfs/specfs/specdev.h>
|
||||
#include <miscfs/kernfs/kernfs.h>
|
||||
#include <machine/kernfs_machdep.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/isa/isavar.h>
|
||||
#endif
|
||||
#if NPCI > 0
|
||||
#include <dev/pci/pcivar.h>
|
||||
#endif
|
||||
|
||||
#if NXENNET > 0
|
||||
#include <net/if.h>
|
||||
|
@ -182,9 +184,13 @@ hypervisor_attach(parent, self, aux)
|
|||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
#ifdef DOM0OPS
|
||||
#if NPCI > 0
|
||||
struct pcibus_attach_args pba;
|
||||
#if defined(DOM0OPS) && NISA > 0
|
||||
struct isabus_attach_args iba;
|
||||
#endif
|
||||
physdev_op_t physdev_op;
|
||||
int i, j, busnum;
|
||||
#endif
|
||||
union hypervisor_attach_cookie hac;
|
||||
|
||||
|
@ -208,15 +214,12 @@ hypervisor_attach(parent, self, aux)
|
|||
hac.hac_xennpx.xa_device = "npx";
|
||||
config_found(self, &hac.hac_xennpx, hypervisor_print);
|
||||
#endif
|
||||
#ifdef DOM0OPS
|
||||
if (xen_start_info.flags & SIF_PRIVILEGED) {
|
||||
physdev_op_t physdev_op;
|
||||
int i, j, busnum;
|
||||
#if NPCI > 0
|
||||
|
||||
physdev_op.cmd = PHYSDEVOP_PCI_PROBE_ROOT_BUSES;
|
||||
if (HYPERVISOR_physdev_op(&physdev_op) < 0) {
|
||||
printf("hypervisor: PHYSDEVOP_PCI_PROBE_ROOT_BUSES failed\n");
|
||||
}
|
||||
physdev_op.cmd = PHYSDEVOP_PCI_PROBE_ROOT_BUSES;
|
||||
if ((i = HYPERVISOR_physdev_op(&physdev_op)) < 0) {
|
||||
printf("hypervisor: PHYSDEVOP_PCI_PROBE_ROOT_BUSES failed with status %d\n", i);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
printf("PCI_PROBE_ROOT_BUSES: ");
|
||||
for (i = 0; i < 256/32; i++)
|
||||
|
@ -246,16 +249,22 @@ hypervisor_attach(parent, self, aux)
|
|||
config_found_ia(self, "pcibus", &pba,
|
||||
pcibusprint);
|
||||
}
|
||||
}
|
||||
if (isa_has_been_seen == 0) {
|
||||
iba._iba_busname = "isa";
|
||||
iba.iba_iot = X86_BUS_SPACE_IO;
|
||||
iba.iba_memt = X86_BUS_SPACE_MEM;
|
||||
iba.iba_dmat = &isa_bus_dma_tag;
|
||||
iba.iba_ic = NULL; /* No isa DMA yet */
|
||||
config_found_ia(self, "isabus", &iba, isabusprint);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(DOM0OPS) && NISA > 0
|
||||
if (isa_has_been_seen == 0) {
|
||||
iba._iba_busname = "isa";
|
||||
iba.iba_iot = X86_BUS_SPACE_IO;
|
||||
iba.iba_memt = X86_BUS_SPACE_MEM;
|
||||
iba.iba_dmat = &isa_bus_dma_tag;
|
||||
iba.iba_ic = NULL; /* No isa DMA yet */
|
||||
config_found_ia(self, "isabus", &iba, isabusprint);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DOM0OPS
|
||||
if (xen_start_info.flags & SIF_PRIVILEGED) {
|
||||
xenkernfs_init();
|
||||
xenprivcmd_init();
|
||||
xen_shm_init();
|
||||
|
|
Loading…
Reference in New Issue