Example #1
0
File: yucca.c Project: 274914765/C
static void __init
yucca_setup_hoses(void)
{
    struct pci_controller *hose;
    char name[20];
    int i;

    if (0 && ppc440spe_init_pcie()) {
        printk(KERN_WARNING "PPC440SPe PCI Express initialization failed\n");
        return;
    }

    for (i = 0; i <= 2; ++i) {
        if (!yucca_pcie_card_present(i))
            continue;

        printk(KERN_INFO "PCIE%d: card present\n", i);
        yucca_setup_pcie_fpga_rootpoint(i);
        if (ppc440spe_init_pcie_rootport(i)) {
            printk(KERN_WARNING "PCIE%d: initialization failed\n", i);
            continue;
        }

        hose = pcibios_alloc_controller();
        if (!hose)
            return;

        sprintf(name, "PCIE%d host bridge", i);
        pci_init_resource(&hose->io_resource,
                  YUCCA_PCIX_LOWER_IO,
                  YUCCA_PCIX_UPPER_IO,
                  IORESOURCE_IO,
                  name);

        hose->mem_space.start = YUCCA_PCIE_LOWER_MEM +
            i * YUCCA_PCIE_MEM_SIZE;
        hose->mem_space.end   = hose->mem_space.start +
            YUCCA_PCIE_MEM_SIZE - 1;

        pci_init_resource(&hose->mem_resources[0],
                  hose->mem_space.start,
                  hose->mem_space.end,
                  IORESOURCE_MEM,
                  name);

        hose->first_busno = 0;
        hose->last_busno  = 15;
        hose_type[hose->index] = HOSE_PCIE0 + i;

        ppc440spe_setup_pcie(hose, i);
        hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
    }

    ppc_md.pci_swizzle = common_swizzle;
    ppc_md.pci_map_irq = yucca_map_irq;
}
Example #2
0
static void __init
yucca_setup_hoses(void)
{
	struct pci_controller *hose;
	char name[20];
	enum yucca_hoses hs;
	int bus_no = 0;

	for (hs = HOSE_PCIX; hs < HOSE_MAX; ++hs) {
		if (is_pcie_hose(hs)) {
			if (!yucca_pcie_card_present(pcie_hose_num(hs)))
				continue;

			pr_debug("PCIE%d: card present\n", pcie_hose_num(hs));

			yucca_setup_pcie_fpga_root_or_endpoint(pcie_hose_num(hs));
			if (ppc440spe_init_pcie_root_or_endport(pcie_hose_num(hs))) {
				printk(KERN_ERR "PCIE%d: initialization "
						"failed\n", pcie_hose_num(hs));
				continue;
			}
		}

		hose = pcibios_alloc_controller();
		if (!hose)
			return;

		sprintf(name, "PCI%s%d host bridge",
				is_pcix_hose(hs) ? "X" : "E",
				is_pcie_hose(hs) ?  pcie_hose_num(hs) : 0
				);

		pci_init_resource(&hose->io_resource,
				  YUCCA_PCIX_LOWER_IO,
				  YUCCA_PCIX_UPPER_IO,
				  IORESOURCE_IO,
				  name);

		if (is_pcix_hose(hs)) {
			hose->mem_space.start = YUCCA_PCIX_LOWER_MEM;
			hose->mem_space.end   = hose->mem_space.start +
				YUCCA_PCIX_MEM_SIZE - 1;

		} else {
			hose->mem_space.start = YUCCA_PCIE_LOWER_MEM +
				pcie_hose_num(hs) * YUCCA_PCIE_MEM_SIZE;
			hose->mem_space.end   = hose->mem_space.start +
				YUCCA_PCIE_MEM_SIZE - 1;
		}

		pci_init_resource(&hose->mem_resources[0],
				  hose->mem_space.start,
				  hose->mem_space.end,
				  IORESOURCE_MEM,
				  name);

		hose->first_busno = bus_no;
		hose->last_busno  = 0xFF;
		hose_type[hose->index] = hs;

		if (is_pcix_hose(hs)) {
			hose->io_space.start = YUCCA_PCIX_LOWER_IO;
			hose->io_space.end = YUCCA_PCIX_UPPER_IO;
			isa_io_base =
				(unsigned long)
					ioremap64(PCIX0_IO_BASE, PCIX_IO_SIZE);
			hose->io_base_virt = (void *)isa_io_base;

			ppc440spe_setup_pcix(hose);

			setup_indirect_pci(hose, PCIX0_CFGA, PCIX0_CFGD);
			hose->set_cfg_type = 1;
		} else {
			if(ppc440spe_setup_pcie(hose, pcie_hose_num(hs)) != 0)
			{
				printk(KERN_WARNING"PCIE setup failed for hose no %d\n",
						pcie_hose_num(hs));
				continue;
			}
		}

		hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
		bus_no = hose->last_busno + 1;
		pr_debug("%s: resources allocated\n", name);
	}

	ppc_md.pci_swizzle = common_swizzle;
	ppc_md.pci_map_irq = yucca_map_irq;
}