drivers/pci/hotplug/cpqphp_nvram.c
Source file repositories/reference/linux-study-clean/drivers/pci/hotplug/cpqphp_nvram.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/hotplug/cpqphp_nvram.c- Extension
.c- Size
- 12964 bytes
- Lines
- 651
- 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.
- 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/kernel.hlinux/types.hlinux/proc_fs.hlinux/slab.hlinux/workqueue.hlinux/pci.hlinux/pci_hotplug.hlinux/uaccess.hcpqphp.hcpqphp_nvram.h
Detected Declarations
struct register_foostruct all_regstruct ev_hrt_headerstruct ev_hrt_ctrlfunction add_bytefunction add_dwordfunction check_for_compaq_ROMfunction access_EVfunction load_HRTfunction store_HRTfunction compaq_nvram_initfunction compaq_nvram_loadfunction compaq_nvram_store
Annotated Snippet
struct register_foo {
union {
unsigned long lword; /* eax */
unsigned short word; /* ax */
struct {
unsigned char low; /* al */
unsigned char high; /* ah */
} byte;
} data;
unsigned char opcode; /* see below */
unsigned long length; /* if the reg. is a pointer, how much data */
} __attribute__ ((packed));
struct all_reg {
struct register_foo eax_reg;
struct register_foo ebx_reg;
struct register_foo ecx_reg;
struct register_foo edx_reg;
struct register_foo edi_reg;
struct register_foo esi_reg;
struct register_foo eflags_reg;
} __attribute__ ((packed));
struct ev_hrt_header {
u8 Version;
u8 num_of_ctrl;
u8 next;
};
struct ev_hrt_ctrl {
u8 bus;
u8 device;
u8 function;
u8 mem_avail;
u8 p_mem_avail;
u8 io_avail;
u8 bus_avail;
u8 next;
};
static u8 evbuffer_init;
static u8 evbuffer_length;
static u8 evbuffer[1024];
static void __iomem *compaq_int15_entry_point;
/* lock for ordering int15_bios_call() */
static DEFINE_SPINLOCK(int15_lock);
/* This is a series of function that deals with
* setting & getting the hotplug resource table in some environment variable.
*/
/*
* We really shouldn't be doing this unless there is a _very_ good reason to!!!
* greg k-h
*/
static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail)
{
u8 **tByte;
if ((*used + 1) > *avail)
return(1);
*((u8 *)*p_buffer) = value;
tByte = (u8 **)p_buffer;
(*tByte)++;
*used += 1;
return(0);
}
static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail)
{
if ((*used + 4) > *avail)
return(1);
**p_buffer = value;
(*p_buffer)++;
*used += 4;
return(0);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/proc_fs.h`, `linux/slab.h`, `linux/workqueue.h`, `linux/pci.h`, `linux/pci_hotplug.h`.
- Detected declarations: `struct register_foo`, `struct all_reg`, `struct ev_hrt_header`, `struct ev_hrt_ctrl`, `function add_byte`, `function add_dword`, `function check_for_compaq_ROM`, `function access_EV`, `function load_HRT`, `function store_HRT`.
- 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.