Add CapsuleInfo guid to store the list of capsule image guid.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4299 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2007-11-16 10:14:34 +00:00
parent 3076397e4b
commit d12f75fee2
4 changed files with 88 additions and 21 deletions

View File

@ -0,0 +1,45 @@
/*++
Copyright (c) 2006 - 2007, 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.
Module Name:
CapsuleVendor.h
Abstract:
Capsule update Guid definitions
--*/
#ifndef __EFI_CAPSULE_INFO_GUID_H__
#define __EFI_CAPSULE_INFO_GUID_H__
typedef struct {
UINT32 CapsuleArrayNumber;
VOID* CapsulePtr[1];
} EFI_CAPSULE_TABLE;
typedef struct {
UINT32 CapsuleGuidNumber;
EFI_GUID CapsuleGuidPtr[1];
} EFI_CAPSULE_INFO_TABLE;
//
// This GUID is used for collecting all capsules' Guids who install in ConfigTable.
//
#define EFI_CAPSULE_INFO_GUID \
{ \
0x8B34EAC7, 0x2690, 0x460B, { 0x8B, 0xA5, 0xD5, 0xCF, 0x32, 0x83, 0x17, 0x35 } \
}
extern EFI_GUID gEfiCapsuleInfoGuid;
#endif // #ifndef _EFI_CAPSULE_INFO_GUID_H_

View File

@ -30,10 +30,4 @@ Abstract:
extern EFI_GUID gEfiCapsuleArchProtocolGuid;
typedef struct {
UINT32 CapsuleArrayNumber;
VOID* CapsulePtr[1];
} EFI_CAPSULE_TABLE;
#endif

View File

@ -64,8 +64,8 @@
gEfiStandardErrorDeviceGuid = { 0xD3B36F2D, 0xD551, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}
gEfiPeiPeCoffLoaderGuid = { 0xD8117CFF, 0x94A6, 0x11D4, { 0x9A, 0x3A, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}
gEfiVariableInfoGuid = { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
gSimpleTextInExNotifyGuid = { 0x856f2def, 0x4e93, 0x4d6b, { 0x94, 0xce, 0x1c, 0xfe, 0x47, 0x1, 0x3e, 0xa5 }}
gSimpleTextInExNotifyGuid = { 0x856f2def, 0x4e93, 0x4d6b, { 0x94, 0xce, 0x1c, 0xfe, 0x47, 0x01, 0x3e, 0xa5 }}
gEfiCapsuleInfoGuid = { 0x8B34EAC7, 0x2690, 0x460B, { 0x8B, 0xA5, 0xD5, 0xCF, 0x32, 0x83, 0x17, 0x35 }}
[Protocols.common]

View File

@ -66,15 +66,26 @@ Returns:
CapsuleHeader = NULL;
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
//
// A capsule which has the CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag must have
// CAPSULE_FLAGS_PERSIST_ACROSS_RESET set in its header as well.
//
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
return EFI_INVALID_PARAMETER;
}
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
return EFI_UNSUPPORTED;
}
//
// To remove this check. Capsule update supports non reset image.
//
// if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
// return EFI_UNSUPPORTED;
// }
}
//
// Check capsule guid is suppored by this platform. To do
//
//
//Assume that capsules have the same flags on reseting or not.
//
@ -87,10 +98,18 @@ Returns:
if (!FeaturePcdGet(PcdSupportUpdateCapsuleRest)) {
return EFI_UNSUPPORTED;
}
if (ScatterGatherList == 0) {
//
// ScatterGatherList is only referenced if the capsules are defined to persist across
// system reset.
//
if (ScatterGatherList == (EFI_PHYSICAL_ADDRESS) NULL) {
return EFI_INVALID_PARAMETER;
} else {
//
// ScatterGatherList is only referenced if the capsules are defined to persist across
// system reset. Set its value into NV storage to let pre-boot driver to pick it up
// after coming through a system reset.
//
Status = EfiSetVariable (
EFI_CAPSULE_VARIABLE_NAME,
&gEfiCapsuleVendorGuid,
@ -99,21 +118,23 @@ Returns:
(VOID *) &ScatterGatherList
);
if (Status != EFI_SUCCESS) {
return EFI_DEVICE_ERROR;
return Status;
}
}
return EFI_SUCCESS;
}
//
//The rest occurs in the condition of non-reset mode
// The rest occurs in the condition of non-reset mode
// Current Runtime mode doesn't support the non-reset capsule image.
//
if (EfiAtRuntime ()) {
return EFI_INVALID_PARAMETER;
}
//
//Here should be in the boot-time
// Here should be in the boot-time for non-reset capsule image
// Default process to Update Capsule image into Flash for any guid image.
//
for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
@ -121,7 +142,7 @@ Returns:
BufferPtr = AllocatePool (CapsuleSize);
if (BufferPtr == NULL) {
return EFI_DEVICE_ERROR;
return EFI_OUT_OF_RESOURCES;
}
CopyMem (BufferPtr, (UINT8*)CapsuleHeader+ CapsuleHeader->HeaderSize, CapsuleSize);
@ -132,7 +153,7 @@ Returns:
Status = gDS->ProcessFirmwareVolume (BufferPtr, CapsuleSize, &FvHandle);
if (Status != EFI_SUCCESS) {
FreePool (BufferPtr);
return EFI_DEVICE_ERROR;
return Status;
}
gDS->Dispatch ();
FreePool (BufferPtr);
@ -189,12 +210,19 @@ Returns:
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
//
// A capsule which has the CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag must have
// CAPSULE_FLAGS_PERSIST_ACROSS_RESET set in its header as well.
//
if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
return EFI_INVALID_PARAMETER;
}
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
return EFI_UNSUPPORTED;
}
//
// To remove this check. Capsule update supports non reset image.
//
// if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
// return EFI_UNSUPPORTED;
// }
}
//