Lines Matching +full:low +full:- +full:pass

1 // SPDX-License-Identifier: GPL-2.0
3 * Low-Level PCI Access for i386 machines
9 * +1 (303) 786-7975
16 * Copyright 1997--2000 Martin Mares <mj@ucw.cz>
65 if (map->dev == dev) in pcibios_fwaddrmap_lookup()
88 map->dev = pci_dev_get(dev); in pcibios_save_fw_addr()
89 map->fw_addr[idx] = fw_addr; in pcibios_save_fw_addr()
90 INIT_LIST_HEAD(&map->list); in pcibios_save_fw_addr()
93 list_add_tail(&map->list, &pcibios_fwaddrmappings); in pcibios_save_fw_addr()
95 map->fw_addr[idx] = fw_addr; in pcibios_save_fw_addr()
111 fw_addr = map->fw_addr[idx]; in pcibios_retrieve_fw_addr()
124 list_del(&entry->list); in pcibios_fw_addr_list_del()
125 pci_dev_put(entry->dev); in pcibios_fw_addr_list_del()
136 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA)) in skip_isa_ioresource_align()
144 * addresses to be allocated in the 0x000-0x0ff region
148 * the low 10 bits of the IO address. The 0x00-0xff region
150 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
151 * but we want to try to avoid allocating at 0x2900-0x2bff
152 * which might have be mirrored at 0x0100-0x03ff..
159 resource_size_t start = res->start; in pcibios_align_resource()
161 if (res->flags & IORESOURCE_IO) { in pcibios_align_resource()
166 } else if (res->flags & IORESOURCE_MEM) { in pcibios_align_resource()
167 /* The low 1MB range is reserved for ISA cards */ in pcibios_align_resource()
178 * On the other hand, we cannot just re-allocate all devices, as it would
184 * - I/O or memory regions not configured
185 * - regions configured, but not enabled in the command register
186 * - bogus I/O addresses above 64K used
187 * - expansion ROMs left enabled (this may sound harmless, but given
191 * - bad resource sizes or overlaps with other regions
194 * (1) Allocate resources for all buses behind PCI-to-PCI bridges.
215 r = &dev->resource[idx]; in pcibios_allocate_bridge_resources()
216 if (!r->flags) in pcibios_allocate_bridge_resources()
218 if (r->parent) /* Already allocated */ in pcibios_allocate_bridge_resources()
220 if (!r->start || pci_claim_bridge_resource(dev, idx) < 0) { in pcibios_allocate_bridge_resources()
227 r->start = r->end = 0; in pcibios_allocate_bridge_resources()
228 r->flags = 0; in pcibios_allocate_bridge_resources()
237 /* Depth-First Search on bus tree */ in pcibios_allocate_bus_resources()
238 if (bus->self) in pcibios_allocate_bus_resources()
239 pcibios_allocate_bridge_resources(bus->self); in pcibios_allocate_bus_resources()
240 list_for_each_entry(child, &bus->children, node) in pcibios_allocate_bus_resources()
249 static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass) in pcibios_allocate_dev_resources() argument
265 r = &dev->resource[idx]; in pcibios_allocate_dev_resources()
266 if (r->parent) /* Already allocated */ in pcibios_allocate_dev_resources()
268 if (!r->start) /* Address not assigned at all */ in pcibios_allocate_dev_resources()
270 if (r->flags & IORESOURCE_IO) in pcibios_allocate_dev_resources()
274 if (pass == disabled) { in pcibios_allocate_dev_resources()
275 dev_dbg(&dev->dev, in pcibios_allocate_dev_resources()
277 idx, r, disabled, pass); in pcibios_allocate_dev_resources()
279 if (r->flags & IORESOURCE_PCI_FIXED) { in pcibios_allocate_dev_resources()
280 dev_info(&dev->dev, "BAR %d %pR is immovable\n", in pcibios_allocate_dev_resources()
285 idx, r->start); in pcibios_allocate_dev_resources()
286 r->end -= r->start; in pcibios_allocate_dev_resources()
287 r->start = 0; in pcibios_allocate_dev_resources()
292 if (!pass) { in pcibios_allocate_dev_resources()
293 r = &dev->resource[PCI_ROM_RESOURCE]; in pcibios_allocate_dev_resources()
294 if (r->flags & IORESOURCE_ROM_ENABLE) { in pcibios_allocate_dev_resources()
298 dev_dbg(&dev->dev, "disabling ROM %pR\n", r); in pcibios_allocate_dev_resources()
299 r->flags &= ~IORESOURCE_ROM_ENABLE; in pcibios_allocate_dev_resources()
300 pci_read_config_dword(dev, dev->rom_base_reg, &reg); in pcibios_allocate_dev_resources()
301 pci_write_config_dword(dev, dev->rom_base_reg, in pcibios_allocate_dev_resources()
307 static void pcibios_allocate_resources(struct pci_bus *bus, int pass) in pcibios_allocate_resources() argument
312 list_for_each_entry(dev, &bus->devices, bus_list) { in pcibios_allocate_resources()
313 pcibios_allocate_dev_resources(dev, pass); in pcibios_allocate_resources()
315 child = dev->subordinate; in pcibios_allocate_resources()
317 pcibios_allocate_resources(child, pass); in pcibios_allocate_resources()
330 r = &dev->resource[PCI_ROM_RESOURCE]; in pcibios_allocate_dev_rom_resource()
331 if (!r->flags || !r->start) in pcibios_allocate_dev_rom_resource()
333 if (r->parent) /* Already allocated */ in pcibios_allocate_dev_rom_resource()
337 r->end -= r->start; in pcibios_allocate_dev_rom_resource()
338 r->start = 0; in pcibios_allocate_dev_rom_resource()
346 list_for_each_entry(dev, &bus->devices, bus_list) { in pcibios_allocate_rom_resources()
349 child = dev->subordinate; in pcibios_allocate_rom_resources()
377 dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n"); in pcibios_resource_survey_bus()