]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h
IntelFrameworkModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBusDxe / Ide.h
index f2cc9df4543e18d7e169f400c301cd1fd66075f4..b4e9342f70a6acb45bc4031af26c7df2fd3f35f1 100644 (file)
@@ -1,15 +1,9 @@
 /** @file\r
   Header file for IDE Bus Driver, containing the helper functions'\r
-  entire prototype.\r
+  prototype.\r
 \r
-  Copyright (c) 2006 - 2007 Intel Corporation. <BR>\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
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
   @par Revision Reference:\r
   2002-6: Add Atapi6 enhancement, support >120GB hard disk, including\r
 // Helper functions Prototype\r
 //\r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  This TODO: add argument description\r
-  @param  Controller TODO: add argument description\r
-  @param  Handle TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-DeRegisterIdeDevice (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN  EFI_HANDLE                     Controller,\r
-  IN  EFI_HANDLE                     Handle\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
+  read a one-byte data from a IDE port.\r
 \r
-  @param  Controller TODO: add argument description\r
-  @param  PciIo TODO: add argument description\r
-  @param  ParentDevicePath TODO: add argument description\r
-  @param  RemainingDevicePath TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-EnableIdeDevice (\r
-  IN EFI_HANDLE                          Controller,\r
-  IN EFI_PCI_IO_PROTOCOL                 *PciIo,\r
-  IN EFI_DEVICE_PATH_PROTOCOL            *ParentDevicePath,\r
-  IN EFI_DEVICE_PATH_PROTOCOL            *RemainingDevicePath\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  PciIo TODO: add argument description\r
-  @param  Port TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param  PciIo  The PCI IO protocol instance\r
+  @param  Port   the IDE Port number\r
 \r
+  return  the one-byte data read from IDE port\r
 **/\r
 UINT8\r
 IDEReadPortB (\r
@@ -76,14 +33,14 @@ IDEReadPortB (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Reads multiple words of data from the IDE data port.\r
+  Call the IO abstraction once to do the complete read,\r
+  not one word at a time.\r
 \r
-  @param  PciIo TODO: add argument description\r
-  @param  Port TODO: add argument description\r
-  @param  Count TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param  PciIo Pointer to the EFI_PCI_IO instance\r
+  @param  Port IO port to read\r
+  @param  Count No. of UINT16's to read\r
+  @param  Buffer Pointer to the data buffer for read\r
 \r
 **/\r
 VOID\r
@@ -95,14 +52,11 @@ IDEReadPortWMultiple (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  PciIo TODO: add argument description\r
-  @param  Port TODO: add argument description\r
-  @param  Data TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  write a 1-byte data to a specific IDE port.\r
 \r
+  @param  PciIo  PCI IO protocol instance\r
+  @param  Port   The IDE port to be writen\r
+  @param  Data   The data to write to the port\r
 **/\r
 VOID\r
 IDEWritePortB (\r
@@ -112,14 +66,11 @@ IDEWritePortB (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  PciIo TODO: add argument description\r
-  @param  Port TODO: add argument description\r
-  @param  Data TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  write a 1-word data to a specific IDE port.\r
 \r
+  @param  PciIo  PCI IO protocol instance\r
+  @param  Port   The IDE port to be writen\r
+  @param  Data   The data to write to the port\r
 **/\r
 VOID\r
 IDEWritePortW (\r
@@ -129,14 +80,14 @@ IDEWritePortW (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Write multiple words of data to the IDE data port.\r
+  Call the IO abstraction once to do the complete read,\r
+  not one word at a time.\r
 \r
-  @param  PciIo TODO: add argument description\r
-  @param  Port TODO: add argument description\r
-  @param  Count TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param  PciIo Pointer to the EFI_PCI_IO instance\r
+  @param  Port IO port to read\r
+  @param  Count No. of UINT16's to read\r
+  @param  Buffer Pointer to the data buffer for read\r
 \r
 **/\r
 VOID\r
@@ -148,12 +99,58 @@ IDEWritePortWMultiple (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,\r
+  use fixed addresses. In Native-PCI mode, get base addresses from BARs in\r
+  the PCI IDE controller's Configuration Space.\r
+\r
+  The steps to get IDE IO port registers' base addresses for each channel\r
+  as follows:\r
+\r
+  1. Examine the Programming Interface byte of the Class Code fields in PCI IDE\r
+  controller's Configuration Space to determine the operating mode.\r
+\r
+  2. a) In 'Compatibility' mode, use fixed addresses shown in the Table 1 below.\r
+  <pre>\r
+  ___________________________________________\r
+  |           | Command Block | Control Block |\r
+  |  Channel  |   Registers   |   Registers   |\r
+  |___________|_______________|_______________|\r
+  |  Primary  |  1F0h - 1F7h  |  3F6h - 3F7h  |\r
+  |___________|_______________|_______________|\r
+  | Secondary |  170h - 177h  |  376h - 377h  |\r
+  |___________|_______________|_______________|\r
+\r
+  Table 1. Compatibility resource mappings\r
+  </pre>\r
+\r
+  b) In Native-PCI mode, IDE registers are mapped into IO space using the BARs\r
+  in IDE controller's PCI Configuration Space, shown in the Table 2 below.\r
+  <pre>\r
+  ___________________________________________________\r
+  |           |   Command Block   |   Control Block   |\r
+  |  Channel  |     Registers     |     Registers     |\r
+  |___________|___________________|___________________|\r
+  |  Primary  | BAR at offset 0x10| BAR at offset 0x14|\r
+  |___________|___________________|___________________|\r
+  | Secondary | BAR at offset 0x18| BAR at offset 0x1C|\r
+  |___________|___________________|___________________|\r
 \r
-  @param  PciIo TODO: add argument description\r
-  @param  IdeRegsBaseAddr TODO: add argument description\r
+  Table 2. BARs for Register Mapping\r
+  </pre>\r
+  @note Refer to Intel ICH4 datasheet, Control Block Offset: 03F4h for\r
+  primary, 0374h for secondary. So 2 bytes extra offset should be\r
+  added to the base addresses read from BARs.\r
 \r
-  TODO: add return values.\r
+  For more details, please refer to PCI IDE Controller Specification and Intel\r
+  ICH4 Datasheet.\r
+\r
+  @param  PciIo Pointer to the EFI_PCI_IO_PROTOCOL instance\r
+  @param  IdeRegsBaseAddr Pointer to IDE_REGISTERS_BASE_ADDR to\r
+          receive IDE IO port registers' base addresses\r
+\r
+  @retval EFI_UNSUPPORTED return this value when the BARs is not IO type\r
+  @retval EFI_SUCCESS     Get the Base address successfully\r
+  @retval other           read the pci configureation data error\r
 \r
 **/\r
 EFI_STATUS\r
@@ -163,11 +160,16 @@ GetIdeRegistersBaseAddr (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to requery IDE resources. The IDE controller will\r
+  probably switch between native and legacy modes during the EFI->CSM->OS\r
+  transfer. We do this everytime before an BlkIo operation to ensure its\r
+  succeess.\r
 \r
-  @param  IdeDev TODO: add argument description\r
+  @param  IdeDev The BLK_IO private data which specifies the IDE device\r
 \r
-  TODO: add return values.\r
+  @retval EFI_INVALID_PARAMETER return this value when the channel is invalid\r
+  @retval EFI_SUCCESS           reassign the IDE IO resource successfully\r
+  @retval other                 get the IDE current base address effor\r
 \r
 **/\r
 EFI_STATUS\r
@@ -176,11 +178,12 @@ ReassignIdeResources (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Detect if there is disk attached to this port.\r
 \r
-  @param  IdeDev TODO: add argument description\r
+  @param  IdeDev The BLK_IO private data which specifies the IDE device.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_NOT_FOUND   The device or channel is not found\r
+  @retval EFI_SUCCESS     The device is found\r
 \r
 **/\r
 EFI_STATUS\r
@@ -192,34 +195,27 @@ DiscoverIdeDevice (
   This interface is used to initialize all state data related to the\r
   detection of one channel.\r
 \r
-  @retval EFI_SUCCESS Completed successfully.\r
-\r
 **/\r
-EFI_STATUS\r
+VOID\r
 InitializeIDEChannelData (\r
   VOID\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the DRQ bit clear in the Status\r
+  Register. DRQ is cleared when the device is finished transferring data.\r
+  So this function is called after data transfer is finished.\r
 \r
-  @param  IdeDev TODO: add argument description\r
+  @param IdeDev                 pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                                to record all the information of the IDE device.\r
+  @param TimeoutInMilliSeconds  used to designate the timeout for the DRQ clear.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS           DRQ bit clear within the time out.\r
 \r
-**/\r
-EFI_STATUS\r
-DetectIDEController (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
+  @retval EFI_TIMEOUT           DRQ bit not clear within the time out.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  TimeoutInMilliSeconds TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @note\r
+  Read Status Register will clear interrupt status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -229,12 +225,21 @@ DRQClear (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the DRQ bit clear in the Alternate\r
+  Status Register. DRQ is cleared when the device is finished\r
+  transferring data. So this function is called after data transfer\r
+  is finished.\r
+\r
+  @param IdeDev                pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                               to record all the information of the IDE device.\r
+\r
+  @param TimeoutInMilliSeconds used to designate the timeout for the DRQ clear.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  TimeoutInMilliSeconds TODO: add argument description\r
+  @retval EFI_SUCCESS          DRQ bit clear within the time out.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_TIMEOUT          DRQ bit not clear within the time out.\r
+  @note\r
+  Read Alternate Status Register will not clear interrupt status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -244,12 +249,21 @@ DRQClear2 (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the DRQ bit set in the\r
+  Status Register.\r
+  DRQ is set when the device is ready to transfer data. So this function\r
+  is called after the command is sent to the device and before required\r
+  data is transferred.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  TimeoutInMilliSeconds TODO: add argument description\r
+  @param IdeDev                pointer pointing to IDE_BLK_IO_DEV data structure,used to\r
+                               record all the information of the IDE device.\r
+  @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS          DRQ bit set within the time out.\r
+  @retval EFI_TIMEOUT          DRQ bit not set within the time out.\r
+  @retval EFI_ABORTED          DRQ bit not set caused by the command abort.\r
+\r
+  @note  Read Status Register will clear interrupt status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -259,12 +273,19 @@ DRQReady (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the DRQ bit set in the Alternate Status Register.\r
+  DRQ is set when the device is ready to transfer data. So this function is called after\r
+  the command is sent to the device and before required data is transferred.\r
+\r
+  @param IdeDev                pointer pointing to IDE_BLK_IO_DEV data structure, used to\r
+                               record all the information of the IDE device.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  TimeoutInMilliSeconds TODO: add argument description\r
+  @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS           DRQ bit set within the time out.\r
+  @retval EFI_TIMEOUT           DRQ bit not set within the time out.\r
+  @retval EFI_ABORTED           DRQ bit not set caused by the command abort.\r
+  @note  Read Alternate Status Register will not clear interrupt status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -274,13 +295,17 @@ DRQReady2 (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the BSY bit clear in the Status Register. BSY\r
+  is clear when the device is not busy. Every command must be sent after device is not busy.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  TimeoutInMilliSeconds TODO: add argument description\r
+  @param IdeDev                pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                               to record all the information of the IDE device.\r
+  @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS          BSY bit clear within the time out.\r
+  @retval EFI_TIMEOUT          BSY bit not clear within the time out.\r
 \r
+  @note Read Status Register will clear interrupt status.\r
 **/\r
 EFI_STATUS\r
 WaitForBSYClear (\r
@@ -289,12 +314,17 @@ WaitForBSYClear (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the BSY bit clear in the Alternate Status Register.\r
+  BSY is clear when the device is not busy. Every command must be sent after device is\r
+  not busy.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  TimeoutInMilliSeconds TODO: add argument description\r
+  @param IdeDev               pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
+                              all the information of the IDE device.\r
+  @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS         BSY bit clear within the time out.\r
+  @retval EFI_TIMEOUT         BSY bit not clear within the time out.\r
+  @note   Read Alternate Status Register will not clear interrupt status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -304,13 +334,18 @@ WaitForBSYClear2 (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the DRDY bit set in the Status Register. DRDY\r
+  bit is set when the device is ready to accept command. Most ATA commands must be\r
+  sent after DRDY set except the ATAPI Packet Command.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  DelayInMilliSeconds TODO: add argument description\r
+  @param IdeDev               pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                              to record all the information of the IDE device.\r
+  @param DelayInMilliSeconds  used to designate the timeout for the DRQ ready.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS         DRDY bit set within the time out.\r
+  @retval EFI_TIMEOUT         DRDY bit not set within the time out.\r
 \r
+  @note  Read Status Register will clear interrupt status.\r
 **/\r
 EFI_STATUS\r
 DRDYReady (\r
@@ -319,12 +354,18 @@ DRDYReady (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to poll for the DRDY bit set in the Alternate Status Register.\r
+  DRDY bit is set when the device is ready to accept command. Most ATA commands must\r
+  be sent after DRDY set except the ATAPI Packet Command.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  DelayInMilliSeconds TODO: add argument description\r
+  @param IdeDev              pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                             to record all the information of the IDE device.\r
+  @param DelayInMilliSeconds used to designate the timeout for the DRQ ready.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS      DRDY bit set within the time out.\r
+  @retval EFI_TIMEOUT      DRDY bit not set within the time out.\r
+\r
+  @note  Read Alternate Status Register will clear interrupt status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -333,32 +374,26 @@ DRDYReady2 (
   IN  UINTN           DelayInMilliSeconds\r
   );\r
 \r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  Destination TODO: add argument description\r
-  @param  Source TODO: add argument description\r
-  @param  Size TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-VOID\r
-SwapStringChars (\r
-  IN CHAR8  *Destination,\r
-  IN CHAR8  *Source,\r
-  IN UINT32 Size\r
-  );\r
-\r
 //\r
 //  ATA device functions' prototype\r
 //\r
 /**\r
-  TODO: Add function description\r
+  Sends out an ATA Identify Command to the specified device.\r
 \r
-  @param  IdeDev TODO: add argument description\r
+  This function is called by DiscoverIdeDevice() during its device\r
+  identification. It sends out the ATA Identify Command to the\r
+  specified device. Only ATA device responses to this command. If\r
+  the command succeeds, it returns the Identify data structure which\r
+  contains information about the device. This function extracts the\r
+  information it needs to fill the IDE_BLK_IO_DEV data structure,\r
+  including device type, media block size, media capacity, and etc.\r
 \r
-  TODO: add return values.\r
+  @param IdeDev  pointer pointing to IDE_BLK_IO_DEV data structure,used to record\r
+                 all the information of the IDE device.\r
+\r
+  @retval EFI_SUCCESS      Identify ATA device successfully.\r
+  @retval EFI_DEVICE_ERROR ATA Identify Device Command failed or device is not ATA device.\r
+  @note  parameter IdeDev will be updated in this function.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -367,32 +402,31 @@ ATAIdentify (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  This function is called by ATAIdentify() or ATAPIIdentify() to print device's module name.\r
 \r
+  @param  IdeDev   pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
+                   all the information of the IDE device.\r
 **/\r
 VOID\r
 PrintAtaModuleName (\r
   IN  IDE_BLK_IO_DEV  *IdeDev\r
   );\r
-\r
 /**\r
-  TODO: Add function description\r
+  This function is used to send out ATA commands conforms to the PIO Data In Protocol.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  Head TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-  @param  SectorNumber TODO: add argument description\r
-  @param  CylinderLsb TODO: add argument description\r
-  @param  CylinderMsb TODO: add argument description\r
+  @param IdeDev       pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
+                      all the information of the IDE device.\r
+  @param Buffer       buffer contained data transferred from device to host.\r
+  @param ByteCount    data size in byte unit of the buffer.\r
+  @param AtaCommand   value of the Command Register\r
+  @param Head         value of the Head/Device Register\r
+  @param SectorCount  value of the Sector Count Register\r
+  @param SectorNumber value of the Sector Number Register\r
+  @param CylinderLsb  value of the low byte of the Cylinder Register\r
+  @param CylinderMsb  value of the high byte of the Cylinder Register\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS      send out the ATA command and device send required data successfully.\r
+  @retval EFI_DEVICE_ERROR command sent failed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -409,19 +443,23 @@ AtaPioDataIn (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to send out ATA commands conforms to the\r
+  PIO Data Out Protocol.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  Head TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-  @param  SectorNumber TODO: add argument description\r
-  @param  CylinderLsb TODO: add argument description\r
-  @param  CylinderMsb TODO: add argument description\r
+  @param IdeDev       pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                      to record all the information of the IDE device.\r
+  @param *Buffer      buffer contained data transferred from host to device.\r
+  @param ByteCount    data size in byte unit of the buffer.\r
+  @param AtaCommand   value of the Command Register\r
+  @param Head         value of the Head/Device Register\r
+  @param SectorCount  value of the Sector Count Register\r
+  @param SectorNumber value of the Sector Number Register\r
+  @param CylinderLsb  value of the low byte of the Cylinder Register\r
+  @param CylinderMsb  value of the high byte of the Cylinder Register\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS      send out the ATA command and device received required\r
+                           data successfully.\r
+  @retval EFI_DEVICE_ERROR command sent failed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -438,11 +476,15 @@ AtaPioDataOut (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to analyze the Status Register and print out\r
+  some debug information and if there is ERR bit set in the Status\r
+  Register, the Error Register's value is also be parsed and print out.\r
 \r
-  @param  IdeDev TODO: add argument description\r
+  @param IdeDev  pointer pointing to IDE_BLK_IO_DEV data structure, used to\r
+                 record all the information of the IDE device.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS       No err information in the Status Register.\r
+  @retval EFI_DEVICE_ERROR  Any err information in the Status Register.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -451,50 +493,23 @@ CheckErrorStatus (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to implement the Soft Reset on the specified device. But,\r
+  the ATA Soft Reset mechanism is so strong a reset method that it will force\r
+  resetting on both devices connected to the same cable.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  Lba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
+  It is called by IdeBlkIoReset(), a interface function of Block\r
+  I/O protocol.\r
 \r
-  TODO: add return values.\r
+  This function can also be used by the ATAPI device to perform reset when\r
+  ATAPI Reset command is failed.\r
 \r
-**/\r
-EFI_STATUS\r
-AtaReadSectors (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         Lba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  BufferData TODO: add argument description\r
-  @param  Lba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaWriteSectors (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *BufferData,\r
-  IN  EFI_LBA         Lba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param IdeDev  pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
+                 all the information of the IDE device.\r
+  @retval EFI_SUCCESS       Soft reset completes successfully.\r
+  @retval EFI_DEVICE_ERROR  Any step during the reset process is failed.\r
 \r
+  @note  The registers initial values after ATA soft reset are different\r
+         to the ATA device and ATAPI device.\r
 **/\r
 EFI_STATUS\r
 AtaSoftReset (\r
@@ -502,243 +517,128 @@ AtaSoftReset (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is the ATA implementation for ReadBlocks in the\r
+  Block I/O Protocol interface.\r
+\r
+  @param IdeBlkIoDevice Indicates the calling context.\r
+  @param MediaId        The media id that the read request is for.\r
+  @param Lba            The starting logical block address to read from on the device.\r
+  @param BufferSize     The size of the Buffer in bytes. This must be a  multiple\r
+                        of the intrinsic block size of the device.\r
+\r
+  @param Buffer         A pointer to the destination buffer for the data. The caller\r
+                        is responsible for either having implicit or explicit ownership\r
+                        of the memory that data is read into.\r
 \r
-  @param  IdeBlkIoDevice TODO: add argument description\r
-  @param  MediaId TODO: add argument description\r
-  @param  LBA TODO: add argument description\r
-  @param  BufferSize TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
+  @retval EFI_SUCCESS          Read Blocks successfully.\r
+  @retval EFI_DEVICE_ERROR     Read Blocks failed.\r
+  @retval EFI_NO_MEDIA         There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGE     The MediaId is not for the current media.\r
+  @retval EFI_BAD_BUFFER_SIZE  The BufferSize parameter is not a multiple of the\r
+                               intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The read request contains LBAs that are not valid,\r
+                                 or the data buffer is not valid.\r
 \r
-  TODO: add return values.\r
+  @note If Read Block error because of device error, this function will call\r
+        AtaSoftReset() function to reset device.\r
 \r
 **/\r
 EFI_STATUS\r
 AtaBlkIoReadBlocks (\r
   IN IDE_BLK_IO_DEV   *IdeBlkIoDevice,\r
   IN UINT32           MediaId,\r
-  IN EFI_LBA          LBA,\r
+  IN EFI_LBA          Lba,\r
   IN UINTN            BufferSize,\r
   OUT VOID            *Buffer\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is the ATA implementation for WriteBlocks in the\r
+  Block I/O Protocol interface.\r
 \r
-  @param  IdeBlkIoDevice TODO: add argument description\r
-  @param  MediaId TODO: add argument description\r
-  @param  LBA TODO: add argument description\r
-  @param  BufferSize TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
+  @param IdeBlkIoDevice  Indicates the calling context.\r
+  @param MediaId         The media id that the write request is for.\r
+  @param Lba             The starting logical block address to write onto the device.\r
+  @param BufferSize      The size of the Buffer in bytes. This must be a multiple\r
+                         of the intrinsic block size of the device.\r
+  @param Buffer          A pointer to the source buffer for the data.The caller\r
+                         is responsible for either having implicit or explicit\r
+                         ownership of the memory that data is written from.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS       Write Blocks successfully.\r
+  @retval EFI_DEVICE_ERROR  Write Blocks failed.\r
+  @retval EFI_NO_MEDIA      There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGE  The MediaId is not for the current media.\r
 \r
+  @retval EFI_BAD_BUFFER_SIZE   The BufferSize parameter is not a multiple of the\r
+                                intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
+                                or the data buffer is not valid.\r
+\r
+  @note If Write Block error because of device error, this function will call\r
+        AtaSoftReset() function to reset device.\r
 **/\r
 EFI_STATUS\r
 AtaBlkIoWriteBlocks (\r
   IN IDE_BLK_IO_DEV   *IdeBlkIoDevice,\r
   IN UINT32           MediaId,\r
-  IN EFI_LBA          LBA,\r
+  IN EFI_LBA          Lba,\r
   IN UINTN            BufferSize,\r
   OUT VOID            *Buffer\r
   );\r
 \r
-//\r
-// ATAPI device functions' prototype\r
-//\r
 /**\r
-  TODO: Add function description\r
+  This function is called by DiscoverIdeDevice() during its device\r
+  identification.\r
+  Its main purpose is to get enough information for the device media\r
+  to fill in the Media data structure of the Block I/O Protocol interface.\r
 \r
-  @param  IdeDev TODO: add argument description\r
+  There are 5 steps to reach such objective:\r
+  1. Sends out the ATAPI Identify Command to the specified device.\r
+  Only ATAPI device responses to this command. If the command succeeds,\r
+  it returns the Identify data structure which filled with information\r
+  about the device. Since the ATAPI device contains removable media,\r
+  the only meaningful information is the device module name.\r
+  2. Sends out ATAPI Inquiry Packet Command to the specified device.\r
+  This command will return inquiry data of the device, which contains\r
+  the device type information.\r
+  3. Allocate sense data space for future use. We don't detect the media\r
+  presence here to improvement boot performance, especially when CD\r
+  media is present. The media detection will be performed just before\r
+  each BLK_IO read/write\r
 \r
-  TODO: add return values.\r
+  @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                 to record all the information of the IDE device.\r
 \r
-**/\r
-EFI_STATUS\r
-ATAPIIdentify (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS       Identify ATAPI device successfully.\r
+  @retval EFI_DEVICE_ERROR  ATAPI Identify Device Command failed or device type\r
+                            is not supported by this IDE driver.\r
+  @retval EFI_OUT_OF_RESOURCES Allocate memory for sense data failed\r
 \r
+  @note   Parameter "IdeDev" will be updated in this function.\r
 **/\r
 EFI_STATUS\r
-AtapiInquiry (\r
+ATAPIIdentify (\r
   IN  IDE_BLK_IO_DEV  *IdeDev\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used to implement the Soft Reset on the specified\r
+  ATAPI device. Different from the AtaSoftReset(), here reset is a ATA\r
+  Soft Reset Command special for ATAPI device, and it only take effects\r
+  on the specified ATAPI device, not on the whole IDE bus.\r
+  Since the ATAPI soft reset is needed when device is in exceptional\r
+  condition (such as BSY bit is always set ), I think the Soft Reset\r
+  command should be sent without waiting for the BSY clear and DRDY\r
+  set.\r
+  This function is called by IdeBlkIoReset(),\r
+  a interface function of Block I/O protocol.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  Packet TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  TimeOut TODO: add argument description\r
+  @param IdeDev    pointer pointing to IDE_BLK_IO_DEV data structure, used\r
+                   to record all the information of the IDE device.\r
 \r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiPacketCommandIn (\r
-  IN  IDE_BLK_IO_DEV        *IdeDev,\r
-  IN  ATAPI_PACKET_COMMAND  *Packet,\r
-  IN  UINT16                *Buffer,\r
-  IN  UINT32                ByteCount,\r
-  IN  UINTN                 TimeOut\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  Packet TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  TimeOut TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiPacketCommandOut (\r
-  IN  IDE_BLK_IO_DEV        *IdeDev,\r
-  IN  ATAPI_PACKET_COMMAND  *Packet,\r
-  IN  UINT16                *Buffer,\r
-  IN  UINT32                ByteCount,\r
-  IN  UINTN                 TimeOut\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  Read TODO: add argument description\r
-  @param  TimeOut TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-PioReadWriteData (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  UINT16          *Buffer,\r
-  IN  UINT32          ByteCount,\r
-  IN  BOOLEAN         Read,\r
-  IN  UINTN           TimeOut\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev  TODO: add argument description\r
-  @param  SResult TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiTestUnitReady (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  OUT SENSE_RESULT       *SResult  \r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  SenseCounts TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiRequestSense (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  OUT UINTN           *SenseCounts\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev  TODO: add argument description\r
-  @param  SResult TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiReadCapacity (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  OUT SENSE_RESULT       *SResult  \r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  MediaChange TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiDetectMedia (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  OUT BOOLEAN         *MediaChange\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  Lba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiReadSectors (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *Buffer,\r
-  IN  EFI_LBA         Lba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  Lba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiWriteSectors (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *Buffer,\r
-  IN  EFI_LBA         Lba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS      Soft reset completes successfully.\r
+  @retval EFI_DEVICE_ERROR Any step during the reset process is failed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -747,98 +647,73 @@ AtapiSoftReset (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is the ATAPI implementation for ReadBlocks in the\r
+  Block I/O Protocol interface.\r
 \r
-  @param  IdeBlkIoDevice TODO: add argument description\r
-  @param  MediaId TODO: add argument description\r
-  @param  LBA TODO: add argument description\r
-  @param  BufferSize TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param IdeBlkIoDevice Indicates the calling context.\r
+  @param MediaId        The media id that the read request is for.\r
+  @param Lba            The starting logical block address to read from on the device.\r
+  @param BufferSize     The size of the Buffer in bytes. This must be a multiple\r
+                        of the intrinsic block size of the device.\r
+  @param Buffer         A pointer to the destination buffer for the data. The caller\r
+                        is responsible for either having implicit or explicit\r
+                        ownership of the memory that data is read into.\r
 \r
+  @retval EFI_SUCCESS           Read Blocks successfully.\r
+  @retval EFI_DEVICE_ERROR      Read Blocks failed.\r
+  @retval EFI_NO_MEDIA          There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED     The MediaId is not for the current media.\r
+  @retval EFI_BAD_BUFFER_SIZE   The BufferSize parameter is not a multiple of the\r
+                                intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
+                                or the data buffer is not valid.\r
 **/\r
 EFI_STATUS\r
 AtapiBlkIoReadBlocks (\r
   IN IDE_BLK_IO_DEV   *IdeBlkIoDevice,\r
   IN UINT32           MediaId,\r
-  IN EFI_LBA          LBA,\r
+  IN EFI_LBA          Lba,\r
   IN UINTN            BufferSize,\r
   OUT VOID            *Buffer\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is the ATAPI implementation for WriteBlocks in the\r
+  Block I/O Protocol interface.\r
 \r
-  @param  IdeBlkIoDevice TODO: add argument description\r
-  @param  MediaId TODO: add argument description\r
-  @param  LBA TODO: add argument description\r
-  @param  BufferSize TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
+  @param IdeBlkIoDevice  Indicates the calling context.\r
+  @param MediaId         The media id that the write request is for.\r
+  @param Lba             The starting logical block address to write onto the device.\r
+  @param BufferSize      The size of the Buffer in bytes. This must be a multiple\r
+                         of the intrinsic block size of the device.\r
+  @param Buffer          A pointer to the source buffer for the data. The caller\r
+                         is responsible for either having implicit or explicit ownership\r
+                         of the memory that data is written from.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS            Write Blocks successfully.\r
+  @retval EFI_DEVICE_ERROR       Write Blocks failed.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGE       The MediaId is not for the current media.\r
+  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the\r
+                                 intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The write request contains LBAs that are not valid,\r
+                                 or the data buffer is not valid.\r
 \r
+  @retval EFI_WRITE_PROTECTED    The write protected is enabled or the media does not support write\r
 **/\r
 EFI_STATUS\r
 AtapiBlkIoWriteBlocks (\r
   IN IDE_BLK_IO_DEV   *IdeBlkIoDevice,\r
   IN UINT32           MediaId,\r
-  IN EFI_LBA          LBA,\r
+  IN EFI_LBA          Lba,\r
   IN UINTN            BufferSize,\r
   OUT VOID            *Buffer\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  SenseCount TODO: add argument description\r
-  @param  Result TODO: add argument description\r
+  Release resources of an IDE device before stopping it.\r
 \r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-ParseSenseData (\r
-  IN IDE_BLK_IO_DEV     *IdeDev,\r
-  IN UINTN              SenseCount,\r
-  OUT SENSE_RESULT      *Result\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiReadPendingData (\r
-  IN IDE_BLK_IO_DEV     *IdeDev\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  WriteProtected TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-IsLS120orZipWriteProtected (\r
-  IN  IDE_BLK_IO_DEV    *IdeDev,\r
-  OUT BOOLEAN           *WriteProtected\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeBlkIoDevice TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param IdeBlkIoDevice  Standard IDE device private data structure\r
 \r
 **/\r
 VOID\r
@@ -847,65 +722,32 @@ ReleaseIdeResources (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  TransferMode TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  Set the calculated Best transfer mode to a detected device\r
 \r
+  @param IdeDev       Standard IDE device private data structure\r
+  @param TransferMode The device transfer mode to be set\r
+  @return Set transfer mode Command execute status.\r
 **/\r
 EFI_STATUS\r
 SetDeviceTransferMode (\r
   IN IDE_BLK_IO_DEV       *IdeDev,\r
   IN ATA_TRANSFER_MODE    *TransferMode\r
   );\r
-\r
 /**\r
-  TODO: Add function description\r
+  Send ATA command into device with NON_DATA protocol.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  NativeMaxAddress TODO: add argument description\r
+  @param  IdeDev Standard IDE device private data structure\r
+  @param  AtaCommand The ATA command to be sent\r
+  @param  Device The value in Device register\r
+  @param  Feature The value in Feature register\r
+  @param  SectorCount The value in SectorCount register\r
+  @param  LbaLow The value in LBA_LOW register\r
+  @param  LbaMiddle The value in LBA_MIDDLE register\r
+  @param  LbaHigh The value in LBA_HIGH register\r
 \r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-ReadNativeMaxAddress (\r
-  IN  IDE_BLK_IO_DEV                *IdeDev,\r
-  OUT EFI_LBA                       *NativeMaxAddress\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  MaxAddress TODO: add argument description\r
-  @param  bVolatile TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-SetMaxAddress (\r
-  IN  IDE_BLK_IO_DEV                *IdeDev,\r
-  IN  EFI_LBA                       MaxAddress,\r
-  IN  BOOLEAN                       bVolatile\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  Device TODO: add argument description\r
-  @param  Feature TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-  @param  LbaLow TODO: add argument description\r
-  @param  LbaMiddle TODO: add argument description\r
-  @param  LbaHigh TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @retval  EFI_SUCCESS Reading succeed\r
+  @retval  EFI_ABORTED Command failed\r
+  @retval  EFI_DEVICE_ERROR Device status error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -921,303 +763,26 @@ AtaNonDataCommandIn (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  Device TODO: add argument description\r
-  @param  Feature TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-  @param  LbaAddress TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaNonDataCommandInExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  UINT8           AtaCommand,\r
-  IN  UINT8           Device,\r
-  IN  UINT16          Feature,\r
-  IN  UINT16          SectorCount,\r
-  IN  EFI_LBA         LbaAddress\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
+  Enable Long Physical Sector Feature for ATA device.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param   IdeDev  The IDE device data\r
 \r
+  @retval  EFI_SUCCESS      The ATA device supports Long Physical Sector feature\r
+                            and corresponding fields in BlockIo structure is updated.\r
+  @retval  EFI_UNSUPPORTED  The device is not ATA device or Long Physical Sector\r
+                            feature is not supported.\r
 **/\r
 EFI_STATUS\r
-AtaReadSectorsExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaWriteSectorsExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaUdmaReadExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaUdmaRead (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaUdmaWriteExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  Perform an ATA Udma operation (Read, ReadExt, Write, WriteExt).\r
-  \r
-  @param[in] *IdeDev\r
-  pointer pointing to IDE_BLK_IO_DEV data structure, used\r
-  to record all the information of the IDE device.\r
-\r
-  @param[in] *DataBuffer\r
-  A pointer to the source buffer for the data.\r
-\r
-  @param[in] StartLba\r
-  The starting logical block address to write to\r
-  on the device media.\r
-\r
-  @param[in] NumberOfBlocks\r
-  The number of transfer data blocks.\r
-  \r
-  @param[in] UdmaOp\r
-  The perform operations could be AtaUdmaReadOp, AtaUdmaReadExOp,\r
-  AtaUdmaWriteOp, AtaUdmaWriteExOp\r
-\r
-  @return The device status of UDMA operation. If the operation is\r
-  successful, return EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-DoAtaUdma (\r
-  IN  IDE_BLK_IO_DEV      *IdeDev,\r
-  IN  VOID                *DataBuffer,\r
-  IN  EFI_LBA             StartLba,\r
-  IN  UINTN               NumberOfBlocks,\r
-  IN  ATA_UDMA_OPERATION  UdmaOp\r
-  );\r
-\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  DataBuffer TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  NumberOfBlocks TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaUdmaWrite (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *DataBuffer,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINTN           NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  Device TODO: add argument description\r
-  @param  Feature TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-  @param  LbaAddress TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaCommandIssueExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  UINT8           AtaCommand,\r
-  IN  UINT8           Device,\r
-  IN  UINT16          Feature,\r
-  IN  UINT16          SectorCount,\r
-  IN  EFI_LBA         LbaAddress\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  Device TODO: add argument description\r
-  @param  Feature TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-  @param  LbaAddress TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaCommandIssue (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  UINT8           AtaCommand,\r
-  IN  UINT8           Device,\r
-  IN  UINT16          Feature,\r
-  IN  UINT16          SectorCount,\r
-  IN  EFI_LBA         LbaAddress\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaAtapi6Identify (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev\r
-  );\r
-\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-VOID\r
-AtaSMARTSupport (\r
+AtaEnableLongPhysicalSector (\r
   IN  IDE_BLK_IO_DEV  *IdeDev\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaPioDataInExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  OUT VOID        *Buffer,\r
-  IN  UINT32          ByteCount,\r
-  IN  UINT8           AtaCommand,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINT16          SectorCount\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
+  Set drive parameters for devices not support PACKETS command.\r
 \r
-  @param  IdeDev TODO: add argument description\r
-  @param  Buffer TODO: add argument description\r
-  @param  ByteCount TODO: add argument description\r
-  @param  AtaCommand TODO: add argument description\r
-  @param  StartLba TODO: add argument description\r
-  @param  SectorCount TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaPioDataOutExt (\r
-  IN  IDE_BLK_IO_DEV  *IdeDev,\r
-  IN  VOID            *Buffer,\r
-  IN  UINT32          ByteCount,\r
-  IN  UINT8           AtaCommand,\r
-  IN  EFI_LBA         StartLba,\r
-  IN  UINT16          SectorCount\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
-  @param  DriveParameters TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @param IdeDev          Standard IDE device private data structure\r
+  @param DriveParameters The device parameters to be set into the disk\r
+  @return SetParameters Command execute status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1227,30 +792,14 @@ SetDriveParameters (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  IdeDev TODO: add argument description\r
+  Enable Interrupt on IDE controller.\r
 \r
-  TODO: add return values.\r
+  @param  IdeDev   Standard IDE device private data structure\r
 \r
+  @retval  EFI_SUCCESS Enable Interrupt successfully\r
 **/\r
 EFI_STATUS\r
 EnableInterrupt (\r
   IN IDE_BLK_IO_DEV       *IdeDev\r
   );\r
-\r
-/**\r
-  Clear pending IDE interrupt before OS loader/kernel take control of the IDE device.\r
-\r
-  @param[in]  Event   Pointer to this event.\r
-  @param[in]  Context Event hanlder private data.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ClearInterrupt (\r
-  IN EFI_EVENT  Event,\r
-  IN VOID       *Context\r
-  );\r
-\r
 #endif\r