Lines Matching refs:zbus

36  * The PCI resources for the function are set up and added to its zbus and the
37 * function is enabled. The function must be added to a zbus which must have
61 pci_bus_add_resource(zdev->zbus->bus, zdev->bars[i].res, 0);
84 pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
106 struct zpci_bus *zbus = zdev->zbus;
109 if (!zdev->zbus->bus)
112 pdev = pci_get_slot(zbus->bus, zdev->devfn);
129 * @zbus: the zbus to be scanned
137 int zpci_bus_scan_bus(struct zpci_bus *zbus)
143 zdev = zbus->function[devfn];
152 pci_scan_child_bus(zbus->bus);
153 pci_bus_add_devices(zbus->bus);
166 struct zpci_bus *zbus = NULL;
169 list_for_each_entry(zbus, &zbus_list, bus_next) {
170 zpci_bus_scan_bus(zbus);
176 /* zpci_bus_create_pci_bus - Create the PCI bus associated with this zbus
177 * @zbus: the zbus holding the zdevices
186 static int zpci_bus_create_pci_bus(struct zpci_bus *zbus, struct zpci_dev *fr, struct pci_ops *ops)
195 zbus->domain_nr = domain;
196 zbus->multifunction = fr->rid_available;
197 zbus->max_bus_speed = fr->max_bus_speed;
200 * Note that the zbus->resources are taken over and zbus->resources
203 bus = pci_create_root_bus(NULL, ZPCI_BUS_NR, ops, zbus, &zbus->resources);
205 zpci_free_domain(zbus->domain_nr);
209 zbus->bus = bus;
216 struct zpci_bus *zbus = container_of(kref, struct zpci_bus, kref);
218 if (zbus->bus) {
220 pci_stop_root_bus(zbus->bus);
222 zpci_free_domain(zbus->domain_nr);
223 pci_free_resource_list(&zbus->resources);
225 pci_remove_root_bus(zbus->bus);
230 list_del(&zbus->bus_next);
232 kfree(zbus);
235 static void zpci_bus_put(struct zpci_bus *zbus)
237 kref_put(&zbus->kref, zpci_bus_release);
242 struct zpci_bus *zbus;
245 list_for_each_entry(zbus, &zbus_list, bus_next) {
246 if (pchid == zbus->pchid) {
247 kref_get(&zbus->kref);
251 zbus = NULL;
254 return zbus;
259 struct zpci_bus *zbus;
261 zbus = kzalloc(sizeof(*zbus), GFP_KERNEL);
262 if (!zbus)
265 zbus->pchid = pchid;
266 INIT_LIST_HEAD(&zbus->bus_next);
268 list_add_tail(&zbus->bus_next, &zbus_list);
271 kref_init(&zbus->kref);
272 INIT_LIST_HEAD(&zbus->resources);
274 zbus->bus_resource.start = 0;
275 zbus->bus_resource.end = ZPCI_BUS_NR;
276 zbus->bus_resource.flags = IORESOURCE_BUS;
277 pci_add_resource(&zbus->resources, &zbus->bus_resource);
279 return zbus;
291 zpci_iov_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
296 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
300 if (zbus->function[zdev->devfn]) {
305 zdev->zbus = zbus;
306 zbus->function[zdev->devfn] = zdev;
309 if (zbus->multifunction && !zdev->rid_available) {
321 zbus->function[zdev->devfn] = NULL;
322 zdev->zbus = NULL;
329 struct zpci_bus *zbus = NULL;
342 zbus = zpci_bus_get(zdev->pchid);
344 if (!zbus) {
345 zbus = zpci_bus_alloc(zdev->pchid);
346 if (!zbus)
350 if (!zbus->bus) {
355 rc = zpci_bus_create_pci_bus(zbus, zdev, ops);
360 rc = zpci_bus_add_device(zbus, zdev);
368 zpci_bus_put(zbus);
374 struct zpci_bus *zbus = zdev->zbus;
377 zbus->function[zdev->devfn] = NULL;
378 zpci_bus_put(zbus);