linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] PCI: Add is_bridge to pci_dev to allow fixups to disable bridge functionality.
@ 2004-10-19 11:22 David Vrabel
  2004-10-30  3:23 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: David Vrabel @ 2004-10-19 11:22 UTC (permalink / raw)
  To: Linux Kernel; +Cc: greg

Hi,

This patch allows device fixups to force the PCI subsystem to ignore 
bridges and hence not allocate resources to them.

I have an IXP425 (ARM) board with a CardBus controller on it (of which 
only the PC card interfaces are used).  The problem is that the PCI 
memory window is too small to fit in all the bridge resources and the 
rest of the PCI devices and up being unconfigured.  With this patch, and 
a fixup to clear is_bridge, this doesn't happen.

The plan was to make the CardBus driver (drivers/pcmcia/yenta_socket.c) 
honour the is_bridge flag and not bother with CardBus stuff if it's cleared.

2004-10-19  David Vrabel <dvrabel@arcom.com>

	* Add is_bridge to struct pci_dev to allow PCI device fixups to
	disable bridge functionality.

Index: linux-2.6-armbe/drivers/pci/probe.c
===================================================================
--- linux-2.6-armbe.orig/drivers/pci/probe.c	2004-10-14 
11:26:38.000000000 +0100
+++ linux-2.6-armbe/drivers/pci/probe.c	2004-10-19 12:00:00.000000000 +0100
@@ -610,6 +610,8 @@
  	dev->devfn = devfn;
  	dev->hdr_type = hdr_type & 0x7f;
  	dev->multifunction = !!(hdr_type & 0x80);
