Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/dev/lib/libpci create /dev/pci device nodes



details:   https://anonhg.NetBSD.org/src/rev/b9d753331609
branches:  trunk
changeset: 328680:b9d753331609
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Apr 13 12:40:00 2014 +0000

description:
create /dev/pci device nodes

diffstat:

 sys/rump/dev/lib/libpci/pci_at_mainbus.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r e267099db605 -r b9d753331609 sys/rump/dev/lib/libpci/pci_at_mainbus.c
--- a/sys/rump/dev/lib/libpci/pci_at_mainbus.c  Sun Apr 13 12:11:01 2014 +0000
+++ b/sys/rump/dev/lib/libpci/pci_at_mainbus.c  Sun Apr 13 12:40:00 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_at_mainbus.c,v 1.1 2014/04/04 12:53:59 pooka Exp $ */
+/*     $NetBSD: pci_at_mainbus.c,v 1.2 2014/04/13 12:40:00 pooka Exp $ */
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_at_mainbus.c,v 1.1 2014/04/04 12:53:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_at_mainbus.c,v 1.2 2014/04/13 12:40:00 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -41,12 +41,27 @@
 #include "ioconf.c"
 
 #include "rump_private.h"
+#include "rump_vfs_private.h"
 
 RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
+       extern const struct cdevsw pci_cdevsw;
+       devmajor_t cmaj, bmaj;
+       int error;
 
        config_init_component(cfdriver_ioconf_pci,
            cfattach_ioconf_pci, cfdata_ioconf_pci);
+
+       bmaj = cmaj = -1;
+       if ((error = devsw_attach("pci", NULL, &bmaj,
+           &pci_cdevsw, &cmaj)) != 0) {
+               printf("pci: devsw_attach failed: %d\n", error);
+               return;
+       }
+
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/pci", '0',
+           cmaj, 0, 4)) != 0)
+               printf("pci: failed to create /dev/pci nodes: %d", error);
 }
 
 RUMP_COMPONENT(RUMP_COMPONENT_DEV_AFTERMAINBUS)



Home | Main Index | Thread Index | Old Index