Skip to contentSkip to conversation

Patch to drivers/pci.c

U-Boot-Users Donald White 2 participants 2 messages May 22, 2003 – May 27, 2003

lore
Share & tools
lore
#0 lore raw

Following is a patch to drivers/pci.c. It fixes the calculation of the base address in pci_hose_config_device().

drivers/pci.c +8 -2
diff -urN u-boot-0.3.0/drivers/pci.c u-boot-0.3.0-zpc1900/drivers/pci.c
@@ -329,9 +329,12 @@
  		if (bar_response & PCI_BASE_ADDRESS_SPACE)
  		{
  			bar_size = ~(bar_response & PCI_BASE_ADDRESS_IO_MASK) + 1;
-			bar_value = io;
 
+			/* round up region base address to a multiple of size */
  			io = ((io - 1) | (bar_size - 1)) + 1;
+			bar_value = io;
+			/* compute new region base address */
+			io = io + bar_size;			
  		}
  		else
  		{
@@ -340,9 +343,12 @@
  				found_mem64 = 1;
 
  			bar_size = ~(bar_response & PCI_BASE_ADDRESS_MEM_MASK) + 1;
-			bar_value = mem;
 
+			/* round up region base address to multiple of size */
  			mem = ((mem - 1) | (bar_size - 1)) + 1;
+			bar_value = mem;
+			/* compute new region base address */
+			mem = mem + bar_size;
  		}
 
  		/* Write it out and update our limit */
#1 lore raw
Quoted 2 lines · In message <[email protected]> you wrote:

Following is a patch to drivers/pci.c. It fixes the calculation of the base address in pci_hose_config_device().

Added, thanks. [Will show up in CVS soon.]

Best regards,

Wolfgang Denk

Signature · 2 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de