+	dev->is_bridge = (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
+			  || dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
  	dev->vendor = l & 0xffff;
  	dev->device = (l >> 16) & 0xffff;
  	dev->cfg_size = pci_cfg_space_size(dev);
@@ -718,8 +720,7 @@
  	pcibios_fixup_bus(bus);
  	for (pass=0; pass < 2; pass++)
  		list_for_each_entry(dev, &bus->devices, bus_list) {
-			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+			if  (dev->is_bridge)
  				max = pci_scan_bridge(bus, dev, max, pass);
  		}

Index: linux-2.6-armbe/include/linux/pci.h
===================================================================
--- linux-2.6-armbe.orig/include/linux/pci.h	2004-10-14 
11:26:38.000000000 +0100
+++ linux-2.6-armbe/include/linux/pci.h	2004-10-14 11:43:24.000000000 +0100
@@ -532,6 +532,7 @@
  	/* These fields are used by common fixups */
  	unsigned int	transparent:1;	/* Transparent PCI bridge */
  	unsigned int	multifunction:1;/* Part of multi-function device */
+	unsigned int	is_bridge:1;	/* A PCI or CardBus bridge */
  	/* keep track of device state */
  	unsigned int	is_enabled:1;	/* pci_enable_device has been called */
  	unsigned int	is_busmaster:1; /* device is busmaster */

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

* Re: [patch] PCI: Add is_bridge to pci_dev to allow fixups to disable bridge functionality.
  2004-10-19 11:22 [patch] PCI: Add is_bridge to pci_dev to allow fixups to disable bridge functionality David Vrabel
@ 2004-10-30  3:23 ` Greg KH
  2004-11-01 10:59   ` David Vrabel
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2004-10-30  3:23 UTC (permalink / raw)
  To: David Vrabel; +Cc: Linux Kernel

On Tue, Oct 19, 2004 at 12:22:49PM +0100, David Vrabel wrote:
> Hi,
> 
> This patch allows device fixups to force the PCI subsystem to ignore 
> bridges and hence not allocate resources to them.
> 
> I have an IXP425 (ARM) board with a CardBus controller on it (of which 
> only the PC card interfaces are used).  The problem is that the PCI 
> memory window is too small to fit in all the bridge resources and the 
> rest of the PCI devices and up being unconfigured.  With this patch, and 
> a fixup to clear is_bridge, this doesn't happen.
> 
> The plan was to make the CardBus driver (drivers/pcmcia/yenta_socket.c) 
> honour the is_bridge flag and not bother with CardBus stuff if it's cleared.

But why can't any code that wants to check this, just look at the
dev->hdr_type instead?  I don't think we need to add a new bit for this
because of that, right?

> Index: linux-2.6-armbe/drivers/pci/probe.c
> ===================================================================
> --- linux-2.6-armbe.orig/drivers/pci/probe.c	2004-10-14 
> 11:26:38.000000000 +0100
> +++ linux-2.6-armbe/drivers/pci/probe.c	2004-10-19 
> 12:00:00.000000000 +0100

Also, your patch was linewrapped :(

thanks,

greg k-h

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

* Re: [patch] PCI: Add is_bridge to pci_dev to allow fixups to disable bridge functionality.
  2004-10-30  3:23 ` Greg KH
@ 2004-11-01 10:59   ` David Vrabel
  2004-11-01 11:34     ` Russell King
  0 siblings, 1 reply; 4+ messages in thread
From: David Vrabel @ 2004-11-01 10:59 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

Greg KH wrote:
> On Tue, Oct 19, 2004 at 12:22:49PM +0100, David Vrabel wrote:
> 
>>The plan was to make the CardBus driver (drivers/pcmcia/yenta_socket.c) 
>>honour the is_bridge flag and not bother with CardBus stuff if it's cleared.
> 
> But why can't any code that wants to check this, just look at the
> dev->hdr_type instead?  I don't think we need to add a new bit for this
> because of that, right?

Using the is_bridge flag allows PCI device fixups to disable the CardBus 
portion of the driver.  And you obviously can't tweak the hdr_type since 
the device header is still a CardBus/bridge type header.

e.g., I have:

static void __devinit pci_fixup_mercury_pci1520(struct pci_dev *dev)
{
         if (!machine_is_arcom_mercury())
                 return;

         dev->is_bridge = 0;
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, 
pci_fixup_mercury_pci1520);

> Also, your patch was linewrapped :(

Hmm.  Looks fine here.  I've attached it instead this time.

David Vrabel
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/

[-- Attachment #2: pci-allow-is_bridge-fixup --]
[-- Type: text/plain, Size: 1604 bytes --]

Index: linux-2.6-armbe/drivers/pci/probe.c
===================================================================
--- linux-2.6-armbe.orig/drivers/pci/probe.c	2004-10-14 11:26:38.000000000 +0100
+++ linux-2.6-armbe/drivers/pci/probe.c	2004-10-19 12:00:00.000000000 +0100
@@ -610,6 +610,8 @@
 	dev->devfn = devfn;
 	dev->hdr_type = hdr_type & 0x7f;
 	dev->multifunction = !!(hdr_type & 0x80);
+	dev->is_bridge = (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
+			  || dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
 	dev->vendor = l & 0xffff;
 	dev->device = (l >> 16) & 0xffff;
 	dev->cfg_size = pci_cfg_space_size(dev);
@@ -718,8 +720,7 @@
 	pcibios_fixup_bus(bus);
 	for (pass=0; pass < 2; pass++)
 		list_for_each_entry(dev, &bus->devices, bus_list) {
-			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+			if  (dev->is_bridge)
 				max = pci_scan_bridge(bus, dev, max, pass);
 		}
 
Index: linux-2.6-armbe/include/linux/pci.h
===================================================================
--- linux-2.6-armbe.orig/include/linux/pci.h	2004-10-14 11:26:38.000000000 +0100
+++ linux-2.6-armbe/include/linux/pci.h	2004-10-14 11:43:24.000000000 +0100
@@ -532,6 +532,7 @@
 	/* These fields are used by common fixups */
 	unsigned int	transparent:1;	/* Transparent PCI bridge */
 	unsigned int	multifunction:1;/* Part of multi-function device */
+	unsigned int	is_bridge:1;	/* A PCI or CardBus bridge */
 	/* keep track of device state */
 	unsigned int	is_enabled:1;	/* pci_enable_device has been called */
 	unsigned int	is_busmaster:1; /* device is busmaster */

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

* Re: [patch] PCI: Add is_bridge to pci_dev to allow fixups to disable bridge functionality.
  2004-11-01 10:59   ` David Vrabel
@ 2004-11-01 11:34     ` Russell King
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King @ 2004-11-01 11:34 UTC (permalink / raw)
  To: David Vrabel; +Cc: Greg KH, Linux Kernel

On Mon, Nov 01, 2004 at 10:59:13AM +0000, David Vrabel wrote:
> Greg KH wrote:
> > On Tue, Oct 19, 2004 at 12:22:49PM +0100, David Vrabel wrote:
> > 
> >>The plan was to make the CardBus driver (drivers/pcmcia/yenta_socket.c) 
> >>honour the is_bridge flag and not bother with CardBus stuff if it's cleared.
> > 
> > But why can't any code that wants to check this, just look at the
> > dev->hdr_type instead?  I don't think we need to add a new bit for this
> > because of that, right?
> 
> Using the is_bridge flag allows PCI device fixups to disable the CardBus 
> portion of the driver.  And you obviously can't tweak the hdr_type since 
> the device header is still a CardBus/bridge type header.

Why not make the PCI spaces for cardbus bridges configurable?  Eg,

cardbusmem=1M cardbusio=8K

?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

end of thread, other threads:[~2004-11-01 11:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19 11:22 [patch] PCI: Add is_bridge to pci_dev to allow fixups to disable bridge functionality David Vrabel
2004-10-30  3:23 ` Greg KH
2004-11-01 10:59   ` David Vrabel
2004-11-01 11:34     ` Russell King

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).