1*4882a593Smuzhiyun /******************************************************************* 2*4882a593Smuzhiyun * This file is part of the Emulex Linux Device Driver for * 3*4882a593Smuzhiyun * Fibre Channel Host Bus Adapters. * 4*4882a593Smuzhiyun * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * 5*4882a593Smuzhiyun * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6*4882a593Smuzhiyun * Copyright (C) 2010 Emulex. All rights reserved. * 7*4882a593Smuzhiyun * EMULEX and SLI are trademarks of Emulex. * 8*4882a593Smuzhiyun * www.broadcom.com * 9*4882a593Smuzhiyun * * 10*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or * 11*4882a593Smuzhiyun * modify it under the terms of version 2 of the GNU General * 12*4882a593Smuzhiyun * Public License as published by the Free Software Foundation. * 13*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful. * 14*4882a593Smuzhiyun * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * 15*4882a593Smuzhiyun * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * 16*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * 17*4882a593Smuzhiyun * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * 18*4882a593Smuzhiyun * TO BE LEGALLY INVALID. See the GNU General Public License for * 19*4882a593Smuzhiyun * more details, a copy of which can be found in the file COPYING * 20*4882a593Smuzhiyun * included with this package. * 21*4882a593Smuzhiyun *******************************************************************/ 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun /* Event definitions for RegisterForEvent */ 24*4882a593Smuzhiyun #define FC_REG_LINK_EVENT 0x0001 /* link up / down events */ 25*4882a593Smuzhiyun #define FC_REG_RSCN_EVENT 0x0002 /* RSCN events */ 26*4882a593Smuzhiyun #define FC_REG_CT_EVENT 0x0004 /* CT request events */ 27*4882a593Smuzhiyun #define FC_REG_DUMP_EVENT 0x0010 /* Dump events */ 28*4882a593Smuzhiyun #define FC_REG_TEMPERATURE_EVENT 0x0020 /* temperature events */ 29*4882a593Smuzhiyun #define FC_REG_VPORTRSCN_EVENT 0x0040 /* Vport RSCN events */ 30*4882a593Smuzhiyun #define FC_REG_ELS_EVENT 0x0080 /* lpfc els events */ 31*4882a593Smuzhiyun #define FC_REG_FABRIC_EVENT 0x0100 /* lpfc fabric events */ 32*4882a593Smuzhiyun #define FC_REG_SCSI_EVENT 0x0200 /* lpfc scsi events */ 33*4882a593Smuzhiyun #define FC_REG_BOARD_EVENT 0x0400 /* lpfc board events */ 34*4882a593Smuzhiyun #define FC_REG_ADAPTER_EVENT 0x0800 /* lpfc adapter events */ 35*4882a593Smuzhiyun #define FC_REG_EVENT_MASK (FC_REG_LINK_EVENT | \ 36*4882a593Smuzhiyun FC_REG_RSCN_EVENT | \ 37*4882a593Smuzhiyun FC_REG_CT_EVENT | \ 38*4882a593Smuzhiyun FC_REG_DUMP_EVENT | \ 39*4882a593Smuzhiyun FC_REG_TEMPERATURE_EVENT | \ 40*4882a593Smuzhiyun FC_REG_VPORTRSCN_EVENT | \ 41*4882a593Smuzhiyun FC_REG_ELS_EVENT | \ 42*4882a593Smuzhiyun FC_REG_FABRIC_EVENT | \ 43*4882a593Smuzhiyun FC_REG_SCSI_EVENT | \ 44*4882a593Smuzhiyun FC_REG_BOARD_EVENT | \ 45*4882a593Smuzhiyun FC_REG_ADAPTER_EVENT) 46*4882a593Smuzhiyun /* Temperature events */ 47*4882a593Smuzhiyun #define LPFC_CRIT_TEMP 0x1 48*4882a593Smuzhiyun #define LPFC_THRESHOLD_TEMP 0x2 49*4882a593Smuzhiyun #define LPFC_NORMAL_TEMP 0x3 50*4882a593Smuzhiyun /* 51*4882a593Smuzhiyun * All net link event payloads will begin with and event type 52*4882a593Smuzhiyun * and subcategory. The event type must come first. 53*4882a593Smuzhiyun * The subcategory further defines the data that follows in the rest 54*4882a593Smuzhiyun * of the payload. Each category will have its own unique header plus 55*4882a593Smuzhiyun * any additional data unique to the subcategory. 56*4882a593Smuzhiyun * The payload sent via the fc transport is one-way driver->application. 57*4882a593Smuzhiyun */ 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun /* RSCN event header */ 60*4882a593Smuzhiyun struct lpfc_rscn_event_header { 61*4882a593Smuzhiyun uint32_t event_type; 62*4882a593Smuzhiyun uint32_t payload_length; /* RSCN data length in bytes */ 63*4882a593Smuzhiyun uint32_t rscn_payload[]; 64*4882a593Smuzhiyun }; 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun /* els event header */ 67*4882a593Smuzhiyun struct lpfc_els_event_header { 68*4882a593Smuzhiyun uint32_t event_type; 69*4882a593Smuzhiyun uint32_t subcategory; 70*4882a593Smuzhiyun uint8_t wwpn[8]; 71*4882a593Smuzhiyun uint8_t wwnn[8]; 72*4882a593Smuzhiyun }; 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun /* subcategory codes for FC_REG_ELS_EVENT */ 75*4882a593Smuzhiyun #define LPFC_EVENT_PLOGI_RCV 0x01 76*4882a593Smuzhiyun #define LPFC_EVENT_PRLO_RCV 0x02 77*4882a593Smuzhiyun #define LPFC_EVENT_ADISC_RCV 0x04 78*4882a593Smuzhiyun #define LPFC_EVENT_LSRJT_RCV 0x08 79*4882a593Smuzhiyun #define LPFC_EVENT_LOGO_RCV 0x10 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun /* special els lsrjt event */ 82*4882a593Smuzhiyun struct lpfc_lsrjt_event { 83*4882a593Smuzhiyun struct lpfc_els_event_header header; 84*4882a593Smuzhiyun uint32_t command; 85*4882a593Smuzhiyun uint32_t reason_code; 86*4882a593Smuzhiyun uint32_t explanation; 87*4882a593Smuzhiyun }; 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun /* special els logo event */ 90*4882a593Smuzhiyun struct lpfc_logo_event { 91*4882a593Smuzhiyun struct lpfc_els_event_header header; 92*4882a593Smuzhiyun uint8_t logo_wwpn[8]; 93*4882a593Smuzhiyun }; 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun /* fabric event header */ 96*4882a593Smuzhiyun struct lpfc_fabric_event_header { 97*4882a593Smuzhiyun uint32_t event_type; 98*4882a593Smuzhiyun uint32_t subcategory; 99*4882a593Smuzhiyun uint8_t wwpn[8]; 100*4882a593Smuzhiyun uint8_t wwnn[8]; 101*4882a593Smuzhiyun }; 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun /* subcategory codes for FC_REG_FABRIC_EVENT */ 104*4882a593Smuzhiyun #define LPFC_EVENT_FABRIC_BUSY 0x01 105*4882a593Smuzhiyun #define LPFC_EVENT_PORT_BUSY 0x02 106*4882a593Smuzhiyun #define LPFC_EVENT_FCPRDCHKERR 0x04 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun /* special case fabric fcprdchkerr event */ 109*4882a593Smuzhiyun struct lpfc_fcprdchkerr_event { 110*4882a593Smuzhiyun struct lpfc_fabric_event_header header; 111*4882a593Smuzhiyun uint32_t lun; 112*4882a593Smuzhiyun uint32_t opcode; 113*4882a593Smuzhiyun uint32_t fcpiparam; 114*4882a593Smuzhiyun }; 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun /* scsi event header */ 118*4882a593Smuzhiyun struct lpfc_scsi_event_header { 119*4882a593Smuzhiyun uint32_t event_type; 120*4882a593Smuzhiyun uint32_t subcategory; 121*4882a593Smuzhiyun uint32_t lun; 122*4882a593Smuzhiyun uint8_t wwpn[8]; 123*4882a593Smuzhiyun uint8_t wwnn[8]; 124*4882a593Smuzhiyun }; 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun /* subcategory codes for FC_REG_SCSI_EVENT */ 127*4882a593Smuzhiyun #define LPFC_EVENT_QFULL 0x0001 128*4882a593Smuzhiyun #define LPFC_EVENT_DEVBSY 0x0002 129*4882a593Smuzhiyun #define LPFC_EVENT_CHECK_COND 0x0004 130*4882a593Smuzhiyun #define LPFC_EVENT_LUNRESET 0x0008 131*4882a593Smuzhiyun #define LPFC_EVENT_TGTRESET 0x0010 132*4882a593Smuzhiyun #define LPFC_EVENT_BUSRESET 0x0020 133*4882a593Smuzhiyun #define LPFC_EVENT_VARQUEDEPTH 0x0040 134*4882a593Smuzhiyun 135*4882a593Smuzhiyun /* special case scsi varqueuedepth event */ 136*4882a593Smuzhiyun struct lpfc_scsi_varqueuedepth_event { 137*4882a593Smuzhiyun struct lpfc_scsi_event_header scsi_event; 138*4882a593Smuzhiyun uint32_t oldval; 139*4882a593Smuzhiyun uint32_t newval; 140*4882a593Smuzhiyun }; 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun /* special case scsi check condition event */ 143*4882a593Smuzhiyun struct lpfc_scsi_check_condition_event { 144*4882a593Smuzhiyun struct lpfc_scsi_event_header scsi_event; 145*4882a593Smuzhiyun uint8_t opcode; 146*4882a593Smuzhiyun uint8_t sense_key; 147*4882a593Smuzhiyun uint8_t asc; 148*4882a593Smuzhiyun uint8_t ascq; 149*4882a593Smuzhiyun }; 150*4882a593Smuzhiyun 151*4882a593Smuzhiyun /* event codes for FC_REG_BOARD_EVENT */ 152*4882a593Smuzhiyun #define LPFC_EVENT_PORTINTERR 0x01 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun /* board event header */ 155*4882a593Smuzhiyun struct lpfc_board_event_header { 156*4882a593Smuzhiyun uint32_t event_type; 157*4882a593Smuzhiyun uint32_t subcategory; 158*4882a593Smuzhiyun }; 159*4882a593Smuzhiyun 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun /* event codes for FC_REG_ADAPTER_EVENT */ 162*4882a593Smuzhiyun #define LPFC_EVENT_ARRIVAL 0x01 163*4882a593Smuzhiyun 164*4882a593Smuzhiyun /* adapter event header */ 165*4882a593Smuzhiyun struct lpfc_adapter_event_header { 166*4882a593Smuzhiyun uint32_t event_type; 167*4882a593Smuzhiyun uint32_t subcategory; 168*4882a593Smuzhiyun }; 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun 171*4882a593Smuzhiyun /* event codes for temp_event */ 172*4882a593Smuzhiyun #define LPFC_CRIT_TEMP 0x1 173*4882a593Smuzhiyun #define LPFC_THRESHOLD_TEMP 0x2 174*4882a593Smuzhiyun #define LPFC_NORMAL_TEMP 0x3 175*4882a593Smuzhiyun 176*4882a593Smuzhiyun struct temp_event { 177*4882a593Smuzhiyun uint32_t event_type; 178*4882a593Smuzhiyun uint32_t event_code; 179*4882a593Smuzhiyun uint32_t data; 180*4882a593Smuzhiyun }; 181*4882a593Smuzhiyun 182