]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/bnxt/bnxt_ioctl.h
sqlite3: Vendor import of sqlite3 3.44.0
[FreeBSD/FreeBSD.git] / sys / dev / bnxt / bnxt_ioctl.h
1 /*-
2  * Broadcom NetXtreme-C/E network driver.
3  *
4  * Copyright (c) 2016 Broadcom, All Rights Reserved.
5  * The term Broadcom refers to Broadcom Limited and/or its subsidiaries
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  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26  * THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #include <sys/cdefs.h>
30 #ifndef _BNXT_IOCTL_H
31 #define _BNXT_IOCTL_H
32
33 enum bnxt_ioctl_type {
34         BNXT_HWRM_NVM_FIND_DIR_ENTRY,
35         BNXT_HWRM_NVM_READ,
36         BNXT_HWRM_FW_RESET,
37         BNXT_HWRM_FW_QSTATUS,
38         BNXT_HWRM_NVM_WRITE,
39         BNXT_HWRM_NVM_ERASE_DIR_ENTRY,
40         BNXT_HWRM_NVM_GET_DIR_INFO,
41         BNXT_HWRM_NVM_GET_DIR_ENTRIES,
42         BNXT_HWRM_NVM_MODIFY,
43         BNXT_HWRM_NVM_VERIFY_UPDATE,
44         BNXT_HWRM_NVM_INSTALL_UPDATE,
45         BNXT_HWRM_FW_GET_TIME,
46         BNXT_HWRM_FW_SET_TIME,
47 };
48
49 struct bnxt_ioctl_header {
50         enum bnxt_ioctl_type type;
51         int             rc;
52 };
53
54 struct bnxt_ioctl_hwrm_nvm_find_dir_entry {
55         struct bnxt_ioctl_header hdr;
56         uint32_t        data_length;
57         uint32_t        fw_ver;
58         uint32_t        item_length;
59         uint16_t        ext;
60         uint16_t        index;
61         uint16_t        ordinal;
62         uint16_t        type;
63         uint8_t         search_opt;
64         bool            use_index;
65 };
66
67 struct bnxt_ioctl_hwrm_nvm_read {
68         struct bnxt_ioctl_header hdr;
69         uint8_t         *data;
70         uint32_t        length;
71         uint32_t        offset;
72         uint16_t        index;
73 };
74
75 struct bnxt_ioctl_hwrm_fw_reset {
76         struct bnxt_ioctl_header hdr;
77         uint8_t         processor;
78         uint8_t         selfreset;
79 };
80
81 struct bnxt_ioctl_hwrm_fw_qstatus {
82         struct bnxt_ioctl_header hdr;
83         uint8_t         processor;
84         uint8_t         selfreset;
85 };
86
87 struct bnxt_ioctl_hwrm_nvm_write {
88         struct bnxt_ioctl_header hdr;
89         uint8_t         *data;
90         uint32_t        data_length;
91         uint32_t        item_length;
92         uint16_t        attr;
93         uint16_t        ext;
94         uint16_t        index;
95         uint16_t        option;
96         uint16_t        ordinal;
97         uint16_t        type;
98         bool            keep;
99 };
100
101 struct bnxt_ioctl_hwrm_nvm_erase_dir_entry {
102         struct bnxt_ioctl_header hdr;
103         enum bnxt_ioctl_type type;
104         int             rc;
105         uint16_t        index;
106 };
107
108 struct bnxt_ioctl_hwrm_nvm_get_dir_info {
109         struct bnxt_ioctl_header hdr;
110         uint32_t        entries;
111         uint32_t        entry_length;
112 };
113
114 struct bnxt_ioctl_hwrm_nvm_get_dir_entries {
115         struct bnxt_ioctl_header hdr;
116         uint8_t         *data;
117         size_t          max_size;
118         uint32_t        entries;
119         uint32_t        entry_length;
120 };
121
122 struct bnxt_ioctl_hwrm_nvm_install_update {
123         struct bnxt_ioctl_header hdr;
124         uint64_t        installed_items;
125         uint32_t        install_type;
126         uint8_t         problem_item;
127         uint8_t         reset_required;
128         uint8_t         result;
129 };
130
131 struct bnxt_ioctl_hwrm_nvm_verify_update {
132         struct bnxt_ioctl_header hdr;
133         uint16_t        ext;
134         uint16_t        ordinal;
135         uint16_t        type;
136 };
137
138 struct bnxt_ioctl_hwrm_nvm_modify {
139         struct bnxt_ioctl_header hdr;
140         uint8_t         *data;
141         uint32_t        length;
142         uint32_t        offset;
143         uint16_t        index;
144 };
145
146 struct bnxt_ioctl_hwrm_fw_get_time {
147         struct bnxt_ioctl_header hdr;
148         uint16_t        millisecond;
149         uint16_t        year;
150         uint16_t        zone;
151         uint8_t         day;
152         uint8_t         hour;
153         uint8_t         minute;
154         uint8_t         month;
155         uint8_t         second;
156 };
157
158 struct bnxt_ioctl_hwrm_fw_set_time {
159         struct bnxt_ioctl_header hdr;
160         uint16_t        millisecond;
161         uint16_t        year;
162         uint16_t        zone;
163         uint8_t         day;
164         uint8_t         hour;
165         uint8_t         minute;
166         uint8_t         month;
167         uint8_t         second;
168 };
169
170 /* IOCTL interface */
171 struct bnxt_ioctl_data {
172         union {
173                 struct bnxt_ioctl_header                        hdr;
174                 struct bnxt_ioctl_hwrm_nvm_find_dir_entry       find;
175                 struct bnxt_ioctl_hwrm_nvm_read                 read;
176                 struct bnxt_ioctl_hwrm_fw_reset                 reset;
177                 struct bnxt_ioctl_hwrm_fw_qstatus               status;
178                 struct bnxt_ioctl_hwrm_nvm_write                write;
179                 struct bnxt_ioctl_hwrm_nvm_erase_dir_entry      erase;
180                 struct bnxt_ioctl_hwrm_nvm_get_dir_info         dir_info;
181                 struct bnxt_ioctl_hwrm_nvm_get_dir_entries      dir_entries;
182                 struct bnxt_ioctl_hwrm_nvm_install_update       install;
183                 struct bnxt_ioctl_hwrm_nvm_verify_update        verify;
184                 struct bnxt_ioctl_hwrm_nvm_modify               modify;
185                 struct bnxt_ioctl_hwrm_fw_get_time              get_time;
186                 struct bnxt_ioctl_hwrm_fw_set_time              set_time;
187         };
188 };
189
190 #endif