]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/FirmwareVolumeBlock.h
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Include / Protocol / FirmwareVolumeBlock.h
index 275c16b91ca84ff57fb2562511cbe0a7ad014859..7fbe3c81e109f280ef31bb90477d8d0ba4754abd 100644 (file)
@@ -1,40 +1,47 @@
 /** @file\r
   This file provides control over block-oriented firmware devices.\r
 \r
-  Copyright (c) 2006 - 2007, 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
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under \r
+the terms and conditions of the BSD License that accompanies this distribution.  \r
+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
   @par Revision Reference: PI\r
-  Version 1.00.\r
+  Version 1.0 and 1.2.\r
 \r
 **/\r
 \r
 #ifndef __FIRMWARE_VOLUME_BLOCK_H__\r
 #define __FIRMWARE_VOLUME_BLOCK_H__\r
 \r
-\r
+//\r
+// EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is defined in PI 1.0 spec and its GUID value\r
+// is later updated to be the same as that of EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL\r
+// defined in PI 1.2 spec. \r
+//\r
 #define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \\r
-  { 0xDE28BC59, 0x6228, 0x41BD, {0xBD, 0xF6, 0xA3, 0xB9, 0xAD,0xB5, 0x8D, 0xA1 } }\r
+  { 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } }\r
 \r
+#define EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL_GUID \\r
+  { 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } }\r
 \r
 typedef struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL;\r
 \r
