+++ /dev/null
-/** @file\r
-\r
- The internal header file includes the common header files, defines\r
- internal structure and functions used by FVB module.\r
-\r
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>\r
- \r\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
- \r\r
-\r
-**/\r
-\r
-#ifndef _SMM_FVB_DXE_H_\r
-#define _SMM_FVB_DXE_H_\r
-\r
-#include <PiDxe.h>\r
-\r
-#include <Protocol/SmmFirmwareVolumeBlock.h>\r
-#include <Protocol/SmmCommunication.h>\r
-\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DevicePathLib.h>\r
-\r
-#include <Guid/EventGroup.h>\r
-#include "FvbSmmCommon.h"\r
-\r
-#define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'S')\r
-#define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FVB_DEVICE, FvbInstance, FVB_DEVICE_SIGNATURE)\r
-\r
-typedef struct {\r
- MEDIA_FW_VOL_DEVICE_PATH FvDevPath;\r
- EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
-} FV_PIWG_DEVICE_PATH;\r
-\r
-typedef struct {\r
- MEMMAP_DEVICE_PATH MemMapDevPath;\r
- EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
-} FV_MEMMAP_DEVICE_PATH;\r
-\r
-typedef struct {\r
- UINTN Signature;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FvbInstance;\r
- EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL *SmmFvbInstance;\r
-} EFI_FVB_DEVICE;\r
-\r
-/**\r
- This function retrieves the attributes and current settings of the block.\r
-\r
- @param[in] This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
-\r
- @param[out] Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the attributes\r
- and current settings are returned. Type EFI_FVB_ATTRIBUTES_2\r
- is defined in EFI_FIRMWARE_VOLUME_HEADER.\r
-\r
- @retval EFI_SUCCESS The firmware volume attributes were returned.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbGetAttributes (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes\r
- );\r
-\r
-\r
- /**\r
- Sets Volume attributes. No polarity translations are done.\r
-\r
- @param[in] This Calling context.\r
- @param[out] Attributes Output buffer which contains attributes.\r
-\r
- @retval EFI_SUCCESS The function always return successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbSetAttributes (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes\r
- );\r
-\r
-\r
-/**\r
- Retrieves the physical address of the device.\r
-\r
- @param[in] This A pointer to EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL.\r
- @param[out] Address Output buffer containing the address.\r
-\r
- @retval EFI_SUCCESS The function always return successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbGetPhysicalAddress (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- OUT EFI_PHYSICAL_ADDRESS *Address\r
- );\r
-\r
-\r
-/**\r
- Retrieve the size of a logical block.\r
-\r
- @param[in] This Calling context.\r
- @param[in] Lba Indicates which block to return the size for.\r
- @param[out] BlockSize A pointer to a caller allocated UINTN in which\r
- the size of the block is returned.\r
- @param[out] NumOfBlocks A pointer to a caller allocated UINTN in which the\r
- number of consecutive blocks starting with Lba is\r
- returned. All blocks in this range have a size of\r
- BlockSize.\r
-\r
- @retval EFI_SUCCESS The function always return successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbGetBlockSize (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- IN EFI_LBA Lba,\r
- OUT UINTN *BlockSize,\r
- OUT UINTN *NumOfBlocks\r
- );\r
-\r
-\r
-/**\r
- Reads data beginning at Lba:Offset from FV. The Read terminates either\r
- when *NumBytes of data have been read, or when a block boundary is\r
- reached. *NumBytes is updated to reflect the actual number of bytes\r
- written. The write opertion does not include erase. This routine will\r
- attempt to write only the specified bytes. If the writes do not stick,\r
- it will return an error.\r
-\r
- @param[in] This Calling context.\r
- @param[in] Lba Block in which to begin write.\r
- @param[in] Offset Offset in the block at which to begin write\r
- @param[in,out] NumBytes On input, indicates the requested write size. On\r
- output, indicates the actual number of bytes written\r
- @param[in] Buffer Buffer containing source data for the write.\r
-\r
- @retval EFI_SUCCESS The firmware volume was read successfully and\r
- contents are in Buffer\r
- @retval EFI_BAD_BUFFER_SIZE Read attempted across a LBA boundary. On output,\r
- NumBytes contains the total number of bytes returned\r
- in Buffer\r
- @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabled state\r
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and\r
- could not be read\r
- @retval EFI_INVALID_PARAMETER NumBytes or Buffer are NULL\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbRead (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- IN EFI_LBA Lba,\r
- IN UINTN Offset,\r
- IN OUT UINTN *NumBytes,\r
- OUT UINT8 *Buffer\r
- );\r
-\r
-\r
-/**\r
- Writes data beginning at Lba:Offset from FV. The write terminates either\r
- when *NumBytes of data have been written, or when a block boundary is\r
- reached. *NumBytes is updated to reflect the actual number of bytes\r
- written. The write opertion does not include erase. This routine will\r
- attempt to write only the specified bytes. If the writes do not stick,\r
- it will return an error.\r
-\r
- @param[in] This Calling context.\r
- @param[in] Lba Block in which to begin write.\r
- @param[in] Offset Offset in the block at which to begin write.\r
- @param[in,out] NumBytes On input, indicates the requested write size. On\r
- output, indicates the actual number of bytes written\r
- @param[in] Buffer Buffer containing source data for the write.\r
-\r
- @retval EFI_SUCCESS The firmware volume was written successfully\r
- @retval EFI_BAD_BUFFER_SIZE Write attempted across a LBA boundary. On output,\r
- NumBytes contains the total number of bytes\r
- actually written.\r
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state\r
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and\r
- could not be written.\r
- @retval EFI_INVALID_PARAMETER NumBytes or Buffer are NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbWrite (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- IN EFI_LBA Lba,\r
- IN UINTN Offset,\r
- IN OUT UINTN *NumBytes,\r
- IN UINT8 *Buffer\r
- );\r
-\r
-\r
-/**\r
- The EraseBlock() function erases one or more blocks as denoted by the\r
- variable argument list. The entire parameter list of blocks must be verified\r
- prior to erasing any blocks. If a block is requested that does not exist\r
- within the associated firmware volume (it has a larger index than the last\r
- block of the firmware volume), the EraseBlock() function must return\r
- EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
-\r
- @param[in] This Calling context.\r
- @param[in] ... Starting LBA followed by Number of Lba to erase.\r
- a -1 to terminate the list.\r
-\r
- @retval EFI_SUCCESS The erase request was successfully completed.\r
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state\r
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and\r
- could not be written. Firmware device may have been\r
- partially erased.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvbEraseBlocks (\r
- IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- ...\r
- );\r
-\r
-#endif\r