xref: /freebsd/sys/dev/hptmv/atapi.h (revision 718cf2ccb9956613756ab15d7a0e28f2c8e91cab)
1*718cf2ccSPedro F. Giffuni /*-
2*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*718cf2ccSPedro F. Giffuni  *
4d2bd3ab9SScott Long  * Copyright (c) 2004-2005 HighPoint Technologies, Inc.
51713e81bSScott Long  * All rights reserved.
61713e81bSScott Long  *
71713e81bSScott Long  * Redistribution and use in source and binary forms, with or without
81713e81bSScott Long  * modification, are permitted provided that the following conditions
91713e81bSScott Long  * are met:
101713e81bSScott Long  * 1. Redistributions of source code must retain the above copyright
111713e81bSScott Long  *    notice, this list of conditions and the following disclaimer.
121713e81bSScott Long  * 2. Redistributions in binary form must reproduce the above copyright
131713e81bSScott Long  *    notice, this list of conditions and the following disclaimer in the
141713e81bSScott Long  *    documentation and/or other materials provided with the distribution.
151713e81bSScott Long  *
161713e81bSScott Long  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
171713e81bSScott Long  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
181713e81bSScott Long  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
191713e81bSScott Long  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
201713e81bSScott Long  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
211713e81bSScott Long  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
221713e81bSScott Long  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
231713e81bSScott Long  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
241713e81bSScott Long  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
251713e81bSScott Long  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261713e81bSScott Long  * SUCH DAMAGE.
27d38d9c9eSScott Long  *
28d38d9c9eSScott Long  * $FreeBSD$
291713e81bSScott Long  */
301713e81bSScott Long 
311713e81bSScott Long #ifndef _ATAPI_H_
321713e81bSScott Long #define _ATAPI_H_
331713e81bSScott Long 
341713e81bSScott Long #pragma pack(1)
351713e81bSScott Long 
361713e81bSScott Long /***************************************************************************
371713e81bSScott Long  *            IDE IO Register File
381713e81bSScott Long  ***************************************************************************/
391713e81bSScott Long 
401713e81bSScott Long /*
411713e81bSScott Long  * IDE IO Port definition
421713e81bSScott Long  */
431713e81bSScott Long typedef struct _IDE_REGISTERS_1 {
441713e81bSScott Long     USHORT Data;               /* RW: Data port feature register      */
451713e81bSScott Long     UCHAR BlockCount;          /* RW: Sector count               */
461713e81bSScott Long     UCHAR BlockNumber;         /* RW: Sector number & LBA 0-7    */
471713e81bSScott Long     UCHAR CylinderLow;         /* RW: Cylinder low & LBA 8-15    */
481713e81bSScott Long     UCHAR CylinderHigh;        /* RW: Cylinder hign & LBA 16-23  */
491713e81bSScott Long     UCHAR DriveSelect;         /* RW: Drive/head & LBA 24-27     */
501713e81bSScott Long     UCHAR Command;             /* RO: Status WR:Command          */
511713e81bSScott Long } IDE_REGISTERS_1, *PIDE_REGISTERS_1;
521713e81bSScott Long 
531713e81bSScott Long 
541713e81bSScott Long /*
551713e81bSScott Long  * IDE status definitions
561713e81bSScott Long  */
571713e81bSScott Long #define IDE_STATUS_ERROR             0x01 /* Error Occurred in Execution    */
581713e81bSScott Long #define IDE_STATUS_INDEX             0x02 /* is vendor specific             */
591713e81bSScott Long #define IDE_STATUS_CORRECTED_ERROR   0x04 /* Corrected Data                 */
601713e81bSScott Long #define IDE_STATUS_DRQ               0x08 /* Ready to transfer data         */
611713e81bSScott Long #define IDE_STATUS_DSC               0x10 /* not defined in ATA-2           */
621713e81bSScott Long #define IDE_STATUS_DWF               0x20 /* Device Fault has been detected */
631713e81bSScott Long #define IDE_STATUS_DRDY              0x40 /* Device Ready to accept command */
641713e81bSScott Long #define IDE_STATUS_IDLE              0x50 /* Device is OK                   */
651713e81bSScott Long #define IDE_STATUS_BUSY              0x80 /* Device Busy, must wait         */
661713e81bSScott Long 
671713e81bSScott Long 
681713e81bSScott Long #define IDE_ERROR_BAD_BLOCK          0x80 /* Reserved now                   */
691713e81bSScott Long #define IDE_ERROR_DATA_ERROR         0x40 /* Uncorreectable  Data Error     */
701713e81bSScott Long #define IDE_ERROR_MEDIA_CHANGE       0x20 /* Media Changed                  */
711713e81bSScott Long #define IDE_ERROR_ID_NOT_FOUND       0x10 /* ID Not Found                   */
721713e81bSScott Long #define IDE_ERROR_MEDIA_CHANGE_REQ   0x08 /* Media Change Requested         */
731713e81bSScott Long #define IDE_ERROR_COMMAND_ABORTED    0x04 /* Aborted Command                */
741713e81bSScott Long #define IDE_ERROR_TRACK0_NOT_FOUND   0x02 /* Track 0 Not Found              */
751713e81bSScott Long #define IDE_ERROR_ADDRESS_NOT_FOUND  0x01 /* Address Mark Not Found         */
761713e81bSScott Long 
771713e81bSScott Long 
781713e81bSScott Long #define LBA_MODE                     0x40
791713e81bSScott Long 
801713e81bSScott Long /*
811713e81bSScott Long  * IDE command definitions
821713e81bSScott Long  */
831713e81bSScott Long 
841713e81bSScott Long #define IDE_COMMAND_RECALIBRATE      0x10 /* Recalibrate                    */
851713e81bSScott Long #define IDE_COMMAND_READ             0x20 /* Read Sectors with retry        */
861713e81bSScott Long #define IDE_COMMAND_WRITE            0x30 /* Write Sectors with retry       */
871713e81bSScott Long #define IDE_COMMAND_VERIFY           0x40 /* Read Verify Sectors with Retry */
881713e81bSScott Long #define IDE_COMMAND_SEEK             0x70 /* Seek                           */
891713e81bSScott Long #define IDE_COMMAND_SET_DRIVE_PARAMETER   0x91 /* Initialize Device Parmeters */
901713e81bSScott Long #define IDE_COMMAND_GET_MEDIA_STATUS 0xDA
911713e81bSScott Long #define IDE_COMMAND_DOOR_LOCK        0xDE /* Door Lock                      */
921713e81bSScott Long #define IDE_COMMAND_DOOR_UNLOCK      0xDF /* Door Unlock                          */
931713e81bSScott Long #define IDE_COMMAND_ENABLE_MEDIA_STATUS   0xEF /* Set Features              */
941713e81bSScott Long #define IDE_COMMAND_IDENTIFY         0xEC /* Identify Device                */
951713e81bSScott Long #define IDE_COMMAND_MEDIA_EJECT      0xED
961713e81bSScott Long #define IDE_COMMAND_SET_FEATURES     0xEF /* IDE set features command       */
971713e81bSScott Long 
981713e81bSScott Long #define IDE_COMMAND_FLUSH_CACHE      0xE7
991713e81bSScott Long #define IDE_COMMAND_STANDBY_IMMEDIATE 0xE0
1001713e81bSScott Long 
1011713e81bSScott Long #ifndef NOT_SUPPORT_MULTIPLE
1021713e81bSScott Long #define IDE_COMMAND_READ_MULTIPLE    0xC4 /* Read Multiple                  */
1031713e81bSScott Long #define IDE_COMMAND_WRITE_MULTIPLE   0xC5 /* Write Multiple                 */
1041713e81bSScott Long #define IDE_COMMAND_SET_MULTIPLE     0xC6 /* Set Multiple Mode              */
1051713e81bSScott Long #endif
1061713e81bSScott Long 
1071713e81bSScott Long #ifndef NOT_SUPPORT_DMA
1081713e81bSScott Long #define IDE_COMMAND_DMA_READ        0xc8  /* IDE DMA read command           */
1091713e81bSScott Long #define IDE_COMMAND_DMA_WRITE       0xca  /* IDE DMA write command          */
1101713e81bSScott Long #endif
1111713e81bSScott Long 
1121713e81bSScott Long #define IDE_COMMAND_READ_DMA_QUEUE   0xc7 /* IDE read DMA queue command     */
1131713e81bSScott Long #define IDE_COMMAND_WRITE_DMA_QUEUE  0xcc /* IDE write DMA queue command    */
1141713e81bSScott Long #define IDE_COMMAND_SERVICE          0xA2 /* IDE service command command    */
1151713e81bSScott Long #define IDE_COMMAND_NOP              0x00 /* IDE NOP command                */
1161713e81bSScott Long #define IDE_STATUS_SRV               0x10
1171713e81bSScott Long #define IDE_RELEASE_BUS              4
1181713e81bSScott Long 
1191713e81bSScott Long /*#define IDE_COMMAND_FLUSH_CACHE_EXT */
1201713e81bSScott Long #define IDE_COMMAND_READ_DMA_EXT       	0x25
1211713e81bSScott Long #define IDE_COMMAND_READ_QUEUE_EXT		0x26
1221713e81bSScott Long #define IDE_COMMAND_READ_MULTIPLE_EXT	0x29
1231713e81bSScott Long #define IDE_COMMAND_READ_MAX_ADDR		0x27
1241713e81bSScott Long #define IDE_COMMAND_READ_EXT			0x24
1251713e81bSScott Long #define IDE_COMMAND_VERIFY_EXT			0x42
1261713e81bSScott Long #define IDE_COMMAND_SET_MULTIPLE_EXT	0x37
1271713e81bSScott Long #define IDE_COMMAND_WRITE_DMA_EXT		0x35
1281713e81bSScott Long #define IDE_COMMAND_WRITE_QUEUE_EXT		0x36
1291713e81bSScott Long #define IDE_COMMAND_WRITE_EXT			0x34
1301713e81bSScott Long #define IDE_COMMAND_WRITE_MULTIPLE_EXT	0x39
1311713e81bSScott Long 
1321713e81bSScott Long /*
1331713e81bSScott Long  * IDE_COMMAND_SET_FEATURES
1341713e81bSScott Long  */
1351713e81bSScott Long #define FT_USE_ULTRA        0x40    /* Set feature for Ultra DMA           */
1361713e81bSScott Long #define FT_USE_MWDMA        0x20    /* Set feature for MW DMA              */
1371713e81bSScott Long #define FT_USE_SWDMA        0x10    /* Set feature for SW DMA              */
1381713e81bSScott Long #define FT_USE_PIO          0x8     /* Set feature for PIO                 */
1391713e81bSScott Long #define FT_DISABLE_IORDY    0x10    /* Set feature for disabling IORDY     */
1401713e81bSScott Long 
1411713e81bSScott Long /*
1421713e81bSScott Long  * S.M.A.R.T. commands
1431713e81bSScott Long  */
1441713e81bSScott Long #define IDE_COMMAND_SMART       0xB0
1451713e81bSScott Long #define SMART_READ_VALUES       0xd0
1461713e81bSScott Long #define SMART_READ_THRESHOLDS   0xd1
1471713e81bSScott Long #define SMART_AUTOSAVE          0xd2
1481713e81bSScott Long #define SMART_SAVE              0xd3
1491713e81bSScott Long #define SMART_IMMEDIATE_OFFLINE 0xd4
1501713e81bSScott Long #define SMART_READ_LOG_SECTOR   0xd5
1511713e81bSScott Long #define SMART_WRITE_LOG_SECTOR  0xd6
1521713e81bSScott Long #define SMART_ENABLE            0xd8
1531713e81bSScott Long #define SMART_DISABLE           0xd9
1541713e81bSScott Long #define SMART_STATUS            0xda
1551713e81bSScott Long #define SMART_AUTO_OFFLINE      0xdb
1561713e81bSScott Long 
1571713e81bSScott Long  /***************************************************************************
1581713e81bSScott Long  *            IDE Control Register File
1591713e81bSScott Long  ***************************************************************************/
1601713e81bSScott Long 
1611713e81bSScott Long typedef struct _IDE_REGISTERS_2 {
1621713e81bSScott Long     UCHAR AlternateStatus;     /* RW: device control port        */
1631713e81bSScott Long } IDE_REGISTERS_2, *PIDE_REGISTERS_2;
1641713e81bSScott Long 
1651713e81bSScott Long 
1661713e81bSScott Long /*
1671713e81bSScott Long  * IDE drive control definitions
1681713e81bSScott Long  */
1691713e81bSScott Long #define IDE_DC_DISABLE_INTERRUPTS    0x02
1701713e81bSScott Long #define IDE_DC_RESET_CONTROLLER      0x04
1711713e81bSScott Long #define IDE_DC_REENABLE_CONTROLLER   0x00
1721713e81bSScott Long 
1731713e81bSScott Long /***************************************************************************
1741713e81bSScott Long  *   MSNS:   Removable device
1751713e81bSScott Long  ***************************************************************************/
1761713e81bSScott Long /*
1771713e81bSScott Long  * Media syatus
1781713e81bSScott Long  */
1791713e81bSScott Long #define MSNS_NO_MEDIA             2
1801713e81bSScott Long #define MSNS_MEDIA_CHANGE_REQUEST 8
1811713e81bSScott Long #define MSNS_MIDIA_CHANGE         0x20
1821713e81bSScott Long #define MSNS_WRITE_PROTECT        0x40
1831713e81bSScott Long #define MSNS_READ_PROTECT         0x80
1841713e81bSScott Long 
1851713e81bSScott Long /*
1861713e81bSScott Long  * IDENTIFY data
1871713e81bSScott Long  */
1881713e81bSScott Long typedef struct _IDENTIFY_DATA {
1891713e81bSScott Long     USHORT GeneralConfiguration;            /* 00 00 */
1901713e81bSScott Long     USHORT NumberOfCylinders;               /* 02  1 */
1911713e81bSScott Long     USHORT Reserved1;                       /* 04  2 */
1921713e81bSScott Long     USHORT NumberOfHeads;                   /* 06  3 */
1931713e81bSScott Long     USHORT UnformattedBytesPerTrack;        /* 08  4 */
1941713e81bSScott Long     USHORT UnformattedBytesPerSector;       /* 0A  5 */
1951713e81bSScott Long     USHORT SectorsPerTrack;                 /* 0C  6 */
1961713e81bSScott Long     USHORT VendorUnique1[3];                /* 0E  7-9 */
1971713e81bSScott Long     USHORT SerialNumber[10];                /* 14  10-19 */
1981713e81bSScott Long     USHORT BufferType;                      /* 28  20 */
1991713e81bSScott Long     USHORT BufferSectorSize;                /* 2A  21 */
2001713e81bSScott Long     USHORT NumberOfEccBytes;                /* 2C  22 */
2011713e81bSScott Long     USHORT FirmwareRevision[4];             /* 2E  23-26 */
2021713e81bSScott Long     USHORT ModelNumber[20];                 /* 36  27-46 */
2031713e81bSScott Long     UCHAR  MaximumBlockTransfer;            /* 5E  47 */
2041713e81bSScott Long     UCHAR  VendorUnique2;                   /* 5F */
2051713e81bSScott Long     USHORT DoubleWordIo;                    /* 60  48 */
2061713e81bSScott Long     USHORT Capabilities;                    /* 62  49 */
2071713e81bSScott Long     USHORT Reserved2;                       /* 64  50 */
2081713e81bSScott Long     UCHAR  VendorUnique3;                   /* 66  51 */
2091713e81bSScott Long     UCHAR  PioCycleTimingMode;              /* 67 */
2101713e81bSScott Long     UCHAR  VendorUnique4;                   /* 68  52 */
2111713e81bSScott Long     UCHAR  DmaCycleTimingMode;              /* 69 */
2121713e81bSScott Long     USHORT TranslationFieldsValid;          /* 6A  53 */
2131713e81bSScott Long     USHORT NumberOfCurrentCylinders;        /* 6C  54 */
2141713e81bSScott Long     USHORT NumberOfCurrentHeads;            /* 6E  55 */
2151713e81bSScott Long     USHORT CurrentSectorsPerTrack;          /* 70  56 */
2161713e81bSScott Long     ULONG  CurrentSectorCapacity;           /* 72  57-58 */
2171713e81bSScott Long     USHORT CurrentMultiSectorSetting;       /* 76  59 */
2181713e81bSScott Long     ULONG  UserAddressableSectors;          /* 78  60-61 */
2191713e81bSScott Long     UCHAR  SingleWordDMASupport;            /* 7C  62 */
2201713e81bSScott Long     UCHAR  SingleWordDMAActive;             /* 7D */
2211713e81bSScott Long     UCHAR  MultiWordDMASupport;         	/* 7E  63 */
2221713e81bSScott Long     UCHAR  MultiWordDMAActive;              /* 7F */
2231713e81bSScott Long     UCHAR  AdvancedPIOModes;                /* 80  64 */
2241713e81bSScott Long     UCHAR  Reserved4;                       /* 81 */
2251713e81bSScott Long     USHORT MinimumMWXferCycleTime;          /* 82  65 */
2261713e81bSScott Long     USHORT RecommendedMWXferCycleTime;      /* 84  66 */
2271713e81bSScott Long     USHORT MinimumPIOCycleTime;             /* 86  67 */
2281713e81bSScott Long     USHORT MinimumPIOCycleTimeIORDY;        /* 88  68 */
2291713e81bSScott Long     USHORT Reserved5[2];                    /* 8A  69-70 */
2301713e81bSScott Long     USHORT ReleaseTimeOverlapped;           /* 8E  71 */
2311713e81bSScott Long     USHORT ReleaseTimeServiceCommand;       /* 90  72 */
2321713e81bSScott Long     USHORT MajorRevision;                   /* 92  73 */
2331713e81bSScott Long     USHORT MinorRevision;                   /* 94  74 */
2341713e81bSScott Long     USHORT MaxQueueDepth;                   /* 96  75 */
2351713e81bSScott Long 	USHORT SataCapability;                  /*     76 */
2361713e81bSScott Long     USHORT Reserved6[9];                    /* 98   77-85 */
2371713e81bSScott Long     USHORT CommandSupport;                  /*     86 */
2381713e81bSScott Long     USHORT CommandEnable;                   /*     87 */
2391713e81bSScott Long     USHORT UtralDmaMode;                    /*     88 */
2401713e81bSScott Long     USHORT Reserved7[11];                   /*     89-99 */
2411713e81bSScott Long     ULONG  Lba48BitLow;						/*     101-100 */
2421713e81bSScott Long     ULONG  Lba48BitHigh;					/*     103-102 */
2431713e81bSScott Long     USHORT Reserved8[23];                   /*     104-126 */
2441713e81bSScott Long     USHORT SpecialFunctionsEnabled;         /*     127 */
2451713e81bSScott Long     USHORT Reserved9[128];                  /*     128-255 */
2461713e81bSScott Long 
2471713e81bSScott Long } IDENTIFY_DATA, *PIDENTIFY_DATA;
2481713e81bSScott Long 
2491713e81bSScott Long typedef struct _CONFIGURATION_IDENTIFY_DATA {
2501713e81bSScott Long 	USHORT Revision;
2511713e81bSScott Long 	USHORT MWDMAModeSupported;
2521713e81bSScott Long 	USHORT UDMAModeSupported;
2531713e81bSScott Long 	ULONG  MaximumLbaLow;
2541713e81bSScott Long 	ULONG  MaximumLbaHigh;
2551713e81bSScott Long 	USHORT CommandSupport;
2561713e81bSScott Long 	USHORT Reserved[247];
2571713e81bSScott Long 	UCHAR  Signature; /* 0xA5 */
2581713e81bSScott Long 	UCHAR  CheckSum;
2591713e81bSScott Long }
2601713e81bSScott Long CONFIGURATION_IDENTIFY_DATA, *PCONFIGURATION_IDENTIFY_DATA;
2611713e81bSScott Long 
2621713e81bSScott Long /* */
2631713e81bSScott Long /* Identify data without the Reserved4. */
2641713e81bSScott Long /* */
2651713e81bSScott Long typedef struct _IDENTIFY_DATA2 {
2661713e81bSScott Long     USHORT GeneralConfiguration;            /* 00 00 */
2671713e81bSScott Long     USHORT NumberOfCylinders;               /* 02  1 */
2681713e81bSScott Long     USHORT Reserved1;                       /* 04  2 */
2691713e81bSScott Long     USHORT NumberOfHeads;                   /* 06  3 */
2701713e81bSScott Long     USHORT UnformattedBytesPerTrack;        /* 08  4 */
2711713e81bSScott Long     USHORT UnformattedBytesPerSector;       /* 0A  5 */
2721713e81bSScott Long     USHORT SectorsPerTrack;                 /* 0C  6 */
2731713e81bSScott Long     USHORT VendorUnique1[3];                /* 0E  7-9 */
2741713e81bSScott Long     USHORT SerialNumber[10];                /* 14  10-19 */
2751713e81bSScott Long     USHORT BufferType;                      /* 28  20 */
2761713e81bSScott Long     USHORT BufferSectorSize;                /* 2A  21 */
2771713e81bSScott Long     USHORT NumberOfEccBytes;                /* 2C  22 */
2781713e81bSScott Long     USHORT FirmwareRevision[4];             /* 2E  23-26 */
2791713e81bSScott Long     USHORT ModelNumber[20];                 /* 36  27-46 */
2801713e81bSScott Long     UCHAR  MaximumBlockTransfer;            /* 5E  47 */
2811713e81bSScott Long     UCHAR  VendorUnique2;                   /* 5F */
2821713e81bSScott Long     USHORT DoubleWordIo;                    /* 60  48 */
2831713e81bSScott Long     USHORT Capabilities;                    /* 62  49 */
2841713e81bSScott Long     USHORT Reserved2;                       /* 64  50 */
2851713e81bSScott Long     UCHAR  VendorUnique3;                   /* 66  51 */
2861713e81bSScott Long     UCHAR  PioCycleTimingMode;              /* 67 */
2871713e81bSScott Long     UCHAR  VendorUnique4;                   /* 68  52 */
2881713e81bSScott Long     UCHAR  DmaCycleTimingMode;              /* 69 */
2891713e81bSScott Long     USHORT TranslationFieldsValid;         	/* 6A  53 */
2901713e81bSScott Long     USHORT NumberOfCurrentCylinders;        /* 6C  54 */
2911713e81bSScott Long     USHORT NumberOfCurrentHeads;            /* 6E  55 */
2921713e81bSScott Long     USHORT CurrentSectorsPerTrack;          /* 70  56 */
2931713e81bSScott Long     ULONG  CurrentSectorCapacity;           /* 72  57-58 */
2941713e81bSScott Long     USHORT CurrentMultiSectorSetting;       /*     59 */
2951713e81bSScott Long     ULONG  UserAddressableSectors;          /*     60-61 */
2961713e81bSScott Long     UCHAR  SingleWordDMASupport;        	/*     62 */
2971713e81bSScott Long     UCHAR  SingleWordDMAActive;
2981713e81bSScott Long     UCHAR  MultiWordDMASupport;         	/*     63 */
2991713e81bSScott Long     UCHAR  MultiWordDMAActive;
3001713e81bSScott Long     UCHAR  AdvancedPIOModes;            	/*     64 */
3011713e81bSScott Long     UCHAR  Reserved4;
3021713e81bSScott Long     USHORT MinimumMWXferCycleTime;          /*     65 */
3031713e81bSScott Long     USHORT RecommendedMWXferCycleTime;      /*     66 */
3041713e81bSScott Long     USHORT MinimumPIOCycleTime;             /*     67 */
3051713e81bSScott Long     USHORT MinimumPIOCycleTimeIORDY;        /*     68 */
3061713e81bSScott Long     USHORT Reserved5[2];                    /*     69-70 */
3071713e81bSScott Long     USHORT ReleaseTimeOverlapped;           /*     71 */
3081713e81bSScott Long     USHORT ReleaseTimeServiceCommand;       /*     72 */
3091713e81bSScott Long     USHORT MajorRevision;                   /*     73 */
3101713e81bSScott Long     USHORT MinorRevision;                   /*     74 */
3111713e81bSScott Long /*    USHORT Reserved6[14];                 //     75-88 */
3121713e81bSScott Long } IDENTIFY_DATA2, *PIDENTIFY_DATA2;
3131713e81bSScott Long 
3141713e81bSScott Long #define IDENTIFY_DATA_SIZE sizeof(IDENTIFY_DATA2)
3151713e81bSScott Long 
3161713e81bSScott Long /* */
3171713e81bSScott Long /* IDENTIFY DMA timing cycle modes. */
3181713e81bSScott Long /* */
3191713e81bSScott Long 
3201713e81bSScott Long #define IDENTIFY_DMA_CYCLES_MODE_0 0x00
3211713e81bSScott Long #define IDENTIFY_DMA_CYCLES_MODE_1 0x01
3221713e81bSScott Long #define IDENTIFY_DMA_CYCLES_MODE_2 0x02
3231713e81bSScott Long 
3241713e81bSScott Long /*
3251713e81bSScott Long  * Mode definitions
3261713e81bSScott Long  */
3271713e81bSScott Long typedef enum _DISK_MODE
3281713e81bSScott Long {
3291713e81bSScott Long 	IDE_PIO_0 = 0,
3301713e81bSScott Long 	IDE_PIO_1,
3311713e81bSScott Long 	IDE_PIO_2,
3321713e81bSScott Long 	IDE_PIO_3,
3331713e81bSScott Long 	IDE_PIO_4,
3341713e81bSScott Long 	IDE_MWDMA_0,
3351713e81bSScott Long 	IDE_MWDMA_1,
3361713e81bSScott Long 	IDE_MWDMA_2,
3371713e81bSScott Long 	IDE_UDMA_0,
3381713e81bSScott Long 	IDE_UDMA_1,
3391713e81bSScott Long 	IDE_UDMA_2,
3401713e81bSScott Long 	IDE_UDMA_3,
3411713e81bSScott Long 	IDE_UDMA_4,
3421713e81bSScott Long 	IDE_UDMA_5,
3431713e81bSScott Long 	IDE_UDMA_6,
3441713e81bSScott Long 	IDE_UDMA_7,
3451713e81bSScott Long } DISK_MODE;
3461713e81bSScott Long 
3471713e81bSScott Long /***************************************************************************
3481713e81bSScott Long  *            IDE Macro
3491713e81bSScott Long  ***************************************************************************/
3501713e81bSScott Long #ifndef MAX_LBA_T
3511713e81bSScott Long #define MAX_LBA_T ((LBA_T)-1)
3521713e81bSScott Long #endif
3531713e81bSScott Long 
3541713e81bSScott Long #define SECTOR_TO_BYTE_SHIFT 9
3551713e81bSScott Long #define SECTOR_TO_BYTE(x)  ((ULONG)(x) << SECTOR_TO_BYTE_SHIFT)
3561713e81bSScott Long 
3571713e81bSScott Long #define mGetStatus(IOPort2)           (UCHAR)InPort(&IOPort2->AlternateStatus)
3581713e81bSScott Long #define mUnitControl(IOPort2, Value)  OutPort(&IOPort2->AlternateStatus,(UCHAR)(Value))
3591713e81bSScott Long 
3601713e81bSScott Long #define mGetErrorCode(IOPort)         (UCHAR)InPort((PUCHAR)&IOPort->Data+1)
3611713e81bSScott Long #define mSetFeaturePort(IOPort,x)     OutPort((PUCHAR)&IOPort->Data+1, x)
3621713e81bSScott Long #define mSetBlockCount(IOPort,x)      OutPort(&IOPort->BlockCount, x)
3631713e81bSScott Long #define mGetBlockCount(IOPort)	      (UCHAR)InPort(&IOPort->BlockCount)
3641713e81bSScott Long #define mGetInterruptReason(IOPort)   (UCHAR)InPort(&IOPort->BlockCount)
3651713e81bSScott Long #define mSetBlockNumber(IOPort,x)     OutPort(&IOPort->BlockNumber, x)
3661713e81bSScott Long #define mGetBlockNumber(IOPort)       (UCHAR)InPort((PUCHAR)&IOPort->BlockNumber)
3671713e81bSScott Long #define mGetByteLow(IOPort)           (UCHAR)InPort(&IOPort->CylinderLow)
3681713e81bSScott Long #define mSetCylinderLow(IOPort,x)         OutPort(&IOPort->CylinderLow, x)
3691713e81bSScott Long #define mGetByteHigh(IOPort)          (UCHAR)InPort(&IOPort->CylinderHigh)
3701713e81bSScott Long #define mSetCylinderHigh(IOPort,x)    OutPort(&IOPort->CylinderHigh, x)
3711713e81bSScott Long #define mGetBaseStatus(IOPort)        (UCHAR)InPort(&IOPort->Command)
3721713e81bSScott Long #ifdef SUPPORT_HPT601
3731713e81bSScott Long #define mSelectUnit(IOPort,UnitId)  do {\
3741713e81bSScott Long 		OutPort(&IOPort->DriveSelect, (UCHAR)(UnitId));\
3751713e81bSScott Long 		OutPort(&IOPort->DriveSelect, (UCHAR)(UnitId));\
3761713e81bSScott Long 		} while (0)
3771713e81bSScott Long #else
3781713e81bSScott Long #define mSelectUnit(IOPort,UnitId)    OutPort(&IOPort->DriveSelect, (UCHAR)(UnitId))
3791713e81bSScott Long #endif
3801713e81bSScott Long #define mGetUnitNumber(IOPort)        InPort(&IOPort->DriveSelect)
3811713e81bSScott Long #define mIssueCommand(IOPort,Cmd)     OutPort(&IOPort->Command, (UCHAR)(Cmd))
3821713e81bSScott Long 
3831713e81bSScott Long /*
3841713e81bSScott Long  * WDC old disk, don't care right now
3851713e81bSScott Long  */
3861713e81bSScott Long #define WDC_MW1_FIX_FLAG_OFFSET        129
3871713e81bSScott Long #define WDC_MW1_FIX_FLAG_VALUE        0x00005555
3881713e81bSScott Long 
3891713e81bSScott Long #pragma pack()
3901713e81bSScott Long #endif
391