MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / AddPadFile

Function AddPadFile

BaseTools/Source/C/GenFv/GenFvInternalLib.c:562–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562EFI_STATUS
563AddPadFile (
564 IN OUT MEMORY_FILE *FvImage,
565 IN UINT32 DataAlignment,
566 IN VOID *FvEnd,
567 IN EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHeader,
568 IN UINT32 NextFfsSize
569 )
570/*++
571
572Routine Description:
573
574 This function adds a pad file to the FV image if it required to align the
575 data of the next file.
576
577Arguments:
578
579 FvImage The memory image of the FV to add it to.
580 The current offset must be valid.
581 DataAlignment The data alignment of the next FFS file.
582 FvEnd End of the empty data in FvImage.
583 ExtHeader PI FvExtHeader Optional
584
585Returns:
586
587 EFI_SUCCESS The function completed successfully.
588 EFI_INVALID_PARAMETER One of the input parameters was invalid.
589 EFI_OUT_OF_RESOURCES Insufficient resources exist in the FV to complete
590 the pad file add.
591
592--*/
593{
594 EFI_FFS_FILE_HEADER *PadFile;
595 UINTN PadFileSize;
596 UINT32 NextFfsHeaderSize;
597 UINT32 CurFfsHeaderSize;
598 UINT32 Index;
599
600 Index = 0;
601 CurFfsHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
602 //
603 // Verify input parameters.
604 //
605 if (FvImage == NULL) {
606 return EFI_INVALID_PARAMETER;
607 }
608
609 //
610 // Calculate the pad file size
611 //
612
613 //
614 // Append extension header size
615 //
616 if (ExtHeader != NULL) {
617 PadFileSize = ExtHeader->ExtHeaderSize;
618 if (PadFileSize + sizeof (EFI_FFS_FILE_HEADER) >= MAX_FFS_SIZE) {
619 CurFfsHeaderSize = sizeof (EFI_FFS_FILE_HEADER2);

Callers 2

AddFileFunction · 0.85
GenerateFvImageFunction · 0.85

Calls 4

CalculateChecksum8Function · 0.85
UpdateFfsFileStateFunction · 0.85
memsetFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected