drivers/ata/sata_fsl.c
Source file repositories/reference/linux-study-clean/drivers/ata/sata_fsl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ata/sata_fsl.c- Extension
.c- Size
- 43407 bytes
- Lines
- 1606
- Domain
- Driver Families
- Bucket
- drivers/ata
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/kernel.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/platform_device.hlinux/slab.hscsi/scsi_host.hscsi/scsi_cmnd.hlinux/libata.hasm/io.h
Detected Declarations
struct cmdhdr_tbl_entrystruct command_descstruct prdestruct sata_fsl_port_privstruct sata_fsl_host_privfunction fsl_sata_set_irq_coalescingfunction fsl_sata_intr_coalescing_showfunction fsl_sata_intr_coalescing_storefunction fsl_sata_rx_watermark_showfunction fsl_sata_rx_watermark_storefunction sata_fsl_tagfunction sata_fsl_setup_cmd_hdr_entryfunction sata_fsl_fill_sgfunction for_each_sgfunction sata_fsl_qc_prepfunction sata_fsl_qc_issuefunction sata_fsl_qc_fill_rtffunction sata_fsl_scr_writefunction sata_fsl_scr_readfunction sata_fsl_freezefunction sata_fsl_thawfunction sata_fsl_pmp_attachfunction sata_fsl_pmp_detachfunction sata_fsl_port_startfunction sata_fsl_port_stopfunction sata_fsl_dev_classifyfunction sata_fsl_hardresetfunction sata_fsl_softresetfunction sata_fsl_error_handlerfunction sata_fsl_post_internal_cmdfunction sata_fsl_host_intrfunction ata_qc_for_each_with_internalfunction sata_fsl_interruptfunction sata_fsl_init_controllerfunction sata_fsl_host_stopfunction sata_fsl_probefunction sata_fsl_removefunction sata_fsl_suspendfunction sata_fsl_resume
Annotated Snippet
struct cmdhdr_tbl_entry {
__le32 cda;
__le32 prde_fis_len;
__le32 ttl;
__le32 desc_info;
};
/*
* Description information bitdefs
*/
enum {
CMD_DESC_RES = (1 << 11),
VENDOR_SPECIFIC_BIST = (1 << 10),
CMD_DESC_SNOOP_ENABLE = (1 << 9),
FPDMA_QUEUED_CMD = (1 << 8),
SRST_CMD = (1 << 7),
BIST = (1 << 6),
ATAPI_CMD = (1 << 5),
};
/*
* Command Descriptor
*/
struct command_desc {
u8 cfis[8 * 4];
u8 sfis[8 * 4];
struct_group(cdb,
u8 acmd[4 * 4];
u8 fill[4 * 4];
);
u32 prdt[SATA_FSL_MAX_PRD_DIRECT * 4];
u32 prdt_indirect[(SATA_FSL_MAX_PRD - SATA_FSL_MAX_PRD_DIRECT) * 4];
};
/*
* Physical region table descriptor(PRD)
*/
struct prde {
__le32 dba;
u8 fill[2 * 4];
__le32 ddc_and_ext;
};
/*
* ata_port private data
* This is our per-port instance data.
*/
struct sata_fsl_port_priv {
struct cmdhdr_tbl_entry *cmdslot;
dma_addr_t cmdslot_paddr;
struct command_desc *cmdentry;
dma_addr_t cmdentry_paddr;
};
/*
* ata_port->host_set private data
*/
struct sata_fsl_host_priv {
void __iomem *hcr_base;
void __iomem *ssr_base;
void __iomem *csr_base;
int irq;
int data_snoop;
struct device_attribute intr_coalescing;
struct device_attribute rx_watermark;
};
static void fsl_sata_set_irq_coalescing(struct ata_host *host,
unsigned int count, unsigned int ticks)
{
struct sata_fsl_host_priv *host_priv = host->private_data;
void __iomem *hcr_base = host_priv->hcr_base;
unsigned long flags;
if (count > ICC_MAX_INT_COUNT_THRESHOLD)
count = ICC_MAX_INT_COUNT_THRESHOLD;
else if (count < ICC_MIN_INT_COUNT_THRESHOLD)
count = ICC_MIN_INT_COUNT_THRESHOLD;
if (ticks > ICC_MAX_INT_TICKS_THRESHOLD)
ticks = ICC_MAX_INT_TICKS_THRESHOLD;
else if ((ICC_MIN_INT_TICKS_THRESHOLD == ticks) &&
(count > ICC_MIN_INT_COUNT_THRESHOLD))
ticks = ICC_SAFE_INT_TICKS;
spin_lock_irqsave(&host->lock, flags);
iowrite32((count << 24 | ticks), hcr_base + ICC);
intr_coalescing_count = count;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_irq.h`, `linux/platform_device.h`, `linux/slab.h`, `scsi/scsi_host.h`.
- Detected declarations: `struct cmdhdr_tbl_entry`, `struct command_desc`, `struct prde`, `struct sata_fsl_port_priv`, `struct sata_fsl_host_priv`, `function fsl_sata_set_irq_coalescing`, `function fsl_sata_intr_coalescing_show`, `function fsl_sata_intr_coalescing_store`, `function fsl_sata_rx_watermark_show`, `function fsl_sata_rx_watermark_store`.
- Atlas domain: Driver Families / drivers/ata.
- Implementation status: source implementation candidate.
- 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.