[U-Boot-Users] [PATCH][RFC] pci: Add check PCI bridge class (Re: [PATCH][RFC] pci: Remove CONFIG_PCI_SKIP_HOST_BRIDGE and Add check PCI class of host bridge)

Nobuhiro Iwamatsu iwamatsu.nobuhiro at renesas.com
Tue Jun 17 08:39:30 CEST 2008


Nobuhiro Iwamatsu wrote:
> Hi, all.
> 
> 2008/5/13 Wolfgang Denk <wd at denx.de>:
>> In message <20080512224352.a3823c7a.iwamatsu at nigauri.org> you wrote:
>>> I made the patch that applied your comment.
>>> This patch skips PCI bridge ( Class code : 0x06XX).
>>>
>>> Could you check this patch?
>> Thanks - but note that this will not make it in the v1.3.3 release in
>> any case.
> 
> Does the developer and Board maintainer get a problem with this patch?
> Would you test this patch?

Sorry , I forgot attached patch.

Best regards,
  Nobuhiro
---
In current source code, when the device number of PCI is 0, process PCI
bridge without fail. However, when the device number is 0, it is not PCI
always bridge. There are times when device of PCI allocates.

This patch add check PCI bridge class.

  - 0x0604 PCI to AGP bridge / PCI to PCI bridge
  - 0x0605 PCI to PCMCIA bridge
  - 0x0606 Nu Bus bridge
  - 0x0607 PCMCIA CardBus controller
  - 0x0608 RACEWay bridge

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro at renesas.com>
---
  drivers/pci/pci.c |   23 +++++++++++++++--------
  1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b3ae3b1..39ca130 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -425,14 +425,21 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
  	     dev <  PCI_BDF(bus,PCI_MAX_PCI_DEVICES-1,PCI_MAX_PCI_FUNCTIONS-1);
  	     dev += PCI_BDF(0,0,1))
  	{
+		/* Read class register */
+		pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class);
  		/* Skip our host bridge */
-		if ( dev == PCI_BDF(hose->first_busno,0,0) ) {
-#if defined(CONFIG_PCI_CONFIG_HOST_BRIDGE)              /* don't skip host bridge */
-			/*
-			 * Only skip hostbridge configuration if "pciconfighost" is not set
-			 */
-			if (getenv("pciconfighost") == NULL) {
-				continue; /* Skip our host bridge */
+		if (dev == PCI_BDF(hose->first_busno,0,0)) {
+			/* CPU to PCI bridge check */
+			if (((class & 0xFF00) == 0x0600) && (class != 0x0680))
+#if defined(CONFIG_PCI_CONFIG_HOST_BRIDGE) /* don't skip host bridge */
+			{
+				/*
+				 * Only skip hostbridge configuration if
+				 * "pciconfighost" is not set
+				 */
+				if (getenv("pciconfighost") == NULL) {
+					continue; /* Skip our host bridge */
+				}
  			}
  #else
  			continue; /* Skip our host bridge */
@@ -474,7 +481,7 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)

  #ifdef CONFIG_PCI_SCAN_SHOW
  			/* Skip our host bridge */
-			if ( dev != PCI_BDF(hose->first_busno,0,0) ) {
+			if (((class & 0xFF00) != 0x0600) || (class == 0x0680)) {
  			    unsigned char int_line;

  			    pci_hose_read_config_byte(hose, dev, PCI_INTERRUPT_LINE,
-- 1.5.5.1





More information about the U-Boot mailing list