+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- Atapi.h\r
- \r
-Abstract: \r
- \r
-\r
-Revision History\r
---*/\r
-\r
-#ifndef _ATAPI_H\r
-#define _ATAPI_H\r
-\r
-#include "Tiano.h"\r
-\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
- UINT16 config; /* General Configuration */\r
- UINT16 cylinders; /* Number of Cylinders */\r
- UINT16 reserved_2;\r
- UINT16 heads; /* Number of logical heads */\r
- UINT16 vendor_data1;\r
- UINT16 vendoe_data2;\r
- UINT16 sectors_per_track;\r
- UINT16 vendor_specific_7_9[3];\r
- CHAR8 SerialNo[20]; /* ASCII */\r
- UINT16 vendor_specific_20_21[2];\r
- UINT16 ecc_bytes_available;\r
- CHAR8 FirmwareVer[8]; /* ASCII */\r
- CHAR8 ModelName[40]; /* ASCII */\r
- UINT16 multi_sector_cmd_max_sct_cnt;\r
- UINT16 reserved_48;\r
- UINT16 capabilities;\r
- UINT16 reserved_50;\r
- UINT16 pio_cycle_timing;\r
- UINT16 reserved_52;\r
- UINT16 field_validity;\r
- UINT16 current_cylinders;\r
- UINT16 current_heads;\r
- UINT16 current_sectors;\r
- UINT16 CurrentCapacityLsb;\r
- UINT16 CurrentCapacityMsb;\r
- UINT16 reserved_59;\r
- UINT16 user_addressable_sectors_lo;\r
- UINT16 user_addressable_sectors_hi;\r
- UINT16 reserved_62;\r
- UINT16 multi_word_dma_mode;\r
- UINT16 advanced_pio_modes;\r
- UINT16 min_multi_word_dma_cycle_time;\r
- UINT16 rec_multi_word_dma_cycle_time;\r
- UINT16 min_pio_cycle_time_without_flow_control;\r
- UINT16 min_pio_cycle_time_with_flow_control;\r
- UINT16 reserved_69_79[11];\r
- UINT16 major_version_no;\r
- UINT16 minor_version_no;\r
- UINT16 reserved_82_127[46];\r
- UINT16 security_status;\r
- UINT16 vendor_data_129_159[31];\r
- UINT16 reserved_160_255[96];\r
-} IDENTIFY;\r
-\r
-typedef struct {\r
- UINT8 peripheral_type;\r
- UINT8 RMB;\r
- UINT8 version;\r
- UINT8 response_data_format;\r
- UINT8 addnl_length;\r
- UINT8 reserved_5;\r
- UINT8 reserved_6;\r
- UINT8 reserved_7;\r
- UINT8 vendor_info[8];\r
- UINT8 product_id[12];\r
- UINT8 eeprom_product_code[4];\r
- UINT8 firmware_rev_level[4];\r
- UINT8 firmware_sub_rev_level[1];\r
- UINT8 reserved_37;\r
- UINT8 reserved_38;\r
- UINT8 reserved_39;\r
- UINT8 max_capacity_hi;\r
- UINT8 max_capacity_mid;\r
- UINT8 max_capacity_lo;\r
- UINT8 reserved_43_95[95 - 43 + 1];\r
- UINT8 vendor_id[20];\r
- UINT8 eeprom_drive_sno[12];\r
-} INQUIRY_DATA;\r
-\r
-typedef struct {\r
- UINT8 error_code : 7;\r
- UINT8 valid : 1;\r
- UINT8 reserved_1;\r
- UINT8 sense_key : 4;\r
- UINT8 reserved_21 : 1;\r
- UINT8 ILI : 1;\r
- UINT8 reserved_22 : 2;\r
- UINT8 vendor_specific_3;\r
- UINT8 vendor_specific_4;\r
- UINT8 vendor_specific_5;\r
- UINT8 vendor_specific_6;\r
- UINT8 addnl_sense_length; // n - 7\r
- UINT8 vendor_specific_8;\r
- UINT8 vendor_specific_9;\r
- UINT8 vendor_specific_10;\r
- UINT8 vendor_specific_11;\r
- UINT8 addnl_sense_code; // mandatory\r
- UINT8 addnl_sense_code_qualifier; // mandatory\r
- UINT8 field_replaceable_unit_code; // optional\r
- UINT8 reserved_15;\r
- UINT8 reserved_16;\r
- UINT8 reserved_17;\r
- //\r
- // Followed by additional sense bytes : FIXME\r
- //\r
-} REQUEST_SENSE_DATA;\r
-\r
-typedef struct {\r
- UINT8 LastLba3;\r
- UINT8 LastLba2;\r
- UINT8 LastLba1;\r
- UINT8 LastLba0;\r
- UINT8 BlockSize3;\r
- UINT8 BlockSize2;\r
- UINT8 BlockSize1;\r
- UINT8 BlockSize0;\r
-} READ_CAPACITY_DATA;\r
-\r
-typedef struct {\r
- UINT8 reserved_0;\r
- UINT8 reserved_1;\r
- UINT8 reserved_2;\r
- UINT8 Capacity_Length;\r
- UINT8 LastLba3;\r
- UINT8 LastLba2;\r
- UINT8 LastLba1;\r
- UINT8 LastLba0;\r
- UINT8 DesCode : 2;\r
- UINT8 reserved_9 : 6;\r
- UINT8 BlockSize2;\r
- UINT8 BlockSize1;\r
- UINT8 BlockSize0;\r
-} READ_FORMAT_CAPACITY_DATA;\r
-\r
-#pragma pack()\r
-//\r
-// ATAPI Command\r
-//\r
-#define ATAPI_SOFT_RESET_CMD 0x08\r
-#define PACKET_CMD 0xA0\r
-#define ATAPI_IDENTIFY_DEVICE_CMD 0xA1\r
-#define ATAPI_SERVICE_CMD 0xA2\r
-\r
-//\r
-// ATAPI Packet Command\r
-//\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
- UINT8 opcode;\r
- UINT8 reserved_1;\r
- UINT8 reserved_2;\r
- UINT8 reserved_3;\r
- UINT8 reserved_4;\r
- UINT8 reserved_5;\r
- UINT8 reserved_6;\r
- UINT8 reserved_7;\r
- UINT8 reserved_8;\r
- UINT8 reserved_9;\r
- UINT8 reserved_10;\r
- UINT8 reserved_11;\r
-} TEST_UNIT_READY_CMD;\r
-\r
-typedef struct {\r
- UINT8 opcode;\r
- UINT8 reserved_1 : 4;\r
- UINT8 lun : 4;\r
- UINT8 page_code;\r
- UINT8 reserved_3;\r
- UINT8 allocation_length;\r
- UINT8 reserved_5;\r
- UINT8 reserved_6;\r
- UINT8 reserved_7;\r
- UINT8 reserved_8;\r
- UINT8 reserved_9;\r
- UINT8 reserved_10;\r
- UINT8 reserved_11;\r
-} INQUIRY_CMD;\r
-\r
-typedef struct {\r
- UINT8 opcode;\r
- UINT8 reserved_1 : 4;\r
- UINT8 lun : 4;\r
- UINT8 reserved_2;\r
- UINT8 reserved_3;\r
- UINT8 allocation_length;\r
- UINT8 reserved_5;\r
- UINT8 reserved_6;\r
- UINT8 reserved_7;\r
- UINT8 reserved_8;\r
- UINT8 reserved_9;\r
- UINT8 reserved_10;\r
- UINT8 reserved_11;\r
-} REQUEST_SENSE_CMD;\r
-\r
-typedef struct {\r
- UINT8 opcode;\r
- UINT8 reserved_1 : 5;\r
- UINT8 lun : 3;\r
- UINT8 Lba0;\r
- UINT8 Lba1;\r
- UINT8 Lba2;\r
- UINT8 Lba3;\r
- UINT8 reserved_6;\r
- UINT8 TranLen0;\r
- UINT8 TranLen1;\r
- UINT8 reserved_9;\r
- UINT8 reserved_10;\r
- UINT8 reserved_11;\r
-} READ10_CMD;\r
-\r
-typedef struct {\r
- UINT8 opcode;\r
- UINT8 reserved_1;\r
- UINT8 reserved_2;\r
- UINT8 reserved_3;\r
- UINT8 reserved_4;\r
- UINT8 reserved_5;\r
- UINT8 reserved_6;\r
- UINT8 allocation_length_hi;\r
- UINT8 allocation_length_lo;\r
- UINT8 reserved_9;\r
- UINT8 reserved_10;\r
- UINT8 reserved_11;\r
-} READ_FORMAT_CAP_CMD;\r
-\r
-typedef struct {\r
- UINT8 peripheral_type;\r
- UINT8 RMB;\r
- UINT8 version;\r
- UINT8 response_data_format;\r
- UINT8 addnl_length;\r
- UINT8 reserved_5;\r
- UINT8 reserved_6;\r
- UINT8 reserved_7;\r
- UINT8 vendor_info[8];\r
- UINT8 product_id[12];\r
- UINT8 eeprom_product_code[4];\r
- UINT8 firmware_rev_level[4];\r
-} USB_INQUIRY_DATA;\r
-\r
-typedef union {\r
- UINT16 Data16[6];\r
- TEST_UNIT_READY_CMD TestUnitReady;\r
- READ10_CMD Read10;\r
- REQUEST_SENSE_CMD RequestSence;\r
- INQUIRY_CMD Inquiry;\r
- READ_FORMAT_CAP_CMD ReadFormatCapacity;\r
-} ATAPI_PACKET_COMMAND;\r
-\r
-#pragma pack()\r
-//\r
-// Packet Command Code\r
-//\r
-#define TEST_UNIT_READY 0x00\r
-#define REQUEST_SENSE 0x03\r
-#define INQUIRY 0x12\r
-#define READ_FORMAT_CAPACITY 0x23\r
-#define READ_CAPACITY 0x25\r
-#define READ_10 0x28\r
-\r
-#define DEFAULT_CTL (0x0a) // default content of device control register, disable INT\r
-#define DEFAULT_CMD (0xa0)\r
-\r
-#define MAX_ATAPI_BYTE_COUNT (0xfffe)\r
-\r
-//\r
-// Sense Key\r
-//\r
-#define REQUEST_SENSE_ERROR (0x70)\r
-#define SK_NO_SENSE (0x0)\r
-#define SK_RECOVERY_ERROR (0x1)\r
-#define SK_NOT_READY (0x2)\r
-#define SK_MEDIUM_ERROR (0x3)\r
-#define SK_HARDWARE_ERROR (0x4)\r
-#define SK_ILLEGAL_REQUEST (0x5)\r
-#define SK_UNIT_ATTENTION (0x6)\r
-#define SK_DATA_PROTECT (0x7)\r
-#define SK_BLANK_CHECK (0x8)\r
-#define SK_VENDOR_SPECIFIC (0x9)\r
-#define SK_RESERVED_A (0xA)\r
-#define SK_ABORT (0xB)\r
-#define SK_RESERVED_C (0xC)\r
-#define SK_OVERFLOW (0xD)\r
-#define SK_MISCOMPARE (0xE)\r
-#define SK_RESERVED_F (0xF)\r
-\r
-//\r
-// Additional Sense Codes\r
-//\r
-#define ASC_NOT_READY (0x04)\r
-#define ASC_MEDIA_ERR1 (0x10)\r
-#define ASC_MEDIA_ERR2 (0x11)\r
-#define ASC_MEDIA_ERR3 (0x14)\r
-#define ASC_MEDIA_ERR4 (0x30)\r
-#define ASC_MEDIA_UPSIDE_DOWN (0x06)\r
-#define ASC_INVALID_CMD (0x20)\r
-#define ASC_LBA_OUT_OF_RANGE (0x21)\r
-#define ASC_INVALID_FIELD (0x24)\r
-#define ASC_WRITE_PROTECTED (0x27)\r
-#define ASC_MEDIA_CHANGE (0x28)\r
-#define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */\r
-#define ASC_ILLEGAL_FIELD (0x26)\r
-#define ASC_NO_MEDIA (0x3A)\r
-#define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)\r
-\r
-//\r
-// Additional Sense Code Qualifier\r
-//\r
-#define ASCQ_IN_PROGRESS (0x01)\r
-\r
-#endif\r