]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Include/Protocol/FirmwareVolume.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / FirmwareVolume.h
diff --git a/OldMdePkg/Include/Protocol/FirmwareVolume.h b/OldMdePkg/Include/Protocol/FirmwareVolume.h
new file mode 100644 (file)
index 0000000..310ea83
--- /dev/null
@@ -0,0 +1,319 @@
+/** @file\r
+  This file declares Firmware Volume protocol.\r
+\r
+  Copyright (c) 2006, 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
+\r
+  Module Name:  FirmwareVolume.h\r
+\r
+  @par Revision Reference:\r
+  This protocol is defined in Firmware Volume specification.\r
+  Version 0.9\r
+\r
+**/\r
+\r
+#ifndef __FIRMWARE_VOLUME_H__\r
+#define __FIRMWARE_VOLUME_H__\r
+\r
+\r
+//\r
+// Firmware Volume Protocol GUID definition\r
+//\r
+#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \\r
+  { \\r
+    0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \\r
+  }\r
+\r
+#define FV_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', '_')\r
+\r
+typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL  EFI_FIRMWARE_VOLUME_PROTOCOL;\r
+\r
+//\r
+// EFI_FV_ATTRIBUTES bit definitions\r
+//\r
+typedef UINT64  EFI_FV_ATTRIBUTES;\r
+\r
+//\r
+// ************************************************************\r
+// EFI_FV_ATTRIBUTES bit definitions\r
+// ************************************************************\r
+//\r
+#define EFI_FV_READ_DISABLE_CAP       0x0000000000000001ULL\r
+#define EFI_FV_READ_ENABLE_CAP        0x0000000000000002ULL\r
+#define EFI_FV_READ_STATUS            0x0000000000000004ULL\r
+\r
+#define EFI_FV_WRITE_DISABLE_CAP      0x0000000000000008ULL\r
+#define EFI_FV_WRITE_ENABLE_CAP       0x0000000000000010ULL\r
+#define EFI_FV_WRITE_STATUS           0x0000000000000020ULL\r
+\r
+#define EFI_FV_LOCK_CAP               0x0000000000000040ULL\r
+#define EFI_FV_LOCK_STATUS            0x0000000000000080ULL\r
+#define EFI_FV_WRITE_POLICY_RELIABLE  0x0000000000000100ULL\r
+\r
+#define EFI_FV_ALIGNMENT_CAP          0x0000000000008000ULL\r
+#define EFI_FV_ALIGNMENT_2            0x0000000000010000ULL\r
+#define EFI_FV_ALIGNMENT_4            0x0000000000020000ULL\r
+#define EFI_FV_ALIGNMENT_8            0x0000000000040000ULL\r
+#define EFI_FV_ALIGNMENT_16           0x0000000000080000ULL\r
+#define EFI_FV_ALIGNMENT_32           0x0000000000100000ULL\r
+#define EFI_FV_ALIGNMENT_64           0x0000000000200000ULL\r
+#define EFI_FV_ALIGNMENT_128          0x0000000000400000ULL\r
+#define EFI_FV_ALIGNMENT_256          0x0000000000800000ULL\r
+#define EFI_FV_ALIGNMENT_512          0x0000000001000000ULL\r
+#define EFI_FV_ALIGNMENT_1K           0x0000000002000000ULL\r
+#define EFI_FV_ALIGNMENT_2K           0x0000000004000000ULL\r
+#define EFI_FV_ALIGNMENT_4K           0x0000000008000000ULL\r
+#define EFI_FV_ALIGNMENT_8K           0x0000000010000000ULL\r
+#define EFI_FV_ALIGNMENT_16K          0x0000000020000000ULL\r
+#define EFI_FV_ALIGNMENT_32K          0x0000000040000000ULL\r
+#define EFI_FV_ALIGNMENT_64K          0x0000000080000000ULL\r
+\r
+//\r
+// Protocol API definitions\r
+//\r
+\r
+/**\r
+  Retrieves attributes, insures positive polarity of attribute bits, returns\r
+  resulting attributes in output parameter\r
+\r
+  @param  This                  Calling context\r
+  @param  Attributes            output buffer which contains attributes\r
+\r
+  @retval EFI_INVALID_PARAMETER\r
+  @retval EFI_SUCCESS\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_GET_ATTRIBUTES) (\r
+  IN  EFI_FIRMWARE_VOLUME_PROTOCOL  *This,\r
+  OUT EFI_FV_ATTRIBUTES             *Attributes\r
+  );\r
+\r
+/**\r
+  Sets volume attributes\r
+\r
+  @param  This                  Calling context\r
+  @param  Attributes            Buffer which contains attributes\r
+\r
+  @retval EFI_INVALID_PARAMETER\r
+  @retval EFI_DEVICE_ERROR\r
+  @retval EFI_SUCCESS\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_SET_ATTRIBUTES) (\r
+  IN EFI_FIRMWARE_VOLUME_PROTOCOL   *This,\r
+  IN OUT EFI_FV_ATTRIBUTES          *Attributes\r
+  );\r
+\r
+typedef UINT32  EFI_FV_FILE_ATTRIBUTES;\r
+\r
+#define EFI_FV_FILE_ATTRIB_ALIGNMENT  0x0000001F\r
+\r
+/**\r
+  Read the requested file (NameGuid) and returns data in Buffer.\r
+\r
+  @param  This                  Calling context\r
+  @param  NameGuid              Filename identifying which file to read\r
+  @param  Buffer                Pointer to pointer to buffer in which contents of file are returned.\r
+                                <br>\r
+                                If Buffer is NULL, only type, attributes, and size are returned as\r
+                                there is no output buffer.\r
+                                <br>\r
+                                If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r
+                                from BS pool by ReadFile\r
+                                <br>\r
+                                If Buffer != NULL and *Buffer != NULL, the output buffer has been\r
+                                allocated by the caller and is being passed in.\r
+  @param  BufferSize            Indicates the buffer size passed in, and on output the size\r
+                                required to complete the read\r
+  @param  FoundType             Indicates the type of the file who's data is returned\r
+  @param  FileAttributes        Indicates the attributes of the file who's data is resturned\r
+  @param  AuthenticationStatus  Indicates the authentication status of the data\r
+\r
+  @retval EFI_SUCCESS\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL\r
+  @retval EFI_NOT_FOUND\r
+  @retval EFI_DEVICE_ERROR\r
+  @retval EFI_ACCESS_DENIED\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_READ_FILE) (\r
+  IN EFI_FIRMWARE_VOLUME_PROTOCOL   *This,\r
+  IN EFI_GUID                       *NameGuid,\r
+  IN OUT VOID                       **Buffer,\r
+  IN OUT UINTN                      *BufferSize,\r
+  OUT EFI_FV_FILETYPE               *FoundType,\r
+  OUT EFI_FV_FILE_ATTRIBUTES        *FileAttributes,\r
+  OUT UINT32                        *AuthenticationStatus\r
+  );\r
+\r
+/**\r
+  Read the requested section from the specified file and returns data in Buffer.\r
+\r
+  @param  This                  Calling context\r
+  @param  NameGuid              Filename identifying the file from which to read\r
+  @param  SectionType           Indicates what section type to retrieve\r
+  @param  SectionInstance       Indicates which instance of SectionType to retrieve\r
+  @param  Buffer                Pointer to pointer to buffer in which contents of file are returned.\r
+                                <br>\r
+                                If Buffer is NULL, only type, attributes, and size are returned as\r
+                                there is no output buffer.\r
+                                <br>\r
+                                If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r
+                                from BS pool by ReadFile\r
+                                <br>\r
+                                If Buffer != NULL and *Buffer != NULL, the output buffer has been\r
+                                allocated by the caller and is being passed in.\r
+  @param  BufferSize            Indicates the buffer size passed in, and on output the size\r
+                                required to complete the read\r
+  @param  AuthenticationStatus  Indicates the authentication status of the data\r
+\r
+  @retval EFI_SUCCESS\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL\r
+  @retval EFI_OUT_OF_RESOURCES\r
+  @retval EFI_NOT_FOUND\r
+  @retval EFI_DEVICE_ERROR\r
+  @retval EFI_ACCESS_DENIED\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_READ_SECTION) (\r
+  IN EFI_FIRMWARE_VOLUME_PROTOCOL   *This,\r
+  IN EFI_GUID                       *NameGuid,\r
+  IN EFI_SECTION_TYPE               SectionType,\r
+  IN UINTN                          SectionInstance,\r
+  IN OUT VOID                       **Buffer,\r
+  IN OUT UINTN                      *BufferSize,\r
+  OUT UINT32                        *AuthenticationStatus\r
+  );\r
+\r
+typedef UINT32  EFI_FV_WRITE_POLICY;\r
+\r
+#define EFI_FV_UNRELIABLE_WRITE 0x00000000\r
+#define EFI_FV_RELIABLE_WRITE   0x00000001\r
+\r
+typedef struct {\r
+  EFI_GUID                *NameGuid;\r
+  EFI_FV_FILETYPE         Type;\r
+  EFI_FV_FILE_ATTRIBUTES  FileAttributes;\r
+  VOID                    *Buffer;\r
+  UINT32                  BufferSize;\r
+} EFI_FV_WRITE_FILE_DATA;\r
+\r
+/**\r
+  Write the supplied file (NameGuid) to the FV.\r
+\r
+  @param  This                  Calling context\r
+  @param  NumberOfFiles         Indicates the number of file records pointed to by FileData\r
+  @param  WritePolicy           Indicates the level of reliability of the write with respect to\r
+                                things like power failure events.\r
+  @param  FileData              A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each\r
+                                element in the array indicates a file to write, and there are\r
+                                NumberOfFiles elements in the input array.\r
+\r
+  @retval EFI_SUCCESS\r
+  @retval EFI_OUT_OF_RESOURCES\r
+  @retval EFI_DEVICE_ERROR\r
+  @retval EFI_WRITE_PROTECTED\r
+  @retval EFI_NOT_FOUND\r
+  @retval EFI_INVALID_PARAMETER\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_WRITE_FILE) (\r
+  IN EFI_FIRMWARE_VOLUME_PROTOCOL   *This,\r
+  IN UINT32                         NumberOfFiles,\r
+  IN EFI_FV_WRITE_POLICY            WritePolicy,\r
+  IN EFI_FV_WRITE_FILE_DATA         *FileData\r
+  );\r
+\r
+/**\r
+  Given the input key, search for the next matching file in the volume.\r
+\r
+  @param  This                  Calling context\r
+  @param  Key                   Pointer to a caller allocated buffer that contains an implementation\r
+                                specific key that is used to track where to begin searching on\r
+                                successive calls.\r
+  @param  FileType              Indicates the file type to filter for\r
+  @param  NameGuid              Guid filename of the file found\r
+  @param  Attributes            Attributes of the file found\r
+  @param  Size                  Size in bytes of the file found\r
+\r
+  @retval EFI_SUCCESS\r
+  @retval EFI_NOT_FOUND\r
+  @retval EFI_DEVICE_ERROR\r
+  @retval EFI_ACCESS_DENIED\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_GET_NEXT_FILE) (\r
+  IN EFI_FIRMWARE_VOLUME_PROTOCOL   *This,\r
+  IN OUT VOID                       *Key,\r
+  IN OUT EFI_FV_FILETYPE            *FileType,\r
+  OUT EFI_GUID                      *NameGuid,\r
+  OUT EFI_FV_FILE_ATTRIBUTES        *Attributes,\r
+  OUT UINTN                         *Size\r
+  );\r
+\r
+/**\r
+  @par Protocol Description:\r
+  The Firmware Volume Protocol provides file-level access to the firmware volume.\r
+  Each firmware volume driver must produce an instance of the Firmware Volume \r
+  Protocol if the firmware volume is to be visible to the system. The Firmware \r
+  Volume Protocol also provides mechanisms for determining and modifying some \r
+  attributes of the firmware volume.  \r
+\r
+  @param GetVolumeAttributes\r
+  Retrieves volume capabilities and current settings. \r
+\r
+  @param SetVolumeAttributes\r
+  Modifies the current settings of the firmware volume.\r
+\r
+  @param ReadFile\r
+  Reads an entire file from the firmware volume. \r
+\r
+  @param ReadSection\r
+  Reads a single section from a file into a buffer.\r
+\r
+  @param WriteFile\r
+  Writes an entire file into the firmware volume.\r
+\r
+  @param GetNextFile\r
+  Provides service to allow searching the firmware volume.\r
+\r
+  @param KeySize\r
+  Data field that indicates the size in bytes of the Key input buffer for \r
+  the GetNextFile() API. \r
+\r
+  @param ParentHandle\r
+  Handle of the parent firmware volume.\r
+\r
+**/\r
+struct _EFI_FIRMWARE_VOLUME_PROTOCOL {\r
+  EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;\r
+  EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;\r
+  EFI_FV_READ_FILE      ReadFile;\r
+  EFI_FV_READ_SECTION   ReadSection;\r
+  EFI_FV_WRITE_FILE     WriteFile;\r
+  EFI_FV_GET_NEXT_FILE  GetNextFile;\r
+  UINT32                KeySize;\r
+  EFI_HANDLE            ParentHandle;\r
+};\r
+\r
+extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;\r
+\r
+#endif\r