drivers/pci/hotplug/acpiphp_core.c
Source file repositories/reference/linux-study-clean/drivers/pci/hotplug/acpiphp_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/hotplug/acpiphp_core.c- Extension
.c- Size
- 8423 bytes
- Lines
- 311
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: exported/initcall integration point
- Status
- integration 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.
- 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/init.hlinux/module.hlinux/moduleparam.hlinux/kernel.hlinux/pci.hlinux/pci-acpi.hlinux/pci_hotplug.hlinux/slab.hlinux/smp.hacpiphp.h
Detected Declarations
function acpiphp_register_attentionfunction acpiphp_unregister_attentionfunction acpiphp_enable_slotfunction acpiphp_disable_slotfunction set_attention_statusfunction get_power_statusfunction get_attention_statusfunction get_latch_statusfunction get_adapter_statusfunction acpiphp_register_hotplug_slotfunction acpiphp_unregister_hotplug_slotfunction acpiphp_initexport acpiphp_register_attentionexport acpiphp_unregister_attention
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* ACPI PCI Hot Plug Controller Driver
*
* Copyright (C) 1995,2001 Compaq Computer Corporation
* Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (C) 2001 IBM Corp.
* Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
* Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
* Copyright (C) 2002,2003 NEC Corporation
* Copyright (C) 2003-2005 Matthew Wilcox (willy@infradead.org)
* Copyright (C) 2003-2005 Hewlett Packard
*
* All rights reserved.
*
* Send feedback to <kristen.c.accardi@intel.com>
*
*/
#define pr_fmt(fmt) "acpiphp: " fmt
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
#include <linux/pci_hotplug.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include "acpiphp.h"
/* name size which is used for entries in pcihpfs */
#define SLOT_NAME_SIZE 21 /* {_SUN} */
bool acpiphp_disabled;
/* local variables */
static struct acpiphp_attention_info *attention_info;
#define DRIVER_VERSION "0.5"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kochi@bq.jp.nec.com>, Matthew Wilcox <willy@infradead.org>"
#define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver"
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_PARM_DESC(disable, "disable acpiphp driver");
module_param_named(disable, acpiphp_disabled, bool, 0444);
static int enable_slot(struct hotplug_slot *slot);
static int disable_slot(struct hotplug_slot *slot);
static int set_attention_status(struct hotplug_slot *slot, u8 value);
static int get_power_status(struct hotplug_slot *slot, u8 *value);
static int get_attention_status(struct hotplug_slot *slot, u8 *value);
static int get_latch_status(struct hotplug_slot *slot, u8 *value);
static int get_adapter_status(struct hotplug_slot *slot, u8 *value);
static const struct hotplug_slot_ops acpi_hotplug_slot_ops = {
.enable_slot = enable_slot,
.disable_slot = disable_slot,
.set_attention_status = set_attention_status,
.get_power_status = get_power_status,
.get_attention_status = get_attention_status,
.get_latch_status = get_latch_status,
.get_adapter_status = get_adapter_status,
};
/**
* acpiphp_register_attention - set attention LED callback
* @info: must be completely filled with LED callbacks
*
* Description: This is used to register a hardware specific ACPI
* driver that manipulates the attention LED. All the fields in
* info must be set.
*/
int acpiphp_register_attention(struct acpiphp_attention_info *info)
{
int retval = -EINVAL;
if (info && info->set_attn && info->get_attn && !attention_info) {
retval = 0;
attention_info = info;
}
return retval;
}
EXPORT_SYMBOL_GPL(acpiphp_register_attention);
/**
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/pci.h`, `linux/pci-acpi.h`, `linux/pci_hotplug.h`, `linux/slab.h`.
- Detected declarations: `function acpiphp_register_attention`, `function acpiphp_unregister_attention`, `function acpiphp_enable_slot`, `function acpiphp_disable_slot`, `function set_attention_status`, `function get_power_status`, `function get_attention_status`, `function get_latch_status`, `function get_adapter_status`, `function acpiphp_register_hotplug_slot`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- 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.