11ac4b82bSMike Smith /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 41ac4b82bSMike Smith * Copyright (c) 1999 Michael Smith 51ac4b82bSMike Smith * All rights reserved. 61ac4b82bSMike Smith * 71ac4b82bSMike Smith * Redistribution and use in source and binary forms, with or without 81ac4b82bSMike Smith * modification, are permitted provided that the following conditions 91ac4b82bSMike Smith * are met: 101ac4b82bSMike Smith * 1. Redistributions of source code must retain the above copyright 111ac4b82bSMike Smith * notice, this list of conditions and the following disclaimer. 121ac4b82bSMike Smith * 2. Redistributions in binary form must reproduce the above copyright 131ac4b82bSMike Smith * notice, this list of conditions and the following disclaimer in the 141ac4b82bSMike Smith * documentation and/or other materials provided with the distribution. 151ac4b82bSMike Smith * 161ac4b82bSMike Smith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 171ac4b82bSMike Smith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 181ac4b82bSMike Smith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 191ac4b82bSMike Smith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 201ac4b82bSMike Smith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 211ac4b82bSMike Smith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 221ac4b82bSMike Smith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231ac4b82bSMike Smith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 241ac4b82bSMike Smith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 251ac4b82bSMike Smith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261ac4b82bSMike Smith * SUCH DAMAGE. 271ac4b82bSMike Smith */ 281ac4b82bSMike Smith 291ac4b82bSMike Smith #include <sys/ioccom.h> 301ac4b82bSMike Smith 311ac4b82bSMike Smith /* 321ac4b82bSMike Smith * System Disk ioctls 331ac4b82bSMike Smith */ 341ac4b82bSMike Smith 35421f2f7dSMike Smith /* system disk status values */ 361ac4b82bSMike Smith #define MLX_SYSD_ONLINE 0x03 371ac4b82bSMike Smith #define MLX_SYSD_CRITICAL 0x04 381ac4b82bSMike Smith #define MLX_SYSD_OFFLINE 0xff 391ac4b82bSMike Smith 40421f2f7dSMike Smith #define MLXD_STATUS _IOR ('M', 100, int) 41421f2f7dSMike Smith #define MLXD_CHECKASYNC _IOR ('M', 101, int) /* command result returned in argument */ 42421f2f7dSMike Smith 431ac4b82bSMike Smith /* 441ac4b82bSMike Smith * Controller ioctls 451ac4b82bSMike Smith */ 461ac4b82bSMike Smith struct mlx_pause 471ac4b82bSMike Smith { 481ac4b82bSMike Smith int mp_which; 491ac4b82bSMike Smith #define MLX_PAUSE_ALL 0xff 501ac4b82bSMike Smith #define MLX_PAUSE_CANCEL 0x00 511ac4b82bSMike Smith int mp_when; 521ac4b82bSMike Smith int mp_howlong; 531ac4b82bSMike Smith }; 541ac4b82bSMike Smith 551ac4b82bSMike Smith struct mlx_usercommand 561ac4b82bSMike Smith { 571ac4b82bSMike Smith /* data buffer */ 581ac4b82bSMike Smith size_t mu_datasize; /* size of databuffer */ 591ac4b82bSMike Smith void *mu_buf; /* address in userspace of databuffer */ 601ac4b82bSMike Smith int mu_bufptr; /* offset into command mailbox to place databuffer address */ 611ac4b82bSMike Smith 621ac4b82bSMike Smith /* command */ 631ac4b82bSMike Smith u_int16_t mu_status; /* command status returned */ 641ac4b82bSMike Smith u_int8_t mu_command[16]; /* command mailbox contents */ 65da8bb3a3SMike Smith 66da8bb3a3SMike Smith /* wrapper */ 67da8bb3a3SMike Smith int mu_error; /* result of submission to driver */ 68da8bb3a3SMike Smith 691ac4b82bSMike Smith }; 701ac4b82bSMike Smith 71421f2f7dSMike Smith struct mlx_rebuild_request 72421f2f7dSMike Smith { 73421f2f7dSMike Smith int rr_channel; 74421f2f7dSMike Smith int rr_target; 75421f2f7dSMike Smith int rr_status; 76421f2f7dSMike Smith }; 77421f2f7dSMike Smith 78421f2f7dSMike Smith struct mlx_rebuild_status 79421f2f7dSMike Smith { 80421f2f7dSMike Smith u_int16_t rs_code; 81421f2f7dSMike Smith #define MLX_REBUILDSTAT_REBUILDCHECK 0x0000 82421f2f7dSMike Smith #define MLX_REBUILDSTAT_ADDCAPACITY 0x0400 83421f2f7dSMike Smith #define MLX_REBUILDSTAT_ADDCAPACITYINIT 0x0500 84421f2f7dSMike Smith #define MLX_REBUILDSTAT_IDLE 0xffff 85421f2f7dSMike Smith u_int16_t rs_drive; 86421f2f7dSMike Smith int rs_size; 87421f2f7dSMike Smith int rs_remaining; 88421f2f7dSMike Smith }; 89421f2f7dSMike Smith 901ac4b82bSMike Smith #define MLX_NEXT_CHILD _IOWR('M', 0, int) 911ac4b82bSMike Smith #define MLX_RESCAN_DRIVES _IO ('M', 1) 921ac4b82bSMike Smith #define MLX_DETACH_DRIVE _IOW ('M', 2, int) 931ac4b82bSMike Smith #define MLX_PAUSE_CHANNEL _IOW ('M', 3, struct mlx_pause) 941ac4b82bSMike Smith #define MLX_COMMAND _IOWR('M', 4, struct mlx_usercommand) 95421f2f7dSMike Smith #define MLX_REBUILDASYNC _IOWR('M', 5, struct mlx_rebuild_request) 96421f2f7dSMike Smith #define MLX_REBUILDSTAT _IOR ('M', 6, struct mlx_rebuild_status) 97421f2f7dSMike Smith #define MLX_GET_SYSDRIVE _IOWR('M', 7, int) 98