From 6ac749e232076b00f93998e01e74722a05010829 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 21 May 2016 09:04:07 -0400 Subject: [PATCH] spec: document patches, reorder them a bit --- ...atformDxe-install-legacy-QEMU-tables.patch | 1084 ----------------- ...multi-processor-support-for-boot-tim.patch | 68 -- ...EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch | 7 +- ...atformDxe-install-patch-default-lega.patch | 272 ----- ...EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch | 7 +- ...atformDxe-install-patch-default-lega.patch | 270 ---- 0003-OvmfPkg-enable-DEBUG_VERBOSE.patch | 6 +- ...ease-max-debug-message-length-to-512.patch | 6 +- ...oDxe-enable-debug-messages-in-VbeShi.patch | 6 +- ....patch => 0006-EXCLUDE_SHELL_FROM_FD.patch | 4 - ...faultKeys-application-for-enrolling-.patch | 20 +- ...rminalDxe-add-other-text-resolutions.patch | 4 - ...k-up-any-display-device-not-only-vga.patch | 8 +- edk2.spec | 39 +- 14 files changed, 32 insertions(+), 1769 deletions(-) delete mode 100644 0001-OvmfPkg-SmbiosPlatformDxe-install-legacy-QEMU-tables.patch delete mode 100644 0001-OvmfPkg-disable-multi-processor-support-for-boot-tim.patch delete mode 100644 0002-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch delete mode 100644 0003-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch rename 0001-EXCLUDE_SHELL_FROM_FD.patch => 0006-EXCLUDE_SHELL_FROM_FD.patch (94%) rename 0001-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch => 0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch (99%) rename 0001-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch => 0008-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch (98%) rename 0001-pick-up-any-display-device-not-only-vga.patch => 0009-pick-up-any-display-device-not-only-vga.patch (77%) diff --git a/0001-OvmfPkg-SmbiosPlatformDxe-install-legacy-QEMU-tables.patch b/0001-OvmfPkg-SmbiosPlatformDxe-install-legacy-QEMU-tables.patch deleted file mode 100644 index 43fa070..0000000 --- a/0001-OvmfPkg-SmbiosPlatformDxe-install-legacy-QEMU-tables.patch +++ /dev/null @@ -1,1084 +0,0 @@ -From 0e182f2305a84fdf62ff2631de6e363a5a881287 Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek -Date: Wed, 5 Jun 2013 10:14:34 +0200 -Subject: [PATCH 1/3] OvmfPkg/SmbiosPlatformDxe: install legacy QEMU tables and - save fields (X86) - -Introduce basic legacy SMBIOS machinery for the QEMU platform: -- Install SMBIOS tables that QEMU passes down in complete form via fw_cfg. -- Stash individual fields that QEMU passes down to override the boot - firmware's default SMBIOS tables. -- Add helper functions that OVMF's default SMBIOS tables will need. - -Contributed-under: TianoCore Contribution Agreement 1.0 -Signed-off-by: Laszlo Ersek ---- - OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c | 694 ++++++++++++++++++++++++ - OvmfPkg/SmbiosPlatformDxe/QemuLegacy.h | 52 ++ - OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h | 221 ++++++++ - OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 17 +- - OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 2 + - 5 files changed, 983 insertions(+), 3 deletions(-) - create mode 100644 OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c - create mode 100644 OvmfPkg/SmbiosPlatformDxe/QemuLegacy.h - create mode 100644 OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h - -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -new file mode 100644 -index 0000000..9c57558 ---- /dev/null -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -@@ -0,0 +1,694 @@ -+/** @file -+ This file fetches and installs SMBIOS tables on the QEMU hypervisor. -+ -+ Copyright (C) 2013, Red Hat, Inc. -+ -+ 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. -+**/ -+ -+#include -+ -+#include "QemuLegacy.h" -+#include "QemuLegacyInternal.h" -+ -+ -+// -+// An SMBIOS entry exported by QEMU over fw_cfg can have one of the following -+// types. -+// -+typedef enum -+{ -+ ET_FIELD, // defines one field in some SMBIOS table -+ ET_TABLE // defines an SMBIOS table instance in entirety -+} FW_CFG_SMBIOS_ENTRY_TYPE; -+ -+// -+// Header type introducing each entry in the QemuFwCfgItemX86SmbiosTables -+// fw_cfg blob. -+// -+#pragma pack(1) -+typedef struct { -+ UINT16 Size; // including payload and this header -+ UINT8 Type; // value from FW_CFG_SMBIOS_ENTRY_TYPE -+} FW_CFG_SMBIOS_ENTRY_HDR; -+#pragma pack() -+ -+// -+// Fields included at the beginning of the the payload in QEMU SMBIOS entries -+// with ET_FIELD type. -+// -+#pragma pack(1) -+typedef struct { -+ UINT8 TableType; // SMBIOS table type to patch -+ UINT16 Offset; // offset of a field in the formatted area -+} FW_CFG_SMBIOS_FIELD; -+#pragma pack() -+ -+ -+/** -+ Initialize a context object tracking SMBIOS table installation and patches -+ for fields. -+ -+ @param[out] Context A BUILD_CONTEXT object allocated dynamically and -+ initialized. -+ -+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed. -+ @retval EFI_SUCCESS Allocation and initialization successful. -+**/ -+STATIC -+EFI_STATUS -+EFIAPI -+InitSmbiosContext ( -+ OUT BUILD_CONTEXT **Context -+ ) -+{ -+ *Context = AllocateZeroPool (sizeof **Context); -+ if (*Context == NULL) { -+ DEBUG ((DEBUG_ERROR, "%a: out of memory\n", __FUNCTION__)); -+ return EFI_OUT_OF_RESOURCES; -+ } -+ return EFI_SUCCESS; -+} -+ -+ -+/** -+ Release a context object tracking SMBIOS table installation and patches for -+ fields. -+ -+ @param[in,out] Context The BUILD_CONTEXT object to tear down. -+**/ -+STATIC -+VOID -+EFIAPI -+UninitSmbiosContext ( -+ IN OUT BUILD_CONTEXT *Context -+ ) -+{ -+ INT32 Type; -+ INT32 Idx; -+ -+ // -+ // free all patches -+ // -+ for (Type = 0; Type < TABLE_TYPE_LIMIT; ++Type) { -+ for (Idx = 0; Idx < PATCH_SUBSCRIPT_LIMIT; ++Idx) { -+ PATCH *Patch; -+ -+ Patch = &Context->Table[Type].Patch[Idx]; -+ if (Patch->Base != NULL) { -+ FreePool (Patch->Base); -+ } -+ } -+ } -+ FreePool (Context); -+} -+ -+ -+/** -+ Save a patch targeting an SMBIOS field in dynamically allocated memory. -+ -+ @param[in,out] Context The initialized BUILD_CONTEXT object to save the -+ patch in. -+ @param[in] TableType The patch to be saved targets this table type. -+ Patches for table types equal to or greater than -+ TABLE_TYPE_LIMIT are ignored. -+ @param[in] FieldOffset The patch to be saved targets the field that -+ begins at offset FieldOffset in SMBIOS table type -+ TableType. FieldOffset is enforced not to point -+ into the SMBIOS table header. A FieldOffset value -+ equal to or greater than 255 is rejected, since -+ the formatted area of an SMBIOS table never -+ exceeds 255 bytes. FieldOffset is not validated -+ against actual field offsets here, it is only -+ saved for later lookup. -+ @param[in] PatchData Byte array constituting the patch body. -+ @param[in] PatchSize Number of bytes in PatchData. -+ -+ @retval EFI_SUCCESS Patch has been either ignored due to not -+ meeting the criterion on TableType, or it has -+ been saved successfully. -+ @retval EFI_INVALID_PARAMETER FieldOffset is invalid. -+ @retval EFI_OUT_OF_RESOURCES Couldn't allocate memory for the patch. -+**/ -+STATIC -+EFI_STATUS -+EFIAPI -+SaveSmbiosPatch ( -+ IN OUT BUILD_CONTEXT *Context, -+ IN UINT8 TableType, -+ IN UINT16 FieldOffset, -+ IN UINT8 *PatchData, -+ IN UINT16 PatchSize -+) -+{ -+ UINT8 *NewBase; -+ PATCH *Patch; -+ -+ if (TableType >= TABLE_TYPE_LIMIT) { -+ DEBUG ((DEBUG_VERBOSE, -+ "%a: ignoring patch for unsupported table type %d\n", -+ __FUNCTION__, TableType)); -+ return EFI_SUCCESS; -+ } -+ -+ if (FieldOffset < FIELD_OFFSET_MINIMUM -+ || FieldOffset - FIELD_OFFSET_MINIMUM >= PATCH_SUBSCRIPT_LIMIT) { -+ DEBUG ((DEBUG_ERROR, -+ "%a: invalid patch for table type %d field offset %d\n", -+ __FUNCTION__, TableType, FieldOffset)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ NewBase = AllocateCopyPool (PatchSize, PatchData); -+ if (PatchSize > 0 && NewBase == NULL) { -+ DEBUG ((DEBUG_ERROR, "%a: table type %d field offset %d: out of memory\n", -+ __FUNCTION__, TableType, FieldOffset)); -+ return EFI_OUT_OF_RESOURCES; -+ } -+ -+ Patch = &Context->Table[TableType].Patch[FieldOffset - FIELD_OFFSET_MINIMUM]; -+ // -+ // replace previous patch if it exists -+ // -+ if (Patch->Base != NULL) { -+ DEBUG ((DEBUG_VERBOSE, -+ "%a: replacing prior patch for table type %d field offset %d\n", -+ __FUNCTION__, TableType, FieldOffset)); -+ FreePool (Patch->Base); -+ } -+ -+ Patch->Base = NewBase; -+ Patch->Size = PatchSize; -+ return EFI_SUCCESS; -+} -+ -+ -+/** -+ Apply a saved patch to a field located in the formatted are of a not yet -+ installed SMBIOS table. -+ -+ The patch is looked up based on (Context, TableType, FieldOffset). -+ -+ @param[in] Context The BUILD_CONTEXT object storing saved patches. -+ @param[in] TableType Selects the table type for which the patch has been -+ saved. It is assumed that the caller has validated -+ TableType against TABLE_TYPE_LIMIT (upper -+ exclusive). -+ @param[in] FieldOffset Selects the SMBIOS field for which the patch has -+ been saved. It is assumed that the caller has -+ validated FieldOffset against FIELD_OFFSET_MINIMUM -+ (lower inclusive) and 255 (upper exclusive). -+ @param[in] FieldSize The caller supplies the size of the field to patch -+ in FieldSize. The patch saved for -+ TableType:FieldOffset, if any, is only applied if -+ its size equals FieldSize. -+ @param[out] TableBase Base of the SMBIOS table of type TableType in which -+ the field starting at FieldOffset needs to be -+ patched. -+ -+ @retval EFI_NOT_FOUND No patch found for TableType:FieldOffset in -+ Context. This return value is considered -+ informative (ie. non-fatal). -+ @retval EFI_INVALID_PARAMETER Patch found for TableType:FieldOffset, but its -+ size doesn't match FieldSize. This result is -+ considered a fatal error of the patch origin. -+ @retval EFI_SUCCESS The SMBIOS table at TableBase has been patched -+ starting at FieldOffset for a length of -+ FieldSize. -+**/ -+EFI_STATUS -+EFIAPI -+PatchSmbiosFormatted ( -+ IN BUILD_CONTEXT *Context, -+ IN UINT8 TableType, -+ IN UINT16 FieldOffset, -+ IN UINT16 FieldSize, -+ OUT UINT8 *TableBase -+ ) -+{ -+ PATCH *Patch; -+ -+ ASSERT (TableType < TABLE_TYPE_LIMIT); -+ ASSERT (FieldOffset >= FIELD_OFFSET_MINIMUM); -+ ASSERT (FieldOffset - FIELD_OFFSET_MINIMUM < PATCH_SUBSCRIPT_LIMIT); -+ -+ Patch = &Context->Table[TableType].Patch[FieldOffset - FIELD_OFFSET_MINIMUM]; -+ if (Patch->Base == NULL) { -+ return EFI_NOT_FOUND; -+ } -+ -+ if (Patch->Size != FieldSize) { -+ DEBUG ((DEBUG_ERROR, "%a: table type %d, field offset %d: " -+ "patch size %d doesn't match field size %d\n", -+ __FUNCTION__, TableType, FieldOffset, Patch->Size, FieldSize)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ CopyMem (TableBase + FieldOffset, Patch->Base, FieldSize); -+ return EFI_SUCCESS; -+} -+ -+ -+/** -+ Apply a saved patch to a text string located in the unformatted area of an -+ already installed SMBIOS table. -+ -+ The patch is looked up based on (Context, TableType, FieldOffset). -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used previously -+ for installing the SMBIOS table. -+ @param[in] SmbiosHandle The EFI_SMBIOS_HANDLE previously returned by -+ Smbios->Add(). -+ @param[in] Context The BUILD_CONTEXT object storing saved patches. -+ @param[in] TableType Selects the table type for which the patch has been -+ saved. It is assumed that the caller has validated -+ TableType against TABLE_TYPE_LIMIT (upper -+ exclusive). -+ @param[in] FieldOffset Selects the SMBIOS field for which the patch has -+ been saved. It is assumed that the caller has -+ validated FieldOffset against FIELD_OFFSET_MINIMUM -+ (lower inclusive) and 255 (upper exclusive). -+ It is also assumed that TableBase[FieldOffset] -+ accesses a field of type SMBIOS_TABLE_STRING, ie. a -+ field in the formatted area that identifies an -+ existent text string in the unformatted area. Text -+ string identifiers are one-based. -+ @param[out] TableBase Base of the SMBIOS table of type TableType in which -+ the SMBIOS_TABLE_STRING field at FieldOffset -+ identifies the existent text string to update. -+ -+ @retval EFI_NOT_FOUND No patch found for TableType:FieldOffset in -+ Context. This return value is considered -+ informative (ie. non-fatal). -+ @retval EFI_INVALID_PARAMETER Patch found for TableType:FieldOffset, but it -+ doesn't end with a NUL character. This result -+ is considered a fatal error of the patch -+ origin. -+ @retval EFI_SUCCESS The text string identified by -+ TableBase[FieldOffset] has been replaced in -+ the installed SMBIOS table under SmbiosHandle. -+ @return Error codes returned by -+ Smbios->UpdateString(). EFI_NOT_FOUND shall -+ not be returned. -+**/ -+EFI_STATUS -+EFIAPI -+PatchSmbiosUnformatted ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_SMBIOS_HANDLE SmbiosHandle, -+ IN BUILD_CONTEXT *Context, -+ IN UINT8 TableType, -+ IN UINT16 FieldOffset, -+ IN UINT8 *TableBase -+ ) -+{ -+ PATCH *Patch; -+ UINTN StringNumber; -+ EFI_STATUS Status; -+ -+ ASSERT (TableType < TABLE_TYPE_LIMIT); -+ ASSERT (FieldOffset >= FIELD_OFFSET_MINIMUM); -+ ASSERT (FieldOffset - FIELD_OFFSET_MINIMUM < PATCH_SUBSCRIPT_LIMIT); -+ -+ Patch = &Context->Table[TableType].Patch[FieldOffset - FIELD_OFFSET_MINIMUM]; -+ if (Patch->Base == NULL) { -+ return EFI_NOT_FOUND; -+ } -+ -+ if (Patch->Size == 0 || Patch->Base[Patch->Size - 1] != '\0') { -+ DEBUG ((DEBUG_ERROR, "%a: table type %d, field offset %d: " -+ "missing terminator, or trailing garbage\n", -+ __FUNCTION__, TableType, FieldOffset)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ StringNumber = TableBase[FieldOffset]; -+ ASSERT (StringNumber != 0); -+ -+ Status = Smbios->UpdateString (Smbios, &SmbiosHandle, &StringNumber, -+ (CHAR8 *)Patch->Base); -+ if (EFI_ERROR (Status)) { -+ ASSERT (Status != EFI_NOT_FOUND); -+ DEBUG ((DEBUG_ERROR, "%a: table type %d, field offset %d, " -+ "string number %d: Smbios->UpdateString(): %r\n", __FUNCTION__, -+ TableType, FieldOffset, TableBase[FieldOffset], Status)); -+ return Status; -+ } -+ return EFI_SUCCESS; -+} -+ -+ -+/** -+ Process an SMBIOS firmware configuration entry with ET_FIELD type, exported -+ by QEMU under QemuFwCfgItemX86SmbiosTables. -+ -+ Such entries describe patches to be saved with SaveSmbiosPatch(). -+ -+ @param[in,out] Context The BUILD_CONTEXT object tracking saved patches. -+ @param[in] Payload Points to the buffer to parse as -+ FW_CFG_SMBIOS_FIELD. -+ @param[in] PayloadSize Number of bytes in Payload. -+ -+ @retval EFI_INVALID_PARAMETER PayloadSize is less than the size of -+ FW_CFG_SMBIOS_FIELD -- fields describing -+ the patch are incomplete. -+ @retval EFI_SUCCESS Payload has been parsed and patch has been -+ saved successfully. -+ @return Error codes returned by SaveSmbiosPatch(). -+**/ -+STATIC -+EFI_STATUS -+EFIAPI -+VisitSmbiosField ( -+ IN OUT BUILD_CONTEXT *Context, -+ IN UINT8 *Payload, -+ IN UINT16 PayloadSize -+ ) -+{ -+ FW_CFG_SMBIOS_FIELD *Field; -+ -+ if (PayloadSize < (INT32) sizeof *Field) { -+ DEBUG ((DEBUG_ERROR, "%a: required minimum size %d, available %d\n", -+ __FUNCTION__, (INT32) sizeof *Field, PayloadSize)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ Field = (FW_CFG_SMBIOS_FIELD *) Payload; -+ return SaveSmbiosPatch (Context, Field->TableType, Field->Offset, -+ Payload + sizeof *Field, (UINT16) (PayloadSize - sizeof *Field)); -+} -+ -+ -+/** -+ Process an SMBIOS firmware configuration entry with ET_TABLE type, exported -+ by QEMU under QemuFwCfgItemX86SmbiosTables. -+ -+ Such entries describe entire SMBIOS table instances to install verbatim. This -+ module never overrides tables installed in this manner with default tables. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables. -+ @param[in] Payload Points to the buffer to install as an SMBIOS -+ table. -+ @param[in] PayloadSize Number of bytes in Payload. -+ -+ @retval EFI_INVALID_PARAMETER The buffer at Payload, interpreted as an -+ SMBIOS table, failed basic sanity checks. -+ @retval EFI_SUCCESS Payload has been installed successfully as an -+ SMBIOS table. -+ @return Error codes returned by Smbios->Add(). -+**/ -+STATIC -+EFI_STATUS -+EFIAPI -+VisitSmbiosTable ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context, -+ IN UINT8 *Payload, -+ IN UINT16 PayloadSize -+ ) -+{ -+ SMBIOS_STRUCTURE *SmbiosHeader; -+ UINT16 MinimumSize; -+ EFI_SMBIOS_HANDLE SmbiosHandle; -+ EFI_STATUS Status; -+ -+ // -+ // Basic sanity checks only in order to help debugging and to catch blatantly -+ // invalid data passed with "-smbios file=binary_file" on the QEMU command -+ // line. Beyond these we don't enforce correct, type-specific SMBIOS table -+ // formatting. -+ // -+ if (PayloadSize < (INT32) sizeof *SmbiosHeader) { -+ DEBUG ((DEBUG_ERROR, "%a: required minimum size %d, available %d\n", -+ __FUNCTION__, (INT32) sizeof *SmbiosHeader, PayloadSize)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ SmbiosHeader = (SMBIOS_STRUCTURE *) Payload; -+ -+ if (SmbiosHeader->Length < (INT32) sizeof *SmbiosHeader) { -+ DEBUG ((DEBUG_ERROR, "%a: required minimum size %d, stated %d\n", -+ __FUNCTION__, (INT32) sizeof *SmbiosHeader, SmbiosHeader->Length)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ MinimumSize = (UINT16) (SmbiosHeader->Length + 2); -+ -+ if (PayloadSize < MinimumSize) { -+ DEBUG ((DEBUG_ERROR, -+ "%a: minimum for formatted area plus terminator is %d, available %d\n", -+ __FUNCTION__, MinimumSize, PayloadSize)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ if (Payload[PayloadSize - 2] != '\0' || -+ Payload[PayloadSize - 1] != '\0') { -+ DEBUG ((DEBUG_ERROR, "%a: missing terminator, or trailing garbage\n", -+ __FUNCTION__)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ // -+ // request unique handle -+ // -+ SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; -+ Status = Smbios->Add (Smbios, ProducerHandle, &SmbiosHandle, -+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosHeader); -+ if (EFI_ERROR (Status)) { -+ DEBUG ((DEBUG_ERROR, "%a: Smbios->Add(): %r\n", __FUNCTION__, Status)); -+ return Status; -+ } -+ -+ // -+ // track known tables -+ // -+ if (SmbiosHeader->Type < TABLE_TYPE_LIMIT) { -+ Context->Table[SmbiosHeader->Type].Installed = TRUE; -+ } -+ return EFI_SUCCESS; -+} -+ -+ -+/** -+ Traverse the SMBIOS firmware configuration blob exported by QEMU under -+ QemuFwCfgItemX86SmbiosTables, processing each entry in turn. -+ -+ Entries with ET_FIELD type are parsed as patches for the SMBIOS tables this -+ module installs as fallbacks, while entries of type ET_TABLE are parsed and -+ installed as verbatim SMBIOS tables. -+ -+ Unknown entry types are silently skipped. Any error encountered during -+ traversal (for example, a recognized but malformed entry) aborts the -+ iteration, leaving the function with a possibly incomplete set of installed -+ tables. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables and saved patches. -+ -+ @retval EFI_SUCCESS The firmware configuration interface is -+ unavailable (no patches saved, no tables -+ installed). -+ @retval EFI_SUCCESS Traversal complete. Tables provided by QEMU -+ have been installed. Patches have been saved -+ for any default tables that will be necessary. -+ @retval EFI_INVALID_PARAMETER Encountered a corrupt entry in the SMBIOS -+ firmware configuration blob. -+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed. -+ @return Error codes returned by VisitSmbiosField() and -+ VisitSmbiosTable(). -+**/ -+STATIC -+EFI_STATUS -+EFIAPI -+ScanQemuSmbios ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context -+ ) -+{ -+ EFI_STATUS Status; -+ UINT16 NumEntries; -+ UINT16 CurEntry; -+ -+ Status = EFI_SUCCESS; -+ -+ if (!QemuFwCfgIsAvailable ()) { -+ return Status; -+ } -+ -+ QemuFwCfgSelectItem (QemuFwCfgItemX86SmbiosTables); -+ -+ NumEntries = QemuFwCfgRead16 (); -+ for (CurEntry = 0; CurEntry < NumEntries && !EFI_ERROR (Status); -+ ++CurEntry) { -+ FW_CFG_SMBIOS_ENTRY_HDR Header; -+ UINT16 PayloadSize; -+ UINT8 *Payload; -+ -+ QemuFwCfgReadBytes (sizeof Header, &Header); -+ -+ if (Header.Size < (INT32) sizeof Header) { -+ DEBUG ((DEBUG_ERROR, "%a: invalid header size %d in entry %d\n", -+ __FUNCTION__, Header.Size, CurEntry)); -+ return EFI_INVALID_PARAMETER; -+ } -+ -+ PayloadSize = (UINT16) (Header.Size - sizeof Header); -+ Payload = AllocatePool (PayloadSize); -+ -+ if (PayloadSize > 0 && Payload == NULL) { -+ DEBUG ((DEBUG_ERROR, "%a: failed to allocate %d bytes for entry %d\n", -+ __FUNCTION__, PayloadSize, CurEntry)); -+ return EFI_OUT_OF_RESOURCES; -+ } -+ -+ QemuFwCfgReadBytes (PayloadSize, Payload); -+ -+ // -+ // dump the payload -+ // -+ DEBUG_CODE ( -+ UINT16 Idx; -+ -+ DEBUG ((DEBUG_VERBOSE, -+ "%a: entry %d, type %d, payload size %d, payload hex dump follows:", -+ __FUNCTION__, CurEntry, Header.Type, PayloadSize)); -+ for (Idx = 0; Idx < PayloadSize; ++Idx) { -+ switch (Idx % 16) { -+ case 0: -+ DEBUG ((DEBUG_VERBOSE, "\n%04X:", Idx)); -+ break; -+ case 8: -+ DEBUG ((DEBUG_VERBOSE, " ")); -+ break; -+ default: -+ ; -+ } -+ DEBUG ((DEBUG_VERBOSE, " %02X", Payload[Idx])); -+ } -+ DEBUG ((DEBUG_VERBOSE, "\n")); -+ ); -+ -+ switch (Header.Type) { -+ case ET_FIELD: -+ Status = VisitSmbiosField (Context, Payload, PayloadSize); -+ break; -+ case ET_TABLE: -+ Status = VisitSmbiosTable (Smbios, ProducerHandle, Context, Payload, -+ PayloadSize); -+ break; -+ default: -+ ; -+ } -+ -+ FreePool (Payload); -+ } -+ -+ return Status; -+} -+ -+ -+/** -+ Install some of the default SMBIOS tables for table types that QEMU hasn't -+ provided under QemuFwCfgItemX86SmbiosTables, but are required by the -+ SMBIOS-2.7.1 specification. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables and saved patches. -+ -+ @return Status codes returned by the InstallSmbiosTypeXX() functions, -+ including the final EFI_SUCCESS if all such calls succeed. -+**/ -+STATIC -+EFI_STATUS -+EFIAPI -+InstallDefaultTables ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context -+ ) -+{ -+ return EFI_SUCCESS; -+} -+ -+ -+/** -+ Fetch and install SMBIOS tables on the QEMU hypervisor. -+ -+ First, tables provided by QEMU in entirety are installed verbatim. -+ -+ Then the function prepares some of the remaining tables required by the -+ SMBIOS-2.7.1 specification. For each such table, -+ - if QEMU provides any fields for the table, they take effect verbatim, -+ - remaining fields are set by this function. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for installing -+ the SMBIOS tables. -+ @param[in] ImageHandle The image handle of the calling module, passed as -+ ProducerHandle to the Smbios->Add() call. -+ -+ @retval EFI_SUCCESS All tables have been installed. -+ @retval EFI_UNSUPPORTED The pair (Smbios->MajorVersion, -+ Smbios->MinorVersion) precedes (2, 3) -+ lexicographically. -+ @return Error codes returned by Smbios->Add() or -+ internal functions. Some tables may not have -+ been installed or fully patched. -+**/ -+EFI_STATUS -+EFIAPI -+InstallQemuSmbiosTables ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ImageHandle -+ ) -+{ -+ EFI_STATUS Status; -+ BUILD_CONTEXT *Context; -+ -+ if (Smbios->MajorVersion < 2 || Smbios->MinorVersion < 3) { -+ DEBUG ((DEBUG_ERROR, "%a: unsupported Smbios version %d.%d\n", -+ __FUNCTION__, Smbios->MajorVersion, Smbios->MinorVersion)); -+ return EFI_UNSUPPORTED; -+ } -+ -+ Status = InitSmbiosContext (&Context); -+ if (EFI_ERROR (Status)) { -+ return Status; -+ } -+ -+ // -+ // and must agree. -+ // -+ ASSERT (sizeof(SMBIOS_STRUCTURE) == sizeof(EFI_SMBIOS_TABLE_HEADER)); -+ -+ Status = ScanQemuSmbios (Smbios, ImageHandle, Context); -+ if (EFI_ERROR (Status)) { -+ goto Cleanup; -+ } -+ -+ Status = InstallDefaultTables (Smbios, ImageHandle, Context); -+ -+Cleanup: -+ UninitSmbiosContext (Context); -+ return Status; -+} -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.h b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.h -new file mode 100644 -index 0000000..40d5ad3 ---- /dev/null -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.h -@@ -0,0 +1,52 @@ -+/** @file -+ This header file provides QEMU-specific public prototypes for the main driver -+ file, "SmbiosPlatformDxe.c". -+ -+ Copyright (C) 2013, Red Hat, Inc. -+ -+ 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. -+**/ -+ -+#ifndef _QEMU_LEGACY_H_ -+#define _QEMU_LEGACY_H_ -+ -+#include -+ -+ -+/** -+ Fetch and install SMBIOS tables on the QEMU hypervisor. -+ -+ First, tables provided by QEMU in entirety are installed verbatim. -+ -+ Then the function prepares some of the remaining tables required by the -+ SMBIOS-2.7.1 specification. For each such table, -+ - if QEMU provides any fields for the table, they take effect verbatim, -+ - remaining fields are set by this function. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for installing -+ the SMBIOS tables. -+ @param[in] ImageHandle The image handle of the calling module, passed as -+ ProducerHandle to the Smbios->Add() call. -+ -+ @retval EFI_SUCCESS All tables have been installed. -+ @retval EFI_UNSUPPORTED The pair (Smbios->MajorVersion, -+ Smbios->MinorVersion) precedes (2, 3) -+ lexicographically. -+ @return Error codes returned by Smbios->Add() or -+ internal functions. Some tables may not have -+ been installed or fully patched. -+**/ -+EFI_STATUS -+EFIAPI -+InstallQemuSmbiosTables ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ImageHandle -+ ); -+ -+#endif -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h b/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -new file mode 100644 -index 0000000..8613407 ---- /dev/null -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -@@ -0,0 +1,221 @@ -+/** @file -+ This header provides common includes, and communicates internal types, -+ function prototypes and macros between "Qemu.c" and "QemuTypeXX.c", that -+ relate to the installation and patching of SMBIOS tables on the QEMU -+ platform. -+ -+ Copyright (C) 2013, Red Hat, Inc. -+ -+ 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. -+**/ -+ -+#ifndef _QEMU_LEGACY_INTERNAL_H_ -+#define _QEMU_LEGACY_INTERNAL_H_ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+// -+// Type identifiers of all tables mandated by the SMBIOS-2.7.1 specification -+// fall strictly under this limit. -+// -+#define TABLE_TYPE_LIMIT (EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION + 1) -+ -+ -+// -+// Track a patch in dynamic memory, originating from a QEMU SMBIOS firmware -+// configuration entry with ET_FIELD type. -+// -+typedef struct { -+ UINT8 *Base; -+ UINT16 Size; -+} PATCH; -+ -+ -+#define FIELD_OFFSET_MINIMUM ((INT32) sizeof(SMBIOS_STRUCTURE)) -+#define PATCH_SUBSCRIPT_LIMIT (255 - FIELD_OFFSET_MINIMUM) -+ -+// -+// The following structure tracks the installation of each SMBIOS table with a -+// type below TABLE_TYPE_LIMIT, and captures QEMU SMBIOS firmware configuration -+// entries with ET_FIELD type that target the default table for the same type. -+// -+typedef struct { -+ BOOLEAN Installed; // at least one instance of the type has been installed -+ -+ PATCH Patch[PATCH_SUBSCRIPT_LIMIT]; // Patches indexed by the field offset -+ // that they target in this specific -+ // table type. Patching the SMBIOS table -+ // header is not allowed, hence we can -+ // shift down field offsets. An unused -+ // element has zeroed-out fields. -+} TABLE_CONTEXT; -+ -+ -+// -+// Track the installation of, and stored patches for, all table types below -+// TABLE_TYPE_LIMIT. -+// -+typedef struct { -+ TABLE_CONTEXT Table[TABLE_TYPE_LIMIT]; -+} BUILD_CONTEXT; -+ -+ -+// -+// Convenience / safety macro for defining C structure types for default SMBIOS -+// tables. -+// -+// Rules of use: -+// - Use only within #pragma pack(1). -+// - This macro depends on the macro -+// "OVMF_TYPE ## TableType ## _STRINGS" specifying the text strings -+// (unformatted area) for TableType. Each "QemuTypeXX.c" file needs to -+// provide said macro before using the one below. -+// -+#define OVMF_SMBIOS(TableType) \ -+ typedef struct { \ -+ SMBIOS_TABLE_TYPE##TableType Base; \ -+ UINT8 Strings[sizeof OVMF_TYPE##TableType##_STRINGS]; \ -+ } OVMF_TYPE##TableType -+ -+ -+// -+// Convenience / safety macro for patching a field in the formatted area of -+// an SMBIOS table. -+// -+#define PATCH_FORMATTED(Context, TableType, OvmfTablePtr, FieldName) \ -+ PatchSmbiosFormatted ( \ -+ Context, \ -+ TableType, \ -+ (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE##TableType, FieldName), \ -+ (UINT16) sizeof (OvmfTablePtr)->Base.FieldName, \ -+ (UINT8 *) (OvmfTablePtr) \ -+ ) -+ -+ -+/** -+ Apply a saved patch to a field located in the formatted are of a not yet -+ installed SMBIOS table. -+ -+ The patch is looked up based on (Context, TableType, FieldOffset). -+ -+ @param[in] Context The BUILD_CONTEXT object storing saved patches. -+ @param[in] TableType Selects the table type for which the patch has been -+ saved. It is assumed that the caller has validated -+ TableType against TABLE_TYPE_LIMIT (upper -+ exclusive). -+ @param[in] FieldOffset Selects the SMBIOS field for which the patch has -+ been saved. It is assumed that the caller has -+ validated FieldOffset against FIELD_OFFSET_MINIMUM -+ (lower inclusive) and 255 (upper exclusive). -+ @param[in] FieldSize The caller supplies the size of the field to patch -+ in FieldSize. The patch saved for -+ TableType:FieldOffset, if any, is only applied if -+ its size equals FieldSize. -+ @param[out] TableBase Base of the SMBIOS table of type TableType in which -+ the field starting at FieldOffset needs to be -+ patched. -+ -+ @retval EFI_NOT_FOUND No patch found for TableType:FieldOffset in -+ Context. This return value is considered -+ informative (ie. non-fatal). -+ @retval EFI_INVALID_PARAMETER Patch found for TableType:FieldOffset, but its -+ size doesn't match FieldSize. This result is -+ considered a fatal error of the patch origin. -+ @retval EFI_SUCCESS The SMBIOS table at TableBase has been patched -+ starting at FieldOffset for a length of -+ FieldSize. -+**/ -+EFI_STATUS -+EFIAPI -+PatchSmbiosFormatted ( -+ IN BUILD_CONTEXT *Context, -+ IN UINT8 TableType, -+ IN UINT16 FieldOffset, -+ IN UINT16 FieldSize, -+ OUT UINT8 *TableBase -+ ); -+ -+ -+// -+// Convenience / safety macro for patching a string in the unformatted area of -+// an SMBIOS table. -+// -+#define PATCH_UNFORMATTED(Smbios, SmbiosHandle, Context, TableType, \ -+ OvmfTablePtr, FieldName) \ -+ \ -+ PatchSmbiosUnformatted ( \ -+ Smbios, \ -+ SmbiosHandle, \ -+ Context, \ -+ TableType, \ -+ (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE##TableType, FieldName), \ -+ (UINT8 *) (OvmfTablePtr) \ -+ ) -+ -+ -+/** -+ Apply a saved patch to a text string located in the unformatted area of an -+ already installed SMBIOS table. -+ -+ The patch is looked up based on (Context, TableType, FieldOffset). -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used previously -+ for installing the SMBIOS table. -+ @param[in] SmbiosHandle The EFI_SMBIOS_HANDLE previously returned by -+ Smbios->Add(). -+ @param[in] Context The BUILD_CONTEXT object storing saved patches. -+ @param[in] TableType Selects the table type for which the patch has been -+ saved. It is assumed that the caller has validated -+ TableType against TABLE_TYPE_LIMIT (upper -+ exclusive). -+ @param[in] FieldOffset Selects the SMBIOS field for which the patch has -+ been saved. It is assumed that the caller has -+ validated FieldOffset against FIELD_OFFSET_MINIMUM -+ (lower inclusive) and 255 (upper exclusive). -+ It is also assumed that TableBase[FieldOffset] -+ accesses a field of type SMBIOS_TABLE_STRING, ie. a -+ field in the formatted area that identifies an -+ existent text string in the unformatted area. Text -+ string identifiers are one-based. -+ @param[out] TableBase Base of the SMBIOS table of type TableType in which -+ the SMBIOS_TABLE_STRING field at FieldOffset -+ identifies the existent text string to update. -+ -+ @retval EFI_NOT_FOUND No patch found for TableType:FieldOffset in -+ Context. This return value is considered -+ informative (ie. non-fatal). -+ @retval EFI_INVALID_PARAMETER Patch found for TableType:FieldOffset, but it -+ doesn't end with a NUL character. This result -+ is considered a fatal error of the patch -+ origin. -+ @retval EFI_SUCCESS The text string identified by -+ TableBase[FieldOffset] has been replaced in -+ the installed SMBIOS table under SmbiosHandle. -+ @return Error codes returned by -+ Smbios->UpdateString(). EFI_NOT_FOUND shall -+ not be returned. -+**/ -+EFI_STATUS -+EFIAPI -+PatchSmbiosUnformatted ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_SMBIOS_HANDLE SmbiosHandle, -+ IN BUILD_CONTEXT *Context, -+ IN UINT8 TableType, -+ IN UINT16 FieldOffset, -+ IN UINT8 *TableBase -+ ); -+ -+#endif -diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c -index 29948a4..b7c1d0d 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c -+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c -@@ -1,6 +1,7 @@ - /** @file - This driver installs SMBIOS information for OVMF - -+ Copyright (C) 2013, Red Hat, Inc. - Copyright (c) 2011, Bei Guan - Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
- -@@ -15,6 +16,9 @@ - **/ - - #include "SmbiosPlatformDxe.h" -+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) -+#include "QemuLegacy.h" -+#endif - - #define TYPE0_STRINGS \ - "EFI Development Kit II / OVMF\0" /* Vendor */ \ -@@ -27,10 +31,10 @@ - typedef struct { - SMBIOS_TABLE_TYPE0 Base; - UINT8 Strings[sizeof(TYPE0_STRINGS)]; --} OVMF_TYPE0; -+} OVMF_DEFAULT_TYPE0; - #pragma pack() - --STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = { -+STATIC CONST OVMF_DEFAULT_TYPE0 mOvmfDefaultType0 = { - { - // SMBIOS_STRUCTURE Hdr - { -@@ -202,7 +206,14 @@ SmbiosTablePublishEntry ( - SmbiosTables = GetQemuSmbiosTables (); - } - -- if (SmbiosTables != NULL) { -+ if (SmbiosTables == NULL) { -+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) -+ // -+ // Handle QEMU's legacy SMBIOS interface. -+ // -+ Status = InstallQemuSmbiosTables (Smbios, ImageHandle); -+#endif -+ } else { - Status = InstallAllStructures (Smbios, SmbiosTables); - - // -diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -index 3b90aac..8c9f43c 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -@@ -1,6 +1,7 @@ - ## @file - # This driver installs SMBIOS information for OVMF - # -+# Copyright (C) 2013, Red Hat, Inc. - # Copyright (c) 2011, Bei Guan - # Copyright (c) 2011, Intel Corporation. All rights reserved.
- # -@@ -35,6 +36,7 @@ - - [Sources.IA32, Sources.X64] - X86Xen.c -+ QemuLegacy.c - - [Sources.ARM, Sources.AARCH64] - ArmXen.c --- -1.8.3.1 - diff --git a/0001-OvmfPkg-disable-multi-processor-support-for-boot-tim.patch b/0001-OvmfPkg-disable-multi-processor-support-for-boot-tim.patch deleted file mode 100644 index 2592b07..0000000 --- a/0001-OvmfPkg-disable-multi-processor-support-for-boot-tim.patch +++ /dev/null @@ -1,68 +0,0 @@ -From dd48ac51d1df4f718b4401b188d2824aebcc341c Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek -Date: Wed, 26 Nov 2014 16:32:06 +0100 -Subject: [PATCH] OvmfPkg: disable multi-processor support for boot time - -We have no useful workload for APs, so let's not start them up, because -they would spin indefinitely until ExitBootServices(). - -Setting gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber to 1 -causes InitializeMpSupport() in "UefiCpuPkg/CpuDxe/CpuMp.c" to return -early. - -Contributed-under: TianoCore Contribution Agreement 1.0 -Signed-off-by: Laszlo Ersek ---- - OvmfPkg/OvmfPkgIa32.dsc | 4 ++++ - OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++++ - OvmfPkg/OvmfPkgX64.dsc | 4 ++++ - 3 files changed, 12 insertions(+) - -diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc -index 6598102..1730812 100644 ---- a/OvmfPkg/OvmfPkgIa32.dsc -+++ b/OvmfPkg/OvmfPkgIa32.dsc -@@ -329,6 +329,10 @@ - # IRQs 5, 9, 10, 11 are level-triggered - gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 - -+ # We have no useful workload for APs, so let's not start them up, because -+ # they would spin indefinitely until ExitBootServices(). -+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|1 -+ - ################################################################################ - # - # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform -diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc -index 4de961f..370ae50 100644 ---- a/OvmfPkg/OvmfPkgIa32X64.dsc -+++ b/OvmfPkg/OvmfPkgIa32X64.dsc -@@ -335,6 +335,10 @@ - # IRQs 5, 9, 10, 11 are level-triggered - gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 - -+ # We have no useful workload for APs, so let's not start them up, because -+ # they would spin indefinitely until ExitBootServices(). -+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|1 -+ - ################################################################################ - # - # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform -diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc -index 6c38081..175d5f4 100644 ---- a/OvmfPkg/OvmfPkgX64.dsc -+++ b/OvmfPkg/OvmfPkgX64.dsc -@@ -334,6 +334,10 @@ - # IRQs 5, 9, 10, 11 are level-triggered - gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 - -+ # We have no useful workload for APs, so let's not start them up, because -+ # they would spin indefinitely until ExitBootServices(). -+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|1 -+ - ################################################################################ - # - # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform --- -1.8.3.1 - diff --git a/0001-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch b/0001-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch index e3c5c99..441ae4c 100644 --- a/0001-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch +++ b/0001-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch @@ -1,8 +1,6 @@ -From 4475c02d63dda9e2da4c663593491a01ae8c6b5a Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 27 Jan 2016 03:05:18 +0100 -Subject: [PATCH 1/5] OvmfPkg: silence EFI_D_VERBOSE (0x00400000) in - NvmExpressDxe +Subject: [PATCH] OvmfPkg: silence EFI_D_VERBOSE (0x00400000) in NvmExpressDxe NvmExpressDxe logs all BlockIo read & write calls on the EFI_D_VERBOSE level. @@ -63,6 +61,3 @@ index e88e70d..eb3ad3f 100644 MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf --- -1.8.3.1 - diff --git a/0002-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch b/0002-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch deleted file mode 100644 index 8a4d751..0000000 --- a/0002-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch +++ /dev/null @@ -1,272 +0,0 @@ -From 26146b77f6d54c44fbb984bacf8bf31683e8d477 Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek -Date: Wed, 5 Jun 2013 10:25:13 +0200 -Subject: [PATCH 2/3] OvmfPkg/SmbiosPlatformDxe: install+patch default legacy - type0 table (X86) - -Contributed-under: TianoCore Contribution Agreement 1.0 -Signed-off-by: Laszlo Ersek ---- - OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c | 5 +- - OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h | 30 ++++ - OvmfPkg/SmbiosPlatformDxe/QemuType0.c | 180 ++++++++++++++++++++++++ - OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 + - 4 files changed, 215 insertions(+), 1 deletion(-) - create mode 100644 OvmfPkg/SmbiosPlatformDxe/QemuType0.c - -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -index 9c57558..ed75a01 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -@@ -628,7 +628,10 @@ InstallDefaultTables ( - IN OUT BUILD_CONTEXT *Context - ) - { -- return EFI_SUCCESS; -+ EFI_STATUS Status; -+ -+ Status = InstallSmbiosType0 (Smbios, ProducerHandle, Context); -+ return Status; - } - - -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h b/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -index 8613407..ca776b5 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -@@ -218,4 +218,34 @@ PatchSmbiosUnformatted ( - IN UINT8 *TableBase - ); - -+ -+/** -+ Install default (fallback) table for SMBIOS Type 0. -+ -+ In case QEMU has provided no Type 0 SMBIOS table in whole, prepare one here, -+ patch it with any referring saved patches, and install it. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables and saved patches. -+ -+ @retval EFI_SUCCESS A Type 0 table has already been installed from the -+ SMBIOS firmware configuration blob. -+ @retval EFI_SUCCESS No Type 0 table was installed previously, and installing -+ the default here has succeeded. -+ @return Error codes from the PATCH_FORMATTED() and -+ PATCH_UNFORMATTED() macros, except EFI_NOT_FOUND, which -+ is only an informative result of theirs. -+**/ -+EFI_STATUS -+EFIAPI -+InstallSmbiosType0 ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context -+ ); -+ - #endif -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuType0.c b/OvmfPkg/SmbiosPlatformDxe/QemuType0.c -new file mode 100644 -index 0000000..9ec5d76 ---- /dev/null -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuType0.c -@@ -0,0 +1,180 @@ -+/** @file -+ Install the default Type 0 SMBIOS table if QEMU doesn't provide one through -+ the firmware configuration interface. -+ -+ Copyright (C) 2013, Red Hat, Inc. -+ -+ 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. -+**/ -+ -+#include "QemuLegacyInternal.h" -+ -+ -+// -+// Text strings (unformatted area) for the default Tpe 0 SMBIOS table. -+// -+// All possible strings must be provided because Smbios->UpdateString() can -+// only update existing strings, it can't introduce new ones. -+// -+#define OVMF_TYPE0_STRINGS \ -+ "EFI Development Kit II / OVMF\0" /* Vendor */ \ -+ "0.1\0" /* BiosVersion */ \ -+ "06/03/2013\0" /* BiosReleaseDate */ -+ -+ -+// -+// Type definition and contents of the default Type 0 SMBIOS table. -+// -+#pragma pack(1) -+OVMF_SMBIOS (0); -+#pragma pack() -+ -+STATIC CONST OVMF_TYPE0 mOvmfType0 = { -+ { -+ // SMBIOS_STRUCTURE Hdr -+ { -+ EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type -+ sizeof (SMBIOS_TABLE_TYPE0) // UINT8 Length -+ }, -+ 1, // SMBIOS_TABLE_STRING Vendor -+ 2, // SMBIOS_TABLE_STRING BiosVersion -+ 0xE800,// UINT16 BiosSegment -+ 3, // SMBIOS_TABLE_STRING BiosReleaseDate -+ 0, // UINT8 BiosSize -+ { 0 }, // MISC_BIOS_CHARACTERISTICS BiosCharacteristics -+ { 0 }, // UINT8 BIOSCharacteristicsExtensionBytes[2] -+ 0, // UINT8 SystemBiosMajorRelease -+ 1, // UINT8 SystemBiosMinorRelease -+ 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRelease -+ 0xFF // UINT8 EmbeddedControllerFirmwareMinorRelease -+ }, -+ OVMF_TYPE0_STRINGS -+}; -+ -+ -+/** -+ Install default (fallback) table for SMBIOS Type 0. -+ -+ In case QEMU has provided no Type 0 SMBIOS table in whole, prepare one here, -+ patch it with any referring saved patches, and install it. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables and saved patches. -+ -+ @retval EFI_SUCCESS A Type 0 table has already been installed from the -+ SMBIOS firmware configuration blob. -+ @retval EFI_SUCCESS No Type 0 table was installed previously, and installing -+ the default here has succeeded. -+ @return Error codes from the PATCH_FORMATTED() and -+ PATCH_UNFORMATTED() macros, except EFI_NOT_FOUND, which -+ is only an informative result of theirs. -+**/ -+EFI_STATUS -+EFIAPI -+InstallSmbiosType0 ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context -+ ) -+{ -+ TABLE_CONTEXT *Table; -+ OVMF_TYPE0 OvmfType0; -+ MISC_BIOS_CHARACTERISTICS_EXTENSION *Ext; -+ EFI_STATUS Status; -+ EFI_SMBIOS_HANDLE SmbiosHandle; -+ -+ Table = &Context->Table[0]; -+ if (Table->Installed) { -+ return EFI_SUCCESS; -+ } -+ -+ CopyMem (&OvmfType0, &mOvmfType0, sizeof OvmfType0); -+ Ext = (VOID *) &OvmfType0.Base.BIOSCharacteristicsExtensionBytes[0]; -+ -+ OvmfType0.Base.BiosCharacteristics.BiosCharacteristicsNotSupported = 1; -+ Ext->SystemReserved.UefiSpecificationSupported = 1; -+ Ext->SystemReserved.VirtualMachineSupported = 1; -+ -+ // -+ // Default contents ready. Formatted fields must be patched before installing -+ // the table, while strings in the unformatted area will be patched -+ // afterwards. -+ // -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, BiosSegment); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, BiosSize); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, BiosCharacteristics); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, -+ BIOSCharacteristicsExtensionBytes); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, SystemBiosMajorRelease); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, SystemBiosMinorRelease); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, -+ EmbeddedControllerFirmwareMajorRelease); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_FORMATTED (Context, 0, &OvmfType0, -+ EmbeddedControllerFirmwareMinorRelease); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ -+ // -+ // Install SMBIOS table with patched formatted area and default strings. -+ // -+ SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; -+ Status = Smbios->Add (Smbios, ProducerHandle, &SmbiosHandle, -+ (EFI_SMBIOS_TABLE_HEADER *) &OvmfType0); -+ if (EFI_ERROR (Status)) { -+ DEBUG ((DEBUG_ERROR, "%a: Smbios->Add(): %r\n", __FUNCTION__, Status)); -+ return Status; -+ } -+ Table->Installed = TRUE; -+ -+ // -+ // Patch strings in the unformatted area of the installed table. -+ // -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 0, &OvmfType0, -+ Vendor); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 0, &OvmfType0, -+ BiosVersion); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 0, &OvmfType0, -+ BiosReleaseDate); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ return EFI_SUCCESS; -+} -diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -index 8c9f43c..3483b9c 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -@@ -37,6 +37,7 @@ - [Sources.IA32, Sources.X64] - X86Xen.c - QemuLegacy.c -+ QemuType0.c - - [Sources.ARM, Sources.AARCH64] - ArmXen.c --- -1.8.3.1 - diff --git a/0002-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch b/0002-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch index cf4426c..aa3a9eb 100644 --- a/0002-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch +++ b/0002-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch @@ -1,8 +1,6 @@ -From c6e5bbe0378662620e736c82bcd0d08db42e5979 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 27 Jan 2016 03:05:18 +0100 -Subject: [PATCH 2/5] OvmfPkg: silence EFI_D_VERBOSE (0x00400000) in the DXE - core +Subject: [PATCH] OvmfPkg: silence EFI_D_VERBOSE (0x00400000) in the DXE core The DXE core logs a bunch of Properties Table and Memory Attributes Table related information, on the EFI_D_VERBOSE level, that I am at the moment @@ -55,6 +53,3 @@ index eb3ad3f..0e02ba8 100644 } IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf --- -1.8.3.1 - diff --git a/0003-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch b/0003-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch deleted file mode 100644 index bf2254f..0000000 --- a/0003-OvmfPkg-SmbiosPlatformDxe-install-patch-default-lega.patch +++ /dev/null @@ -1,270 +0,0 @@ -From 1b10131728dd1cff48ef1ce46820d89f21708852 Mon Sep 17 00:00:00 2001 -From: Laszlo Ersek -Date: Wed, 5 Jun 2013 10:28:09 +0200 -Subject: [PATCH 3/3] OvmfPkg/SmbiosPlatformDxe: install+patch default legacy - type1 table (X86) - -Contributed-under: TianoCore Contribution Agreement 1.0 -Signed-off-by: Laszlo Ersek ---- - OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c | 5 + - OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h | 30 ++++ - OvmfPkg/SmbiosPlatformDxe/QemuType1.c | 178 ++++++++++++++++++++++++ - OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 + - 4 files changed, 214 insertions(+) - create mode 100644 OvmfPkg/SmbiosPlatformDxe/QemuType1.c - -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -index ed75a01..6507cc0 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacy.c -@@ -631,6 +631,11 @@ InstallDefaultTables ( - EFI_STATUS Status; - - Status = InstallSmbiosType0 (Smbios, ProducerHandle, Context); -+ if (EFI_ERROR (Status)) { -+ return Status; -+ } -+ -+ Status = InstallSmbiosType1 (Smbios, ProducerHandle, Context); - return Status; - } - -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h b/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -index ca776b5..4a2e824 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuLegacyInternal.h -@@ -248,4 +248,34 @@ InstallSmbiosType0 ( - IN OUT BUILD_CONTEXT *Context - ); - -+ -+/** -+ Install default (fallback) table for SMBIOS Type 1. -+ -+ In case QEMU has provided no Type 1 SMBIOS table in whole, prepare one here, -+ patch it with any referring saved patches, and install it. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables and saved patches. -+ -+ @retval EFI_SUCCESS A Type 1 table has already been installed from the -+ SMBIOS firmware configuration blob. -+ @retval EFI_SUCCESS No Type 1 table was installed previously, and installing -+ the default here has succeeded. -+ @return Error codes from the PATCH_FORMATTED() and -+ PATCH_UNFORMATTED() macros, except EFI_NOT_FOUND, which -+ is only an informative result of theirs. -+**/ -+EFI_STATUS -+EFIAPI -+InstallSmbiosType1 ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context -+ ); -+ - #endif -diff --git a/OvmfPkg/SmbiosPlatformDxe/QemuType1.c b/OvmfPkg/SmbiosPlatformDxe/QemuType1.c -new file mode 100644 -index 0000000..ff48164 ---- /dev/null -+++ b/OvmfPkg/SmbiosPlatformDxe/QemuType1.c -@@ -0,0 +1,178 @@ -+/** @file -+ Install the default Type 1 SMBIOS table if QEMU doesn't provide one through -+ the firmware configuration interface. -+ -+ Copyright (C) 2013, Red Hat, Inc. -+ -+ 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. -+**/ -+ -+#include "QemuLegacyInternal.h" -+ -+ -+// -+// Text strings (unformatted area) for the default Tpe 1 SMBIOS table. -+// -+// All possible strings must be provided because Smbios->UpdateString() can -+// only update existing strings, it can't introduce new ones. -+// -+#define OVMF_TYPE1_STRINGS \ -+ "QEMU\0" /* Manufacturer */ \ -+ "QEMU Virtual Machine\0" /* ProductName */ \ -+ "n/a\0" /* Version */ \ -+ "n/a\0" /* SerialNumber */ \ -+ "n/a\0" /* SKUNumber */ \ -+ "n/a\0" /* Family */ -+ -+ -+// -+// Type definition and contents of the default Type 1 SMBIOS table. -+// -+#pragma pack(1) -+OVMF_SMBIOS (1); -+#pragma pack() -+ -+STATIC CONST OVMF_TYPE1 mOvmfType1 = { -+ { -+ // SMBIOS_STRUCTURE Hdr -+ { -+ EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, // UINT8 Type -+ sizeof (SMBIOS_TABLE_TYPE1) // UINT8 Length -+ }, -+ 1, // SMBIOS_TABLE_STRING Manufacturer -+ 2, // SMBIOS_TABLE_STRING ProductName -+ 3, // SMBIOS_TABLE_STRING Version -+ 4, // SMBIOS_TABLE_STRING SerialNumber -+ { 0 }, // GUID Uuid -+ SystemWakeupTypePowerSwitch, // UINT8 WakeUpType -+ 5, // SMBIOS_TABLE_STRING SKUNumber -+ 6, // SMBIOS_TABLE_STRING Family -+ }, -+ OVMF_TYPE1_STRINGS -+}; -+ -+ -+/** -+ Install default (fallback) table for SMBIOS Type 1. -+ -+ In case QEMU has provided no Type 1 SMBIOS table in whole, prepare one here, -+ patch it with any referring saved patches, and install it. -+ -+ @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance used for -+ installing SMBIOS tables. -+ @param[in] ProducerHandle Passed on to Smbios->Add(), ProducerHandle -+ tracks the origin of installed SMBIOS tables. -+ @param[in,out] Context The BUILD_CONTEXT object tracking installed -+ tables and saved patches. -+ -+ @retval EFI_SUCCESS A Type 1 table has already been installed from the -+ SMBIOS firmware configuration blob. -+ @retval EFI_SUCCESS No Type 1 table was installed previously, and installing -+ the default here has succeeded. -+ @return Error codes from the PATCH_FORMATTED() and -+ PATCH_UNFORMATTED() macros, except EFI_NOT_FOUND, which -+ is only an informative result of theirs. -+**/ -+EFI_STATUS -+EFIAPI -+InstallSmbiosType1 ( -+ IN EFI_SMBIOS_PROTOCOL *Smbios, -+ IN EFI_HANDLE ProducerHandle, -+ IN OUT BUILD_CONTEXT *Context -+ ) -+{ -+ TABLE_CONTEXT *Table; -+ OVMF_TYPE1 OvmfType1; -+ EFI_STATUS Status; -+ EFI_SMBIOS_HANDLE SmbiosHandle; -+ -+ Table = &Context->Table[1]; -+ if (Table->Installed) { -+ return EFI_SUCCESS; -+ } -+ -+ CopyMem (&OvmfType1, &mOvmfType1, sizeof OvmfType1); -+ -+ QemuFwCfgSelectItem (QemuFwCfgItemSystemUuid); -+ OvmfType1.Base.Uuid.Data1 = SwapBytes32 (QemuFwCfgRead32 ()); -+ OvmfType1.Base.Uuid.Data2 = SwapBytes16 (QemuFwCfgRead16 ()); -+ OvmfType1.Base.Uuid.Data3 = SwapBytes16 (QemuFwCfgRead16 ()); -+ QemuFwCfgReadBytes (sizeof OvmfType1.Base.Uuid.Data4, -+ &OvmfType1.Base.Uuid.Data4); -+ -+ // -+ // Default contents ready. Formatted fields must be patched before installing -+ // the table, while strings in the unformatted area will be patched -+ // afterwards. -+ // -+ Status = PATCH_FORMATTED (Context, 1, &OvmfType1, Uuid); -+ switch (Status) { -+ case EFI_NOT_FOUND: -+ break; -+ case EFI_SUCCESS: -+ OvmfType1.Base.Uuid.Data1 = SwapBytes32 (OvmfType1.Base.Uuid.Data1); -+ OvmfType1.Base.Uuid.Data2 = SwapBytes16 (OvmfType1.Base.Uuid.Data2); -+ OvmfType1.Base.Uuid.Data3 = SwapBytes16 (OvmfType1.Base.Uuid.Data3); -+ break; -+ default: -+ return Status; -+ } -+ -+ Status = PATCH_FORMATTED (Context, 1, &OvmfType1, WakeUpType); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ -+ // -+ // Install SMBIOS table with patched formatted area and default strings. -+ // -+ SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; -+ Status = Smbios->Add (Smbios, ProducerHandle, &SmbiosHandle, -+ (EFI_SMBIOS_TABLE_HEADER *) &OvmfType1); -+ if (EFI_ERROR (Status)) { -+ DEBUG ((DEBUG_ERROR, "%a: Smbios->Add(): %r\n", __FUNCTION__, Status)); -+ return Status; -+ } -+ Table->Installed = TRUE; -+ -+ // -+ // Patch strings in the unformatted area of the installed table. -+ // -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 1, &OvmfType1, -+ Manufacturer); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 1, &OvmfType1, -+ ProductName); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 1, &OvmfType1, -+ Version); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 1, &OvmfType1, -+ SerialNumber); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 1, &OvmfType1, -+ SKUNumber); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ Status = PATCH_UNFORMATTED (Smbios, SmbiosHandle, Context, 1, &OvmfType1, -+ Family); -+ if (Status != EFI_NOT_FOUND && Status != EFI_SUCCESS) { -+ return Status; -+ } -+ return EFI_SUCCESS; -+} -diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -index 3483b9c..1f7dfca 100644 ---- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf -@@ -38,6 +38,7 @@ - X86Xen.c - QemuLegacy.c - QemuType0.c -+ QemuType1.c - - [Sources.ARM, Sources.AARCH64] - ArmXen.c --- -1.8.3.1 - diff --git a/0003-OvmfPkg-enable-DEBUG_VERBOSE.patch b/0003-OvmfPkg-enable-DEBUG_VERBOSE.patch index 447fdfd..ecf487d 100644 --- a/0003-OvmfPkg-enable-DEBUG_VERBOSE.patch +++ b/0003-OvmfPkg-enable-DEBUG_VERBOSE.patch @@ -1,7 +1,6 @@ -From 214090228fb08f03737ba90d29e23dc7b2235614 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Sun, 8 Jul 2012 14:26:07 +0200 -Subject: [PATCH 3/5] OvmfPkg: enable DEBUG_VERBOSE +Subject: [PATCH] OvmfPkg: enable DEBUG_VERBOSE Enable verbose debug logs. @@ -51,6 +50,3 @@ index 0e02ba8..1836c25 100644 !ifdef $(SOURCE_DEBUG_ENABLE) gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17 --- -1.8.3.1 - diff --git a/0004-OvmfPkg-increase-max-debug-message-length-to-512.patch b/0004-OvmfPkg-increase-max-debug-message-length-to-512.patch index c59c207..1bb9ee3 100644 --- a/0004-OvmfPkg-increase-max-debug-message-length-to-512.patch +++ b/0004-OvmfPkg-increase-max-debug-message-length-to-512.patch @@ -1,7 +1,6 @@ -From f468bab8fa61f7b7d0b0149f374945eb549af16e Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 20 Feb 2014 22:54:45 +0100 -Subject: [PATCH 4/5] OvmfPkg: increase max debug message length to 512 +Subject: [PATCH] OvmfPkg: increase max debug message length to 512 Contributed-under: TianoCore Contribution Agreement 1.0 --- @@ -21,6 +20,3 @@ index 44850a9..b6927d0 100644 /** This constructor function does not have to do anything. --- -1.8.3.1 - diff --git a/0005-OvmfPkg-QemuVideoDxe-enable-debug-messages-in-VbeShi.patch b/0005-OvmfPkg-QemuVideoDxe-enable-debug-messages-in-VbeShi.patch index d8052ba..f1274ea 100644 --- a/0005-OvmfPkg-QemuVideoDxe-enable-debug-messages-in-VbeShi.patch +++ b/0005-OvmfPkg-QemuVideoDxe-enable-debug-messages-in-VbeShi.patch @@ -1,7 +1,6 @@ -From 82175ef201595d45a0959249a36f4ffd74047fdb Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Tue, 20 May 2014 23:41:56 +0200 -Subject: [PATCH 5/5] OvmfPkg: QemuVideoDxe: enable debug messages in VbeShim +Subject: [PATCH] OvmfPkg: QemuVideoDxe: enable debug messages in VbeShim Contributed-under: TianoCore Contribution Agreement 1.0 --- @@ -519,6 +518,3 @@ index cc9b6e1..db37f1d 100644 + /* 00000459 or al,[fs:bx+si] */ 0x64, 0x0A, 0x00, }; #endif --- -1.8.3.1 - diff --git a/0001-EXCLUDE_SHELL_FROM_FD.patch b/0006-EXCLUDE_SHELL_FROM_FD.patch similarity index 94% rename from 0001-EXCLUDE_SHELL_FROM_FD.patch rename to 0006-EXCLUDE_SHELL_FROM_FD.patch index d084003..1e2f7d6 100644 --- a/0001-EXCLUDE_SHELL_FROM_FD.patch +++ b/0006-EXCLUDE_SHELL_FROM_FD.patch @@ -1,4 +1,3 @@ -From 144ac2186d46a9a6cbf4d4174b6db1865d7de1d7 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 18 Feb 2016 10:52:44 +0100 Subject: [PATCH] EXCLUDE_SHELL_FROM_FD @@ -63,6 +62,3 @@ index 387b808..4e0c0ab 100644 FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { SECTION RAW = MdeModulePkg/Logo/Logo.bmp --- -1.8.3.1 - diff --git a/0001-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch b/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch similarity index 99% rename from 0001-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch rename to 0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch index 2e927e9..2b1fae6 100644 --- a/0001-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch +++ b/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch @@ -1,4 +1,3 @@ -From 89d722b43fba95708ba16ef676a989a6e02a55f5 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 6 Jul 2015 20:22:02 +0200 Subject: [PATCH] OvmfPkg: EnrollDefaultKeys: application for enrolling default @@ -55,7 +54,7 @@ Signed-off-by: Laszlo Ersek diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c new file mode 100644 -index 000000000000..a1dddb2fb5be +index 0000000..081212b --- /dev/null +++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c @@ -0,0 +1,960 @@ @@ -1021,7 +1020,7 @@ index 000000000000..a1dddb2fb5be +} diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf new file mode 100644 -index 000000000000..30c127f2ecb4 +index 0000000..ac919bb --- /dev/null +++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf @@ -0,0 +1,51 @@ @@ -1077,10 +1076,10 @@ index 000000000000..30c127f2ecb4 + UefiLib + UefiRuntimeServicesTableLib diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc -index 012e24817e5a..1e0e71aea606 100644 +index aaaaaa8..90980d4 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc -@@ -743,6 +743,10 @@ [Components] +@@ -725,6 +725,10 @@ !if $(SECURE_BOOT_ENABLE) == TRUE SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf @@ -1092,10 +1091,10 @@ index 012e24817e5a..1e0e71aea606 100644 OvmfPkg/PlatformDxe/Platform.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc -index 23c09d1e6083..6346f2db0006 100644 +index b4545b3..4d0ec9c 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc -@@ -752,6 +752,10 @@ [Components.X64] +@@ -734,6 +734,10 @@ !if $(SECURE_BOOT_ENABLE) == TRUE SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf @@ -1107,10 +1106,10 @@ index 23c09d1e6083..6346f2db0006 100644 OvmfPkg/PlatformDxe/Platform.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc -index b0b6b3770e84..7a0d7eb7a75f 100644 +index 1836c25..aca5476 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc -@@ -750,6 +750,10 @@ [Components] +@@ -732,6 +732,10 @@ !if $(SECURE_BOOT_ENABLE) == TRUE SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf @@ -1121,6 +1120,3 @@ index b0b6b3770e84..7a0d7eb7a75f 100644 !endif OvmfPkg/PlatformDxe/Platform.inf --- -1.8.3.1 - diff --git a/0001-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch b/0008-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch similarity index 98% rename from 0001-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch rename to 0008-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch index 1c28761..aaf8ba6 100644 --- a/0001-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch +++ b/0008-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch @@ -1,4 +1,3 @@ -From c8e5617ebaaa8be91a32be48dcf3dc7157b00d2c Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Tue, 25 Feb 2014 18:40:35 +0100 Subject: [PATCH] MdeModulePkg: TerminalDxe: add other text resolutions @@ -108,6 +107,3 @@ index 6fde3b2..787bd35 100644 // // New modes can be added here. // --- -1.8.3.1 - diff --git a/0001-pick-up-any-display-device-not-only-vga.patch b/0009-pick-up-any-display-device-not-only-vga.patch similarity index 77% rename from 0001-pick-up-any-display-device-not-only-vga.patch rename to 0009-pick-up-any-display-device-not-only-vga.patch index de874d2..732d76d 100644 --- a/0001-pick-up-any-display-device-not-only-vga.patch +++ b/0009-pick-up-any-display-device-not-only-vga.patch @@ -1,4 +1,3 @@ -From 71de9d92e78ae0a7c351f9daf84109bbbaca400a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 13 Mar 2014 08:08:41 +0100 Subject: [PATCH] pick up any display device, not only vga @@ -8,10 +7,10 @@ Subject: [PATCH] pick up any display device, not only vga 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c -index ab9c93e..d3f5908 100644 +index 0bc02ba..5024caf 100644 --- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c -@@ -593,7 +593,7 @@ DetectAndPreparePlatformPciDevicePath ( +@@ -586,7 +586,7 @@ DetectAndPreparePlatformPciDevicePath ( // // Here we decide which VGA device to enable in PCI bus // @@ -20,6 +19,3 @@ index ab9c93e..d3f5908 100644 // // Add them to ConOut. // --- -1.8.3.1 - diff --git a/edk2.spec b/edk2.spec index fc23aca..e7f22f2 100644 --- a/edk2.spec +++ b/edk2.spec @@ -15,17 +15,22 @@ Source1: https://www.openssl.org/source/openssl-%{openssl_version}.tar.gz Source3: build-iso.sh Source9: update-tarball.sh -Patch1: 0001-pick-up-any-display-device-not-only-vga.patch -Patch2: 0001-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch -Patch3: 0001-EXCLUDE_SHELL_FROM_FD.patch - -Patch10: 0001-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch -Patch11: 0002-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch -Patch12: 0003-OvmfPkg-enable-DEBUG_VERBOSE.patch -Patch13: 0004-OvmfPkg-increase-max-debug-message-length-to-512.patch -Patch14: 0005-OvmfPkg-QemuVideoDxe-enable-debug-messages-in-VbeShi.patch - -Patch20: 0001-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch +# Debug output tweaks, not for upstream +Patch0001: 0001-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch +Patch0002: 0002-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-the-DXE-.patch +Patch0003: 0003-OvmfPkg-enable-DEBUG_VERBOSE.patch +Patch0004: 0004-OvmfPkg-increase-max-debug-message-length-to-512.patch +Patch0005: 0005-OvmfPkg-QemuVideoDxe-enable-debug-messages-in-VbeShi.patch +# Exclude EFI shell from firmware, suggested by pjones re: secureboot. +# Not for upstream, see bug 1325023#c16 +Patch0006: 0006-EXCLUDE_SHELL_FROM_FD.patch +# Ship EnrollDefaultKeys application. +# Not for upstream, see bug 1325023#c16 +Patch0007: 0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch +# More text console resolutions. Upstreaming attempted, but failed +Patch0008: 0008-MdeModulePkg-TerminalDxe-add-other-text-resolutions.patch +# Support qemu 'secondary-vga'. Not send upstream yet +Patch0009: 0009-pick-up-any-display-device-not-only-vga.patch # # actual firmware builds are done on x86_64 and aarch64, @@ -101,17 +106,7 @@ AARCH64 UEFI Firmware %prep %setup -q -n tianocore-%{name}-%{edk2_githash} -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 - -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 - -%patch20 -p1 +%autopatch -p1 # add openssl tar -C CryptoPkg/Library/OpensslLib -xf %{SOURCE1}