drivers/scsi/aic94xx/aic94xx_seq.c
Source file repositories/reference/linux-study-clean/drivers/scsi/aic94xx/aic94xx_seq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/aic94xx/aic94xx_seq.c- Extension
.c- Size
- 46802 bytes
- Lines
- 1402
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/gfp.hlinux/pci.hlinux/module.hlinux/firmware.haic94xx_reg.haic94xx_hwi.haic94xx_seq.haic94xx_dump.h
Detected Declarations
function asd_pause_cseqfunction asd_unpause_cseqfunction asd_seq_pause_lseqfunction asd_pause_lseqfunction for_each_sequencerfunction asd_seq_unpause_lseqfunction asd_verify_cseqfunction LmRAMPAGEfunction asd_verify_seqfunction for_each_sequencerfunction asd_download_seqfunction asd_download_seqfunction asd_seq_download_seqsfunction for_each_sequencerfunction asd_init_cseq_mipfunction asd_init_cseq_mdpfunction asd_init_cseq_scratchfunction asd_init_lseq_mipfunction asd_init_lseq_mdpfunction asd_init_lseq_scratchfunction asd_init_scb_sitesfunction asd_init_cseq_ciofunction asd_init_lseq_ciofunction asd_post_init_cseqfunction asd_init_ddb_0function asd_seq_init_ddb_sitesfunction asd_seq_setup_seqsfunction asd_seq_start_cseqfunction asd_seq_start_lseqfunction asd_release_firmwarefunction asd_request_firmwarefunction asd_init_seqsfunction asd_start_seqsfunction asd_update_port_links
Annotated Snippet
if (le32_to_cpu(*prog) != val) {
asd_printk("%s: cseq verify failed at %u "
"read:0x%x, wanted:0x%x\n",
pci_name(asd_ha->pcidev),
i, val, le32_to_cpu(*prog));
return -1;
}
}
ASD_DPRINTK("verified %d bytes, passed\n", size);
return 0;
}
/**
* asd_verify_lseq - verify the microcode of a link sequencer
* @asd_ha: pointer to host adapter structure
* @_prog: pointer to the microcode
* @size: size of the microcode in bytes
* @lseq: link sequencer of interest
*
* The link sequencer code is accessed in 4 KB pages, which are selected
* by setting LmRAMPAGE (bits 8 and 9) of the LmBISTCTL1 register.
* The 10 KB LSEQm instruction code is mapped, page at a time, at
* LmSEQRAM address.
*/
static int asd_verify_lseq(struct asd_ha_struct *asd_ha, const u8 *_prog,
u32 size, int lseq)
{
#define LSEQ_CODEPAGE_SIZE 4096
int pages = (size + LSEQ_CODEPAGE_SIZE - 1) / LSEQ_CODEPAGE_SIZE;
u32 page;
const u32 *prog = (u32 *) _prog;
for (page = 0; page < pages; page++) {
u32 i;
asd_write_reg_dword(asd_ha, LmBISTCTL1(lseq),
page << LmRAMPAGE_LSHIFT);
for (i = 0; size > 0 && i < LSEQ_CODEPAGE_SIZE;
i += 4, prog++, size-=4) {
u32 val = asd_read_reg_dword(asd_ha, LmSEQRAM(lseq)+i);
if (le32_to_cpu(*prog) != val) {
asd_printk("%s: LSEQ%d verify failed "
"page:%d, offs:%d\n",
pci_name(asd_ha->pcidev),
lseq, page, i);
return -1;
}
}
}
ASD_DPRINTK("LSEQ%d verified %d bytes, passed\n", lseq,
(int)((u8 *)prog-_prog));
return 0;
}
/**
* asd_verify_seq -- verify CSEQ/LSEQ microcode
* @asd_ha: pointer to host adapter structure
* @prog: pointer to microcode
* @size: size of the microcode
* @lseq_mask: if 0, verify CSEQ microcode, else mask of LSEQs of interest
*
* Return 0 if microcode is correct, negative on mismatch.
*/
static int asd_verify_seq(struct asd_ha_struct *asd_ha, const u8 *prog,
u32 size, u8 lseq_mask)
{
if (lseq_mask == 0)
return asd_verify_cseq(asd_ha, prog, size);
else {
int lseq, err;
for_each_sequencer(lseq_mask, lseq_mask, lseq) {
err = asd_verify_lseq(asd_ha, prog, size, lseq);
if (err)
return err;
}
}
return 0;
}
#define ASD_DMA_MODE_DOWNLOAD
#ifdef ASD_DMA_MODE_DOWNLOAD
/* This is the size of the CSEQ Mapped instruction page */
#define MAX_DMA_OVLY_COUNT ((1U << 14)-1)
static int asd_download_seq(struct asd_ha_struct *asd_ha,
const u8 * const prog, u32 size, u8 lseq_mask)
{
u32 comstaten;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gfp.h`, `linux/pci.h`, `linux/module.h`, `linux/firmware.h`, `aic94xx_reg.h`, `aic94xx_hwi.h`, `aic94xx_seq.h`.
- Detected declarations: `function asd_pause_cseq`, `function asd_unpause_cseq`, `function asd_seq_pause_lseq`, `function asd_pause_lseq`, `function for_each_sequencer`, `function asd_seq_unpause_lseq`, `function asd_verify_cseq`, `function LmRAMPAGE`, `function asd_verify_seq`, `function for_each_sequencer`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.