• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** @file
2  System Firmware descriptor.
3
4  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5  This program and the accompanying materials
6  are licensed and made available under the terms and conditions of the BSD License
7  which accompanies this distribution.  The full text of the license may be found at
8  http://opensource.org/licenses/bsd-license.php
9
10  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#include <PiPei.h>
16#include <Protocol/FirmwareManagement.h>
17#include <Guid/EdkiiSystemFmpCapsule.h>
18
19#define PACKAGE_VERSION                     0xFFFFFFFF
20#define PACKAGE_VERSION_STRING              L"Unknown"
21
22#define CURRENT_FIRMWARE_VERSION            0x00000002
23#define CURRENT_FIRMWARE_VERSION_STRING     L"0x00000002"
24#define LOWEST_SUPPORTED_FIRMWARE_VERSION   0x00000001
25
26#define IMAGE_ID                            SIGNATURE_64('V', 'L', 'V', '2', '_', '_', 'F', 'd')
27#define IMAGE_ID_STRING                     L"Vlv2Fd"
28
29// PcdSystemFmpCapsuleImageTypeIdGuid
30#define IMAGE_TYPE_ID_GUID                  { 0x4096267b, 0xda0a, 0x42eb, { 0xb5, 0xeb, 0xfe, 0xf3, 0x1d, 0x20, 0x7c, 0xb4 } }
31
32typedef struct {
33  EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR  Descriptor;
34  // real string data
35  CHAR16                                  ImageIdNameStr[sizeof(IMAGE_ID_STRING)/sizeof(CHAR16)];
36  CHAR16                                  VersionNameStr[sizeof(CURRENT_FIRMWARE_VERSION_STRING)/sizeof(CHAR16)];
37  CHAR16                                  PackageVersionNameStr[sizeof(PACKAGE_VERSION_STRING)/sizeof(CHAR16)];
38} IMAGE_DESCRIPTOR;
39
40IMAGE_DESCRIPTOR mImageDescriptor =
41{
42  {
43    EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE,
44    sizeof(EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR),
45    sizeof(IMAGE_DESCRIPTOR),
46    PACKAGE_VERSION,                                       // PackageVersion
47    OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr),   // PackageVersionName
48    1,                                                     // ImageIndex;
49    {0x0},                                                 // Reserved
50    IMAGE_TYPE_ID_GUID,                                    // ImageTypeId;
51    IMAGE_ID,                                              // ImageId;
52    OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr),          // ImageIdName;
53    CURRENT_FIRMWARE_VERSION,                              // Version;
54    OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr),          // VersionName;
55    {0x0},                                                 // Reserved2
56    FixedPcdGet32(PcdFlashAreaSize),                       // Size;
57    IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
58      IMAGE_ATTRIBUTE_RESET_REQUIRED |
59      IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
60      IMAGE_ATTRIBUTE_IN_USE,                              // AttributesSupported;
61    IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
62      IMAGE_ATTRIBUTE_RESET_REQUIRED |
63      IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
64      IMAGE_ATTRIBUTE_IN_USE,                              // AttributesSetting;
65    0x0,                                                   // Compatibilities;
66    LOWEST_SUPPORTED_FIRMWARE_VERSION,                     // LowestSupportedImageVersion;
67    0x00000000,                                            // LastAttemptVersion;
68    0,                                                     // LastAttemptStatus;
69    {0x0},                                                 // Reserved3
70    0,                                                     // HardwareInstance;
71  },
72  // real string data
73  {IMAGE_ID_STRING},
74  {CURRENT_FIRMWARE_VERSION_STRING},
75  {PACKAGE_VERSION_STRING},
76};
77
78
79VOID*
80ReferenceAcpiTable (
81  VOID
82  )
83{
84  //
85  // Reference the table being generated to prevent the optimizer from
86  // removing the data structure from the executable
87  //
88  return (VOID*)&mImageDescriptor;
89}
90