1/*- 2 * Copyright (c) 2006 IronPort Systems 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26#include <dev/ic/mfireg.h> 27#include <sys/ioctl.h> 28 29/* 30 * these structures are used for LSI's MegaCli on both FreeBSD and Linux 31 * We will also use them in the NetBSD driver. 32 */ 33 34#define MAX_SPACE_FOR_SENSE_PTR 32 35union mfi_sense_ptr { 36 uint8_t sense_ptr_data[MAX_SPACE_FOR_SENSE_PTR]; 37 void *user_space; 38 struct { 39 uint32_t low; 40 uint32_t high; 41 } addr; 42} __packed; 43 44 45#define MAX_IOCTL_SGE 16 46 47struct mfi_ioc_packet { 48 uint16_t mfi_adapter_no; 49 uint16_t mfi_pad1; 50 uint32_t mfi_sgl_off; 51 uint32_t mfi_sge_count; 52 uint32_t mfi_sense_off; 53 uint32_t mfi_sense_len; 54 union { 55 uint8_t raw[128]; 56 struct mfi_frame_header hdr; 57 } mfi_frame; 58 59 struct iovec mfi_sgl[MAX_IOCTL_SGE]; 60} __packed; 61 62struct mfi_ioc_aen { 63 uint16_t aen_adapter_no; 64 uint16_t aen_pad1; 65 uint32_t aen_seq_num; 66 uint32_t aen_class_locale; 67} __packed; 68 69#define MFI_CMD _IOWR('M', 1, struct mfi_ioc_packet) 70#define MFI_SET_AEN _IOW('M', 3, struct mfi_ioc_aen) 71 72#ifdef _LP64 73struct iovec32 { 74 u_int32_t iov_base; 75 int iov_len; 76}; 77 78struct mfi_ioc_packet32 { 79 uint16_t mfi_adapter_no; 80 uint16_t mfi_pad1; 81 uint32_t mfi_sgl_off; 82 uint32_t mfi_sge_count; 83 uint32_t mfi_sense_off; 84 uint32_t mfi_sense_len; 85 union { 86 uint8_t raw[128]; 87 struct mfi_frame_header hdr; 88 } mfi_frame; 89 90 struct iovec32 mfi_sgl[MAX_IOCTL_SGE]; 91} __packed; 92#define MFI_CMD32 _IOWR('M', 1, struct mfi_ioc_packet32) 93#endif 94