Module Name: src
Committed By: jmcneill
Date: Sat Nov 25 16:31:03 UTC 2017
Modified Files:
src/distrib/sets/lists/comp: mi
src/etc: MAKEDEV.tmpl
src/sys/conf: files majors
src/sys/dev/acpi: files.acpi
src/sys/dev/ic: Makefile
Added Files:
src/sys/dev/acpi: qemufwcfg_acpi.c
src/sys/dev/ic: qemufwcfg.c qemufwcfgio.h qemufwcfgvar.h
Log Message:
Add driver for QEMU Firmware Configuration device.
This interface allows the host to pass various data items and files to
the guest OS.
To generate a diff of this commit:
cvs rdiff -u -r1.2159 -r1.2160 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.186 -r1.187 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.1184 -r1.1185 src/sys/conf/files
cvs rdiff -u -r1.76 -r1.77 src/sys/conf/majors
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/acpi/files.acpi
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/qemufwcfg_acpi.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/qemufwcfg.c \
src/sys/dev/ic/qemufwcfgio.h src/sys/dev/ic/qemufwcfgvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2159 src/distrib/sets/lists/comp/mi:1.2160
--- src/distrib/sets/lists/comp/mi:1.2159 Tue Nov 7 22:20:05 2017
+++ src/distrib/sets/lists/comp/mi Sat Nov 25 16:31:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.2159 2017/11/07 22:20:05 christos Exp $
+# $NetBSD: mi,v 1.2160 2017/11/25 16:31:03 jmcneill Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
./etc/mtree/set.comp comp-sys-root
@@ -514,6 +514,7 @@
./usr/include/dev/ic/pckbcvar.h comp-obsolete obsolete
./usr/include/dev/ic/pdqreg.h comp-obsolete obsolete
./usr/include/dev/ic/pdqvar.h comp-obsolete obsolete
+./usr/include/dev/ic/qemufwcfgio.h comp-c-include
./usr/include/dev/ic/rrunnerreg.h comp-c-include
./usr/include/dev/ic/rrunnervar.h comp-c-include
./usr/include/dev/ic/smc83c170reg.h comp-obsolete obsolete
Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.186 src/etc/MAKEDEV.tmpl:1.187
--- src/etc/MAKEDEV.tmpl:1.186 Mon Aug 28 01:34:52 2017
+++ src/etc/MAKEDEV.tmpl Sat Nov 25 16:31:03 2017
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $NetBSD: MAKEDEV.tmpl,v 1.186 2017/08/28 01:34:52 sevan Exp $
+# $NetBSD: MAKEDEV.tmpl,v 1.187 2017/11/25 16:31:03 jmcneill Exp $
#
# Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -875,6 +875,11 @@ pad)
lndev pad0 pad
;;
+qemufwcfg)
+ makedev qemufwcfg0
+ lndev qemufwcfg0 qemufwcfg
+ ;;
+
radio)
makedev radio0 radio1
lndev radio0 radio
@@ -1761,6 +1766,11 @@ pad[0-9]*)
mkdev pad$unit c %pad_chr% $unit 444
;;
+qemufwcfg[0-9]*)
+ unit=${i#qemufwcfg}
+ mkdev qemufwcfg$unit c %qemufwcfg_chr% $unit 660
+ ;;
+
nvram)
mkdev nvram c %nvram_chr% 0 644
;;
Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1184 src/sys/conf/files:1.1185
--- src/sys/conf/files:1.1184 Sat Nov 18 18:44:55 2017
+++ src/sys/conf/files Sat Nov 25 16:31:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1184 2017/11/18 18:44:55 christos Exp $
+# $NetBSD: files,v 1.1185 2017/11/25 16:31:03 jmcneill Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@@ -1419,6 +1419,10 @@ file dev/ic/ld_nvme.c ld_nvme
device bwfm: arp, ifnet, wlan
file dev/ic/bwfm.c bwfm
+# QEMU Firmware Configuration (fw_cfg) device
+device qemufwcfg
+file dev/ic/qemufwcfg.c qemufwcfg
+
# legitimate pseudo-devices
#
defpseudodev vnd: disk
Index: src/sys/conf/majors
diff -u src/sys/conf/majors:1.76 src/sys/conf/majors:1.77
--- src/sys/conf/majors:1.76 Thu Dec 8 11:31:08 2016
+++ src/sys/conf/majors Sat Nov 25 16:31:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: majors,v 1.76 2016/12/08 11:31:08 nat Exp $
+# $NetBSD: majors,v 1.77 2017/11/25 16:31:03 jmcneill Exp $
#
# Device majors for Machine-Independent drivers.
#
@@ -75,3 +75,4 @@ device-major spkr char 240 spkr
device-major hdmicec char 340 hdmicec
device-major nvme char 341 nvme
+device-major qemufwcfg char 342 qemufwcfg
Index: src/sys/dev/acpi/files.acpi
diff -u src/sys/dev/acpi/files.acpi:1.98 src/sys/dev/acpi/files.acpi:1.99
--- src/sys/dev/acpi/files.acpi:1.98 Tue Jun 21 11:35:47 2016
+++ src/sys/dev/acpi/files.acpi Sat Nov 25 16:31:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.acpi,v 1.98 2016/06/21 11:35:47 nonaka Exp $
+# $NetBSD: files.acpi,v 1.99 2017/11/25 16:31:03 jmcneill Exp $
include "dev/acpi/acpica/files.acpica"
@@ -221,4 +221,8 @@ file dev/acpi/apple_smc_acpi.c apple_smc
attach sdhc at acpinodebus with sdhc_acpi
file dev/acpi/sdhc_acpi.c sdhc_acpi
+# QEMU Firmware Configuration (fw_cfg) device
+attach qemufwcfg at acpinodebus with qemufwcfg_acpi
+file dev/acpi/qemufwcfg_acpi.c qemufwcfg_acpi
+
include "dev/acpi/wmi/files.wmi"
Index: src/sys/dev/ic/Makefile
diff -u src/sys/dev/ic/Makefile:1.25 src/sys/dev/ic/Makefile:1.26
--- src/sys/dev/ic/Makefile:1.25 Sat Jun 4 16:11:51 2016
+++ src/sys/dev/ic/Makefile Sat Nov 25 16:31:03 2017
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.25 2016/06/04 16:11:51 nonaka Exp $
+# $NetBSD: Makefile,v 1.26 2017/11/25 16:31:03 jmcneill Exp $
INCSDIR= /usr/include/dev/ic
# Only install includes which are used by userland
INCS= athioctl.h bt8xx.h hd44780var.h icpreg.h icp_ioctl.h isp_ioctl.h \
- mlxreg.h mlxio.h nvmeio.h nvmereg.h rrunnerreg.h rrunnervar.h \
- wdcreg.h wi_ieee.h
+ mlxreg.h mlxio.h nvmeio.h nvmereg.h qemufwcfgio.h rrunnerreg.h \
+ rrunnervar.h wdcreg.h wi_ieee.h
.include <bsd.kinc.mk>
Added files:
Index: src/sys/dev/acpi/qemufwcfg_acpi.c
diff -u /dev/null src/sys/dev/acpi/qemufwcfg_acpi.c:1.1
--- /dev/null Sat Nov 25 16:31:04 2017
+++ src/sys/dev/acpi/qemufwcfg_acpi.c Sat Nov 25 16:31:03 2017
@@ -0,0 +1,113 @@
+/* $NetBSD: qemufwcfg_acpi.c,v 1.1 2017/11/25 16:31:03 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: qemufwcfg_acpi.c,v 1.1 2017/11/25 16:31:03 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <sys/mutex.h>
+#include <sys/bus.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+
+#include <dev/ic/qemufwcfgvar.h>
+
+#define _COMPONENT ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME ("qemufwcfg_acpi")
+
+static int fwcfg_acpi_match(device_t, cfdata_t, void *);
+static void fwcfg_acpi_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(qemufwcfg_acpi, sizeof(struct fwcfg_softc),
+ fwcfg_acpi_match,
+ fwcfg_acpi_attach,
+ NULL,
+ NULL
+);
+
+static const char * const fwcfg_acpi_ids[] = {
+ "QEMU0002",
+ NULL
+};
+
+static int
+fwcfg_acpi_match(device_t parent, cfdata_t match, void *opaque)
+{
+ struct acpi_attach_args *aa = opaque;
+
+ if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
+ return 0;
+
+ return acpi_match_hid(aa->aa_node->ad_devinfo, fwcfg_acpi_ids);
+}
+
+static void
+fwcfg_acpi_attach(device_t parent, device_t self, void *opaque)
+{
+ struct fwcfg_softc *sc = device_private(self);
+ struct acpi_attach_args *aa = opaque;
+ struct acpi_resources res;
+ struct acpi_mem *mem;
+ struct acpi_io *io;
+ bus_addr_t base;
+ bus_size_t size;
+ ACPI_STATUS rv;
+
+ rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
+ &res, &acpi_resource_parse_ops_default);
+ if (ACPI_FAILURE(rv))
+ return;
+
+ sc->sc_dev = self;
+
+ if ((io = acpi_res_io(&res, 0)) != NULL) {
+ sc->sc_bst = aa->aa_iot;
+ base = io->ar_base;
+ size = io->ar_length;
+ } else if ((mem = acpi_res_mem(&res, 0)) != NULL) {
+ sc->sc_bst = aa->aa_memt;
+ base = mem->ar_base;
+ size = mem->ar_length;
+ } else {
+ aprint_error_dev(self, "couldn't acquire resources\n");
+ return;
+ }
+ acpi_resource_cleanup(&res);
+
+ if (bus_space_map(sc->sc_bst, base, size, 0, &sc->sc_bsh) != 0) {
+ aprint_error_dev(self, "couldn't map registers\n");
+ return;
+ }
+
+ fwcfg_attach(sc);
+
+ pmf_device_register(self, NULL, NULL);
+}
Index: src/sys/dev/ic/qemufwcfg.c
diff -u /dev/null src/sys/dev/ic/qemufwcfg.c:1.1
--- /dev/null Sat Nov 25 16:31:04 2017
+++ src/sys/dev/ic/qemufwcfg.c Sat Nov 25 16:31:03 2017
@@ -0,0 +1,179 @@
+/* $NetBSD: qemufwcfg.c,v 1.1 2017/11/25 16:31:03 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.1 2017/11/25 16:31:03 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/mutex.h>
+#include <sys/bus.h>
+
+#include <dev/ic/qemufwcfgvar.h>
+#include <dev/ic/qemufwcfgio.h>
+
+#include "ioconf.h"
+
+/* Register locations are MD */
+#if defined(__i386__) || defined(__x86_64__)
+#define FWCFG_SEL_REG 0x00
+#define FWCFG_SEL_SWAP htole16
+#define FWCFG_DATA_REG 0x01
+#define FWCFG_DMA_ADDR 0x04
+#elif defined(__arm__) || defined(__aarch64__)
+#define FWCFG_SEL_REG 0x08
+#define FWCFG_SEL_SWAP htobe16
+#define FWCFG_DATA_REG 0x00
+#define FWCFG_DMA_ADDR 0x10
+#else
+#error driver does not support this architecture
+#endif
+
+static dev_type_open(fwcfg_open);
+static dev_type_close(fwcfg_close);
+static dev_type_read(fwcfg_read);
+static dev_type_ioctl(fwcfg_ioctl);
+
+#define FWCFGUNIT(d) minor(d)
+
+static void
+fwcfg_select(struct fwcfg_softc *sc, uint16_t index)
+{
+ bus_space_write_2(sc->sc_bst, sc->sc_bsh, FWCFG_SEL_REG, FWCFG_SEL_SWAP(index));
+}
+
+static int
+fwcfg_open(dev_t dev, int flag, int mode, lwp_t *l)
+{
+ struct fwcfg_softc * const sc = device_lookup_private(&qemufwcfg_cd, FWCFGUNIT(dev));
+ int error;
+
+ if (sc == NULL)
+ return ENXIO;
+
+ mutex_enter(&sc->sc_lock);
+ if (!sc->sc_open) {
+ error = 0;
+ sc->sc_open = true;
+ } else
+ error = EBUSY;
+ mutex_exit(&sc->sc_lock);
+
+ return error;
+}
+
+static int
+fwcfg_close(dev_t dev, int flag, int mode, lwp_t *l)
+{
+ struct fwcfg_softc * const sc = device_lookup_private(&qemufwcfg_cd, FWCFGUNIT(dev));
+ int error;
+
+ if (sc == NULL)
+ return ENXIO;
+
+ mutex_enter(&sc->sc_lock);
+ if (sc->sc_open) {
+ error = 0;
+ sc->sc_open = false;
+ } else
+ error = EINVAL;
+ mutex_exit(&sc->sc_lock);
+
+ return error;
+}
+
+static int
+fwcfg_read(dev_t dev, struct uio *uio, int flags)
+{
+ struct fwcfg_softc * const sc = device_lookup_private(&qemufwcfg_cd, FWCFGUNIT(dev));
+ uint8_t buf[64];
+ size_t count;
+ int error = 0;
+
+ if (sc == NULL)
+ return ENXIO;
+
+ while (uio->uio_resid > 0) {
+ count = min(sizeof(buf), uio->uio_resid);
+ bus_space_read_multi_1(sc->sc_bst, sc->sc_bsh, FWCFG_DATA_REG, buf, count);
+ error = uiomove(buf, count, uio);
+ if (error != 0)
+ break;
+ }
+
+ return error;
+}
+
+static int
+fwcfg_ioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
+{
+ struct fwcfg_softc * const sc = device_lookup_private(&qemufwcfg_cd, FWCFGUNIT(dev));
+ uint16_t index;
+
+ if (sc == NULL)
+ return ENXIO;
+
+ switch (cmd) {
+ case FWCFGIO_SET_INDEX:
+ index = *(uint16_t *)data;
+ fwcfg_select(sc, index);
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+
+const struct cdevsw qemufwcfg_cdevsw = {
+ .d_open = fwcfg_open,
+ .d_close = fwcfg_close,
+ .d_read = fwcfg_read,
+ .d_write = nowrite,
+ .d_ioctl = fwcfg_ioctl,
+ .d_stop = nostop,
+ .d_tty = notty,
+ .d_poll = nopoll,
+ .d_mmap = nommap,
+ .d_kqfilter = nokqfilter,
+ .d_discard = nodiscard,
+ .d_flag = D_OTHER | D_MPSAFE
+};
+
+void
+fwcfg_attach(struct fwcfg_softc *sc)
+{
+ char sig[4];
+
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+
+ /* Read signature */
+ fwcfg_select(sc, FW_CFG_SIGNATURE);
+ bus_space_read_multi_1(sc->sc_bst, sc->sc_bsh, FWCFG_DATA_REG, sig, sizeof(sig));
+ aprint_verbose_dev(sc->sc_dev, "<%c%c%c%c>\n", sig[0], sig[1], sig[2], sig[3]);
+}
Index: src/sys/dev/ic/qemufwcfgio.h
diff -u /dev/null src/sys/dev/ic/qemufwcfgio.h:1.1
--- /dev/null Sat Nov 25 16:31:04 2017
+++ src/sys/dev/ic/qemufwcfgio.h Sat Nov 25 16:31:03 2017
@@ -0,0 +1,42 @@
+/* $NetBSD: qemufwcfgio.h,v 1.1 2017/11/25 16:31:03 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _QEMUFWCFGIO_H
+#define _QEMUFWCFGIO_H
+
+#include <sys/ioccom.h>
+
+/* Fixed selector keys */
+#define FW_CFG_SIGNATURE 0x0000 /* Signature */
+#define FW_CFG_ID 0x0001 /* Revision / feature bitmap */
+#define FW_CFG_FILE_DIR 0x0019 /* File directory */
+#define FW_CFG_FILE_FIRST 0x0020 /* First file in directory */
+
+#define FWCFGIO_SET_INDEX _IOW('q', 0, uint16_t)
+
+#endif /* !_QEMUFWCFGIO_H */
Index: src/sys/dev/ic/qemufwcfgvar.h
diff -u /dev/null src/sys/dev/ic/qemufwcfgvar.h:1.1
--- /dev/null Sat Nov 25 16:31:04 2017
+++ src/sys/dev/ic/qemufwcfgvar.h Sat Nov 25 16:31:03 2017
@@ -0,0 +1,43 @@
+/* $NetBSD: qemufwcfgvar.h,v 1.1 2017/11/25 16:31:03 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _QEMUFWCFGVAR_H
+#define _QEMUFWCFGVAR_H
+
+struct fwcfg_softc {
+ device_t sc_dev;
+ bus_space_tag_t sc_bst;
+ bus_space_handle_t sc_bsh;
+
+ kmutex_t sc_lock;
+ bool sc_open;
+};
+
+void fwcfg_attach(struct fwcfg_softc *);
+
+#endif /* !_QEMUFWCFGVAR_H */