--- /dev/null
+/** @file\r
+ This file declares EFI IDE Controller Init Protocol\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. 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: IdeControllerInit.h\r
+\r
+ @par Revision Reference:\r
+ This Protocol is defined in IDE Controller Initialization Protocol Specification\r
+ Version 0.9\r
+\r
+**/\r
+\r
+#ifndef _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H\r
+#define _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H\r
+\r
+//\r
+// Global ID for the EFI Platform IDE Protocol GUID\r
+//\r
+#define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \\r
+ { 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 } }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL EFI_IDE_CONTROLLER_INIT_PROTOCOL;\r
+\r
+//\r
+//////////////////////////////////////////////////////////////////////////////////////////\r
+// EFI_IDE_BUS_ENUMERATION_PHASE\r
+// EFI_IDE_CONTROLLER_ENUM_PHASE\r
+//\r
+typedef enum{\r
+ EfiIdeBeforeChannelEnumeration,\r
+ EfiIdeAfterChannelEnumeration,\r
+ EfiIdeBeforeChannelReset,\r
+ EfiIdeAfterChannelReset,\r
+ EfiIdeBusBeforeDevicePresenceDetection,\r
+ EfiIdeBusAfterDevicePresenceDetection,\r
+ EfiIdeResetMode,\r
+ EfiIdeBusPhaseMaximum\r
+} EFI_IDE_CONTROLLER_ENUM_PHASE;\r
+\r
+//\r
+//******************************************************\r
+// EFI_ATA_EXT_TRANSFER_PROTOCOL\r
+//******************************************************\r
+//\r
+// This extended mode describes the SATA physical protocol.\r
+// SATA physical layers can operate at different speeds. \r
+// These speeds are defined below. Various PATA protocols \r
+// and associated modes are not applicable to SATA devices.\r
+//\r
+\r
+typedef enum {\r
+ EfiAtaSataTransferProtocol \r
+} EFI_ATA_EXT_TRANSFER_PROTOCOL;\r
+\r
+#define EFI_SATA_AUTO_SPEED 0\r
+#define EFI_SATA_GEN1_SPEED 1\r
+#define EFI_SATA_GEN2_SPEED 2\r
+\r
+//\r
+//*******************************************************\r
+// EFI_IDE_CABLE_TYPE\r
+//*******************************************************\r
+//\r
+typedef enum {\r
+ EfiIdeCableTypeUnknown,\r
+ EfiIdeCableType40pin,\r
+ EfiIdeCableType80Pin,\r
+ EfiIdeCableTypeSerial,\r
+ EfiIdeCableTypeMaximum\r
+} EFI_IDE_CABLE_TYPE;\r
+\r
+//\r
+//******************************************************\r
+// EFI_ATA_MODE\r
+//******************************************************\r
+//\r
+typedef struct {\r
+ BOOLEAN Valid;\r
+ UINT32 Mode; \r
+} EFI_ATA_MODE;\r
+\r
+//\r
+//******************************************************\r
+// EFI_ATA_EXTENDED_MODE\r
+//******************************************************\r
+//\r
+typedef struct {\r
+ EFI_ATA_EXT_TRANSFER_PROTOCOL TransferProtocol;\r
+ UINT32 Mode;\r
+} EFI_ATA_EXTENDED_MODE;\r
+\r
+//\r
+//******************************************************\r
+// EFI_ATA_COLLECTIVE_MODE\r
+//******************************************************\r
+//\r
+typedef struct {\r
+ EFI_ATA_MODE PioMode; \r
+ EFI_ATA_MODE SingleWordDmaMode;\r
+ EFI_ATA_MODE MultiWordDmaMode;\r
+ EFI_ATA_MODE UdmaMode;\r
+ UINT32 ExtModeCount;\r
+ EFI_ATA_EXTENDED_MODE ExtMode[1]; \r
+} EFI_ATA_COLLECTIVE_MODE;\r
+\r
+//\r
+//*******************************************************\r
+// EFI_ATA_IDENTIFY_DATA\r
+//*******************************************************\r
+//\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 vendor_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 command_set_supported_82; // word 82\r
+ UINT16 command_set_supported_83; // word 83\r
+ UINT16 command_set_feature_extn; // word 84\r
+ UINT16 command_set_feature_enb_85; // word 85\r
+ UINT16 command_set_feature_enb_86; // word 86\r
+ UINT16 command_set_feature_default; // word 87\r
+ UINT16 ultra_dma_mode; // word 88\r
+ UINT16 reserved_89_127[39];\r
+ UINT16 security_status;\r
+ UINT16 vendor_data_129_159[31];\r
+ UINT16 reserved_160_255[96];\r
+} EFI_ATA_IDENTIFY_DATA;\r
+\r
+#pragma pack()\r
+//\r
+//*******************************************************\r
+// EFI_ATAPI_IDENTIFY_DATA\r
+//*******************************************************\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT16 config; // General Configuration\r
+ UINT16 obsolete_1;\r
+ UINT16 specific_config;\r
+ UINT16 obsolete_3; \r
+ UINT16 retired_4_5[2];\r
+ UINT16 obsolete_6; \r
+ UINT16 cfa_reserved_7_8[2];\r
+ UINT16 retired_9;\r
+ CHAR8 SerialNo[20]; // ASCII \r
+ UINT16 retired_20_21[2];\r
+ UINT16 obsolete_22;\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_49;\r
+ UINT16 capabilities_50;\r
+ UINT16 obsolete_51_52[2]; \r
+ UINT16 field_validity;\r
+ UINT16 obsolete_54_58[5];\r
+ UINT16 mutil_sector_setting;\r
+ UINT16 user_addressable_sectors_lo;\r
+ UINT16 user_addressable_sectors_hi;\r
+ UINT16 obsolete_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_74[6];\r
+ UINT16 queue_depth;\r
+ UINT16 reserved_76_79[4];\r
+ UINT16 major_version_no;\r
+ UINT16 minor_version_no;\r
+ UINT16 cmd_set_support_82;\r
+ UINT16 cmd_set_support_83;\r
+ UINT16 cmd_feature_support;\r
+ UINT16 cmd_feature_enable_85;\r
+ UINT16 cmd_feature_enable_86;\r
+ UINT16 cmd_feature_default;\r
+ UINT16 ultra_dma_select;\r
+ UINT16 time_required_for_sec_erase;\r
+ UINT16 time_required_for_enhanced_sec_erase;\r
+ UINT16 current_advanced_power_mgmt_value;\r
+ UINT16 master_pwd_revison_code;\r
+ UINT16 hardware_reset_result;\r
+ UINT16 current_auto_acoustic_mgmt_value;\r
+ UINT16 reserved_95_99[5];\r
+ UINT16 max_user_lba_for_48bit_addr[4];\r
+ UINT16 reserved_104_126[23];\r
+ UINT16 removable_media_status_notification_support;\r
+ UINT16 security_status;\r
+ UINT16 vendor_data_129_159[31];\r
+ UINT16 cfa_power_mode;\r
+ UINT16 cfa_reserved_161_175[15];\r
+ UINT16 current_media_serial_no[30];\r
+ UINT16 reserved_206_254[49];\r
+ UINT16 integrity_word;\r
+} EFI_ATAPI_IDENTIFY_DATA;\r
+\r
+#pragma pack()\r
+//\r
+//*******************************************************\r
+// EFI_IDENTIFY_DATA\r
+//*******************************************************\r
+//\r
+typedef union {\r
+ EFI_ATA_IDENTIFY_DATA AtaData;\r
+ EFI_ATAPI_IDENTIFY_DATA AtapiData;\r
+} EFI_IDENTIFY_DATA; \r
+\r
+#define EFI_ATAPI_DEVICE_IDENTIFY_DATA 0x8000\r
+\r
+//\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+// Function prototype declaration, for ANSI compatability\r
+//\r
+/**\r
+ Returns the information about the specified IDE channel. \r
+\r
+ @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
+ @param Channel Zero-based channel number.\r
+ @param Enabled TRUE if this channel is enabled. Disabled channels are not scanned\r
+ to see if any devices are present.\r
+ @param MaxDevices The maximum number of IDE devices that the bus driver\r
+ can expect on this channel.\r
+\r
+ @retval EFI_SUCCESS Information was returned without any errors.\r
+ @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IDE_CONTROLLER_GET_CHANNEL_INFO) (\r
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
+ IN UINT8 Channel, \r
+ OUT BOOLEAN *Enabled,\r
+ OUT UINT8 *MaxDevices\r
+);\r
+\r
+/**\r
+ The notifications from the IDE bus driver that it is about to enter a certain \r
+ phase of the IDE channel enumeration process. \r
+\r
+ @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
+ @param Phase The phase during enumeration.\r
+ @param Channel Zero-based channel number.\r
+\r
+ @retval EFI_SUCCESS The notification was accepted without any errors.\r
+ @retval EFI_NOT_SUPPORTED Phase is not supported.\r
+ @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
+ @retval EFI_NOT_READY This phase cannot be entered at this time.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IDE_CONTROLLER_NOTIFY_PHASE) (\r
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
+ IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,\r
+ IN UINT8 Channel\r
+);\r
+\r
+/**\r
+ Submits the device information to the IDE controller driver. \r
+\r
+ @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
+ @param Channel Zero-based channel number.\r
+ @param Device Zero-based device number on the Channel.\r
+ @param IdentifyData The device's response to the ATA IDENTIFY_DEVICE command.\r
+\r
+ @retval EFI_SUCCESS The information was accepted without any errors.\r
+ @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
+ Or Device is invalid.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IDE_CONTROLLER_SUBMIT_DATA) (\r
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
+ IN UINT8 Channel,\r
+ IN UINT8 Device,\r
+ IN EFI_IDENTIFY_DATA *IdentifyData\r
+);\r
+\r
+/**\r
+ Disqualifies specific modes for an IDE device. \r
+\r
+ @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
+ @param Channel Zero-based channel number.\r
+ @param Device Zero-based device number on the Channel.\r
+ @param BadModes The modes that the device does not support and that\r
+ should be disqualified.\r
+\r
+ @retval EFI_SUCCESS The modes were accepted without any errors.\r
+ @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
+ Or Device is invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IDE_CONTROLLER_DISQUALIFY_MODE) (\r
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
+ IN UINT8 Channel,\r
+ IN UINT8 Device,\r
+ IN EFI_ATA_COLLECTIVE_MODE *BadModes\r
+);\r
+\r
+/**\r
+ Returns the information about the optimum modes for the specified IDE device.\r
+\r
+ @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
+ @param Channel Zero-based channel number.\r
+ @param Device Zero-based device number on the Channel.\r
+ @param SupportedModes The optimum modes for the device.\r
+\r
+ @retval EFI_SUCCESS SupportedModes was returned.\r
+ @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
+ Or Device is invalid. Or SupportedModes is NULL.\r
+ @retval EFI_NOT_READY Modes cannot be calculated due to a lack of data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IDE_CONTROLLER_CALCULATE_MODE) (\r
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
+ IN UINT8 Channel,\r
+ IN UINT8 Device,\r
+ OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes\r
+);\r
+\r
+/**\r
+ Commands the IDE controller driver to program the IDE controller hardware \r
+ so that the specified device can operate at the specified mode. \r
+\r
+ @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
+ @param Channel Zero-based channel number.\r
+ @param Device Zero-based device number on the Channel.\r
+ @param Modes The modes to set.\r
+\r
+ @retval EFI_SUCCESS The command was accepted without any errors.\r
+ @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
+ Or Device is invalid.\r
+ @retval EFI_NOT_READY Modes cannot be set at this time due to lack of data.\r
+ @retval EFI_DEVICE_ERROR Modes cannot be set due to hardware failure.\r
+ The IDE bus driver should not use this device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IDE_CONTROLLER_SET_TIMING) (\r
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
+ IN UINT8 Channel,\r
+ IN UINT8 Device,\r
+ IN EFI_ATA_COLLECTIVE_MODE *Modes\r
+);\r
+\r
+//\r
+////////////////////////////////////////////////////////////////////////////////////////////////////\r
+// Interface structure \r
+// EFI_IDE_CONTROLLER_INIT_PROTOCOL protocol provides the chipset specific information to the IDE bus driver.\r
+// An IDE Bus driver wants to manage an IDE bus and possible IDE devices will have to retrieve the \r
+// EFI_IDE_CONTROLLER_INIT_PROTOCOL instances.\r
+//\r
+/**\r
+ @par Protocol Description:\r
+ Provides the basic interfaces to abstract an IDE controller.\r
+\r
+ @param GetChannelInfo\r
+ Returns the information about a specific channel. \r
+\r
+ @param NotifyPhase\r
+ The notification that the IDE bus driver is about to enter the \r
+ specified phase during the enumeration process. \r
+\r
+ @param SubmitData \r
+ Submits the Drive Identify data that was returned by the device. \r
+\r
+ @param DisqualifyMode \r
+ Submits information about modes that should be disqualified. \r
+\r
+ @param CalculateMode \r
+ Calculates and returns the optimum mode for a particular IDE device.\r
+\r
+ @param SetTiming \r
+ Programs the IDE controller hardware to the default timing or per the modes \r
+ that were returned by the last call to CalculateMode().\r
+\r
+ @param EnumAll \r
+ Set to TRUE if the enumeration group includes all the channels that are \r
+ produced by this controller. FALSE if an enumeration group consists of \r
+ only one channel. \r
+\r
+ @param ChannelCount\r
+ The number of channels that are produced by this controller.\r
+\r
+**/\r
+struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL {\r
+ EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo;\r
+ EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase;\r
+ EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData;\r
+ EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode;\r
+ EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode;\r
+ EFI_IDE_CONTROLLER_SET_TIMING SetTiming;\r
+ BOOLEAN EnumAll;\r
+ UINT8 ChannelCount; \r
+};\r
+\r
+extern EFI_GUID gEfiIdeControllerInitProtocolGuid;\r
+\r
+#endif\r
+\r
+\r