drivers/scsi/mvsas/mv_64xx.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mvsas/mv_64xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mvsas/mv_64xx.c- Extension
.c- Size
- 19031 bytes
- Lines
- 815
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
mv_sas.hmv_64xx.hmv_chips.h
Detected Declarations
function mvs_64xx_detect_porttypefunction mvs_64xx_enable_xmtfunction mvs_64xx_phy_hacksfunction mvs_64xx_stp_resetfunction mvs_64xx_phy_resetfunction mvs_64xx_clear_srs_irqfunction mvs_64xx_chip_resetfunction mvs_64xx_phy_disablefunction mvs_64xx_phy_enablefunction mvs_64xx_initfunction mvs_64xx_ioremapfunction mvs_64xx_iounmapfunction mvs_64xx_interrupt_enablefunction mvs_64xx_interrupt_disablefunction mvs_64xx_isr_statusfunction mvs_64xx_isrfunction mvs_64xx_command_activefunction mvs_64xx_issue_stopfunction mvs_64xx_free_reg_setfunction mvs_64xx_assign_reg_setfunction mvs_64xx_make_prdfunction mvs_64xx_oob_donefunction mvs_64xx_fix_phy_infofunction mvs_64xx_phy_work_aroundfunction mvs_64xx_phy_set_link_ratefunction mvs_64xx_clear_active_cmdsfunction mvs_64xx_spi_read_datafunction mvs_64xx_spi_write_datafunction mvs_64xx_spi_buildcmdfunction mvs_64xx_spi_issuecmdfunction mvs_64xx_spi_waitdatareadyfunction mvs_64xx_fix_dmafunction mvs_64xx_tune_interrupt
Annotated Snippet
if (phy_id < MVS_SOC_PORTS) {
pci_write_config_dword(mvi->pdev, PCR_PHY_CTL, tmp);
mdelay(10);
pci_write_config_dword(mvi->pdev, PCR_PHY_CTL, reg);
} else {
pci_write_config_dword(mvi->pdev, PCR_PHY_CTL2, tmp);
mdelay(10);
pci_write_config_dword(mvi->pdev, PCR_PHY_CTL2, reg);
}
} else {
mw32(MVS_PHY_CTL, tmp);
mdelay(10);
mw32(MVS_PHY_CTL, reg);
}
}
static void mvs_64xx_phy_reset(struct mvs_info *mvi, u32 phy_id, int hard)
{
u32 tmp;
tmp = mvs_read_port_irq_stat(mvi, phy_id);
tmp &= ~PHYEV_RDY_CH;
mvs_write_port_irq_stat(mvi, phy_id, tmp);
tmp = mvs_read_phy_ctl(mvi, phy_id);
if (hard == MVS_HARD_RESET)
tmp |= PHY_RST_HARD;
else if (hard == MVS_SOFT_RESET)
tmp |= PHY_RST;
mvs_write_phy_ctl(mvi, phy_id, tmp);
if (hard) {
do {
tmp = mvs_read_phy_ctl(mvi, phy_id);
} while (tmp & PHY_RST_HARD);
}
}
static void
mvs_64xx_clear_srs_irq(struct mvs_info *mvi, u8 reg_set, u8 clear_all)
{
void __iomem *regs = mvi->regs;
u32 tmp;
if (clear_all) {
tmp = mr32(MVS_INT_STAT_SRS_0);
if (tmp) {
printk(KERN_DEBUG "check SRS 0 %08X.\n", tmp);
mw32(MVS_INT_STAT_SRS_0, tmp);
}
} else {
tmp = mr32(MVS_INT_STAT_SRS_0);
if (tmp & (1 << (reg_set % 32))) {
printk(KERN_DEBUG "register set 0x%x was stopped.\n",
reg_set);
mw32(MVS_INT_STAT_SRS_0, 1 << (reg_set % 32));
}
}
}
static int mvs_64xx_chip_reset(struct mvs_info *mvi)
{
void __iomem *regs = mvi->regs;
u32 tmp;
int i;
/* make sure interrupts are masked immediately (paranoia) */
mw32(MVS_GBL_CTL, 0);
tmp = mr32(MVS_GBL_CTL);
/* Reset Controller */
if (!(tmp & HBA_RST)) {
if (mvi->flags & MVF_PHY_PWR_FIX) {
pci_read_config_dword(mvi->pdev, PCR_PHY_CTL, &tmp);
tmp &= ~PCTL_PWR_OFF;
tmp |= PCTL_PHY_DSBL;
pci_write_config_dword(mvi->pdev, PCR_PHY_CTL, tmp);
pci_read_config_dword(mvi->pdev, PCR_PHY_CTL2, &tmp);
tmp &= ~PCTL_PWR_OFF;
tmp |= PCTL_PHY_DSBL;
pci_write_config_dword(mvi->pdev, PCR_PHY_CTL2, tmp);
}
}
/* make sure interrupts are masked immediately (paranoia) */
mw32(MVS_GBL_CTL, 0);
tmp = mr32(MVS_GBL_CTL);
/* Reset Controller */
if (!(tmp & HBA_RST)) {
/* global reset, incl. COMRESET/H_RESET_N (self-clearing) */
mw32_f(MVS_GBL_CTL, HBA_RST);
}
Annotation
- Immediate include surface: `mv_sas.h`, `mv_64xx.h`, `mv_chips.h`.
- Detected declarations: `function mvs_64xx_detect_porttype`, `function mvs_64xx_enable_xmt`, `function mvs_64xx_phy_hacks`, `function mvs_64xx_stp_reset`, `function mvs_64xx_phy_reset`, `function mvs_64xx_clear_srs_irq`, `function mvs_64xx_chip_reset`, `function mvs_64xx_phy_disable`, `function mvs_64xx_phy_enable`, `function mvs_64xx_init`.
- 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.
- 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.