1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2023 Racktop Systems, Inc. 14 */ 15 #ifndef _LMRC_IOCTL_H 16 #define _LMRC_IOCTL_H 17 18 #include <sys/cred.h> 19 #include <sys/file.h> 20 #include <sys/types.h> 21 #include <sys/errno.h> 22 #include <sys/ddi.h> 23 #include <sys/sunddi.h> 24 25 typedef struct lmrc_drv_ver lmrc_drv_ver_t; 26 typedef struct lmrc_pci_info lmrc_pci_info_t; 27 typedef struct lmrc_ioctl lmrc_ioctl_t; 28 29 #include "lmrc_reg.h" 30 31 /* 32 * Definitions for the lmrc ioctl interface. This has to be the same as in 33 * mr_sas(4D), as the only consumers of this interface are closed-source 34 * utilities like storcli which we can't change. 35 */ 36 #define LMRC_IOCTL_DRIVER 0x12341234 37 #define LMRC_IOCTL_FIRMWARE 0x12345678 38 #define LMRC_IOCTL_AEN 0x87654321 39 40 #define LMRC_DRIVER_IOCTL_COMMON 0xF0010000 41 #define LMRC_DRIVER_IOCTL_DRIVER_VERSION 0xF0010100 42 #define LMRC_DRIVER_IOCTL_PCI_INFORMATION 0xF0010200 43 #define LMRC_DRIVER_IOCTL_MRRAID_STATISTICS 0xF0010300 44 45 #define LMRC_IOC_SENSE_LEN 32 46 47 #pragma pack(1) 48 49 struct lmrc_drv_ver { 50 uint8_t dv_signature[12]; 51 uint8_t dv_os_name[16]; 52 uint8_t dv_os_ver[12]; 53 uint8_t dv_drv_name[20]; 54 uint8_t dv_drv_ver[32]; 55 uint8_t dv_drv_rel_date[20]; 56 }; 57 58 struct lmrc_pci_info { 59 uint32_t pi_bus; 60 uint8_t pi_dev; 61 uint8_t pi_func; 62 uint8_t pi_intr; 63 uint8_t pi_rsvd; 64 uint8_t pi_header[0x40]; 65 uint8_t pi_cap[8]; 66 uint8_t pi_rsvd2[32]; 67 }; 68 69 struct lmrc_ioctl { 70 uint16_t ioc_version; 71 uint16_t ioc_controller_id; 72 uint8_t ioc_signature[8]; 73 uint32_t ioc_reserved_1; 74 uint32_t ioc_control_code; 75 uint32_t ioc_reserved_2[2]; 76 lmrc_mfi_frame_t ioc_frame; 77 lmrc_mfi_sgl_t ioc_sgl; 78 uint8_t ioc_sense[LMRC_IOC_SENSE_LEN]; 79 uint8_t ioc_data[0]; 80 }; 81 82 #pragma pack(0) 83 84 int lmrc_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); 85 86 #endif /* _LMRC_IOCTL_H */ 87