Re: PCI64 bus vanished in 2.4.23-pre6

From: Marcelo Tosatti
Date: Fri Oct 10 2003 - 13:36:55 EST




On Tue, 7 Oct 2003, J.A. Magallon wrote:

> Hi all...
>
> With 2.4.23-pre6, my e1000 cards did not work. I was thinking it was a driver
> problem, but the I realized that they are not even listed in lspci.
>
> <moilanen:austin.ibm.com>:
> o Workaround PPC64 PCI scan issue

This has a high chance of being the problem.

Attached patch for you to revert (-R) and retry is attached, please. :)
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1136 -> 1.1136.2.1
# include/asm-alpha/pci.h 1.8 -> 1.9
# include/asm-mips64/pci.h 1.11 -> 1.12
# include/asm-sparc64/pci.h 1.6 -> 1.7
# include/asm-ppc64/pci.h 1.3 -> 1.4
# drivers/pci/pci.c 1.45 -> 1.46
# include/asm-arm/pci.h 1.10 -> 1.11
# include/asm-i386/pci.h 1.16 -> 1.17
# include/asm-m68k/pci.h 1.3 -> 1.4
# include/asm-sh/pci.h 1.10 -> 1.11
# include/asm-mips/pci.h 1.12 -> 1.13
# include/asm-parisc/pci.h 1.7 -> 1.8
# include/asm-ppc/pci.h 1.14 -> 1.15
# include/asm-sparc/pci.h 1.8 -> 1.9
# include/asm-ia64/pci.h 1.13 -> 1.14
# include/asm-x86_64/pci.h 1.5 -> 1.6
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/29 len.brown@xxxxxxxxx 1.1137
# Merge intel.com:/home/lenb/bk/linux-2.4.23
# into intel.com:/home/lenb/bk/linux-acpi-test-2.4.23
# --------------------------------------------
# 03/09/29 len.brown@xxxxxxxxx 1.1136.1.1
# Merge intel.com:/home/lenb/bk/linux-2.4.23
# into intel.com:/home/lenb/bk/linux-acpi-release-2.4.23
# --------------------------------------------
# 03/09/29 moilanen@xxxxxxxxxxxxxx 1.1136.2.1
# [PATCH] Workaround PPC64 PCI scan issue
#
# This patch is a port of some work that Anton Blanchard did for 2.6.
#
# There are some arch, like PPC64, that need to be able to scan all the
# PCI functions. The problem comes in on a logically partitioned system
# where function 0 on a PCI-PCI bridge is assigned to one partition and say
# function 2 is assiged to another partition. On the second partition, it
# would appear that function 0 does not exist, but function 2 does. If all
# the functions are not scanned, everything under function 2 would not be
# detected.
#
#
# Thanks,
# Jake
# --------------------------------------------
#
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c Fri Oct 10 15:27:59 2003
+++ b/drivers/pci/pci.c Fri Oct 10 15:27:59 2003
@@ -1475,17 +1475,22 @@
u8 hdr_type;

for (func = 0; func < 8; func++, temp->devfn++) {
- if (func && !is_multi) /* not a multi-function device */
- continue;
if (pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type))
continue;
temp->hdr_type = hdr_type & 0x7f;

dev = pci_scan_device(temp);
- if (!dev)
- continue;
+ if (!pcibios_scan_all_fns() && func == 0) {
+ if (!dev)
+ break;
+ } else {
+ if (!dev)
+ continue;
+ is_multi = 1;
+ }
+
pci_name_device(dev);
- if (!func) {
+ if (!first_dev) {
is_multi = hdr_type & 0x80;
first_dev = dev;
}
@@ -1499,6 +1504,14 @@

/* Fix up broken headers */
pci_fixup_device(PCI_FIXUP_HEADER, dev);
+
+ /*
+ * If this is a single function device
+ * don't scan past the first function.
+ */
+ if (!is_multi)
+ break;
+
}
return first_dev;
}
diff -Nru a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
--- a/include/asm-alpha/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-alpha/pci.h Fri Oct 10 15:27:59 2003
@@ -50,6 +50,7 @@
bus numbers. */

#define pcibios_assign_all_busses() 1
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO alpha_mv.min_io_address
#define PCIBIOS_MIN_MEM alpha_mv.min_mem_address
diff -Nru a/include/asm-arm/pci.h b/include/asm-arm/pci.h
--- a/include/asm-arm/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-arm/pci.h Fri Oct 10 15:27:59 2003
@@ -53,6 +53,8 @@
/* We don't do dynamic PCI IRQ allocation */
}

