ecam.c (0b104773b4f72ccd8af98a2f1efe69b174c344d3) | ecam.c (0c59c06a7c90390c3985c9acd58a73320781c15e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright 2016 Broadcom 4 */ 5 6#include <linux/device.h> 7#include <linux/io.h> 8#include <linux/kernel.h> --- 87 unchanged lines hidden (view full) --- 96err_exit_iomap: 97 dev_err(dev, "ECAM ioremap failed\n"); 98err_exit_malloc: 99 err = -ENOMEM; 100err_exit: 101 pci_ecam_free(cfg); 102 return ERR_PTR(err); 103} | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright 2016 Broadcom 4 */ 5 6#include <linux/device.h> 7#include <linux/io.h> 8#include <linux/kernel.h> --- 87 unchanged lines hidden (view full) --- 96err_exit_iomap: 97 dev_err(dev, "ECAM ioremap failed\n"); 98err_exit_malloc: 99 err = -ENOMEM; 100err_exit: 101 pci_ecam_free(cfg); 102 return ERR_PTR(err); 103} |
104EXPORT_SYMBOL_GPL(pci_ecam_create); |
|
104 105void pci_ecam_free(struct pci_config_window *cfg) 106{ 107 int i; 108 109 if (per_bus_mapping) { 110 if (cfg->winp) { 111 for (i = 0; i < resource_size(&cfg->busr); i++) --- 4 unchanged lines hidden (view full) --- 116 } else { 117 if (cfg->win) 118 iounmap(cfg->win); 119 } 120 if (cfg->res.parent) 121 release_resource(&cfg->res); 122 kfree(cfg); 123} | 105 106void pci_ecam_free(struct pci_config_window *cfg) 107{ 108 int i; 109 110 if (per_bus_mapping) { 111 if (cfg->winp) { 112 for (i = 0; i < resource_size(&cfg->busr); i++) --- 4 unchanged lines hidden (view full) --- 117 } else { 118 if (cfg->win) 119 iounmap(cfg->win); 120 } 121 if (cfg->res.parent) 122 release_resource(&cfg->res); 123 kfree(cfg); 124} |
125EXPORT_SYMBOL_GPL(pci_ecam_free); |
|
124 125/* 126 * Function to implement the pci_ops ->map_bus method 127 */ 128void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn, 129 int where) 130{ 131 struct pci_config_window *cfg = bus->sysdata; --- 6 unchanged lines hidden (view full) --- 138 139 busn -= cfg->busr.start; 140 if (per_bus_mapping) 141 base = cfg->winp[busn]; 142 else 143 base = cfg->win + (busn << cfg->ops->bus_shift); 144 return base + (devfn << devfn_shift) + where; 145} | 126 127/* 128 * Function to implement the pci_ops ->map_bus method 129 */ 130void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn, 131 int where) 132{ 133 struct pci_config_window *cfg = bus->sysdata; --- 6 unchanged lines hidden (view full) --- 140 141 busn -= cfg->busr.start; 142 if (per_bus_mapping) 143 base = cfg->winp[busn]; 144 else 145 base = cfg->win + (busn << cfg->ops->bus_shift); 146 return base + (devfn << devfn_shift) + where; 147} |
148EXPORT_SYMBOL_GPL(pci_ecam_map_bus); |
|
146 147/* ECAM ops */ 148const struct pci_ecam_ops pci_generic_ecam_ops = { 149 .bus_shift = 20, 150 .pci_ops = { 151 .map_bus = pci_ecam_map_bus, 152 .read = pci_generic_config_read, 153 .write = pci_generic_config_write, 154 } 155}; | 149 150/* ECAM ops */ 151const struct pci_ecam_ops pci_generic_ecam_ops = { 152 .bus_shift = 20, 153 .pci_ops = { 154 .map_bus = pci_ecam_map_bus, 155 .read = pci_generic_config_read, 156 .write = pci_generic_config_write, 157 } 158}; |
159EXPORT_SYMBOL_GPL(pci_generic_ecam_ops); |
|
156 157#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) 158/* ECAM ops for 32-bit access only (non-compliant) */ 159const struct pci_ecam_ops pci_32b_ops = { 160 .bus_shift = 20, 161 .pci_ops = { 162 .map_bus = pci_ecam_map_bus, 163 .read = pci_generic_config_read32, 164 .write = pci_generic_config_write32, 165 } 166}; 167#endif | 160 161#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) 162/* ECAM ops for 32-bit access only (non-compliant) */ 163const struct pci_ecam_ops pci_32b_ops = { 164 .bus_shift = 20, 165 .pci_ops = { 166 .map_bus = pci_ecam_map_bus, 167 .read = pci_generic_config_read32, 168 .write = pci_generic_config_write32, 169 } 170}; 171#endif |