linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pci_child_fixup()
@ 2003-01-20  3:52 William Lee Irwin III
  2003-01-20 11:57 ` pci_child_fixup() Ivan Kokshaysky
  0 siblings, 1 reply; 3+ messages in thread
From: William Lee Irwin III @ 2003-01-20  3:52 UTC (permalink / raw)
  To: ink; +Cc: linux-kernel, Martin.Bligh, akpm

Adds a fresh pci_fixup_child() hook for physical bus numbers in bus
number registers that don't match the bus numbers in the MP tables.
It basically allows for arbitrary bus number twiddling for children.

vs. 2.5.59-mm1

 arch/i386/pci/numa.c   |    9 +++++++++
 drivers/pci/probe.c    |    5 +----
 include/asm-i386/pci.h |   11 +++++++++++
 3 files changed, 21 insertions(+), 4 deletions(-)


diff -urpN mpc-2.5.59-1/arch/i386/pci/numa.c mpc-2.5.59-2/arch/i386/pci/numa.c
--- mpc-2.5.59-1/arch/i386/pci/numa.c	2003-01-19 19:01:38.000000000 -0800
+++ mpc-2.5.59-2/arch/i386/pci/numa.c	2003-01-19 19:42:30.000000000 -0800
@@ -88,6 +88,15 @@ static struct pci_ops pci_direct_conf1_m
 	.write	= pci_conf1_mq_write
 };
 
+void pci_child_fixup(struct pci_bus *parent, struct pci_bus *child, int buses)
+{
+	int quad = BUS2QUAD(parent->number);
+	child->primary		= QUADLOCAL2BUS(quad, buses         & 0xFF);
+	child->secondary	= QUADLOCAL2BUS(quad, (buses >> 8)  & 0xFF);
+	child->subordinate	= QUADLOCAL2BUS(quad, (buses >> 16) & 0xFF);
+	child->number		= child->secondary;
+}
+
 
 static void __devinit pci_fixup_i450nx(struct pci_dev *d)
 {
diff -urpN mpc-2.5.59-1/drivers/pci/probe.c mpc-2.5.59-2/drivers/pci/probe.c
--- mpc-2.5.59-1/drivers/pci/probe.c	2003-01-16 18:22:24.000000000 -0800
+++ mpc-2.5.59-2/drivers/pci/probe.c	2003-01-19 19:43:24.000000000 -0800
@@ -271,10 +271,7 @@ int __devinit pci_scan_bridge(struct pci
 		if (pass)
 			return max;
 		child = pci_add_new_bus(bus, dev, 0);
-		child->primary = buses & 0xFF;
-		child->secondary = (buses >> 8) & 0xFF;
-		child->subordinate = (buses >> 16) & 0xFF;
-		child->number = child->secondary;
+		pci_child_fixup(bus, child, buses);
 		cmax = pci_do_scan_bus(child);
 		if (cmax > max) max = cmax;
 	} else {
diff -urpN mpc-2.5.59-1/include/asm-i386/pci.h mpc-2.5.59-2/include/asm-i386/pci.h
--- mpc-2.5.59-1/include/asm-i386/pci.h	2003-01-16 18:22:04.000000000 -0800
+++ mpc-2.5.59-2/include/asm-i386/pci.h	2003-01-19 19:39:07.000000000 -0800
@@ -100,6 +100,17 @@ static inline int pci_controller_num(str
 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 			       enum pci_mmap_state mmap_state, int write_combine);
 
+#ifdef CONFIG_X86_NUMAQ
+void pci_child_fixup(struct pci_bus *, struct pci_bus *, int);
+#else
+static inline void pci_child_fixup(struct pci_bus *parent, struct pci_bus *child, int buses)
+{
+	child->primary		= buses & 0xFF;
+	child->secondary	= (buses >> 8) & 0xFF;
+	child->subordinate	= (buses >> 16) & 0xFF;
+	child->number		= child->secondary;
+}
+#endif
 #endif /* __KERNEL__ */
 
 /* implement the pci_ DMA API in terms of the generic device dma_ one */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pci_child_fixup()
  2003-01-20  3:52 pci_child_fixup() William Lee Irwin III
@ 2003-01-20 11:57 ` Ivan Kokshaysky
  2003-01-20 12:53   ` pci_child_fixup() William Lee Irwin III
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Kokshaysky @ 2003-01-20 11:57 UTC (permalink / raw)
  To: William Lee Irwin III, linux-kernel, Martin.Bligh, akpm

On Sun, Jan 19, 2003 at 07:52:17PM -0800, William Lee Irwin III wrote:
>  		child = pci_add_new_bus(bus, dev, 0);
> -		child->primary = buses & 0xFF;
> -		child->secondary = (buses >> 8) & 0xFF;
> -		child->subordinate = (buses >> 16) & 0xFF;
> -		child->number = child->secondary;
> +		pci_child_fixup(bus, child, buses);

The "bus" argument seems to be redundant. Why not use "child->parent"
just filled in by pci_add_new_bus() instead?

Ivan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pci_child_fixup()
  2003-01-20 11:57 ` pci_child_fixup() Ivan Kokshaysky
