xref: /openbmc/linux/drivers/scsi/mpt3sas/mpt3sas_ctl.h (revision a066f4c31359d07b1a2c5144b4b9a29901365fd0)
1f92363d1SSreekanth Reddy /*
2f92363d1SSreekanth Reddy  * Management Module Support for MPT (Message Passing Technology) based
3f92363d1SSreekanth Reddy  * controllers
4f92363d1SSreekanth Reddy  *
5f92363d1SSreekanth Reddy  * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h
6a4ffce0dSSreekanth Reddy  * Copyright (C) 2012-2014  LSI Corporation
7a03bd153SSreekanth Reddy  * Copyright (C) 2013-2014 Avago Technologies
8a03bd153SSreekanth Reddy  *  (mailto: MPT-FusionLinux.pdl@avagotech.com)
9f92363d1SSreekanth Reddy  *
10f92363d1SSreekanth Reddy  * This program is free software; you can redistribute it and/or
11f92363d1SSreekanth Reddy  * modify it under the terms of the GNU General Public License
12f92363d1SSreekanth Reddy  * as published by the Free Software Foundation; either version 2
13f92363d1SSreekanth Reddy  * of the License, or (at your option) any later version.
14f92363d1SSreekanth Reddy  *
15f92363d1SSreekanth Reddy  * This program is distributed in the hope that it will be useful,
16f92363d1SSreekanth Reddy  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17f92363d1SSreekanth Reddy  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18f92363d1SSreekanth Reddy  * GNU General Public License for more details.
19f92363d1SSreekanth Reddy  *
20f92363d1SSreekanth Reddy  * NO WARRANTY
21f92363d1SSreekanth Reddy  * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
22f92363d1SSreekanth Reddy  * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
23f92363d1SSreekanth Reddy  * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
24f92363d1SSreekanth Reddy  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
25f92363d1SSreekanth Reddy  * solely responsible for determining the appropriateness of using and
26f92363d1SSreekanth Reddy  * distributing the Program and assumes all risks associated with its
27f92363d1SSreekanth Reddy  * exercise of rights under this Agreement, including but not limited to
28f92363d1SSreekanth Reddy  * the risks and costs of program errors, damage to or loss of data,
29f92363d1SSreekanth Reddy  * programs or equipment, and unavailability or interruption of operations.
30f92363d1SSreekanth Reddy 
31f92363d1SSreekanth Reddy  * DISCLAIMER OF LIABILITY
32f92363d1SSreekanth Reddy  * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
33f92363d1SSreekanth Reddy  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34f92363d1SSreekanth Reddy  * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
35f92363d1SSreekanth Reddy  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36f92363d1SSreekanth Reddy  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37f92363d1SSreekanth Reddy  * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
38f92363d1SSreekanth Reddy  * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
39f92363d1SSreekanth Reddy 
40f92363d1SSreekanth Reddy  * You should have received a copy of the GNU General Public License
41f92363d1SSreekanth Reddy  * along with this program; if not, write to the Free Software
42f92363d1SSreekanth Reddy  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
43f92363d1SSreekanth Reddy  * USA.
44f92363d1SSreekanth Reddy  */
45f92363d1SSreekanth Reddy 
46f92363d1SSreekanth Reddy #ifndef MPT3SAS_CTL_H_INCLUDED
47f92363d1SSreekanth Reddy #define MPT3SAS_CTL_H_INCLUDED
48f92363d1SSreekanth Reddy 
49f92363d1SSreekanth Reddy #ifdef __KERNEL__
50f92363d1SSreekanth Reddy #include <linux/miscdevice.h>
51f92363d1SSreekanth Reddy #endif
52f92363d1SSreekanth Reddy 
5378f97c8fSSreekanth Reddy #ifndef MPT2SAS_MINOR
5478f97c8fSSreekanth Reddy #define MPT2SAS_MINOR		(MPT_MINOR + 1)
5578f97c8fSSreekanth Reddy #endif
56f92363d1SSreekanth Reddy #ifndef MPT3SAS_MINOR
57f92363d1SSreekanth Reddy #define MPT3SAS_MINOR		(MPT_MINOR + 2)
58f92363d1SSreekanth Reddy #endif
5978f97c8fSSreekanth Reddy #define MPT2SAS_DEV_NAME	"mpt2ctl"
60f92363d1SSreekanth Reddy #define MPT3SAS_DEV_NAME	"mpt3ctl"
61f92363d1SSreekanth Reddy #define MPT3_MAGIC_NUMBER	'L'
62f92363d1SSreekanth Reddy #define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */
63f92363d1SSreekanth Reddy 
64f92363d1SSreekanth Reddy /**
65f92363d1SSreekanth Reddy  * IOCTL opcodes
66f92363d1SSreekanth Reddy  */
67f92363d1SSreekanth Reddy #define MPT3IOCINFO	_IOWR(MPT3_MAGIC_NUMBER, 17, \
68f92363d1SSreekanth Reddy 	struct mpt3_ioctl_iocinfo)
69f92363d1SSreekanth Reddy #define MPT3COMMAND	_IOWR(MPT3_MAGIC_NUMBER, 20, \
70f92363d1SSreekanth Reddy 	struct mpt3_ioctl_command)
71f92363d1SSreekanth Reddy #ifdef CONFIG_COMPAT
72f92363d1SSreekanth Reddy #define MPT3COMMAND32	_IOWR(MPT3_MAGIC_NUMBER, 20, \
73f92363d1SSreekanth Reddy 	struct mpt3_ioctl_command32)
74f92363d1SSreekanth Reddy #endif
75f92363d1SSreekanth Reddy #define MPT3EVENTQUERY	_IOWR(MPT3_MAGIC_NUMBER, 21, \
76f92363d1SSreekanth Reddy 	struct mpt3_ioctl_eventquery)
77f92363d1SSreekanth Reddy #define MPT3EVENTENABLE	_IOWR(MPT3_MAGIC_NUMBER, 22, \
78f92363d1SSreekanth Reddy 	struct mpt3_ioctl_eventenable)
79f92363d1SSreekanth Reddy #define MPT3EVENTREPORT	_IOWR(MPT3_MAGIC_NUMBER, 23, \
80f92363d1SSreekanth Reddy 	struct mpt3_ioctl_eventreport)
81f92363d1SSreekanth Reddy #define MPT3HARDRESET	_IOWR(MPT3_MAGIC_NUMBER, 24, \
82f92363d1SSreekanth Reddy 	struct mpt3_ioctl_diag_reset)
83f92363d1SSreekanth Reddy #define MPT3BTDHMAPPING	_IOWR(MPT3_MAGIC_NUMBER, 31, \
84f92363d1SSreekanth Reddy 	struct mpt3_ioctl_btdh_mapping)
85f92363d1SSreekanth Reddy 
86f92363d1SSreekanth Reddy /* diag buffer support */
87f92363d1SSreekanth Reddy #define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \
88f92363d1SSreekanth Reddy 	struct mpt3_diag_register)
89f92363d1SSreekanth Reddy #define MPT3DIAGRELEASE	_IOWR(MPT3_MAGIC_NUMBER, 27, \
90f92363d1SSreekanth Reddy 	struct mpt3_diag_release)
91f92363d1SSreekanth Reddy #define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \
92f92363d1SSreekanth Reddy 	struct mpt3_diag_unregister)
93f92363d1SSreekanth Reddy #define MPT3DIAGQUERY	_IOWR(MPT3_MAGIC_NUMBER, 29, \
94f92363d1SSreekanth Reddy 	struct mpt3_diag_query)
95f92363d1SSreekanth Reddy #define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \
96f92363d1SSreekanth Reddy 	struct mpt3_diag_read_buffer)
97f92363d1SSreekanth Reddy 
9808e7378eSSreekanth Reddy /* Trace Buffer default UniqueId */
9908e7378eSSreekanth Reddy #define MPT2DIAGBUFFUNIQUEID (0x07075900)
10008e7378eSSreekanth Reddy #define MPT3DIAGBUFFUNIQUEID (0x4252434D)
10108e7378eSSreekanth Reddy 
10208e7378eSSreekanth Reddy /* UID not found */
10308e7378eSSreekanth Reddy #define MPT3_DIAG_UID_NOT_FOUND (0xFF)
10408e7378eSSreekanth Reddy 
10508e7378eSSreekanth Reddy 
106f92363d1SSreekanth Reddy /**
107f92363d1SSreekanth Reddy  * struct mpt3_ioctl_header - main header structure
108f92363d1SSreekanth Reddy  * @ioc_number -  IOC unit number
109f92363d1SSreekanth Reddy  * @port_number - IOC port number
110f92363d1SSreekanth Reddy  * @max_data_size - maximum number bytes to transfer on read
111f92363d1SSreekanth Reddy  */
112f92363d1SSreekanth Reddy struct mpt3_ioctl_header {
113f92363d1SSreekanth Reddy 	uint32_t ioc_number;
114f92363d1SSreekanth Reddy 	uint32_t port_number;
115f92363d1SSreekanth Reddy 	uint32_t max_data_size;
116f92363d1SSreekanth Reddy };
117f92363d1SSreekanth Reddy 
118f92363d1SSreekanth Reddy /**
119f92363d1SSreekanth Reddy  * struct mpt3_ioctl_diag_reset - diagnostic reset
120f92363d1SSreekanth Reddy  * @hdr - generic header
121f92363d1SSreekanth Reddy  */
122f92363d1SSreekanth Reddy struct mpt3_ioctl_diag_reset {
123f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
124f92363d1SSreekanth Reddy };
125f92363d1SSreekanth Reddy 
126f92363d1SSreekanth Reddy 
127f92363d1SSreekanth Reddy /**
128f92363d1SSreekanth Reddy  * struct mpt3_ioctl_pci_info - pci device info
129f92363d1SSreekanth Reddy  * @device - pci device id
130f92363d1SSreekanth Reddy  * @function - pci function id
131f92363d1SSreekanth Reddy  * @bus - pci bus id
132f92363d1SSreekanth Reddy  * @segment_id - pci segment id
133f92363d1SSreekanth Reddy  */
134f92363d1SSreekanth Reddy struct mpt3_ioctl_pci_info {
135f92363d1SSreekanth Reddy 	union {
136f92363d1SSreekanth Reddy 		struct {
137f92363d1SSreekanth Reddy 			uint32_t device:5;
138f92363d1SSreekanth Reddy 			uint32_t function:3;
139f92363d1SSreekanth Reddy 			uint32_t bus:24;
140f92363d1SSreekanth Reddy 		} bits;
141f92363d1SSreekanth Reddy 		uint32_t  word;
142f92363d1SSreekanth Reddy 	} u;
143f92363d1SSreekanth Reddy 	uint32_t segment_id;
144f92363d1SSreekanth Reddy };
145f92363d1SSreekanth Reddy 
146f92363d1SSreekanth Reddy 
147f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SCSI	(0x00)
148f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_FC		(0x01)
149f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_FC_IP	(0x02)
150f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS	(0x03)
151f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS2	(0x04)
1527786ab6aSSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS2_SSS6200	(0x05)
153f92363d1SSreekanth Reddy #define MPT3_IOCTL_INTERFACE_SAS3	(0x06)
154998f26aeSSuganath Prabu Subramani #define MPT3_IOCTL_INTERFACE_SAS35	(0x07)
155f92363d1SSreekanth Reddy #define MPT2_IOCTL_VERSION_LENGTH	(32)
156f92363d1SSreekanth Reddy 
157f92363d1SSreekanth Reddy /**
158f92363d1SSreekanth Reddy  * struct mpt3_ioctl_iocinfo - generic controller info
159f92363d1SSreekanth Reddy  * @hdr - generic header
160f92363d1SSreekanth Reddy  * @adapter_type - type of adapter (spi, fc, sas)
161f92363d1SSreekanth Reddy  * @port_number - port number
162f92363d1SSreekanth Reddy  * @pci_id - PCI Id
163f92363d1SSreekanth Reddy  * @hw_rev - hardware revision
164f92363d1SSreekanth Reddy  * @sub_system_device - PCI subsystem Device ID
165f92363d1SSreekanth Reddy  * @sub_system_vendor - PCI subsystem Vendor ID
166f92363d1SSreekanth Reddy  * @rsvd0 - reserved
167f92363d1SSreekanth Reddy  * @firmware_version - firmware version
168f92363d1SSreekanth Reddy  * @bios_version - BIOS version
169f92363d1SSreekanth Reddy  * @driver_version - driver version - 32 ASCII characters
170f92363d1SSreekanth Reddy  * @rsvd1 - reserved
171f92363d1SSreekanth Reddy  * @scsi_id - scsi id of adapter 0
172f92363d1SSreekanth Reddy  * @rsvd2 - reserved
173f92363d1SSreekanth Reddy  * @pci_information - pci info (2nd revision)
174f92363d1SSreekanth Reddy  */
175f92363d1SSreekanth Reddy struct mpt3_ioctl_iocinfo {
176f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
177f92363d1SSreekanth Reddy 	uint32_t adapter_type;
178f92363d1SSreekanth Reddy 	uint32_t port_number;
179f92363d1SSreekanth Reddy 	uint32_t pci_id;
180f92363d1SSreekanth Reddy 	uint32_t hw_rev;
181f92363d1SSreekanth Reddy 	uint32_t subsystem_device;
182f92363d1SSreekanth Reddy 	uint32_t subsystem_vendor;
183f92363d1SSreekanth Reddy 	uint32_t rsvd0;
184f92363d1SSreekanth Reddy 	uint32_t firmware_version;
185f92363d1SSreekanth Reddy 	uint32_t bios_version;
186f92363d1SSreekanth Reddy 	uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH];
187f92363d1SSreekanth Reddy 	uint8_t rsvd1;
188f92363d1SSreekanth Reddy 	uint8_t scsi_id;
189f92363d1SSreekanth Reddy 	uint16_t rsvd2;
190f92363d1SSreekanth Reddy 	struct mpt3_ioctl_pci_info pci_information;
191f92363d1SSreekanth Reddy };
192f92363d1SSreekanth Reddy 
193f92363d1SSreekanth Reddy 
194f92363d1SSreekanth Reddy /* number of event log entries */
1951537d1bfSChaitra P B #define MPT3SAS_CTL_EVENT_LOG_SIZE (200)
196f92363d1SSreekanth Reddy 
197f92363d1SSreekanth Reddy /**
198f92363d1SSreekanth Reddy  * struct mpt3_ioctl_eventquery - query event count and type
199f92363d1SSreekanth Reddy  * @hdr - generic header
200f92363d1SSreekanth Reddy  * @event_entries - number of events returned by get_event_report
201f92363d1SSreekanth Reddy  * @rsvd - reserved
202f92363d1SSreekanth Reddy  * @event_types - type of events currently being captured
203f92363d1SSreekanth Reddy  */
204f92363d1SSreekanth Reddy struct mpt3_ioctl_eventquery {
205f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
206f92363d1SSreekanth Reddy 	uint16_t event_entries;
207f92363d1SSreekanth Reddy 	uint16_t rsvd;
208f92363d1SSreekanth Reddy 	uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
209f92363d1SSreekanth Reddy };
210f92363d1SSreekanth Reddy 
211f92363d1SSreekanth Reddy /**
212f92363d1SSreekanth Reddy  * struct mpt3_ioctl_eventenable - enable/disable event capturing
213f92363d1SSreekanth Reddy  * @hdr - generic header
214f92363d1SSreekanth Reddy  * @event_types - toggle off/on type of events to be captured
215f92363d1SSreekanth Reddy  */
216f92363d1SSreekanth Reddy struct mpt3_ioctl_eventenable {
217f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
218f92363d1SSreekanth Reddy 	uint32_t event_types[4];
219f92363d1SSreekanth Reddy };
220f92363d1SSreekanth Reddy 
221f92363d1SSreekanth Reddy #define MPT3_EVENT_DATA_SIZE (192)
222f92363d1SSreekanth Reddy /**
223f92363d1SSreekanth Reddy  * struct MPT3_IOCTL_EVENTS -
224f92363d1SSreekanth Reddy  * @event - the event that was reported
225f92363d1SSreekanth Reddy  * @context - unique value for each event assigned by driver
226f92363d1SSreekanth Reddy  * @data - event data returned in fw reply message
227f92363d1SSreekanth Reddy  */
228f92363d1SSreekanth Reddy struct MPT3_IOCTL_EVENTS {
229f92363d1SSreekanth Reddy 	uint32_t event;
230f92363d1SSreekanth Reddy 	uint32_t context;
231f92363d1SSreekanth Reddy 	uint8_t data[MPT3_EVENT_DATA_SIZE];
232f92363d1SSreekanth Reddy };
233f92363d1SSreekanth Reddy 
234f92363d1SSreekanth Reddy /**
235f92363d1SSreekanth Reddy  * struct mpt3_ioctl_eventreport - returing event log
236f92363d1SSreekanth Reddy  * @hdr - generic header
237f92363d1SSreekanth Reddy  * @event_data - (see struct MPT3_IOCTL_EVENTS)
238f92363d1SSreekanth Reddy  */
239f92363d1SSreekanth Reddy struct mpt3_ioctl_eventreport {
240f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
241f92363d1SSreekanth Reddy 	struct MPT3_IOCTL_EVENTS event_data[1];
242f92363d1SSreekanth Reddy };
243f92363d1SSreekanth Reddy 
244f92363d1SSreekanth Reddy /**
245f92363d1SSreekanth Reddy  * struct mpt3_ioctl_command - generic mpt firmware passthru ioctl
246f92363d1SSreekanth Reddy  * @hdr - generic header
247f92363d1SSreekanth Reddy  * @timeout - command timeout in seconds. (if zero then use driver default
248f92363d1SSreekanth Reddy  *  value).
249f92363d1SSreekanth Reddy  * @reply_frame_buf_ptr - reply location
250f92363d1SSreekanth Reddy  * @data_in_buf_ptr - destination for read
251f92363d1SSreekanth Reddy  * @data_out_buf_ptr - data source for write
252f92363d1SSreekanth Reddy  * @sense_data_ptr - sense data location
253f92363d1SSreekanth Reddy  * @max_reply_bytes - maximum number of reply bytes to be sent to app.
254f92363d1SSreekanth Reddy  * @data_in_size - number bytes for data transfer in (read)
255f92363d1SSreekanth Reddy  * @data_out_size - number bytes for data transfer out (write)
256f92363d1SSreekanth Reddy  * @max_sense_bytes - maximum number of bytes for auto sense buffers
257f92363d1SSreekanth Reddy  * @data_sge_offset - offset in words from the start of the request message to
258f92363d1SSreekanth Reddy  * the first SGL
259f92363d1SSreekanth Reddy  * @mf[1];
260f92363d1SSreekanth Reddy  */
261f92363d1SSreekanth Reddy struct mpt3_ioctl_command {
262f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
263f92363d1SSreekanth Reddy 	uint32_t timeout;
264f92363d1SSreekanth Reddy 	void __user *reply_frame_buf_ptr;
265f92363d1SSreekanth Reddy 	void __user *data_in_buf_ptr;
266f92363d1SSreekanth Reddy 	void __user *data_out_buf_ptr;
267f92363d1SSreekanth Reddy 	void __user *sense_data_ptr;
268f92363d1SSreekanth Reddy 	uint32_t max_reply_bytes;
269f92363d1SSreekanth Reddy 	uint32_t data_in_size;
270f92363d1SSreekanth Reddy 	uint32_t data_out_size;
271f92363d1SSreekanth Reddy 	uint32_t max_sense_bytes;
272f92363d1SSreekanth Reddy 	uint32_t data_sge_offset;
273f92363d1SSreekanth Reddy 	uint8_t mf[1];
274f92363d1SSreekanth Reddy };
275f92363d1SSreekanth Reddy 
276f92363d1SSreekanth Reddy #ifdef CONFIG_COMPAT
277f92363d1SSreekanth Reddy struct mpt3_ioctl_command32 {
278f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
279f92363d1SSreekanth Reddy 	uint32_t timeout;
280f92363d1SSreekanth Reddy 	uint32_t reply_frame_buf_ptr;
281f92363d1SSreekanth Reddy 	uint32_t data_in_buf_ptr;
282f92363d1SSreekanth Reddy 	uint32_t data_out_buf_ptr;
283f92363d1SSreekanth Reddy 	uint32_t sense_data_ptr;
284f92363d1SSreekanth Reddy 	uint32_t max_reply_bytes;
285f92363d1SSreekanth Reddy 	uint32_t data_in_size;
286f92363d1SSreekanth Reddy 	uint32_t data_out_size;
287f92363d1SSreekanth Reddy 	uint32_t max_sense_bytes;
288f92363d1SSreekanth Reddy 	uint32_t data_sge_offset;
289f92363d1SSreekanth Reddy 	uint8_t mf[1];
290f92363d1SSreekanth Reddy };
291f92363d1SSreekanth Reddy #endif
292f92363d1SSreekanth Reddy 
293f92363d1SSreekanth Reddy /**
294f92363d1SSreekanth Reddy  * struct mpt3_ioctl_btdh_mapping - mapping info
295f92363d1SSreekanth Reddy  * @hdr - generic header
296f92363d1SSreekanth Reddy  * @id - target device identification number
297f92363d1SSreekanth Reddy  * @bus - SCSI bus number that the target device exists on
298f92363d1SSreekanth Reddy  * @handle - device handle for the target device
299f92363d1SSreekanth Reddy  * @rsvd - reserved
300f92363d1SSreekanth Reddy  *
301f92363d1SSreekanth Reddy  * To obtain a bus/id the application sets
302f92363d1SSreekanth Reddy  * handle to valid handle, and bus/id to 0xFFFF.
303f92363d1SSreekanth Reddy  *
304f92363d1SSreekanth Reddy  * To obtain the device handle the application sets
305f92363d1SSreekanth Reddy  * bus/id valid value, and the handle to 0xFFFF.
306f92363d1SSreekanth Reddy  */
307f92363d1SSreekanth Reddy struct mpt3_ioctl_btdh_mapping {
308f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
309f92363d1SSreekanth Reddy 	uint32_t id;
310f92363d1SSreekanth Reddy 	uint32_t bus;
311f92363d1SSreekanth Reddy 	uint16_t handle;
312f92363d1SSreekanth Reddy 	uint16_t rsvd;
313f92363d1SSreekanth Reddy };
314f92363d1SSreekanth Reddy 
315f92363d1SSreekanth Reddy 
316f92363d1SSreekanth Reddy 
317f92363d1SSreekanth Reddy /* application flags for mpt3_diag_register, mpt3_diag_query */
318f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_APP_OWNED	(0x0001)
319f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_BUFFER_VALID	(0x0002)
320f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_FW_BUFFER_ACCESS	(0x0004)
321*a066f4c3SSreekanth Reddy #define MPT3_APP_FLAGS_DYNAMIC_BUFFER_ALLOC (0x0008)
322f92363d1SSreekanth Reddy 
323f92363d1SSreekanth Reddy /* flags for mpt3_diag_read_buffer */
324f92363d1SSreekanth Reddy #define MPT3_FLAGS_REREGISTER		(0x0001)
325f92363d1SSreekanth Reddy 
326f92363d1SSreekanth Reddy #define MPT3_PRODUCT_SPECIFIC_DWORDS		23
327f92363d1SSreekanth Reddy 
328f92363d1SSreekanth Reddy /**
329f92363d1SSreekanth Reddy  * struct mpt3_diag_register - application register with driver
330f92363d1SSreekanth Reddy  * @hdr - generic header
331f92363d1SSreekanth Reddy  * @reserved -
332f92363d1SSreekanth Reddy  * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED
333f92363d1SSreekanth Reddy  * @application_flags - misc flags
334f92363d1SSreekanth Reddy  * @diagnostic_flags - specifies flags affecting command processing
335f92363d1SSreekanth Reddy  * @product_specific - product specific information
336f92363d1SSreekanth Reddy  * @requested_buffer_size - buffers size in bytes
337f92363d1SSreekanth Reddy  * @unique_id - tag specified by application that is used to signal ownership
338f92363d1SSreekanth Reddy  *  of the buffer.
339f92363d1SSreekanth Reddy  *
340f92363d1SSreekanth Reddy  * This will allow the driver to setup any required buffers that will be
341f92363d1SSreekanth Reddy  * needed by firmware to communicate with the driver.
342f92363d1SSreekanth Reddy  */
343f92363d1SSreekanth Reddy struct mpt3_diag_register {
344f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
345f92363d1SSreekanth Reddy 	uint8_t reserved;
346f92363d1SSreekanth Reddy 	uint8_t buffer_type;
347f92363d1SSreekanth Reddy 	uint16_t application_flags;
348f92363d1SSreekanth Reddy 	uint32_t diagnostic_flags;
349f92363d1SSreekanth Reddy 	uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS];
350f92363d1SSreekanth Reddy 	uint32_t requested_buffer_size;
351f92363d1SSreekanth Reddy 	uint32_t unique_id;
352f92363d1SSreekanth Reddy };
353f92363d1SSreekanth Reddy 
354f92363d1SSreekanth Reddy /**
355f92363d1SSreekanth Reddy  * struct mpt3_diag_unregister - application unregister with driver
356f92363d1SSreekanth Reddy  * @hdr - generic header
357f92363d1SSreekanth Reddy  * @unique_id - tag uniquely identifies the buffer to be unregistered
358f92363d1SSreekanth Reddy  *
359f92363d1SSreekanth Reddy  * This will allow the driver to cleanup any memory allocated for diag
360f92363d1SSreekanth Reddy  * messages and to free up any resources.
361f92363d1SSreekanth Reddy  */
362f92363d1SSreekanth Reddy struct mpt3_diag_unregister {
363f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
364f92363d1SSreekanth Reddy 	uint32_t unique_id;
365f92363d1SSreekanth Reddy };
366f92363d1SSreekanth Reddy 
367f92363d1SSreekanth Reddy /**
368f92363d1SSreekanth Reddy  * struct mpt3_diag_query - query relevant info associated with diag buffers
369f92363d1SSreekanth Reddy  * @hdr - generic header
370f92363d1SSreekanth Reddy  * @reserved -
371f92363d1SSreekanth Reddy  * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED
372f92363d1SSreekanth Reddy  * @application_flags - misc flags
373f92363d1SSreekanth Reddy  * @diagnostic_flags - specifies flags affecting command processing
374f92363d1SSreekanth Reddy  * @product_specific - product specific information
375f92363d1SSreekanth Reddy  * @total_buffer_size - diag buffer size in bytes
376f92363d1SSreekanth Reddy  * @driver_added_buffer_size - size of extra space appended to end of buffer
377f92363d1SSreekanth Reddy  * @unique_id - unique id associated with this buffer.
378f92363d1SSreekanth Reddy  *
379f92363d1SSreekanth Reddy  * The application will send only buffer_type and unique_id.  Driver will
380f92363d1SSreekanth Reddy  * inspect unique_id first, if valid, fill in all the info.  If unique_id is
381f92363d1SSreekanth Reddy  * 0x00, the driver will return info specified by Buffer Type.
382f92363d1SSreekanth Reddy  */
383f92363d1SSreekanth Reddy struct mpt3_diag_query {
384f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
385f92363d1SSreekanth Reddy 	uint8_t reserved;
386f92363d1SSreekanth Reddy 	uint8_t buffer_type;
387f92363d1SSreekanth Reddy 	uint16_t application_flags;
388f92363d1SSreekanth Reddy 	uint32_t diagnostic_flags;
389f92363d1SSreekanth Reddy 	uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS];
390f92363d1SSreekanth Reddy 	uint32_t total_buffer_size;
391f92363d1SSreekanth Reddy 	uint32_t driver_added_buffer_size;
392f92363d1SSreekanth Reddy 	uint32_t unique_id;
393f92363d1SSreekanth Reddy };
394f92363d1SSreekanth Reddy 
395f92363d1SSreekanth Reddy /**
396f92363d1SSreekanth Reddy  * struct mpt3_diag_release -  request to send Diag Release Message to firmware
397f92363d1SSreekanth Reddy  * @hdr - generic header
398f92363d1SSreekanth Reddy  * @unique_id - tag uniquely identifies the buffer to be released
399f92363d1SSreekanth Reddy  *
400f92363d1SSreekanth Reddy  * This allows ownership of the specified buffer to returned to the driver,
401f92363d1SSreekanth Reddy  * allowing an application to read the buffer without fear that firmware is
4029a284e5cSMasahiro Yamada  * overwriting information in the buffer.
403f92363d1SSreekanth Reddy  */
404f92363d1SSreekanth Reddy struct mpt3_diag_release {
405f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
406f92363d1SSreekanth Reddy 	uint32_t unique_id;
407f92363d1SSreekanth Reddy };
408f92363d1SSreekanth Reddy 
409f92363d1SSreekanth Reddy /**
410f92363d1SSreekanth Reddy  * struct mpt3_diag_read_buffer - request for copy of the diag buffer
411f92363d1SSreekanth Reddy  * @hdr - generic header
412f92363d1SSreekanth Reddy  * @status -
413f92363d1SSreekanth Reddy  * @reserved -
414f92363d1SSreekanth Reddy  * @flags - misc flags
415f92363d1SSreekanth Reddy  * @starting_offset - starting offset within drivers buffer where to start
416f92363d1SSreekanth Reddy  *  reading data at into the specified application buffer
417f92363d1SSreekanth Reddy  * @bytes_to_read - number of bytes to copy from the drivers buffer into the
418f92363d1SSreekanth Reddy  *  application buffer starting at starting_offset.
419f92363d1SSreekanth Reddy  * @unique_id - unique id associated with this buffer.
420f92363d1SSreekanth Reddy  * @diagnostic_data - data payload
421f92363d1SSreekanth Reddy  */
422f92363d1SSreekanth Reddy struct mpt3_diag_read_buffer {
423f92363d1SSreekanth Reddy 	struct mpt3_ioctl_header hdr;
424f92363d1SSreekanth Reddy 	uint8_t status;
425f92363d1SSreekanth Reddy 	uint8_t reserved;
426f92363d1SSreekanth Reddy 	uint16_t flags;
427f92363d1SSreekanth Reddy 	uint32_t starting_offset;
428f92363d1SSreekanth Reddy 	uint32_t bytes_to_read;
429f92363d1SSreekanth Reddy 	uint32_t unique_id;
430f92363d1SSreekanth Reddy 	uint32_t diagnostic_data[1];
431f92363d1SSreekanth Reddy };
432f92363d1SSreekanth Reddy 
433f92363d1SSreekanth Reddy #endif /* MPT3SAS_CTL_H_INCLUDED */
434