181966bceSXin LI /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 481966bceSXin LI * Copyright (c) 2011 HighPoint Technologies, Inc. 581966bceSXin LI * All rights reserved. 681966bceSXin LI * 781966bceSXin LI * Redistribution and use in source and binary forms, with or without 881966bceSXin LI * modification, are permitted provided that the following conditions 981966bceSXin LI * are met: 1081966bceSXin LI * 1. Redistributions of source code must retain the above copyright 1181966bceSXin LI * notice, this list of conditions and the following disclaimer. 1281966bceSXin LI * 2. Redistributions in binary form must reproduce the above copyright 1381966bceSXin LI * notice, this list of conditions and the following disclaimer in the 1481966bceSXin LI * documentation and/or other materials provided with the distribution. 1581966bceSXin LI * 1681966bceSXin LI * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1781966bceSXin LI * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1881966bceSXin LI * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1981966bceSXin LI * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2081966bceSXin LI * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2181966bceSXin LI * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2281966bceSXin LI * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2381966bceSXin LI * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2481966bceSXin LI * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2581966bceSXin LI * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2681966bceSXin LI * SUCH DAMAGE. 2781966bceSXin LI */ 2881966bceSXin LI 2981966bceSXin LI #include <dev/hpt27xx/hpt27xx_config.h> 3081966bceSXin LI 3181966bceSXin LI #ifndef _HPT_HIM_H_ 3281966bceSXin LI #define _HPT_HIM_H_ 3381966bceSXin LI 3481966bceSXin LI #define VERMAGIC_HIM 55 3581966bceSXin LI 3681966bceSXin LI #if defined(__cplusplus) 3781966bceSXin LI extern "C" { 3881966bceSXin LI #endif 3981966bceSXin LI 4081966bceSXin LI #include <dev/hpt27xx/list.h> 4181966bceSXin LI 4281966bceSXin LI #define SECTOR_TO_BYTE_SHIFT 9 4381966bceSXin LI #define SECTOR_TO_BYTE(x) ((HPT_U32)(x) << SECTOR_TO_BYTE_SHIFT) 4481966bceSXin LI #define BYTE_TO_SECTOR(x) ((x)>>SECTOR_TO_BYTE_SHIFT) 4581966bceSXin LI 4681966bceSXin LI typedef struct _PCI_ID 4781966bceSXin LI { 4881966bceSXin LI HPT_U16 vid; 4981966bceSXin LI HPT_U16 did; 5081966bceSXin LI HPT_U32 subsys; 5181966bceSXin LI HPT_U8 rev; 5281966bceSXin LI HPT_U8 nbase; 5381966bceSXin LI HPT_U16 reserve; 5481966bceSXin LI } 5581966bceSXin LI PCI_ID; 5681966bceSXin LI 5781966bceSXin LI typedef struct _PCI_ADDRESS 5881966bceSXin LI { 5981966bceSXin LI HPT_U8 tree; 6081966bceSXin LI HPT_U8 bus; 6181966bceSXin LI HPT_U8 device; 6281966bceSXin LI HPT_U8 function; 6381966bceSXin LI } 6481966bceSXin LI PCI_ADDRESS; 6581966bceSXin LI 6681966bceSXin LI typedef struct _HIM_ADAPTER_CONFIG 6781966bceSXin LI { 6881966bceSXin LI PCI_ADDRESS pci_addr; 6981966bceSXin LI PCI_ID pci_id; 7081966bceSXin LI 7181966bceSXin LI HPT_U8 max_devices; 7281966bceSXin LI 7381966bceSXin LI HPT_U8 bProbeInInitializing:1; 7481966bceSXin LI 7581966bceSXin LI HPT_U8 bSpinupOneDevEachTime:1; 7681966bceSXin LI 7781966bceSXin LI HPT_U8 bGlobalNcq:1; 7881966bceSXin LI HPT_U8 bSGPIOPartSupport:1; 7981966bceSXin LI 8081966bceSXin LI HPT_U8 bNeedSASIdleTimer:1; 8181966bceSXin LI HPT_U8 reserved:3; 8281966bceSXin LI 8381966bceSXin LI HPT_U8 bDevsPerBus; 8481966bceSXin LI HPT_U8 first_on_slot; 8581966bceSXin LI 8681966bceSXin LI HPT_U8 bChipType; 8781966bceSXin LI HPT_U8 bChipIntrNum; 8881966bceSXin LI HPT_U8 bChipFlags; 8981966bceSXin LI HPT_U8 bNumBuses; 9081966bceSXin LI 9181966bceSXin LI HPT_U8 szVendorID[36]; 9281966bceSXin LI HPT_U8 szProductID[36]; 9381966bceSXin LI HPT_U32 nvramSize; 9481966bceSXin LI HPT_U64 nvramAddress; 9581966bceSXin LI HPT_U8 slot_index; 96f29c86f1SXin LI HPT_U8 maxWidth; 97f29c86f1SXin LI HPT_U8 currentWidth; 98f29c86f1SXin LI HPT_U8 maxSpeed; 99f29c86f1SXin LI HPT_U8 currentSpeed; 100f29c86f1SXin LI HPT_U8 reserved2[7]; 10181966bceSXin LI } 10281966bceSXin LI HIM_ADAPTER_CONFIG, *PHIM_ADAPTER_CONFIG; 10381966bceSXin LI 10481966bceSXin LI typedef struct _HIM_CHANNEL_CONFIG 10581966bceSXin LI { 10681966bceSXin LI HPT_U32 io_port; 10781966bceSXin LI HPT_U32 ctl_port; 10881966bceSXin LI } HIM_CHANNEL_CONFIG, *PHIM_CHANNEL_CONFIG; 10981966bceSXin LI 11081966bceSXin LI typedef struct _HIM_DEVICE_FLAGS 11181966bceSXin LI { 11281966bceSXin LI HPT_UINT df_atapi :1; 11381966bceSXin LI HPT_UINT df_removable_drive :1; 11481966bceSXin LI HPT_UINT df_on_line :1; 11581966bceSXin LI HPT_UINT df_reduce_mode :1; 11681966bceSXin LI HPT_UINT df_sata :1; 11781966bceSXin LI HPT_UINT df_on_pm_port :1; 11881966bceSXin LI HPT_UINT df_support_read_ahead :1; 11981966bceSXin LI HPT_UINT df_read_ahead_enabled :1; 12081966bceSXin LI HPT_UINT df_support_write_cache :1; 12181966bceSXin LI HPT_UINT df_write_cache_enabled :1; 12281966bceSXin LI HPT_UINT df_cdrom_device :1; 12381966bceSXin LI HPT_UINT df_tape_device :1; 124f29c86f1SXin LI HPT_UINT df_changer_device :1; 12581966bceSXin LI HPT_UINT df_support_tcq :1; 12681966bceSXin LI HPT_UINT df_tcq_enabled :1; 12781966bceSXin LI HPT_UINT df_support_ncq :1; 12881966bceSXin LI HPT_UINT df_ncq_enabled :1; 12981966bceSXin LI HPT_UINT df_sas :1; 13081966bceSXin LI HPT_UINT df_in_enclosure :1; 13181966bceSXin LI HPT_UINT df_ssd :1; 13281966bceSXin LI } DEVICE_FLAGS, *PDEVICE_FLAGS; 13381966bceSXin LI 13481966bceSXin LI #pragma pack(1) 13581966bceSXin LI typedef struct _IDENTIFY_DATA { 13681966bceSXin LI HPT_U16 GeneralConfiguration; 13781966bceSXin LI HPT_U16 NumberOfCylinders; 13881966bceSXin LI HPT_U16 Reserved1; 13981966bceSXin LI HPT_U16 NumberOfHeads; 14081966bceSXin LI HPT_U16 UnformattedBytesPerTrack; 14181966bceSXin LI HPT_U16 UnformattedBytesPerSector; 14281966bceSXin LI HPT_U8 SasAddress[8]; 14381966bceSXin LI HPT_U16 SerialNumber[10]; 14481966bceSXin LI HPT_U16 BufferType; 14581966bceSXin LI HPT_U16 BufferSectorSize; 14681966bceSXin LI HPT_U16 NumberOfEccBytes; 14781966bceSXin LI HPT_U16 FirmwareRevision[4]; 14881966bceSXin LI HPT_U16 ModelNumber[20]; 14981966bceSXin LI HPT_U8 MaximumBlockTransfer; 15081966bceSXin LI HPT_U8 VendorUnique2; 15181966bceSXin LI HPT_U16 DoubleWordIo; 15281966bceSXin LI HPT_U16 Capabilities; 15381966bceSXin LI HPT_U16 Reserved2; 15481966bceSXin LI HPT_U8 VendorUnique3; 15581966bceSXin LI HPT_U8 PioCycleTimingMode; 15681966bceSXin LI HPT_U8 VendorUnique4; 15781966bceSXin LI HPT_U8 DmaCycleTimingMode; 15881966bceSXin LI HPT_U16 TranslationFieldsValid; 15981966bceSXin LI HPT_U16 NumberOfCurrentCylinders; 16081966bceSXin LI HPT_U16 NumberOfCurrentHeads; 16181966bceSXin LI HPT_U16 CurrentSectorsPerTrack; 16281966bceSXin LI HPT_U32 CurrentSectorCapacity; 16381966bceSXin LI HPT_U16 CurrentMultiSectorSetting; 16481966bceSXin LI HPT_U32 UserAddressableSectors; 16581966bceSXin LI HPT_U8 SingleWordDMASupport; 16681966bceSXin LI HPT_U8 SingleWordDMAActive; 16781966bceSXin LI HPT_U8 MultiWordDMASupport; 16881966bceSXin LI HPT_U8 MultiWordDMAActive; 16981966bceSXin LI HPT_U8 AdvancedPIOModes; 17081966bceSXin LI HPT_U8 Reserved4; 17181966bceSXin LI HPT_U16 MinimumMWXferCycleTime; 17281966bceSXin LI HPT_U16 RecommendedMWXferCycleTime; 17381966bceSXin LI HPT_U16 MinimumPIOCycleTime; 17481966bceSXin LI HPT_U16 MinimumPIOCycleTimeIORDY; 17581966bceSXin LI HPT_U16 Reserved5[2]; 17681966bceSXin LI HPT_U16 ReleaseTimeOverlapped; 17781966bceSXin LI HPT_U16 ReleaseTimeServiceCommand; 17881966bceSXin LI HPT_U16 MajorRevision; 17981966bceSXin LI HPT_U16 MinorRevision; 18081966bceSXin LI HPT_U16 MaxQueueDepth; 18181966bceSXin LI HPT_U16 SataCapability; 18281966bceSXin LI HPT_U16 Reserved6[9]; 18381966bceSXin LI HPT_U16 CommandSupport; 18481966bceSXin LI HPT_U16 CommandEnable; 18581966bceSXin LI HPT_U16 UtralDmaMode; 18681966bceSXin LI HPT_U16 Reserved7[11]; 18781966bceSXin LI HPT_U32 Lba48BitLow; 18881966bceSXin LI HPT_U32 Lba48BitHigh; 18981966bceSXin LI HPT_U16 Reserved8[23]; 19081966bceSXin LI HPT_U16 SpecialFunctionsEnabled; 19181966bceSXin LI HPT_U16 Reserved9[128]; 19281966bceSXin LI } 19381966bceSXin LI #ifdef __GNUC__ 19481966bceSXin LI __attribute__((packed)) 19581966bceSXin LI #endif 19681966bceSXin LI IDENTIFY_DATA, *PIDENTIFY_DATA; 19781966bceSXin LI #pragma pack() 19881966bceSXin LI 19981966bceSXin LI typedef struct _HIM_DEVICE_CONFIG 20081966bceSXin LI { 20181966bceSXin LI HPT_U64 capacity; 202f29c86f1SXin LI HPT_U32 logical_sector_size; 20381966bceSXin LI 20481966bceSXin LI DEVICE_FLAGS flags; 20581966bceSXin LI 20681966bceSXin LI HPT_U8 path_id; 20781966bceSXin LI HPT_U8 target_id; 20881966bceSXin LI HPT_U8 max_queue_depth; 20981966bceSXin LI HPT_U8 spin_up_mode; 21081966bceSXin LI 21181966bceSXin LI HPT_U8 reserved; 21281966bceSXin LI HPT_U8 transfer_mode; 21381966bceSXin LI HPT_U8 bMaxShowMode; 21481966bceSXin LI HPT_U8 bDeUsable_Mode; 21581966bceSXin LI 21681966bceSXin LI HPT_U16 max_sectors_per_cmd; 21781966bceSXin LI 21881966bceSXin LI PIDENTIFY_DATA pIdentifyData; 21981966bceSXin LI 22081966bceSXin LI 22181966bceSXin LI HPT_U8 fixed_path_id; /*equals to phy id */ 22281966bceSXin LI } 22381966bceSXin LI HIM_DEVICE_CONFIG, *PHIM_DEVICE_CONFIG; 22481966bceSXin LI 22581966bceSXin LI 22681966bceSXin LI #define _DIT_MODE 0 22781966bceSXin LI #define _DIT_601 1 22881966bceSXin LI #define _DIT_READ_AHEAD 2 22981966bceSXin LI #define _DIT_WRITE_CACHE 3 23081966bceSXin LI #define _DIT_TCQ 4 23181966bceSXin LI #define _DIT_NCQ 5 23281966bceSXin LI #define _DIT_BEEP_OFF 6 23381966bceSXin LI #define _DIT_SPIN_UP_MODE 7 23481966bceSXin LI #define _DIT_IDLE_STANDBY 8 23581966bceSXin LI #define _DIT_IDENTIFY 9 23681966bceSXin LI 23781966bceSXin LI #define SPIN_UP_MODE_NOSUPPORT 0 23881966bceSXin LI #define SPIN_UP_MODE_FULL 1 23981966bceSXin LI #define SPIN_UP_MODE_STANDBY 2 24081966bceSXin LI 24181966bceSXin LI struct tcq_control { 24281966bceSXin LI HPT_U8 enable; 24381966bceSXin LI HPT_U8 depth; 24481966bceSXin LI }; 24581966bceSXin LI 24681966bceSXin LI struct ncq_control { 24781966bceSXin LI HPT_U8 enable; 24881966bceSXin LI HPT_U8 depth; 24981966bceSXin LI }; 25081966bceSXin LI 25181966bceSXin LI typedef struct _HIM_ALTERABLE_DEV_INFO{ 25281966bceSXin LI HPT_U8 type; 25381966bceSXin LI union { 25481966bceSXin LI HPT_U8 mode; 25581966bceSXin LI HPT_U8 enable_read_ahead; 25681966bceSXin LI HPT_U8 enable_read_cache; 25781966bceSXin LI HPT_U8 enable_write_cache; 25881966bceSXin LI struct tcq_control tcq; 25981966bceSXin LI struct ncq_control ncq; 26081966bceSXin LI void * adapter; 26181966bceSXin LI HPT_U8 spin_up_mode; 26281966bceSXin LI HPT_U8 idle_standby_timeout; 26381966bceSXin LI HPT_U8 identify_indicator; 26481966bceSXin LI }u; 26581966bceSXin LI } HIM_ALTERABLE_DEV_INFO, *PHIM_ALTERABLE_DEV_INFO; 26681966bceSXin LI 26781966bceSXin LI struct _COMMAND; 26881966bceSXin LI struct _IOCTL_ARG; 26981966bceSXin LI 27081966bceSXin LI typedef void (*PROBE_CALLBACK)(void *arg, void *dev, int index); 27181966bceSXin LI 27281966bceSXin LI typedef struct _HIM { 27381966bceSXin LI char *name; 27481966bceSXin LI struct _HIM *next; 27581966bceSXin LI HPT_UINT max_sg_descriptors; 27681966bceSXin LI #define _HIM_INTERFACE(_type, _fn, _args) _type (* _fn) _args; 27781966bceSXin LI #include <dev/hpt27xx/himfuncs.h> 27881966bceSXin LI } 27981966bceSXin LI HIM, *PHIM; 28081966bceSXin LI 28181966bceSXin LI 28281966bceSXin LI #pragma pack(1) 28381966bceSXin LI #ifdef SG_FLAG_EOT 28481966bceSXin LI #error "don't use SG_FLAG_EOT with _SG.eot. clean the code!" 28581966bceSXin LI #endif 28681966bceSXin LI 28781966bceSXin LI typedef struct _SG { 28881966bceSXin LI HPT_U32 size; 28981966bceSXin LI HPT_UINT eot; 29081966bceSXin LI union { 29181966bceSXin LI HPT_U8 FAR * _logical; 29281966bceSXin LI BUS_ADDRESS bus; 29381966bceSXin LI } 29481966bceSXin LI addr; 29581966bceSXin LI } 29681966bceSXin LI SG, *PSG; 29781966bceSXin LI #pragma pack() 29881966bceSXin LI 29981966bceSXin LI typedef struct _AtaCommand 30081966bceSXin LI { 30181966bceSXin LI HPT_U64 Lba; 30281966bceSXin LI HPT_U16 nSectors; 30381966bceSXin LI HPT_U16 pad; 30481966bceSXin LI } AtaComm, *PAtaComm; 30581966bceSXin LI 30681966bceSXin LI #define ATA_CMD_NOP 0x0 30781966bceSXin LI 30881966bceSXin LI #define ATA_CMD_SET_FEATURES 0xef 30981966bceSXin LI #define ATA_CMD_FLUSH 0xE7 31081966bceSXin LI #define ATA_CMD_VERIFY 0x40 31181966bceSXin LI #define ATA_CMD_STANDBY 0xe2 31281966bceSXin LI #define ATA_CMD_READ_MULTI 0xC4 31381966bceSXin LI #define ATA_CMD_READ_MULTI_EXT 0x29 31481966bceSXin LI #define ATA_CMD_WRITE_MULTI 0xC5 31581966bceSXin LI #define ATA_CMD_WRITE_MULTI_EXT 0x39 31681966bceSXin LI #define ATA_CMD_WRITE_MULTI_FUA_EXT 0xCE 31781966bceSXin LI 31881966bceSXin LI #define ATA_CMD_READ_DMA 0xc8 /* IDE DMA read command */ 31981966bceSXin LI #define ATA_CMD_WRITE_DMA 0xca /* IDE DMA write command */ 32081966bceSXin LI #define ATA_CMD_READ_DMA_EXT 0x25 32181966bceSXin LI #define ATA_CMD_READ_QUEUE_EXT 0x26 32281966bceSXin LI #define ATA_CMD_READ_MAX_ADDR 0x27 32381966bceSXin LI #define ATA_CMD_READ_EXT 0x24 32481966bceSXin LI #define ATA_CMD_VERIFY_EXT 0x42 32581966bceSXin LI #define ATA_CMD_WRITE_DMA_EXT 0x35 32681966bceSXin LI #define ATA_CMD_WRITE_QUEUE_EXT 0x36 32781966bceSXin LI #define ATA_CMD_WRITE_EXT 0x34 32881966bceSXin LI 32981966bceSXin LI #define ATA_SET_FEATURES_XFER 0x3 33081966bceSXin LI #define ATA_SECTOR_SIZE 512 33181966bceSXin LI 33281966bceSXin LI typedef struct _PassthroughCmd { 33381966bceSXin LI HPT_U16 bFeaturesReg; 33481966bceSXin LI HPT_U16 bSectorCountReg; 33581966bceSXin LI HPT_U16 bLbaLowReg; 33681966bceSXin LI HPT_U16 bLbaMidReg; 33781966bceSXin LI HPT_U16 bLbaHighReg; 33881966bceSXin LI HPT_U8 bDriveHeadReg; 33981966bceSXin LI HPT_U8 bCommandReg; 34081966bceSXin LI HPT_U16 nSectors; 34181966bceSXin LI HPT_U8 *pDataBuffer; 34281966bceSXin LI } 34381966bceSXin LI PassthroughCmd; 34481966bceSXin LI 34581966bceSXin LI typedef struct _ScsiComm { 34681966bceSXin LI HPT_U8 cdbLength; 34781966bceSXin LI HPT_U8 senseLength; 34881966bceSXin LI HPT_U8 scsiStatus; 34981966bceSXin LI HPT_U8 reserve1; 35081966bceSXin LI HPT_U32 dataLength; 351f29c86f1SXin LI HPT_U8 cdb[16]; 35281966bceSXin LI HPT_U8 *senseBuffer; 35381966bceSXin LI } 35481966bceSXin LI ScsiComm; 35581966bceSXin LI 356f29c86f1SXin LI typedef struct _ScsiExtComm { 357f29c86f1SXin LI HPT_U8 cdbLength; 358f29c86f1SXin LI HPT_U8 senseLength; 359f29c86f1SXin LI HPT_U8 scsiStatus; 360f29c86f1SXin LI HPT_U8 reserve1; 361f29c86f1SXin LI HPT_U32 dataLength; 362f29c86f1SXin LI HPT_U8 cdb[16]; 363f29c86f1SXin LI HPT_U8 *senseBuffer; 364f29c86f1SXin LI HPT_U8 lun[8]; 365f29c86f1SXin LI } 366f29c86f1SXin LI ScsiExtComm; 367f29c86f1SXin LI 36881966bceSXin LI 36981966bceSXin LI #define CTRL_CMD_REBUILD 1 37081966bceSXin LI #define CTRL_CMD_VERIFY 2 37181966bceSXin LI #define CTRL_CMD_INIT 3 37281966bceSXin LI 37381966bceSXin LI 37481966bceSXin LI typedef struct _R5ControlCmd { 37581966bceSXin LI HPT_U64 StripeLine; 37681966bceSXin LI HPT_U16 Offset; 37781966bceSXin LI HPT_U8 Command; 378f29c86f1SXin LI HPT_U8 CmdTarget; 37981966bceSXin LI } 38081966bceSXin LI R5ControlCmd, *PR5ControlCmd; 38181966bceSXin LI 38281966bceSXin LI typedef struct _HPT_ADDRESS 38381966bceSXin LI { 38481966bceSXin LI HPT_U8 * logical; 38581966bceSXin LI BUS_ADDRESS bus; 38681966bceSXin LI } 38781966bceSXin LI HPT_ADDRESS; 38881966bceSXin LI 38981966bceSXin LI 39081966bceSXin LI typedef struct ctl_pages { 39181966bceSXin LI HPT_ADDRESS *pages; 39281966bceSXin LI HPT_UINT page_size; 39381966bceSXin LI HPT_UINT npages; 39481966bceSXin LI HPT_UINT min_sg_descriptors; 39581966bceSXin LI } CONTROL_PAGES, *PCONTROL_PAGES; 39681966bceSXin LI 39781966bceSXin LI typedef struct _R1ControlCmd { 39881966bceSXin LI HPT_U64 Lba; 39981966bceSXin LI HPT_U16 nSectors; 400f29c86f1SXin LI HPT_U8 Command; 401f29c86f1SXin LI HPT_U8 CmdTarget; 40281966bceSXin LI PCONTROL_PAGES ctl_pages; 40381966bceSXin LI } 40481966bceSXin LI R1ControlCmd, *PR1ControlCmd; 40581966bceSXin LI 40681966bceSXin LI typedef void (*TQ_PROC)(void *arg); 40781966bceSXin LI 40881966bceSXin LI struct tq_item { 40981966bceSXin LI TQ_PROC proc; 41081966bceSXin LI void *arg; 41181966bceSXin LI struct tq_item *next; 41281966bceSXin LI }; 41381966bceSXin LI 41481966bceSXin LI #define INIT_TQ_ITEM(t, p, a) \ 41581966bceSXin LI do { (t)->proc = p; (t)->arg = a; (t)->next = 0; } while (0) 41681966bceSXin LI 41781966bceSXin LI typedef struct _COMMAND 41881966bceSXin LI { 41981966bceSXin LI 42081966bceSXin LI struct _VBUS * vbus; 42181966bceSXin LI 42281966bceSXin LI struct freelist *grplist; 42381966bceSXin LI HPT_UINT grpcnt; 42481966bceSXin LI 42581966bceSXin LI 42681966bceSXin LI struct list_head q_link; 42781966bceSXin LI struct tq_item done_dpc; 42881966bceSXin LI 42981966bceSXin LI HPT_UINT extsize; 43081966bceSXin LI void *ext; 43181966bceSXin LI 43281966bceSXin LI 43381966bceSXin LI 43481966bceSXin LI void *target; 43581966bceSXin LI void *priv; 43681966bceSXin LI HPT_UPTR priv2; 43781966bceSXin LI 43881966bceSXin LI int priority; 43981966bceSXin LI struct lock_request *owned_lock; 44081966bceSXin LI struct lock_request *lock_req; 44181966bceSXin LI void (*dtor)(struct _COMMAND *, void *); 44281966bceSXin LI void *dtor_arg; 44381966bceSXin LI 44481966bceSXin LI union{ 44581966bceSXin LI AtaComm Ide; 44681966bceSXin LI PassthroughCmd Passthrough; 44781966bceSXin LI ScsiComm Scsi; 448f29c86f1SXin LI ScsiExtComm ScsiExt; 44981966bceSXin LI R5ControlCmd R5Control; 45081966bceSXin LI R1ControlCmd R1Control; 45181966bceSXin LI } uCmd; 45281966bceSXin LI 45381966bceSXin LI HPT_U8 type; /* CMD_TYPE_* */ 45481966bceSXin LI 45581966bceSXin LI struct { 45681966bceSXin LI HPT_U8 physical_sg: 1; 45781966bceSXin LI HPT_U8 data_in: 1; 45881966bceSXin LI HPT_U8 data_out: 1; 45981966bceSXin LI HPT_U8 transform : 1; 46081966bceSXin LI HPT_U8 hard_flush: 2; 46181966bceSXin LI HPT_U8 from_cc: 1; 46281966bceSXin LI HPT_U8 force_cc: 1; 46381966bceSXin LI } flags; 46481966bceSXin LI 46581966bceSXin LI /* return status */ 46681966bceSXin LI HPT_U8 Result; 46781966bceSXin LI /* retry count */ 46881966bceSXin LI HPT_U8 RetryCount; 46981966bceSXin LI 47081966bceSXin LI 47181966bceSXin LI PSG psg; 47281966bceSXin LI 47381966bceSXin LI 47481966bceSXin LI int (*buildsgl)(struct _COMMAND *cmd, PSG psg, int logical); 47581966bceSXin LI void (*done)(struct _COMMAND *cmd); 47681966bceSXin LI } 47781966bceSXin LI COMMAND, *PCOMMAND; 47881966bceSXin LI 47981966bceSXin LI /* command types */ 48081966bceSXin LI #define CMD_TYPE_IO 0 48181966bceSXin LI #define CMD_TYPE_CONTROL 1 48281966bceSXin LI #define CMD_TYPE_ATAPI 2 48381966bceSXin LI #define CMD_TYPE_SCSI CMD_TYPE_ATAPI 48481966bceSXin LI #define CMD_TYPE_PASSTHROUGH 3 48581966bceSXin LI #define CMD_TYPE_FLUSH 4 486f29c86f1SXin LI #define CMD_TYPE_SCSI_EXT 5 48781966bceSXin LI #define CMD_TYPE_IO_INDIRECT 0x80 48881966bceSXin LI 48981966bceSXin LI /* flush command flags */ 49081966bceSXin LI #define CF_HARD_FLUSH_CACHE 1 49181966bceSXin LI #define CF_HARD_FLUSH_STANDBY 2 49281966bceSXin LI 49381966bceSXin LI /* command return values */ 49481966bceSXin LI #define RETURN_PENDING 0 49581966bceSXin LI #define RETURN_SUCCESS 1 49681966bceSXin LI #define RETURN_BAD_DEVICE 2 49781966bceSXin LI #define RETURN_BAD_PARAMETER 3 49881966bceSXin LI #define RETURN_WRITE_NO_DRQ 4 49981966bceSXin LI #define RETURN_DEVICE_BUSY 5 50081966bceSXin LI #define RETURN_INVALID_REQUEST 6 50181966bceSXin LI #define RETURN_SELECTION_TIMEOUT 7 50281966bceSXin LI #define RETURN_IDE_ERROR 8 50381966bceSXin LI #define RETURN_NEED_LOGICAL_SG 9 50481966bceSXin LI #define RETURN_NEED_PHYSICAL_SG 10 50581966bceSXin LI #define RETURN_RETRY 11 50681966bceSXin LI #define RETURN_DATA_ERROR 12 50781966bceSXin LI #define RETURN_BUS_RESET 13 50881966bceSXin LI #define RETURN_BAD_TRANSFER_LENGTH 14 50981966bceSXin LI #define RETURN_INSUFFICIENT_MEMORY 15 51081966bceSXin LI #define RETURN_SECTOR_ERROR 16 51181966bceSXin LI #define RETURN_NEED_SPINUP 17 51281966bceSXin LI 51381966bceSXin LI #if defined(__cplusplus) 51481966bceSXin LI } 51581966bceSXin LI #endif 51681966bceSXin LI #endif 517