1178814Sjhb/*-
2178814Sjhb * Copyright (c) 2008 Yahoo!, Inc.
3178814Sjhb * All rights reserved.
4178814Sjhb * Written by: John Baldwin <jhb@FreeBSD.org>
5178814Sjhb *
6178814Sjhb * Redistribution and use in source and binary forms, with or without
7178814Sjhb * modification, are permitted provided that the following conditions
8178814Sjhb * are met:
9178814Sjhb * 1. Redistributions of source code must retain the above copyright
10178814Sjhb *    notice, this list of conditions and the following disclaimer.
11178814Sjhb * 2. Redistributions in binary form must reproduce the above copyright
12178814Sjhb *    notice, this list of conditions and the following disclaimer in the
13178814Sjhb *    documentation and/or other materials provided with the distribution.
14178814Sjhb * 3. Neither the name of the author nor the names of any co-contributors
15178814Sjhb *    may be used to endorse or promote products derived from this software
16178814Sjhb *    without specific prior written permission.
17178814Sjhb *
18178814Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19178814Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20178814Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21178814Sjhb * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22178814Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23178814Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24178814Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25178814Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26178814Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27178814Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28178814Sjhb * SUCH DAMAGE.
29178814Sjhb *
30178814Sjhb * LSI MPT-Fusion Host Adapter FreeBSD userland interface
31178814Sjhb *
32178814Sjhb * $FreeBSD$
33178814Sjhb */
34178814Sjhb
35178814Sjhb#ifndef _MPT_IOCTL_H_
36178814Sjhb#define	_MPT_IOCTL_H_
37178814Sjhb
38178814Sjhb#include <dev/mpt/mpilib/mpi_type.h>
39178814Sjhb#include <dev/mpt/mpilib/mpi.h>
40178814Sjhb#include <dev/mpt/mpilib/mpi_cnfg.h>
41178814Sjhb
42178814Sjhb/*
43178814Sjhb * For the read header requests, the header should include the page
44178814Sjhb * type or extended page type, page number, and page version.  The
45178814Sjhb * buffer and length are unused.  The completed header is returned in
46178814Sjhb * the 'header' member.
47178814Sjhb *
48178814Sjhb * For the read page and write page requests, 'buf' should point to a
49178814Sjhb * buffer of 'len' bytes which holds the entire page (including the
50178814Sjhb * header).
51178814Sjhb *
52178814Sjhb * All requests specify the page address in 'page_address'.
53178814Sjhb */
54178814Sjhbstruct mpt_cfg_page_req {
55178814Sjhb	CONFIG_PAGE_HEADER header;
56178814Sjhb	uint32_t page_address;
57178814Sjhb	void	*buf;
58178814Sjhb	int	len;
59178814Sjhb	uint16_t ioc_status;
60178814Sjhb};
61178814Sjhb
62178814Sjhbstruct mpt_ext_cfg_page_req {
63178814Sjhb	CONFIG_EXTENDED_PAGE_HEADER header;
64178814Sjhb	uint32_t page_address;
65178814Sjhb	void	*buf;
66178814Sjhb	int	len;
67178814Sjhb	uint16_t ioc_status;
68178814Sjhb};
69178814Sjhb
70178814Sjhbstruct mpt_raid_action {
71178814Sjhb	uint8_t action;
72178814Sjhb	uint8_t volume_bus;
73178814Sjhb	uint8_t volume_id;
74178814Sjhb	uint8_t phys_disk_num;
75178814Sjhb	uint32_t action_data_word;
76178814Sjhb	void *buf;
77178814Sjhb	int len;
78178814Sjhb	uint32_t volume_status;
79178814Sjhb	uint32_t action_data[4];
80178814Sjhb	uint16_t action_status;
81178814Sjhb	uint16_t ioc_status;
82178814Sjhb	uint8_t write;
83178814Sjhb};
84178814Sjhb
85178814Sjhb#define	MPTIO_READ_CFG_HEADER	_IOWR('M', 100, struct mpt_cfg_page_req)
86178814Sjhb#define	MPTIO_READ_CFG_PAGE	_IOWR('M', 101, struct mpt_cfg_page_req)
87178814Sjhb#define	MPTIO_READ_EXT_CFG_HEADER _IOWR('M', 102, struct mpt_ext_cfg_page_req)
88178814Sjhb#define	MPTIO_READ_EXT_CFG_PAGE	_IOWR('M', 103, struct mpt_ext_cfg_page_req)
89178814Sjhb#define	MPTIO_WRITE_CFG_PAGE	_IOWR('M', 104, struct mpt_cfg_page_req)
90178814Sjhb#define	MPTIO_RAID_ACTION	_IOWR('M', 105, struct mpt_raid_action)
91178814Sjhb
92178814Sjhb#if defined(__amd64__)
93178814Sjhbstruct mpt_cfg_page_req32 {
94178814Sjhb	CONFIG_PAGE_HEADER header;
95178814Sjhb	uint32_t page_address;
96178814Sjhb	uint32_t buf;
97178814Sjhb	int	len;
98178814Sjhb	uint16_t ioc_status;
99178814Sjhb};
100178814Sjhb
101178814Sjhbstruct mpt_ext_cfg_page_req32 {
102178814Sjhb	CONFIG_EXTENDED_PAGE_HEADER header;
103178814Sjhb	uint32_t page_address;
104178814Sjhb	uint32_t buf;
105178814Sjhb	int	len;
106178814Sjhb	uint16_t ioc_status;
107178814Sjhb};
108178814Sjhb
109178814Sjhbstruct mpt_raid_action32 {
110178814Sjhb	uint8_t action;
111178814Sjhb	uint8_t volume_bus;
112178814Sjhb	uint8_t volume_id;
113178814Sjhb	uint8_t phys_disk_num;
114178814Sjhb	uint32_t action_data_word;
115178814Sjhb	uint32_t buf;
116178814Sjhb	int len;
117178814Sjhb	uint32_t volume_status;
118178814Sjhb	uint32_t action_data[4];
119178814Sjhb	uint16_t action_status;
120178814Sjhb	uint16_t ioc_status;
121178814Sjhb	uint8_t write;
122178814Sjhb};
123178814Sjhb
124178814Sjhb#define	MPTIO_READ_CFG_HEADER32	_IOWR('M', 100, struct mpt_cfg_page_req32)
125178814Sjhb#define	MPTIO_READ_CFG_PAGE32	_IOWR('M', 101, struct mpt_cfg_page_req32)
126178814Sjhb#define	MPTIO_READ_EXT_CFG_HEADER32 _IOWR('M', 102, struct mpt_ext_cfg_page_req32)
127178814Sjhb#define	MPTIO_READ_EXT_CFG_PAGE32 _IOWR('M', 103, struct mpt_ext_cfg_page_req32)
128178814Sjhb#define	MPTIO_WRITE_CFG_PAGE32	_IOWR('M', 104, struct mpt_cfg_page_req32)
129178814Sjhb#define	MPTIO_RAID_ACTION32	_IOWR('M', 105, struct mpt_raid_action32)
130178814Sjhb#endif
131178814Sjhb
132178814Sjhb#endif /* !_MPT_IOCTL_H_ */
133