Subject: [PATCH 0/11] x86/pci 32/64 bit merge

This patch series merges the x86/pci code. It's relative to
tip/x86/cpu since there are already changes that touch pci code.

I reworked parts of the subsys_initcalls to remove Makefile object
order dependencies. The kernel reboots for acpi/noacpi, smp/nosmp,
32/64 bit. It compiles for numaq and visws (I don't have hardware
available for this configurations, so please test these configs if you
have hardware available).

There is still some work to do in arch/x86/pci/amd_bus.c and for
mmconfig.

Signed-off-by: Robert Richter <[email protected]>



Subject: [PATCH 04/11] x86/pci: Makefile merge: Decoupling options for mp_bus_to_node.o

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index 8491894..d69a0fe 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -14,14 +14,12 @@ pci-y := fixup.o
# legacy/irq.o
pci-$(CONFIG_ACPI) += acpi.o
pci-y += legacy.o irq.o
+pci-$(CONFIG_NUMA) += mp_bus_to_node.o

# Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
# therefor correct. This needs a proper fix by distangling the code.
pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
-pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o
-
-# Necessary for NUMAQ as well
-pci-$(CONFIG_NUMA) += mp_bus_to_node.o
+pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o mp_bus_to_node.o

obj-y += $(pci-y) common.o early.o
obj-y += amd_bus.o
--
1.5.5.4

Subject: [PATCH 03/11] x86/pci: Makefile merge: Whitespace changes only

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index d33c57d..8491894 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -32,14 +32,14 @@ else
# Makefile for X86_64 specific PCI routines
#

-obj-y := i386.o
-obj-$(CONFIG_PCI_DIRECT)+= direct.o
-obj-y += fixup.o init.o
-obj-$(CONFIG_ACPI) += acpi.o
-obj-y += legacy.o irq.o common.o early.o
+obj-y := i386.o
+obj-$(CONFIG_PCI_DIRECT) += direct.o
+obj-y += fixup.o init.o
+obj-$(CONFIG_ACPI) += acpi.o
+obj-y += legacy.o irq.o common.o early.o
# mmconfig has a 64bit special
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
+obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o

-obj-y += amd_bus.o
+obj-y += amd_bus.o

endif
--
1.5.5.4

Subject: [PATCH 01/11] x86/pci: Makefile merge: Removing Makefile_*

