Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/pci Force pci_mode 1 when running as Xen HVM do...



details:   https://anonhg.NetBSD.org/src/rev/c3a9b5e100bb
branches:  trunk
changeset: 329094:c3a9b5e100bb
user:      sborrill <sborrill%NetBSD.org@localhost>
date:      Tue May 06 09:01:26 2014 +0000

description:
Force pci_mode 1 when running as Xen HVM domU to allow cd* to be detected
correctly. Fixes kern/48770. Thanks to cube@

diffstat:

 sys/arch/x86/pci/pci_machdep.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 926b71b05384 -r c3a9b5e100bb sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c    Tue May 06 07:29:30 2014 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c    Tue May 06 09:01:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.65 2014/01/27 23:11:50 jakllsch Exp $        */
+/*     $NetBSD: pci_machdep.c,v 1.66 2014/05/06 09:01:26 sborrill 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.65 2014/01/27 23:11:50 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.66 2014/05/06 09:01:26 sborrill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -526,6 +526,7 @@
        int i;
        pcireg_t idreg;
        extern char cpu_brand_string[];
+       const char *system_vendor, *system_product;
 
        if (pci_mode != -1)
                return pci_mode;
@@ -555,7 +556,13 @@
                        return (pci_mode);
                }
        }
-        if (memcmp(cpu_brand_string, "QEMU", 4) == 0) {
+
+       system_vendor = pmf_get_platform("system-vendor");
+       system_product = pmf_get_platform("system-product");
+        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");



Home | Main Index | Thread Index | Old Index