File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / smartmontools / os_freebsd.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:17:35 2013 UTC (10 years, 11 months ago) by misho
Branches: smartmontools, elwix, MAIN
CVS tags: v6_2, v6_1p0, v6_1, HEAD
6.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>