]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.h
FmpDevicePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBusDxe / IdeBus.h
index 092b219503c5a273cf86afc3ba8d053e5f5a76d4..830661e39a6f34b3026620f2be7f9785b3c8eb70 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Header file for IDE Bus Driver.\r
 \r
-  Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2018, 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
@@ -39,7 +39,7 @@
 \r
 #include <Guid/EventGroup.h>\r
 \r
-#include <IndustryStandard/Pci22.h>\r
+#include <IndustryStandard/Pci.h>\r
 #include "IdeData.h"\r
 \r
 //\r
@@ -60,11 +60,6 @@ extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gIDEBusDriverDiagnostics2;
 #define ATA_DEVICE_TYPE     0x00\r
 #define ATAPI_DEVICE_TYPE   0x01\r
 \r
-#define EFI_IOB_ATA_BUS_SMART_ENABLE          (EFI_SUBCLASS_SPECIFIC | 0x00000000)\r
-#define EFI_IOB_ATA_BUS_SMART_DISABLE         (EFI_SUBCLASS_SPECIFIC | 0x00000001)\r
-#define EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD   (EFI_SUBCLASS_SPECIFIC | 0x00000002)\r
-#define EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD  (EFI_SUBCLASS_SPECIFIC | 0x00000003)\r
-\r
 typedef struct {\r
   BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];\r
   BOOLEAN DeviceFound[MAX_IDE_DEVICE];\r
