audk/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc

84 lines
3.5 KiB
Plaintext

/** @file
System Firmware descriptor.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiPei.h>
#include <Protocol/FirmwareManagement.h>
#include <Guid/EdkiiSystemFmpCapsule.h>
#define PACKAGE_VERSION 0xFFFFFFFF
#define PACKAGE_VERSION_STRING L"Unknown"
#define CURRENT_FIRMWARE_VERSION 0x00000002
#define CURRENT_FIRMWARE_VERSION_STRING L"0x00000002"
#define LOWEST_SUPPORTED_FIRMWARE_VERSION 0x00000001
#define IMAGE_ID SIGNATURE_64('V', 'L', 'V', '2', '_', '_', 'F', 'd')
#define IMAGE_ID_STRING L"Vlv2Fd"
// PcdSystemFmpCapsuleImageTypeIdGuid
#define IMAGE_TYPE_ID_GUID { 0x4096267b, 0xda0a, 0x42eb, { 0xb5, 0xeb, 0xfe, 0xf3, 0x1d, 0x20, 0x7c, 0xb4 } }
typedef struct {
EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR Descriptor;
// real string data
CHAR16 ImageIdNameStr[sizeof(IMAGE_ID_STRING)/sizeof(CHAR16)];
CHAR16 VersionNameStr[sizeof(CURRENT_FIRMWARE_VERSION_STRING)/sizeof(CHAR16)];
CHAR16 PackageVersionNameStr[sizeof(PACKAGE_VERSION_STRING)/sizeof(CHAR16)];
} IMAGE_DESCRIPTOR;
IMAGE_DESCRIPTOR mImageDescriptor =
{
{
EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE,
sizeof(EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR),
sizeof(IMAGE_DESCRIPTOR),
PACKAGE_VERSION, // PackageVersion
OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr), // PackageVersionName
1, // ImageIndex;
{0x0}, // Reserved
IMAGE_TYPE_ID_GUID, // ImageTypeId;
IMAGE_ID, // ImageId;
OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr), // ImageIdName;
CURRENT_FIRMWARE_VERSION, // Version;
OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr), // VersionName;
{0x0}, // Reserved2
FixedPcdGet32(PcdFlashAreaSize), // Size;
IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
IMAGE_ATTRIBUTE_RESET_REQUIRED |
IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
IMAGE_ATTRIBUTE_IN_USE, // AttributesSupported;
IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
IMAGE_ATTRIBUTE_RESET_REQUIRED |
IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
IMAGE_ATTRIBUTE_IN_USE, // AttributesSetting;
0x0, // Compatibilities;
LOWEST_SUPPORTED_FIRMWARE_VERSION, // LowestSupportedImageVersion;
0x00000000, // LastAttemptVersion;
0, // LastAttemptStatus;
{0x0}, // Reserved3
0, // HardwareInstance;
},
// real string data
{IMAGE_ID_STRING},
{CURRENT_FIRMWARE_VERSION_STRING},
{PACKAGE_VERSION_STRING},
};
VOID*
ReferenceAcpiTable (
VOID
)
{
//
// Reference the table being generated to prevent the optimizer from
// removing the data structure from the executable
//
return (VOID*)&mImageDescriptor;
}