No functional nor ordering changes here.

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 47 ++++++++++++++++++++++++++++++++++++++++++++-
arch/x86/pci/Makefile_32 | 25 ------------------------
arch/x86/pci/Makefile_64 | 17 ----------------
3 files changed, 45 insertions(+), 44 deletions(-)
delete mode 100644 arch/x86/pci/Makefile_32
delete mode 100644 arch/x86/pci/Makefile_64

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index c5c8e48..8d1648d 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -1,5 +1,48 @@
ifeq ($(CONFIG_X86_32),y)
-include ${srctree}/arch/x86/pci/Makefile_32
+
+obj-y := i386.o init.o
+
+obj-$(CONFIG_PCI_BIOS) += pcbios.o
+obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o
+obj-$(CONFIG_PCI_DIRECT) += direct.o
+obj-$(CONFIG_PCI_OLPC) += olpc.o
+
+pci-y := fixup.o
+
+# Do not change the ordering here. There is a nasty init function
+# ordering dependency which breaks when you move acpi.o below
+# legacy/irq.o
+pci-$(CONFIG_ACPI) += acpi.o
+pci-y += legacy.o irq.o
+
+# Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
+# therefor correct. This needs a proper fix by distangling the code.
+pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
+pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o
+
+# Necessary for NUMAQ as well
+pci-$(CONFIG_NUMA) += mp_bus_to_node.o
+
+obj-y += $(pci-y) common.o early.o
+obj-y += amd_bus.o
+
else
-include ${srctree}/arch/x86/pci/Makefile_64
+
+#
+# Makefile for X86_64 specific PCI routines
+#
+# Reuse the i386 PCI subsystem
+#
+EXTRA_CFLAGS += -Iarch/x86/pci
+
+obj-y := i386.o
+obj-$(CONFIG_PCI_DIRECT)+= direct.o
+obj-y += fixup.o init.o
+obj-$(CONFIG_ACPI) += acpi.o
+obj-y += legacy.o irq.o common.o early.o
+# mmconfig has a 64bit special
+obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
+
+obj-y += amd_bus.o
+
endif
diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32
deleted file mode 100644
index f647e7e..0000000
--- a/arch/x86/pci/Makefile_32
+++ /dev/null
@@ -1,25 +0,0 @@
-obj-y := i386.o init.o
-
-obj-$(CONFIG_PCI_BIOS) += pcbios.o
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o
-obj-$(CONFIG_PCI_DIRECT) += direct.o
-obj-$(CONFIG_PCI_OLPC) += olpc.o
-
-pci-y := fixup.o
-
-# Do not change the ordering here. There is a nasty init function
-# ordering dependency which breaks when you move acpi.o below
-# legacy/irq.o
-pci-$(CONFIG_ACPI) += acpi.o
-pci-y += legacy.o irq.o
-
-# Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
-# therefor correct. This needs a proper fix by distangling the code.
-pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
-pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o
-
-# Necessary for NUMAQ as well
-pci-$(CONFIG_NUMA) += mp_bus_to_node.o
-
-obj-y += $(pci-y) common.o early.o
-obj-y += amd_bus.o
diff --git a/arch/x86/pci/Makefile_64 b/arch/x86/pci/Makefile_64
deleted file mode 100644
index fd47068..0000000
--- a/arch/x86/pci/Makefile_64
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Makefile for X86_64 specific PCI routines
-#
-# Reuse the i386 PCI subsystem
-#
-EXTRA_CFLAGS += -Iarch/x86/pci
-
-obj-y := i386.o
-obj-$(CONFIG_PCI_DIRECT)+= direct.o
-obj-y += fixup.o init.o
-obj-$(CONFIG_ACPI) += acpi.o
-obj-y += legacy.o irq.o common.o early.o
-# mmconfig has a 64bit special
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
-
-obj-y += amd_bus.o
-
--
1.5.5.4

Subject: [PATCH 09/11] x86/pci: Makefile merge: Coalescing 32 and 64 bit

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 21 +--------------------
1 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index 58a3749..c92dc6f 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -1,9 +1,7 @@
-ifeq ($(CONFIG_X86_32),y)
-
obj-y := i386.o init.o

obj-$(CONFIG_PCI_BIOS) += pcbios.o
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o
+obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o
obj-$(CONFIG_PCI_DIRECT) += direct.o
obj-$(CONFIG_PCI_OLPC) += olpc.o

@@ -22,20 +20,3 @@ pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o

obj-y += $(pci-y) common.o early.o
obj-y += amd_bus.o
-
-else
-
-#
-# Makefile for X86_64 specific PCI routines
-#
-
-obj-y := i386.o init.o
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
-obj-$(CONFIG_PCI_DIRECT) += direct.o
-pci-y := fixup.o
-pci-$(CONFIG_ACPI) += acpi.o
-pci-y += legacy.o irq.o
-obj-y += $(pci-y) common.o early.o
-obj-y += amd_bus.o
-
-endif
--
1.5.5.4

Subject: [PATCH 11/11] x86/pci: Removing subsys_initcall ordering dependencies

So far subsys_initcalls has been executed in this order depending on
the object order in the Makefile:

arch/x86/pci/visws.c:subsys_initcall(pcibios_init);
arch/x86/pci/numa.c:subsys_initcall(pci_numa_init);
arch/x86/pci/acpi.c:subsys_initcall(pci_acpi_init);
arch/x86/pci/legacy.c:subsys_initcall(pci_legacy_init);
arch/x86/pci/irq.c:subsys_initcall(pcibios_irq_init);
arch/x86/pci/common.c:subsys_initcall(pcibios_init);

This patch removes the ordering dependency. There is now only one
subsys_initcall function that contains subsystem initialization code
with a defined order.

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 4 ----
arch/x86/pci/acpi.c | 3 +--
arch/x86/pci/common.c | 4 +---
arch/x86/pci/init.c | 4 ++--
arch/x86/pci/irq.c | 5 +----
arch/x86/pci/legacy.c | 11 ++++++++++-
arch/x86/pci/numa.c | 8 +++++++-
arch/x86/pci/pci.h | 11 ++++++++---
arch/x86/pci/visws.c | 7 ++++++-
9 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index c92dc6f..a071be2 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -6,10 +6,6 @@ obj-$(CONFIG_PCI_DIRECT) += direct.o
obj-$(CONFIG_PCI_OLPC) += olpc.o

