]>
Commit | Line | Data |
---|---|---|
832b75ed GG |
1 | /* |
2 | * os_freebsd.h | |
3 | * | |
a86ec89e | 4 | * Home page of code is: http://www.smartmontools.org |
832b75ed | 5 | * |
f9e10201 | 6 | * Copyright (C) 2003-8 Eduard Martinescu |
832b75ed | 7 | * |
ff28b140 | 8 | * SPDX-License-Identifier: GPL-2.0-or-later |
832b75ed GG |
9 | */ |
10 | ||
11 | /*- | |
12 | * Copyright (c) 2000 Michael Smith | |
13 | * Copyright (c) 2003 Paul Saab | |
14 | * Copyright (c) 2003 Vinod Kashyap | |
15 | * Copyright (c) 2000 BSDi | |
16 | * All rights reserved. | |
17 | * | |
18 | * Redistribution and use in source and binary forms, with or without | |
19 | * modification, are permitted provided that the following conditions | |
20 | * are met: | |
21 | * 1. Redistributions of source code must retain the above copyright | |
22 | * notice, this list of conditions and the following disclaimer. | |
23 | * 2. Redistributions in binary form must reproduce the above copyright | |
24 | * notice, this list of conditions and the following disclaimer in the | |
25 | * documentation and/or other materials provided with the distribution. | |
26 | * | |
27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
37 | * SUCH DAMAGE. | |
38 | * | |
39 | */ | |
40 | ||
41 | /* | |
42 | * Copyright (c) 2004-05 Applied Micro Circuits Corporation. | |
43 | * Copyright (c) 2004-05 Vinod Kashyap | |
44 | * All rights reserved. | |
45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | |
54 | * | |
55 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
56 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
58 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
59 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
60 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
61 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
62 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
63 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
64 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
65 | * SUCH DAMAGE. | |
66 | * | |
67 | */ | |
68 | ||
69 | #ifndef OS_FREEBSD_H_ | |
70 | #define OS_FREEBSD_H_ | |
71 | ||
ff28b140 | 72 | #define OS_FREEBSD_H_CVSID "$Id: os_freebsd.h 4760 2018-08-19 18:45:53Z chrfranke $" |
832b75ed | 73 | |
832b75ed GG |
74 | #define MAX_NUM_DEV 26 |
75 | ||
76 | #ifdef HAVE_SYS_TWEREG_H | |
77 | #include <sys/twereg.h> | |
78 | #else | |
79 | /** | |
80 | * The following cut out of twereg.h | |
81 | * | |
82 | */ | |
83 | #if __FreeBSD_version < 500040 | |
84 | #define __packed __attribute__((__packed__)) | |
85 | #endif | |
86 | ||
87 | #define TWE_MAX_SGL_LENGTH 62 | |
88 | #define TWE_MAX_ATA_SGL_LENGTH 60 | |
89 | #define TWE_OP_ATA_PASSTHROUGH 0x11 | |
90 | ||
91 | /* scatter/gather list entry */ | |
92 | typedef struct | |
93 | { | |
94 | u_int32_t address; | |
95 | u_int32_t length; | |
96 | } __packed TWE_SG_Entry; | |
97 | ||
98 | typedef struct { | |
99 | u_int8_t opcode:5; /* TWE_OP_INITCONNECTION */ | |
100 | u_int8_t res1:3; | |
101 | u_int8_t size; | |
102 | u_int8_t request_id; | |
103 | u_int8_t res2:4; | |
104 | u_int8_t host_id:4; | |
105 | u_int8_t status; | |
106 | u_int8_t flags; | |
107 | u_int16_t message_credits; | |
108 | u_int32_t response_queue_pointer; | |
109 | } __packed TWE_Command_INITCONNECTION; | |
110 | ||
111 | typedef struct | |
112 | { | |
113 | u_int8_t opcode:5; /* TWE_OP_READ/TWE_OP_WRITE */ | |
114 | u_int8_t res1:3; | |
115 | u_int8_t size; | |
116 | u_int8_t request_id; | |
117 | u_int8_t unit:4; | |
118 | u_int8_t host_id:4; | |
119 | u_int8_t status; | |
120 | u_int8_t flags; | |
121 | u_int16_t block_count; | |
122 | u_int32_t lba; | |
123 | TWE_SG_Entry sgl[TWE_MAX_SGL_LENGTH]; | |
124 | } __packed TWE_Command_IO; | |
125 | ||
126 | typedef struct | |
127 | { | |
128 | u_int8_t opcode:5; /* TWE_OP_HOTSWAP */ | |
129 | u_int8_t res1:3; | |
130 | u_int8_t size; | |
131 | u_int8_t request_id; | |
132 | u_int8_t unit:4; | |
133 | u_int8_t host_id:4; | |
134 | u_int8_t status; | |
135 | u_int8_t flags; | |
136 | u_int8_t action; | |
137 | #define TWE_OP_HOTSWAP_REMOVE 0x00 /* remove assumed-degraded unit */ | |
138 | #define TWE_OP_HOTSWAP_ADD_CBOD 0x01 /* add CBOD to empty port */ | |
139 | #define TWE_OP_HOTSWAP_ADD_SPARE 0x02 /* add spare to empty port */ | |
140 | u_int8_t aport; | |
141 | } __packed TWE_Command_HOTSWAP; | |
142 | ||
143 | typedef struct | |
144 | { | |
145 | u_int8_t opcode:5; /* TWE_OP_SETATAFEATURE */ | |
146 | u_int8_t res1:3; | |
147 | u_int8_t size; | |
148 | u_int8_t request_id; | |
149 | u_int8_t unit:4; | |
150 | u_int8_t host_id:4; | |
151 | u_int8_t status; | |
152 | u_int8_t flags; | |
153 | u_int8_t feature; | |
154 | #define TWE_OP_SETATAFEATURE_WCE 0x02 | |
155 | #define TWE_OP_SETATAFEATURE_DIS_WCE 0x82 | |
156 | u_int8_t feature_mode; | |
157 | u_int16_t all_units; | |
158 | u_int16_t persistence; | |
159 | } __packed TWE_Command_SETATAFEATURE; | |
160 | ||
161 | typedef struct | |
162 | { | |
163 | u_int8_t opcode:5; /* TWE_OP_CHECKSTATUS */ | |
164 | u_int8_t res1:3; | |
165 | u_int8_t size; | |
166 | u_int8_t request_id; | |
167 | u_int8_t unit:4; | |
168 | u_int8_t res2:4; | |
169 | u_int8_t status; | |
170 | u_int8_t flags; | |
171 | u_int16_t target_status; /* set low byte to target request's ID */ | |
172 | } __packed TWE_Command_CHECKSTATUS; | |
173 | ||
174 | typedef struct | |
175 | { | |
176 | u_int8_t opcode:5; /* TWE_OP_GETPARAM, TWE_OP_SETPARAM */ | |
177 | u_int8_t res1:3; | |
178 | u_int8_t size; | |
179 | u_int8_t request_id; | |
180 | u_int8_t unit:4; | |
181 | u_int8_t host_id:4; | |
182 | u_int8_t status; | |
183 | u_int8_t flags; | |
184 | u_int16_t param_count; | |
185 | TWE_SG_Entry sgl[TWE_MAX_SGL_LENGTH]; | |
186 | } __packed TWE_Command_PARAM; | |
187 | ||
188 | typedef struct | |
189 | { | |
190 | u_int8_t opcode:5; /* TWE_OP_REBUILDUNIT */ | |
191 | u_int8_t res1:3; | |
192 | u_int8_t size; | |
193 | u_int8_t request_id; | |
194 | u_int8_t src_unit:4; | |
195 | u_int8_t host_id:4; | |
196 | u_int8_t status; | |
197 | u_int8_t flags; | |
198 | u_int8_t action:7; | |
199 | #define TWE_OP_REBUILDUNIT_NOP 0 | |
200 | #define TWE_OP_REBUILDUNIT_STOP 2 /* stop all rebuilds */ | |
201 | #define TWE_OP_REBUILDUNIT_START 4 /* start rebuild with lowest unit */ | |
202 | #define TWE_OP_REBUILDUNIT_STARTUNIT 5 /* rebuild src_unit (not supported) */ | |
203 | u_int8_t cs:1; /* request state change on src_unit */ | |
204 | u_int8_t logical_subunit; /* for RAID10 rebuild of logical subunit */ | |
205 | } __packed TWE_Command_REBUILDUNIT; | |
206 | ||
207 | typedef struct | |
208 | { | |
209 | u_int8_t opcode:5; | |
210 | u_int8_t sgl_offset:3; | |
211 | u_int8_t size; | |
212 | u_int8_t request_id; | |
a37e7145 | 213 | u_int8_t unit; |
832b75ed GG |
214 | u_int8_t status; |
215 | u_int8_t flags; | |
216 | u_int16_t param; | |
217 | u_int16_t features; | |
218 | u_int16_t sector_count; | |
219 | u_int16_t sector_num; | |
220 | u_int16_t cylinder_lo; | |
221 | u_int16_t cylinder_hi; | |
222 | u_int8_t drive_head; | |
223 | u_int8_t command; | |
224 | TWE_SG_Entry sgl[TWE_MAX_ATA_SGL_LENGTH]; | |
225 | } __packed TWE_Command_ATA; | |
226 | ||
227 | typedef struct | |
228 | { | |
229 | u_int8_t opcode:5; | |
230 | u_int8_t sgl_offset:3; | |
231 | u_int8_t size; | |
232 | u_int8_t request_id; | |
233 | u_int8_t unit:4; | |
234 | u_int8_t host_id:4; | |
235 | u_int8_t status; | |
236 | u_int8_t flags; | |
237 | #define TWE_FLAGS_SUCCESS 0x00 | |
238 | #define TWE_FLAGS_INFORMATIONAL 0x01 | |
239 | #define TWE_FLAGS_WARNING 0x02 | |
240 | #define TWE_FLAGS_FATAL 0x03 | |
241 | #define TWE_FLAGS_PERCENTAGE (1<<8) /* bits 0-6 indicate completion percentage */ | |
242 | u_int16_t count; /* block count, parameter count, message credits */ | |
243 | } __packed TWE_Command_Generic; | |
244 | ||
245 | /* command packet - must be TWE_ALIGNMENT aligned */ | |
246 | typedef union | |
247 | { | |
248 | TWE_Command_INITCONNECTION initconnection; | |
249 | TWE_Command_IO io; | |
250 | TWE_Command_PARAM param; | |
251 | TWE_Command_CHECKSTATUS checkstatus; | |
252 | TWE_Command_REBUILDUNIT rebuildunit; | |
253 | TWE_Command_SETATAFEATURE setatafeature; | |
254 | TWE_Command_ATA ata; | |
255 | TWE_Command_Generic generic; | |
256 | u_int8_t pad[512]; | |
257 | } TWE_Command; | |
258 | ||
259 | /* response queue entry */ | |
260 | typedef union | |
261 | { | |
262 | struct | |
263 | { | |
264 | u_int32_t undefined_1:4; | |
265 | u_int32_t response_id:8; | |
266 | u_int32_t undefined_2:20; | |
267 | } u; | |
268 | u_int32_t value; | |
269 | } TWE_Response_Queue; | |
270 | ||
271 | #endif | |
272 | ||
273 | #ifdef HAVE_SYS_TWEIO_H | |
274 | #include <sys/tweio.h> | |
275 | #else | |
276 | /* | |
277 | * Following cut out of tweio.h | |
278 | * | |
279 | */ | |
280 | /* | |
281 | * User-space command | |
282 | * | |
283 | * Note that the command's scatter/gather list will be computed by the | |
284 | * driver, and cannot be filled in by the consumer. | |
285 | */ | |
286 | struct twe_usercommand { | |
287 | TWE_Command tu_command; /* command ready for the controller */ | |
288 | void *tu_data; /* pointer to data in userspace */ | |
289 | size_t tu_size; /* userspace data length */ | |
290 | }; | |
291 | ||
292 | #define TWEIO_COMMAND _IOWR('T', 100, struct twe_usercommand) | |
293 | ||
294 | #endif | |
295 | ||
296 | #ifdef HAVE_SYS_TW_OSL_IOCTL_H | |
297 | #include <sys/tw_osl_ioctl.h> | |
298 | #else | |
299 | /* | |
300 | * Following cut out of tw_osl_types.h | |
301 | * | |
302 | */ | |
303 | ||
304 | typedef void TW_VOID; | |
305 | typedef char TW_INT8; | |
306 | typedef unsigned char TW_UINT8; | |
307 | typedef short TW_INT16; | |
308 | typedef unsigned short TW_UINT16; | |
309 | typedef int TW_INT32; | |
310 | typedef unsigned int TW_UINT32; | |
311 | typedef long long TW_INT64; | |
312 | typedef unsigned long long TW_UINT64; | |
313 | ||
314 | /* | |
315 | * Following cut out of tw_cl_share.h | |
316 | * | |
317 | */ | |
318 | ||
319 | #pragma pack(1) | |
320 | ||
321 | struct tw_cl_event_packet { | |
322 | TW_UINT32 sequence_id; | |
323 | TW_UINT32 time_stamp_sec; | |
324 | TW_UINT16 aen_code; | |
325 | TW_UINT8 severity; | |
326 | TW_UINT8 retrieved; | |
327 | TW_UINT8 repeat_count; | |
328 | TW_UINT8 parameter_len; | |
329 | TW_UINT8 parameter_data[98]; | |
330 | TW_UINT32 event_src; | |
331 | TW_UINT8 severity_str[20]; | |
332 | }; | |
333 | ||
334 | #pragma pack() | |
335 | ||
336 | /* | |
337 | * Following cut out of tw_cl_fwif.h | |
338 | * | |
339 | */ | |
340 | ||
341 | #define TWA_FW_CMD_ATA_PASSTHROUGH 0x11 | |
342 | ||
343 | #define TWA_SENSE_DATA_LENGTH 18 | |
344 | ||
345 | #pragma pack(1) | |
346 | /* 7000 structures. */ | |
347 | struct tw_cl_command_init_connect { | |
348 | TW_UINT8 res1__opcode; /* 3:5 */ | |
349 | TW_UINT8 size; | |
350 | TW_UINT8 request_id; | |
351 | TW_UINT8 res2; | |
352 | TW_UINT8 status; | |
353 | TW_UINT8 flags; | |
354 | TW_UINT16 message_credits; | |
355 | TW_UINT32 features; | |
356 | TW_UINT16 fw_srl; | |
357 | TW_UINT16 fw_arch_id; | |
358 | TW_UINT16 fw_branch; | |
359 | TW_UINT16 fw_build; | |
360 | TW_UINT32 result; | |
361 | }; | |
362 | ||
363 | ||
364 | /* Structure for downloading firmware onto the controller. */ | |
365 | struct tw_cl_command_download_firmware { | |
366 | TW_UINT8 sgl_off__opcode;/* 3:5 */ | |
367 | TW_UINT8 size; | |
368 | TW_UINT8 request_id; | |
369 | TW_UINT8 unit; | |
370 | TW_UINT8 status; | |
371 | TW_UINT8 flags; | |
372 | TW_UINT16 param; | |
373 | TW_UINT8 sgl[1]; | |
374 | }; | |
375 | ||
376 | ||
377 | /* Structure for hard resetting the controller. */ | |
378 | struct tw_cl_command_reset_firmware { | |
379 | TW_UINT8 res1__opcode; /* 3:5 */ | |
380 | TW_UINT8 size; | |
381 | TW_UINT8 request_id; | |
382 | TW_UINT8 unit; | |
383 | TW_UINT8 status; | |
384 | TW_UINT8 flags; | |
385 | TW_UINT8 res2; | |
386 | TW_UINT8 param; | |
387 | }; | |
388 | ||
389 | ||
390 | /* Structure for sending get/set param commands. */ | |
391 | struct tw_cl_command_param { | |
392 | TW_UINT8 sgl_off__opcode;/* 3:5 */ | |
393 | TW_UINT8 size; | |
394 | TW_UINT8 request_id; | |
395 | TW_UINT8 host_id__unit; /* 4:4 */ | |
396 | TW_UINT8 status; | |
397 | TW_UINT8 flags; | |
398 | TW_UINT16 param_count; | |
399 | TW_UINT8 sgl[1]; | |
400 | }; | |
401 | ||
402 | ||
403 | /* Generic command packet. */ | |
404 | struct tw_cl_command_generic { | |
405 | TW_UINT8 sgl_off__opcode;/* 3:5 */ | |
406 | TW_UINT8 size; | |
407 | TW_UINT8 request_id; | |
408 | TW_UINT8 host_id__unit; /* 4:4 */ | |
409 | TW_UINT8 status; | |
410 | TW_UINT8 flags; | |
411 | TW_UINT16 count; /* block cnt, parameter cnt, message credits */ | |
412 | }; | |
413 | ||
414 | ||
415 | /* Command packet header. */ | |
416 | struct tw_cl_command_header { | |
417 | TW_UINT8 sense_data[TWA_SENSE_DATA_LENGTH]; | |
418 | struct { | |
419 | TW_INT8 reserved[4]; | |
420 | TW_UINT16 error; | |
421 | TW_UINT8 padding; | |
422 | TW_UINT8 res__severity; /* 5:3 */ | |
423 | } status_block; | |
424 | TW_UINT8 err_specific_desc[98]; | |
425 | struct { | |
426 | TW_UINT8 size_header; | |
427 | TW_UINT16 reserved; | |
428 | TW_UINT8 size_sense; | |
429 | } header_desc; | |
430 | }; | |
431 | ||
432 | ||
433 | /* 7000 Command packet. */ | |
434 | union tw_cl_command_7k { | |
435 | struct tw_cl_command_init_connect init_connect; | |
436 | struct tw_cl_command_download_firmware download_fw; | |
437 | struct tw_cl_command_reset_firmware reset_fw; | |
438 | struct tw_cl_command_param param; | |
439 | struct tw_cl_command_generic generic; | |
440 | TW_UINT8 padding[1024 - sizeof(struct tw_cl_command_header)]; | |
441 | }; | |
442 | ||
443 | ||
444 | /* 9000 Command Packet. */ | |
445 | struct tw_cl_command_9k { | |
446 | TW_UINT8 res__opcode; /* 3:5 */ | |
447 | TW_UINT8 unit; | |
448 | TW_UINT16 lun_l4__req_id; /* 4:12 */ | |
449 | TW_UINT8 status; | |
450 | TW_UINT8 sgl_offset; /* offset (in bytes) to sg_list, from the | |
451 | end of sgl_entries */ | |
452 | TW_UINT16 lun_h4__sgl_entries; | |
453 | TW_UINT8 cdb[16]; | |
454 | TW_UINT8 sg_list[872];/* total struct size = | |
455 | 1024-sizeof(cmd_hdr) */ | |
456 | }; | |
457 | ||
458 | ||
459 | /* Full command packet. */ | |
460 | struct tw_cl_command_packet { | |
461 | struct tw_cl_command_header cmd_hdr; | |
462 | union { | |
463 | union tw_cl_command_7k cmd_pkt_7k; | |
464 | struct tw_cl_command_9k cmd_pkt_9k; | |
465 | } command; | |
466 | }; | |
467 | ||
468 | #pragma pack() | |
469 | ||
470 | /* | |
471 | * Following cut out of tw_cl_ioctl.h | |
472 | * | |
473 | */ | |
474 | ||
475 | #pragma pack(1) | |
476 | ||
477 | /* Structure used to handle GET/RELEASE LOCK ioctls. */ | |
478 | struct tw_cl_lock_packet { | |
479 | TW_UINT32 timeout_msec; | |
480 | TW_UINT32 time_remaining_msec; | |
481 | TW_UINT32 force_flag; | |
482 | }; | |
483 | ||
484 | ||
485 | /* Structure used to handle GET COMPATIBILITY INFO ioctl. */ | |
486 | struct tw_cl_compatibility_packet { | |
487 | TW_UINT8 driver_version[32];/* driver version */ | |
488 | TW_UINT16 working_srl; /* driver & firmware negotiated srl */ | |
489 | TW_UINT16 working_branch; /* branch # of the firmware that the | |
490 | driver is compatible with */ | |
491 | TW_UINT16 working_build; /* build # of the firmware that the | |
492 | driver is compatible with */ | |
493 | }; | |
494 | ||
495 | ||
496 | /* Driver understandable part of the ioctl packet built by the API. */ | |
497 | struct tw_cl_driver_packet { | |
498 | TW_UINT32 control_code; | |
499 | TW_UINT32 status; | |
500 | TW_UINT32 unique_id; | |
501 | TW_UINT32 sequence_id; | |
502 | TW_UINT32 os_status; | |
503 | TW_UINT32 buffer_length; | |
504 | }; | |
505 | ||
506 | #pragma pack() | |
507 | ||
508 | /* | |
509 | * Following cut out of tw_osl_ioctl.h | |
510 | * | |
511 | */ | |
512 | ||
513 | #pragma pack(1) | |
514 | /* | |
515 | * We need the structure below to ensure that the first byte of | |
516 | * data_buf is not overwritten by the kernel, after we return | |
517 | * from the ioctl call. Note that cmd_pkt has been reduced | |
518 | * to an array of 1024 bytes even though it's actually 2048 bytes | |
519 | * in size. This is because, we don't expect requests from user | |
520 | * land requiring 2048 (273 sg elements) byte cmd pkts. | |
521 | */ | |
522 | typedef struct tw_osli_ioctl_no_data_buf { | |
523 | struct tw_cl_driver_packet driver_pkt; | |
524 | TW_VOID *pdata; /* points to data_buf */ | |
525 | TW_INT8 padding[488 - sizeof(TW_VOID *)]; | |
526 | struct tw_cl_command_packet cmd_pkt; | |
527 | } TW_OSLI_IOCTL_NO_DATA_BUF; | |
528 | ||
529 | #pragma pack() | |
530 | ||
531 | #define TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH \ | |
532 | _IOWR('T', 202, TW_OSLI_IOCTL_NO_DATA_BUF) | |
533 | ||
534 | #pragma pack(1) | |
535 | ||
536 | typedef struct tw_osli_ioctl_with_payload { | |
537 | struct tw_cl_driver_packet driver_pkt; | |
538 | TW_INT8 padding[488]; | |
539 | struct tw_cl_command_packet cmd_pkt; | |
540 | union { | |
541 | struct tw_cl_event_packet event_pkt; | |
542 | struct tw_cl_lock_packet lock_pkt; | |
543 | struct tw_cl_compatibility_packet compat_pkt; | |
544 | TW_INT8 data_buf[1]; | |
545 | } payload; | |
546 | } TW_OSLI_IOCTL_WITH_PAYLOAD; | |
547 | ||
548 | #pragma pack() | |
549 | ||
550 | #endif | |
551 | ||
2127e193 GI |
552 | #define HPT_CTL_CODE(x) (x+0xFF00) |
553 | #define HPT_IOCTL_GET_CHANNEL_INFO HPT_CTL_CODE(3) | |
554 | #define HPT_IOCTL_GET_CHANNEL_INFO_V2 HPT_CTL_CODE(53) | |
555 | #define HPT_IOCTL_IDE_PASS_THROUGH HPT_CTL_CODE(24) | |
556 | ||
557 | #define HPT_READ 1 | |
558 | #define HPT_WRITE 2 | |
559 | ||
560 | #define HPT_IOCTL_MAGIC 0xA1B2C3D4 | |
561 | ||
562 | #define MAXDEV_PER_CHANNEL 2 | |
563 | #define PMPORT_PER_CHANNEL 15 /* max devices connected to this channel via pmport */ | |
564 | ||
54965743 | 565 | #pragma pack(1) |
2127e193 GI |
566 | typedef struct _HPT_CHANNEL_INFO { |
567 | unsigned int reserve1; | |
568 | unsigned int reserve2; | |
569 | unsigned int devices[MAXDEV_PER_CHANNEL]; | |
570 | } HPT_CHANNEL_INFO, *PHPT_CHANNEL_INFO; | |
571 | ||
572 | typedef struct _HPT_CHANNEL_INFO_V2 { | |
573 | unsigned int reserve1; | |
574 | unsigned int reserve2; | |
575 | unsigned int devices[PMPORT_PER_CHANNEL]; | |
576 | } HPT_CHANNEL_INFO_V2, *PHPT_CHANNEL_INFO_V2; | |
577 | ||
578 | typedef struct _HPT_IOCTL_PARAM { | |
579 | unsigned int magic; /* used to check if it's a valid ioctl packet */ | |
580 | unsigned int ctrl_code; /* operation control code */ | |
581 | void* in; /* input data buffer */ | |
582 | unsigned int in_size; /* size of input data buffer */ | |
583 | void* out; /* output data buffer */ | |
584 | unsigned int out_size; /* size of output data buffer */ | |
585 | void* returned_size; /* count of chars returned */ | |
586 | } HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM; | |
587 | #define HPT_DO_IOCONTROL _IOW('H', 0, HPT_IOCTL_PARAM) | |
588 | ||
589 | typedef struct _HPT_PASS_THROUGH_HEADER { | |
590 | unsigned int id; /* disk ID */ | |
591 | unsigned char feature; | |
592 | unsigned char sectorcount; | |
593 | unsigned char lbalow; | |
594 | unsigned char lbamid; | |
595 | unsigned char lbahigh; | |
596 | unsigned char driverhead; | |
597 | unsigned char command; | |
598 | unsigned char sectors; /* data size in sectors, if the command has data transfer */ | |
599 | unsigned char protocol; /* HPT_(READ,WRITE) or zero for non-DATA */ | |
600 | unsigned char reserve[3]; | |
601 | } | |
602 | HPT_PASS_THROUGH_HEADER, *PHPT_PASS_THROUGH_HEADER; | |
54965743 | 603 | #pragma pack() |
832b75ed GG |
604 | |
605 | #ifndef __unused | |
606 | #define __unused __attribute__ ((__unused__)) | |
607 | #endif | |
608 | ||
609 | #endif /* OS_FREEBSD_H_ */ |