drivers/scsi/esas2r/esas2r_init.c
Source file repositories/reference/linux-study-clean/drivers/scsi/esas2r/esas2r_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/esas2r/esas2r_init.c- Extension
.c- Size
- 45248 bytes
- Lines
- 1695
- 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
esas2r.h
Detected Declarations
function esas2r_initmem_allocfunction esas2r_initmem_freefunction addressfunction alloc_vda_reqfunction esas2r_unmap_regionsfunction esas2r_map_regionsfunction esas2r_setup_interruptsfunction esas2r_claim_interruptsfunction esas2r_init_adapterfunction esas2r_adapter_power_downfunction list_for_each_entry_safefunction esas2r_kill_adapterfunction esas2r_suspendfunction esas2r_resumefunction esas2r_set_degraded_modefunction esas2r_get_uncached_sizefunction esas2r_init_pci_cfg_spacefunction esas2r_init_adapter_structfunction esas2r_check_adapterfunction esas2r_format_init_msgfunction esas2r_init_msgsfunction esas2r_init_adapter_hwfunction esas2r_reset_adapterfunction esas2r_reset_chipfunction esas2r_power_down_notify_firmwarefunction esas2r_power_downfunction esas2r_power_upfunction esas2r_is_adapter_present
Annotated Snippet
if (i != 0) {
esas2r_log(ESAS2R_LOG_WARN,
"failed to enable MSI for adapter %d, "
"falling back to legacy interrupts "
"(err=%d)", a->index,
i);
goto use_legacy_interrupts;
}
a->intr_mode = INTR_MODE_MSI;
set_bit(AF2_MSI_ENABLED, &a->flags2);
break;
default:
esas2r_log(ESAS2R_LOG_WARN,
"unknown interrupt_mode %d requested, "
"falling back to legacy interrupt",
interrupt_mode);
goto use_legacy_interrupts;
}
}
static void esas2r_claim_interrupts(struct esas2r_adapter *a)
{
unsigned long flags = 0;
if (a->intr_mode == INTR_MODE_LEGACY)
flags |= IRQF_SHARED;
esas2r_log(ESAS2R_LOG_INFO,
"esas2r_claim_interrupts irq=%d (%p, %s, %lx)",
a->pcid->irq, a, a->name, flags);
if (request_irq(a->pcid->irq,
(a->intr_mode ==
INTR_MODE_LEGACY) ? esas2r_interrupt :
esas2r_msi_interrupt,
flags,
a->name,
a)) {
esas2r_log(ESAS2R_LOG_CRIT, "unable to request IRQ %02X",
a->pcid->irq);
return;
}
set_bit(AF2_IRQ_CLAIMED, &a->flags2);
esas2r_log(ESAS2R_LOG_INFO,
"claimed IRQ %d flags: 0x%lx",
a->pcid->irq, flags);
}
int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
int index)
{
struct esas2r_adapter *a;
u64 bus_addr = 0;
int i;
void *next_uncached;
struct esas2r_request *first_request, *last_request;
bool dma64 = false;
if (index >= MAX_ADAPTERS) {
esas2r_log(ESAS2R_LOG_CRIT,
"tried to init invalid adapter index %u!",
index);
return 0;
}
if (esas2r_adapters[index]) {
esas2r_log(ESAS2R_LOG_CRIT,
"tried to init existing adapter index %u!",
index);
return 0;
}
a = (struct esas2r_adapter *)host->hostdata;
memset(a, 0, sizeof(struct esas2r_adapter));
a->pcid = pcid;
a->host = host;
if (sizeof(dma_addr_t) > 4 &&
dma_get_required_mask(&pcid->dev) > DMA_BIT_MASK(32) &&
!dma_set_mask_and_coherent(&pcid->dev, DMA_BIT_MASK(64)))
dma64 = true;
if (!dma64 && dma_set_mask_and_coherent(&pcid->dev, DMA_BIT_MASK(32))) {
esas2r_log(ESAS2R_LOG_CRIT, "failed to set DMA mask");
esas2r_kill_adapter(index);
return 0;
}
Annotation
- Immediate include surface: `esas2r.h`.
- Detected declarations: `function esas2r_initmem_alloc`, `function esas2r_initmem_free`, `function address`, `function alloc_vda_req`, `function esas2r_unmap_regions`, `function esas2r_map_regions`, `function esas2r_setup_interrupts`, `function esas2r_claim_interrupts`, `function esas2r_init_adapter`, `function esas2r_adapter_power_down`.
- 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.