+typedef EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL;    \r
+\r
 /**\r
   The GetAttributes() function retrieves the attributes and\r
-  current settings of the block. Status Codes Returned\r
+  current settings of the block.\r
 \r
-  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
-                instance.\r
+  @param This       Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
 \r
-  @param Attributes Pointer to EFI_FVB_ATTRIBUTES in which the\r
+  @param Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the\r
                     attributes and current settings are\r
-                    returned. Type EFI_FVB_ATTRIBUTES is defined\r
+                    returned. Type EFI_FVB_ATTRIBUTES_2 is defined\r
                     in EFI_FIRMWARE_VOLUME_HEADER.\r
 \r
   @retval EFI_SUCCESS The firmware volume attributes were\r
@@ -43,9 +50,9 @@ typedef struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_FIRMWARE_VOLUME_BLOCK_PRO
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI * EFI_FVB_GET_ATTRIBUTES) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
-  OUT       EFI_FVB_ATTRIBUTES                  *Attributes\r
+(EFIAPI * EFI_FVB_GET_ATTRIBUTES)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
+  OUT       EFI_FVB_ATTRIBUTES_2                *Attributes\r
 );\r
 \r
 \r
@@ -53,20 +60,17 @@ EFI_STATUS
   The SetAttributes() function sets configurable firmware volume\r
   attributes and returns the new settings of the firmware volume.\r
 \r
-  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
-                instance.\r
+  @param This         Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
 \r
   @param Attributes   On input, Attributes is a pointer to\r
-                      EFI_FVB_ATTRIBUTES that contains the\r
+                      EFI_FVB_ATTRIBUTES_2 that contains the\r
                       desired firmware volume settings. On\r
                       successful return, it contains the new\r
                       settings of the firmware volume. Type\r
-                      EFI_FVB_ATTRIBUTES is defined in\r
+                      EFI_FVB_ATTRIBUTES_2 is defined in\r
                       EFI_FIRMWARE_VOLUME_HEADER.\r
-\r
   \r
-  @retval EFI_SUCCESS The firmware volume attributes were\r
-                      returned.\r
+  @retval EFI_SUCCESS           The firmware volume attributes were returned.\r
 \r
   @retval EFI_INVALID_PARAMETER The attributes requested are in\r
                                 conflict with the capabilities\r
@@ -76,9 +80,9 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI * EFI_FVB_SET_ATTRIBUTES) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
-  IN OUT    EFI_FVB_ATTRIBUTES                  *Attributes\r
+(EFIAPI * EFI_FVB_SET_ATTRIBUTES)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
+  IN OUT    EFI_FVB_ATTRIBUTES_2                *Attributes\r
 );\r
 \r
 \r
@@ -87,28 +91,22 @@ EFI_STATUS
   a memory-mapped firmware volume. This function should be called\r
   only for memory-mapped firmware volumes.\r
 \r
-  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
-                nstance.\r
+  @param This     Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
   \r
   @param Address  Pointer to a caller-allocated\r
                   EFI_PHYSICAL_ADDRESS that, on successful\r
                   return from GetPhysicalAddress(), contains the\r
-                  base address of the firmware volume. Type\r
-                  EFI_PHYSICAL_ADDRESS is defined in\r
-                  AllocatePages() in the UEFI 2.0 specification.\r
+                  base address of the firmware volume.\r
   \r
-  @retval EFI_SUCCESS The firmware volume base address is\r
-                      returned.\r
+  @retval EFI_SUCCESS       The firmware volume base address was returned.\r
   \r
-  @retval EFI_NOT_SUPPORTED The firmware volume is not memory\r
-                            mapped.\r
-\r
+  @retval EFI_NOT_SUPPORTED The firmware volume is not memory mapped.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI * EFI_FVB_GET_PHYSICAL_ADDRESS) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+(EFIAPI * EFI_FVB_GET_PHYSICAL_ADDRESS)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
   OUT       EFI_PHYSICAL_ADDRESS                *Address\r
 );\r
 \r
@@ -119,15 +117,12 @@ EFI_STATUS
   retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER).\r
 \r
 \r
-  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
-                instance.\r
+  @param This           Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
 \r
-  @param Lba  Indicates the block for which to return the size.\r
-              Type EFI_LBA is defined in the BLOCK_IO Protocol\r
-              (section 11.6) in the UEFI 2.0 specification.\r
+  @param Lba            Indicates the block for which to return the size.\r
 \r
-  @param BlockSize  Pointer to a caller-allocated UINTN in which\r
-                    the size of the block is returned.\r
+  @param BlockSize      Pointer to a caller-allocated UINTN in which\r
+                        the size of the block is returned.\r
 \r
   @param NumberOfBlocks Pointer to a caller-allocated UINTN in\r
                         which the number of consecutive blocks,\r
@@ -136,17 +131,15 @@ EFI_STATUS
                         BlockSize.\r
 \r
   \r
-  @retval EFI_SUCCESS The firmware volume base address is\r
-                      returned.\r
+  @retval EFI_SUCCESS             The firmware volume base address was returned.\r
   \r
-  @retval EFI_INVALID_PARAMETER   The requested LBA is out of\r
-                                  range.\r
+  @retval EFI_INVALID_PARAMETER   The requested LBA is out of range.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI * EFI_FVB_GET_BLOCK_SIZE) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+(EFIAPI * EFI_FVB_GET_BLOCK_SIZE)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
   IN        EFI_LBA                             Lba,\r
   OUT       UINTN                               *BlockSize,\r
   OUT       UINTN                               *NumberOfBlocks\r
@@ -154,6 +147,8 @@ EFI_STATUS
 \r
 \r
 /**\r
+  Reads the specified number of bytes into a buffer from the specified block.\r
+\r
   The Read() function reads the requested number of bytes from the\r
   requested block and stores them in the provided buffer.\r
   Implementations should be mindful that the firmware volume\r
@@ -167,13 +162,12 @@ EFI_STATUS
   indicate the number of bytes actually read. The caller must be\r
   aware that a read may be partially completed.\r
 \r
-  @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
-              instance. Lba The starting logical block index\r
-              from which to read. Type EFI_LBA is defined in the\r
-              BLOCK_IO Protocol (section 11.6) in the UEFI 2.0\r
-              specification.\r
+  @param This     Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
+  \r
+  @param Lba      The starting logical block index\r
+                  from which to read.\r
 \r
-  @param Offset Offset into the block at which to begin reading.\r
+  @param Offset   Offset into the block at which to begin reading.\r
 \r
   @param NumBytes Pointer to a UINTN. At entry, *NumBytes\r
                   contains the total size of the buffer. At\r
@@ -183,8 +177,8 @@ EFI_STATUS
   @param Buffer   Pointer to a caller-allocated buffer that will\r
                   be used to hold the data that is read.\r
 \r
-  @retval EFI_SUCCESS The firmware volume was read successfully\r
-                      and contents are in Buffer.\r
+  @retval EFI_SUCCESS         The firmware volume was read successfully,\r
+                              and contents are in Buffer.\r
   \r
   @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA\r
                               boundary. On output, NumBytes\r
@@ -201,17 +195,17 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_FVB_READ) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+(EFIAPI *EFI_FVB_READ)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
   IN        EFI_LBA                             Lba,\r
   IN        UINTN                               Offset,\r
   IN OUT    UINTN                               *NumBytes,\r
   IN OUT    UINT8                               *Buffer\r
 );\r
 \r
-\r
-\r
 /**\r
+  Writes the specified number of bytes from the input buffer to the block.\r
+\r
   The Write() function writes the specified number of bytes from\r
   the provided buffer to the specified block and offset. If the\r
   firmware volume is sticky write, the caller must ensure that\r
@@ -220,9 +214,9 @@ EFI_STATUS
   function, or else the result will be unpredictable. This\r
   unpredictability arises because, for a sticky-write firmware\r
   volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY\r
-  state but it cannot flip it back again. In general, before\r
-  calling the Write() function, the caller should call the\r
-  EraseBlocks() function first to erase the specified block to\r
+  state but cannot flip it back again.  Before calling the\r
+  Write() function,  it is recommended for the caller to first call \r
+  the EraseBlocks() function to erase the specified block to\r
   write. A block erase cycle will transition bits from the\r
   (NOT)EFI_FVB_ERASE_POLARITY state back to the\r
   EFI_FVB_ERASE_POLARITY state. Implementations should be\r
@@ -239,25 +233,21 @@ EFI_STATUS
   fully flushed to the hardware before the Write() service\r
   returns.\r
 \r
-  @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
-              instance.\r
+  @param This     Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
   \r
-  @param Lba  The starting logical block index to write to. Type\r
-              EFI_LBA is defined in the BLOCK_IO Protocol\r
-              (section 11.6) in the UEFI 2.0 specification.\r
-              Offset Offset into the block at which to begin\r
-              writing.\r
+  @param Lba      The starting logical block index to write to.\r
   \r
-  @param NumBytes Pointer to a UINTN. At entry, *NumBytes\r
+  @param Offset   Offset into the block at which to begin writing.\r
+  \r
+  @param NumBytes The pointer to a UINTN. At entry, *NumBytes\r
                   contains the total size of the buffer. At\r
                   exit, *NumBytes contains the total number of\r
                   bytes actually written.\r
   \r
-  @param Buffer Pointer to a caller-allocated buffer that\r
-                contains the source for the write.\r
+  @param Buffer   The pointer to a caller-allocated buffer that\r
+                  contains the source for the write.\r
   \r
-  @retval EFI_SUCCESS The firmware volume was written\r
-                      successfully.\r
+  @retval EFI_SUCCESS         The firmware volume was written successfully.\r
   \r
   @retval EFI_BAD_BUFFER_SIZE The write was attempted across an\r
                               LBA boundary. On output, NumBytes\r
@@ -274,8 +264,8 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI * EFI_FVB_WRITE) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+(EFIAPI * EFI_FVB_WRITE)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
   IN        EFI_LBA                             Lba,\r
   IN        UINTN                               Offset,\r
   IN OUT    UINTN                               *NumBytes,\r
@@ -285,13 +275,15 @@ EFI_STATUS
 \r
 \r
 \r
-//\r
-// EFI_LBA_LIST_TERMINATOR\r
-//\r
+///\r
+/// EFI_LBA_LIST_TERMINATOR\r
+///\r
 #define EFI_LBA_LIST_TERMINATOR   0xFFFFFFFFFFFFFFFFULL\r
 \r
 \r
 /**\r
+  Erases and initializes a firmware volume block.\r
+\r
   The EraseBlocks() function erases one or more blocks as denoted\r
   by the variable argument list. The entire parameter list of\r
   blocks must be verified before erasing any blocks. If a block is\r
@@ -307,7 +299,7 @@ EFI_STATUS
   flushed to the hardware before the EraseBlocks() service\r
   returns.\r
 \r
-  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL\r
                 instance.\r
 \r
   @param ...    The variable argument list is a list of tuples.\r
@@ -315,7 +307,7 @@ EFI_STATUS
                 and consists of the following:\r
                 - An EFI_LBA that indicates the starting LBA\r
                 - A UINTN that indicates the number of blocks to\r
-                  erase\r
+                  erase.\r
 \r
                 The list is terminated with an\r
                 EFI_LBA_LIST_TERMINATOR. For example, the\r
@@ -323,7 +315,7 @@ EFI_STATUS
                 (5-7 and 10-11) are to be erased: EraseBlocks\r
                 (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR);\r
 \r
-  @retval EFI_SUCCESS The erase request was successfully\r
+  @retval EFI_SUCCESS The erase request successfully\r
                       completed.\r
   \r
   @retval EFI_ACCESS_DENIED   The firmware volume is in the\r
@@ -339,76 +331,21 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI * EFI_FVB_ERASE_BLOCKS) (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+(EFIAPI * EFI_FVB_ERASE_BLOCKS)(\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,\r
   ...\r
 );\r
 \r
-\r
-\r
-/**\r
-  The Firmware Volume Block Protocol is the low-level interface\r
-  to a firmware volume. File-level access to a firmware volume\r
-  should not be done using the Firmware Volume Block Protocol.\r
-  Normal access to a firmware volume must use the Firmware\r
-  Volume Protocol. Typically, only the file system driver that\r
-  produces the Firmware Volume Protocol will bind to the\r
-  Firmware Volume Block Protocol. The Firmware Volume Block\r
-  Protocol provides the following:\r
-  - Byte-level read/write functionality.\r
-  - Block-level erase functionality.\r
-  - It further exposes device-hardening features, such as may be\r
-    equired to protect the firmware from unwanted overwriting\r
-    and/or erasure.\r
-  - It is useful to layer a file system driver on top of the\r
-    Firmware Volume Block Protocol.\r
-\r
-  This file system driver produces the Firmware Volume Protocol,\r
-  which provides file-level access to a firmware volume. The\r
-  Firmware Volume Protocol abstracts the file system that is\r
-  used to format the firmware volume and the hardware\r
-  device-hardening features that may be present.\r
-\r
-\r
-  @param GetPhysicalAddress   Retrieves the memory-mapped\r
-                              address of the firmware volume.\r
-                              See the GetPhysicalAddress()\r
-                              function description. \r
-\r
-  @param GetBlockSize   Retrieves the size for a specific block.\r
-                        Also returns the number of consecutive\r
-                        similarly sized blocks. See the\r
-                        GetBlockSize() function description.\r
-\r
-  @param Read   Reads n bytes into a buffer from the firmware\r
-                volume hardware. See the Read() function\r
-                description.\r
-\r
-  @param Write  Writes n bytes from a buffer into the firmware\r
-                volume hardware. See the Write() function\r
-                description.\r
-\r
-  @param EraseBlocks  Erases specified block(s) and sets all\r
-                      values as indicated by the\r
-                      EFI_FVB_ERASE_POLARITY bit. See the\r
-                      EraseBlocks() function description. Type\r
-                      EFI_FVB_ERASE_POLARITY is defined in\r
-                      EFI_FIRMWARE_VOLUME_HEADER. ParentHandle\r
-                      Handle of the parent firmware volume. Type\r
-                      EFI_HANDLE is defined in\r
-                      InstallProtocolInterface() in the UEFI 2.0\r
-                      specification.\r
-  \r
-  @param GetAttributes Retrieves the current volume attributes.\r
-                       See the GetAttributes() function\r
-                       description.\r
-  \r
-  @param SetAttributes Sets the current volume attributes. See\r
-                       the SetAttributes() function description.\r
-  \r
-\r
-**/\r
-struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL {\r
+///\r
+/// The Firmware Volume Block Protocol is the low-level interface\r
+/// to a firmware volume. File-level access to a firmware volume\r
+/// should not be done using the Firmware Volume Block Protocol.\r
+/// Normal access to a firmware volume must use the Firmware\r
+/// Volume Protocol. Typically, only the file system driver that\r
+/// produces the Firmware Volume Protocol will bind to the\r
+/// Firmware Volume Block Protocol.\r
+///\r
+struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL{\r
   EFI_FVB_GET_ATTRIBUTES        GetAttributes;\r
   EFI_FVB_SET_ATTRIBUTES        SetAttributes;\r
   EFI_FVB_GET_PHYSICAL_ADDRESS  GetPhysicalAddress;\r
@@ -416,11 +353,14 @@ struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL {
   EFI_FVB_READ                  Read;\r
   EFI_FVB_WRITE                 Write;\r
   EFI_FVB_ERASE_BLOCKS          EraseBlocks;\r
+  ///\r
+  /// The handle of the parent firmware volume.\r
+  ///  \r
   EFI_HANDLE                    ParentHandle;\r
 };\r
 \r
 \r
 extern EFI_GUID gEfiFirmwareVolumeBlockProtocolGuid;\r
-\r
+extern EFI_GUID gEfiFirmwareVolumeBlock2ProtocolGuid;\r
 \r
 #endif\r