drivers/scsi/qla2xxx/qla_sup.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_sup.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_sup.c- Extension
.c- Size
- 97691 bytes
- Lines
- 3712
- 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.
- 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
qla_def.hlinux/delay.hlinux/slab.hlinux/vmalloc.hlinux/uaccess.h
Detected Declarations
function Copyrightfunction qla2x00_unlock_nvram_accessfunction qla2x00_nv_writefunction qla2x00_nvram_requestfunction qla2x00_get_nvram_wordfunction qla2x00_nv_deselectfunction qla2x00_write_nvram_wordfunction qla2x00_write_nvram_word_tmofunction qla2x00_clear_nvram_protectionfunction qla2x00_set_nvram_protectionfunction flash_conf_addrfunction flash_data_addrfunction nvram_conf_addrfunction nvram_data_addrfunction qla24xx_read_flash_dwordfunction qla24xx_read_flash_datafunction qla24xx_write_flash_dwordfunction qla24xx_get_flash_manufacturerfunction qla2xxx_find_flt_startfunction qla2xxx_get_flt_infofunction qla2xxx_get_fdt_infofunction qla2xxx_get_idc_paramfunction qla28xx_validate_mcu_signaturefunction qla2xxx_get_flash_infofunction qla2xxx_flash_npiv_conffunction qla24xx_unprotect_flashfunction qla24xx_protect_flashfunction qla24xx_erase_sectorfunction qla24xx_write_flash_datafunction qla2x00_read_nvram_datafunction qla24xx_read_nvram_datafunction qla2x00_write_nvram_datafunction qla24xx_write_nvram_datafunction qla25xx_read_nvram_datafunction qla25xx_write_nvram_datafunction qla2x00_flip_colorsfunction qla2x00_beacon_blinkfunction qla2x00_beacon_onfunction qla2x00_beacon_offfunction qla24xx_flip_colorsfunction qla24xx_beacon_blinkfunction qla83xx_select_led_portfunction qla83xx_beacon_blinkfunction qla24xx_beacon_onfunction qla24xx_beacon_offfunction qla2x00_flash_enablefunction qla2x00_flash_disablefunction qla2x00_read_flash_byte
Annotated Snippet
while (data & NVR_BUSY) {
udelay(100);
data = rd_reg_word(®->nvram);
}
/* Lock resource */
wrt_reg_word(®->u.isp2300.host_semaphore, 0x1);
rd_reg_word(®->u.isp2300.host_semaphore);
udelay(5);
data = rd_reg_word(®->u.isp2300.host_semaphore);
while ((data & BIT_0) == 0) {
/* Lock failed */
udelay(100);
wrt_reg_word(®->u.isp2300.host_semaphore, 0x1);
rd_reg_word(®->u.isp2300.host_semaphore);
udelay(5);
data = rd_reg_word(®->u.isp2300.host_semaphore);
}
}
}
/**
* qla2x00_unlock_nvram_access() -
* @ha: HA context
*/
static void
qla2x00_unlock_nvram_access(struct qla_hw_data *ha)
{
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) {
wrt_reg_word(®->u.isp2300.host_semaphore, 0);
rd_reg_word(®->u.isp2300.host_semaphore);
}
}
/**
* qla2x00_nv_write() - Prepare for NVRAM read/write operation.
* @ha: HA context
* @data: Serial interface selector
*/
static void
qla2x00_nv_write(struct qla_hw_data *ha, uint16_t data)
{
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
wrt_reg_word(®->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
rd_reg_word(®->nvram); /* PCI Posting. */
NVRAM_DELAY();
wrt_reg_word(®->nvram, data | NVR_SELECT | NVR_CLOCK |
NVR_WRT_ENABLE);
rd_reg_word(®->nvram); /* PCI Posting. */
NVRAM_DELAY();
wrt_reg_word(®->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
rd_reg_word(®->nvram); /* PCI Posting. */
NVRAM_DELAY();
}
/**
* qla2x00_nvram_request() - Sends read command to NVRAM and gets data from
* NVRAM.
* @ha: HA context
* @nv_cmd: NVRAM command
*
* Bit definitions for NVRAM command:
*
* Bit 26 = start bit
* Bit 25, 24 = opcode
* Bit 23-16 = address
* Bit 15-0 = write data
*
* Returns the word read from nvram @addr.
*/
static uint16_t
qla2x00_nvram_request(struct qla_hw_data *ha, uint32_t nv_cmd)
{
uint8_t cnt;
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
uint16_t data = 0;
uint16_t reg_data;
/* Send command to NVRAM. */
nv_cmd <<= 5;
for (cnt = 0; cnt < 11; cnt++) {
if (nv_cmd & BIT_31)
qla2x00_nv_write(ha, NVR_DATA_OUT);
else
qla2x00_nv_write(ha, 0);
nv_cmd <<= 1;
}
Annotation
- Immediate include surface: `qla_def.h`, `linux/delay.h`, `linux/slab.h`, `linux/vmalloc.h`, `linux/uaccess.h`.
- Detected declarations: `function Copyright`, `function qla2x00_unlock_nvram_access`, `function qla2x00_nv_write`, `function qla2x00_nvram_request`, `function qla2x00_get_nvram_word`, `function qla2x00_nv_deselect`, `function qla2x00_write_nvram_word`, `function qla2x00_write_nvram_word_tmo`, `function qla2x00_clear_nvram_protection`, `function qla2x00_set_nvram_protection`.
- 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.