/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2004-2012 Emulex. All rights reserved.
* Use is subject to license terms.
*/
#include <emlxs.h>
/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
extern void
emlxs_null_func() {}
static uint32_t
{
/* Check if the event is being requested */
return (1);
}
#ifdef SAN_DIAG_SUPPORT
return (1);
}
#endif /* SAN_DIAG_SUPPORT */
return (0);
} /* emlxs_event_check() */
extern uint32_t
{
/* Clear the queue */
/* Get the current interrupt block cookie */
&iblock);
/* Create the mutex lock */
}
#ifdef MSI_SUPPORT
else {
/* Create event mutex lock */
}
#endif
return (1);
} /* emlxs_event_queue_create() */
extern void
{
uint32_t i;
/* Clear all event masks and broadcast a wakeup */
/* to clear any sleeping threads */
if (hba->event_mask) {
hba->event_mask = 0;
hba->event_timer = 0;
wakeup = 1;
}
for (i = 0; i < MAX_VPORTS; i++) {
if (vport->sd_event_mask) {
vport->sd_event_mask = 0;
wakeup = 1;
}
}
if (wakeup) {
BUSYWAIT_MS(10);
}
/* Destroy the remaining events */
}
/* Destroy the queue lock */
/* Clear the queue */
return;
} /* emlxs_event_queue_destroy() */
/* Event queue lock must be held */
static void
{
} else {
}
}
}
}
}
missed = 1;
}
}
"%s[%d]: flag=%x missed=%d cnt=%d",
/* Call notification handler */
}
/* Free context buffer */
}
/* Free entry buffer */
return;
} /* emlxs_event_destroy() */
extern void
{
uint32_t i;
goto failed;
}
/* Create event entry */
sizeof (emlxs_event_entry_t), KM_NOSLEEP))) {
goto failed;
}
/* Initialize */
/* Set the event timer */
}
/* Eventq id starts with 1 */
}
/* Set the event id */
/* Set last event table */
for (i = 0; i < 32; i++) {
if (mask & 0x01) {
}
mask >>= 1;
}
/* Put event on bottom of queue */
} else {
}
}
/* Broadcast the event */
return;
}
return;
} /* emlxs_event() */
extern void
{
return;
}
return;
}
while (entry) {
continue;
}
/* Event timed out, destroy it */
}
}
/* Set next event timer check */
return;
} /* emlxs_timer_check_events() */
extern void
{
/* Check if the event is being requested */
return;
}
if (size > MAX_RSCN_PAYLOAD) {
}
/* Save a copy of the payload for the event log */
return;
}
/*
* Buffer Format:
* word[0] = DID of the RSCN
* word[1] = RSCN Payload
*/
return;
} /* emlxs_log_rscn_event() */
extern void
{
/* Check if the event is being requested */
return;
}
if (size > MAX_RSCN_PAYLOAD) {
}
/* Save a copy of the payload for the event log */
"%s: Unable to allocate buffer.",
return;
}
/*
* Buffer Format:
* word[0 - 4] = WWPN of the RSCN
* word[5] = RSCN Payload
*/
return;
} /* emlxs_log_vportrscn_event() */
extern uint32_t
{
continue;
}
/* This will prevent a CT exchange abort */
/* in emlxs_ct_event_destroy() */
found = 1;
break;
}
}
return (found);
} /* emlxs_flush_ct_event() */
extern uint32_t
{
/* Check if the event is being requested */
return (1);
}
if (size > MAX_CT_PAYLOAD) {
}
/* Save a copy of the payload for the event log */
return (1);
}
/*
* Buffer Format:
* word[0] = RXID tag for outgoing reply to this CT request
* word[1] = CT Payload
*/
return (0);
} /* emlxs_log_ct_event() */
extern void
{
/* Abort exchange */
}
return;
} /* emlxs_ct_event_destroy() */
extern void
{
/* Check if the event is being requested */
return;
}
/* Save a copy of the buffer for the event log */
return;
}
/*
* Buffer Format:
* word[0] = Linkspeed:8
* word[0] = LIP_type:8
* word[0] = resv1:8
* word[0] = resv2:8
* word[1] = dfc_linkinfo_t data
*/
*resv1 = 0;
*resv2 = 0;
*linkspeed = 0;
*liptype = 0;
} else {
/* Set linkspeed */
} else {
}
/* Set LIP type */
}
} else {
}
} else {
}
}
} else {
} else {
}
}
}
return;
} /* emlxs_log_link_event() */
extern void
{
/* Check if the event is being requested */
#ifdef DUMP_SUPPORT
/* Schedule a dump thread */
#endif /* DUMP_SUPPORT */
return;
}
/* Save a copy of the buffer for the event log */
"%s: Unable to allocate buffer.",
return;
}
} else {
size = 0;
}
return;
} /* emlxs_log_dump_event() */
extern void
{
/* Check if the event is being requested */
#ifdef DUMP_SUPPORT
/* Schedule a dump thread */
#endif /* DUMP_SUPPORT */
return;
}
return;
}
return;
} /* emlxs_log_temp_event() */
extern void
{
/* Check if the event is being requested */
return;
}
/* Check if this is a FCOE adapter */
return;
}
size = sizeof (menlo_init_rsp_t);
return;
}
return;
} /* emlxs_log_fcoe_event() */
extern void
{
return;
}
/* ASYNC_STATUS_CN response size */
size = 64;
return;
}
return;
} /* emlxs_log_async_event() */
extern uint32_t
{
return (DFC_ARG_NULL);
}
max_events = *eventcount;
*eventcount = 0;
*missed = 0;
/* Account for missed events */
} else {
}
return (0);
}
/* A new event has occurred since last acquisition */
events = 0;
/* Skip old events */
continue;
}
/* Process this entry */
case EVT_LINK:
Reserved[0] = 0;
Reserved[1] = 0;
Reserved[2] = 0;
} else {
if ((linkinfo->a_topology ==
LNK_PUBLIC_LOOP) ||
(linkinfo->a_topology ==
LNK_LOOP)) {
Reserved[0] = 2;
} else {
Reserved[0] = 1;
}
}
eventinfo++;
events++;
break;
case EVT_RSCN:
word[0] & 0xFFFFFF;
/* word[1] is the RSCN payload command */
switch (format) {
case 0: /* Port */
break;
case 1: /* Area */
break;
case 2: /* Domain */
break;
case 3: /* Network */
NPortPage = 0;
break;
}
0;
0;
eventinfo++;
events++;
break;
}
}
/* Return number of events acquired */
*eventcount = events;
return (0);
} /* emlxs_get_dfc_eventinfo() */
void
{
uint32_t i;
}
/* Calculate the event index */
for (i = 0; i < 32; i++) {
if (mask & 0x01) {
break;
}
mask >>= 1;
}
if (i == 32) {
return;
}
/* Check if no new event has occurred */
if (!sleep) {
return;
}
/* While event is still active and */
/* no new event has been logged */
/* Check if thread was killed by kernel */
if (rc == 0) {
return;
}
}
/* If the event is no longer registered then */
/* return immediately */
return;
}
}
/* !!! An event has occurred since last_id !!! */
/* Check if event data is not being requested */
if (!size) {
/* If so, then just return the last event id */
return;
}
/* !!! The requester wants the next event buffer !!! */
found = 0;
while (entry) {
found = 1;
break;
}
}
if (!found) {
/* Update last_id to the last known event */
/* Try waiting again if we can */
goto wait_for_event;
}
/* !!! Next event found !!! */
/* Copy the context buffer to the buffer provided */
}
/* Event has been retrieved by DFCLIB */
}
return;
} /* emlxs_get_dfc_event() */
{
return (0);
} /* emlxs_kill_dfc_event() */
#ifdef SAN_DIAG_SUPPORT
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_plogi_rcv_v0);
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
sizeof (HBA_WWN));
sizeof (HBA_WWN));
return;
} /* emlxs_log_sd_basic_els_event() */
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_prlo_rcv_v0);
KM_NOSLEEP))) {
"%s PRLO: Unable to allocate buffer.",
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
sizeof (HBA_WWN));
return;
} /* emlxs_log_sd_prlo_event() */
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_lsrjt_rcv_v0);
KM_NOSLEEP))) {
"%s LSRJT: Unable to allocate buffer.",
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
sizeof (HBA_WWN));
return;
} /* emlxs_log_sd_lsrjt_event() */
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_pbsy_rcv_v0);
KM_NOSLEEP))) {
"%s BSY: Unable to allocate buffer.",
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
if (remoteport == NULL)
else
{
sizeof (HBA_WWN));
}
return;
} /* emlxs_log_sd_fc_bsy_event() */
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_fcprdchkerr_v0);
KM_NOSLEEP))) {
"%s RDCHK: Unable to allocate buffer.",
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
sizeof (HBA_WWN));
return;
} /* emlxs_log_sd_rdchk_event() */
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_scsi_generic_v0);
KM_NOSLEEP))) {
"%s: Unable to allocate buffer.",
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
sizeof (HBA_WWN));
return;
} /* emlxs_log_sd_scsi_event() */
extern void
{
/* Check if the event is being requested */
return;
}
size = sizeof (struct sd_scsi_checkcond_v0);
KM_NOSLEEP))) {
"%s CHECK: Unable to allocate buffer.",
return;
}
/*
* we are using version field to store subtype, libdfc
* will fix this up before returning data to app.
*/
sizeof (HBA_WWN));
return;
} /* emlxs_log_sd_scsi_check_event() */
void
{
uint32_t i;
}
/* Calculate the event index */
for (i = 0; i < 32; i++) {
if (mask & 0x01) {
break;
}
mask >>= 1;
}
if (i == 32) {
return;
}
/* Check if no new event has ocurred */
if (!sleep) {
return;
}
/* While event is active and no new event has been logged */
/* Check if thread was killed by kernel */
if (rc == 0) {
return;
}
}
/* If the event is no longer registered then return */
return;
}
}
/* !!! An event has occurred since last_id !!! */
/* Check if event data is not being requested */
if (!size) {
/* If so, then just return the last event id */
return;
}
/* !!! The requester wants the next event buffer !!! */
found = 0;
while (entry) {
found = 1;
break;
}
}
if (!found) {
/* Update last_id to the last known event */
/* Try waiting again if we can */
goto wait_for_event;
}
/* !!! Next event found !!! */
/* Copy the context buffer to the buffer provided */
}
/* Event has been retrieved by SANDIAG */
}
return;
} /* emlxs_get_sd_event */
#endif /* SAN_DIAG_SUPPORT */