drivers/pci/hotplug/ibmphp_hpc.c
Source file repositories/reference/linux-study-clean/drivers/pci/hotplug/ibmphp_hpc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/hotplug/ibmphp_hpc.c- Extension
.c- Size
- 31946 bytes
- Lines
- 1095
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/wait.hlinux/time.hlinux/completion.hlinux/delay.hlinux/module.hlinux/pci.hlinux/init.hlinux/mutex.hlinux/sched.hlinux/kthread.hibmphp.h
Detected Declarations
function i2c_ctrl_readfunction i2c_ctrl_writefunction isa_ctrl_readfunction isa_ctrl_writefunction pci_ctrl_readfunction pci_ctrl_writefunction ctrl_readfunction ctrl_writefunction hpc_writecmdtoindexfunction hpc_readcmdtoindexfunction ibmphp_hpc_readslotfunction list_for_each_entryfunction ibmphp_hpc_writeslotfunction get_hpc_accessfunction free_hpc_accessfunction ibmphp_lock_operationsfunction ibmphp_unlock_operationsfunction poll_hpcfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction process_changeinstatusfunction process_changeinlatchfunction ibmphp_hpc_start_poll_threadfunction ibmphp_hpc_stop_poll_threadfunction hpc_wait_ctlr_notworking
Annotated Snippet
if (busindex < 0) {
rc = -EINVAL;
err("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc);
return rc;
} else
index = (u8) busindex;
} else
index = pslot->ctlr_index;
index = hpc_readcmdtoindex(cmd, index);
if (index == HPC_ERROR) {
rc = -EINVAL;
err("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc);
return rc;
}
ctlr_ptr = pslot->ctrl;
get_hpc_access();
//--------------------------------------------------------------------
// map physical address to logical address
//--------------------------------------------------------------------
if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4))
wpg_bbar = ioremap(ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE);
//--------------------------------------------------------------------
// check controller status before reading
//--------------------------------------------------------------------
rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status);
if (!rc) {
switch (cmd) {
case READ_ALLSTAT:
// update the slot structure
pslot->ctrl->status = status;
pslot->status = ctrl_read(ctlr_ptr, wpg_bbar, index);
rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar,
&status);
if (!rc)
pslot->ext_status = ctrl_read(ctlr_ptr, wpg_bbar, index + WPG_1ST_EXTSLOT_INDEX);
break;
case READ_SLOTSTATUS:
// DO NOT update the slot structure
*pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index);
break;
case READ_EXTSLOTSTATUS:
// DO NOT update the slot structure
*pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index);
break;
case READ_CTLRSTATUS:
// DO NOT update the slot structure
*pstatus = status;
break;
case READ_BUSSTATUS:
pslot->busstatus = ctrl_read(ctlr_ptr, wpg_bbar, index);
break;
case READ_REVLEVEL:
*pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index);
break;
case READ_HPCOPTIONS:
*pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index);
break;
case READ_SLOTLATCHLOWREG:
// DO NOT update the slot structure
*pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index);
break;
// Not used
case READ_ALLSLOT:
list_for_each_entry(pslot, &ibmphp_slot_head,
ibm_slot_list) {
index = pslot->ctlr_index;
rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr,
wpg_bbar, &status);
if (!rc) {
pslot->status = ctrl_read(ctlr_ptr, wpg_bbar, index);
rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT,
ctlr_ptr, wpg_bbar, &status);
if (!rc)
pslot->ext_status =
ctrl_read(ctlr_ptr, wpg_bbar,
index + WPG_1ST_EXTSLOT_INDEX);
} else {
err("%s - Error ctrl_read failed\n", __func__);
Annotation
- Immediate include surface: `linux/wait.h`, `linux/time.h`, `linux/completion.h`, `linux/delay.h`, `linux/module.h`, `linux/pci.h`, `linux/init.h`, `linux/mutex.h`.
- Detected declarations: `function i2c_ctrl_read`, `function i2c_ctrl_write`, `function isa_ctrl_read`, `function isa_ctrl_write`, `function pci_ctrl_read`, `function pci_ctrl_write`, `function ctrl_read`, `function ctrl_write`, `function hpc_writecmdtoindex`, `function hpc_readcmdtoindex`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.