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
148 if (!zbus->function[0]) in zpci_bus_scan_bus()
152 zdev = zbus->function[devfn]; in zpci_bus_scan_bus()
161 pci_scan_child_bus(zbus->bus); in zpci_bus_scan_bus()
162 pci_bus_add_devices(zbus->bus); in zpci_bus_scan_bus()
175 struct zpci_bus *zbus = NULL; in zpci_bus_scan_busses() local
178 list_for_each_entry(zbus, &zbus_list, bus_next) { in zpci_bus_scan_busses()
179 zpci_bus_scan_bus(zbus); in zpci_bus_scan_busses()
195 static int zpci_bus_create_pci_bus(struct zpci_bus *zbus, struct zpci_dev *f0, struct pci_ops *ops) in zpci_bus_create_pci_bus() argument
204 zbus->domain_nr = domain; in zpci_bus_create_pci_bus()
205 zbus->multifunction = f0->rid_available; in zpci_bus_create_pci_bus()
206 zbus->max_bus_speed = f0->max_bus_speed; in zpci_bus_create_pci_bus()
212 bus = pci_create_root_bus(NULL, ZPCI_BUS_NR, ops, zbus, &zbus->resources); in zpci_bus_create_pci_bus()
214 zpci_free_domain(zbus->domain_nr); in zpci_bus_create_pci_bus()
218 zbus->bus = bus; in zpci_bus_create_pci_bus()
226 struct zpci_bus *zbus = container_of(kref, struct zpci_bus, kref); in zpci_bus_release() local
228 if (zbus->bus) { in zpci_bus_release()
230 pci_stop_root_bus(zbus->bus); in zpci_bus_release()
232 zpci_free_domain(zbus->domain_nr); in zpci_bus_release()
233 pci_free_resource_list(&zbus->resources); in zpci_bus_release()
235 pci_remove_root_bus(zbus->bus); in zpci_bus_release()
240 list_del(&zbus->bus_next); in zpci_bus_release()
242 kfree(zbus); in zpci_bus_release()
245 static void zpci_bus_put(struct zpci_bus *zbus) in zpci_bus_put() argument
247 kref_put(&zbus->kref, zpci_bus_release); in zpci_bus_put()
252 struct zpci_bus *zbus; in zpci_bus_get() local
255 list_for_each_entry(zbus, &zbus_list, bus_next) { in zpci_bus_get()
256 if (pchid == zbus->pchid) { in zpci_bus_get()
257 kref_get(&zbus->kref); in zpci_bus_get()
261 zbus = NULL; in zpci_bus_get()
264 return zbus; in zpci_bus_get()
269 struct zpci_bus *zbus; in zpci_bus_alloc() local
271 zbus = kzalloc(sizeof(*zbus), GFP_KERNEL); in zpci_bus_alloc()
272 if (!zbus) in zpci_bus_alloc()
275 zbus->pchid = pchid; in zpci_bus_alloc()
276 INIT_LIST_HEAD(&zbus->bus_next); in zpci_bus_alloc()
278 list_add_tail(&zbus->bus_next, &zbus_list); in zpci_bus_alloc()
281 kref_init(&zbus->kref); in zpci_bus_alloc()
282 INIT_LIST_HEAD(&zbus->resources); in zpci_bus_alloc()
284 zbus->bus_resource.start = 0; in zpci_bus_alloc()
285 zbus->bus_resource.end = ZPCI_BUS_NR; in zpci_bus_alloc()
286 zbus->bus_resource.flags = IORESOURCE_BUS; in zpci_bus_alloc()
287 pci_add_resource(&zbus->resources, &zbus->bus_resource); in zpci_bus_alloc()
289 return zbus; in zpci_bus_alloc()
301 zpci_iov_setup_virtfn(zdev->zbus, pdev, zdev->vfn); in pcibios_bus_add_device()
318 struct zpci_bus *zbus = zdev->zbus; in zpci_bus_create_hotplug_slots() local
326 if (zdev->devfn == 0 && zbus->multifunction) { in zpci_bus_create_hotplug_slots()
333 zdev = zbus->function[devfn]; in zpci_bus_create_hotplug_slots()
347 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) in zpci_bus_add_device() argument
351 if (zbus->function[zdev->devfn]) { in zpci_bus_add_device()
355 zdev->zbus = zbus; in zpci_bus_add_device()
356 zbus->function[zdev->devfn] = zdev; in zpci_bus_add_device()
359 if (zbus->bus) { in zpci_bus_add_device()
360 if (zbus->multifunction && !zdev->rid_available) { in zpci_bus_add_device()
368 zbus->multifunction = 1; in zpci_bus_add_device()
374 zbus->function[zdev->devfn] = NULL; in zpci_bus_add_device()
375 zdev->zbus = NULL; in zpci_bus_add_device()
382 struct zpci_bus *zbus = NULL; in zpci_bus_device_register() local
395 zbus = zpci_bus_get(zdev->pchid); in zpci_bus_device_register()
397 if (!zbus) { in zpci_bus_device_register()
398 zbus = zpci_bus_alloc(zdev->pchid); in zpci_bus_device_register()
399 if (!zbus) in zpci_bus_device_register()
404 rc = zpci_bus_create_pci_bus(zbus, zdev, ops); in zpci_bus_device_register()
409 rc = zpci_bus_add_device(zbus, zdev); in zpci_bus_device_register()
417 zpci_bus_put(zbus); in zpci_bus_device_register()
423 struct zpci_bus *zbus = zdev->zbus; in zpci_bus_device_unregister() local
426 zbus->function[zdev->devfn] = NULL; in zpci_bus_device_unregister()
427 zpci_bus_put(zbus); in zpci_bus_device_unregister()