/** @file
Capsule Library instance to update capsule image to flash.
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <PiDxe.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/CapsuleLib.h>
/**
Those capsules supported by the firmwares.
@param CapsuleHeader Points to a capsule header.
@retval EFI_SUCESS Input capsule is supported by firmware.
@retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.
**/
)
{
return EFI_SUCCESS;
}
return EFI_UNSUPPORTED;
}
/**
The firmware implements to process the capsule image.
@param CapsuleHeader Points to a capsule header.
@retval EFI_SUCESS Process Capsule Image successfully.
@retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
@retval EFI_VOLUME_CORRUPTED FV volume in the capsule is corrupted.
@retval EFI_OUT_OF_RESOURCES Not enough memory.
**/
)
{
return EFI_UNSUPPORTED;
}
//
// Skip the capsule header, move to the Firware Volume
//
while (Length != 0) {
//
// Point to the next firmware volume header, and then
// call the DXE service to process it.
//
//
// Notes: need to stuff this status somewhere so that the
// error can be detected at OS runtime
//
break;
}
//
// FvAlignment must be more than 8 bytes required by FvHeader structure.
//
if (FvAlignment < 8) {
FvAlignment = 8;
}
//
// Check FvImage Align is required.
//
} else {
//
// Allocate new aligned buffer to store FvImage.
//
ProcessedFvImage = (EFI_FIRMWARE_VOLUME_HEADER *) AllocateAlignedPages ((UINTN) EFI_SIZE_TO_PAGES ((UINTN) FvImage->FvLength), (UINTN) FvAlignment);
if (ProcessedFvImage == NULL) {
break;
}
}
(VOID *) ProcessedFvImage,
);
break;
}
//
// Call the dispatcher to dispatch any drivers from the produced firmware volume
//
//
// On to the next FV in the capsule
//
}
return Status;
}