Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
Show First 20 Lines • Show All 527 Lines • ▼ Show 20 Lines | static int agtiapi_CharIoctl( struct cdev *dev, | ||||
int fflag, | int fflag, | ||||
struct thread *td ) | struct thread *td ) | ||||
{ | { | ||||
struct sema mx; | struct sema mx; | ||||
datatosend *load; // structure defined in lxcommon.h | datatosend *load; // structure defined in lxcommon.h | ||||
tiIOCTLPayload_t *pIoctlPayload; | tiIOCTLPayload_t *pIoctlPayload; | ||||
struct agtiapi_softc *pCard; | struct agtiapi_softc *pCard; | ||||
pCard=dev->si_drv1; | pCard=dev->si_drv1; | ||||
void *param1 = NULL; | |||||
void *param2 = NULL; | |||||
void *param3 = NULL; | |||||
U32 status = 0; | U32 status = 0; | ||||
U32 retValue; | U32 retValue; | ||||
int err = 0; | int err = 0; | ||||
int error = 0; | int error = 0; | ||||
tdDeviceListPayload_t *pDeviceList = NULL; | tdDeviceListPayload_t *pDeviceList = NULL; | ||||
unsigned long flags; | unsigned long flags; | ||||
switch (cmd) | switch (cmd) | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | else if (pIoctlPayload->MajorFunction == IOCTL_MJ_FATAL_ERROR_DUMP_COMPLETE) | ||||
status = IOCTL_CALL_FAIL; | status = IOCTL_CALL_FAIL; | ||||
} | } | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
status = tiCOMMgntIOCTL( &pCard->tiRoot, | status = tiCOMMgntIOCTL( &pCard->tiRoot, | ||||
pIoctlPayload, | pIoctlPayload, | ||||
pCard, | pCard, | ||||
param2, | NULL, | ||||
param3 ); | NULL ); | ||||
if (status == IOCTL_CALL_PENDING) | if (status == IOCTL_CALL_PENDING) | ||||
{ | { | ||||
ostiIOCTLWaitForSignal(&pCard->tiRoot,NULL, NULL, NULL); | ostiIOCTLWaitForSignal(&pCard->tiRoot,NULL, NULL, NULL); | ||||
status = IOCTL_CALL_SUCCESS; | status = IOCTL_CALL_SUCCESS; | ||||
} | } | ||||
} | } | ||||
pCard->pIoctlSem = NULL; | pCard->pIoctlSem = NULL; | ||||
err = 0; | err = 0; | ||||
▲ Show 20 Lines • Show All 1,402 Lines • ▼ Show 20 Lines | if (TID < 0 || TID >= maxTargets) | ||||
ccb->ccb_h.status &= ~CAM_STATUS_MASK; | ccb->ccb_h.status &= ~CAM_STATUS_MASK; | ||||
ccb->ccb_h.status |= CAM_DEV_NOT_THERE;//CAM_REQ_CMP; | ccb->ccb_h.status |= CAM_DEV_NOT_THERE;//CAM_REQ_CMP; | ||||
xpt_done(ccb); | xpt_done(ccb); | ||||
return tiError; | return tiError; | ||||
} | } | ||||
/* get a ccb */ | /* get a ccb */ | ||||
if ((pccb = agtiapi_GetCCB(pmcsc)) == NULL) | if ((pccb = agtiapi_GetCCB(pmcsc)) == NULL) | ||||
{ | { | ||||
ag_device_t *targ; | |||||
AGTIAPI_PRINTK("agtiapi_QueueCmnd_: GetCCB ERROR\n"); | AGTIAPI_PRINTK("agtiapi_QueueCmnd_: GetCCB ERROR\n"); | ||||
if (pmcsc != NULL) | if (pmcsc != NULL) | ||||
{ | { | ||||
ag_device_t *targ; | |||||
TID = INDEX(pmcsc, TID); | TID = INDEX(pmcsc, TID); | ||||
targ = &pmcsc->pDevList[TID]; | targ = &pmcsc->pDevList[TID]; | ||||
} | |||||
if (targ != NULL) | |||||
{ | |||||
agtiapi_adjust_queue_depth(ccb->ccb_h.path,targ->qdepth); | agtiapi_adjust_queue_depth(ccb->ccb_h.path,targ->qdepth); | ||||
} | } | ||||
ccb->ccb_h.status &= ~CAM_SIM_QUEUED; | ccb->ccb_h.status &= ~CAM_SIM_QUEUED; | ||||
ccb->ccb_h.status &= ~CAM_STATUS_MASK; | ccb->ccb_h.status &= ~CAM_STATUS_MASK; | ||||
ccb->ccb_h.status |= CAM_REQUEUE_REQ; | ccb->ccb_h.status |= CAM_REQUEUE_REQ; | ||||
xpt_done(ccb); | xpt_done(ccb); | ||||
return tiBusy; | return tiBusy; | ||||
} | } | ||||
pccb->pmcsc = pmcsc; | pccb->pmcsc = pmcsc; | ||||
/* initialize Command Control Block (CCB) */ | /* initialize Command Control Block (CCB) */ | ||||
▲ Show 20 Lines • Show All 993 Lines • ▼ Show 20 Lines | |||||
Return: | Return: | ||||
Note: | Note: | ||||
******************************************************************************/ | ******************************************************************************/ | ||||
STATIC void agtiapi_StartIO( struct agtiapi_softc *pmcsc ) | STATIC void agtiapi_StartIO( struct agtiapi_softc *pmcsc ) | ||||
{ | { | ||||
ccb_t *pccb; | ccb_t *pccb; | ||||
int TID; | int TID; | ||||
ag_device_t *targ; | ag_device_t *targ; | ||||
struct ccb_relsim crs; | |||||
AGTIAPI_IO( "agtiapi_StartIO: start\n" ); | AGTIAPI_IO( "agtiapi_StartIO: start\n" ); | ||||
AG_LOCAL_LOCK( &pmcsc->sendLock ); | AG_LOCAL_LOCK( &pmcsc->sendLock ); | ||||
pccb = pmcsc->ccbSendHead; | pccb = pmcsc->ccbSendHead; | ||||
/* if link is down, do nothing */ | /* if link is down, do nothing */ | ||||
if ((pccb == NULL) || pmcsc->flags & AGTIAPI_RESET) | if ((pccb == NULL) || pmcsc->flags & AGTIAPI_RESET) | ||||
▲ Show 20 Lines • Show All 1,239 Lines • ▼ Show 20 Lines | agtiapi_LogEvent( pmcsc, | ||||
0, | 0, | ||||
"agtiapi_eh_HostReset! " ); | "agtiapi_eh_HostReset! " ); | ||||
#endif | #endif | ||||
return agtiapi_DoSoftReset( pmcsc ); | return agtiapi_DoSoftReset( pmcsc ); | ||||
} | } | ||||
int agtiapi_eh_DeviceReset( struct agtiapi_softc *pmcsc, union ccb *cmnd ) | |||||
{ | |||||
AGTIAPI_PRINTK( "agtiapi_eh_HostReset: ccb pointer %p\n", | |||||
cmnd ); | |||||
if( cmnd == NULL ) | |||||
{ | |||||
printf( "agtiapi_eh_HostReset: null command, skipping reset.\n" ); | |||||
return tiInvalidHandle; | |||||
} | |||||
return agtiapi_DoSoftReset( pmcsc ); | |||||
} | |||||
/****************************************************************************** | /****************************************************************************** | ||||
agtiapi_QueueCCB() | agtiapi_QueueCCB() | ||||
Purpose: | Purpose: | ||||
Put ccb in ccb queue at the tail | Put ccb in ccb queue at the tail | ||||
Parameters: | Parameters: | ||||
struct agtiapi_softc *pmcsc (IN) Pointer to HBA data structure | struct agtiapi_softc *pmcsc (IN) Pointer to HBA data structure | ||||
pccb_t *phead (IN) Double pointer to ccb queue head | pccb_t *phead (IN) Double pointer to ccb queue head | ||||
▲ Show 20 Lines • Show All 1,288 Lines • ▼ Show 20 Lines | |||||
Parameters: | Parameters: | ||||
struct agtiapi_softc *pCard (IN) Pointer to the HBA data structure | struct agtiapi_softc *pCard (IN) Pointer to the HBA data structure | ||||
Return: | Return: | ||||
Note: | Note: | ||||
******************************************************************************/ | ******************************************************************************/ | ||||
static void agtiapi_scan(struct agtiapi_softc *pmcsc) | static void agtiapi_scan(struct agtiapi_softc *pmcsc) | ||||
{ | { | ||||
union ccb *ccb; | union ccb *ccb; | ||||
int bus, tid, lun, card_no; | int bus, tid, lun; | ||||
static int num=0; | |||||
AGTIAPI_PRINTK("agtiapi_scan: start cardNO %d \n", pmcsc->cardNo); | AGTIAPI_PRINTK("agtiapi_scan: start cardNO %d \n", pmcsc->cardNo); | ||||
bus = cam_sim_path(pmcsc->sim); | bus = cam_sim_path(pmcsc->sim); | ||||
tid = CAM_TARGET_WILDCARD; | tid = CAM_TARGET_WILDCARD; | ||||
lun = CAM_LUN_WILDCARD; | lun = CAM_LUN_WILDCARD; | ||||
▲ Show 20 Lines • Show All 982 Lines • Show Last 20 Lines |