Page MenuHomeFreeBSD

D38332.id116188.diff
No OneTemporary

D38332.id116188.diff

diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c
--- a/usr.sbin/bhyve/qemu_fwcfg.c
+++ b/usr.sbin/bhyve/qemu_fwcfg.c
@@ -33,10 +33,35 @@
#define QEMU_FWCFG_DATA_PORT_FLAGS \
IOPORT_F_INOUT /* QEMU v2.4+ ignores writes */
+#define QEMU_FWCFG_ARCHITECTURE_MASK 0x0001
+#define QEMU_FWCFG_INDEX_MASK 0x3FFF
+
+#define QEMU_FWCFG_SELECT_READ 0
+#define QEMU_FWCFG_SELECT_WRITE 1
+
+#define QEMU_FWCFG_ARCHITECTURE_GENERIC 0
+#define QEMU_FWCFG_ARCHITECTURE_SPECIFIC 1
+
#pragma pack(1)
+union qemu_fwcfg_selector {
+ struct {
+ uint16_t index : 14;
+ uint16_t writeable : 1;
+ /*
+ * 0 = generic | for all architectures
+ * 1 = specific | only for current architecture
+ */
+ uint16_t architecture : 1;
+ };
+ uint16_t bits;
+};
+
struct qemu_fwcfg_softc {
struct acpi_device *acpi_dev;
+
+ uint32_t data_offset;
+ union qemu_fwcfg_selector selector;
};
#pragma pack()
@@ -48,6 +73,20 @@
const int port __unused, const int bytes, uint32_t *const eax,
void *const arg __unused)
{
+ if (bytes != sizeof(uint16_t)) {
+ warnx("%s: invalid size (%d) of IO port access", __func__,
+ bytes);
+ return (-1);
+ }
+
+ if (in) {
+ *eax = htole16(sc.selector.bits);
+ return (0);
+ }
+
+ sc.data_offset = 0;
+ sc.selector.bits = le16toh(*eax);
+
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 8, 8:17 PM (5 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28493327
Default Alt Text
D38332.id116188.diff (1 KB)

Event Timeline