/* * Create a PCI config space window * - reserve mem region * - alloc struct pci_config_window with space for all mappings * - ioremap the config space
*/ staticstruct pci_config_window *arch_pci_ecam_create(struct device *dev, struct resource *cfgres, struct resource *busr, conststruct pci_ecam_ops *ops)
{ int bsz, bus_range, err; struct resource *conflict; struct pci_config_window *cfg;
if (busr->start > busr->end) return ERR_PTR(-EINVAL);
cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); if (!cfg) return ERR_PTR(-ENOMEM);
/* * Lookup the bus range for the domain in MCFG, and set up config space * mapping.
*/ staticstruct pci_config_window *
pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
{ int ret, bus_shift;
u16 seg = root->segment; struct device *dev = &root->device->dev; struct resource cfgres; struct resource *bus_res = &root->secondary; struct pci_config_window *cfg; conststruct pci_ecam_ops *ecam_ops;
ret = pci_mcfg_lookup(root, &cfgres, &ecam_ops); if (ret < 0) {
dev_err(dev, "%04x:%pR ECAM region not found, use default value\n", seg, bus_res);
ecam_ops = &loongson_pci_ecam_ops;
root->mcfg_addr = mcfg_addr_init(0);
}
bus = pci_find_bus(domain, busnum); if (bus) {
memcpy(bus->sysdata, info->cfg, sizeof(struct pci_config_window));
kfree(info);
kfree(root_ops);
} else { struct pci_bus *child;
bus = acpi_pci_root_create(root, root_ops,
&info->common, info->cfg); if (!bus) {
kfree(info);
kfree(root_ops); return NULL;
}
/* If we must preserve the resource configuration, claim now */
host = pci_find_host_bridge(bus); if (host->preserve_config)
pci_bus_claim_resources(bus);
/* * Assign whatever was left unassigned. If we didn't claim above, * this will reassign everything.
*/
pci_assign_unassigned_root_bus_resources(bus);
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.