summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/mpi_pci.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2006-06-16 05:36:46 +0000
committerdlg <dlg@openbsd.org>2006-06-16 05:36:46 +0000
commitc429ac72d25fcff5d7880e1613c62523e1daccc6 (patch)
treed3aaf5aa804d8a1423bcd6a5a772ef756624a373 /sys/dev/pci/mpi_pci.c
parentenable mpi. (diff)
downloadwireguard-openbsd-c429ac72d25fcff5d7880e1613c62523e1daccc6.tar.xz
wireguard-openbsd-c429ac72d25fcff5d7880e1613c62523e1daccc6.zip
vmware emulates mpi, but it does a half arsed job of it. half the fields
we read off the hardware and use to configure the driver with are set to zero, so things dont really work like we want them to. one of these fields is the pci subsystem id which is something we can fetch really early in the attach process. so if the subsys is 0 then we go on and fix up some of the values we get off the "hardware". now we can attach disks on vmware. "sneaky" and ok marco@ tested by and ok brad@
Diffstat (limited to 'sys/dev/pci/mpi_pci.c')
-rw-r--r--sys/dev/pci/mpi_pci.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pci/mpi_pci.c b/sys/dev/pci/mpi_pci.c
index 3521d24f916..3955a7ffc0d 100644
--- a/sys/dev/pci/mpi_pci.c
+++ b/sys/dev/pci/mpi_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi_pci.c,v 1.7 2006/06/14 08:26:31 dlg Exp $ */
+/* $OpenBSD: mpi_pci.c,v 1.8 2006/06/16 05:36:46 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -136,6 +136,10 @@ mpi_pci_attach(struct device *parent, struct device *self, void *aux)
}
printf(": %s", intrstr);
+ /* vmware doesn't fill in the pci subsystem register */
+ if (pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG) == 0x0)
+ sc->sc_flags |= MPI_F_VMWARE;
+
if (mpi_attach(sc) != 0) {
/* error printed by mpi_attach */
goto deintr;