arch/powerpc/kernel/eeh_pe.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/eeh_pe.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/eeh_pe.c- Extension
.c- Size
- 24438 bytes
- Lines
- 939
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/export.hlinux/gfp.hlinux/kernel.hlinux/of.hlinux/pci.hlinux/string.hasm/pci-bridge.hasm/ppc-pci.h
Detected Declarations
function eeh_set_pe_aux_sizefunction eeh_phb_pe_createfunction eeh_wait_statefunction list_for_each_entryfunction eeh_for_each_pefunction eeh_pe_dev_traversefunction eeh_pe_tree_insertfunction eeh_pe_tree_removefunction freefunction list_for_each_entryfunction eeh_pe_update_time_stampfunction eeh_pe_state_markfunction EEH_PE_ISOLATEDfunction list_for_each_entryfunction __eeh_pe_dev_mode_markfunction eeh_pe_dev_mode_markfunction eeh_pe_state_clearfunction eeh_for_each_pefunction eeh_pe_for_each_devfunction bridgesfunction eeh_restore_bridge_barsfunction eeh_restore_device_barsfunction eeh_restore_one_device_barsfunction eeh_pe_restore_barsfunction propertyfunction _eeh_pe_bus_getfunction _eeh_pe_bus_getexport eeh_pe_state_markexport eeh_pe_mark_isolated
Annotated Snippet
if (max_wait <= 0) {
pr_warn("%s: Timeout when getting PE's state (%d)\n",
__func__, max_wait);
return EEH_STATE_NOT_SUPPORT;
}
if (mwait < EEH_STATE_MIN_WAIT_TIME) {
pr_warn("%s: Firmware returned bad wait value %d\n",
__func__, mwait);
mwait = EEH_STATE_MIN_WAIT_TIME;
} else if (mwait > EEH_STATE_MAX_WAIT_TIME) {
pr_warn("%s: Firmware returned too long wait value %d\n",
__func__, mwait);
mwait = EEH_STATE_MAX_WAIT_TIME;
}
msleep(min(mwait, max_wait));
max_wait -= mwait;
}
}
/**
* eeh_phb_pe_get - Retrieve PHB PE based on the given PHB
* @phb: PCI controller
*
* The overall PEs form hierarchy tree. The first layer of the
* hierarchy tree is composed of PHB PEs. The function is used
* to retrieve the corresponding PHB PE according to the given PHB.
*/
struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb)
{
struct eeh_pe *pe;
list_for_each_entry(pe, &eeh_phb_pe, child) {
/*
* Actually, we needn't check the type since
* the PE for PHB has been determined when that
* was created.
*/
if ((pe->type & EEH_PE_PHB) && pe->phb == phb)
return pe;
}
return NULL;
}
/**
* eeh_pe_next - Retrieve the next PE in the tree
* @pe: current PE
* @root: root PE
*
* The function is used to retrieve the next PE in the
* hierarchy PE tree.
*/
struct eeh_pe *eeh_pe_next(struct eeh_pe *pe, struct eeh_pe *root)
{
struct list_head *next = pe->child_list.next;
if (next == &pe->child_list) {
while (1) {
if (pe == root)
return NULL;
next = pe->child.next;
if (next != &pe->parent->child_list)
break;
pe = pe->parent;
}
}
return list_entry(next, struct eeh_pe, child);
}
/**
* eeh_pe_traverse - Traverse PEs in the specified PHB
* @root: root PE
* @fn: callback
* @flag: extra parameter to callback
*
* The function is used to traverse the specified PE and its
* child PEs. The traversing is to be terminated once the
* callback returns something other than NULL, or no more PEs
* to be traversed.
*/
void *eeh_pe_traverse(struct eeh_pe *root,
eeh_pe_traverse_func fn, void *flag)
{
struct eeh_pe *pe;
void *ret;
eeh_for_each_pe(root, pe) {
Annotation
- Immediate include surface: `linux/delay.h`, `linux/export.h`, `linux/gfp.h`, `linux/kernel.h`, `linux/of.h`, `linux/pci.h`, `linux/string.h`, `asm/pci-bridge.h`.
- Detected declarations: `function eeh_set_pe_aux_size`, `function eeh_phb_pe_create`, `function eeh_wait_state`, `function list_for_each_entry`, `function eeh_for_each_pe`, `function eeh_pe_dev_traverse`, `function eeh_pe_tree_insert`, `function eeh_pe_tree_remove`, `function free`, `function list_for_each_entry`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration 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.