NetBSD-Bugs archive

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

port-xen/40356: [PATCH] PCI_ADDR_FIXUP has no effect under xen environment



>Number:         40356
>Category:       port-xen
>Synopsis:       [PATCH] PCI_ADDR_FIXUP has no effect under xen environment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-xen-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 10 12:35:00 +0000 2009
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 5.0_BETA
>Organization:
        FUKAUMI Naoki
>Environment:
System: NetBSD t105.naobsd.org 5.0_BETA NetBSD 5.0_BETA (T105) #0: Thu Jan 8 
21:21:25 JST 2009 
fun%t105.naobsd.org@localhost:/home/fun/src/sys/arch/amd64/compile/T105 amd64
Architecture: x86_64
Machine: amd64
>Description:
        I'm using Dell PowerEdge T105 with netbsd-5/amd64. with GENERIC
        kernel, wd at viaide0 is not attached. (viaide0: couldn't map
        sata regs)
        "options PCI_ADDR_FIXUP" (and PCI_BUS_FIXUP) fixes this problem.

        # kern/38011 states NVIDIA chipset has problem. I'm not sure
        # which is wrong: BIOS or chipset. but it's not important for
        # this PR.

        now, I'm try to setup xen33 environment on T105. XEN3_DOM0
        kernel has same problem, but "options PCI_ADDR_FIXUP" has no
        effect.

        see also:
         http://mail-index.netbsd.org/port-xen/2009/01/04/msg004617.html
>How-To-Repeat:
        try "options PCI_ADDR_FIXUP" (and PCI_BUS_FIXUP) under xen
        environment.
>Fix:
        below patch fixes this problem. please pullup to netbsd-5.

Index: sys/arch/xen/conf/files.xen
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/xen/conf/files.xen,v
retrieving revision 1.88
diff -u -p -r1.88 files.xen
--- sys/arch/xen/conf/files.xen 3 Aug 2008 19:32:03 -0000       1.88
+++ sys/arch/xen/conf/files.xen 2 Jan 2009 17:15:06 -0000
@@ -254,10 +254,8 @@ file       arch/x86/x86/i8259.c            xen3
 # MP configuration using Intel SMP specification 1.4
 file   arch/x86/x86/mpbios.c           mpbios
 
-ifdef i386
-file   arch/i386/pci/pci_bus_fixup.c   pci_bus_fixup
-file   arch/i386/pci/pci_addr_fixup.c  pci_addr_fixup
-endif
+file   arch/x86/pci/pci_bus_fixup.c    pci_bus_fixup
+file   arch/x86/pci/pci_addr_fixup.c   pci_addr_fixup
 
 file   arch/x86/x86/apic.c             ioapic
 
Index: sys/arch/xen/x86/mainbus.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/xen/x86/mainbus.c,v
retrieving revision 1.5
diff -u -p -r1.5 mainbus.c
--- sys/arch/xen/x86/mainbus.c  21 Oct 2008 15:46:32 -0000      1.5
+++ sys/arch/xen/x86/mainbus.c  2 Jan 2009 17:21:42 -0000
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 
 #include "opt_xen.h"
 #include "opt_mpbios.h"
+#include "opt_pcifixup.h"
 
 #include "acpi.h"
 #include "ioapic.h"
@@ -71,6 +72,12 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 #ifdef MPBIOS
 #include <machine/mpbiosvar.h>       
 #endif /* MPBIOS */
+#ifdef PCI_BUS_FIXUP
+#include <arch/x86/pci/pci_bus_fixup.h>
+#ifdef PCI_ADDR_FIXUP
+#include <arch/x86/pci/pci_addr_fixup.h>
+#endif  
+#endif
 
 #if defined(MPBIOS) || NACPI > 0
 struct mp_bus *mp_busses;
@@ -136,6 +143,9 @@ mainbus_attach(device_t parent, device_t
 #if NACPI > 0 || defined(MPBIOS)
        int numioapics = 0;     
 #endif
+#ifdef PCI_BUS_FIXUP
+       int pci_maxbus = 0;
+#endif
 #endif /* defined(DOM0OPS) && defined(XEN3) */
 
        aprint_naive("\n");
@@ -157,14 +167,16 @@ mainbus_attach(device_t parent, device_t
                /* ACPI needs to be able to access PCI configuration space. */
                pci_mode = pci_mode_detect();
 #ifdef PCI_BUS_FIXUP
-               pci_maxbus = pci_bus_fixup(NULL, 0);
-               aprint_debug_dev(self, "PCI bus max, after pci_bus_fixup: %i\n",
-                   pci_maxbus);
+               if (pci_mode != 0) {
+                       pci_maxbus = pci_bus_fixup(NULL, 0);
+                       aprint_debug_dev(self, "PCI bus max, after "
+                           "pci_bus_fixup: %i\n", pci_maxbus);
 #ifdef PCI_ADDR_FIXUP
-               pciaddr.extent_port = NULL;
-               pciaddr.extent_mem = NULL;
-               pci_addr_fixup(NULL, pci_maxbus);
+                       pciaddr.extent_port = NULL;
+                       pciaddr.extent_mem = NULL;
+                       pci_addr_fixup(NULL, pci_maxbus);
 #endif /* PCI_ADDR_FIXUP */
+               }
 #endif /* PCI_BUS_FIXUP */
 #if NACPI > 0
                acpi_present = acpi_probe();
Index: sys/arch/xen/xen/hypervisor.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.42
diff -u -p -r1.42 hypervisor.c
--- sys/arch/xen/xen/hypervisor.c       24 Oct 2008 21:09:24 -0000      1.42
+++ sys/arch/xen/xen/hypervisor.c       2 Jan 2009 17:15:06 -0000
@@ -125,12 +125,6 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c
 #ifdef MPBIOS
 #include <machine/mpbiosvar.h>       
 #endif
-#ifdef PCI_BUS_FIXUP
-#include <arch/i386/pci/pci_bus_fixup.h>
-#ifdef PCI_ADDR_FIXUP
-#include <arch/i386/pci/pci_addr_fixup.h>
-#endif  
-#endif
 #endif /* NPCI */
 
 #if NXENBUS > 0
@@ -243,9 +237,6 @@ hypervisor_attach(device_t parent, devic
        int i, j, busnum;
 #endif
 
-#ifdef PCI_BUS_FIXUP
-       int pci_maxbus = 0;
-#endif
 #endif /* NPCI */
        union hypervisor_attach_cookie hac;
 



Home | Main Index | Thread Index | Old Index