@@ -119,34 +114,16 @@ typedef struct {
 \r
 #include "Ide.h"\r
 \r
-//\r
-// Prototypes\r
-// Driver model protocol interface\r
-//\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  ImageHandle TODO: add argument description\r
-  @param  SystemTable TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IDEBusControllerDriverEntryPoint (\r
-  IN EFI_HANDLE                   ImageHandle,\r
-  IN EFI_SYSTEM_TABLE             *SystemTable\r
-  );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Supported function of Driver Binding protocol for this driver.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  Controller TODO: add argument description\r
-  @param  RemainingDevicePath TODO: add argument description\r
+  @param This                A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param ControllerHandle    The handle of the controller to test.\r
+  @param RemainingDevicePath A pointer to the remaining portion of a device path.\r
 \r
-  TODO: add return values.\r
+  @retval  EFI_SUCCESS Driver loaded.\r
+  @retval  other       Driver not loaded.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -158,13 +135,16 @@ IDEBusDriverBindingSupported (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Start function of Driver binding protocol which start this driver on Controller\r
+  by detecting all disks and installing BlockIo protocol on them.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  Controller TODO: add argument description\r
-  @param  RemainingDevicePath TODO: add argument description\r
+  @param  This                Protocol instance pointer.\r
+  @param  Controller          Handle of device to bind driver to.\r
+  @param  RemainingDevicePath produce all possible children.\r
 \r
-  TODO: add return values.\r
+  @retval  EFI_SUCCESS         This driver is added to ControllerHandle.\r
+  @retval  EFI_ALREADY_STARTED This driver is already running on ControllerHandle.\r
+  @retval  other               This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -176,14 +156,16 @@ IDEBusDriverBindingStart (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Stop function of Driver Binding Protocol which is to stop the driver on Controller Handle and all\r
+  child handle attached to the controller handle if there are.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  Controller TODO: add argument description\r
-  @param  NumberOfChildren TODO: add argument description\r
-  @param  ChildHandleBuffer TODO: add argument description\r
+  @param  This Protocol instance pointer.\r
+  @param  Controller Handle of device to stop driver on\r
+  @param  NumberOfChildren Not used\r
+  @param  ChildHandleBuffer Not used\r
 \r
-  TODO: add return values.\r
+  @retval  EFI_SUCCESS This driver is removed DeviceHandle\r
+  @retval  other This driver was not removed from this device\r
 \r
 **/\r
 EFI_STATUS\r
@@ -198,85 +180,59 @@ IDEBusDriverBindingStop (
 //\r
 // EFI Driver Configuration Functions\r
 //\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  This                 TODO: add argument description\r
-  @param  ControllerHandle     TODO: add argument description\r
-  @param  ChildHandle          TODO: add argument description\r
-  @param  Language             TODO: add argument description\r
-  @param  ActionRequired       TODO: add argument description\r
-\r
-  TODO: add return values.\r
 \r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IDEBusDriverConfigurationSetOptions (\r
-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL                      *This,\r
-  IN  EFI_HANDLE                                             ControllerHandle,\r
-  IN  EFI_HANDLE                                             ChildHandle  OPTIONAL,\r
-  IN  CHAR8                                                  *Language,\r
-  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED               *ActionRequired\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  This                 TODO: add argument description\r
-  @param  ControllerHandle     TODO: add argument description\r
-  @param  ChildHandle          TODO: add argument description\r
 \r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IDEBusDriverConfigurationOptionsValid (\r
-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL               *This,\r
-  IN  EFI_HANDLE                                      ControllerHandle,\r
-  IN  EFI_HANDLE                                      ChildHandle  OPTIONAL\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
 \r
-  @param  This                 TODO: add argument description\r
-  @param  ControllerHandle     TODO: add argument description\r
-  @param  ChildHandle          TODO: add argument description\r
-  @param  DefaultType          TODO: add argument description\r
-  @param  ActionRequired       TODO: add argument description\r
-\r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IDEBusDriverConfigurationForceDefaults (\r
-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL                      *This,\r
-  IN  EFI_HANDLE                                             ControllerHandle,\r
-  IN  EFI_HANDLE                                             ChildHandle  OPTIONAL,\r
-  IN  UINT32                                                 DefaultType,\r
-  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED               *ActionRequired\r
-  );\r
 \r
 //\r
 // EFI Driver Diagnostics Functions\r
 //\r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  This                 TODO: add argument description\r
-  @param  ControllerHandle     TODO: add argument description\r
-  @param  ChildHandle          TODO: add argument description\r
-  @param  DiagnosticType       TODO: add argument description\r
-  @param  Language             TODO: add argument description\r
-  @param  ErrorType            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
-\r
+  Runs diagnostics on a controller.\r
+\r
+  @param  This             A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOLinstance.\r
+  @param  ControllerHandle The handle of the controller to run diagnostics on.\r
+  @param  ChildHandle      The handle of the child controller to run diagnostics on\r
+                           This is an optional parameter that may be NULL.  It will\r
+                           be NULL for device drivers.  It will also be NULL for a\r
+                           bus drivers that wish to run diagnostics on the bus controller.\r
+                           It will not be NULL for a bus driver that wishes to run\r
+                           diagnostics on one of its child controllers.\r
+  @param  DiagnosticType   Indicates type of diagnostics to perform on the controller\r
+                           specified by ControllerHandle and ChildHandle.\r
+  @param  Language         A pointer to a three character ISO 639-2 language identifier.\r
+                           This is the language in which the optional error message should\r
+                           be returned in Buffer, and it must match one of the languages\r
+                           specified in SupportedLanguages. The number of languages supported by\r
+                           a driver is up to the driver writer.\r
+  @param  ErrorType        A GUID that defines the format of the data returned in Buffer.\r
+  @param  BufferSize       The size, in bytes, of the data returned in Buffer.\r
+  @param  Buffer           A buffer that contains a Null-terminated Unicode string\r
+                           plus some additional data whose format is defined by ErrorType.\r
+                           Buffer is allocated by this function with AllocatePool(), and\r
+                           it is the caller's responsibility to free it with a call to FreePool().\r
+\r
+  @retval  EFI_SUCCESS           The controller specified by ControllerHandle and ChildHandle passed\r
+                                 the diagnostic.\r
+  @retval  EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
+  @retval  EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval  EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval  EFI_INVALID_PARAMETER ErrorType is NULL.\r
+  @retval  EFI_INVALID_PARAMETER BufferType is NULL.\r
+  @retval  EFI_INVALID_PARAMETER Buffer is NULL.\r
+  @retval  EFI_UNSUPPORTED       The driver specified by This does not support running\r
+                                 diagnostics for the controller specified by ControllerHandle\r
+                                 and ChildHandle.\r
+  @retval  EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                 type of diagnostic specified by DiagnosticType.\r
+  @retval  EFI_UNSUPPORTED       The driver specified by This does not support the language\r
+                                 specified by Language.\r
+  @retval  EFI_OUT_OF_RESOURCES  There are not enough resources available to complete the\r
+                                 diagnostics.\r
+  @retval  EFI_OUT_OF_RESOURCES  There are not enough resources available to return the\r
+                                 status information in ErrorType, BufferSize,and Buffer.\r
+  @retval  EFI_DEVICE_ERROR      The controller specified by ControllerHandle and ChildHandle\r
+                                 did not pass the diagnostic.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -291,16 +247,15 @@ IDEBusDriverDiagnosticsRunDiagnostics (
   OUT CHAR16                                        **Buffer\r
   );\r
 \r
-//\r
-// Block I/O Protocol Interface\r
-//\r
 /**\r
-  TODO: Add function description\r
+  issue ATA or ATAPI command to reset a block IO device.\r
+  @param  This                  Block IO protocol instance pointer.\r
+  @param  ExtendedVerification  If FALSE,for ATAPI device, driver will only invoke ATAPI reset method\r
+                                If TRUE, for ATAPI device, driver need invoke ATA reset method after\r
+                                invoke ATAPI reset method\r
 \r
-  @param  This TODO: add argument description\r
-  @param  ExtendedVerification TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @retval EFI_DEVICE_ERROR      When the device is neighther ATA device or ATAPI device.\r
+  @retval EFI_SUCCESS           The device reset successfully\r
 \r
 **/\r
 EFI_STATUS\r
@@ -311,15 +266,16 @@ IDEBlkIoReset (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Read data from a block IO device.\r
 \r
-  @param  This 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  This       Block IO protocol instance pointer.\r
+  @param  MediaId    The media ID of the device\r
+  @param  Lba        Starting LBA address to read data\r
+  @param  BufferSize The size of data to be read\r
+  @param  Buffer     Caller supplied buffer to save data\r
 \r
-  TODO: add return values.\r
+  @retval EFI_DEVICE_ERROR  unknown device type\r
+  @retval EFI_SUCCESS       read the data successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -333,15 +289,16 @@ IDEBlkIoReadBlocks (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  Write data to block io device\r
 \r
-  @param  This 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  This       Protocol instance pointer.\r
+  @param  MediaId    The media ID of the device\r
+  @param  Lba        Starting LBA address to write data\r
+  @param  BufferSize The size of data to be written\r
+  @param  Buffer     Caller supplied buffer to save data\r
 \r
-  TODO: add return values.\r
+  @retval EFI_DEVICE_ERROR  unknown device type\r
+  @retval other             write data status\r
 \r
 **/\r
 EFI_STATUS\r
@@ -355,42 +312,30 @@ IDEBlkIoWriteBlocks (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
-\r
-  @param  This TODO: add argument description\r
+  Flushes all modified data to a physical block devices\r
 \r
-  TODO: add return values.\r
+  @param  This  Indicates a pointer to the calling context which to sepcify a\r
+                sepcific block device\r
 \r
+  @retval EFI_SUCCESS   Always return success.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 IDEBlkIoFlushBlocks (\r
   IN  EFI_BLOCK_IO_PROTOCOL       *This\r
   );\r
-\r
 /**\r
-  TODO: Add function description\r
+  This function is used by the IDE bus driver to get inquiry data.\r
+  Data format of Identify data is defined by the Interface GUID.\r
 \r
-  @param  PciIo TODO: add argument description\r
-  @param  Enable TODO: add argument description\r
+  @param  This                  Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
+  @param  InquiryData           Pointer to a buffer for the inquiry data.\r
+  @param  InquiryDataSize       Pointer to the value for the inquiry data size.\r
 \r
-  TODO: add return values.\r
-\r
-**/\r
-EFI_STATUS\r
-IDERegisterDecodeEnableorDisable (\r
-  IN  EFI_PCI_IO_PROTOCOL         *PciIo,\r
-  IN  BOOLEAN                     Enable\r
-  );\r
-\r
-/**\r
-  TODO: Add function description\r
-\r
-  @param  This TODO: add argument description\r
-  @param  InquiryData TODO: add argument description\r
-  @param  IntquiryDataSize TODO: add argument description\r
-\r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS           The command was accepted without any errors.\r
+  @retval EFI_NOT_FOUND         Device does not support this data class\r
+  @retval EFI_DEVICE_ERROR      Error reading InquiryData from device\r
+  @retval EFI_BUFFER_TOO_SMALL  IntquiryDataSize not big enough\r
 \r
 **/\r
 EFI_STATUS\r
@@ -398,17 +343,21 @@ EFIAPI
 IDEDiskInfoInquiry (\r
   IN EFI_DISK_INFO_PROTOCOL       *This,\r
   IN OUT VOID                     *InquiryData,\r
-  IN OUT UINT32                   *IntquiryDataSize\r
+  IN OUT UINT32                   *InquiryDataSize\r
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used by the IDE bus driver to get identify data.\r
+  Data format of Identify data is defined by the Interface GUID.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  IdentifyData TODO: add argument description\r
-  @param  IdentifyDataSize TODO: add argument description\r
+  @param  This                  Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
+  @param  IdentifyData          Pointer to a buffer for the identify data.\r
+  @param  IdentifyDataSize      Pointer to the value for the identify data size.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS           The command was accepted without any errors.\r
+  @retval EFI_NOT_FOUND         Device does not support this data class\r
+  @retval EFI_DEVICE_ERROR      Error reading IdentifyData from device\r
+  @retval EFI_BUFFER_TOO_SMALL  IdentifyDataSize not big enough\r
 \r
 **/\r
 EFI_STATUS\r
@@ -420,14 +369,18 @@ IDEDiskInfoIdentify (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used by the IDE bus driver to get sense data.\r
+  Data format of Sense data is defined by the Interface GUID.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  SenseData TODO: add argument description\r
-  @param  SenseDataSize TODO: add argument description\r
-  @param  SenseDataNumber TODO: add argument description\r
+  @param  This                  Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
+  @param  SenseData             Pointer to the SenseData.\r
+  @param  SenseDataSize         Size of SenseData in bytes.\r
+  @param  SenseDataNumber       Pointer to the value for the identify data size.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS           The command was accepted without any errors.\r
+  @retval EFI_NOT_FOUND         Device does not support this data class\r
+  @retval EFI_DEVICE_ERROR      Error reading InquiryData from device\r
+  @retval EFI_BUFFER_TOO_SMALL  SenseDataSize not big enough\r
 \r
 **/\r
 EFI_STATUS\r
@@ -440,13 +393,14 @@ IDEDiskInfoSenseData (
   );\r
 \r
 /**\r
-  TODO: Add function description\r
+  This function is used by the IDE bus driver to get controller information.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  IdeChannel TODO: add argument description\r
-  @param  IdeDevice TODO: add argument description\r
+  @param  This                  Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
+  @param  IdeChannel            Pointer to the Ide Channel number. Primary or secondary.\r
+  @param  IdeDevice             Pointer to the Ide Device number. Master or slave.\r
 \r
-  TODO: add return values.\r
+  @retval EFI_SUCCESS           IdeChannel and IdeDevice are valid\r
+  @retval EFI_UNSUPPORTED       This is not an IDE device\r
 \r
 **/\r
 EFI_STATUS\r
@@ -456,5 +410,18 @@ IDEDiskInfoWhichIde (
   OUT UINT32                      *IdeChannel,\r
   OUT UINT32                      *IdeDevice\r
   );\r
+/**\r
+  The is an event(generally the event is exitBootService event) call back function.\r
+  Clear pending IDE interrupt before OS loader/kernel take control of the IDE device.\r
+\r
+  @param  Event   Pointer to this event\r
+  @param  Context Event handler private data\r
 \r
+**/\r
+VOID\r
+EFIAPI\r
+ClearInterrupt (\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
+  );\r
 #endif\r