Lines Matching +full:1275 +full:- +full:1994

1 // SPDX-License-Identifier: GPL-2.0-only
17 #include <asm/pci-bridge.h>
20 * get_int_prop - Decode a u32 from a device tree property
34 * pci_parse_of_flags - Parse the flags cell of a device tree PCI address
38 * PCI Bus Binding to IEEE Std 1275-1994
49 * t is 1 if the address is aliased (for non-relocatable I/O),
54 * 10 denotes 32-bit-address Memory Space
55 * 11 denotes 64-bit-address Memory Space
56 * bbbbbbbb is the 8-bit Bus Number
57 * ddddd is the 5-bit Device Number
58 * fff is the 3-bit Function Number
59 * rrrrrrrr is the 8-bit Register Number
95 * do a config space read, it will be force-enabled if needed in pci_parse_of_flags()
110 * of_pci_parse_addrs - Parse PCI addresses assigned in the device tree node
114 * This function parses the 'assigned-addresses' property of a PCI devices'
128 addrs = of_get_property(node, "assigned-addresses", &proplen); in of_pci_parse_addrs()
137 for (; proplen >= 20; proplen -= 20, addrs += 5) { in of_pci_parse_addrs()
151 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; in of_pci_parse_addrs()
152 } else if (i == dev->rom_base_reg) { in of_pci_parse_addrs()
153 res = &dev->resource[PCI_ROM_RESOURCE]; in of_pci_parse_addrs()
159 res->flags = flags; in of_pci_parse_addrs()
161 res->flags |= IORESOURCE_UNSET; in of_pci_parse_addrs()
162 res->name = pci_name(dev); in of_pci_parse_addrs()
164 region.end = base + size - 1; in of_pci_parse_addrs()
165 pcibios_bus_to_resource(dev->bus, res, &region); in of_pci_parse_addrs()
170 * of_create_pci_dev - Given a device tree node on a pci bus, create a pci_dev
187 dev->dev.of_node = of_node_get(node); in of_create_pci_dev()
188 dev->dev.parent = bus->bridge; in of_create_pci_dev()
189 dev->dev.bus = &pci_bus_type; in of_create_pci_dev()
190 dev->devfn = devfn; in of_create_pci_dev()
191 dev->multifunction = 0; /* maybe a lie? */ in of_create_pci_dev()
192 dev->needs_freset = 0; /* pcie fundamental reset required */ in of_create_pci_dev()
196 dev->vendor = get_int_prop(node, "vendor-id", 0xffff); in of_create_pci_dev()
197 dev->device = get_int_prop(node, "device-id", 0xffff); in of_create_pci_dev()
198 dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); in of_create_pci_dev()
199 dev->subsystem_device = get_int_prop(node, "subsystem-id", 0); in of_create_pci_dev()
201 dev->cfg_size = pci_cfg_space_size(dev); in of_create_pci_dev()
203 dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus), in of_create_pci_dev()
204 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); in of_create_pci_dev()
205 dev->class = get_int_prop(node, "class-code", 0); in of_create_pci_dev()
206 dev->revision = get_int_prop(node, "revision-id", 0); in of_create_pci_dev()
208 pr_debug(" class: 0x%x\n", dev->class); in of_create_pci_dev()
209 pr_debug(" revision: 0x%x\n", dev->revision); in of_create_pci_dev()
211 dev->current_state = PCI_UNKNOWN; /* unknown power state */ in of_create_pci_dev()
212 dev->error_state = pci_channel_io_normal; in of_create_pci_dev()
213 dev->dma_mask = 0xffffffff; in of_create_pci_dev()
219 /* a PCI-PCI bridge */ in of_create_pci_dev()
220 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; in of_create_pci_dev()
221 dev->rom_base_reg = PCI_ROM_ADDRESS1; in of_create_pci_dev()
224 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS; in of_create_pci_dev()
226 dev->hdr_type = PCI_HEADER_TYPE_NORMAL; in of_create_pci_dev()
227 dev->rom_base_reg = PCI_ROM_ADDRESS; in of_create_pci_dev()
229 dev->irq = 0; in of_create_pci_dev()
243 * of_scan_pci_bridge - Set up a PCI bridge and scan for child nodes
252 struct device_node *node = dev->dev.of_node; in of_scan_pci_bridge()
264 /* parse bus-range property */ in of_scan_pci_bridge()
265 busrange = of_get_property(node, "bus-range", &len); in of_scan_pci_bridge()
267 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %pOF\n", in of_scan_pci_bridge()
273 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %pOF\n", in of_scan_pci_bridge()
278 bus = pci_find_bus(pci_domain_nr(dev->bus), in of_scan_pci_bridge()
281 bus = pci_add_new_bus(dev->bus, dev, in of_scan_pci_bridge()
290 bus->primary = dev->bus->number; in of_scan_pci_bridge()
293 bus->bridge_ctl = 0; in of_scan_pci_bridge()
296 /* PCI #address-cells == 3 and #size-cells == 2 always */ in of_scan_pci_bridge()
297 res = &dev->resource[PCI_BRIDGE_RESOURCES]; in of_scan_pci_bridge()
298 for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) { in of_scan_pci_bridge()
299 res->flags = 0; in of_scan_pci_bridge()
300 bus->resource[i] = res; in of_scan_pci_bridge()
304 for (; len >= 32; len -= 32, ranges += 8) { in of_scan_pci_bridge()
310 res = bus->resource[0]; in of_scan_pci_bridge()
311 if (res->flags) { in of_scan_pci_bridge()
317 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { in of_scan_pci_bridge()
322 res = bus->resource[i]; in of_scan_pci_bridge()
325 res->flags = flags; in of_scan_pci_bridge()
327 region.end = region.start + size - 1; in of_scan_pci_bridge()
328 pcibios_bus_to_resource(dev->bus, res, &region); in of_scan_pci_bridge()
330 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), in of_scan_pci_bridge()
331 bus->number); in of_scan_pci_bridge()
332 pr_debug(" bus name: %s\n", bus->name); in of_scan_pci_bridge()
337 if (phb->controller_ops.probe_mode) in of_scan_pci_bridge()
338 mode = phb->controller_ops.probe_mode(bus); in of_scan_pci_bridge()
376 if (edev && (edev->mode & EEH_DEV_REMOVED)) in of_scan_pci_dev()
385 pr_debug(" dev header type: %x\n", dev->hdr_type); in of_scan_pci_dev()
390 * __of_scan_bus - given a PCI bus node, setup bus and scan for child devices
402 node, bus->number); in __of_scan_bus()
409 pr_debug(" dev header type: %x\n", dev->hdr_type); in __of_scan_bus()
424 * of_scan_bus - given a PCI bus node, setup bus and scan for child devices
435 * of_rescan_bus - given a PCI bus node, scan for child devices