+#define pcibios_scan_all_fns() 0
+
struct pci_dev;

/* Allocate and map kernel buffer using consistent mode DMA for a device.
diff -Nru a/include/asm-i386/pci.h b/include/asm-i386/pci.h
--- a/include/asm-i386/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-i386/pci.h Fri Oct 10 15:27:59 2003
@@ -14,6 +14,7 @@
#else
#define pcibios_assign_all_busses() 0
#endif
+#define pcibios_scan_all_fns() 0

extern unsigned long pci_mem_start;
#define PCIBIOS_MIN_IO 0x1000
diff -Nru a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
--- a/include/asm-ia64/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-ia64/pci.h Fri Oct 10 15:27:59 2003
@@ -15,6 +15,7 @@
* loader.
*/
#define pcibios_assign_all_busses() 0
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
diff -Nru a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
--- a/include/asm-m68k/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-m68k/pci.h Fri Oct 10 15:27:59 2003
@@ -34,6 +34,7 @@
};

#define pcibios_assign_all_busses() 0
+#define pcibios_scan_all_fns() 0

extern inline void pcibios_set_master(struct pci_dev *dev)
{
diff -Nru a/include/asm-mips/pci.h b/include/asm-mips/pci.h
--- a/include/asm-mips/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-mips/pci.h Fri Oct 10 15:27:59 2003
@@ -19,6 +19,7 @@
#else
#define pcibios_assign_all_busses() 0
#endif
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
diff -Nru a/include/asm-mips64/pci.h b/include/asm-mips64/pci.h
--- a/include/asm-mips64/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-mips64/pci.h Fri Oct 10 15:27:59 2003
@@ -19,6 +19,7 @@
#else
#define pcibios_assign_all_busses() 0
#endif
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
diff -Nru a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
--- a/include/asm-parisc/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-parisc/pci.h Fri Oct 10 15:27:59 2003
@@ -259,6 +259,7 @@
** to zero for legacy platforms and one for PAT platforms.
*/
#define pcibios_assign_all_busses() (pdc_type == PDC_TYPE_PAT)
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0x10
#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */
diff -Nru a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
--- a/include/asm-ppc/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-ppc/pci.h Fri Oct 10 15:27:59 2003
@@ -24,6 +24,7 @@
extern int pci_assign_all_busses;

#define pcibios_assign_all_busses() (pci_assign_all_busses)
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
diff -Nru a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
--- a/include/asm-ppc64/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-ppc64/pci.h Fri Oct 10 15:27:59 2003
@@ -25,6 +25,12 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000

+/*
+ * ppc64 can have multifunction devices that do not respond to function 0.
+ * In this case we must scan all functions.
+ */
+#define pcibios_scan_all_fns() 1
+
static inline void pcibios_set_master(struct pci_dev *dev)
{
/* No special bus mastering setup handling */
diff -Nru a/include/asm-sh/pci.h b/include/asm-sh/pci.h
--- a/include/asm-sh/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-sh/pci.h Fri Oct 10 15:27:59 2003
@@ -10,6 +10,7 @@
or architectures with incomplete PCI setup by the loader */

#define pcibios_assign_all_busses() 1
+#define pcibios_scan_all_fns() 0

#if defined(CONFIG_CPU_SUBTYPE_ST40)
/* These are currently the correct values for the ST40 based chips.
diff -Nru a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
--- a/include/asm-sparc/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-sparc/pci.h Fri Oct 10 15:27:59 2003
@@ -8,6 +8,7 @@
* or architectures with incomplete PCI setup by the loader.
*/
#define pcibios_assign_all_busses() 0
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0UL
#define PCIBIOS_MIN_MEM 0UL
diff -Nru a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
--- a/include/asm-sparc64/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-sparc64/pci.h Fri Oct 10 15:27:59 2003
@@ -11,6 +11,7 @@
* or architectures with incomplete PCI setup by the loader.
*/
#define pcibios_assign_all_busses() 0
+#define pcibios_scan_all_fns() 0

#define PCIBIOS_MIN_IO 0UL
#define PCIBIOS_MIN_MEM 0UL
diff -Nru a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
--- a/include/asm-x86_64/pci.h Fri Oct 10 15:27:59 2003
+++ b/include/asm-x86_64/pci.h Fri Oct 10 15:27:59 2003
@@ -17,6 +17,7 @@
#else
#define pcibios_assign_all_busses() 0
#endif
+#define pcibios_scan_all_fns() 0

extern unsigned long pci_mem_start;
#define PCIBIOS_MIN_IO 0x1000