FreeBSD kernel pms device code
sadisc.c File Reference

The file implements the functions to do SAS/SATA discovery. More...

#include <sys/cdefs.h>
#include <dev/pms/config.h>
#include <dev/pms/RefTisa/sallsdk/spc/saglobal.h>
Include dependency graph for sadisc.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
GLOBAL bit32 saDiscover (agsaRoot_t *agRoot, agsaPortContext_t *agPortContext, bit32 type, bit32 option)
 Start/Abort SAS/SATA discovery. More...
 
GLOBAL bit32 saDeregisterDeviceHandle (agsaRoot_t *agRoot, agsaContext_t *agContext, agsaDevHandle_t *agDevHandle, bit32 queueNum)
 Function for target to remove stale initiator device handle. More...
 
GLOBAL bit32 siRemoveDevHandle (agsaRoot_t *agRoot, agsaDevHandle_t *agDevHandle)
 Function for target to remove stale initiator device handle. More...
 
GLOBAL bit32 saGetDeviceHandles (agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaPortContext_t *agPortContext, bit32 flags, agsaDevHandle_t *agDev[], bit32 skipCount, bit32 MaxDevs)
 Get Device Handles from a specific local port. More...
 
GLOBAL bit32 saRegisterNewDevice (agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaDeviceInfo_t *agDeviceInfo, agsaPortContext_t *agPortContext, bit16 hostAssignedDeviceId)
 Register New Device from a specific local port. More...
 
GLOBAL bit32 saRegisterEventCallback (agsaRoot_t *agRoot, bit32 eventSourceType, ossaGenericCB_t callbackPtr)
 Register a callback for a specific event. More...
 
GLOBAL bit32 saGetDeviceInfo (agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 option, bit32 queueNum, agsaDevHandle_t *agDevHandle)
 Get Device Information. More...
 
GLOBAL bit32 saSetDeviceInfo (agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaDevHandle_t *agDevHandle, bit32 option, bit32 param, ossaSetDeviceInfoCB_t agCB)
 Set Device Information. More...
 
GLOBAL bit32 saGetDeviceState (agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaDevHandle_t *agDevHandle)
 Get Device State. More...
 
GLOBAL bit32 saSetDeviceState (agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaDevHandle_t *agDevHandle, bit32 newDeviceState)
 Set Device State. More...
 

Detailed Description

The file implements the functions to do SAS/SATA discovery.

Definition in file sadisc.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ saDeregisterDeviceHandle()

GLOBAL bit32 saDeregisterDeviceHandle ( agsaRoot_t agRoot,
agsaContext_t agContext,
agsaDevHandle_t agDevHandle,
bit32  queueNum 
)

Function for target to remove stale initiator device handle.

function is called to ask the LL layer to remove all LL layer and SPC firmware internal resources associated with a device handle

Parameters
agRootHandles for this instance of SAS/SATA hardware
agDevHandleHandle of the device that this I/O request will be made on
Returns
If the device handle is removed successfully
  • AGSA_RC_SUCCESS the device handle is removed successfully
  • AGSA_RC_BUSY the device is busy, cannot be removed now

Definition at line 83 of file sadisc.c.

References agNULL, AGSA_RC_FAILURE, AGSA_RC_SUCCESS, DEVICE_ID_BITS, agsaDeviceMap_s::DeviceHandle, agsaDeviceMap_s::DeviceIdFromFW, agsaLLRoot_s::DeviceMap, agsaDeviceDesc_s::DeviceMapIndex, hpDBG_VERY_LOUD, MAX_IO_DEVICE_ENTRIES, mpiDeregDevHandleCmd(), OS_ASSERT, agsaPort_s::portId, agsaDeviceDesc_s::pPort, SA_DBG1, SA_DBG3, agsaContext_s::sdkData, smTraceFuncEnter, and smTraceFuncExit.

Referenced by ossaDeviceRegistrationCB(), ossaSMPAbortCB(), and tdsaDeregisterDevicesInPort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saDiscover()

GLOBAL bit32 saDiscover ( agsaRoot_t agRoot,
agsaPortContext_t agPortContext,
bit32  type,
bit32  option 
)

Start/Abort SAS/SATA discovery.

Start/Abort SAS/SATA discovery

