arch/powerpc/platforms/powermac/pci.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powermac/pci.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powermac/pci.c- Extension
.c- Size
- 36163 bytes
- Lines
- 1262
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/pci.hlinux/delay.hlinux/string.hlinux/init.hlinux/irq.hlinux/of_address.hlinux/of_irq.hlinux/of_pci.hasm/sections.hasm/io.hasm/pci-bridge.hasm/machdep.hasm/pmac_feature.hasm/grackle.hasm/ppc-pci.hpmac.h
Detected Declarations
function fixup_one_level_bus_rangefunction fixup_bus_rangefunction MacRISCfunction specificfunction setup_chaosfunction u3_ht_skip_devicefunction u3_ht_read_configfunction u3_ht_write_configfunction pmac_pci_fixup_u4_of_nodefunction init_banditfunction init_p2pbridgefunction init_second_oharefunction fixup_nec_usb2function for_each_node_by_namefunction setup_banditfunction setup_uninorthfunction setup_u3_agpfunction setup_u4_pciefunction parse_region_decodefunction setup_u3_htfunction of_address_to_resourcefunction pmac_add_bridgefunction pmac_pci_irq_fixupfunction pmac_pci_root_bridge_preparefunction pmac_pci_initfunction pmac_pci_enable_device_hookfunction of_device_is_compatiblefunction of_device_is_compatiblefunction pmac_pci_fixup_ohcifunction pmac_pcibios_after_initfunction for_each_node_by_namefunction pmac_pci_fixup_cardbusfunction pmac_pci_fixup_pciatafunction fixup_k2_satafunction U4function pmac_pci_probe_mode
Annotated Snippet
if (bus_range != NULL && len > 2 * sizeof(int)) {
if (bus_range[1] > higher)
higher = bus_range[1];
}
higher = fixup_one_level_bus_range(node->child, higher);
}
return higher;
}
/* This routine fixes the "bus-range" property of all bridges in the
* system since they tend to have their "last" member wrong on macs
*
* Note that the bus numbers manipulated here are OF bus numbers, they
* are not Linux bus numbers.
*/
static void __init fixup_bus_range(struct device_node *bridge)
{
int *bus_range, len;
struct property *prop;
/* Lookup the "bus-range" property for the hose */
prop = of_find_property(bridge, "bus-range", &len);
if (prop == NULL || prop->length < 2 * sizeof(int))
return;
bus_range = prop->value;
bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
}
/*
* Apple MacRISC (U3, UniNorth, Bandit, Chaos) PCI controllers.
*
* The "Bandit" version is present in all early PCI PowerMacs,
* and up to the first ones using Grackle. Some machines may
* have 2 bandit controllers (2 PCI busses).
*
* "Chaos" is used in some "Bandit"-type machines as a bridge
* for the separate display bus. It is accessed the same
* way as bandit, but cannot be probed for devices. It therefore
* has its own config access functions.
*
* The "UniNorth" version is present in all Core99 machines
* (iBook, G4, new IMacs, and all the recent Apple machines).
* It contains 3 controllers in one ASIC.
*
* The U3 is the bridge used on G5 machines. It contains an
* AGP bus which is dealt with the old UniNorth access routines
* and a HyperTransport bus which uses its own set of access
* functions.
*/
#define MACRISC_CFA0(devfn, off) \
((1 << (unsigned int)PCI_SLOT(dev_fn)) \
| (((unsigned int)PCI_FUNC(dev_fn)) << 8) \
| (((unsigned int)(off)) & 0xFCUL))
#define MACRISC_CFA1(bus, devfn, off) \
((((unsigned int)(bus)) << 16) \
|(((unsigned int)(devfn)) << 8) \
|(((unsigned int)(off)) & 0xFCUL) \
|1UL)
static void __iomem *macrisc_cfg_map_bus(struct pci_bus *bus,
unsigned int dev_fn,
int offset)
{
unsigned int caddr;
struct pci_controller *hose;
hose = pci_bus_to_host(bus);
if (hose == NULL)
return NULL;
if (bus->number == hose->first_busno) {
if (dev_fn < (11 << 3))
return NULL;
caddr = MACRISC_CFA0(dev_fn, offset);
} else
caddr = MACRISC_CFA1(bus->number, dev_fn, offset);
/* Uninorth will return garbage if we don't read back the value ! */
do {
out_le32(hose->cfg_addr, caddr);
} while (in_le32(hose->cfg_addr) != caddr);
offset &= has_uninorth ? 0x07 : 0x03;
return hose->cfg_data + offset;
}
static struct pci_ops macrisc_pci_ops =
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pci.h`, `linux/delay.h`, `linux/string.h`, `linux/init.h`, `linux/irq.h`, `linux/of_address.h`, `linux/of_irq.h`.
- Detected declarations: `function fixup_one_level_bus_range`, `function fixup_bus_range`, `function MacRISC`, `function specific`, `function setup_chaos`, `function u3_ht_skip_device`, `function u3_ht_read_config`, `function u3_ht_write_config`, `function pmac_pci_fixup_u4_of_node`, `function init_bandit`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.