Message-based devices
Fusion message devices #
mpt_register() #
u8 Register protocol-specific main callback handler.
Parameters
MPT_CALLBACK cbfunc: callback function pointerMPT_DRIVER_CLASS dclass: Protocol driver's class (MPT_DRIVER_CLASSenum value)char *func_name: call function's name
Description
This routine is called by a protocol-specific driver (SCSI host, LAN, SCSI target) to register its reply callback routine. Each protocol-specific driver must do this before it will be able to use any IOC resources, such as obtaining request frames.
NOTES
-
The SCSI protocol driver currently calls this routine thrice
in order to register separate callbacks; one for "normal" SCSI IO; one for MptScsiTaskMgmt requests; one for Scan/DV requests.
Returns u8 valued "handle" in the range (and S.O.D. order) {N,...,7,6,5,...,1} if successful. A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be considered an error by the caller.
mpt_deregister() #
void Deregister a protocol drivers resources.
Parameters
u8 cb_idx: previously registered callback handle
Description
Each protocol-specific driver should call this routine when its module is unloaded.
mpt_event_register() #
int Register protocol-specific event callback handler.
Parameters
u8 cb_idx: previously registered (via mpt_register) callback handleMPT_EVHANDLER ev_cbfunc: callback function
Description
This routine can be called by one or more protocol-specific drivers if/when they choose to be notified of MPT events.
Returns 0 for success.
mpt_event_deregister() #
void Deregister protocol-specific event callback handler
Parameters
u8 cb_idx: previously registered callback handle
Description
Each protocol-specific driver should call this routine when it does not (or can no longer) handle events, or when its module is unloaded.
mpt_reset_register() #
int Register protocol-specific IOC reset handler.
Parameters
u8 cb_idx: previously registered (via mpt_register) callback handleMPT_RESETHANDLER reset_func: reset function
Description
This routine can be called by one or more protocol-specific drivers if/when they choose to be notified of IOC resets.
Returns 0 for success.
mpt_reset_deregister() #
void Deregister protocol-specific IOC reset handler.
Parameters
u8 cb_idx: previously registered callback handle
Description
Each protocol-specific driver should call this routine when it does not (or can no longer) handle IOC reset handling, or when its module is unloaded.
mpt_device_driver_register() #
int Register device driver hooks
Parameters
struct mpt_pci_driver * dd_cbfunc: driver callbacks structu8 cb_idx: MPT protocol driver index
mpt_device_driver_deregister() #
void DeRegister device driver hooks
Parameters
u8 cb_idx: MPT protocol driver index
mpt_get_msg_frame() #
MPT_FRAME_HDR* Obtain an MPT request frame from the pool
Parameters
u8 cb_idx: Handle of registered MPT protocol driverMPT_ADAPTER *ioc: Pointer to MPT adapter structure
Description
Obtain an MPT request frame from the pool (of 1024) that are allocated per MPT adapter.
Returns pointer to a MPT request frame or NULL if none are available
or IOC is not active.
mpt_put_msg_frame() #
void Send a protocol-specific MPT request frame to an IOC
Parameters
u8 cb_idx: Handle of registered MPT protocol driverMPT_ADAPTER *ioc: Pointer to MPT adapter structureMPT_FRAME_HDR *mf: Pointer to MPT request frame
Description
This routine posts an MPT request frame to the request post FIFO of a specific MPT adapter.
mpt_put_msg_frame_hi_pri() #
void Send a hi-pri protocol-specific MPT request frame
Parameters
u8 cb_idx: Handle of registered MPT protocol driverMPT_ADAPTER *ioc: Pointer to MPT adapter structureMPT_FRAME_HDR *mf: Pointer to MPT request frame
Description
Send a protocol-specific MPT request frame to an IOC using hi-priority request queue.
This routine posts an MPT request frame to the request post FIFO of a specific MPT adapter.
mpt_free_msg_frame() #
void Place MPT request frame back on FreeQ.
Parameters
MPT_ADAPTER *ioc: Pointer to MPT adapter structureMPT_FRAME_HDR *mf: Pointer to MPT request frame
Description
This routine places a MPT request frame back on the MPT adapter's FreeQ.
mpt_send_handshake_request() #
int Send MPT request via doorbell handshake method.
Parameters
u8 cb_idx: Handle of registered MPT protocol driverMPT_ADAPTER *ioc: Pointer to MPT adapter structureint reqBytes: Size of the request in bytesu32 *req: Pointer to MPT request frameint sleepFlag: Use schedule if CAN_SLEEP else use udelay.
Description
This routine is used exclusively to send MptScsiTaskMgmt requests since they are required to be sent via doorbell handshake.
NOTE
-
It is the callers responsibility to byte-swap fields in the
request which are greater than 1 byte in size.
Returns 0 for success, non-zero for failure.
mpt_verify_adapter() #
int Given IOC identifier, set pointer to its adapter structure.
Parameters
int iocid: IOC unique identifier (integer)MPT_ADAPTER **iocpp: Pointer to pointer to IOC adapter
Description
Given a unique IOC identifier, set pointer to the associated MPT adapter structure.
Returns iocid and sets iocpp if iocid is found. Returns -1 if iocid is not found.
mpt_attach() #
int Install a PCI intelligent MPT adapter.
Parameters
struct pci_dev *pdev: Pointer to pci_dev structureconst struct pci_device_id *id: PCI device ID information
Description
This routine performs all the steps necessary to bring the IOC of a MPT adapter to a OPERATIONAL state. This includes registering memory regions, registering the interrupt, and allocating request and reply memory pools.
This routine also pre-fetches the LAN MAC address of a Fibre Channel MPT adapter.
Returns 0 for success, non-zero for failure.
TODO: Add support for polled controllers
mpt_detach() #
void Remove a PCI intelligent MPT adapter.
Parameters
struct pci_dev *pdev: Pointer to pci_dev structure
mpt_suspend() #
int Fusion MPT base driver suspend routine.
Parameters
struct pci_dev *pdev: Pointer to pci_dev structurepm_message_t state: new state to enter
mpt_resume() #
int Fusion MPT base driver resume routine.
Parameters
struct pci_dev *pdev: Pointer to pci_dev structure
mpt_GetIocState() #
u32 Get the current state of a MPT adapter.
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureint cooked: Request raw or cooked IOC state
Description
Returns all IOC Doorbell register bits if cooked==0, else just the Doorbell bits in MPI_IOC_STATE_MASK.
mpt_alloc_fw_memory() #
int allocate firmware memory
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureint size: total FW bytes
Description
If memory has already been allocated, the same (cached) value is returned.
Return 0 if successful, or non-zero for failure
mpt_free_fw_memory() #
void free firmware memory
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structure
Description
If alt_img is NULL, delete from ioc structure. Else, delete a secondary image in same format.
mptbase_sas_persist_operation() #
int Perform operation on SAS Persistent Table
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureu8 persist_opcode: see below
Description
=============================== ======================================
MPI_SAS_OP_CLEAR_NOT_PRESENT Free all persist TargetID mappings for
devices not currently present.
MPI_SAS_OP_CLEAR_ALL_PERSISTENT Clear al persist TargetID mappings
=============================== ======================================
NOTE
Don't use not this function during interrupt time.
Returns 0 for success, non-zero error
mpt_raid_phys_disk_pg0() #
int returns phys disk page zero
Parameters
MPT_ADAPTER *ioc: Pointer to a Adapter Structureu8 phys_disk_num: io unit unique phys disk num generated by the iocRaidPhysDiskPage0_t *phys_disk: requested payload data returned
Return
0 on success -EFAULT if read of config page header fails or data pointer not NULL -ENOMEM if pci_alloc failed
mpt_raid_phys_disk_get_num_paths() #
int returns number paths associated to this phys_num
Parameters
MPT_ADAPTER *ioc: Pointer to a Adapter Structureu8 phys_disk_num: io unit unique phys disk num generated by the ioc
Return
returns number paths
mpt_raid_phys_disk_pg1() #
int returns phys disk page 1
Parameters
MPT_ADAPTER *ioc: Pointer to a Adapter Structureu8 phys_disk_num: io unit unique phys disk num generated by the iocRaidPhysDiskPage1_t *phys_disk: requested payload data returned
Return
0 on success -EFAULT if read of config page header fails or data pointer not NULL -ENOMEM if pci_alloc failed
mpt_findImVolumes() #
int Identify IDs of hidden disks and RAID Volumes
Parameters
MPT_ADAPTER *ioc: Pointer to a Adapter Strucutre
Return
0 on success -EFAULT if read of config page header fails or data pointer not NULL -ENOMEM if pci_alloc failed
mpt_config() #
int Generic function to issue config message
Parameters
MPT_ADAPTER *ioc: Pointer to an adapter structureCONFIGPARMS *pCfg: Pointer to a configuration structure. Struct contains action, page address, direction, physical address and pointer to a configuration page header Page header is updated.
Description
Returns 0 for success -EAGAIN if no msg frames currently available -EFAULT for non-successful reply or no reply (timeout)
mpt_print_ioc_summary() #
void Write ASCII summary of IOC to a buffer.
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structurechar *buffer: Pointer to buffer where IOC summary info should be writtenint *size: Pointer to number of bytes we wrote (set by this routine)int len: Offset at which to start writing in bufferint showlan: Display LAN stuff?
Description
This routine writes (english readable) ASCII text, which represents a summary of IOC information, to a buffer.
mpt_set_taskmgmt_in_progress_flag() #
int set flags associated with task management
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structure
Description
Returns 0 for SUCCESS or -1 if FAILED.
If -1 is return, then it was not possible to set the flags
mpt_clear_taskmgmt_in_progress_flag() #
void clear flags associated with task management
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structure
mpt_halt_firmware() #
void __noreturn Halts the firmware if it is operational and panic the kernel
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structure
mpt_Soft_Hard_ResetHandler() #
int Try less expensive reset
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureint sleepFlag: Indicates if sleep or schedule must be called.
Description
Returns 0 for SUCCESS or -1 if FAILED. Try for softreset first, only if it fails go for expensive HardReset.
mpt_HardResetHandler() #
int Generic reset handler
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureint sleepFlag: Indicates if sleep or schedule must be called.
Description
Issues SCSI Task Management call based on input arg values. If TaskMgmt fails, returns associated SCSI request.
Remark: _HardResetHandler can be invoked from an interrupt thread (timer)
or a non-interrupt thread. In the former, must not call schedule().
Note
-
A return of -1 is a FATAL error case, as it means a
FW reload/initialization failed.
Returns 0 for SUCCESS or -1 if FAILED.
mptscsih_info() #
const char * Return information about MPT adapter
Parameters
struct Scsi_Host *SChost: Pointer to Scsi_Host structure
Description
(linux scsi_host_template.info routine)
Returns pointer to buffer where information was written.
mptscsih_qcmd() #
enum scsi_qc_status Primary Fusion MPT SCSI initiator IO start routine.
Parameters
struct scsi_cmnd *SCpnt: Pointer to scsi_cmnd structure
Description
(linux scsi_host_template.queuecommand routine) This is the primary SCSI IO start routine. Create a MPI SCSIIORequest from a linux scsi_cmnd request and send it to the IOC.
Returns 0. (rtn value discarded by linux scsi mid-layer)
mptscsih_IssueTaskMgmt() #
int Generic send Task Management function.
Parameters
MPT_SCSI_HOST *hd: Pointer to MPT_SCSI_HOST structureu8 type: Task Management typeu8 channel: channel number for task managementu8 id: Logical Target ID for reset (if appropriate)u64 lun: Logical Unit for reset (if appropriate)int ctx2abort: Context for the task to be aborted (if appropriate)ulong timeout: timeout for task management control
Description
Remark: _HardResetHandler can be invoked from an interrupt thread (timer)
or a non-interrupt thread. In the former, must not call schedule().
Not all fields are meaningfull for all task types.
Returns 0 for SUCCESS, or FAILED.
mptscsih_abort() #
int Abort linux scsi_cmnd routine, new_eh variant
Parameters
struct scsi_cmnd * SCpnt: Pointer to scsi_cmnd structure, IO to be aborted
Description
(linux scsi_host_template.eh_abort_handler routine)
Returns SUCCESS or FAILED.
mptscsih_dev_reset() #
int Perform a SCSI LOGICAL_UNIT_RESET!
Parameters
struct scsi_cmnd * SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
Description
(linux scsi_host_template.eh_dev_reset_handler routine)
Returns SUCCESS or FAILED.
mptscsih_bus_reset() #
int Perform a SCSI BUS_RESET! new_eh variant
Parameters
struct scsi_cmnd * SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
Description
(linux scsi_host_template.eh_bus_reset_handler routine)
Returns SUCCESS or FAILED.
mptscsih_host_reset() #
int Perform a SCSI host adapter RESET (new_eh variant)
Parameters
struct scsi_cmnd *SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
Description
(linux scsi_host_template.eh_host_reset_handler routine)
Returns SUCCESS or FAILED.
mptscsih_taskmgmt_complete() #
int Registered with Fusion MPT base driver
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureMPT_FRAME_HDR *mf: Pointer to SCSI task mgmt request frameMPT_FRAME_HDR *mr: Pointer to SCSI task mgmt reply frame
Description
This routine is called from mptbase.c::mpt_interrupt() at the completion
of any SCSI task management request.
This routine is registered with the MPT (base) driver at driver
load/init time via the mpt_register() API call.
Returns 1 indicating alloc'd request frame ptr should be freed.
mptscsih_get_scsi_lookup() #
struct scsi_cmnd * retrieves scmd entry
Parameters
MPT_ADAPTER *ioc: Pointer to MPT_ADAPTER structureint i: index into the array
Description
Returns the scsi_cmd pointer