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