pci-y := fixup.o
-
-# Do not change the ordering here. There is a nasty init function
-# ordering dependency which breaks when you move acpi.o below
-# legacy/irq.o
pci-$(CONFIG_ACPI) += acpi.o
pci-y += legacy.o irq.o

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index d95de2f..2e85b4e 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -219,7 +219,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
}

extern int pci_routeirq;
-static int __init pci_acpi_init(void)
+int __init pci_acpi_init(void)
{
struct pci_dev *dev = NULL;

@@ -253,4 +253,3 @@ static int __init pci_acpi_init(void)

return 0;
}
-subsys_initcall(pci_acpi_init);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 940185e..1d58bbe 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -384,7 +384,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)

extern u8 pci_cache_line_size;

-static int __init pcibios_init(void)
+int __init pcibios_init(void)
{
struct cpuinfo_x86 *c = &boot_cpu_data;

@@ -411,8 +411,6 @@ static int __init pcibios_init(void)
return 0;
}

-subsys_initcall(pcibios_init);
-
char * __devinit pcibios_setup(char *str)
{
if (!strcmp(str, "off")) {
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index b821f44..d6c950f 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -4,7 +4,7 @@

/* arch_initcall has too random ordering, so call the initializers
in the right sequence from here. */
-static __init int pci_access_init(void)
+static __init int pci_arch_init(void)
{
#ifdef CONFIG_PCI_DIRECT
int type = 0;
@@ -40,4 +40,4 @@ static __init int pci_access_init(void)

return 0;
}
-arch_initcall(pci_access_init);
+arch_initcall(pci_arch_init);
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index ca8df9c..4debf53 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -1118,7 +1118,7 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = {
{ }
};

-static int __init pcibios_irq_init(void)
+int __init pcibios_irq_init(void)
{
DBG(KERN_DEBUG "PCI: IRQ init\n");

@@ -1153,9 +1153,6 @@ static int __init pcibios_irq_init(void)
return 0;
}

-subsys_initcall(pcibios_irq_init);
-
-
static void pirq_penalize_isa_irq(int irq, int active)
{
/*
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index a67921c..3c1d795 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -55,4 +55,13 @@ static int __init pci_legacy_init(void)
return 0;
}

-subsys_initcall(pci_legacy_init);
+int __init pci_subsys_init(void)
+{
+#ifdef CONFIG_ACPI
+ pci_acpi_init();
+#endif
+ pci_legacy_init();
+ pcibios_irq_init();
+ pcibios_init();
+}
+subsys_initcall(pci_subsys_init);
diff --git a/arch/x86/pci/numa.c b/arch/x86/pci/numa.c
index d9afbae..a50c2a5 100644
--- a/arch/x86/pci/numa.c
+++ b/arch/x86/pci/numa.c
@@ -198,4 +198,10 @@ static int __init pci_numa_init(void)
return 0;
}

-subsys_initcall(pci_numa_init);
+static __init int pci_subsys_init(void)
+{
+ pci_numa_init();
+ pcibios_irq_init();
+ pcibios_init();
+}
+subsys_initcall(pci_subsys_init);
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index ba263e6..5824174 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -39,9 +39,6 @@ enum pci_bf_sort_state {
pci_dmi_bf,
};

-extern void __init dmi_check_pciprobe(void);
-extern void __init dmi_check_skip_isa_align(void);
-
/* pci-i386.c */

extern unsigned int pcibios_max_latency;
@@ -99,10 +96,18 @@ extern struct pci_raw_ops *raw_pci_ext_ops;

extern struct pci_raw_ops pci_direct_conf1;

+/* arch_initcall level */
extern int pci_direct_probe(void);
extern void pci_direct_init(int type);
extern void pci_pcbios_init(void);
extern int pci_olpc_init(void);
+extern void __init dmi_check_pciprobe(void);
+extern void __init dmi_check_skip_isa_align(void);
+
+/* some common used subsys_initcalls */
+extern int __init pci_acpi_init(void);
+extern int __init pcibios_irq_init(void);
+extern int __init pcibios_init(void);

/* pci-mmconfig.c */

diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index c3dc9f2..16e5206 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -105,4 +105,9 @@ static int __init pci_visws_init(void)
return 0;
}

-subsys_initcall(pci_visws_init);
+static __init int pci_subsys_init(void)
+{
+ pci_visws_init();
+ pcibios_init();
+}
+subsys_initcall(pci_subsys_init);
--
1.5.5.4

Subject: [PATCH 05/11] x86/pci: Makefile merge: Changing 64bit ordering

This should be save since mmconfig*.o and init.o do not contain
*initcalls with the same level as in other files.

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index d69a0fe..0fc3425 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -30,14 +30,13 @@ else
# Makefile for X86_64 specific PCI routines
#

-obj-y := i386.o
+obj-y := i386.o init.o
+obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
obj-$(CONFIG_PCI_DIRECT) += direct.o
-obj-y += fixup.o init.o
+obj-y += fixup.o
obj-$(CONFIG_ACPI) += acpi.o
-obj-y += legacy.o irq.o common.o early.o
-# mmconfig has a 64bit special
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
-
+obj-y += legacy.o irq.o
+obj-y += common.o early.o
obj-y += amd_bus.o

endif
--
1.5.5.4

Subject: [PATCH 10/11] x86/pci: visws: Renaming pcibios_init()

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/visws.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index c2df4e9..c3dc9f2 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -85,7 +85,7 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
}

-static int __init pcibios_init(void)
+static int __init pci_visws_init(void)
{
/* The VISWS supports configuration access type 1 only */
pci_probe = (pci_probe | PCI_PROBE_CONF1) &
@@ -105,4 +105,4 @@ static int __init pcibios_init(void)
return 0;
}

-subsys_initcall(pcibios_init);
+subsys_initcall(pci_visws_init);
--
1.5.5.4

Subject: [PATCH 07/11] x86/pci: mp_bus_to_node merge: moving code in amd_bus.c

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/amd_bus.c | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 15f505d..aa3a190 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -14,27 +14,6 @@
* also get peer root bus resource for io,mmio
*/

-
-/*
- * sub bus (transparent) will use entres from 3 to store extra from root,
- * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES?
- */
-#define RES_NUM 16
-struct pci_root_info {
- char name[12];
- unsigned int res_num;
- struct resource res[RES_NUM];
- int bus_min;
- int bus_max;
- int node;
- int link;
-};
-
-/* 4 at this time, it may become to 32 */
-#define PCI_ROOT_NR 4
-static int pci_root_num;
-static struct pci_root_info pci_root_info[PCI_ROOT_NR];
-
#ifdef CONFIG_NUMA

#define BUS_NR 256
@@ -65,8 +44,29 @@ int get_mp_bus_to_node(int busnum)

return node;
}
+
#endif

