1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1999 Michael Smith 5 * All rights reserved. 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * 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 AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 #include <sys/ioccom.h> 32 33 /* 34 * System Disk ioctls 35 */ 36 37 /* system disk status values */ 38 #define MLX_SYSD_ONLINE 0x03 39 #define MLX_SYSD_CRITICAL 0x04 40 #define MLX_SYSD_OFFLINE 0xff 41 42 #define MLXD_STATUS _IOR ('M', 100, int) 43 #define MLXD_CHECKASYNC _IOR ('M', 101, int) /* command result returned in argument */ 44 45 /* 46 * Controller ioctls 47 */ 48 struct mlx_pause 49 { 50 int mp_which; 51 #define MLX_PAUSE_ALL 0xff 52 #define MLX_PAUSE_CANCEL 0x00 53 int mp_when; 54 int mp_howlong; 55 }; 56 57 struct mlx_usercommand 58 { 59 /* data buffer */ 60 size_t mu_datasize; /* size of databuffer */ 61 void *mu_buf; /* address in userspace of databuffer */ 62 int mu_bufptr; /* offset into command mailbox to place databuffer address */ 63 64 /* command */ 65 u_int16_t mu_status; /* command status returned */ 66 u_int8_t mu_command[16]; /* command mailbox contents */ 67 68 /* wrapper */ 69 int mu_error; /* result of submission to driver */ 70 71 }; 72 73 struct mlx_rebuild_request 74 { 75 int rr_channel; 76 int rr_target; 77 int rr_status; 78 }; 79 80 struct mlx_rebuild_status 81 { 82 u_int16_t rs_code; 83 #define MLX_REBUILDSTAT_REBUILDCHECK 0x0000 84 #define MLX_REBUILDSTAT_ADDCAPACITY 0x0400 85 #define MLX_REBUILDSTAT_ADDCAPACITYINIT 0x0500 86 #define MLX_REBUILDSTAT_IDLE 0xffff 87 u_int16_t rs_drive; 88 int rs_size; 89 int rs_remaining; 90 }; 91 92 #define MLX_NEXT_CHILD _IOWR('M', 0, int) 93 #define MLX_RESCAN_DRIVES _IO ('M', 1) 94 #define MLX_DETACH_DRIVE _IOW ('M', 2, int) 95 #define MLX_PAUSE_CHANNEL _IOW ('M', 3, struct mlx_pause) 96 #define MLX_COMMAND _IOWR('M', 4, struct mlx_usercommand) 97 #define MLX_REBUILDASYNC _IOWR('M', 5, struct mlx_rebuild_request) 98 #define MLX_REBUILDSTAT _IOR ('M', 6, struct mlx_rebuild_status) 99 #define MLX_GET_SYSDRIVE _IOWR('M', 7, int) 100