Parameters
agRootHandles for this instance of SAS/SATA hardware
agPortContextPointer to this instance of port context
typeSpecifies the type(s) of discovery operation to start or cancel
optionSpecified the discovery option
Returns
If discovery is started/aborted successfully
  • AGSA_RC_SUCCESS discovery is started/aborted successfully
  • AGSA_RC_FAILURE discovery is not started/aborted successfully

Definition at line 57 of file sadisc.c.

References AGSA_RC_FAILURE.

Referenced by ossaHwCB(), and tiINIDiscoverTargets().

Here is the caller graph for this function:

◆ saGetDeviceHandles()

GLOBAL bit32 saGetDeviceHandles ( agsaRoot_t agRoot,
agsaContext_t agContext,
bit32  queueNum,
agsaPortContext_t agPortContext,
bit32  flags,
agsaDevHandle_t agDev[],
bit32  skipCount,
bit32  MaxDevs 
)

Get Device Handles from a specific local port.

Get a Device Handles

Parameters
agRootHandles for this instance of SAS/SATA hardware
agsaContextPointer to this API context
agPortContextPointer to this instance of port context
flagsDevice flags
agDev[]Pointer of array of device handles
MaxDevsSpecified Maximum number of Device Handles
Returns
If GetDeviceHandles is successfully or failure
  • AGSA_RC_SUCCESS GetDeviceHandles is successfully
  • AGSA_RC_FAILURE GetDeviceHandles is not successfully

Definition at line 243 of file sadisc.c.

References agNULL, AGSA_RC_FAILURE, AGSA_RC_SUCCESS, agsaLLRoot_s::DeviceHandle, flags, hpDBG_VERY_LOUD, mpiGetDeviceHandleCmd(), OS_ASSERT, agsaPort_s::portId, SA_DBG1, agsaContext_s::sdkData, smTraceFuncEnter, and smTraceFuncExit.

Here is the call graph for this function:

◆ saGetDeviceInfo()

GLOBAL bit32 saGetDeviceInfo ( agsaRoot_t agRoot,
agsaContext_t agContext,
bit32  option,
bit32  queueNum,
agsaDevHandle_t agDevHandle 
)

Get Device Information.

Get SAS/SATA device information API

Parameters
agRootHandles for this instance of SAS/SATA hardware
optiondevice general information or extended information
agDevHandlePointer of device handle
Returns
  • AGSA_RC_SUCCESS
  • AGSA_RC_FAILURE

Definition at line 609 of file sadisc.c.

References agNULL, AGSA_RC_FAILURE, DEVICE_ID_BITS, agsaDeviceMap_s::DeviceHandle, agsaDeviceMap_s::DeviceIdFromFW, agsaLLRoot_s::DeviceMap, agsaDeviceDesc_s::DeviceMapIndex, hpDBG_VERY_LOUD, mpiGetDeviceInfoCmd(), OS_ASSERT, SA_DBG1, SA_DBG3, agsaContext_s::sdkData, smTraceFuncEnter, and smTraceFuncExit.

Referenced by tiINIGetDeviceInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saGetDeviceState()

GLOBAL bit32 saGetDeviceState ( agsaRoot_t agRoot,
agsaContext_t agContext,
bit32  queueNum,
agsaDevHandle_t agDevHandle 
)

Get Device State.

Get SAS/SATA device state API

Parameters
agRootHandles for this instance of SAS/SATA hardware
agContextPointer to this API context
queueNumIQ/OQ number
agDevHandlePointer of device handler
Returns
  • AGSA_RC_SUCCESS
  • AGSA_RC_FAILURE

Definition at line 739 of file sadisc.c.

References agNULL, AGSA_RC_FAILURE, DEVICE_ID_BITS, agsaDeviceMap_s::DeviceHandle, agsaDeviceMap_s::DeviceIdFromFW, agsaLLRoot_s::DeviceMap, agsaDeviceDesc_s::DeviceMapIndex, hpDBG_VERY_LOUD, mpiGetDeviceStateCmd(), OS_ASSERT, SA_DBG1, SA_DBG3, agsaContext_s::sdkData, smTraceFuncEnter, and smTraceFuncExit.

Here is the call graph for this function:

◆ saRegisterEventCallback()

GLOBAL bit32 saRegisterEventCallback ( agsaRoot_t agRoot,
bit32  eventSourceType,
ossaGenericCB_t  callbackPtr 
)

Register a callback for a specific event.

