فهرست منبع

Fixed PCI indirect config ops to handle multiple PCI controllers
We need to adjust the bus number we are trying to access based
on which PCI controller its on
Patch by Kumar Gala 12 Jan 2006

Kumar Gala 19 سال پیش
والد
کامیت
dffb70f330
2فایلهای تغییر یافته به همراه21 افزوده شده و 0 حذف شده
  1. 5 0
      CHANGELOG
  2. 16 0
      drivers/pci_indirect.c

+ 5 - 0
CHANGELOG

@@ -2,6 +2,11 @@
 Changes since U-Boot 1.1.4:
 ======================================================================
 
+* Fixed PCI indirect config ops to handle multiple PCI controllers
+  We need to adjust the bus number we are trying to access based
+  on which PCI controller its on
+  Patch by Kumar Gala 12 Jan 2006
+
 * Report back PCI bus when doing table based device config
   Patch by Kumar Gala 11 Jan 2006
 

+ 16 - 0
drivers/pci_indirect.c

@@ -36,6 +36,10 @@ static int								 \
 indirect_##rw##_config_##size(struct pci_controller *hose, 		 \
 			      pci_dev_t dev, int offset, type val)	 \
 {									 \
+	u32 b, d,f;							 \
+	b = PCI_BUS(dev); d = PCI_DEV(dev); f = PCI_FUNC(dev);		 \
+	b = b - hose->first_busno;					 \
+	dev = PCI_BDF(b, d, f);						 \
 	out_le32(hose->cfg_addr, dev | (offset & 0xfc) | 0x80000000); 	 \
 	sync();								 \
 	cfg_##rw(val, hose->cfg_data + (offset & mask), type, op);	 \
@@ -47,6 +51,10 @@ static int                                                               \
 indirect_##rw##_config_##size(struct pci_controller *hose,               \
 			      pci_dev_t dev, int offset, type val)       \
 {                                                                        \
+	u32 b, d,f;							 \
+	b = PCI_BUS(dev); d = PCI_DEV(dev); f = PCI_FUNC(dev);		 \
+	b = b - hose->first_busno;					 \
+	dev = PCI_BDF(b, d, f);						 \
 	*(hose->cfg_addr) = dev | (offset & 0xfc) | 0x80000000;          \
 	sync();                                                          \
 	cfg_##rw(val, hose->cfg_data + (offset & mask), type, op);       \
@@ -58,6 +66,10 @@ static int								 \
 indirect_##rw##_config_##size(struct pci_controller *hose, 		 \
 			      pci_dev_t dev, int offset, type val)	 \
 {									 \
+	u32 b, d,f;							 \
+	b = PCI_BUS(dev); d = PCI_DEV(dev); f = PCI_FUNC(dev);		 \
+	b = b - hose->first_busno;					 \
+	dev = PCI_BDF(b, d, f);						 \
 	if (PCI_BUS(dev) > 0)                                            \
 		out_le32(hose->cfg_addr, dev | (offset & 0xfc) | 0x80000001); \
 	else                                                             \
@@ -71,6 +83,10 @@ static int								 \
 indirect_##rw##_config_##size(struct pci_controller *hose, 		 \
 			      pci_dev_t dev, int offset, type val)	 \
 {									 \
+	u32 b, d,f;							 \
+	b = PCI_BUS(dev); d = PCI_DEV(dev); f = PCI_FUNC(dev);		 \
+	b = b - hose->first_busno;					 \
+	dev = PCI_BDF(b, d, f);						 \
 	out_le32(hose->cfg_addr, dev | (offset & 0xfc) | 0x80000000); 	 \
 	cfg_##rw(val, hose->cfg_data + (offset & mask), type, op);	 \
 	return 0;    					 		 \