EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Defines | Functions

IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/Ffs.c File Reference

#include "FwVolDriver.h"

Go to the source code of this file.

Defines

#define PHYSICAL_ADDRESS_TO_POINTER(Address)   ((VOID *) ((UINTN) Address))

Functions

VOID SetFileState (IN UINT8 State, IN EFI_FFS_FILE_HEADER *FfsHeader)
EFI_FFS_FILE_STATE GetFileState (IN UINT8 ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
EFI_STATUS Buffer2LbaEntry (IN FV_DEVICE *FvDevice, IN EFI_PHYSICAL_ADDRESS BufferAddress, OUT LBA_ENTRY **LbaListEntry)
EFI_STATUS Buffer2Lba (IN FV_DEVICE *FvDevice, IN EFI_PHYSICAL_ADDRESS BufferAddress, OUT EFI_LBA *Lba, OUT UINTN *Offset)
BOOLEAN IsBufferErased (IN UINT8 ErasePolarity, IN UINT8 *Buffer, IN UINTN BufferSize)
BOOLEAN VerifyFvHeaderChecksum (IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader)
BOOLEAN VerifyHeaderChecksum (IN EFI_FFS_FILE_HEADER *FfsHeader)
BOOLEAN VerifyFileChecksum (IN EFI_FFS_FILE_HEADER *FfsHeader)
BOOLEAN IsValidFFSHeader (IN UINT8 ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
EFI_PHYSICAL_ADDRESS GetNextPossibleFileHeader (IN UINT8 ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
EFI_FFS_FILE_HEADERDuplicateFileExist (IN FV_DEVICE *FvDevice, IN EFI_FFS_FILE_HEADER *FfsHeader, IN EFI_FFS_FILE_STATE StateBit)
EFI_STATUS UpdateHeaderBit (IN FV_DEVICE *FvDevice, IN EFI_FFS_FILE_HEADER *FfsHeader, IN EFI_FFS_FILE_STATE State)
BOOLEAN IsValidFFSFile (IN FV_DEVICE *FvDevice, IN EFI_FFS_FILE_HEADER *FfsHeader)

Detailed Description

FFS file access utilities.

Copyright (c) 2006 - 2011, 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

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file Ffs.c.


Define Documentation

#define PHYSICAL_ADDRESS_TO_POINTER (   Address)    ((VOID *) ((UINTN) Address))

Definition at line 19 of file Ffs.c.


Function Documentation

EFI_STATUS Buffer2Lba ( IN FV_DEVICE FvDevice,
IN EFI_PHYSICAL_ADDRESS  BufferAddress,
OUT EFI_LBA Lba,
OUT UINTN Offset 
)

Convert the Buffer Address to LBA Address & Offset.

Parameters:
FvDeviceCached FvDevice
BufferAddressAddress of Buffer
LbaPointer to the gob Lba value
OffsetPointer to the got Offset
Return values:
EFI_NOT_FOUNDBuffer address is out of FvDevice.
EFI_SUCCESSLBA and Offset is found for Buffer address.

Definition at line 138 of file Ffs.c.

EFI_STATUS Buffer2LbaEntry ( IN FV_DEVICE FvDevice,
IN EFI_PHYSICAL_ADDRESS  BufferAddress,
OUT LBA_ENTRY **  LbaListEntry 
)

Convert the Buffer Address to LBA Entry Address.

Parameters:
FvDeviceCached FvDevice
BufferAddressAddress of Buffer
LbaListEntryPointer to the got LBA entry that contains the address.
Return values:
EFI_NOT_FOUNDBuffer address is out of FvDevice.
EFI_SUCCESSLBA entry is found for Buffer address.

Definition at line 85 of file Ffs.c.

EFI_FFS_FILE_HEADER* DuplicateFileExist ( IN FV_DEVICE FvDevice,
IN EFI_FFS_FILE_HEADER FfsHeader,
IN EFI_FFS_FILE_STATE  StateBit 
)

Search FFS file with the same FFS name in FV Cache.

Parameters:
FvDeviceCached FV image.
FfsHeaderPoints to the FFS file header to be skipped.
StateBitFFS file state bit to be checked.
Returns:
Pointer to next found FFS header. NULL will return if no found.

Definition at line 432 of file Ffs.c.

EFI_FFS_FILE_STATE GetFileState ( IN UINT8  ErasePolarity,
IN EFI_FFS_FILE_HEADER FfsHeader 
)

Get the FFS file state by checking the highest bit set in the header's state field.

Parameters:
ErasePolarityErase polarity attribute of the firmware volume
FfsHeaderPoints to the FFS file header
Returns:
FFS File state

Definition at line 51 of file Ffs.c.

EFI_PHYSICAL_ADDRESS GetNextPossibleFileHeader ( IN UINT8  ErasePolarity,
IN EFI_FFS_FILE_HEADER FfsHeader 
)

Get next possible of Firmware File System Header.

Parameters:
ErasePolarityErase polarity attribute of the firmware volume
FfsHeaderPoints to the FFS file header to be skipped.
Returns:
Pointer to next FFS header.

Definition at line 384 of file Ffs.c.

BOOLEAN IsBufferErased ( IN UINT8  ErasePolarity,
IN UINT8 Buffer,
IN UINTN  BufferSize 
)

Check if a block of buffer is erased.

Parameters:
ErasePolarityErase polarity attribute of the firmware volume
BufferThe buffer to be checked
BufferSizeSize of the buffer in bytes
Return values:
TRUEThe block of buffer is erased
FALSEThe block of buffer is not erased

Definition at line 177 of file Ffs.c.

BOOLEAN IsValidFFSFile ( IN FV_DEVICE FvDevice,
IN EFI_FFS_FILE_HEADER FfsHeader 
)

Check if it's a valid FFS file. Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.

Parameters:
FvDeviceCached FV image.
FfsHeaderPoints to the FFS file to be checked
Return values:
TRUEValid FFS file
FALSEInvalid FFS file

Definition at line 538 of file Ffs.c.

BOOLEAN IsValidFFSHeader ( IN UINT8  ErasePolarity,
IN EFI_FFS_FILE_HEADER FfsHeader 
)

Check if it's a valid FFS file header.

Parameters:
ErasePolarityErase polarity attribute of the firmware volume
FfsHeaderPoints to the FFS file header to be checked
Return values:
TRUEValid FFS file header
FALSEInvalid FFS file header

Definition at line 315 of file Ffs.c.

VOID SetFileState ( IN UINT8  State,
IN EFI_FFS_FILE_HEADER FfsHeader 
)

Set File State in the FfsHeader.

Parameters:
StateFile state to be set into FFS header.
FfsHeaderPoints to the FFS file header

Definition at line 29 of file Ffs.c.

EFI_STATUS UpdateHeaderBit ( IN FV_DEVICE FvDevice,
IN EFI_FFS_FILE_HEADER FfsHeader,
IN EFI_FFS_FILE_STATE  State 
)

Change FFS file header state and write to FV.

Parameters:
FvDeviceCached FV image.
FfsHeaderPoints to the FFS file header to be updated.
StateFFS file state to be set.
Return values:
EFI_SUCCESSFile state is writen into FV.
othersFile state can't be writen into FV.

Definition at line 490 of file Ffs.c.

BOOLEAN VerifyFileChecksum ( IN EFI_FFS_FILE_HEADER FfsHeader)

Verify checksum of the FFS file data.

Parameters:
FfsHeaderPoints to the FFS file header to be checked
Return values:
TRUEChecksum verification passed
FALSEChecksum verification failed

Definition at line 266 of file Ffs.c.

BOOLEAN VerifyFvHeaderChecksum ( IN EFI_FIRMWARE_VOLUME_HEADER FvHeader)

Verify checksum of the firmware volume header.

Parameters:
FvHeaderPoints to the firmware volume header to be checked
Return values:
TRUEChecksum verification passed
FALSEChecksum verification failed

Definition at line 211 of file Ffs.c.

BOOLEAN VerifyHeaderChecksum ( IN EFI_FFS_FILE_HEADER FfsHeader)

Verify checksum of the FFS file header.

Parameters:
FfsHeaderPoints to the FFS file header to be checked
Return values:
TRUEChecksum verification passed
FALSEChecksum verification failed

Definition at line 236 of file Ffs.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines