Module Name: src
Committed By: bouyer
Date: Wed May 21 22:05:40 UTC 2014
Modified Files:
src/sys/arch/x86/pci [netbsd-5]: pci_machdep.c
Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1903):
sys/arch/x86/pci/pci_machdep.c: revision 1.61 via patch
sys/arch/x86/pci/pci_machdep.c: revision 1.66 via patch
Force pci_mode 1 when running as Xen HVM domU to allow cd* to be
detected correctly. Fixes kern/48770. Thanks to cube@
Force PCI mode 1 when running under QEMU, to work around QEMU bug 897771.
This should also make it possible to boot NetBSD under versions of KVM
that have inherited said QEMU bug. Fixes PR kern/45671.
To generate a diff of this commit:
cvs rdiff -u -r1.34.10.1 -r1.34.10.2 src/sys/arch/x86/pci/pci_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.34.10.1 src/sys/arch/x86/pci/pci_machdep.c:1.34.10.2
--- src/sys/arch/x86/pci/pci_machdep.c:1.34.10.1 Sat May 19 16:39:24 2012
+++ src/sys/arch/x86/pci/pci_machdep.c Wed May 21 22:05:40 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.34.10.1 2012/05/19 16:39:24 riz Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.34.10.2 2014/05/21 22:05:40 bouyer Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.34.10.1 2012/05/19 16:39:24 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.34.10.2 2014/05/21 22:05:40 bouyer Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -483,6 +483,8 @@ pci_mode_detect(void)
uint32_t sav, val;
int i;
pcireg_t idreg;
+ extern char cpu_brand_string[];
+ const char *system_vendor, *system_product;
if (pci_mode != -1)
return pci_mode;
@@ -513,6 +515,19 @@ pci_mode_detect(void)
}
}
+ system_vendor = pmf_get_platform("system-manufacturer");
+ system_product = pmf_get_platform("system-product-name");
+ if (memcmp(cpu_brand_string, "QEMU", 4) == 0 ||
+ (system_vendor != NULL && system_product != NULL &&
+ !strcmp(system_vendor, "Xen") &&
+ !strcmp(system_product, "HVM domU"))) {
+ /* PR 45671, https://bugs.launchpad.net/qemu/+bug/897771 */
+#ifdef DEBUG
+ printf("forcing PCI mode 1 for QEMU\n");
+#endif
+ return (pci_mode);
+ }
+
/*
* Strong check for standard compliant mode 1:
* 1. bit 31 ("enable") can be set