Index: sys/arm/mv/mv_pci.c =================================================================== --- sys/arm/mv/mv_pci.c +++ sys/arm/mv/mv_pci.c @@ -420,21 +420,29 @@ { struct mv_pcib_softc *sc; phandle_t node, parnode; - uint32_t val, unit, reg0; - int err, bus, devfn; + uint32_t val, reg0; + int err, bus, devfn, port_id; sc = device_get_softc(self); sc->sc_dev = self; - unit = fdt_get_unit(self); - node = ofw_bus_get_node(self); parnode = OF_parent(node); + + if (OF_getencprop(node, "port-id", &(port_id), + sizeof(port_id)) <= 0) { + /* If port-id does not exist in FDT set value to 0 */ + if (!OF_hasprop(node, "port-id")) + port_id = 0; + else + return(ENXIO); + } + if (fdt_is_compatible(node, "mrvl,pcie")) { sc->sc_type = MV_TYPE_PCIE; - sc->sc_win_target = MV_WIN_PCIE_TARGET(unit); - sc->sc_mem_win_attr = MV_WIN_PCIE_MEM_ATTR(unit); - sc->sc_io_win_attr = MV_WIN_PCIE_IO_ATTR(unit); + sc->sc_win_target = MV_WIN_PCIE_TARGET(port_id); + sc->sc_mem_win_attr = MV_WIN_PCIE_MEM_ATTR(port_id); + sc->sc_io_win_attr = MV_WIN_PCIE_IO_ATTR(port_id); } else if (fdt_is_compatible(node, "mrvl,pci")) { sc->sc_type = MV_TYPE_PCI; sc->sc_win_target = MV_WIN_PCI_TARGET; @@ -477,7 +485,7 @@ /* * Enable PCIE device. */ - mv_pcib_enable(sc, unit); + mv_pcib_enable(sc, port_id); /* * Memory management.