mrsas_ioctl.h revision 282525
1222656Sed/* 2222656Sed * Copyright (c) 2014, LSI Corp. All rights reserved. Author: Marian Choy 3214152Sed * Support: freebsdraid@lsi.com 4214152Sed * 5214152Sed * Redistribution and use in source and binary forms, with or without 6214152Sed * modification, are permitted provided that the following conditions are 7214152Sed * met: 8214152Sed * 9214152Sed * 1. Redistributions of source code must retain the above copyright notice, 10214152Sed * this list of conditions and the following disclaimer. 2. Redistributions 11214152Sed * in binary form must reproduce the above copyright notice, this list of 12214152Sed * conditions and the following disclaimer in the documentation and/or other 13214152Sed * materials provided with the distribution. 3. Neither the name of the 14214152Sed * <ORGANIZATION> nor the names of its contributors may be used to endorse or 15214152Sed * promote products derived from this software without specific prior written 16214152Sed * permission. 17214152Sed * 18214152Sed * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19214152Sed * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20214152Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21214152Sed * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22214152Sed * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23214152Sed * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24214152Sed * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25214152Sed * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26214152Sed * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27214152Sed * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28214152Sed * POSSIBILITY OF SUCH DAMAGE. 29214152Sed * 30214152Sed * The views and conclusions contained in the software and documentation are 31214152Sed * those of the authors and should not be interpreted as representing 32214152Sed * official policies,either expressed or implied, of the FreeBSD Project. 33214152Sed * 34214152Sed * Send feedback to: <megaraidfbsd@lsi.com> Mail to: LSI Corporation, 1621 35214152Sed * Barber Lane, Milpitas, CA 95035 ATTN: MegaRaid FreeBSD 36214152Sed * 37214152Sed */ 38214152Sed 39214152Sed#include <sys/cdefs.h> 40214152Sed__FBSDID("$FreeBSD: head/sys/dev/mrsas/mrsas_ioctl.h 282525 2015-05-06 10:32:27Z kadesai $"); 41214152Sed 42214152Sed#ifndef MRSAS_IOCTL_H 43214152Sed#define MRSAS_IOCTL_H 44214152Sed 45214152Sed#ifndef _IOWR 46214152Sed#include <sys/ioccom.h> 47214152Sed#endif /* !_IOWR */ 48214152Sed 49214152Sed#ifdef COMPAT_FREEBSD32 50214152Sed/* Compilation error FIX */ 51214152Sed#if (__FreeBSD_version <= 900000) 52214152Sed#include <sys/socket.h> 53214152Sed#endif 54214152Sed#include <sys/mount.h> 55214152Sed#include <compat/freebsd32/freebsd32.h> 56214152Sed#endif 57 58/* 59 * We need to use the same values as the mfi driver until MegaCli adds 60 * support for this (mrsas) driver: M is for MegaRAID. (This is typically the 61 * vendor or product initial) 1 arbitrary. (This may be used to segment kinds 62 * of commands. (1-9 status, 10-20 policy, etc.) struct mrsas_iocpacket 63 * (sizeof() this parameter will be used.) These three values are encoded 64 * into a somewhat unique, 32-bit value. 65 */ 66 67#define MRSAS_IOC_GET_PCI_INFO _IOR('M', 7, MRSAS_DRV_PCI_INFORMATION) 68#define MRSAS_IOC_FIRMWARE_PASS_THROUGH64 _IOWR('M', 1, struct mrsas_iocpacket) 69#ifdef COMPAT_FREEBSD32 70#define MRSAS_IOC_FIRMWARE_PASS_THROUGH32 _IOWR('M', 1, struct mrsas_iocpacket32) 71#endif 72 73#define MRSAS_IOC_SCAN_BUS _IO('M', 10) 74 75#define MRSAS_LINUX_CMD32 0xc1144d01 76 77#define MAX_IOCTL_SGE 16 78#define MFI_FRAME_DIR_READ 0x0010 79#define MFI_CMD_LD_SCSI_IO 0x03 80 81#define INQUIRY_CMD 0x12 82#define INQUIRY_CMDLEN 6 83#define INQUIRY_REPLY_LEN 96 84#define INQUIRY_VENDOR 8 /* Offset in reply data to 85 * vendor name */ 86#define SCSI_SENSE_BUFFERSIZE 96 87 88#define MEGAMFI_RAW_FRAME_SIZE 128 89 90 91#pragma pack(1) 92struct mrsas_iocpacket { 93 u_int16_t host_no; 94 u_int16_t __pad1; 95 u_int32_t sgl_off; 96 u_int32_t sge_count; 97 u_int32_t sense_off; 98 u_int32_t sense_len; 99 union { 100 u_int8_t raw[MEGAMFI_RAW_FRAME_SIZE]; 101 struct mrsas_header hdr; 102 } frame; 103 struct iovec sgl[MAX_IOCTL_SGE]; 104}; 105 106#pragma pack() 107 108#ifdef COMPAT_FREEBSD32 109#pragma pack(1) 110struct mrsas_iocpacket32 { 111 u_int16_t host_no; 112 u_int16_t __pad1; 113 u_int32_t sgl_off; 114 u_int32_t sge_count; 115 u_int32_t sense_off; 116 u_int32_t sense_len; 117 union { 118 u_int8_t raw[MEGAMFI_RAW_FRAME_SIZE]; 119 struct mrsas_header hdr; 120 } frame; 121 struct iovec32 sgl[MAX_IOCTL_SGE]; 122}; 123 124#pragma pack() 125#endif /* COMPAT_FREEBSD32 */ 126 127#endif /* MRSAS_IOCTL_H */ 128