ql_tmplt.h revision 284982
118334Speter/*
272566Sobrien * Copyright (c) 2013-2016 Qlogic Corporation
390282Sobrien * All rights reserved.
418334Speter *
590282Sobrien *  Redistribution and use in source and binary forms, with or without
618334Speter *  modification, are permitted provided that the following conditions
790282Sobrien *  are met:
890282Sobrien *
990282Sobrien *  1. Redistributions of source code must retain the above copyright
1090282Sobrien *     notice, this list of conditions and the following disclaimer.
1118334Speter *  2. Redistributions in binary form must reproduce the above copyright
1290282Sobrien *     notice, this list of conditions and the following disclaimer in the
1390282Sobrien *     documentation and/or other materials provided with the distribution.
1490282Sobrien *
1590282Sobrien *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1618334Speter *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1718334Speter *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1890282Sobrien *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1990282Sobrien *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2090282Sobrien *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2118334Speter *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2252558Sobrien *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2352558Sobrien *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2418334Speter *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2518334Speter *  POSSIBILITY OF SUCH DAMAGE.
2618334Speter *
2718334Speter * $FreeBSD: stable/10/sys/dev/qlxgbe/ql_tmplt.h 284982 2015-06-30 20:59:07Z davidcs $
2818334Speter */
2918334Speter/*
3050615Sobrien * File: ql_tmplt.h
3150615Sobrien * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
3250615Sobrien */
3318334Speter#ifndef _QL_TMPLT_H_
3418334Speter#define _QL_TMPLT_H_
3518334Speter
3650615Sobrien
3750615Sobrientypedef struct _q8_tmplt_hdr {
3818334Speter	uint16_t	version;
3950615Sobrien	uint16_t	signature;
4050615Sobrien	uint16_t	size;
4150615Sobrien	uint16_t	nentries;
4218334Speter	uint16_t	stop_seq_off;
4318334Speter	uint16_t	csum;
4418334Speter	uint16_t	init_seq_off;
4518334Speter	uint16_t	start_seq_off;
4618334Speter} __packed q8_tmplt_hdr_t;
4790282Sobrien
4818334Speter
4918334Spetertypedef struct _q8_ce_hdr {
5050615Sobrien	uint16_t	opcode;
5190282Sobrien	uint16_t	size;
5290282Sobrien	uint16_t	opcount;
5350615Sobrien	uint16_t	delay_to;
5418334Speter} __packed q8_ce_hdr_t;
5550615Sobrien
5690282Sobrien/*
5750615Sobrien * Values for opcode field in q8_ce_hdr_t
5852558Sobrien */
5952558Sobrien#define Q8_CE_OPCODE_NOP		0x000
6052558Sobrien#define Q8_CE_OPCODE_WRITE_LIST		0x001
6190282Sobrien#define Q8_CE_OPCODE_READ_WRITE_LIST	0x002
6290282Sobrien#define Q8_CE_OPCODE_POLL_LIST		0x004
6390282Sobrien#define Q8_CE_OPCODE_POLL_WRITE_LIST	0x008
6490282Sobrien#define Q8_CE_OPCODE_READ_MODIFY_WRITE	0x010
6590282Sobrien#define Q8_CE_OPCODE_SEQ_PAUSE		0x020
6690282Sobrien#define Q8_CE_OPCODE_SEQ_END		0x040
6790282Sobrien#define Q8_CE_OPCODE_TMPLT_END		0x080
6890282Sobrien#define Q8_CE_OPCODE_POLL_RD_LIST	0x100
6990282Sobrien
7090282Sobrien/*
7190282Sobrien * structure for Q8_CE_OPCODE_WRITE_LIST
7290282Sobrien */
7390282Sobrientypedef struct _q8_wrl_e {
7490282Sobrien	uint32_t	addr;
7518334Speter	uint32_t	value;
7650615Sobrien} __packed q8_wrl_e_t;
7750615Sobrien
7850615Sobrien/*
7950615Sobrien * structure for Q8_CE_OPCODE_READ_WRITE_LIST
8050615Sobrien */
8150615Sobrientypedef struct _q8_rdwrl_e {
8250615Sobrien	uint32_t	rd_addr;
8350615Sobrien	uint32_t	wr_addr;
8450615Sobrien} __packed q8_rdwrl_e_t;
8550615Sobrien
8650615Sobrien/*
8750615Sobrien * common for
8818334Speter *	Q8_CE_OPCODE_POLL_LIST
8990282Sobrien *	Q8_CE_OPCODE_POLL_WRITE_LIST
9090282Sobrien *	Q8_CE_OPCODE_POLL_RD_LIST
9118334Speter */
9290282Sobrientypedef struct _q8_poll_hdr {
9390282Sobrien	uint32_t	tmask;
9490282Sobrien	uint32_t	tvalue;
9590282Sobrien} q8_poll_hdr_t;
9618334Speter
9718334Speter/*
9818334Speter * structure for Q8_CE_OPCODE_POLL_LIST
9990282Sobrien */
10018334Spetertypedef struct _q8_poll_e {
10118334Speter	uint32_t	addr;
10290282Sobrien	uint32_t	to_addr;
10390282Sobrien} q8_poll_e_t;
10418334Speter
10518334Speter/*
10618334Speter * structure for Q8_CE_OPCODE_POLL_WRITE_LIST
10718334Speter */
10818334Spetertypedef struct _q8_poll_wr_e {
10918334Speter	uint32_t	dr_addr;
11018334Speter	uint32_t	dr_value;
11118334Speter	uint32_t	ar_addr;
11218334Speter	uint32_t	ar_value;
11318334Speter} q8_poll_wr_e_t;
11418334Speter
11518334Speter/*
11690282Sobrien * structure for Q8_CE_OPCODE_POLL_RD_LIST
11718334Speter */
11890282Sobrientypedef struct _q8_poll_rd_e {
11918334Speter	uint32_t	ar_addr;
12018334Speter	uint32_t	ar_value;
12118334Speter	uint32_t	dr_addr;
12218334Speter	uint32_t	rsrvd;
12318334Speter} q8_poll_rd_e_t;
12418334Speter
12518334Speter/*
12690282Sobrien * structure for Q8_CE_OPCODE_READ_MODIFY_WRITE
12790282Sobrien */
12890282Sobrientypedef struct _q8_rdmwr_hdr {
12990282Sobrien	uint32_t	and_value;
13090282Sobrien	uint32_t	xor_value;
13190282Sobrien	uint32_t	or_value;
13290282Sobrien	uint8_t		shl;
13390282Sobrien	uint8_t		shr;
13418334Speter	uint8_t		index_a;
13590282Sobrien	uint8_t		rsrvd;
13690282Sobrien} q8_rdmwr_hdr_t;
13750615Sobrien
13890282Sobrientypedef struct _q8_rdmwr_e {
13990282Sobrien	uint32_t	rd_addr;
14090282Sobrien	uint32_t	wr_addr;
14190282Sobrien} q8_rdmwr_e_t;
14290282Sobrien
14390282Sobrien#endif /* #ifndef _QL_TMPLT_H_ */
14418334Speter