]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/BlockIo.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / BlockIo.h
index dd3d9c1a1503ed18c8b206a47c9cbf2ef2763583..0bc2bcbd8e269c1da36c98a5d9ece9e686f4a116 100644 (file)
@@ -4,8 +4,8 @@
   The Block IO protocol is used to abstract block devices like hard drives,\r
   DVD-ROMs and floppy drives.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
+  Copyright (c) 2006 - 2011, 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
@@ -38,7 +38,7 @@ typedef EFI_BLOCK_IO_PROTOCOL   EFI_BLOCK_IO;
 /**\r
   Reset the Block Device.\r
 \r
-  @param  This                 Protocol instance pointer.\r
+  @param  This                 Indicates a pointer to the calling context.\r
   @param  ExtendedVerification Driver may perform diagnostics on reset.\r
 \r
   @retval EFI_SUCCESS          The device was reset.\r
@@ -56,19 +56,20 @@ EFI_STATUS
 /**\r
   Read BufferSize bytes from Lba into Buffer.\r
 \r
-  @param  This       Protocol instance pointer.\r
+  @param  This       Indicates a pointer to the calling context.\r
   @param  MediaId    Id of the media, changes every time the media is replaced.\r
   @param  Lba        The starting Logical Block Address to read from\r
   @param  BufferSize Size of Buffer, must be a multiple of device block size.\r
-  @param  Buffer     Buffer containing read data\r
+  @param  Buffer     A pointer to the destination buffer for the data. The caller is\r
+                     responsible for either having implicit or explicit ownership of the buffer.\r
 \r
   @retval EFI_SUCCESS           The data was read correctly from the device.\r
   @retval EFI_DEVICE_ERROR      The device reported an error while performing the read.\r
   @retval EFI_NO_MEDIA          There is no media in the device.\r
   @retval EFI_MEDIA_CHANGED     The MediaId does not matched the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
-                                valid for the device.\r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
+                                or the buffer is not on proper alignment.\r
 \r
 **/\r
 typedef\r
@@ -84,11 +85,12 @@ EFI_STATUS
 /**\r
   Write BufferSize bytes from Lba into Buffer.\r
 \r
-  @param  This       Protocol instance pointer.\r
-  @param  MediaId    Id of the media, changes every time the media is replaced.\r
-  @param  Lba        The starting Logical Block Address to read from\r
+  @param  This       Indicates a pointer to the calling context.\r
+  @param  MediaId    The media ID that the write request is for.\r
+  @param  Lba        The starting logical block address to be written. The caller is\r
+                     responsible for writing to only legitimate locations.\r
   @param  BufferSize Size of Buffer, must be a multiple of device block size.\r
-  @param  Buffer     Buffer containing read data\r
+  @param  Buffer     A pointer to the source buffer for the data.\r
 \r
   @retval EFI_SUCCESS           The data was written correctly to the device.\r
   @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
@@ -96,8 +98,8 @@ EFI_STATUS
   @retval EFI_NO_MEDIA          There is no media in the device.\r
   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The write request contains a LBA that is not\r
-                                valid for the device.\r
+  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
+                                or the buffer is not on proper alignment.\r
 \r
 **/\r
 typedef\r
@@ -113,7 +115,7 @@ EFI_STATUS
 /**\r
   Flush the Block Device.\r
 \r
-  @param  This              Protocol instance pointer.\r
+  @param  This              Indicates a pointer to the calling context.\r
 \r
   @retval EFI_SUCCESS       All outstanding data was written to the device\r
   @retval EFI_DEVICE_ERROR  The device reported an error while writting back the data\r
@@ -180,19 +182,41 @@ typedef struct {
   /// If the media changes, then this field is updated. \r
   ///\r
   EFI_LBA LastBlock; \r
+\r
+  ///\r
+  /// Only present if EFI_BLOCK_IO_PROTOCOL.Revision is greater than or equal to\r
+  /// EFI_BLOCK_IO_PROTOCOL_REVISION2. Returns the first LBA is aligned to \r
+  /// a physical block boundary. \r
+  ///\r
+  EFI_LBA LowestAlignedLba;\r
+\r
+  ///\r
+  /// Only present if EFI_BLOCK_IO_PROTOCOL.Revision is greater than or equal to\r
+  /// EFI_BLOCK_IO_PROTOCOL_REVISION2. Returns the number of logical blocks \r
+  /// per physical block.\r
+  ///\r
+  UINT32 LogicalBlocksPerPhysicalBlock;\r
+\r
+  ///\r
+  /// Only present if EFI_BLOCK_IO_PROTOCOL.Revision is greater than or equal to\r
+  /// EFI_BLOCK_IO_PROTOCOL_REVISION3. Returns the optimal transfer length\r
+  /// granularity as a number of logical blocks.\r
+  ///\r
+  UINT32 OptimalTransferLengthGranularity;\r
 } EFI_BLOCK_IO_MEDIA;\r
 \r
 #define EFI_BLOCK_IO_PROTOCOL_REVISION  0x00010000\r
+#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001\r
+#define EFI_BLOCK_IO_PROTOCOL_REVISION3 0x00020031\r
 \r
 ///\r
 /// Revision defined in EFI1.1.\r
 /// \r
 #define EFI_BLOCK_IO_INTERFACE_REVISION   EFI_BLOCK_IO_PROTOCOL_REVISION\r
 \r
-/**\r
-  @par Protocol Description:\r
-  This protocol provides control over block devices.\r
-**/\r
+///\r
+///  This protocol provides control over block devices.\r
+///\r
 struct _EFI_BLOCK_IO_PROTOCOL {\r
   ///\r
   /// The revision to which the block IO interface adheres. All future\r
@@ -200,7 +224,9 @@ struct _EFI_BLOCK_IO_PROTOCOL {
   /// back wards compatible, it is not the same GUID.\r
   ///\r
   UINT64              Revision;\r
-\r
+  ///\r
+  /// Pointer to the EFI_BLOCK_IO_MEDIA data for this device.\r
+  ///\r
   EFI_BLOCK_IO_MEDIA  *Media;\r
 \r
   EFI_BLOCK_RESET     Reset;\r