X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FInclude%2FProtocol%2FFirmwareVolume2.h;h=e54364b94248b572e159a27245308ab3f970ef7d;hp=66fa1e4a39c499df1b9289fc7efb08ac46a2c70c;hb=04789f89d5c762d3dc2274bd26a42b7badd46634;hpb=19bee90c32772dd225332193858d9c2fcd2930aa diff --git a/MdePkg/Include/Protocol/FirmwareVolume2.h b/MdePkg/Include/Protocol/FirmwareVolume2.h index 66fa1e4a39..e54364b942 100644 --- a/MdePkg/Include/Protocol/FirmwareVolume2.h +++ b/MdePkg/Include/Protocol/FirmwareVolume2.h @@ -5,8 +5,8 @@ the system during the DXE phase. The Firmware Volume Protocol also provides mechanisms for determining and modifying some attributes of the firmware volume. - Copyright (c) 2006 - 2007, Intel Corporation - All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -28,9 +28,9 @@ typedef struct _EFI_FIRMWARE_VOLUME2_PROTOCOL EFI_FIRMWARE_VOLUME2_PROTOCOL; -// -// EFI_FV_ATTRIBUTES -// +/// +/// EFI_FV_ATTRIBUTES +/// typedef UINT64 EFI_FV_ATTRIBUTES; // @@ -85,7 +85,8 @@ typedef UINT64 EFI_FV_ATTRIBUTES; #define EFI_FV2_ALIGNMENT_2G 0x00000000001F0000ULL /** - + Returns the attributes and current settings of the firmware volume. + Because of constraints imposed by the underlying firmware storage, an instance of the Firmware Volume Protocol may not be to able to support all possible variations of this @@ -94,11 +95,9 @@ typedef UINT64 EFI_FV_ATTRIBUTES; GetVolumeAttributes() function. GetVolumeAttributes() is callable only from TPL_NOTIFY and below. Behavior of GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is - undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI - 2.0 specification. - - @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance. + undefined. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance. @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which the attributes and current settings are @@ -118,6 +117,8 @@ EFI_STATUS /** + Modifies the current settings of the firmware volume according to the input parameter. + The SetVolumeAttributes() function is used to set configurable firmware volume attributes. Only EFI_FV_READ_STATUS, EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and @@ -132,12 +133,9 @@ EFI_STATUS prevents further modification to all the attribute bits. SetVolumeAttributes() is callable only from TPL_NOTIFY and below. Behavior of SetVolumeAttributes() at any EFI_TPL above - TPL_NOTIFY is undefined. Type EFI_TPL is defined in - RaiseTPL() in the UEFI 2.0 specification. - + TPL_NOTIFY is undefined. - @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance. + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance. @param FvAttributes On input, FvAttributes is a pointer to an EFI_FV_ATTRIBUTES containing the @@ -148,10 +146,10 @@ EFI_STATUS modified and the firmware volume settings are not changed. - @retval EFI_SUCCESS The requested firmware volume attributes - were set and the resulting - EFI_FV_ATTRIBUTES is returned in - FvAttributes. + @retval EFI_SUCCESS The requested firmware volume attributes + were set and the resulting + EFI_FV_ATTRIBUTES is returned in + FvAttributes. @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS is set to 1 on input, but the @@ -214,11 +212,13 @@ EFI_STATUS /** + Retrieves a file and/or file information from the firmware volume. + ReadFile() is used to retrieve any file from a firmware volume during the DXE phase. The actual binary encoding of the file in the firmware volume media may be in any arbitrary format as long - as it does the following: ?It is accessed using the Firmware - Volume Protocol. ?The image that is returned follows the image + as it does the following: It is accessed using the Firmware + Volume Protocol. The image that is returned follows the image format defined in Code Definitions: PI Firmware File Format. If the input value of Buffer==NULL, it indicates the caller is requesting only that the type, attributes, and size of the @@ -251,37 +251,35 @@ EFI_STATUS other output parameters are returned with valid values. ReadFile() is callable only from TPL_NOTIFY and below. Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is - undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI - 2.0 specification. - - @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance. + undefined. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance. - @param NameGuid Pointer to an EFI_GUID, which is the file - name. All firmware file names are EFI_GUIDs. - A single firmware volume must not have two - valid files with the same file name - EFI_GUID. + @param NameGuid Pointer to an EFI_GUID, which is the file + name. All firmware file names are EFI_GUIDs. + A single firmware volume must not have two + valid files with the same file name + EFI_GUID. - @param Buffer Pointer to a pointer to a buffer in which the - file contents are returned, not including the - file header. - @param BufferSize Pointer to a caller-allocated UINTN. It - indicates the size of the memory - represented by Buffer. + @param Buffer Pointer to a pointer to a buffer in which the + file contents are returned, not including the + file header. + + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. - @param FoundType Pointer to a caller-allocated - EFI_FV_FILETYPE. + @param FoundType Pointer to a caller-allocated EFI_FV_FILETYPE. - @param FileAttributes Pointer to a caller-allocated - EFI_FV_FILE_ATTRIBUTES. + @param FileAttributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. @param AuthenticationStatus Pointer to a caller-allocated UINT32 in which the authentication status is returned. - @retval EFI_SUCCESS The call completed successfully. + @retval EFI_SUCCESS The call completed successfully. @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested @@ -289,17 +287,15 @@ EFI_STATUS filled and the output is truncated. - @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. - @retval EFI_NOT_FOUND Name was not found in the firmware - volume. + @retval EFI_NOT_FOUND Name was not found in the firmware volume. - @retval EFI_DEVICE_ERROR A hardware error occurred when - attempting to access the firmware - volume. + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware volume. - @retval EFI_ACCESS_DENIED The firmware volume is configured to - isallow reads. + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. **/ typedef @@ -317,12 +313,12 @@ EFI_STATUS /** + Locates the requested section within a file and returns it in a buffer. + ReadSection() is used to retrieve a specific section from a file within a firmware volume. The section returned is determined using a depth-first, left-to-right search algorithm through all - sections found in the specified file. See - ????Firmware File Sections???? on page 9 for more details about - sections. The output buffer is specified by a double indirection + sections found in the specified file. The output buffer is specified by a double indirection of the Buffer parameter. The input value of Buffer is used to determine if the output buffer is caller allocated or is dynamically allocated by ReadSection(). If the input value of @@ -343,36 +339,33 @@ EFI_STATUS parameters are returned with valid values. ReadSection() is callable only from TPL_NOTIFY and below. Behavior of ReadSection() at any EFI_TPL above TPL_NOTIFY is - undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI - 2.0 specification. - - - @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance. - - @param NameGuid Pointer to an EFI_GUID, which indicates the - file name from which the requested section - will be read. - - @param SectionType Indicates the section type to return. - SectionType in conjunction with - SectionInstance indicates which section to - return. - - @param SectionInstance Indicates which instance of sections - with a type of SectionType to return. - SectionType in conjunction with - SectionInstance indicates which - section to return. SectionInstance is - zero based. - - @param Buffer Pointer to a pointer to a buffer in which the - section contents are returned, not including - the section header. - - @param BufferSize Pointer to a caller-allocated UINTN. It - indicates the size of the memory - represented by Buffer. + undefined. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance. + + @param NameGuid Pointer to an EFI_GUID, which indicates the + file name from which the requested section + will be read. + + @param SectionType Indicates the section type to return. + SectionType in conjunction with + SectionInstance indicates which section to + return. + + @param SectionInstance Indicates which instance of sections + with a type of SectionType to return. + SectionType in conjunction with + SectionInstance indicates which + section to return. SectionInstance is + zero based. + + @param Buffer Pointer to a pointer to a buffer in which the + section contents are returned, not including + the section header. + + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. @param AuthenticationStatus Pointer to a caller-allocated UINT32 in which the authentication @@ -425,9 +418,9 @@ EFI_STATUS OUT UINT32 *AuthenticationStatus ); -// -// EFI_FV_WRITE_POLICY -// +/// +/// EFI_FV_WRITE_POLICY, two policies (unreliable write and reliable write) are defined. +/// typedef UINT32 EFI_FV_WRITE_POLICY; #define EFI_FV_UNRELIABLE_WRITE 0x00000000 #define EFI_FV_RELIABLE_WRITE 0x00000001 @@ -436,14 +429,31 @@ typedef UINT32 EFI_FV_WRITE_POLICY; // EFI_FV_WRITE_FILE_DATA // typedef struct { + /// + /// Pointer to a GUID, which is the file name to be written. + /// EFI_GUID *NameGuid; + /// + /// Indicates the type of file to be written. + /// EFI_FV_FILETYPE Type; + /// + /// Indicates the attributes for the file to be written. + /// EFI_FV_FILE_ATTRIBUTES FileAttributes; + /// + /// Pointer to a buffer containing the file to be written. + /// VOID *Buffer; + /// + /// Indicates the size of the file image contained in Buffer. + /// UINT32 BufferSize; } EFI_FV_WRITE_FILE_DATA; /** + Locates the requested section within a file and returns it in a buffer. + WriteFile() is used to write one or more files to a firmware volume. Each file to be written is described by an EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that @@ -462,39 +472,37 @@ typedef struct { Architectural Elements 84 August 21, 2006 Version 1.0 WriteFile() is callable only from TPL_NOTIFY and below. Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is - undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 - specification. - - @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance. NumberOfFiles Indicates the number of - elements in the array pointed to by FileData. + undefined. + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance. - @param WritePolicy Indicates the level of reliability for the - write in the event of a power failure or - other system failure during the write - operation. + @param NumberOfFiles Indicates the number of elements in the array pointed to by FileData - @param FileData Pointer to an array of - EFI_FV_WRITE_FILE_DATA. Each element of - FileData[] represents a file to be written. + @param WritePolicy Indicates the level of reliability for the + write in the event of a power failure or + other system failure during the write + operation. + + @param FileData Pointer to an array of + EFI_FV_WRITE_FILE_DATA. Each element of + FileData[] represents a file to be written. - @retval EFI_SUCCESS The write completed successfully. + @retval EFI_SUCCESS The write completed successfully. - @retval EFI_OUT_OF_RESOURCES The firmware volume does not - have enough free space to - storefile(s). + @retval EFI_OUT_OF_RESOURCES The firmware volume does not + have enough free space to + storefile(s). - @retval EFI_DEVICE_ERROR A hardware error occurred when - attempting to access the firmware volume. + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware volume. - @retval EFI_WRITE_PROTECTED The firmware volume is - configured to disallow writes. + @retval EFI_WRITE_PROTECTED The firmware volume is + configured to disallow writes. - @retval EFI_NOT_FOUND A delete was requested, but the - requested file was not found in the - firmware volume. + @retval EFI_NOT_FOUND A delete was requested, but the + requested file was not found in the + firmware volume. @retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write. @@ -520,6 +528,9 @@ EFI_STATUS /** + Retrieves information about the next file in the firmware volume store + that matches the search criteria. + GetNextFile() is the interface that is used to search a firmware volume for a particular file. It is called successively until the desired file is located or the function returns @@ -536,22 +547,16 @@ EFI_STATUS implementation specific and no semantic content is implied. GetNextFile() is callable only from TPL_NOTIFY and below. Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is - undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 - specification. Status Codes Returned - - - @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance. Key Pointer to a caller-allocated buffer - that contains implementation-specific data that is - used to track where to begin the search for the - next file. The size of the buffer must be at least - This->KeySize bytes long. To re-initialize the - search and begin from the beginning of the - firmware volume, the entire buffer must be cleared - to zero. Other than clearing the buffer to - initiate a new search, the caller must not modify - the data in the buffer between calls to - GetNextFile(). + undefined. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance. + + @param Key Pointer to a caller-allocated buffer that contains implementation-specific data that is + used to track where to begin the search for the next file. The size of the buffer must be + at least This->KeySize bytes long. To re-initialize the search and begin from the + beginning of the firmware volume, the entire buffer must be cleared to zero. Other + than clearing the buffer to initiate a new search, the caller must not modify the data in + the buffer between calls to GetNextFile(). @param FileType Pointer to a caller-allocated EFI_FV_FILETYPE. The GetNextFile() API can @@ -576,16 +581,16 @@ EFI_STATUS EFI_FV_FILE_ATTRIBUTES is defined in ReadFile(). - @param Size Pointer to a caller-allocated UINTN. If a - matching file is found, the file's size is - returned in *Size. If no matching file is found, - Size is not modified. + @param Size Pointer to a caller-allocated UINTN. If a + matching file is found, the file's size is + returned in *Size. If no matching file is found, + Size is not modified. - @retval EFI_SUCCESS The output parameters are filled with data - obtained from the first matching file that - was found. + @retval EFI_SUCCESS The output parameters are filled with data + obtained from the first matching file that + was found. - @retval FI_NOT_FOUND No files of type FileType were found. + @retval FI_NOT_FOUND No files of type FileType were found. @retval EFI_DEVICE_ERROR A hardware error occurred when @@ -609,6 +614,8 @@ EFI_STATUS ); /** + Return information about a firmware volume. + The GetInfo() function returns information of type InformationType for the requested firmware volume. If the volume does not support the requested information type, then @@ -619,28 +626,28 @@ EFI_STATUS this specification are required information types that all file systems must support. - @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance that is the file handle the requested - information is for. + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the requested + information is for. @param InformationType The type identifier for the information being requested. - @param BufferSize On input, the size of Buffer. On output, - the amount of data returned in Buffer. In - both cases, the size is measured in bytes. + @param BufferSize On input, the size of Buffer. On output, + the amount of data returned in Buffer. In + both cases, the size is measured in bytes. - @param Buffer A pointer to the data buffer to return. The - buffer's type is indicated by InformationType. + @param Buffer A pointer to the data buffer to return. The + buffer's type is indicated by InformationType. - @retval EFI_SUCCESS The information was retrieved. + @retval EFI_SUCCESS The information was retrieved. - @retval EFI_UNSUPPORTED The InformationType is not known. + @retval EFI_UNSUPPORTED The InformationType is not known. - @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @@ -664,42 +671,43 @@ EFI_STATUS /** + Sets information about a firmware volume. The SetInfo() function sets information of type InformationType on the requested firmware volume. - @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL - instance that is the file handle the information - is for. + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the information + is for. @param InformationType The type identifier for the information being set. - @param BufferSize The size, in bytes, of Buffer. + @param BufferSize The size, in bytes, of Buffer. - @param Buffer A pointer to the data buffer to write. The - buffer's type is indicated by InformationType. + @param Buffer A pointer to the data buffer to write. The + buffer's type is indicated by InformationType. - @retval EFI_SUCCESS The information was set. + @retval EFI_SUCCESS The information was set. - @retval EFI_UNSUPPORTED The InformationType is not known. + @retval EFI_UNSUPPORTED The InformationType is not known. - @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The media is read only. + @retval EFI_WRITE_PROTECTED The media is read only. - @retval EFI_VOLUME_FULL The volume is full. + @retval EFI_VOLUME_FULL The volume is full. - @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the - size of the type indicated by - InformationType. + @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the + size of the type indicated by + InformationType. **/ typedef @@ -712,60 +720,19 @@ EFI_STATUS ); -/** - The Firmware Volume Protocol contains the file-level - abstraction to the firmware volume as well as some firmware - volume attribute reporting and configuration services. The - Firmware Volume Protocol is the interface used by all parts of - DXE that are not directly involved with managing the firmware - volume itself. This abstraction allows many varied types of - firmware volume implementations. A firmware volume may be a - flash device or it may be a file in the UEFI system partition, - for example. This level of firmware volume implementation - detail is not visible to the consumers of the Firmware Volume - Protocol. - - @param GetVolumeAttributes Retrieves volume capabilities - and current settings. See the - GetVolumeAttributes() function - description. - - @param SetVolumeAttributes Modifies the current settings of - the firmware volume. See the - SetVolumeAttributes() function - description. - - @param ReadFile Reads an entire file from the firmware - volume. See the ReadFile() function - description. - - @param ReadSection Reads a single section from a file into - a buffer. - - @param WriteFile Writes an entire file into the firmware - volume. See the WriteFile() function - description. - - @param GetNextFile Provides service to allow searching the - firmware volume. See the GetNextFile() - function description. - - @param KeySize Data field that indicates the size in bytes - of the Key input buffer for the - GetNextFile() API. - - @param ParentHandle Handle of the parent firmware volume. - Type EFI_HANDLE is defined in - InstallProtocolInterface() in the UEFI - 2.0 specification. - - @param GetInfo Gets the requested file or volume - information. See the GetInfo() function - description. - @param SetInfo Sets the requested file information. See the - SetInfo() function description. - -**/ +/// +/// The Firmware Volume Protocol contains the file-level +/// abstraction to the firmware volume as well as some firmware +/// volume attribute reporting and configuration services. The +/// Firmware Volume Protocol is the interface used by all parts of +/// DXE that are not directly involved with managing the firmware +/// volume itself. This abstraction allows many varied types of +/// firmware volume implementations. A firmware volume may be a +/// flash device or it may be a file in the UEFI system partition, +/// for example. This level of firmware volume implementation +/// detail is not visible to the consumers of the Firmware Volume +/// Protocol. +/// struct _EFI_FIRMWARE_VOLUME2_PROTOCOL { EFI_FV_GET_ATTRIBUTES GetVolumeAttributes; EFI_FV_SET_ATTRIBUTES SetVolumeAttributes; @@ -773,7 +740,17 @@ struct _EFI_FIRMWARE_VOLUME2_PROTOCOL { EFI_FV_READ_SECTION ReadSection; EFI_FV_WRITE_FILE WriteFile; EFI_FV_GET_NEXT_FILE GetNextFile; + + /// + /// Data field that indicates the size in bytes + /// of the Key input buffer for the + /// GetNextFile() API. + /// UINT32 KeySize; + + /// + /// Handle of the parent firmware volume. + /// EFI_HANDLE ParentHandle; EFI_FV_GET_INFO GetInfo; EFI_FV_SET_INFO SetInfo;