drivers/platform/x86/amd/hsmp/hsmp.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/amd/hsmp/hsmp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/amd/hsmp/hsmp.c- Extension
.c- Size
- 12240 bytes
- Lines
- 467
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/amd/hsmp.hlinux/acpi.hlinux/delay.hlinux/device.hlinux/semaphore.hlinux/sysfs.hhsmp.h
Detected Declarations
function __hsmp_send_messagefunction validate_messagefunction hsmp_send_messagefunction hsmp_msg_get_nargsfunction hsmp_testfunction is_get_msgfunction hsmp_ioctlfunction hsmp_metric_tbl_readfunction hsmp_get_tbl_dram_basefunction hsmp_cache_proto_verfunction hsmp_misc_registerfunction hsmp_misc_deregister
Annotated Snippet
static const struct file_operations hsmp_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = hsmp_ioctl,
.compat_ioctl = hsmp_ioctl,
};
int hsmp_misc_register(struct device *dev)
{
hsmp_pdev.mdev.name = HSMP_CDEV_NAME;
hsmp_pdev.mdev.minor = MISC_DYNAMIC_MINOR;
hsmp_pdev.mdev.fops = &hsmp_fops;
hsmp_pdev.mdev.parent = dev;
hsmp_pdev.mdev.nodename = HSMP_DEVNODE_NAME;
hsmp_pdev.mdev.mode = 0644;
return misc_register(&hsmp_pdev.mdev);
}
EXPORT_SYMBOL_NS_GPL(hsmp_misc_register, "AMD_HSMP");
void hsmp_misc_deregister(void)
{
misc_deregister(&hsmp_pdev.mdev);
}
EXPORT_SYMBOL_NS_GPL(hsmp_misc_deregister, "AMD_HSMP");
struct hsmp_plat_device *get_hsmp_pdev(void)
{
return &hsmp_pdev;
}
EXPORT_SYMBOL_NS_GPL(get_hsmp_pdev, "AMD_HSMP");
MODULE_DESCRIPTION("AMD HSMP Common driver");
MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `asm/amd/hsmp.h`, `linux/acpi.h`, `linux/delay.h`, `linux/device.h`, `linux/semaphore.h`, `linux/sysfs.h`, `hsmp.h`.
- Detected declarations: `function __hsmp_send_message`, `function validate_message`, `function hsmp_send_message`, `function hsmp_msg_get_nargs`, `function hsmp_test`, `function is_get_msg`, `function hsmp_ioctl`, `function hsmp_metric_tbl_read`, `function hsmp_get_tbl_dram_base`, `function hsmp_cache_proto_ver`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.