fix up virtio module for current structure; add virtio_pci module

This commit is contained in:
jakllsch 2018-06-06 16:11:36 +00:00
parent 9a546da821
commit 09582ef971
5 changed files with 54 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: virtio.c,v 1.31 2018/06/02 22:43:15 jakllsch Exp $ */
/* $NetBSD: virtio.c,v 1.32 2018/06/06 16:11:36 jakllsch Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.31 2018/06/02 22:43:15 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.32 2018/06/06 16:11:36 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -932,7 +932,7 @@ virtio_features(struct virtio_softc *sc)
return sc->sc_features;
}
MODULE(MODULE_CLASS_DRIVER, virtio, "pci");
MODULE(MODULE_CLASS_DRIVER, virtio, NULL);
#ifdef _MODULE
#include "ioconf.c"

View File

@ -1,4 +1,4 @@
/* $NetBSD: virtio_pci.c,v 1.4 2018/06/02 22:43:15 jakllsch Exp $ */
/* $NetBSD: virtio_pci.c,v 1.5 2018/06/06 16:11:36 jakllsch Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@ -26,11 +26,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.4 2018/06/02 22:43:15 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.5 2018/06/06 16:11:36 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kmem.h>
#include <sys/module.h>
#include <sys/device.h>
@ -727,3 +728,34 @@ virtio_pci_msix_config_intr(void *arg)
r = (sc->sc_config_change)(sc);
return r;
}
MODULE(MODULE_CLASS_DRIVER, virtio_pci, "pci,virtio");
#ifdef _MODULE
#include "ioconf.c"
#endif
static int
virtio_pci_modcmd(modcmd_t cmd, void *opaque)
{
int error = 0;
#ifdef _MODULE
switch (cmd) {
case MODULE_CMD_INIT:
error = config_init_component(cfdriver_ioconf_virtio_pci,
cfattach_ioconf_virtio_pci, cfdata_ioconf_virtio_pci);
break;
case MODULE_CMD_FINI:
error = config_fini_component(cfdriver_ioconf_virtio_pci,
cfattach_ioconf_virtio_pci, cfdata_ioconf_virtio_pci);
break;
default:
error = ENOTTY;
break;
}
#endif
return error;
}

View File

@ -1,11 +1,10 @@
# $NetBSD: Makefile,v 1.1 2016/09/27 03:53:09 pgoyette Exp $
# $NetBSD: Makefile,v 1.2 2018/06/06 16:11:36 jakllsch Exp $
.include "../Makefile.inc"
.PATH: ${S}/dev/pci
KMOD= virtio
IOCONF= virtio.ioconf
SRCS+= virtio.c

View File

@ -0,0 +1,14 @@
# $NetBSD: Makefile,v 1.1 2018/06/06 16:11:36 jakllsch Exp $
.include "../Makefile.inc"
.PATH: ${S}/dev/pci
KMOD= virtio_pci
IOCONF= virtio_pci.ioconf
SRCS+= virtio_pci.c
CPPFLAGS+= -DDIAGNOSTIC
.include <bsd.kmodule.mk>

View File

@ -1,6 +1,6 @@
# $NetBSD: virtio.ioconf,v 1.1 2016/09/27 03:53:09 pgoyette Exp $
# $NetBSD: virtio_pci.ioconf,v 1.1 2018/06/06 16:11:36 jakllsch Exp $
ioconf virtio
ioconf virtio_pci
include "conf/files"
include "dev/pci/files.pci"