1308696Sshurd/*-
2308696Sshurd * Broadcom NetXtreme-C/E network driver.
3308696Sshurd *
4308696Sshurd * Copyright (c) 2016 Broadcom, All Rights Reserved.
5308696Sshurd * The term Broadcom refers to Broadcom Limited and/or its subsidiaries
6308696Sshurd *
7308696Sshurd * Redistribution and use in source and binary forms, with or without
8308696Sshurd * modification, are permitted provided that the following conditions
9308696Sshurd * are met:
10308696Sshurd * 1. Redistributions of source code must retain the above copyright
11308696Sshurd *    notice, this list of conditions and the following disclaimer.
12308696Sshurd * 2. Redistributions in binary form must reproduce the above copyright
13308696Sshurd *    notice, this list of conditions and the following disclaimer in the
14308696Sshurd *    documentation and/or other materials provided with the distribution.
15308696Sshurd *
16308696Sshurd * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
17308696Sshurd * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18308696Sshurd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19308696Sshurd * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20308696Sshurd * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21308696Sshurd * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22308696Sshurd * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23308696Sshurd * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24308696Sshurd * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25308696Sshurd * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26308696Sshurd * THE POSSIBILITY OF SUCH DAMAGE.
27308696Sshurd */
28308696Sshurd
29308696Sshurd#include <sys/cdefs.h>
30308696Sshurd__FBSDID("$FreeBSD: stable/11/sys/dev/bnxt/bnxt_ioctl.h 308696 2016-11-15 20:35:29Z shurd $");
31308696Sshurd
32308696Sshurd#ifndef _BNXT_IOCTL_H
33308696Sshurd#define _BNXT_IOCTL_H
34308696Sshurd
35308696Sshurdenum bnxt_ioctl_type {
36308696Sshurd	BNXT_HWRM_NVM_FIND_DIR_ENTRY,
37308696Sshurd	BNXT_HWRM_NVM_READ,
38308696Sshurd	BNXT_HWRM_FW_RESET,
39308696Sshurd	BNXT_HWRM_FW_QSTATUS,
40308696Sshurd	BNXT_HWRM_NVM_WRITE,
41308696Sshurd	BNXT_HWRM_NVM_ERASE_DIR_ENTRY,
42308696Sshurd	BNXT_HWRM_NVM_GET_DIR_INFO,
43308696Sshurd	BNXT_HWRM_NVM_GET_DIR_ENTRIES,
44308696Sshurd	BNXT_HWRM_NVM_MODIFY,
45308696Sshurd	BNXT_HWRM_NVM_VERIFY_UPDATE,
46308696Sshurd	BNXT_HWRM_NVM_INSTALL_UPDATE,
47308696Sshurd	BNXT_HWRM_FW_GET_TIME,
48308696Sshurd	BNXT_HWRM_FW_SET_TIME,
49308696Sshurd};
50308696Sshurd
51308696Sshurdstruct bnxt_ioctl_header {
52308696Sshurd	enum bnxt_ioctl_type type;
53308696Sshurd	int		rc;
54308696Sshurd};
55308696Sshurd
56308696Sshurdstruct bnxt_ioctl_hwrm_nvm_find_dir_entry {
57308696Sshurd	struct bnxt_ioctl_header hdr;
58308696Sshurd	uint32_t	data_length;
59308696Sshurd	uint32_t	fw_ver;
60308696Sshurd	uint32_t	item_length;
61308696Sshurd	uint16_t	ext;
62308696Sshurd	uint16_t	index;
63308696Sshurd	uint16_t	ordinal;
64308696Sshurd	uint16_t	type;
65308696Sshurd	uint8_t		search_opt;
66308696Sshurd	bool		use_index;
67308696Sshurd};
68308696Sshurd
69308696Sshurdstruct bnxt_ioctl_hwrm_nvm_read {
70308696Sshurd	struct bnxt_ioctl_header hdr;
71308696Sshurd	uint8_t		*data;
72308696Sshurd	uint32_t	length;
73308696Sshurd	uint32_t	offset;
74308696Sshurd	uint16_t	index;
75308696Sshurd};
76308696Sshurd
77308696Sshurdstruct bnxt_ioctl_hwrm_fw_reset {
78308696Sshurd	struct bnxt_ioctl_header hdr;
79308696Sshurd	uint8_t		processor;
80308696Sshurd	uint8_t		selfreset;
81308696Sshurd};
82308696Sshurd
83308696Sshurdstruct bnxt_ioctl_hwrm_fw_qstatus {
84308696Sshurd	struct bnxt_ioctl_header hdr;
85308696Sshurd	uint8_t		processor;
86308696Sshurd	uint8_t		selfreset;
87308696Sshurd};
88308696Sshurd
89308696Sshurdstruct bnxt_ioctl_hwrm_nvm_write {
90308696Sshurd	struct bnxt_ioctl_header hdr;
91308696Sshurd	uint8_t		*data;
92308696Sshurd	uint32_t	data_length;
93308696Sshurd	uint32_t	item_length;
94308696Sshurd	uint16_t	attr;
95308696Sshurd	uint16_t	ext;
96308696Sshurd	uint16_t	index;
97308696Sshurd	uint16_t	option;
98308696Sshurd	uint16_t	ordinal;
99308696Sshurd	uint16_t	type;
100308696Sshurd	bool		keep;
101308696Sshurd};
102308696Sshurd
103308696Sshurdstruct bnxt_ioctl_hwrm_nvm_erase_dir_entry {
104308696Sshurd	struct bnxt_ioctl_header hdr;
105308696Sshurd	enum bnxt_ioctl_type type;
106308696Sshurd	int		rc;
107308696Sshurd	uint16_t	index;
108308696Sshurd};
109308696Sshurd
110308696Sshurdstruct bnxt_ioctl_hwrm_nvm_get_dir_info {
111308696Sshurd	struct bnxt_ioctl_header hdr;
112308696Sshurd	uint32_t	entries;
113308696Sshurd	uint32_t	entry_length;
114308696Sshurd};
115308696Sshurd
116308696Sshurdstruct bnxt_ioctl_hwrm_nvm_get_dir_entries {
117308696Sshurd	struct bnxt_ioctl_header hdr;
118308696Sshurd	uint8_t		*data;
119308696Sshurd	size_t		max_size;
120308696Sshurd	uint32_t	entries;
121308696Sshurd	uint32_t	entry_length;
122308696Sshurd};
123308696Sshurd
124308696Sshurdstruct bnxt_ioctl_hwrm_nvm_install_update {
125308696Sshurd	struct bnxt_ioctl_header hdr;
126308696Sshurd	uint64_t	installed_items;
127308696Sshurd	uint32_t	install_type;
128308696Sshurd	uint8_t		problem_item;
129308696Sshurd	uint8_t		reset_required;
130308696Sshurd	uint8_t		result;
131308696Sshurd};
132308696Sshurd
133308696Sshurdstruct bnxt_ioctl_hwrm_nvm_verify_update {
134308696Sshurd	struct bnxt_ioctl_header hdr;
135308696Sshurd	uint16_t	ext;
136308696Sshurd	uint16_t	ordinal;
137308696Sshurd	uint16_t	type;
138308696Sshurd};
139308696Sshurd
140308696Sshurdstruct bnxt_ioctl_hwrm_nvm_modify {
141308696Sshurd	struct bnxt_ioctl_header hdr;
142308696Sshurd	uint8_t		*data;
143308696Sshurd	uint32_t	length;
144308696Sshurd	uint32_t	offset;
145308696Sshurd	uint16_t	index;
146308696Sshurd};
147308696Sshurd
148308696Sshurdstruct bnxt_ioctl_hwrm_fw_get_time {
149308696Sshurd	struct bnxt_ioctl_header hdr;
150308696Sshurd	uint16_t	millisecond;
151308696Sshurd	uint16_t	year;
152308696Sshurd	uint16_t	zone;
153308696Sshurd	uint8_t		day;
154308696Sshurd	uint8_t		hour;
155308696Sshurd	uint8_t		minute;
156308696Sshurd	uint8_t		month;
157308696Sshurd	uint8_t		second;
158308696Sshurd};
159308696Sshurd
160308696Sshurdstruct bnxt_ioctl_hwrm_fw_set_time {
161308696Sshurd	struct bnxt_ioctl_header hdr;
162308696Sshurd	uint16_t	millisecond;
163308696Sshurd	uint16_t	year;
164308696Sshurd	uint16_t	zone;
165308696Sshurd	uint8_t		day;
166308696Sshurd	uint8_t		hour;
167308696Sshurd	uint8_t		minute;
168308696Sshurd	uint8_t		month;
169308696Sshurd	uint8_t		second;
170308696Sshurd};
171308696Sshurd
172308696Sshurd/* IOCTL interface */
173308696Sshurdstruct bnxt_ioctl_data {
174308696Sshurd	union {
175308696Sshurd		struct bnxt_ioctl_header			hdr;
176308696Sshurd		struct bnxt_ioctl_hwrm_nvm_find_dir_entry	find;
177308696Sshurd		struct bnxt_ioctl_hwrm_nvm_read			read;
178308696Sshurd		struct bnxt_ioctl_hwrm_fw_reset			reset;
179308696Sshurd		struct bnxt_ioctl_hwrm_fw_qstatus		status;
180308696Sshurd		struct bnxt_ioctl_hwrm_nvm_write		write;
181308696Sshurd		struct bnxt_ioctl_hwrm_nvm_erase_dir_entry	erase;
182308696Sshurd		struct bnxt_ioctl_hwrm_nvm_get_dir_info		dir_info;
183308696Sshurd		struct bnxt_ioctl_hwrm_nvm_get_dir_entries	dir_entries;
184308696Sshurd		struct bnxt_ioctl_hwrm_nvm_install_update	install;
185308696Sshurd		struct bnxt_ioctl_hwrm_nvm_verify_update	verify;
186308696Sshurd		struct bnxt_ioctl_hwrm_nvm_modify		modify;
187308696Sshurd		struct bnxt_ioctl_hwrm_fw_get_time		get_time;
188308696Sshurd		struct bnxt_ioctl_hwrm_fw_set_time		set_time;
189308696Sshurd	};
190308696Sshurd};
191308696Sshurd
192308696Sshurd#endif
193