xref: /freebsd/sys/dev/hptrr/him.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1718cf2ccSPedro F. Giffuni /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4b063a422SScott Long  * Copyright (c) HighPoint Technologies, Inc.
5b063a422SScott Long  * All rights reserved.
6b063a422SScott Long  *
7b063a422SScott Long  * Redistribution and use in source and binary forms, with or without
8b063a422SScott Long  * modification, are permitted provided that the following conditions
9b063a422SScott Long  * are met:
10b063a422SScott Long  * 1. Redistributions of source code must retain the above copyright
11b063a422SScott Long  *    notice, this list of conditions and the following disclaimer.
12b063a422SScott Long  * 2. Redistributions in binary form must reproduce the above copyright
13b063a422SScott Long  *    notice, this list of conditions and the following disclaimer in the
14b063a422SScott Long  *    documentation and/or other materials provided with the distribution.
15b063a422SScott Long  *
16b063a422SScott Long  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17b063a422SScott Long  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18b063a422SScott Long  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19b063a422SScott Long  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20b063a422SScott Long  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21b063a422SScott Long  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22b063a422SScott Long  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23b063a422SScott Long  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24b063a422SScott Long  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25b063a422SScott Long  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26b063a422SScott Long  * SUCH DAMAGE.
27b063a422SScott Long  */
28b063a422SScott Long #include <dev/hptrr/hptrr_config.h>
29b063a422SScott Long /*
304fdb276aSScott Long  * $Id: him.h,v 1.47 2007/12/17 08:55:49 gmm Exp $
31b063a422SScott Long  * Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
32b063a422SScott Long  */
33b063a422SScott Long #ifndef _HPT_HIM_H_
34b063a422SScott Long #define _HPT_HIM_H_
35b063a422SScott Long 
364fdb276aSScott Long #define VERMAGIC_HIM 46
37b063a422SScott Long 
38b063a422SScott Long #if defined(__cplusplus)
39b063a422SScott Long extern "C" {
40b063a422SScott Long #endif
41b063a422SScott Long 
42b063a422SScott Long #include <dev/hptrr/list.h>
43b063a422SScott Long 
44b063a422SScott Long #define SECTOR_TO_BYTE_SHIFT 9
45b063a422SScott Long #define SECTOR_TO_BYTE(x)       ((HPT_U32)(x) << SECTOR_TO_BYTE_SHIFT)
46b063a422SScott Long #define BYTE_TO_SECTOR(x)       ((x)>>SECTOR_TO_BYTE_SHIFT)
47b063a422SScott Long 
48b063a422SScott Long typedef struct _PCI_ID
49b063a422SScott Long {
50b063a422SScott Long 	HPT_U16 vid;
51b063a422SScott Long 	HPT_U16 did;
52b063a422SScott Long 	HPT_U32 subsys;
53b063a422SScott Long 	HPT_U8  rev;
54b063a422SScott Long 	HPT_U8  nbase;
55b063a422SScott Long 	HPT_U16 reserve;
56b063a422SScott Long }
57b063a422SScott Long PCI_ID;
58b063a422SScott Long 
59b063a422SScott Long typedef struct _PCI_ADDRESS
60b063a422SScott Long {
61b063a422SScott Long 	HPT_U8 tree;
62b063a422SScott Long 	HPT_U8 bus;
63b063a422SScott Long 	HPT_U8 device;
64b063a422SScott Long 	HPT_U8 function;
65b063a422SScott Long }
66b063a422SScott Long PCI_ADDRESS;
67b063a422SScott Long 
68b063a422SScott Long typedef struct _HIM_ADAPTER_CONFIG
69b063a422SScott Long {
70b063a422SScott Long 	PCI_ADDRESS pci_addr;
71b063a422SScott Long 	PCI_ID  pci_id;
72b063a422SScott Long 
73b063a422SScott Long 	HPT_U8  max_devices;
74b063a422SScott Long 	HPT_U8  reserve1;
75b063a422SScott Long 
76b063a422SScott Long 	HPT_U8  bDevsPerBus;
77b063a422SScott Long 	HPT_U8  first_on_slot;
78b063a422SScott Long 
79b063a422SScott Long 	HPT_U8  bChipType;
80b063a422SScott Long 	HPT_U8  bChipIntrNum;
81b063a422SScott Long 	HPT_U8  bChipFlags;
82b063a422SScott Long 	HPT_U8  bNumBuses;
83b063a422SScott Long 
84b063a422SScott Long 	HPT_U8  szVendorID[36];
85b063a422SScott Long 	HPT_U8  szProductID[36];
86b063a422SScott Long }
87b063a422SScott Long HIM_ADAPTER_CONFIG, *PHIM_ADAPTER_CONFIG;
88b063a422SScott Long 
89b063a422SScott Long typedef struct _HIM_CHANNEL_CONFIG
90b063a422SScott Long {
91b063a422SScott Long 	HPT_U32 io_port;
92b063a422SScott Long 	HPT_U32 ctl_port;
93b063a422SScott Long } HIM_CHANNEL_CONFIG, *PHIM_CHANNEL_CONFIG;
94b063a422SScott Long 
95b063a422SScott Long typedef struct _HIM_DEVICE_FLAGS
96b063a422SScott Long {
974fdb276aSScott Long 	HPT_UINT df_atapi               :1;
984fdb276aSScott Long 	HPT_UINT df_removable_drive     :1;
994fdb276aSScott Long 	HPT_UINT df_on_line             :1;
1004fdb276aSScott Long 	HPT_UINT df_reduce_mode         :1;
1014fdb276aSScott Long 	HPT_UINT df_sata                :1;
1024fdb276aSScott Long 	HPT_UINT df_on_pm_port          :1;
1034fdb276aSScott Long 	HPT_UINT df_support_read_ahead  :1;
1044fdb276aSScott Long 	HPT_UINT df_read_ahead_enabled  :1;
1054fdb276aSScott Long 	HPT_UINT df_support_write_cache :1;
1064fdb276aSScott Long 	HPT_UINT df_write_cache_enabled :1;
1074fdb276aSScott Long 	HPT_UINT df_cdrom_device        :1;
1084fdb276aSScott Long 	HPT_UINT df_tape_device         :1;
1094fdb276aSScott Long 	HPT_UINT df_support_tcq         :1;
1104fdb276aSScott Long 	HPT_UINT df_tcq_enabled         :1;
1114fdb276aSScott Long 	HPT_UINT df_support_ncq         :1;
1124fdb276aSScott Long 	HPT_UINT df_ncq_enabled         :1;
1134fdb276aSScott Long 	HPT_UINT df_sas                 :1;
114b063a422SScott Long } DEVICE_FLAGS, *PDEVICE_FLAGS;
115b063a422SScott Long 
116b063a422SScott Long #pragma pack(1)
117b063a422SScott Long typedef struct _IDENTIFY_DATA2 {
118b063a422SScott Long 	HPT_U16 GeneralConfiguration;
119b063a422SScott Long 	HPT_U16 NumberOfCylinders;
120b063a422SScott Long 	HPT_U16 Reserved1;
121b063a422SScott Long 	HPT_U16 NumberOfHeads;
122b063a422SScott Long 	HPT_U16 UnformattedBytesPerTrack;
123b063a422SScott Long 	HPT_U16 UnformattedBytesPerSector;
124b063a422SScott Long 	HPT_U16 SectorsPerTrack;
125b063a422SScott Long 	HPT_U16 VendorUnique1[3];
126b063a422SScott Long 	HPT_U16 SerialNumber[10];
127b063a422SScott Long 	HPT_U16 BufferType;
128b063a422SScott Long 	HPT_U16 BufferSectorSize;
129b063a422SScott Long 	HPT_U16 NumberOfEccBytes;
130b063a422SScott Long 	HPT_U16 FirmwareRevision[4];
131b063a422SScott Long 	HPT_U16 ModelNumber[20];
132b063a422SScott Long 	HPT_U8  MaximumBlockTransfer;
133b063a422SScott Long 	HPT_U8  VendorUnique2;
134b063a422SScott Long 	HPT_U16 DoubleWordIo;
135b063a422SScott Long 	HPT_U16 Capabilities;
136b063a422SScott Long 	HPT_U16 Reserved2;
137b063a422SScott Long 	HPT_U8  VendorUnique3;
138b063a422SScott Long 	HPT_U8  PioCycleTimingMode;
139b063a422SScott Long 	HPT_U8  VendorUnique4;
140b063a422SScott Long 	HPT_U8  DmaCycleTimingMode;
141b063a422SScott Long 	HPT_U16 TranslationFieldsValid;
142b063a422SScott Long 	HPT_U16 NumberOfCurrentCylinders;
143b063a422SScott Long 	HPT_U16 NumberOfCurrentHeads;
144b063a422SScott Long 	HPT_U16 CurrentSectorsPerTrack;
145b063a422SScott Long 	HPT_U32 CurrentSectorCapacity;
146b063a422SScott Long 	HPT_U16 CurrentMultiSectorSetting;
147b063a422SScott Long 	HPT_U32 UserAddressableSectors;
148b063a422SScott Long 	HPT_U8  SingleWordDMASupport;
149b063a422SScott Long 	HPT_U8  SingleWordDMAActive;
150b063a422SScott Long 	HPT_U8  MultiWordDMASupport;
151b063a422SScott Long 	HPT_U8  MultiWordDMAActive;
152b063a422SScott Long 	HPT_U8  AdvancedPIOModes;
153b063a422SScott Long 	HPT_U8  Reserved4;
154b063a422SScott Long 	HPT_U16 MinimumMWXferCycleTime;
155b063a422SScott Long 	HPT_U16 RecommendedMWXferCycleTime;
156b063a422SScott Long 	HPT_U16 MinimumPIOCycleTime;
157b063a422SScott Long 	HPT_U16 MinimumPIOCycleTimeIORDY;
158b063a422SScott Long 	HPT_U16 Reserved5[2];
159b063a422SScott Long 	HPT_U16 ReleaseTimeOverlapped;
160b063a422SScott Long 	HPT_U16 ReleaseTimeServiceCommand;
161b063a422SScott Long 	HPT_U16 MajorRevision;
162b063a422SScott Long 	HPT_U16 MinorRevision;
163b063a422SScott Long }
164b063a422SScott Long #ifdef __GNUC__
165b063a422SScott Long __attribute__((packed))
166b063a422SScott Long #endif
167b063a422SScott Long IDENTIFY_DATA2, *PIDENTIFY_DATA2;
168b063a422SScott Long #pragma pack()
169b063a422SScott Long 
170b063a422SScott Long typedef struct _HIM_DEVICE_CONFIG
171b063a422SScott Long {
172b063a422SScott Long 	HPT_U64 capacity;
173b063a422SScott Long 
174b063a422SScott Long 	DEVICE_FLAGS flags;
175b063a422SScott Long 
176b063a422SScott Long 	HPT_U8  path_id;
177b063a422SScott Long 	HPT_U8  target_id;
178b063a422SScott Long 	HPT_U8  max_queue_depth;
179b063a422SScott Long 	HPT_U8  spin_up_mode;
180b063a422SScott Long 
181b063a422SScott Long 	HPT_U8  reserved;
182b063a422SScott Long 	HPT_U8  transfer_mode;
183b063a422SScott Long 	HPT_U8  bMaxShowMode;
184b063a422SScott Long 	HPT_U8  bDeUsable_Mode;
185b063a422SScott Long 
186b063a422SScott Long 	HPT_U16 max_sectors_per_cmd;
187b063a422SScott Long 
188b063a422SScott Long 	PIDENTIFY_DATA2 pIdentifyData;
189b063a422SScott Long 
190b063a422SScott Long }
191b063a422SScott Long HIM_DEVICE_CONFIG, *PHIM_DEVICE_CONFIG;
192b063a422SScott Long 
193b063a422SScott Long 
194b063a422SScott Long #define _DIT_MODE               0
195b063a422SScott Long #define _DIT_601                1
196b063a422SScott Long #define _DIT_READ_AHEAD         2
197b063a422SScott Long #define _DIT_WRITE_CACHE        3
198b063a422SScott Long #define _DIT_TCQ                4
199b063a422SScott Long #define _DIT_NCQ                5
200b063a422SScott Long #define _DIT_BEEP_OFF           6
201b063a422SScott Long #define _DIT_SPIN_UP_MODE       7
2024fdb276aSScott Long #define _DIT_IDLE_STANDBY       8
2034fdb276aSScott Long #define _DIT_IDENTIFY           9
204b063a422SScott Long 
205b063a422SScott Long #define SPIN_UP_MODE_NOSUPPORT 0
206b063a422SScott Long #define SPIN_UP_MODE_FULL      1
207b063a422SScott Long #define SPIN_UP_MODE_STANDBY   2
208b063a422SScott Long 
209b063a422SScott Long struct tcq_control {
210b063a422SScott Long 	HPT_U8 enable;
211b063a422SScott Long 	HPT_U8 depth;
212b063a422SScott Long };
213b063a422SScott Long 
214b063a422SScott Long struct ncq_control {
215b063a422SScott Long 	HPT_U8 enable;
216b063a422SScott Long 	HPT_U8 depth;
217b063a422SScott Long };
218b063a422SScott Long 
219b063a422SScott Long typedef struct _HIM_ALTERABLE_DEV_INFO{
220b063a422SScott Long 	HPT_U8 type;
221b063a422SScott Long 	union {
222b063a422SScott Long 		HPT_U8 mode;
223b063a422SScott Long 		HPT_U8 enable_read_ahead;
224b063a422SScott Long 		HPT_U8 enable_read_cache;
225b063a422SScott Long 		HPT_U8 enable_write_cache;
226b063a422SScott Long 		struct tcq_control tcq;
227b063a422SScott Long 		struct ncq_control ncq;
228b063a422SScott Long 		void * adapter;
229b063a422SScott Long 		HPT_U8 spin_up_mode;
2304fdb276aSScott Long 		HPT_U8 idle_standby_timeout;
2314fdb276aSScott Long 		HPT_U8 identify_indicator;
232b063a422SScott Long 	}u;
233b063a422SScott Long } HIM_ALTERABLE_DEV_INFO, *PHIM_ALTERABLE_DEV_INFO;
234b063a422SScott Long 
235b063a422SScott Long struct _COMMAND;
236b063a422SScott Long struct _IOCTL_ARG;
237b063a422SScott Long 
238b063a422SScott Long typedef void (*PROBE_CALLBACK)(void *arg, void *dev, int index);
239b063a422SScott Long 
240b063a422SScott Long typedef struct _HIM {
241b063a422SScott Long 	char *name;
242b063a422SScott Long 	struct _HIM *next;
243b063a422SScott Long 	HPT_UINT max_sg_descriptors;
244b063a422SScott Long 	#define _HIM_INTERFACE(_type, _fn, _args) _type (* _fn) _args;
245b063a422SScott Long 	#include <dev/hptrr/himfuncs.h>
246b063a422SScott Long }
247b063a422SScott Long HIM, *PHIM;
248b063a422SScott Long 
249b063a422SScott Long 
250b063a422SScott Long #pragma pack(1)
251b063a422SScott Long #ifdef SG_FLAG_EOT
252b063a422SScott Long #error "don't use SG_FLAG_EOT with _SG.eot. clean the code!"
253b063a422SScott Long #endif
254b063a422SScott Long 
255b063a422SScott Long typedef struct _SG {
256b063a422SScott Long 	HPT_U32 size;
257b063a422SScott Long 	HPT_UINT eot;
258b063a422SScott Long 	union {
259b063a422SScott Long 		HPT_U8 FAR * _logical;
260b063a422SScott Long 		BUS_ADDRESS bus;
261b063a422SScott Long 	}
262b063a422SScott Long 	addr;
263b063a422SScott Long }
264b063a422SScott Long SG, *PSG;
265b063a422SScott Long #pragma pack()
266b063a422SScott Long 
267b063a422SScott Long typedef struct _AtaCommand
268b063a422SScott Long {
269b063a422SScott Long     HPT_U64     Lba;
270b063a422SScott Long     HPT_U16     nSectors;
271b063a422SScott Long     HPT_U16     pad;
272b063a422SScott Long } AtaComm, *PAtaComm;
273b063a422SScott Long 
274b063a422SScott Long #define ATA_CMD_SET_FEATURES    0xef
275b063a422SScott Long #define ATA_CMD_FLUSH           0xE7
276b063a422SScott Long #define ATA_CMD_VERIFY          0x40
277b063a422SScott Long #define ATA_CMD_STANDBY         0xe2
278b063a422SScott Long #define ATA_CMD_READ_MULTI      0xC4
279b063a422SScott Long #define ATA_CMD_READ_MULTI_EXT  0x29
280b063a422SScott Long #define ATA_CMD_WRITE_MULTI     0xC5
281b063a422SScott Long #define ATA_CMD_WRITE_MULTI_EXT 0x39
282b063a422SScott Long #define ATA_CMD_WRITE_MULTI_FUA_EXT     0xCE
283b063a422SScott Long 
284b063a422SScott Long #define ATA_SET_FEATURES_XFER 0x3
285b063a422SScott Long #define ATA_SECTOR_SIZE 512
286b063a422SScott Long 
287b063a422SScott Long typedef struct _PassthroughCmd {
288b063a422SScott Long 	HPT_U16    bFeaturesReg;
289b063a422SScott Long 	HPT_U16    bSectorCountReg;
290b063a422SScott Long 	HPT_U16    bLbaLowReg;
291b063a422SScott Long 	HPT_U16    bLbaMidReg;
292b063a422SScott Long 	HPT_U16    bLbaHighReg;
293b063a422SScott Long 	HPT_U8     bDriveHeadReg;
294b063a422SScott Long 	HPT_U8     bCommandReg;
295b063a422SScott Long 	HPT_U8     nSectors;
296b063a422SScott Long 	HPT_U8    *pDataBuffer;
297b063a422SScott Long }
298b063a422SScott Long PassthroughCmd;
299b063a422SScott Long 
3004fdb276aSScott Long typedef struct _ScsiComm {
3014fdb276aSScott Long 	HPT_U8  cdbLength;
3024fdb276aSScott Long 	HPT_U8  senseLength;
3034fdb276aSScott Long 	HPT_U8  scsiStatus;
3044fdb276aSScott Long 	HPT_U8  reserve1;
3054fdb276aSScott Long 	HPT_U32 dataLength;
3064fdb276aSScott Long 	HPT_U8 *cdb;
3074fdb276aSScott Long 	HPT_U8 *senseBuffer;
3084fdb276aSScott Long }
3094fdb276aSScott Long ScsiComm;
3104fdb276aSScott Long 
311b063a422SScott Long 
312b063a422SScott Long #define CTRL_CMD_REBUILD 1
313b063a422SScott Long #define CTRL_CMD_VERIFY  2
314b063a422SScott Long #define CTRL_CMD_INIT    3
315b063a422SScott Long 
316b063a422SScott Long 
317b063a422SScott Long typedef struct _R5ControlCmd {
318b063a422SScott Long 	HPT_U64  StripeLine;
319b063a422SScott Long 	HPT_U16 Offset;
320b063a422SScott Long 	HPT_U8  Command;
321b063a422SScott Long 	HPT_U8  reserve1;
322b063a422SScott Long }
323b063a422SScott Long R5ControlCmd, *PR5ControlCmd;
324b063a422SScott Long 
325b063a422SScott Long typedef struct _HPT_ADDRESS
326b063a422SScott Long {
327b063a422SScott Long 	HPT_U8 * logical;
328b063a422SScott Long 	BUS_ADDRESS bus;
329b063a422SScott Long }
330b063a422SScott Long HPT_ADDRESS;
331b063a422SScott Long 
332b063a422SScott Long 
333b063a422SScott Long typedef struct ctl_pages {
334b063a422SScott Long 	HPT_ADDRESS *pages;
335b063a422SScott Long 	HPT_UINT        page_size;
336b063a422SScott Long 	HPT_UINT        npages;
337b063a422SScott Long 	HPT_UINT min_sg_descriptors;
338b063a422SScott Long } CONTROL_PAGES, *PCONTROL_PAGES;
339b063a422SScott Long 
340b063a422SScott Long typedef struct _R1ControlCmd {
341b063a422SScott Long 	HPT_U64  Lba;
342b063a422SScott Long 	HPT_U16 nSectors;
343b063a422SScott Long 	HPT_U8  Command;      /* CTRL_CMD_XXX */
344b063a422SScott Long 	HPT_U8  reserve1;
345b063a422SScott Long 	PCONTROL_PAGES ctl_pages;
346b063a422SScott Long }
347b063a422SScott Long R1ControlCmd, *PR1ControlCmd;
348b063a422SScott Long 
349b063a422SScott Long typedef void (*TQ_PROC)(void *arg);
350b063a422SScott Long 
351b063a422SScott Long struct tq_item {
352b063a422SScott Long 	TQ_PROC proc;
353b063a422SScott Long 	void *arg;
354b063a422SScott Long 	struct tq_item *next;
355b063a422SScott Long };
356b063a422SScott Long 
357b063a422SScott Long #define INIT_TQ_ITEM(t, p, a) \
358b063a422SScott Long 	do { (t)->proc = p; (t)->arg = a; (t)->next = 0; } while (0)
359b063a422SScott Long 
360b063a422SScott Long typedef struct _COMMAND
361b063a422SScott Long {
362b063a422SScott Long 
363b063a422SScott Long 	struct _VBUS * vbus;
364b063a422SScott Long 
365b063a422SScott Long 	struct freelist *grplist;
366b063a422SScott Long 	HPT_UINT grpcnt;
367b063a422SScott Long 
368b063a422SScott Long 
369b063a422SScott Long 	struct list_head q_link;
370b063a422SScott Long 	struct tq_item done_dpc;
371b063a422SScott Long 
372b063a422SScott Long 	HPT_UINT extsize;
373b063a422SScott Long 	void *ext;
374b063a422SScott Long 
375b063a422SScott Long 
376b063a422SScott Long 
377b063a422SScott Long 	void *target;
378b063a422SScott Long 	void *priv;
379b063a422SScott Long 	HPT_UPTR priv2;
380b063a422SScott Long 
381b063a422SScott Long 	int priority;
382b063a422SScott Long 	struct lock_request *owned_lock;
383b063a422SScott Long 	struct lock_request *lock_req;
3844fdb276aSScott Long 	void (*dtor)(struct _COMMAND *, void *);
3854fdb276aSScott Long 	void *dtor_arg;
386b063a422SScott Long 
387b063a422SScott Long 	union{
388b063a422SScott Long 		AtaComm Ide;
389b063a422SScott Long 		PassthroughCmd Passthrough;
3904fdb276aSScott Long 		ScsiComm Scsi;
391b063a422SScott Long 		R5ControlCmd R5Control;
392b063a422SScott Long 		R1ControlCmd R1Control;
393b063a422SScott Long 	} uCmd;
394b063a422SScott Long 
395b063a422SScott Long 	HPT_U8 type; /* CMD_TYPE_* */
396b063a422SScott Long 
397b063a422SScott Long 	struct {
398b063a422SScott Long 		HPT_U8  physical_sg: 1;
399b063a422SScott Long 		HPT_U8  data_in: 1;
400b063a422SScott Long 		HPT_U8  data_out: 1;
401b063a422SScott Long 		HPT_U8  transform : 1;
402b063a422SScott Long 		HPT_U8  hard_flush: 2;
403b063a422SScott Long 		HPT_U8  from_cc: 1;
4044fdb276aSScott Long 		HPT_U8  force_cc: 1;
405b063a422SScott Long 	} flags;
406b063a422SScott Long 
407b063a422SScott Long 	/* return status */
408b063a422SScott Long 	HPT_U8  Result;
409b063a422SScott Long 	/* retry count */
410b063a422SScott Long 	HPT_U8  RetryCount;
411b063a422SScott Long 
412b063a422SScott Long 
413b063a422SScott Long 	PSG psg;
414b063a422SScott Long 
415b063a422SScott Long 
416b063a422SScott Long 	int  (*buildsgl)(struct _COMMAND *cmd, PSG psg, int logical);
417b063a422SScott Long 	void (*done)(struct _COMMAND *cmd);
418b063a422SScott Long }
419b063a422SScott Long COMMAND, *PCOMMAND;
420b063a422SScott Long 
421b063a422SScott Long /* command types */
422b063a422SScott Long #define   CMD_TYPE_IO           0
423b063a422SScott Long #define   CMD_TYPE_CONTROL      1
424b063a422SScott Long #define   CMD_TYPE_ATAPI        2
4254fdb276aSScott Long #define   CMD_TYPE_SCSI         CMD_TYPE_ATAPI
426b063a422SScott Long #define   CMD_TYPE_PASSTHROUGH  3
427b063a422SScott Long #define   CMD_TYPE_FLUSH                4
428b063a422SScott Long 
429b063a422SScott Long /* flush command flags */
430b063a422SScott Long #define   CF_HARD_FLUSH_CACHE   1
431b063a422SScott Long #define   CF_HARD_FLUSH_STANDBY 2
432b063a422SScott Long 
433b063a422SScott Long /* command return values */
434b063a422SScott Long #define   RETURN_PENDING             0
435b063a422SScott Long #define   RETURN_SUCCESS             1
436b063a422SScott Long #define   RETURN_BAD_DEVICE          2
437b063a422SScott Long #define   RETURN_BAD_PARAMETER       3
438b063a422SScott Long #define   RETURN_WRITE_NO_DRQ        4
439b063a422SScott Long #define   RETURN_DEVICE_BUSY         5
440b063a422SScott Long #define   RETURN_INVALID_REQUEST     6
441b063a422SScott Long #define   RETURN_SELECTION_TIMEOUT   7
442b063a422SScott Long #define   RETURN_IDE_ERROR           8
443b063a422SScott Long #define   RETURN_NEED_LOGICAL_SG     9
444b063a422SScott Long #define   RETURN_NEED_PHYSICAL_SG    10
445b063a422SScott Long #define   RETURN_RETRY               11
446b063a422SScott Long #define   RETURN_DATA_ERROR          12
447b063a422SScott Long #define   RETURN_BUS_RESET           13
448b063a422SScott Long #define   RETURN_BAD_TRANSFER_LENGTH 14
449b063a422SScott Long #define   RETURN_INSUFFICIENT_MEMORY 15
450b063a422SScott Long #define   RETURN_SECTOR_ERROR        16
451b063a422SScott Long 
452b063a422SScott Long #if defined(__cplusplus)
453b063a422SScott Long }
454b063a422SScott Long #endif
455b063a422SScott Long #endif
456