diff options
-rw-r--r-- | sys/dev/pci/pcireg.h | 4 | ||||
-rw-r--r-- | usr.sbin/vmd/pci.c | 22 |
2 files changed, 21 insertions, 5 deletions
diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h index 71fe94c9cf4..feaa9bc6f47 100644 --- a/sys/dev/pci/pcireg.h +++ b/sys/dev/pci/pcireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcireg.h,v 1.54 2017/06/12 03:00:26 kevlo Exp $ */ +/* $OpenBSD: pcireg.h,v 1.55 2017/08/09 21:42:44 mlarkin Exp $ */ /* $NetBSD: pcireg.h,v 1.26 2000/05/10 16:58:42 thorpej Exp $ */ /* @@ -338,6 +338,7 @@ typedef u_int8_t pci_revision_t; #define PCI_CARDBUSCIS 0x28 #define PCI_SUBVEND_0 0x2c #define PCI_SUBDEV_0 0x2e +#define PCI_EXROMADDR_0 0x30 #define PCI_INTLINE 0x3c #define PCI_INTPIN 0x3d #define PCI_MINGNT 0x3e @@ -369,6 +370,7 @@ typedef u_int8_t pci_revision_t; #define PCI_SUBVEND_1 0x34 #define PCI_SUBDEV_1 0x36 +#define PCI_EXROMADDR_1 0x38 /* config registers for header type 2 devices */ diff --git a/usr.sbin/vmd/pci.c b/usr.sbin/vmd/pci.c index ffcab0df158..bbf69b55c6b 100644 --- a/usr.sbin/vmd/pci.c +++ b/usr.sbin/vmd/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.18 2017/07/06 06:19:15 mlarkin Exp $ */ +/* $OpenBSD: pci.c,v 1.19 2017/08/09 21:42:44 mlarkin Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -345,9 +345,23 @@ pci_handle_data_reg(struct vm_run_params *vrp) vei->vei.vei_data = 0; } - /* XXX - discard writes to reassign IRQs / pins */ - if (o != 0x3c && o != 0x30 && o != 0x38) - get_input_data(vei, &pci.pci_devices[d].pd_cfg_space[o / 4]); + /* + * Discard writes to "option rom base address" as none of our + * emulated devices have PCI option roms. + */ + if (o != PCI_EXROMADDR_0) + get_input_data(vei, + &pci.pci_devices[d].pd_cfg_space[o / 4]); + + if (o == PCI_INTLINE) { + /* Guest reassigned IRQ */ + + pci.pci_devices[d].pd_irq = + pci.pci_devices[d].pd_cfg_space[o / 4]; + + log_debug("%s: reassigned pci irq for device %d " + "to 0x%x", __func__, d, pci.pci_devices[d].pd_irq); + } /* IOBAR registers must have bit 0 set */ if (o == 0x10) |