Lines Matching refs:zbus

60 		zpci_setup_bus_resources(zdev, &zdev->zbus->resources);  in zpci_bus_prepare_device()
61 resource_list_for_each_entry_safe(window, n, &zdev->zbus->resources) { in zpci_bus_prepare_device()
63 pci_bus_add_resource(zdev->zbus->bus, res, 0); in zpci_bus_prepare_device()
86 pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); in zpci_bus_scan_device()
92 pci_bus_add_devices(zdev->zbus->bus); in zpci_bus_scan_device()
109 struct zpci_bus *zbus = zdev->zbus; in zpci_bus_remove_device() local
112 if (!zdev->zbus->bus) in zpci_bus_remove_device()
115 pdev = pci_get_slot(zbus->bus, zdev->devfn); in zpci_bus_remove_device()
143 int zpci_bus_scan_bus(struct zpci_bus *zbus) in zpci_bus_scan_bus() argument
149 zdev = zbus->function[devfn]; in zpci_bus_scan_bus()
158 pci_scan_child_bus(zbus->bus); in zpci_bus_scan_bus()
159 pci_bus_add_devices(zbus->bus); in zpci_bus_scan_bus()
172 struct zpci_bus *zbus = NULL; in zpci_bus_scan_busses() local
175 list_for_each_entry(zbus, &zbus_list, bus_next) { in zpci_bus_scan_busses()
176 zpci_bus_scan_bus(zbus); in zpci_bus_scan_busses()
192 static int zpci_bus_create_pci_bus(struct zpci_bus *zbus, struct zpci_dev *fr, struct pci_ops *ops) in zpci_bus_create_pci_bus() argument
201 zbus->domain_nr = domain; in zpci_bus_create_pci_bus()
202 zbus->multifunction = fr->rid_available; in zpci_bus_create_pci_bus()
203 zbus->max_bus_speed = fr->max_bus_speed; in zpci_bus_create_pci_bus()
209 bus = pci_create_root_bus(NULL, ZPCI_BUS_NR, ops, zbus, &zbus->resources); in zpci_bus_create_pci_bus()
211 zpci_free_domain(zbus->domain_nr); in zpci_bus_create_pci_bus()
215 zbus->bus = bus; in zpci_bus_create_pci_bus()
223 struct zpci_bus *zbus = container_of(kref, struct zpci_bus, kref); in zpci_bus_release() local
225 if (zbus->bus) { in zpci_bus_release()
227 pci_stop_root_bus(zbus->bus); in zpci_bus_release()
229 zpci_free_domain(zbus->domain_nr); in zpci_bus_release()
230 pci_free_resource_list(&zbus->resources); in zpci_bus_release()
232 pci_remove_root_bus(zbus->bus); in zpci_bus_release()
237 list_del(&zbus->bus_next); in zpci_bus_release()
239 kfree(zbus); in zpci_bus_release()
242 static void zpci_bus_put(struct zpci_bus *zbus) in zpci_bus_put() argument
244 kref_put(&zbus->kref, zpci_bus_release); in zpci_bus_put()
249 struct zpci_bus *zbus; in zpci_bus_get() local
252 list_for_each_entry(zbus, &zbus_list, bus_next) { in zpci_bus_get()
253 if (pchid == zbus->pchid) { in zpci_bus_get()
254 kref_get(&zbus->kref); in zpci_bus_get()
258 zbus = NULL; in zpci_bus_get()
261 return zbus; in zpci_bus_get()
266 struct zpci_bus *zbus; in zpci_bus_alloc() local
268 zbus = kzalloc(sizeof(*zbus), GFP_KERNEL); in zpci_bus_alloc()
269 if (!zbus) in zpci_bus_alloc()
272 zbus->pchid = pchid; in zpci_bus_alloc()
273 INIT_LIST_HEAD(&zbus->bus_next); in zpci_bus_alloc()
275 list_add_tail(&zbus->bus_next, &zbus_list); in zpci_bus_alloc()
278 kref_init(&zbus->kref); in zpci_bus_alloc()
279 INIT_LIST_HEAD(&zbus->resources); in zpci_bus_alloc()
281 zbus->bus_resource.start = 0; in zpci_bus_alloc()
282 zbus->bus_resource.end = ZPCI_BUS_NR; in zpci_bus_alloc()
283 zbus->bus_resource.flags = IORESOURCE_BUS; in zpci_bus_alloc()
284 pci_add_resource(&zbus->resources, &zbus->bus_resource); in zpci_bus_alloc()
286 return zbus; in zpci_bus_alloc()
298 zpci_iov_setup_virtfn(zdev->zbus, pdev, zdev->vfn); in pcibios_bus_add_device()
303 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) in zpci_bus_add_device() argument
307 if (zbus->function[zdev->devfn]) { in zpci_bus_add_device()
312 zdev->zbus = zbus; in zpci_bus_add_device()
313 zbus->function[zdev->devfn] = zdev; in zpci_bus_add_device()
316 if (zbus->multifunction && !zdev->rid_available) { in zpci_bus_add_device()
328 zbus->function[zdev->devfn] = NULL; in zpci_bus_add_device()
329 zdev->zbus = NULL; in zpci_bus_add_device()
336 struct zpci_bus *zbus = NULL; in zpci_bus_device_register() local
349 zbus = zpci_bus_get(zdev->pchid); in zpci_bus_device_register()
351 if (!zbus) { in zpci_bus_device_register()
352 zbus = zpci_bus_alloc(zdev->pchid); in zpci_bus_device_register()
353 if (!zbus) in zpci_bus_device_register()
357 if (!zbus->bus) { in zpci_bus_device_register()
362 rc = zpci_bus_create_pci_bus(zbus, zdev, ops); in zpci_bus_device_register()
367 rc = zpci_bus_add_device(zbus, zdev); in zpci_bus_device_register()
375 zpci_bus_put(zbus); in zpci_bus_device_register()
381 struct zpci_bus *zbus = zdev->zbus; in zpci_bus_device_unregister() local
384 zbus->function[zdev->devfn] = NULL; in zpci_bus_device_unregister()
385 zpci_bus_put(zbus); in zpci_bus_device_unregister()