Blame view

drivers/scsi/bfa/bfa_plog.h 4.39 KB
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
1
  /*
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
2
   * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
   * All rights reserved
   * www.brocade.com
   *
   * Linux driver for Brocade Fibre Channel Host Bus Adapter.
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License (GPL) Version 2 as
   * published by the Free Software Foundation
   *
   * This program is distributed in the hope that it will be useful, but
   * WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * General Public License for more details.
   */
  #ifndef __BFA_PORTLOG_H__
  #define __BFA_PORTLOG_H__
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
19
20
  #include "bfa_fc.h"
  #include "bfa_defs.h"
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
21
22
23
24
25
26
27
28
  
  #define BFA_PL_NLOG_ENTS 256
  #define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
  
  #define BFA_PL_STRING_LOG_SZ   32   /* number of chars in string log */
  #define BFA_PL_INT_LOG_SZ      8    /* number of integers in the integer log */
  
  enum bfa_plog_log_type {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
29
30
31
  	BFA_PL_LOG_TYPE_INVALID	= 0,
  	BFA_PL_LOG_TYPE_INT	= 1,
  	BFA_PL_LOG_TYPE_STRING	= 2,
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
32
33
34
35
36
37
  };
  
  /*
   * the (fixed size) record format for each entry in the portlog
   */
  struct bfa_plog_rec_s {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
38
39
40
41
42
43
  	u64	tv;	/* timestamp */
  	u8	 port;	/* Source port that logged this entry */
  	u8	 mid;	/* module id */
  	u8	 eid;	/* indicates Rx, Tx, IOCTL, etc.  bfa_plog_eid */
  	u8	 log_type; /* string/integer log, bfa_plog_log_type_t */
  	u8	 log_num_ints;
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
44
45
46
47
  	/*
  	 * interpreted only if log_type is INT_LOG. indicates number of
  	 * integers in the int_log[] (0-PL_INT_LOG_SZ).
  	 */
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
48
49
  	u8	 rsvd;
  	u16	misc;	/* can be used to indicate fc frame length */
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
50
  	union {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
51
52
  		char	    string_log[BFA_PL_STRING_LOG_SZ];
  		u32	int_log[BFA_PL_INT_LOG_SZ];
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  	} log_entry;
  
  };
  
  /*
   * the following #defines will be used by the logging entities to indicate
   * their module id. BFAL will convert the integer value to string format
   *
  * process to be used while changing the following #defines:
   *  - Always add new entries at the end
   *  - define corresponding string in BFAL
   *  - Do not remove any entry or rearrange the order.
   */
  enum bfa_plog_mid {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
67
68
69
70
71
72
73
  	BFA_PL_MID_INVALID	= 0,
  	BFA_PL_MID_DEBUG	= 1,
  	BFA_PL_MID_DRVR		= 2,
  	BFA_PL_MID_HAL		= 3,
  	BFA_PL_MID_HAL_FCXP	= 4,
  	BFA_PL_MID_HAL_UF	= 5,
  	BFA_PL_MID_FCS		= 6,
5c1fb1d55   Krishna Gudipati   [SCSI] bfa: Defin...
74
  	BFA_PL_MID_LPS		= 7,
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
75
  	BFA_PL_MID_MAX		= 8
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
76
77
78
79
  };
  
  #define BFA_PL_MID_STRLEN    8
  struct bfa_plog_mid_strings_s {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
80
  	char	    m_str[BFA_PL_MID_STRLEN];
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
81
82
83
84
85
86
87
88
89
90
91
92
  };
  
  /*
   * the following #defines will be used by the logging entities to indicate
   * their event type. BFAL will convert the integer value to string format
   *
  * process to be used while changing the following #defines:
   *  - Always add new entries at the end
   *  - define corresponding string in BFAL
   *  - Do not remove any entry or rearrange the order.
   */
  enum bfa_plog_eid {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  	BFA_PL_EID_INVALID		= 0,
  	BFA_PL_EID_IOC_DISABLE		= 1,
  	BFA_PL_EID_IOC_ENABLE		= 2,
  	BFA_PL_EID_PORT_DISABLE		= 3,
  	BFA_PL_EID_PORT_ENABLE		= 4,
  	BFA_PL_EID_PORT_ST_CHANGE	= 5,
  	BFA_PL_EID_TX			= 6,
  	BFA_PL_EID_TX_ACK1		= 7,
  	BFA_PL_EID_TX_RJT		= 8,
  	BFA_PL_EID_TX_BSY		= 9,
  	BFA_PL_EID_RX			= 10,
  	BFA_PL_EID_RX_ACK1		= 11,
  	BFA_PL_EID_RX_RJT		= 12,
  	BFA_PL_EID_RX_BSY		= 13,
  	BFA_PL_EID_CT_IN		= 14,
  	BFA_PL_EID_CT_OUT		= 15,
  	BFA_PL_EID_DRIVER_START		= 16,
  	BFA_PL_EID_RSCN			= 17,
  	BFA_PL_EID_DEBUG		= 18,
  	BFA_PL_EID_MISC			= 19,
5c1fb1d55   Krishna Gudipati   [SCSI] bfa: Defin...
113
114
115
116
  	BFA_PL_EID_FIP_FCF_DISC		= 20,
  	BFA_PL_EID_FIP_FCF_CVL		= 21,
  	BFA_PL_EID_LOGIN		= 22,
  	BFA_PL_EID_LOGO			= 23,
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
117
118
  	BFA_PL_EID_TRUNK_SCN		= 24,
  	BFA_PL_EID_MAX
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
119
  };
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
120
  #define BFA_PL_ENAME_STRLEN	8
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
121
  struct bfa_plog_eid_strings_s {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
122
  	char	    e_str[BFA_PL_ENAME_STRLEN];
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
123
124
125
126
127
128
129
130
131
  };
  
  #define BFA_PL_SIG_LEN	8
  #define BFA_PL_SIG_STR  "12pl123"
  
  /*
   * per port circular log buffer
   */
  struct bfa_plog_s {
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
132
133
134
135
136
137
  	char	    plog_sig[BFA_PL_SIG_LEN];	/* Start signature */
  	u8	 plog_enabled;
  	u8	 rsvd[7];
  	u32	ticks;
  	u16	head;
  	u16	tail;
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
138
139
140
141
142
143
144
145
146
147
  	struct bfa_plog_rec_s  plog_recs[BFA_PL_NLOG_ENTS];
  };
  
  void bfa_plog_init(struct bfa_plog_s *plog);
  void bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  			enum bfa_plog_eid event, u16 misc, char *log_str);
  void bfa_plog_intarr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  			enum bfa_plog_eid event, u16 misc,
  			u32 *intarr, u32 num_ints);
  void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
a36c61f90   Krishna Gudipati   [SCSI] bfa: clean...
148
  		enum bfa_plog_eid event, u16 misc, struct fchs_s *fchdr);
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
149
150
151
  void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  			enum bfa_plog_eid event, u16 misc,
  			struct fchs_s *fchdr, u32 pld_w0);
7725ccfda   Jing Huang   [SCSI] bfa: Broca...
152
153
  
  #endif /* __BFA_PORTLOG_H__ */