xref: /freebsd/sys/dev/qlxgbe/ql_tmplt.h (revision 8d20be1e22095c27faf8fe8b2f0d089739cc742e)
1 /*
2  * Copyright (c) 2013-2014 Qlogic Corporation
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29 /*
30  * File: ql_tmplt.h
31  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
32  */
33 #ifndef _QL_TMPLT_H_
34 #define _QL_TMPLT_H_
35 
36 
37 typedef struct _q8_tmplt_hdr {
38 	uint16_t	version;
39 	uint16_t	signature;
40 	uint16_t	size;
41 	uint16_t	nentries;
42 	uint16_t	stop_seq_off;
43 	uint16_t	csum;
44 	uint16_t	init_seq_off;
45 	uint16_t	start_seq_off;
46 } __packed q8_tmplt_hdr_t;
47 
48 
49 typedef struct _q8_ce_hdr {
50 	uint16_t	opcode;
51 	uint16_t	size;
52 	uint16_t	opcount;
53 	uint16_t	delay_to;
54 } __packed q8_ce_hdr_t;
55 
56 /*
57  * Values for opcode field in q8_ce_hdr_t
58  */
59 #define Q8_CE_OPCODE_NOP		0x000
60 #define Q8_CE_OPCODE_WRITE_LIST		0x001
61 #define Q8_CE_OPCODE_READ_WRITE_LIST	0x002
62 #define Q8_CE_OPCODE_POLL_LIST		0x004
63 #define Q8_CE_OPCODE_POLL_WRITE_LIST	0x008
64 #define Q8_CE_OPCODE_READ_MODIFY_WRITE	0x010
65 #define Q8_CE_OPCODE_SEQ_PAUSE		0x020
66 #define Q8_CE_OPCODE_SEQ_END		0x040
67 #define Q8_CE_OPCODE_TMPLT_END		0x080
68 #define Q8_CE_OPCODE_POLL_RD_LIST	0x100
69 
70 /*
71  * structure for Q8_CE_OPCODE_WRITE_LIST
72  */
73 typedef struct _q8_wrl_e {
74 	uint32_t	addr;
75 	uint32_t	value;
76 } __packed q8_wrl_e_t;
77 
78 /*
79  * structure for Q8_CE_OPCODE_READ_WRITE_LIST
80  */
81 typedef struct _q8_rdwrl_e {
82 	uint32_t	rd_addr;
83 	uint32_t	wr_addr;
84 } __packed q8_rdwrl_e_t;
85 
86 /*
87  * common for
88  *	Q8_CE_OPCODE_POLL_LIST
89  *	Q8_CE_OPCODE_POLL_WRITE_LIST
90  *	Q8_CE_OPCODE_POLL_RD_LIST
91  */
92 typedef struct _q8_poll_hdr {
93 	uint32_t	tmask;
94 	uint32_t	tvalue;
95 } q8_poll_hdr_t;
96 
97 /*
98  * structure for Q8_CE_OPCODE_POLL_LIST
99  */
100 typedef struct _q8_poll_e {
101 	uint32_t	addr;
102 	uint32_t	to_addr;
103 } q8_poll_e_t;
104 
105 /*
106  * structure for Q8_CE_OPCODE_POLL_WRITE_LIST
107  */
108 typedef struct _q8_poll_wr_e {
109 	uint32_t	dr_addr;
110 	uint32_t	dr_value;
111 	uint32_t	ar_addr;
112 	uint32_t	ar_value;
113 } q8_poll_wr_e_t;
114 
115 /*
116  * structure for Q8_CE_OPCODE_POLL_RD_LIST
117  */
118 typedef struct _q8_poll_rd_e {
119 	uint32_t	ar_addr;
120 	uint32_t	ar_value;
121 	uint32_t	dr_addr;
122 	uint32_t	rsrvd;
123 } q8_poll_rd_e_t;
124 
125 /*
126  * structure for Q8_CE_OPCODE_READ_MODIFY_WRITE
127  */
128 typedef struct _q8_rdmwr_hdr {
129 	uint32_t	and_value;
130 	uint32_t	xor_value;
131 	uint32_t	or_value;
132 	uint8_t		shl;
133 	uint8_t		shr;
134 	uint8_t		index_a;
135 	uint8_t		rsrvd;
136 } q8_rdmwr_hdr_t;
137 
138 typedef struct _q8_rdmwr_e {
139 	uint32_t	rd_addr;
140 	uint32_t	wr_addr;
141 } q8_rdmwr_e_t;
142 
143 extern unsigned char ql83xx_resetseq[];
144 extern unsigned int ql83xx_resetseq_len;
145 
146 
147 #endif /* #ifndef _QL_TMPLT_H_ */
148