+/*
+ * sub bus (transparent) will use entres from 3 to store extra from root,
+ * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES?
+ */
+#define RES_NUM 16
+struct pci_root_info {
+ char name[12];
+ unsigned int res_num;
+ struct resource res[RES_NUM];
+ int bus_min;
+ int bus_max;
+ int node;
+ int link;
+};
+
+/* 4 at this time, it may become to 32 */
+#define PCI_ROOT_NR 4
+static int pci_root_num;
+static struct pci_root_info pci_root_info[PCI_ROOT_NR];
+
void set_pci_bus_resources_arch_default(struct pci_bus *b)
{
int i;
--
1.5.5.4

Subject: [PATCH 02/11] x86/pci: Makefile merge: Removing include dir flag

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index 8d1648d..d33c57d 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -31,9 +31,6 @@ else
#
# Makefile for X86_64 specific PCI routines
#
-# Reuse the i386 PCI subsystem
-#
-EXTRA_CFLAGS += -Iarch/x86/pci

obj-y := i386.o
obj-$(CONFIG_PCI_DIRECT)+= direct.o
--
1.5.5.4

Subject: [PATCH 06/11] x86/pci: Makefile merge: Creating pci-y for 64 bit

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index 0fc3425..844906e 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -33,10 +33,10 @@ else
obj-y := i386.o init.o
obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
obj-$(CONFIG_PCI_DIRECT) += direct.o
-obj-y += fixup.o
-obj-$(CONFIG_ACPI) += acpi.o
-obj-y += legacy.o irq.o
-obj-y += common.o early.o
+pci-y := fixup.o
+pci-$(CONFIG_ACPI) += acpi.o
+pci-y += legacy.o irq.o
+obj-y += $(pci-y) common.o early.o
obj-y += amd_bus.o

endif
--
1.5.5.4

Subject: [PATCH 08/11] x86/pci: merge: Moving mp_bus_to_node.c to amd_bus.c

Signed-off-by: Robert Richter <[email protected]>
---
arch/x86/pci/Makefile | 3 +--
arch/x86/pci/amd_bus.c | 32 +++++++++++++++++++++++++++++---
arch/x86/pci/mp_bus_to_node.c | 23 -----------------------
3 files changed, 30 insertions(+), 28 deletions(-)
delete mode 100644 arch/x86/pci/mp_bus_to_node.c

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index 844906e..58a3749 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -14,12 +14,11 @@ pci-y := fixup.o
# legacy/irq.o
pci-$(CONFIG_ACPI) += acpi.o
pci-y += legacy.o irq.o
-pci-$(CONFIG_NUMA) += mp_bus_to_node.o

# Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
# therefor correct. This needs a proper fix by distangling the code.
pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
-pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o mp_bus_to_node.o
+pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o

obj-y += $(pci-y) common.o early.o
obj-y += amd_bus.o
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index aa3a190..f2b81d6 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -1,13 +1,13 @@
#include <linux/init.h>
#include <linux/pci.h>
+#include <linux/topology.h>
#include "pci.h"

#ifdef CONFIG_X86_64
-
#include <asm/pci-direct.h>
#include <asm/mpspec.h>
#include <linux/cpumask.h>
-#include <linux/topology.h>
+#endif

/*
* This discovers the pcibus <-> node mapping on AMD K8.
@@ -18,6 +18,8 @@

#define BUS_NR 256

+#ifdef CONFIG_X86_64
+
static int mp_bus_to_node[BUS_NR];

void set_mp_bus_to_node(int busnum, int node)
@@ -45,7 +47,31 @@ int get_mp_bus_to_node(int busnum)
return node;
}

-#endif
+#else /* CONFIG_X86_32 */
+
+static unsigned char mp_bus_to_node[BUS_NR];
+
+void set_mp_bus_to_node(int busnum, int node)
+{
+ if (busnum >= 0 && busnum < BUS_NR)
+ mp_bus_to_node[busnum] = (unsigned char) node;
+}
+
+int get_mp_bus_to_node(int busnum)
+{
+ int node;
+
+ if (busnum < 0 || busnum > (BUS_NR - 1))
+ return 0;
+ node = mp_bus_to_node[busnum];
+ return node;
+}
+
+#endif /* CONFIG_X86_32 */
+
+#endif /* CONFIG_NUMA */
+
+#ifdef CONFIG_X86_64

/*
* sub bus (transparent) will use entres from 3 to store extra from root,
diff --git a/arch/x86/pci/mp_bus_to_node.c b/arch/x86/pci/mp_bus_to_node.c
deleted file mode 100644
index 0229439..0000000
--- a/arch/x86/pci/mp_bus_to_node.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/topology.h>
-
-#define BUS_NR 256
-
-static unsigned char mp_bus_to_node[BUS_NR];
-
-void set_mp_bus_to_node(int busnum, int node)
-{
- if (busnum >= 0 && busnum < BUS_NR)
- mp_bus_to_node[busnum] = (unsigned char) node;
-}
-
-int get_mp_bus_to_node(int busnum)
-{
- int node;
-
- if (busnum < 0 || busnum > (BUS_NR - 1))
- return 0;
- node = mp_bus_to_node[busnum];
- return node;
-}
--
1.5.5.4

2008-07-02 23:39:16

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH 04/11] x86/pci: Makefile merge: Decoupling options for mp_bus_to_node.o

On Wed, Jul 2, 2008 at 1:50 PM, Robert Richter <[email protected]> wrote:
> Signed-off-by: Robert Richter <[email protected]>
> ---
> arch/x86/pci/Makefile | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
> index 8491894..d69a0fe 100644
> --- a/arch/x86/pci/Makefile
> +++ b/arch/x86/pci/Makefile
> @@ -14,14 +14,12 @@ pci-y := fixup.o
> # legacy/irq.o
> pci-$(CONFIG_ACPI) += acpi.o
> pci-y += legacy.o irq.o
> +pci-$(CONFIG_NUMA) += mp_bus_to_node.o
>
> # Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
> # therefor correct. This needs a proper fix by distangling the code.
> pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
> -pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o

looks like you didn't base on latest tip/master...

YH

2008-07-03 19:19:20

by Jesse Barnes

[permalink] [raw]
Subject: Re: [PATCH 0/11] x86/pci 32/64 bit merge

On Wednesday, July 02, 2008 1:50 pm Robert Richter wrote:
> This patch series merges the x86/pci code. It's relative to
> tip/x86/cpu since there are already changes that touch pci code.
>
> I reworked parts of the subsys_initcalls to remove Makefile object
> order dependencies. The kernel reboots for acpi/noacpi, smp/nosmp,
> 32/64 bit. It compiles for numaq and visws (I don't have hardware
> available for this configurations, so please test these configs if you
> have hardware available).
>
> There is still some work to do in arch/x86/pci/amd_bus.c and for
> mmconfig.
>
> Signed-off-by: Robert Richter <[email protected]>

In general it looks pretty nice and smaller than I would have guessed. I'd
like to see each change have a nicer changelog though, explaining things more
than the one line patch summary (why, how, etc.). And like Yinghai mentioned
there may be other changes in the x86 tree that you have to deal with in
order to merge this; I can pull those into my PCI linux-next tree though to
make things easier.

Jesse

Subject: Re: [PATCH 0/11] x86/pci 32/64 bit merge

Jesse,

On 03.07.08 12:19:01, Jesse Barnes wrote:
> In general it looks pretty nice and smaller than I would have guessed. I'd
> like to see each change have a nicer changelog though, explaining things more
> than the one line patch summary (why, how, etc.). And like Yinghai mentioned
> there may be other changes in the x86 tree that you have to deal with in
> order to merge this; I can pull those into my PCI linux-next tree though to
> make things easier.

I will look for changes in other x86 feature trees and cherry-pick all
of them for tip/pci-for-jesse. This will resolve existing conflicts as
well. If the conflicts have small impact, I will create follow on
patches. So, I am fine with applying this patch series to
pci/linux-next.

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]

2008-07-09 09:42:20

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 0/11] x86/pci 32/64 bit merge


* Robert Richter <[email protected]> wrote:

> This patch series merges the x86/pci code. It's relative to
> tip/x86/cpu since there are already changes that touch pci code.
>
> I reworked parts of the subsys_initcalls to remove Makefile object
> order dependencies. The kernel reboots for acpi/noacpi, smp/nosmp,
> 32/64 bit. It compiles for numaq and visws (I don't have hardware
> available for this configurations, so please test these configs if you
> have hardware available).
>
> There is still some work to do in arch/x86/pci/amd_bus.c and for
> mmconfig.

Robert, since this series interacts quite a bit with other bits in
tip/x86/* i've merged it up into a new topic: tip/x86/unify-pci and
started testing it:

Robert Richter (11):
x86/pci: Makefile merge: Removing Makefile_*
x86/pci: Makefile merge: removing include dir flag
x86/pci: Makefile merge: whitespace changes only
x86/pci: Makefile merge: decoupling options for mp_bus_to_node.o
x86/pci: Makefile merge: changing 64bit ordering
x86/pci: Makefile merge: creating pci-y for 64 bit
x86/pci: mp_bus_to_node merge: moving code in amd_bus.c
x86/pci: merge: moving mp_bus_to_node.c to amd_bus.c
x86/pci: Makefile merge: coalescing 32 and 64 bit
x86/pci: visws: renaming pcibios_init()
x86/pci: removing subsys_initcall ordering dependencies

You can have a look by pulling this branch into a -git based tree:

git-pull git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86/unify-pci

Ingo