@ 2003-01-20 12:53   ` William Lee Irwin III
  0 siblings, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2003-01-20 12:53 UTC (permalink / raw)
  To: Ivan Kokshaysky; +Cc: linux-kernel, Martin.Bligh, akpm, greg

On Sun, Jan 19, 2003 at 07:52:17PM -0800, William Lee Irwin III wrote:
>>  		child = pci_add_new_bus(bus, dev, 0);
>> -		child->primary = buses & 0xFF;
>> -		child->secondary = (buses >> 8) & 0xFF;
>> -		child->subordinate = (buses >> 16) & 0xFF;
>> -		child->number = child->secondary;
>> +		pci_child_fixup(bus, child, buses);

On Mon, Jan 20, 2003 at 02:57:54PM +0300, Ivan Kokshaysky wrote:
> The "bus" argument seems to be redundant. Why not use "child->parent"
> just filled in by pci_add_new_bus() instead?
> Ivan.

Good point. Here's an adjusted patch. I added gregkh to the cc: list
in case he's interested (he generally seems to be wrt. PCI).


Thanks,
Bill


The NUMA-Q BIOS reports bus numbers different from the physical ones
programmed into PCI-PCI bridges etc. PCI config cycles (and almost
everything else) are meant to use translation tables handed to us by
the BIOS. No other extant i386 port has such a beast, and there's
currently no way to override bus numbers gotten from bus number
registers in a meaningful way; bus number conflicts error out prior to
any call into arch code. All of the IRQ routing, interrupt assignment,
IO-APIC, PCI bus, etc. etc. MP table entries use these numbers, so we're
stuck with them.

This provides a fixup hook so it's possible to override the standard
interpretation of the bus number registers in PCI-PCI bridges.

 arch/i386/pci/numa.c   |    9 +++++++++
 drivers/pci/probe.c    |    5 +----
 include/asm-i386/pci.h |   11 +++++++++++
 3 files changed, 21 insertions(+), 4 deletions(-)


diff -urpN mpc-2.5.59-1/arch/i386/pci/numa.c mpc-2.5.59-2/arch/i386/pci/numa.c
--- mpc-2.5.59-1/arch/i386/pci/numa.c	2003-01-19 19:01:38.000000000 -0800
+++ mpc-2.5.59-2/arch/i386/pci/numa.c	2003-01-20 04:37:02.000000000 -0800
@@ -88,6 +88,15 @@ static struct pci_ops pci_direct_conf1_m
 	.write	= pci_conf1_mq_write
 };
 
+void pci_child_fixup(struct pci_bus *child, int buses)
+{
+	int quad = BUS2QUAD(child->parent->number);
+	child->primary		= QUADLOCAL2BUS(quad, buses         & 0xFF);
+	child->secondary	= QUADLOCAL2BUS(quad, (buses >> 8)  & 0xFF);
+	child->subordinate	= QUADLOCAL2BUS(quad, (buses >> 16) & 0xFF);
+	child->number		= child->secondary;
+}
+
 
 static void __devinit pci_fixup_i450nx(struct pci_dev *d)
 {
diff -urpN mpc-2.5.59-1/drivers/pci/probe.c mpc-2.5.59-2/drivers/pci/probe.c
--- mpc-2.5.59-1/drivers/pci/probe.c	2003-01-16 18:22:24.000000000 -0800
+++ mpc-2.5.59-2/drivers/pci/probe.c	2003-01-20 04:37:32.000000000 -0800
@@ -271,10 +271,7 @@ int __devinit pci_scan_bridge(struct pci
 		if (pass)
 			return max;
 		child = pci_add_new_bus(bus, dev, 0);
-		child->primary = buses & 0xFF;
-		child->secondary = (buses >> 8) & 0xFF;
-		child->subordinate = (buses >> 16) & 0xFF;
-		child->number = child->secondary;
+		pci_child_fixup(child, buses);
 		cmax = pci_do_scan_bus(child);
 		if (cmax > max) max = cmax;
 	} else {
diff -urpN mpc-2.5.59-1/include/asm-i386/pci.h mpc-2.5.59-2/include/asm-i386/pci.h
--- mpc-2.5.59-1/include/asm-i386/pci.h	2003-01-16 18:22:04.000000000 -0800
+++ mpc-2.5.59-2/include/asm-i386/pci.h	2003-01-20 04:39:12.000000000 -0800
@@ -100,6 +100,17 @@ static inline int pci_controller_num(str
 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 			       enum pci_mmap_state mmap_state, int write_combine);
 
+#ifdef CONFIG_X86_NUMAQ
+void pci_child_fixup(struct pci_bus *, int);
+#else
+static inline void pci_child_fixup(struct pci_bus *child, int buses)
+{
+	child->primary		= buses & 0xFF;
+	child->secondary	= (buses >> 8) & 0xFF;
+	child->subordinate	= (buses >> 16) & 0xFF;
+	child->number		= child->secondary;
+}
+#endif
 #endif /* __KERNEL__ */
 
 /* implement the pci_ DMA API in terms of the generic device dma_ one */

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-20 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-20  3:52 pci_child_fixup() William Lee Irwin III
2003-01-20 11:57 ` pci_child_fixup() Ivan Kokshaysky
2003-01-20 12:53   ` pci_child_fixup() William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).