From mboxrd@z Thu Jan 1 00:00:00 1970 From: Donald White Date: Sun, 18 May 2003 16:39:38 -0700 Subject: [U-Boot-Users] Please explain this code in drivers/pci.c Message-ID: <3EC819BA.2030500@asu.edu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Group, Please help me to understand the following code. It occurs in drivers/pci.c in the function pci_hose_config_device(). I have ported U-Boot 0.3.0 and HHL 2.0 to our custom MPC8265A board. It has one device on the PCI bus. The driver develop was wanting a specific memory space allocation for the device. So I created a PCI configuration table with the memory base of 0x90000000. The card wants 4 regions 0f 0x8000 bytes in size. The driver writer thinks this should be 0x90000000, 0x90008000, 0x90010000 and 0x90018000. This brings us to the code snippet: bar_size = ~(bar_response & PCI_BASE_ADDRESS_MEM_MASK) + 1; bar_value = mem; mem = ((mem - 1) | (bar_size - 1)) + 1; The value of bar_response is 0xffff8008 which looks good. This gives bar size of 0x8000 which also looks good. The value of mem is initially 0x90000000. So, (mem - 1) = 0x8fffffff and (bar_size - 1) = 0x7fff). When these are or'd one gets 0x8fffffff and adding 1 gives 0x90000000. This result is that the card is given 4 address bases all at 0x90000000. Thanks for any help, Don