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