drivers/pci/hotplug/ibmphp_ebda.c
Source file repositories/reference/linux-study-clean/drivers/pci/hotplug/ibmphp_ebda.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/hotplug/ibmphp_ebda.c- Extension
.c- Size
- 32171 bytes
- Lines
- 1119
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/errno.hlinux/mm.hlinux/slab.hlinux/pci.hlinux/list.hlinux/init.hibmphp.h
Detected Declarations
function alloc_ebda_hpc_listfunction free_ebda_hpcfunction alloc_ebda_rsrc_listfunction print_bus_infofunction list_for_each_entryfunction print_lo_infofunction print_vg_infofunction print_ebda_pci_rsrcfunction list_for_each_entryfunction print_ibm_slotfunction list_for_each_entryfunction print_opt_vgfunction print_ebda_hpcfunction list_for_each_entryfunction ibmphp_access_ebdafunction ebda_rio_tablefunction combine_wpg_for_chassisfunction list_for_each_entryfunction combine_wpg_for_expansionfunction list_for_each_entryfunction varfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction calculate_first_slotfunction list_for_each_entryfunction fillslotinfofunction infofunction list_for_each_entryfunction infofunction ibmphp_get_total_controllersfunction list_for_each_entryfunction list_for_each_entryfunction ibmphp_get_bus_indexfunction list_for_each_entryfunction ibmphp_free_bus_info_queuefunction list_for_each_entry_safefunction ibmphp_free_ebda_hpc_queuefunction list_for_each_entry_safefunction ibmphp_free_ebda_pci_rsrc_queuefunction list_for_each_entry_safefunction ibmphp_register_pcifunction list_for_each_entryfunction ibmphp_probefunction list_for_each_entry
Annotated Snippet
static struct pci_driver ibmphp_driver;
/*
* map info (ctlr-id, slot count, slot#.. bus count, bus#, ctlr type...) of
* each hpc from physical address to a list of hot plug controllers based on
* hpc descriptors.
*/
static int __init ebda_rsrc_controller(void)
{
u16 addr, addr_slot, addr_bus;
u8 ctlr_id, temp, bus_index;
u16 ctlr, slot, bus;
u16 slot_num, bus_num, index;
struct controller *hpc_ptr;
struct ebda_hpc_bus *bus_ptr;
struct ebda_hpc_slot *slot_ptr;
struct bus_info *bus_info_ptr1, *bus_info_ptr2;
int rc;
struct slot *tmp_slot;
char name[SLOT_NAME_SIZE];
addr = hpc_list_ptr->phys_addr;
for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) {
bus_index = 1;
ctlr_id = readb(io_mem + addr);
addr += 1;
slot_num = readb(io_mem + addr);
addr += 1;
addr_slot = addr; /* offset of slot structure */
addr += (slot_num * 4);
bus_num = readb(io_mem + addr);
addr += 1;
addr_bus = addr; /* offset of bus */
addr += (bus_num * 9); /* offset of ctlr_type */
temp = readb(io_mem + addr);
addr += 1;
/* init hpc structure */
hpc_ptr = alloc_ebda_hpc(slot_num, bus_num);
if (!hpc_ptr) {
return -ENOMEM;
}
hpc_ptr->ctlr_id = ctlr_id;
hpc_ptr->ctlr_relative_id = ctlr;
hpc_ptr->slot_count = slot_num;
hpc_ptr->bus_count = bus_num;
debug("now enter ctlr data structure ---\n");
debug("ctlr id: %x\n", ctlr_id);
debug("ctlr_relative_id: %x\n", hpc_ptr->ctlr_relative_id);
debug("count of slots controlled by this ctlr: %x\n", slot_num);
debug("count of buses controlled by this ctlr: %x\n", bus_num);
/* init slot structure, fetch slot, bus, cap... */
slot_ptr = hpc_ptr->slots;
for (slot = 0; slot < slot_num; slot++) {
slot_ptr->slot_num = readb(io_mem + addr_slot);
slot_ptr->slot_bus_num = readb(io_mem + addr_slot + slot_num);
slot_ptr->ctl_index = readb(io_mem + addr_slot + 2*slot_num);
slot_ptr->slot_cap = readb(io_mem + addr_slot + 3*slot_num);
// create bus_info lined list --- if only one slot per bus: slot_min = slot_max
bus_info_ptr2 = ibmphp_find_same_bus_num(slot_ptr->slot_bus_num);
if (!bus_info_ptr2) {
bus_info_ptr1 = kzalloc_obj(struct bus_info);
if (!bus_info_ptr1) {
rc = -ENOMEM;
goto error_no_slot;
}
bus_info_ptr1->slot_min = slot_ptr->slot_num;
bus_info_ptr1->slot_max = slot_ptr->slot_num;
bus_info_ptr1->slot_count += 1;
bus_info_ptr1->busno = slot_ptr->slot_bus_num;
bus_info_ptr1->index = bus_index++;
bus_info_ptr1->current_speed = 0xff;
bus_info_ptr1->current_bus_mode = 0xff;
bus_info_ptr1->controller_id = hpc_ptr->ctlr_id;
list_add_tail(&bus_info_ptr1->bus_info_list, &bus_info_head);
} else {
bus_info_ptr2->slot_min = min(bus_info_ptr2->slot_min, slot_ptr->slot_num);
bus_info_ptr2->slot_max = max(bus_info_ptr2->slot_max, slot_ptr->slot_num);
bus_info_ptr2->slot_count += 1;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/errno.h`, `linux/mm.h`, `linux/slab.h`, `linux/pci.h`, `linux/list.h`, `linux/init.h`, `ibmphp.h`.
- Detected declarations: `function alloc_ebda_hpc_list`, `function free_ebda_hpc`, `function alloc_ebda_rsrc_list`, `function print_bus_info`, `function list_for_each_entry`, `function print_lo_info`, `function print_vg_info`, `function print_ebda_pci_rsrc`, `function list_for_each_entry`, `function print_ibm_slot`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: pattern 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.