Lines Matching full:cfg

31 	struct pci_config_window *cfg;  in pci_ecam_create()  local
39 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); in pci_ecam_create()
40 if (!cfg) in pci_ecam_create()
43 cfg->parent = dev; in pci_ecam_create()
44 cfg->ops = ops; in pci_ecam_create()
45 cfg->busr.start = busr->start; in pci_ecam_create()
46 cfg->busr.end = busr->end; in pci_ecam_create()
47 cfg->busr.flags = IORESOURCE_BUS; in pci_ecam_create()
48 bus_range = resource_size(&cfg->busr); in pci_ecam_create()
52 cfg->busr.end = busr->start + bus_range - 1; in pci_ecam_create()
54 cfgres, &cfg->busr, busr); in pci_ecam_create()
58 cfg->res.start = cfgres->start; in pci_ecam_create()
59 cfg->res.end = cfgres->end; in pci_ecam_create()
60 cfg->res.flags = IORESOURCE_MEM | IORESOURCE_BUSY; in pci_ecam_create()
61 cfg->res.name = "PCI ECAM"; in pci_ecam_create()
63 conflict = request_resource_conflict(&iomem_resource, &cfg->res); in pci_ecam_create()
67 &cfg->res, conflict->name, conflict); in pci_ecam_create()
72 cfg->winp = kcalloc(bus_range, sizeof(*cfg->winp), GFP_KERNEL); in pci_ecam_create()
73 if (!cfg->winp) in pci_ecam_create()
76 cfg->winp[i] = in pci_ecam_create()
79 if (!cfg->winp[i]) in pci_ecam_create()
83 cfg->win = pci_remap_cfgspace(cfgres->start, bus_range * bsz); in pci_ecam_create()
84 if (!cfg->win) in pci_ecam_create()
89 err = ops->init(cfg); in pci_ecam_create()
93 dev_info(dev, "ECAM at %pR for %pR\n", &cfg->res, &cfg->busr); in pci_ecam_create()
94 return cfg; in pci_ecam_create()
101 pci_ecam_free(cfg); in pci_ecam_create()
106 void pci_ecam_free(struct pci_config_window *cfg) in pci_ecam_free() argument
111 if (cfg->winp) { in pci_ecam_free()
112 for (i = 0; i < resource_size(&cfg->busr); i++) in pci_ecam_free()
113 if (cfg->winp[i]) in pci_ecam_free()
114 iounmap(cfg->winp[i]); in pci_ecam_free()
115 kfree(cfg->winp); in pci_ecam_free()
118 if (cfg->win) in pci_ecam_free()
119 iounmap(cfg->win); in pci_ecam_free()
121 if (cfg->res.parent) in pci_ecam_free()
122 release_resource(&cfg->res); in pci_ecam_free()
123 kfree(cfg); in pci_ecam_free()
133 struct pci_config_window *cfg = bus->sysdata; in pci_ecam_map_bus() local
134 unsigned int devfn_shift = cfg->ops->bus_shift - 8; in pci_ecam_map_bus()
138 if (busn < cfg->busr.start || busn > cfg->busr.end) in pci_ecam_map_bus()
141 busn -= cfg->busr.start; in pci_ecam_map_bus()
143 base = cfg->winp[busn]; in pci_ecam_map_bus()
145 base = cfg->win + (busn << cfg->ops->bus_shift); in pci_ecam_map_bus()