Register a callback for a Event API

Parameters
agRootHandles for this instance of SAS/SATA hardware
eventSourceTypeEvent Type
callbackPtrFunction pointer to OS layer
Returns
  • AGSA_RC_SUCCESS
  • AGSA_RC_FAILURE

Definition at line 566 of file sadisc.c.

References AGSA_RC_FAILURE, AGSA_RC_SUCCESS, agsaLLRoot_s::DeviceDeregistrationCB, agsaLLRoot_s::DeviceRegistrationCB, OSSA_EVENT_SOURCE_DEVICE_HANDLE_ADDED, OSSA_EVENT_SOURCE_DEVICE_HANDLE_REMOVED, SA_DBG1, SA_DBG3, and agsaContext_s::sdkData.

Referenced by tiCOMPortInit().

Here is the caller graph for this function:

◆ saRegisterNewDevice()

GLOBAL bit32 saRegisterNewDevice ( agsaRoot_t agRoot,
agsaContext_t agContext,
bit32  queueNum,
agsaDeviceInfo_t agDeviceInfo,
agsaPortContext_t agPortContext,
bit16  hostAssignedDeviceId 
)

Register New Device from a specific local port.

Register New Device API

Parameters
agRootHandles for this instance of SAS/SATA hardware
agContextPointer to this API context
agDeviceInfoPointer to this instance of device info
agPortContextPointer to this instance of port context
Returns
If discovery is started/aborted successfully
  • AGSA_RC_SUCCESS discovery is started/aborted successfully
  • AGSA_RC_FAILURE discovery is not started/aborted successfully

Definition at line 302 of file sadisc.c.

References agsaIOMap_s::agContext, agFALSE, agNULL, AGSA_RC_BUSY, AGSA_RC_FAILURE, AGSA_RC_SUCCESS, agTRUE, ATAPI_DEVICE_FLAG, AWT_DEVICE_FLAG, DEV_INFO_IR_SHIFT, DEV_INFO_MASK, DEV_INFO_MCN_SHIFT, DEV_LINK_RATE, agsaSASIdentify_s::deviceType_addressFrameType, agsaDeviceInfo_s::devType_S_Rate, agsaDeviceInfo_s::firstBurstSize, agsaDeviceInfo_s::flag, agsaLLRoot_s::freeIORequests, agsaLLRoot_s::freeReservedRequests, hpDBG_VERY_LOUD, agsaIORequestDesc_s::HTag, agsaLLRoot_s::IOMap, IOMB_SIZE64, agsaIOMap_s::IORequest, agsaDeviceInfo_s::it_NexusTimeout, agsaIORequestDesc_s::linkNode, LL_IOREQ_LOCKEQ_LOCK, MARK_OFF, MPI_CATEGORY_SAS_SATA, mpiBuildCmd(), OPC_INB_REG_DEV, OPC_INB_SPC_REG_DEV, OS_ASSERT, OSSA_OFFSET_OF, ossaSingleThreadedEnter(), ossaSingleThreadedLeave(), agsaIORequestDesc_s::pDevice, agsaPort_s::portId, PORTID_MASK, SA_DBG1, SA_DBG2, SA_DBG3, SA_RESERVED_REQUEST_COUNT, saLlistIOAdd, saLlistIOGetCount, saLlistIOGetHead, saLlistIORemove, agsaDeviceInfo_s::sasAddressHi, agsaSASIdentify_s::sasAddressHi, agsaDeviceInfo_s::sasAddressLo, agsaSASIdentify_s::sasAddressLo, agsaRegDevCmd_s::sasAddrHi, agsaRegDevCmd_s::sasAddrLo, agsaContext_s::sdkData, SHIFT2, SHIFT24, SHIFT31, SHIFT4, SHIFT9, si_memset(), siPortSASDeviceAdd(), siPortSATADeviceAdd(), smIS_SPC(), agsaDeviceInfo_s::smpTimeout, smTrace, smTraceFuncEnter, smTraceFuncExit, agsaIOMap_s::Tag, agsaIORequestDesc_s::valid, and XFER_RDY_PRIORTY_DEVICE_FLAG.

Referenced by ossaDeviceRegistrationCB(), and tdssAddSASToSharedcontext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saSetDeviceInfo()

