
On Fri, May 21, 2010 at 4:17 AM, Kumar Gala galak@kernel.crashing.org wrote:
#ifdef CONFIG_PCIE2
- pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_2, io_sel);
- pcie_configured = is_serdes_configured(PCIE2);
if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE2)) {
- set_next_law(CONFIG_SYS_PCIE2_MEM_PHYS, LAW_SIZE_512M,
- LAW_TRGT_IF_PCIE_2);
- set_next_law(CONFIG_SYS_PCIE2_IO_PHYS, LAW_SIZE_64K,
- LAW_TRGT_IF_PCIE_2);
SET_STD_PCIE_INFO(pci_info[num], 2);
Are you sure that pci_info needs to be an array? It looks as if pci_info[num] is only used inside the #ifdef block. That is, I think we can do this:
struct fsl_pci_info pci_info;
...
#ifdef CONFIG_PCIE3 pcie_configured = is_serdes_configured(PCIE3);
if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE3)) { set_next_law(CONFIG_SYS_PCIE3_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_3); set_next_law(CONFIG_SYS_PCIE3_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_3); SET_STD_PCIE_INFO(&pci_info, 3); pcie_ep = fsl_setup_hose(&pcie3_hose, pci_info.regs); printf(" PCIE3 connected to Slot 1 as %s (base addr %lx)\n", pcie_ep ? "Endpoint" : "Root Complex", pci_info.regs); first_free_busno = fsl_pci_init_port(&pci_info, &pcie3_hose, first_free_busno); } else { printf(" PCIE3: disabled\n"); } puts("\n"); #else
Each #ifdef CONFIG_PCIEx block is self-contained, with respect to pci_info. It appears that there's no need to remember pci_info[0] and use pci_info[1] for the next PCIE device.