From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.groups.io with SMTP id smtpd.web08.12.1662722116001097121 for ; Fri, 09 Sep 2022 04:15:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ghKk9vDZ; spf=pass (domain: gmail.com, ip: 209.85.221.49, mailfrom: theojehl76@gmail.com) Received: by mail-wr1-f49.google.com with SMTP id c11so2145107wrp.11 for ; Fri, 09 Sep 2022 04:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=LKg7HKlN29j7Lx6zLJ+21+d+hmpFQmIgyjMuf0z9GLw=; b=ghKk9vDZ7rWUFAEv/b6OM1DDqQfy3FVR3Wmewf4pQPakTpi0D66RH4XqxPpsabglkw 0fmxK4tVfglLDGvkruiwsI4eKjsK91mU8UVGyF1ldJiQx4ZriAfUfZEdvUCHY4Qyt/8P ZvsuIrMar/8w20KO+P0V3FKpqwg/lb5TVHm1NnzpTOSCjZiHOWfI3vB+Ucx9WAC/oTq+ MGDaw+1ZrvmAFlZQGVWZ7Jl+LrQPzI7fWODw99Bz07yj3tPzi16Cjj9JtUB0l2OBh8WC 1Q+AKt5VHWiN3W1d3yX3tgHFmyJo6JeBRQGPSFJyAI4kkEAZt7sbMW6czMTZ8z1WmSmc bK0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=LKg7HKlN29j7Lx6zLJ+21+d+hmpFQmIgyjMuf0z9GLw=; b=s+gEzB9UJ82AYa0Pg0midpJMC404nV07nzbrHplQOZU9X89OYUxJqZC3SqPYrf3b9P ZyzewDjrAqJtMnrIjvd85iPS4hQ9kULkWtm5DLEv8HGOXsduu4gRtM6uFYoI8P7IV0Rm LNrJahYiLV0ts4/gq9JPQaXssOZ3PGfnAk51YyNnrHIV6NrThNhXPODu7qbo67ZmD2tt UD3+BdLEX+RjJbjjEi2g1I+mj+/jUnBruJTEvLU0XNFFz5SUSBxpjLiGGmdysrt9IGsG hKaaUrh591fvtATmgNVKf7+/Za+bP0KQmQcZYFdrFPhWItex+DQbd1pyopZ5JcldNe0E fF+w== X-Gm-Message-State: ACgBeo0RqMl1YH/n3CeUDxpT0EIPhrEQBeJJEdTKYNpslffjx5JAr1TS b8qg2QKR/Rve1wbO9lNsLhhBbH4IeUaUb7GE X-Google-Smtp-Source: AA6agR75QrOEGnWePXTprFKIUc6UHwE9LzQIHEt8bUoCZpQT6IoerVNsBSP02NMg9sX3dYZCTe+ceA== X-Received: by 2002:a05:6000:815:b0:22a:418e:f354 with SMTP id bt21-20020a056000081500b0022a418ef354mr905430wrb.97.1662722114107; Fri, 09 Sep 2022 04:15:14 -0700 (PDT) Return-Path: Received: from localhost.localdomain (eth-east-parth2-46-193-66-249.wb.wifirst.net. [46.193.66.249]) by smtp.gmail.com with ESMTPSA id i11-20020adfb64b000000b00228df23bd51sm240537wre.82.2022.09.09.04.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 04:15:13 -0700 (PDT) From: =?UTF-8?B?VGjDqW8gSmVobA==?= To: devel@edk2.groups.io Cc: Leif Lindholm , Michael D Kinney , Isaac Oram , Pedro Falcato , Gerd Hoffmann , Stefan Hajnoczi Subject: [[edk2-platforms] Patch V2 4/4] QemuOpenBoardPkg: Enable stage 4 Date: Fri, 9 Sep 2022 13:15:04 +0200 Message-Id: <20220909111504.1661-5-theojehl76@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220909111504.1661-1-theojehl76@gmail.com> References: <20220909111504.1661-1-theojehl76@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Enable MinPlatform stage 4 (OS boot) functionality. It adds ACPI, SMBIOS and SMM drivers required for stage 4. This should boot Windows and Linux with PIIX4 or Q35 configurations. In the current state, SMM only works on Qemu Q35 system if you set SMM_REQUIRED =3D TRUE in QemuOpenBoardPkg.dsc or via command-line. Cc: Leif Lindholm =0D Cc: Michael D Kinney =0D Cc: Isaac Oram =0D Cc: Pedro Falcato =0D Cc: Gerd Hoffmann =0D Cc: Stefan Hajnoczi =0D Signed-off-by: Th=C3=A9o Jehl --- Platform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage4.dsc.inc | 56 +++= +++++ Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc | 14 +- Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf | 66 +++= +++++++ Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h | 10 +- 4 files changed, 139 insertions(+), 7 deletions(-) diff --git a/Platform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage4.dsc.inc b/Pl= atform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage4.dsc.inc new file mode 100644 index 000000000000..369416db72b6 --- /dev/null +++ b/Platform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage4.dsc.inc @@ -0,0 +1,56 @@ +## @file=0D +# Common DSC content to begin Stage 4 enabling=0D +#=0D +# @copyright=0D +# Copyright (C) 2022 Th=C3=A9o Jehl=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +=0D +=0D +[LibraryClasses]=0D + !if $(SMM_REQUIRED) =3D=3D TRUE=0D + SpiFlashCommonLib | IntelSiliconPkg/Library/SmmSpiFlashCommonLib/S= mmSpiFlashCommonLib.inf=0D + !endif=0D +=0D +[LibraryClasses.Common.DXE_SMM_DRIVER]=0D + LockBoxLib | MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxS= mmLib.inf=0D + SmmCpuPlatformHookLib | OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmC= puPlatformHookLibQemu.inf=0D + SmmCpuFeaturesLib | OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeatur= esLib.inf=0D +=0D +[Components.$(DXE_ARCH)]=0D + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf=0D + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf=0D + OvmfPkg/SataControllerDxe/SataControllerDxe.inf=0D + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf=0D + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf=0D + MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf=0D + MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf=0D + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf=0D + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf=0D + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf=0D +=0D + !if $(SMM_REQUIRED) =3D=3D TRUE=0D + OvmfPkg/SmmAccess/SmmAccess2Dxe.inf=0D + OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf=0D + MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf=0D + MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf=0D +=0D + MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf=0D + UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf=0D +=0D + MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCodeRout= erSmm.inf=0D + MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf= =0D + UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf=0D + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf= =0D + IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf=0D + !endif=0D +=0D + #=0D + # SMBIOS Support=0D + #=0D + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf {=0D + =0D + NULL | OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf=0D + }=0D + OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc b/Platform= /Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc index 55c7c3e3cc00..13eeaac0cc05 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc +++ b/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc @@ -38,7 +38,7 @@ OvmfPkg/OvmfPkg.dec=0D =0D [PcdsFixedAtBuild]=0D - gMinPlatformPkgTokenSpaceGuid.PcdBootStage | = 3=0D + gMinPlatformPkgTokenSpaceGuid.PcdBootStage | = 4=0D =0D gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel | = 0x802A00C7=0D gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel | = 0x802A00C7=0D @@ -95,7 +95,7 @@ gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable | = FALSE=0D =0D !if $(SMM_REQUIRED) =3D=3D TRUE=0D - gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire | = FALSE=0D + gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire | = TRUE=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport | = FALSE=0D gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache | = FALSE=0D !endif=0D @@ -129,6 +129,7 @@ !include QemuOpenBoardPkg/Include/Dsc/Stage1.dsc.inc=0D !include QemuOpenBoardPkg/Include/Dsc/Stage2.dsc.inc=0D !include QemuOpenBoardPkg/Include/Dsc/Stage3.dsc.inc=0D +!include QemuOpenBoardPkg/Include/Dsc/Stage4.dsc.inc=0D =0D [LibraryClasses.Common]=0D QemuOpenFwCfgLib | QemuOpenBoardPkg/Library/QemuOpenFwCfgLib/Qemu= OpenFwCfgLib.inf=0D @@ -153,3 +154,12 @@ DebugLib | OvmfPkg/Library/PlatformDebugLibIoPort/Platfor= mRomDebugLibIoPort.inf=0D =0D [Components.$(DXE_ARCH)]=0D + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf=0D + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf=0D + OvmfPkg/SataControllerDxe/SataControllerDxe.inf=0D + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf=0D + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf=0D + MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf=0D + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf=0D + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf b/Platform= /Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf index 8f14ad71c1f8..ea1547df32aa 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf +++ b/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf @@ -220,6 +220,8 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize = =3D 0x800000 INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf=0D INF MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf=0D =0D +=0D +=0D [FV.FvUefiBoot]=0D !include MinPlatformPkg/Include/Fdf/CommonSpiFvHeaderInfo.fdf=0D FvNameGuid =3D D0C15ADB-FE38-4331-841C-0E96C1B0FBFA=0D @@ -232,15 +234,76 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize = =3D 0x800000 }=0D }=0D =0D +=0D ###########################=0D #=0D # Stage 4 Firmware Volumes=0D #=0D ###########################=0D +[FV.FvOsBootUncompressed]=0D + !include MinPlatformPkg/Include/Fdf/CommonSpiFvHeaderInfo.fdf=0D + FvNameGuid =3D 4bb59c22-e1b8-414e-9de8-559db4054c4c=0D +=0D + INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf=0D +=0D + INF PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeControllerDxe.inf=0D + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf=0D + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf=0D + INF FatPkg/EnhancedFatDxe/Fat.inf=0D +=0D + INF MdeModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf=0D + INF MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf=0D +=0D + # ACPI=0D + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf=0D + INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf=0D +=0D + # Buses=0D +=0D + INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf=0D + INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf=0D + INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf=0D + INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf=0D + INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf=0D +=0D + INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf=0D + INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf=0D +=0D + INF OvmfPkg/SataControllerDxe/SataControllerDxe.inf=0D +=0D + INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf=0D + INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf=0D +=0D + INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf=0D +=0D + !if $(SMM_REQUIRED) =3D=3D TRUE=0D + INF OvmfPkg/SmmAccess/SmmAccess2Dxe.inf=0D + INF OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf=0D + INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf=0D + INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf=0D + INF MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf=0D + INF MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCo= deRouterSmm.inf=0D + INF MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSm= m.inf=0D + INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf=0D + INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf=0D + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteS= mm.inf=0D + INF IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf= =0D + !endif=0D +=0D + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf=0D + INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf=0D +=0D [FV.FvOsBoot]=0D !include MinPlatformPkg/Include/Fdf/CommonSpiFvHeaderInfo.fdf=0D FvNameGuid =3D AE8F0EA0-1614-422D-ABC1-C518596F1678=0D =0D + FILE FV_IMAGE =3D 4bb59c22-e1b8-414e-9de8-559db4054c4c {=0D + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE {=0D + SECTION FV_IMAGE =3D FvOsBootUncompressed=0D + }=0D + }=0D +=0D +=0D ###########################=0D #=0D # Stage 5 Firmware Volumes=0D @@ -249,6 +312,9 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize = =3D 0x800000 [FV.FvSecurity]=0D !include MinPlatformPkg/Include/Fdf/CommonSpiFvHeaderInfo.fdf=0D FvNameGuid =3D 1AE6AB90-9431-425B-9A92-ED2708A4E982=0D + !include MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf=0D + !include MinPlatformPkg/Include/Fdf/CoreSecurityPreMemoryInclude.fdf=0D +=0D =0D ###########################=0D #=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLi= b.h b/Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h index 2d4690b660f5..a94228837b7a 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h +++ b/Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h @@ -89,17 +89,17 @@ QemuFwCfgReadBytes ( /**=0D Finds a file in fw_cfg by its name=0D =0D - @param[in] String Pointer to an ASCII string to match in the database=0D + @param[in] String Pointer to an ASCII string to match in the database=0D @param[out] FWConfigFile Buffer for the config file=0D =0D - @return EFI_STATUS - Entry was found, FWConfigFile is populated=0D - @return EFI_ERROR - Entry was not found=0D + @return EFI_STATUS Entry was found, FWConfigFile is populated=0D + @return EFI_ERROR Entry was not found=0D */=0D EFI_STATUS=0D EFIAPI=0D QemuFwCfgFindFile (=0D - IN CHAR8 *String,=0D - OUT QEMU_FW_CFG_FILE *FWConfigFile=0D + IN CHAR8 *String,=0D + OUT QEMU_FW_CFG_FILE *FWConfigFile=0D );=0D =0D #endif // QEMU_OPEN_BOARD_PKG_QEMU_FW_CFG_LIB_H_=0D --=20 2.32.1 (Apple Git-133)