Lines Matching defs: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
56 pci_bus_add_resource(zdev->zbus->bus, zdev->bars[i].res, 0);
79 pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
101 struct zpci_bus *zbus = zdev->zbus;
104 if (!zdev->zbus->bus)
107 pdev = pci_get_slot(zbus->bus, zdev->devfn);
124 * @zbus: the zbus to be scanned
132 int zpci_bus_scan_bus(struct zpci_bus *zbus)
138 zdev = zbus->function[devfn];
147 pci_scan_child_bus(zbus->bus);
148 pci_bus_add_devices(zbus->bus);
161 struct zpci_bus *zbus = NULL;
164 list_for_each_entry(zbus, &zbus_list, bus_next) {
165 zpci_bus_scan_bus(zbus);
171 /* zpci_bus_create_pci_bus - Create the PCI bus associated with this zbus
172 * @zbus: the zbus holding the zdevices
181 static int zpci_bus_create_pci_bus(struct zpci_bus *zbus, struct zpci_dev *fr, struct pci_ops *ops)
190 zbus->domain_nr = domain;
191 zbus->multifunction = fr->rid_available;
192 zbus->max_bus_speed = fr->max_bus_speed;
195 * Note that the zbus->resources are taken over and zbus->resources
198 bus = pci_create_root_bus(NULL, ZPCI_BUS_NR, ops, zbus, &zbus->resources);
200 zpci_free_domain(zbus->domain_nr);
204 zbus->bus = bus;
211 struct zpci_bus *zbus = container_of(kref, struct zpci_bus, kref);
213 if (zbus->bus) {
215 pci_stop_root_bus(zbus->bus);
217 zpci_free_domain(zbus->domain_nr);
218 pci_free_resource_list(&zbus->resources);
220 pci_remove_root_bus(zbus->bus);
225 list_del(&zbus->bus_next);
227 kfree(zbus);
230 static void zpci_bus_put(struct zpci_bus *zbus)
232 kref_put(&zbus->kref, zpci_bus_release);
237 struct zpci_bus *zbus;
240 list_for_each_entry(zbus, &zbus_list, bus_next) {
241 if (pchid == zbus->pchid) {
242 kref_get(&zbus->kref);
246 zbus = NULL;
249 return zbus;
254 struct zpci_bus *zbus;
256 zbus = kzalloc(sizeof(*zbus), GFP_KERNEL);
257 if (!zbus)
260 zbus->pchid = pchid;
261 INIT_LIST_HEAD(&zbus->bus_next);
263 list_add_tail(&zbus->bus_next, &zbus_list);
266 kref_init(&zbus->kref);
267 INIT_LIST_HEAD(&zbus->resources);
269 zbus->bus_resource.start = 0;
270 zbus->bus_resource.end = ZPCI_BUS_NR;
271 zbus->bus_resource.flags = IORESOURCE_BUS;
272 pci_add_resource(&zbus->resources, &zbus->bus_resource);
274 return zbus;
286 zpci_iov_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
291 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
295 if (zbus->function[zdev->devfn]) {
300 zdev->zbus = zbus;
301 zbus->function[zdev->devfn] = zdev;
304 if (zbus->multifunction && !zdev->rid_available) {
316 zbus->function[zdev->devfn] = NULL;
317 zdev->zbus = NULL;
324 struct zpci_bus *zbus = NULL;
337 zbus = zpci_bus_get(zdev->pchid);
339 if (!zbus) {
340 zbus = zpci_bus_alloc(zdev->pchid);
341 if (!zbus)
345 if (!zbus->bus) {
350 rc = zpci_bus_create_pci_bus(zbus, zdev, ops);
355 rc = zpci_bus_add_device(zbus, zdev);
363 zpci_bus_put(zbus);
369 struct zpci_bus *zbus = zdev->zbus;
372 zbus->function[zdev->devfn] = NULL;
373 zpci_bus_put(zbus);