drivers/scsi/mpi3mr/mpi3mr_transport.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mpi3mr/mpi3mr_transport.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mpi3mr/mpi3mr_transport.c- Extension
.c- Size
- 101435 bytes
- Lines
- 3358
- 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
linux/vmalloc.hmpi3mr.h
Detected Declarations
struct rep_manu_requeststruct rep_manu_replystruct host_portstruct phy_error_log_requeststruct phy_error_log_replystruct phy_control_requeststruct phy_control_replyfunction Copyrightfunction mpi3mr_report_manufacturefunction mpi3mr_is_expander_devicefunction mpi3mr_get_sas_addressfunction mpi3mr_remove_device_by_sas_addressfunction list_for_each_entryfunction controllerfunction mpi3mr_parent_presentfunction mpi3mr_convert_phy_link_ratefunction mpi3mr_delete_sas_phyfunction mpi3mr_add_sas_phyfunction mpi3mr_add_phy_to_an_existing_portfunction list_for_each_entryfunction list_for_each_entryfunction mpi3mr_delete_sas_portfunction mpi3mr_del_phy_from_an_existing_portfunction list_for_each_entry_safefunction mpi3mr_sas_port_sanity_checkfunction mpi3mr_set_identifyfunction mpi3mr_add_host_phyfunction mpi3mr_add_expander_phyfunction mpi3mr_alloc_hba_portfunction list_for_each_entry_safefunction mpi3mr_update_linksfunction mpi3mr_sas_host_refreshfunction mpi3mr_sas_host_addfunction list_for_each_entryfunction mpi3mr_sas_port_removefunction list_for_each_entry_safefunction mpi3mr_update_mr_sas_portfunction arefunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction mpi3mr_refresh_expandersfunction mpi3mr_expander_node_addfunction mpi3mr_expander_addfunction mpi3mr_expander_node_removefunction mpi3mr_expander_node_removefunction mpi3mr_get_sas_negotiated_logical_linkrate
Annotated Snippet
struct rep_manu_request {
u8 smp_frame_type;
u8 function;
u8 reserved;
u8 request_length;
};
/* report manufacture reply structure */
struct rep_manu_reply {
u8 smp_frame_type; /* 0x41 */
u8 function; /* 0x01 */
u8 function_result;
u8 response_length;
u16 expander_change_count;
u8 reserved0[2];
u8 sas_format;
u8 reserved2[3];
u8 vendor_id[SAS_EXPANDER_VENDOR_ID_LEN] __nonstring;
u8 product_id[SAS_EXPANDER_PRODUCT_ID_LEN] __nonstring;
u8 product_rev[SAS_EXPANDER_PRODUCT_REV_LEN] __nonstring;
u8 component_vendor_id[SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN] __nonstring;
u16 component_id;
u8 component_revision_id;
u8 reserved3;
u8 vendor_specific[8];
};
/**
* mpi3mr_report_manufacture - obtain SMP report_manufacture
* @mrioc: Adapter instance reference
* @sas_address: SAS address of the expander device
* @edev: SAS transport layer sas_expander_device object
* @port_id: ID of the HBA port
*
* Fills in the sas_expander_device with manufacturing info.
*
* Return: 0 for success, non-zero for failure.
*/
static int mpi3mr_report_manufacture(struct mpi3mr_ioc *mrioc,
u64 sas_address, struct sas_expander_device *edev, u8 port_id)
{
struct mpi3_smp_passthrough_request mpi_request;
struct mpi3_smp_passthrough_reply mpi_reply;
struct rep_manu_reply *manufacture_reply;
struct rep_manu_request *manufacture_request;
int rc = 0;
void *psge;
void *data_out = NULL;
dma_addr_t data_out_dma;
dma_addr_t data_in_dma;
size_t data_in_sz;
size_t data_out_sz;
u8 sgl_flags = MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST;
u16 request_sz = sizeof(struct mpi3_smp_passthrough_request);
u16 reply_sz = sizeof(struct mpi3_smp_passthrough_reply);
u16 ioc_status;
u8 *tmp;
if (mrioc->reset_in_progress) {
ioc_err(mrioc, "%s: host reset in progress!\n", __func__);
return -EFAULT;
}
if (mrioc->pci_err_recovery) {
ioc_err(mrioc, "%s: pci error recovery in progress!\n", __func__);
return -EFAULT;
}
data_out_sz = sizeof(struct rep_manu_request);
data_in_sz = sizeof(struct rep_manu_reply);
data_out = dma_alloc_coherent(&mrioc->pdev->dev,
data_out_sz + data_in_sz, &data_out_dma, GFP_KERNEL);
if (!data_out) {
rc = -ENOMEM;
goto out;
}
data_in_dma = data_out_dma + data_out_sz;
manufacture_reply = data_out + data_out_sz;
manufacture_request = data_out;
manufacture_request->smp_frame_type = 0x40;
manufacture_request->function = 1;
manufacture_request->reserved = 0;
manufacture_request->request_length = 0;
memset(&mpi_request, 0, request_sz);
memset(&mpi_reply, 0, reply_sz);
mpi_request.host_tag = cpu_to_le16(MPI3MR_HOSTTAG_TRANSPORT_CMDS);
mpi_request.function = MPI3_FUNCTION_SMP_PASSTHROUGH;
Annotation
- Immediate include surface: `linux/vmalloc.h`, `mpi3mr.h`.
- Detected declarations: `struct rep_manu_request`, `struct rep_manu_reply`, `struct host_port`, `struct phy_error_log_request`, `struct phy_error_log_reply`, `struct phy_control_request`, `struct phy_control_reply`, `function Copyright`, `function mpi3mr_report_manufacture`, `function mpi3mr_is_expander_device`.
- 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.