drivers/block/mtip32xx/mtip32xx.c
Source file repositories/reference/linux-study-clean/drivers/block/mtip32xx/mtip32xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/mtip32xx/mtip32xx.c- Extension
.c- Size
- 101773 bytes
- Lines
- 4084
- Domain
- Driver Families
- Bucket
- drivers/block
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/pci.hlinux/interrupt.hlinux/ata.hlinux/delay.hlinux/hdreg.hlinux/uaccess.hlinux/random.hlinux/smp.hlinux/compat.hlinux/fs.hlinux/module.hlinux/blkdev.hlinux/blk-mq.hlinux/bio.hlinux/dma-mapping.hlinux/idr.hlinux/kthread.h../drivers/ata/ahci.hlinux/export.hlinux/debugfs.hlinux/prefetch.hlinux/numa.hmtip32xx.h
Detected Declarations
struct mtip_compat_ide_task_request_sstruct mtip_int_cmdfunction mtip_check_surprise_removalfunction HBAfunction mtip_issue_ncq_commandfunction mtip_enable_fisfunction mtip_enable_enginefunction mtip_start_portfunction mtip_deinit_portfunction mtip_deinit_portfunction mtip_restart_portfunction mtip_device_resetfunction print_tagsfunction mtip_complete_commandfunction mtip_handle_tfefunction mtip_workq_sdbfxfunction mtip_process_legacyfunction mtip_process_errorsfunction mtip_handle_irqfunction mtip_irq_handlerfunction mtip_issue_non_ncq_commandfunction mtip_pause_ncqfunction mtip_commands_activefunction mtip_quiesce_iofunction mtip_exec_internal_commandfunction swappedfunction mtip_set_timeoutfunction bufferfunction mtip_standby_immediatefunction mtip_read_log_pagefunction mtip_get_smart_datafunction mtip_get_smart_attrfunction mtip_hw_get_capacityfunction mtip_dump_identifyfunction fill_command_sgfunction for_each_sgfunction exec_drive_taskfunction exec_drive_commandfunction implicit_sectorfunction ide_taskfile_ioctlfunction mtip_hw_ioctlfunction mtip_hw_submit_iofunction mtip_hw_show_statusfunction mtip_hw_read_registersfunction mtip_hw_read_flagsfunction mtip_hw_debugfs_initfunction mtip_hw_debugfs_exitfunction hba_setup
Annotated Snippet
static const struct file_operations mtip_regs_fops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = mtip_hw_read_registers,
};
static const struct file_operations mtip_flags_fops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = mtip_hw_read_flags,
};
static void mtip_hw_debugfs_init(struct driver_data *dd)
{
dd->dfs_node = debugfs_create_dir(dd->disk->disk_name, dfs_parent);
debugfs_create_file("flags", 0444, dd->dfs_node, dd, &mtip_flags_fops);
debugfs_create_file("registers", 0444, dd->dfs_node, dd,
&mtip_regs_fops);
}
static void mtip_hw_debugfs_exit(struct driver_data *dd)
{
debugfs_remove_recursive(dd->dfs_node);
}
/*
* Perform any init/resume time hardware setup
*
* @dd Pointer to the driver data structure.
*
* return value
* None
*/
static inline void hba_setup(struct driver_data *dd)
{
u32 hwdata;
hwdata = readl(dd->mmio + HOST_HSORG);
/* interrupt bug workaround: use only 1 IS bit.*/
writel(hwdata |
HSORG_DISABLE_SLOTGRP_INTR |
HSORG_DISABLE_SLOTGRP_PXIS,
dd->mmio + HOST_HSORG);
}
static int mtip_device_unaligned_constrained(struct driver_data *dd)
{
return (dd->pdev->device == P420M_DEVICE_ID ? 1 : 0);
}
/*
* Detect the details of the product, and store anything needed
* into the driver data structure. This includes product type and
* version and number of slot groups.
*
* @dd Pointer to the driver data structure.
*
* return value
* None
*/
static void mtip_detect_product(struct driver_data *dd)
{
u32 hwdata;
unsigned int rev, slotgroups;
/*
* HBA base + 0xFC [15:0] - vendor-specific hardware interface
* info register:
* [15:8] hardware/software interface rev#
* [ 3] asic-style interface
* [ 2:0] number of slot groups, minus 1 (only valid for asic-style).
*/
hwdata = readl(dd->mmio + HOST_HSORG);
dd->product_type = MTIP_PRODUCT_UNKNOWN;
dd->slot_groups = 1;
if (hwdata & 0x8) {
dd->product_type = MTIP_PRODUCT_ASICFPGA;
rev = (hwdata & HSORG_HWREV) >> 8;
slotgroups = (hwdata & HSORG_SLOTGROUPS) + 1;
dev_info(&dd->pdev->dev,
"ASIC-FPGA design, HS rev 0x%x, "
"%i slot groups [%i slots]\n",
rev,
slotgroups,
slotgroups * 32);
if (slotgroups > MTIP_MAX_SLOT_GROUPS) {
dev_warn(&dd->pdev->dev,
Annotation
- Immediate include surface: `linux/pci.h`, `linux/interrupt.h`, `linux/ata.h`, `linux/delay.h`, `linux/hdreg.h`, `linux/uaccess.h`, `linux/random.h`, `linux/smp.h`.
- Detected declarations: `struct mtip_compat_ide_task_request_s`, `struct mtip_int_cmd`, `function mtip_check_surprise_removal`, `function HBA`, `function mtip_issue_ncq_command`, `function mtip_enable_fis`, `function mtip_enable_engine`, `function mtip_start_port`, `function mtip_deinit_port`, `function mtip_deinit_port`.
- Atlas domain: Driver Families / drivers/block.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.