xref: /freebsd/sys/dev/mps/mps_ioctl.h (revision bb15ca603fa442c72dde3f3cb8b46db6970e3950)
1 /*-
2  * Copyright (c) 2008 Yahoo!, Inc.
3  * All rights reserved.
4  * Written by: John Baldwin <jhb@FreeBSD.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the author nor the names of any co-contributors
15  *    may be used to endorse or promote products derived from this software
16  *    without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * LSI MPT-Fusion Host Adapter FreeBSD userland interface
31  *
32  * $FreeBSD$
33  */
34 
35 #ifndef _MPS_IOCTL_H_
36 #define	_MPS_IOCTL_H_
37 
38 #include <dev/mps/mpi/mpi2_type.h>
39 #include <dev/mps/mpi/mpi2.h>
40 #include <dev/mps/mpi/mpi2_cnfg.h>
41 #include <dev/mps/mpi/mpi2_sas.h>
42 
43 /*
44  * For the read header requests, the header should include the page
45  * type or extended page type, page number, and page version.  The
46  * buffer and length are unused.  The completed header is returned in
47  * the 'header' member.
48  *
49  * For the read page and write page requests, 'buf' should point to a
50  * buffer of 'len' bytes which holds the entire page (including the
51  * header).
52  *
53  * All requests specify the page address in 'page_address'.
54  */
55 struct mps_cfg_page_req {
56 	MPI2_CONFIG_PAGE_HEADER header;
57 	uint32_t page_address;
58 	void	*buf;
59 	int	len;
60 	uint16_t ioc_status;
61 };
62 
63 struct mps_ext_cfg_page_req {
64 	MPI2_CONFIG_EXTENDED_PAGE_HEADER header;
65 	uint32_t page_address;
66 	void	*buf;
67 	int	len;
68 	uint16_t ioc_status;
69 };
70 
71 struct mps_raid_action {
72 	uint8_t action;
73 	uint8_t volume_bus;
74 	uint8_t volume_id;
75 	uint8_t phys_disk_num;
76 	uint32_t action_data_word;
77 	void *buf;
78 	int len;
79 	uint32_t volume_status;
80 	uint32_t action_data[4];
81 	uint16_t action_status;
82 	uint16_t ioc_status;
83 	uint8_t write;
84 };
85 
86 struct mps_usr_command {
87 	void *req;
88 	uint32_t req_len;
89 	void *rpl;
90 	uint32_t rpl_len;
91 	void *buf;
92 	int len;
93 	uint32_t flags;
94 };
95 
96 #define MPSIO_MPS_COMMAND_FLAG_VERBOSE 0x01
97 #define MPSIO_MPS_COMMAND_FLAG_DEBUG 0x02
98 #define	MPSIO_READ_CFG_HEADER	_IOWR('M', 200, struct mps_cfg_page_req)
99 #define	MPSIO_READ_CFG_PAGE	_IOWR('M', 201, struct mps_cfg_page_req)
100 #define	MPSIO_READ_EXT_CFG_HEADER _IOWR('M', 202, struct mps_ext_cfg_page_req)
101 #define	MPSIO_READ_EXT_CFG_PAGE	_IOWR('M', 203, struct mps_ext_cfg_page_req)
102 #define	MPSIO_WRITE_CFG_PAGE	_IOWR('M', 204, struct mps_cfg_page_req)
103 #define	MPSIO_RAID_ACTION	_IOWR('M', 205, struct mps_raid_action)
104 #define	MPSIO_MPS_COMMAND	_IOWR('M', 210, struct mps_usr_command)
105 
106 #endif /* !_MPS_IOCTL_H_ */
107