FreeBSD/sys/dev/pms/freebsd/driver/common/lxosapi.c
/******************************************************************************
ostiPortEvent()
Purpose:
  Call back function to inform OS the events of port state change.
Parameters:
  tiRoot_t *ptiRoot(IN)          Pointer to driver root data structure 
  tiPortEvent_t eventType (IN)   Type of port event:
                                 tiPortPanic
                                 tiPortResetComplete
                                 tiPortNameServerDown
                                 tiPortLinkDown
                                 tiPortLinkUp
                                 tiPortStarted
                                 tiPortStopped
                                 tiPortShutdown
                                 tiPortInitComplete
  void *pParm(IN)                Pointer to event specific structure
Return:
  None 
******************************************************************************/
ostiPortEvent()
Purpose:
Call back function to inform OS the events of port state change.
ostiPortEvent () Purpose : Call back function to inform OS the events of port state change .
void
ostiPortEvent(tiRoot_t      *ptiRoot, 
              tiPortEvent_t eventType, 
              U32           status, 
              void          *pParm)
{
  struct agtiapi_softc  *pCard;
  ag_portal_data_t *pPortalData;
  AGTIAPI_PRINTK("ostiPortEvent: start eventType 0x%x\n", eventType);
  pCard = TIROOT_TO_CARD(ptiRoot);
  switch (eventType) 
  {
  case tiPortStarted:
       pCard->flags |= AGTIAPI_CB_DONE;
       pPortalData = PORTAL_CONTEXT_TO_PORTALDATA(pParm);
       PORTAL_STATUS(pPortalData) |= AGTIAPI_PORT_START;
       AGTIAPI_PRINTK("PortStarted - portal %p, status %x\n",
                      pPortalData, PORTAL_STATUS(pPortalData));
       break;
  case tiPortLinkDown:
       pPortalData = PORTAL_CONTEXT_TO_PORTALDATA(pParm);
       PORTAL_STATUS(pPortalData) &= ~AGTIAPI_PORT_LINK_UP;
       AGTIAPI_PRINTK("PortLinkDown - portal %p\n", pPortalData);
       break;
  case tiPortLinkUp:
       pPortalData = PORTAL_CONTEXT_TO_PORTALDATA(pParm);
       PORTAL_STATUS(pPortalData) |= AGTIAPI_PORT_LINK_UP;
       AGTIAPI_PRINTK("PortLinkUp - portal %p\n", pPortalData);
#ifdef INITIATOR_DRIVER
#ifndef HOTPLUG_SUPPORT
       if (!(pCard->flags & AGTIAPI_INIT_TIME))
#endif
#endif
       break;
case tiPortDiscoveryReady:
       pCard->flags |= AGTIAPI_CB_DONE;
       pPortalData = PORTAL_CONTEXT_TO_PORTALDATA(pParm);
       PORTAL_STATUS(pPortalData) |= AGTIAPI_PORT_DISC_READY;
       AGTIAPI_PRINTK("PortDiscoveryReady - portal %p, status 0x%x\n",
                      pPortalData, PORTAL_STATUS(pPortalData));
#ifdef INITIATOR_DRIVER
#ifndef HOTPLUG_SUPPORT
       if (!(pCard->flags & AGTIAPI_INIT_TIME))
#endif
         tiINIDiscoverTargets(&pCard->tiRoot,
                              &pPortalData->portalInfo.tiPortalContext,
                              FORCE_PERSISTENT_ASSIGN_MASK);
#endif
       break;
  case tiPortNameServerDown:
       AGTIAPI_PRINTK("PortNameSeverDown\n");
       pPortalData = PORTAL_CONTEXT_TO_PORTALDATA(pParm);
       PORTAL_STATUS(pPortalData) &= ~AGTIAPI_NAME_SERVER_UP;
       break;
  case tiPortPanic:
       AGTIAPI_PRINTK("PortPanic\n");
       AGTIAPI_PRINTK( "## PortEvent\n" );
       pCard->flags |= AGTIAPI_PORT_PANIC;
       break;
  case tiPortResetComplete:
       AGTIAPI_PRINTK("PortResetComplete\n");
       pCard->flags |= AGTIAPI_CB_DONE;
       if (status == tiSuccess)
         pCard->flags |= AGTIAPI_RESET_SUCCESS;
       break;
  case tiPortShutdown:
       AGTIAPI_PRINTK("PortShutdown\n");
       pCard->flags |= AGTIAPI_CB_DONE;
       pCard->flags |= AGTIAPI_PORT_SHUTDOWN;
       break;
  case tiPortStopped:
       pCard->flags |= AGTIAPI_CB_DONE;
       pPortalData = PORTAL_CONTEXT_TO_PORTALDATA(pParm);
       PORTAL_STATUS(pPortalData) |= AGTIAPI_PORT_STOPPED;
       AGTIAPI_PRINTK("PortStopped - portal %p\n", pPortalData);
       break;
  case tiEncryptOperation:
       break;
  case tiModePageOperation:
       break;
  default:
       AGTIAPI_PRINTK("PortEvent - %d (Unknown)\n", eventType);
       break;
  }
  return;
}
void ostiPortEvent ( tiRoot_t * ptiRoot , tiPortEvent_t eventType , U32 status , void * pParm ) { struct agtiapi_softc * pCard ; ag_portal_data_t * pPortalData ; AGTIAPI_PRINTK ( " \n " , eventType ) ; pCard = TIROOT_TO_CARD ( ptiRoot ) ; switch ( eventType ) { case tiPortStarted : pCard -> flags |= AGTIAPI_CB_DONE ; pPortalData = PORTAL_CONTEXT_TO_PORTALDATA ( pParm ) ; PORTAL_STATUS ( pPortalData ) |= AGTIAPI_PORT_START ; AGTIAPI_PRINTK ( " \n " , pPortalData , PORTAL_STATUS ( pPortalData ) ) ; break ; case tiPortLinkDown : pPortalData = PORTAL_CONTEXT_TO_PORTALDATA ( pParm ) ; PORTAL_STATUS ( pPortalData ) &= ~ AGTIAPI_PORT_LINK_UP ; AGTIAPI_PRINTK ( " \n " , pPortalData ) ; break ; case tiPortLinkUp : pPortalData = PORTAL_CONTEXT_TO_PORTALDATA ( pParm ) ; PORTAL_STATUS ( pPortalData ) |= AGTIAPI_PORT_LINK_UP ; AGTIAPI_PRINTK ( " \n " , pPortalData ) ; #ifdef INITIATOR_DRIVER #ifndef HOTPLUG_SUPPORT if ( ! ( pCard -> flags & AGTIAPI_INIT_TIME ) ) #endif #endif break ; case tiPortDiscoveryReady : pCard -> flags |= AGTIAPI_CB_DONE ; pPortalData = PORTAL_CONTEXT_TO_PORTALDATA ( pParm ) ; PORTAL_STATUS ( pPortalData ) |= AGTIAPI_PORT_DISC_READY ; AGTIAPI_PRINTK ( " \n " , pPortalData , PORTAL_STATUS ( pPortalData ) ) ; #ifdef INITIATOR_DRIVER #ifndef HOTPLUG_SUPPORT if ( ! ( pCard -> flags & AGTIAPI_INIT_TIME ) ) #endif tiINIDiscoverTargets ( & pCard -> tiRoot , & pPortalData -> portalInfo . tiPortalContext , FORCE_PERSISTENT_ASSIGN_MASK ) ; #endif break ; case tiPortNameServerDown : AGTIAPI_PRINTK ( " \n " ) ; pPortalData = PORTAL_CONTEXT_TO_PORTALDATA ( pParm ) ; PORTAL_STATUS ( pPortalData ) &= ~ AGTIAPI_NAME_SERVER_UP ; break ; case tiPortPanic : AGTIAPI_PRINTK ( " \n " ) ; AGTIAPI_PRINTK ( " \n " ) ; pCard -> flags |= AGTIAPI_PORT_PANIC ; break ; case tiPortResetComplete : AGTIAPI_PRINTK ( " \n " ) ; pCard -> flags |= AGTIAPI_CB_DONE ; if ( status == tiSuccess ) pCard -> flags |= AGTIAPI_RESET_SUCCESS ; break ; case tiPortShutdown : AGTIAPI_PRINTK ( " \n " ) ; pCard -> flags |= AGTIAPI_CB_DONE ; pCard -> flags |= AGTIAPI_PORT_SHUTDOWN ; break ; case tiPortStopped : pCard -> flags |= AGTIAPI_CB_DONE ; pPortalData = PORTAL_CONTEXT_TO_PORTALDATA ( pParm ) ; PORTAL_STATUS ( pPortalData ) |= AGTIAPI_PORT_STOPPED ; AGTIAPI_PRINTK ( " \n " , pPortalData ) ; break ; case tiEncryptOperation : break ; case tiModePageOperation : break ; default : AGTIAPI_PRINTK ( " \n " , eventType ) ; break ; } return ; }
ostiPortEvent()
Purpose:
Call back function to inform OS the events of port state change.
ostiPortEvent () Purpose : Call back function to inform OS the events of port state change .
//         agtiapi_StartIO(pCard);