--- /dev/null
+/** @file\r
+\r
+Copyright (c) 2004 - 2008, 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:\r
+\r
+ FvLib.h\r
+\r
+Abstract:\r
+\r
+ These functions assist in parsing and manipulating a Firmware Volume.\r
+\r
+**/\r
+\r
+#ifndef _EFI_FV_LIB_H\r
+#define _EFI_FV_LIB_H\r
+\r
+//\r
+// Include files\r
+//\r
+#include <string.h>\r
+\r
+#include <Common/UefiBaseTypes.h>\r
+#include <Common/PiFirmwareFile.h>\r
+#include <Common/PiFirmwareVolume.h>\r
+\r
+EFI_STATUS\r
+InitializeFvLib (\r
+ IN VOID *Fv,\r
+ IN UINT32 FvLength\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+GetFvHeader (\r
+ OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader,\r
+ OUT UINT32 *FvLength\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+GetNextFile (\r
+ IN EFI_FFS_FILE_HEADER *CurrentFile,\r
+ OUT EFI_FFS_FILE_HEADER **NextFile\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+GetFileByName (\r
+ IN EFI_GUID *FileName,\r
+ OUT EFI_FFS_FILE_HEADER **File\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+GetFileByType (\r
+ IN EFI_FV_FILETYPE FileType,\r
+ IN UINTN Instance,\r
+ OUT EFI_FFS_FILE_HEADER **File\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+GetSectionByType (\r
+ IN EFI_FFS_FILE_HEADER *File,\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ IN UINTN Instance,\r
+ OUT EFI_FILE_SECTION_POINTER *Section\r
+ )\r
+;\r
+//\r
+// will not parse compressed sections\r
+//\r
+EFI_STATUS\r
+VerifyFv (\r
+ IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
+ )\r
+;\r
+\r
+EFI_STATUS\r
+VerifyFfsFile (\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader\r
+ )\r
+;\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Verify the current pointer points to a FFS file header.\r
+\r
+Arguments:\r
+\r
+ FfsHeader Pointer to an alleged FFS file.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The Ffs header is valid.\r
+ EFI_NOT_FOUND This "file" is the beginning of free space.\r
+ EFI_VOLUME_CORRUPTED The Ffs header is not valid.\r
+\r
+--*/\r
+UINT32\r
+GetLength (\r
+ UINT8 *ThreeByteLength\r
+ )\r
+;\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Converts a three byte length value into a UINT32.\r
+\r
+Arguments:\r
+\r
+ ThreeByteLength Pointer to the first of the 3 byte length.\r
+\r
+Returns:\r
+\r
+ UINT32 Size of the section\r
+\r
+--*/\r
+EFI_STATUS\r
+GetErasePolarity (\r
+ OUT BOOLEAN *ErasePolarity\r
+ )\r
+;\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function returns with the FV erase polarity. If the erase polarity\r
+ for a bit is 1, the function return TRUE.\r
+\r
+Arguments:\r
+\r
+ ErasePolarity A pointer to the erase polarity.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The function completed successfully.\r
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.\r
+\r
+--*/\r
+UINT8\r
+GetFileState (\r
+ IN BOOLEAN ErasePolarity,\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader\r
+ )\r
+;\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function returns a the highest state bit in the FFS that is set.\r
+ It in no way validate the FFS file.\r
+\r
+Arguments:\r
+ \r
+ ErasePolarity The erase polarity for the file state bits.\r
+ FfsHeader Pointer to a FFS file.\r
+\r
+Returns:\r
+\r
+ UINT8 The hightest set state of the file.\r
+\r
+--*/\r
+#endif\r