smartmontools SVN Rev 5613
Utility to control and monitor storage systems with "S.M.A.R.T."
aacraid.h
Go to the documentation of this file.
1/* aacraid.h
2 * Copyright (C) 2014 Raghava Aditya <Raghava.Aditya@pmcs.com>
3 * Copyright (C) 2015 Nidhi Malhotra <Nidhi.Malhotra@pmcs.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8// Check windows
9#if defined(_WIN32) || defined(_WIN64)
10#ifdef _WIN64
11 #define ENVIRONMENT64
12#else
13 #define ENVIRONMENT32
14#endif
15#endif
16
17// Check GCC
18#if __GNUC__
19#if __x86_64__ || __ppc64__
20 #define ENVIRONMENT64
21#else
22 #define ENVIRONMENT32
23#endif
24#endif
25
26#define METHOD_BUFFERED 0
27#define METHOD_NEITHER 3
28
29#if defined(_WIN32) || defined(_WIN64)
30#define FSAMPCTL_SCSI_BASE IOCTL_SCSI_BASE
31#define ARCIOCTL_SEND_RAW_SRB CTL_CODE(FSAMPCTL_SCSI_BASE, 2201, METHOD_BUFFERED, FILE_ANY_ACCESS)
32#define AACRAID_SAS_SIGNATURE "ARCSAS"
33#define SRB_FLAGS_DATA_IN 0x00000040
34#define SRB_FLAGS_DATA_OUT 0x00000080
35#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
36#else
37#define CTL_CODE(function, method) ((4<< 16) | ((function) << 2) | (method) )
38
39#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED)
40#endif
41#define SRB_FUNCTION_EXECUTE_SCSI 0X00
42
43#define SRB_DataIn 0x0040
44#define SRB_DataOut 0x0080
45#define SRB_NoDataXfer 0x0000
46
47typedef struct {
48 uint32_t lo32;
49 uint32_t hi32;
50 } address64;
51
52typedef struct {
54 uint32_t length; /* Length. */
56
57typedef struct {
58 uint32_t addr32;
59 uint32_t length;
61
62typedef struct {
63 uint32_t count;
66
67typedef struct {
68 uint32_t count;
71
72#if defined(_WIN32) || defined(_WIN64)
73typedef struct _SCSI_REQUEST_BLOCK {
74 USHORT Length; // offset 0
75 UCHAR Function; // offset 2
76 UCHAR SrbStatus; // offset 3
77 UCHAR ScsiStatus; // offset 4
78 UCHAR PathId; // offset 5
79 UCHAR TargetId; // offset 6
80 UCHAR Lun; // offset 7
81 UCHAR QueueTag; // offset 8
82 UCHAR QueueAction; // offset 9
83 UCHAR CdbLength; // offset a
84 UCHAR SenseInfoBufferLength; // offset b
85 ULONG SrbFlags; // offset c
86 ULONG DataTransferLength; // offset 10
87 ULONG TimeOutValue; // offset 14
88 PVOID DataBuffer; // offset 18
89 PVOID SenseInfoBuffer; // offset 1c
90 struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20
91 PVOID OriginalRequest; // offset 24
92 PVOID SrbExtension; // offset 28
93 union {
94 ULONG InternalStatus; // offset 2c
95 ULONG QueueSortKey; // offset 2c
96 };
97
98#if defined(_WIN64)
99 //
100 // Force PVOID alignment of Cdb
101 //
102 ULONG Reserved;
103#endif
104
105 UCHAR Cdb[16]; // offset 30
106} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
107
108#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
109
110#else
111typedef struct {
112 uint32_t function; //SRB_FUNCTION_EXECUTE_SCSI 0x00
113 uint32_t channel; //bus
114 uint32_t id; //use the ID number this is wrong
115 uint32_t lun; //Logical unit number
116 uint32_t timeout;
117 uint32_t flags; //Interesting stuff I must say
118 uint32_t count; // Data xfer size
119 uint32_t retry_limit; // We shall see
120 uint32_t cdb_size; // Length of CDB
121 uint8_t cdb[16]; // The actual cdb command
122 user_sgmap64 sg64; // pDatabuffer and address of Databuffer
124
125typedef struct {
126 uint32_t function; //SRB_FUNCTION_EXECUTE_SCSI 0x00
127 uint32_t channel; //bus
128 uint32_t id; //use the ID number this is wrong
129 uint32_t lun; //Logical unit number
130 uint32_t timeout;
131 uint32_t flags; //Interesting stuff I must say
132 uint32_t count; // Data xfer size
133 uint32_t retry_limit; // We shall see
134 uint32_t cdb_size; // Length of CDB
135 uint8_t cdb[16]; // The actual cdb command
136 user_sgmap32 sg32; // pDatabuffer and address of Databuffer
138
139typedef struct {
140 uint32_t status;
141 uint32_t srb_status;
142 uint32_t scsi_status;
145 uint8_t sense_data[30];
147#endif
u8 cdb[16]
Definition: megaraid.h:21
uint32_t hi32
Definition: aacraid.h:49
uint32_t lo32
Definition: aacraid.h:48
uint32_t srb_status
Definition: aacraid.h:141
uint32_t sense_data_size
Definition: aacraid.h:144
uint32_t data_xfer_length
Definition: aacraid.h:143
uint32_t scsi_status
Definition: aacraid.h:142
uint32_t status
Definition: aacraid.h:140
uint32_t flags
Definition: aacraid.h:131
uint32_t timeout
Definition: aacraid.h:130
uint32_t count
Definition: aacraid.h:132
uint32_t retry_limit
Definition: aacraid.h:133
uint32_t cdb_size
Definition: aacraid.h:134
user_sgmap32 sg32
Definition: aacraid.h:136
uint32_t function
Definition: aacraid.h:126
uint32_t id
Definition: aacraid.h:128
uint32_t channel
Definition: aacraid.h:127
uint32_t lun
Definition: aacraid.h:129
uint32_t id
Definition: aacraid.h:114
uint32_t function
Definition: aacraid.h:112
uint32_t cdb_size
Definition: aacraid.h:120
uint32_t timeout
Definition: aacraid.h:116
user_sgmap64 sg64
Definition: aacraid.h:122
uint32_t retry_limit
Definition: aacraid.h:119
uint32_t count
Definition: aacraid.h:118
uint32_t flags
Definition: aacraid.h:117
uint32_t channel
Definition: aacraid.h:113
uint32_t lun
Definition: aacraid.h:115
uint32_t length
Definition: aacraid.h:59
uint32_t addr32
Definition: aacraid.h:58
uint32_t length
Definition: aacraid.h:54
address64 addr64
Definition: aacraid.h:53
uint32_t count
Definition: aacraid.h:68
uint32_t count
Definition: aacraid.h:63