// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2001 Dave Engebretsen, IBM Corporation * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM * * pSeries specific routines for PCI.
*/
vf_pe_array = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); if (!vf_pe_array) return -ENOMEM;
pdn = pci_get_pdn(pdev); /* create firmware structure to associate pes */ for (vf_index = 0; vf_index < num_vfs; vf_index++) {
pdn->pe_num_map[vf_index] = IODA_INVALID_PE; for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
res = &pdev->resource[i + PCI_IOV_RESOURCES]; if (!res->parent) continue;
size = pcibios_iov_resource_alignment(pdev, i +
PCI_IOV_RESOURCES);
vf_pe_array[vf_index].bar =
cpu_to_be64(res->start + size * vf_index);
vf_pe_array[vf_index].rid =
cpu_to_be16((pci_iov_virtfn_bus(pdev, vf_index)
<< 8) | pci_iov_virtfn_devfn(pdev,
vf_index));
vf_pe_array[vf_index].pe_num =
cpu_to_be16(IODA_INVALID_PE);
}
}
rc = pseries_send_map_pe(pdev, num_vfs, vf_pe_array); /* Only zero is success */ if (!rc) for (vf_index = 0; vf_index < num_vfs; vf_index++)
pseries_set_pe_num(pdev, vf_index,
vf_pe_array[vf_index].pe_num);
/* Anything other than zero is failure */ if (rc) {
dev_err(&pdev->dev, "Failure to enable sriov: %x\n", rc);
kfree(pdn->pe_num_map);
} else {
pci_vf_drivers_autoprobe(pdev, false);
}
/* * Assume the winbond 82c105 is the IDE controller on a * p610/p615/p630. We should probably be more careful in case * someone tries to plug in a similar adapter.
*/ staticvoid fixup_winbond_82c105(struct pci_dev* dev)
{ struct resource *r; unsignedint reg;
if (!machine_is(pseries)) return;
printk("Using INTC for W82c105 IDE controller.\n");
pci_read_config_dword(dev, 0x40, ®); /* Enable LEGIRQ to use INTC instead of ISA interrupts */
pci_write_config_dword(dev, 0x40, reg | (1<<11));
pci_dev_for_each_resource(dev, r) { /* zap the 2nd function of the winbond chip */ if (dev->bus->number == 0 && dev->devfn == 0x81 &&
r->flags & IORESOURCE_IO)
r->flags &= ~IORESOURCE_IO; if (r->start == 0 && r->end) {
r->flags = 0;
r->end = 0;
}
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
fixup_winbond_82c105);
staticenum pci_bus_speed prop_to_pci_speed(u32 prop)
{ switch (prop) { case 0x01: return PCIE_SPEED_2_5GT; case 0x02: return PCIE_SPEED_5_0GT; case 0x04: return PCIE_SPEED_8_0GT; case 0x08: return PCIE_SPEED_16_0GT; case 0x10: return PCIE_SPEED_32_0GT; default:
pr_debug("Unexpected PCI link speed property value\n"); return PCI_SPEED_UNKNOWN;
}
}
int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
{ struct device_node *dn, *pdn; struct pci_bus *bus;
u32 pcie_link_speed_stats[2]; int rc;
bus = bridge->bus;
/* Rely on the pcibios_free_controller_deferred() callback. */
pci_set_host_bridge_release(bridge, pcibios_free_controller_deferred,
(void *) pci_bus_to_host(bus));
dn = pcibios_get_phb_of_node(bus); if (!dn) return 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.