]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
MdeModulePkg/AtaBusDxe: Fix some ATA hard drives cannot be discovered
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaBusDxe / AtaBus.h
index d6b0ff8f084a90c92a9ce2e9d3c2ab0e4f9da566..26ec70d30a1a534e1f9a69a73f9ad5328bd980b5 100644 (file)
@@ -4,7 +4,7 @@
   This file defines common data structures, macro definitions and some module\r
   internal function header files.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, 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
@@ -20,7 +20,6 @@
 \r
 #include <Uefi.h>\r
 \r
-#include <Guid/MemoryOverwriteControl.h>\r
 #include <Protocol/AtaPassThru.h>\r
 #include <Protocol/BlockIo.h>\r
 #include <Protocol/BlockIo2.h>\r
@@ -38,6 +37,7 @@
 #include <Library/DevicePathLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/TimerLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Atapi.h>\r
 \r
 #define ATA_SUB_TASK_SIGNATURE            SIGNATURE_32 ('A', 'S', 'T', 'S')\r
 #define IS_ALIGNED(addr, size)            (((UINTN) (addr) & (size - 1)) == 0)\r
 \r
-#define ROUNDUP512(x) (((x) % 512 == 0) ? (x) : ((x) / 512 + 1) * 512)\r
-\r
-#define SECURITY_PROTOCOL_TCG      0x02\r
-#define SECURITY_PROTOCOL_IEEE1667 0xEE\r
-\r
-//\r
-// ATA Supported Security Protocols List Description.\r
-// Refer to ATA8-ACS Spec 7.57.6.2 Table 69.\r
-//\r
-typedef struct  {\r
-  UINT8                            Reserved1[6];\r
-  UINT8                            SupportedSecurityListLength[2];\r
-  UINT8                            SupportedSecurityProtocol[1];\r
-} SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA;\r
-\r
 //\r
 // ATA bus data structure for ATA controller\r
 //\r
@@ -147,6 +132,7 @@ typedef struct {
 \r
   LIST_ENTRY                            AtaTaskList;\r
   LIST_ENTRY                            AtaSubTaskList;\r
+  BOOLEAN                               Abort;\r
 } ATA_DEVICE;\r
 \r
 //\r
@@ -180,8 +166,8 @@ typedef struct {
 #define ATA_DEVICE_FROM_BLOCK_IO2(a)        CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)\r
 #define ATA_DEVICE_FROM_DISK_INFO(a)        CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)\r
 #define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)\r
-#define ATA_AYNS_SUB_TASK_FROM_ENTRY(a)     CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)\r
-#define ATA_AYNS_TASK_FROM_ENTRY(a)         CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r
+#define ATA_ASYN_SUB_TASK_FROM_ENTRY(a)     CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)\r
+#define ATA_ASYN_TASK_FROM_ENTRY(a)         CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r
 \r
 //\r
 // Global Variables\r
@@ -300,6 +286,7 @@ AccessAtaDevice(
   IN BOOLEAN                        IsWrite,\r
   IN OUT EFI_BLOCK_IO2_TOKEN        *Token\r
   );\r
+\r
 /**\r
   Trust transfer data from/to ATA device.\r
 \r
@@ -803,6 +790,22 @@ AtaBlockIoFlushBlocksEx (
   IN OUT EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
+/**\r
+  Terminate any in-flight non-blocking I/O requests by signaling an EFI_ABORTED\r
+  in the TransactionStatus member of the EFI_BLOCK_IO2_TOKEN for the non-blocking\r
+  I/O. After that it is safe to free any Token or Buffer data structures that\r
+  were allocated to initiate the non-blockingI/O requests that were in-flight for\r
+  this device.\r
+\r
+  @param[in]  AtaDevice     The ATA child device involved for the operation.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AtaTerminateNonBlockingTask (\r
+  IN ATA_DEVICE               *AtaDevice\r
+  );\r
+\r
 /**\r
   Provides inquiry information for the controller type.\r
 \r
@@ -939,20 +942,20 @@ AtaDiskInfoWhichIde (
   return EFI_SUCCESS. If the security protocol command completes with an error, the\r
   function shall return EFI_DEVICE_ERROR.\r
 \r
-  @param  This                              Indicates a pointer to the calling context.\r
-  @param  MediaId                           ID of the medium to receive data from.\r
-  @param  Timeout                                 The timeout, in 100ns units, to use for the execution\r
+  @param  This                         Indicates a pointer to the calling context.\r
+  @param  MediaId                      ID of the medium to receive data from.\r
+  @param  Timeout                      The timeout, in 100ns units, to use for the execution\r
                                        of the security protocol command. A Timeout value of 0\r
                                        means that this function will wait indefinitely for the\r
                                        security protocol command to execute. If Timeout is greater\r
                                        than zero, then this function will return EFI_TIMEOUT\r
-                                                              if the time required to execute the receive data command\r
-                                                              is greater than Timeout.\r
+                                       if the time required to execute the receive data command\r
+                                       is greater than Timeout.\r
   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of\r
                                        the security protocol command to be sent.\r
   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
                                        of the security protocol command to be sent.\r
-  @param  PayloadBufferSize                     Size in bytes of the payload data buffer.\r
+  @param  PayloadBufferSize            Size in bytes of the payload data buffer.\r
   @param  PayloadBuffer                A pointer to a destination buffer to store the security\r
                                        protocol command specific payload data for the security\r
                                        protocol command. The caller is responsible for having\r
@@ -1019,20 +1022,20 @@ AtaStorageSecurityReceiveData (
   EFI_SUCCESS. If the security protocol command completes with an error, the function\r
   shall return EFI_DEVICE_ERROR.\r
 \r
-  @param  This                              Indicates a pointer to the calling context.\r
-  @param  MediaId                           ID of the medium to receive data from.\r
-  @param  Timeout                                 The timeout, in 100ns units, to use for the execution\r
+  @param  This                         Indicates a pointer to the calling context.\r
+  @param  MediaId                      ID of the medium to receive data from.\r
+  @param  Timeout                      The timeout, in 100ns units, to use for the execution\r
                                        of the security protocol command. A Timeout value of 0\r
                                        means that this function will wait indefinitely for the\r
                                        security protocol command to execute. If Timeout is greater\r
                                        than zero, then this function will return EFI_TIMEOUT\r
-                                                              if the time required to execute the receive data command\r
-                                                              is greater than Timeout.\r
+                                       if the time required to execute the receive data command\r
+                                       is greater than Timeout.\r
   @param  SecurityProtocolId           The value of the "Security Protocol" parameter of\r
                                        the security protocol command to be sent.\r
   @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
                                        of the security protocol command to be sent.\r
-  @param  PayloadBufferSize                     Size in bytes of the payload data buffer.\r
+  @param  PayloadBufferSize            Size in bytes of the payload data buffer.\r
   @param  PayloadBuffer                A pointer to a destination buffer to store the security\r
                                        protocol command specific payload data for the security\r
                                        protocol command.\r