El 06/06/15 a les 22:34, Robert Millan ha escrit:
El 31/05/15 a les 13:34, Robert Millan ha escrit:
Okay. I assume you'll want to make code dependencies time-consistent, so here's
my first patch to add
the rumpcomp_pci_init() interface in pci_user.h.
I'll send a followup for pci-userspace, then back to libpci.
Second patch, implementing rumpcomp_pci_init() in pci-userspace module
based on the prototype from main Rump.
And finally, call rumpcomp_pci_init() from libpci to enable I/O support.
--
Robert Millan
diff --git a/sys/rump/dev/lib/libpci/pci_at_mainbus.c b/sys/rump/dev/lib/libpci/pci_at_mainbus.c
index 835e17c..81997f7 100644
--- a/sys/rump/dev/lib/libpci/pci_at_mainbus.c
+++ b/sys/rump/dev/lib/libpci/pci_at_mainbus.c
@@ -43,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_at_mainbus.c,v 1.5 2014/08/22 14:28:58 pooka Exp
#include "rump_private.h"
#include "rump_vfs_private.h"
+#include "pci_user.h"
+
RUMP_COMPONENT(RUMP_COMPONENT_DEV)
{
extern const struct cdevsw pci_cdevsw;
@@ -68,6 +70,7 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV_AFTERMAINBUS)
{
struct pcibus_attach_args pba;
device_t mainbus;
+ int error, caps;
/* XXX: attach args should come from elsewhere */
memset(&pba, 0, sizeof(pba));
@@ -81,7 +84,12 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV_AFTERMAINBUS)
pba.pba_flags = PCI_FLAGS_MEM_OKAY |
PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;;
#ifdef RUMP_PCI_IOSPACE
- pba.pba_flags |= PCI_FLAGS_IO_OKAY;
+ error = rumpcomp_pci_init(0, &caps);
+ if (error != 0) {
+ aprint_error("pci: unable to raise I/O privilege level (error %d)\n", error);
+ } else {
+ pba.pba_flags |= PCI_FLAGS_IO_OKAY;
+ }
#endif
mainbus = device_find_by_driver_unit("mainbus", 0);
diff --git a/sys/rump/dev/lib/libpci/pci_user.h b/sys/rump/dev/lib/libpci/pci_user.h
index 2eca986..cc1bfa5 100644
--- a/sys/rump/dev/lib/libpci/pci_user.h
+++ b/sys/rump/dev/lib/libpci/pci_user.h
@@ -22,3 +22,5 @@ int rumpcomp_pci_dmamem_map(struct rumpcomp_pci_dmaseg *, size_t, size_t,
void **);
unsigned long rumpcomp_pci_virt_to_mach(void *);
+
+int rumpcomp_pci_init(int, int *);