> Date: Sat, 25 Mar 2017 15:40:01 +0100 (CET)
> From: Mark Kettenis <[email protected]>
>
> > Date: Fri, 24 Mar 2017 20:34:37 +0100 (CET)
> > From: Mark Kettenis <[email protected]>
> >
> > So here is my suggested change to solve the problem with seabios
> > overwriting the vmd interrupt line overwrites.
> >
> > I don't really see the point in letting the BIOS or the guest OS have
> > control over the irq aasignment as long as vmd doesn't emulate an
> > APIC. It'd mean adding more code in both seabios and vmd. Code that
> > would become mostly useless as soon as we implement APIC emulation.
> > And vmd should be able to do a better job assigning irqs in a way that
> > minimizes sharing than the seabios code.
> >
> > Diff has not been tested beyond checking that it compiles.
>
> And it didn't even compile. Here's a better diff that also includes
> the needed REVISION bump.
I've now tested this diff, and it works like a charm.
ok?
> Index: sysutils/firmware/vmm/Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
> retrieving revision 1.4
> diff -u -p -r1.4 Makefile
> --- sysutils/firmware/vmm/Makefile 24 Mar 2017 22:37:53 -0000 1.4
> +++ sysutils/firmware/vmm/Makefile 25 Mar 2017 13:28:24 -0000
> @@ -2,7 +2,7 @@
>
> FW_DRIVER= vmm
> FW_VER= 1.10.2
> -REVISION= 1
> +REVISION= 2
> DISTNAME= seabios-${FW_VER}
>
> HOMEPAGE= https://www.seabios.org/
> Index: sysutils/firmware/vmm/patches/patch-src_fw_pciinit_c
> ===================================================================
> RCS file: sysutils/firmware/vmm/patches/patch-src_fw_pciinit_c
> diff -N sysutils/firmware/vmm/patches/patch-src_fw_pciinit_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ sysutils/firmware/vmm/patches/patch-src_fw_pciinit_c 25 Mar 2017
> 13:20:59 -0000
> @@ -0,0 +1,38 @@
> +$OpenBSD$
> +
> +Since we hijacked the OpenBSD PCI vendor ID, this diff should probably
> +not be upstreamed.
> +
> +--- src/fw/pciinit.c.orig Fri Feb 24 15:01:20 2017
> ++++ src/fw/pciinit.c Sat Mar 25 14:19:56 2017
> +@@ -141,6 +141,11 @@ static int mch_pci_slot_get_irq(struct pci_device *pci
> + return pci_irqs[(pin - 1 + pin_addend) & 3];
> + }
> +
> ++static int vmm_pci_slot_get_irq(struct pci_device *pci, int pin)
> ++{
> ++ return pci_config_readb(pci->bdf, PCI_INTERRUPT_LINE);
> ++}
> ++
> + /* PIIX3/PIIX4 PCI to ISA bridge */
> + static void piix_isa_bridge_setup(struct pci_device *pci, void *arg)
> + {
> +@@ -506,11 +511,18 @@ static void mch_mem_addr_setup(struct pci_device *dev,
> + pci_io_low_end = acpi_pm_base;
> + }
> +
> ++static void vmm_mem_addr_setup(struct pci_device *dev, void *arg)
> ++{
> ++ pci_slot_get_irq = vmm_pci_slot_get_irq;
> ++}
> ++
> + static const struct pci_device_id pci_platform_tbl[] = {
> + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
> + i440fx_mem_addr_setup),
> + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_Q35_MCH,
> + mch_mem_addr_setup),
> ++ PCI_DEVICE(PCI_VENDOR_ID_OPENBSD, PCI_DEVICE_ID_OPENBSD_PCHB,
> ++ vmm_mem_addr_setup),
> + PCI_DEVICE_END
> + };
> +
> Index: sysutils/firmware/vmm/patches/patch-src_hw_pci_ids_h
> ===================================================================
> RCS file: sysutils/firmware/vmm/patches/patch-src_hw_pci_ids_h
> diff -N sysutils/firmware/vmm/patches/patch-src_hw_pci_ids_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ sysutils/firmware/vmm/patches/patch-src_hw_pci_ids_h 25 Mar 2017
> 13:14:37 -0000
> @@ -0,0 +1,17 @@
> +$OpenBSD$
> +
> +Since we hijacked the OpenBSD PCI vendor ID, this diff should probably
> +not be upstreamed.
> +
> +--- src/hw/pci_ids.h.orig Fri Feb 24 15:01:20 2017
> ++++ src/hw/pci_ids.h Sat Mar 25 14:13:05 2017
> +@@ -146,6 +146,9 @@
> + #define PCI_DEVICE_ID_BERKOM_A4T 0xffa4
> + #define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8
> +
> ++#define PCI_VENDOR_ID_OPENBSD 0x0b5d
> ++#define PCI_DEVICE_ID_OPENBSD_PCHB 0x0666
> ++
> + #define PCI_VENDOR_ID_COMPAQ 0x0e11
> + #define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508
> + #define PCI_DEVICE_ID_COMPAQ_TACHYON 0xa0fc
>