GLOBAL bit32 saSetDeviceInfo ( agsaRoot_t agRoot,
agsaContext_t agContext,
bit32  queueNum,
agsaDevHandle_t agDevHandle,
bit32  option,
bit32  param,
ossaSetDeviceInfoCB_t  agCB 
)

Set Device Information.

Set SAS/SATA device information API

Parameters
agRootHandles for this instance of SAS/SATA hardware
agContextPointer to this API context
queueNumIQ/OQ number
agDevHandlePointer of device handle
optiondevice general information or extended information
paramParameter of Set Device Infomation
Returns
  • AGSA_RC_SUCCESS
  • AGSA_RC_FAILURE

Definition at line 672 of file sadisc.c.

References agNULL, AGSA_RC_FAILURE, DEVICE_ID_BITS, agsaDeviceMap_s::DeviceHandle, agsaDeviceMap_s::DeviceIdFromFW, agsaLLRoot_s::DeviceMap, agsaDeviceDesc_s::DeviceMapIndex, hpDBG_VERY_LOUD, mpiSetDeviceInfoCmd(), agsaDeviceDesc_s::option, OS_ASSERT, agsaDeviceDesc_s::param, SA_DBG1, SA_DBG2, SA_DBG3, agsaContext_s::sdkData, smTraceFuncEnter, and smTraceFuncExit.

Referenced by itdssOpenCnxErrorConnectionRateNotSupportedHandler(), and ossaDeviceHandleAccept().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saSetDeviceState()

GLOBAL bit32 saSetDeviceState ( agsaRoot_t agRoot,
agsaContext_t agContext,
bit32  queueNum,
agsaDevHandle_t agDevHandle,
bit32  newDeviceState 
)

Set Device State.

Set SAS/SATA device state API

Parameters
agRootHandles for this instance of SAS/SATA hardware
agContextPointer to this API context
queueNumIQ/OQ number
agDevHandlePointer of device handler
newDeviceStatenew device state
Returns
  • AGSA_RC_SUCCESS
  • AGSA_RC_FAILURE

Definition at line 801 of file sadisc.c.

References agNULL, AGSA_RC_FAILURE, DEVICE_ID_BITS, agsaDeviceMap_s::DeviceHandle, agsaDeviceMap_s::DeviceIdFromFW, agsaLLRoot_s::DeviceMap, agsaDeviceDesc_s::DeviceMapIndex, hpDBG_VERY_LOUD, mpiSetDeviceStateCmd(), OS_ASSERT, SA_DBG1, SA_DBG3, agsaContext_s::sdkData, smTraceFuncEnter, and smTraceFuncExit.

Referenced by itdssDsNonOperationalHandler(), itdssTaskCompleted(), ossaHwCB(), ossaLocalPhyControlCB(), smLocalPhyControlCB(), smPhyControlRespRcvd(), smsatDelayedProcessAbnormalCompletion(), smsatIDStartCB(), smsatProcessAbnormalCompletion(), smSMPCompleted(), smTaskManagement(), and tdsaPhyControlRespRcvd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ siRemoveDevHandle()

GLOBAL bit32 siRemoveDevHandle ( agsaRoot_t agRoot,
agsaDevHandle_t agDevHandle 
)

Function for target to remove stale initiator device handle.

function is called to ask the LL layer to remove all LL layer internal resources associated with a device handle

Parameters
agRootHandles for this instance of SAS/SATA hardware
agDevHandleHandle of the device that this I/O request will be made on
Returns
If the device handle is removed successfully
  • AGSA_RC_SUCCESS the device handle is removed successfully
  • AGSA_RC_BUSY the device is busy, cannot be removed now

Definition at line 158 of file sadisc.c.

References agFALSE, agNULL, AGSA_RC_FAILURE, AGSA_RC_SUCCESS, agTRUE, agsaDeviceDesc_s::deviceType, DIRECT_SATA_DEVICE, hpDBG_VERY_LOUD, agsaDeviceDesc_s::initiatorDevHandle, OS_ASSERT, agsaDeviceDesc_s::pPort, SA_ASSERT, SA_DBG1, SA_DBG3, agsaContext_s::sdkData, siPortDeviceRemove(), smTraceFuncEnter, smTraceFuncExit, SSP_SMP_DEVICE, STP_DEVICE, and agsaDeviceDesc_s::targetDevHandle.

Referenced by mpiDeregDevHandleRsp().

Here is the call graph for this function:
Here is the caller graph for this function: