From nobody Sat Apr 27 01:21:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48332+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48332+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1569892560; cv=none; d=zoho.com; s=zohoarc; b=EIkhx17RazjHumKZBKmJaX/4RfKad1AxgAMN74GZSCp/U2bcVKy49uc1Sz5ezl5+npXHn3QUnLoY9rzVIANGd22aTP4c614R28mWhDsJRSIPkCEa/1ZQVUIuGo5FZomyYlxjLZZKt+EirRstcldCDAcCtXmYbFwLnvlOKJMwW9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569892560; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=w4WzTe+oVryfKYPv8N+a+srUiNAStRPAHNUKvQsnpvw=; b=AlfocwQxRKkYx3cFXMMdF9ZKowJ4OXcc2THShSDsaCY1nowtbLm8ReJro+gxBOijKaQ8bEvBhFpjQ2aaflgh87M4KQ37CTGAiOcgmiDz1YlQR7LNMzWMXRPT1d6p6zpTDKoa4GNjfBywsN8g9FkBfCOHwZOjaF5QBG0gRCUBn4Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48332+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1569892560183570.459034011638; Mon, 30 Sep 2019 18:16:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id iC3YYY1788612xuJHmxdbmHJ; Mon, 30 Sep 2019 18:15:59 -0700 X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 30 Sep 2019 18:15:59 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 18:15:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,569,1559545200"; d="scan'208";a="203080838" X-Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga002.jf.intel.com with ESMTP; 30 Sep 2019 18:15:58 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Sai Chaganty , Ray Ni Subject: [edk2-devel] [edk2-platforms][PATCH V1 1/3] IntelSiliconPkg/FirmwareBootMediaLib: Add library Date: Mon, 30 Sep 2019 18:15:45 -0700 Message-Id: <20191001011547.14588-2-michael.a.kubacki@intel.com> In-Reply-To: <20191001011547.14588-1-michael.a.kubacki@intel.com> References: <20191001011547.14588-1-michael.a.kubacki@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.a.kubacki@intel.com X-Gm-Message-State: hshjPNUdZXBz5BguvJf3hEkex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1569892559; bh=Ke2+G7T5ujJ8CAkraW+zfIhK2XKVUB6n0N3Bmcl30hI=; h=Cc:Date:From:Reply-To:Subject:To; b=DRE+ox/qDQEkMMFcwojjp8vA/L+sH7tgIbyuz8Pe5iK3vZRC/yt8BRRkRyxhmwvReqI VZ7beuh9MPjUEenjaF2BCkBJxcvBfejPn6EhWcLzPH6UiO2aDSYxFdiDnepKGJLY8Ttms E/Wt0GjvA3gLLd0d4gEsqHN/6rkVE6xIvYc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2229 Adds a new library that is used to make system initialization decisions in the boot flow dependent upon firmware boot media. Note that the firmware boot media is the storage media that the boot firmware is stored on. It is not the OS storage media which may be stored upon a different non-volatile storage device. Any Intel board, platform, or silicon code that must take action conditionally based on the firmware boot media must use this library API. Cc: Sai Chaganty Cc: Ray Ni Signed-off-by: Michael Kubacki --- Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec = | 4 +- Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc = | 4 +- Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmware= BootMediaLib.inf | 43 ++++++++ Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBoo= tMediaLib.inf | 38 +++++++ Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h = | 106 +++++++++++++++++++ Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmware= BootMediaLib.c | 107 +++++++++++++++++++ Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMe= diaLib.c | 109 ++++++++++++++++++++ Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBoo= tMediaLib.c | 82 +++++++++++++++ 8 files changed, 491 insertions(+), 2 deletions(-) diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/In= tel/IntelSiliconPkg/IntelSiliconPkg.dec index fe5bfa0dc6..8ae0223f35 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec @@ -3,7 +3,7 @@ # # This package provides common open source Intel silicon modules. # -# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -35,6 +35,8 @@ ## Include/Guid/MicrocodeFmp.h gMicrocodeFmpImageTypeIdGuid =3D { 0x96d4fdcd, 0x1502, 0x424d, { 0x= 9d, 0x4c, 0x9b, 0x12, 0xd2, 0xdc, 0xae, 0x5c } } =20 + gFirmwareBootMediaHobGuid =3D { 0x8c7340ea, 0xde8b, 0x4e06, {0xa4, 0x78,= 0xec, 0x8b, 0x62, 0xd7, 0xa, 0x8b } } + [Ppis] gEdkiiVTdInfoPpiGuid =3D { 0x8a59fcb3, 0xf191, 0x400c, { 0x97, 0x67, 0x6= 7, 0xaf, 0x2b, 0x25, 0x68, 0x4a } } =20 diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/In= tel/IntelSiliconPkg/IntelSiliconPkg.dsc index 58b5b656ef..2b4a525404 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc @@ -1,7 +1,7 @@ ## @file # This package provides common open source Intel silicon modules. # -# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -42,6 +42,7 @@ =20 MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFi= rmwareBootMediaLib.inf =20 [LibraryClasses.common.DXE_DRIVER] UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf @@ -52,6 +53,7 @@ =20 HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSm= mFirmwareBootMediaLib.inf =20 ##########################################################################= ######################### # diff --git a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Dx= eSmmFirmwareBootMediaLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxe= SmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf new file mode 100644 index 0000000000..83ed5f04af --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFir= mwareBootMediaLib.inf @@ -0,0 +1,43 @@ +## @file +# Firmware Boot Media Library +# +# The firmware boot media device is used to make system initialization dec= isions in the boot flow dependent +# upon firmware boot media. Note that the firmware boot media is the stora= ge media that the boot firmware is stored on. +# It is not the OS storage media which may be stored upon a different non-= volatile storage device. +# +# This library contains an implementation for the DXE and SMM boot phases. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D DxeSmmFirmwareBootMediaLib + FILE_GUID =3D 72F07B0B-54F5-47FD-9EDB-D796BE2B87E9 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + PI_SPECIFICATION_VERSION =3D 0x0001000A + LIBRARY_CLASS =3D FirmwareBootMediaLib|DXE_DRIVER DXE_S= MM_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR =3D DxeSmmFirmwareBootMediaLibInit +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC +# + +[Sources] + FirmwareBootMediaLib.c + DxeSmmFirmwareBootMediaLib.c + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + HobLib + +[Guids] + gFirmwareBootMediaHobGuid ## CONSUMES diff --git a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Pe= iFirmwareBootMediaLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmm= BootMediaLib/PeiFirmwareBootMediaLib.inf new file mode 100644 index 0000000000..063c4027d3 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwa= reBootMediaLib.inf @@ -0,0 +1,38 @@ +## @file +# Firmware Boot Media Library +# +# The firmware boot media device is used to make system initialization dec= isions in the boot flow dependent +# upon firmware boot media. Note that the firmware boot media is the stora= ge media that the boot firmware is stored on. +# It is not the OS storage media which may be stored upon a different non-= volatile storage device. +# +# This library contains an implementation for the PEI boot phase. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PeiFirmwareBootMediaLib + FILE_GUID =3D D3F7BD0B-3539-4F2D-AF98-EE32DBE7971F + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D FirmwareBootMediaLib + +[Sources] + FirmwareBootMediaLib.c + PeiFirmwareBootMediaLib.c + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + HobLib + +[Guids] + gFirmwareBootMediaHobGuid ## PRODUCES CONSUMES diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMedi= aLib.h b/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib= .h new file mode 100644 index 0000000000..aca9593a84 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h @@ -0,0 +1,106 @@ +/** @file + This library identifies the firmware boot media device. + + The firmware boot media device is used to make system initialization dec= isions in the boot flow dependent + upon firmware boot media. Note that the firmware boot media is the stora= ge media that the boot firmware is stored on. + It is not the OS storage media which may be stored upon a different non-= volatile storage device. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FIRMWARE_BOOT_MEDIA_LIB_H_ +#define _FIRMWARE_BOOT_MEDIA_LIB_H_ + +#include + +typedef enum { + FwBootMediaSpi, + FwBootMediaUfs, + FwBootMediaEmmc, + FwBootMediaNvme, + FwBootMediaMax +} FW_BOOT_MEDIA_TYPE; + +typedef struct { + FW_BOOT_MEDIA_TYPE BootMedia; +} FW_BOOT_MEDIA_HOB_DATA; + +/** + Determines the current platform firmware boot media device. + + @param[out] FwBootMediaType The current platform Boot Media type. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_FOUND The boot media type could not be found. +**/ +EFI_STATUS +EFIAPI +GetFirmwareBootMediaType ( + OUT FW_BOOT_MEDIA_TYPE *FwBootMediaType + ); + +/** + Indicates whether the boot media is presently known. + + Note: Very early in boot this data may not be available. + + @retval TRUE Boot media is known + @retval FALSE Boot media is not known +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsKnown ( + VOID + ); + +/** + Determines if the platform firmware is booting from SPI. + + @retval TRUE Platform firmware is booting from SPI + @retval FALSE Platform firmware is booting from a non-SPI device o= r the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsSpi ( + VOID + ); + +/** + Determines if the platform firmware is booting from UFS. + + @retval TRUE Platform firmware is booting from UFS + @retval FALSE Platform firmware is booting from a non-UFS device o= r the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsUfs ( + VOID + ); + +/** + Determines if the platform firmware is booting from eMMC. + + @retval TRUE Platform firmware is booting from eMMC + @retval FALSE Platform firmware is booting from a non-eMMC device = or the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsEmmc ( + VOID + ); + +/** + Determines if the platform firmware is booting from NVMe. + + @retval TRUE Platform firmware is booting from NVMe. + @retval FALSE Platform firmware is booting from a non-NVMe device = or the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsNvme ( + VOID + ); + +#endif diff --git a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Dx= eSmmFirmwareBootMediaLib.c b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSm= mBootMediaLib/DxeSmmFirmwareBootMediaLib.c new file mode 100644 index 0000000000..1e3876afb3 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFir= mwareBootMediaLib.c @@ -0,0 +1,107 @@ +/** @file + This library identifies the firmware boot media device. + + The firmware boot media device is used to make system initialization dec= isions in the boot flow dependent + upon firmware boot media. Note that the firmware boot media is the stora= ge media that the boot firmware is stored on. + It is not the OS storage media which may be stored upon a different non-= volatile storage device. + + This file contains implementation specific to the DXE and SMM boot phase= s. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +STATIC FW_BOOT_MEDIA_TYPE mFwBootMedia =3D FwBootMediaMax; + +/** + Determines the current platform firmware boot media device. + + @param[out] FwBootMediaType The current platform Boot Media type. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_FOUND The boot media type could not be found. +**/ +EFI_STATUS +EFIAPI +GetFirmwareBootMediaType ( + OUT FW_BOOT_MEDIA_TYPE *FwBootMediaType + ) +{ + if (mFwBootMedia =3D=3D FwBootMediaMax) { + return EFI_NOT_FOUND; + } + + *FwBootMediaType =3D mFwBootMedia; + return EFI_SUCCESS; +} + +/** + Determines if the boot media is presently known. + + Note: Very early in boot this data may not be available. + + @retval TRUE Boot media is known + @retval FALSE Boot media is not known +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsKnown ( + VOID + ) +{ + return mFwBootMedia !=3D FwBootMediaMax; +} + +/** + The library constructor. + + This constructor depends upon gFirmwareBootMediaHobGuid. + It should be produced by the platform in the HOB producer phase. + + @param[in] ImageHandle The firmware allocated handle for the = UEFI image. + @param[in] SystemTable A pointer to the EFI system table. + + @retval EFI_SUCCESS The constructor executed successfully. + @retval EFI_NOT_FOUND The gFirmwareBootMediaHobGuid HOB coul= d not be located + or the boot media type is invalid. +**/ +EFI_STATUS +EFIAPI +DxeSmmFirmwareBootMediaLibInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + FW_BOOT_MEDIA_HOB_DATA *BootMediaHobData; + FW_BOOT_MEDIA_TYPE BootMediaType; + EFI_HOB_GUID_TYPE *GuidHobPtr; + + GuidHobPtr =3D GetFirstGuidHob (&gFirmwareBootMediaHobGuid); + if (GuidHobPtr =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB does not exist!\n")); + ASSERT (GuidHobPtr !=3D NULL); + return EFI_NOT_FOUND; + } + + BootMediaHobData =3D (FW_BOOT_MEDIA_HOB_DATA *) GET_GUID_HOB_DATA (GuidH= obPtr); + if (BootMediaHobData =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + BootMediaType =3D BootMediaHobData->BootMedia; + + if (BootMediaType >=3D FwBootMediaMax) { + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB specifies an invalid= media type.\n")); + return EFI_NOT_FOUND; + } + + mFwBootMedia =3D BootMediaType; + + return EFI_SUCCESS; +} diff --git a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Fi= rmwareBootMediaLib.c b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootM= ediaLib/FirmwareBootMediaLib.c new file mode 100644 index 0000000000..11a14d172d --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareB= ootMediaLib.c @@ -0,0 +1,109 @@ +/** @file + This library identifies the firmware boot media device. + + The firmware boot media device is used to make system initialization dec= isions in the boot flow dependent + upon firmware boot media. Note that the firmware boot media is the stora= ge media that the boot firmware is stored on. + It is not the OS storage media which may be stored upon a different non-= volatile storage device. + + This file contains library implementation common to all boot phases. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +/** + Determines if the platform firmware is booting from SPI. + + @retval TRUE Platform firmware is booting from SPI + @retval FALSE Platform firmware is booting from a non-SPI device o= r the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsSpi ( + VOID + ) +{ + EFI_STATUS Status; + FW_BOOT_MEDIA_TYPE BootMedia; + + Status =3D GetFirmwareBootMediaType (&BootMedia); + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaSpi) { + return FALSE; + } else { + return TRUE; + } +} + +/** + Determines if the platform firmware is booting from UFS. + + @retval TRUE Platform firmware is booting from UFS + @retval FALSE Platform firmware is booting from a non-UFS device o= r the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsUfs ( + VOID + ) +{ + EFI_STATUS Status; + FW_BOOT_MEDIA_TYPE BootMedia; + + Status =3D GetFirmwareBootMediaType (&BootMedia); + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaUfs) { + return FALSE; + } else { + return TRUE; + } +} + +/** + Determines if the platform firmware is booting from eMMC. + + @retval TRUE Platform firmware is booting from eMMC + @retval FALSE Platform firmware is booting from a non-eMMC device = or the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsEmmc ( + VOID + ) +{ + EFI_STATUS Status; + FW_BOOT_MEDIA_TYPE BootMedia; + + Status =3D GetFirmwareBootMediaType (&BootMedia); + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaEmmc) { + return FALSE; + } else { + return TRUE; + } +} + +/** + Determines if the platform firmware is booting from NVMe. + + @retval TRUE Platform firmware is booting from NVMe. + @retval FALSE Platform firmware is booting from a non-NVMe device = or the boot media is unknown +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsNvme ( + VOID + ) +{ + EFI_STATUS Status; + FW_BOOT_MEDIA_TYPE BootMedia; + + Status =3D GetFirmwareBootMediaType (&BootMedia); + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaNvme) { + return FALSE; + } else { + return TRUE; + } +} diff --git a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Pe= iFirmwareBootMediaLib.c b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBo= otMediaLib/PeiFirmwareBootMediaLib.c new file mode 100644 index 0000000000..14478e0dbe --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwa= reBootMediaLib.c @@ -0,0 +1,82 @@ +/** @file + This library identifies the firmware boot media device. + + The firmware boot media device is used to make system initialization dec= isions in the boot flow dependent + upon firmware boot media. Note that the firmware boot media is the stora= ge media that the boot firmware is stored on. + It is not the OS storage media which may be stored upon a different non-= volatile storage device. + + This file contains implementation specific to the PEI boot phase. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +/** + Determines the current platform firmware boot media device. + + @param[out] FwBootMediaType The current platform Boot Media type. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_FOUND The boot media type could not be found. +**/ +EFI_STATUS +EFIAPI +GetFirmwareBootMediaType ( + OUT FW_BOOT_MEDIA_TYPE *FwBootMediaType + ) +{ + FW_BOOT_MEDIA_HOB_DATA *BootMediaHobData; + EFI_HOB_GUID_TYPE *GuidHobPtr; + + GuidHobPtr =3D GetFirstGuidHob (&gFirmwareBootMediaHobGuid); + if (GuidHobPtr =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB does not exist!\n"= )); + ASSERT (GuidHobPtr !=3D NULL); + return EFI_NOT_FOUND; + } + + BootMediaHobData =3D (FW_BOOT_MEDIA_HOB_DATA *) GET_GUID_HOB_DATA (GuidH= obPtr); + if (BootMediaHobData =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + if (BootMediaHobData->BootMedia >=3D FwBootMediaMax) { + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB specifies an invalid= media type.\n")); + return EFI_NOT_FOUND; + } + *FwBootMediaType =3D BootMediaHobData->BootMedia; + + return EFI_SUCCESS; +} + +/** + Determines if the boot media is presently known. + + Note: Very early in boot this data may not be available. + + @retval TRUE Boot media is known + @retval FALSE Boot media is not known +**/ +BOOLEAN +EFIAPI +FirmwareBootMediaIsKnown ( + VOID + ) +{ + EFI_STATUS Status; + FW_BOOT_MEDIA_TYPE BootMedia; + + BootMedia =3D FwBootMediaMax; + Status =3D GetFirmwareBootMediaType (&BootMedia); + if (EFI_ERROR (Status) || BootMedia =3D=3D FwBootMediaMax) { + return FALSE; + } else { + return TRUE; + } +} --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48332): https://edk2.groups.io/g/devel/message/48332 Mute This Topic: https://groups.io/mt/34352433/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat Apr 27 01:21:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48333+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48333+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1569892560; cv=none; d=zoho.com; s=zohoarc; b=EyT9ElMA/dkPqXfsELnIz09lQLmPFsI5PI2YDIcD5g4wBbZgQpGaJcgaBRU+IPiQxpChV/AiKvl3DGmUIZFqDgJLjeJzTwRZfse3OBaSiozPx35T12y5XOHyVPZB9EPbPPEYf9N4kD7KJjK/9JTYGDiwLD6dTSSUJhWooE8XOIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569892560; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=LtEdSsm3xLmv23Gj7DCvLzHsBIA+O9Gd1qS2q+fhjCI=; b=T1UouQPbkdovsClRUonOe9suVaxxII8IwMQGjVZqQEY3E0DHkFA5ApLynPLRcA9PXYni1HgiGQGgMheE8bDeLJY+TQkyC+rPoNCflthL5w/6DvoFvmDXvkrco5LktyFR8WVEKUecLrHspgAoJiyFolurWIXo0CZbiSEUaU47quQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48333+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1569892560978667.9989622835038; Mon, 30 Sep 2019 18:16:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0g3GYY1788612xN4a1AZvULP; Mon, 30 Sep 2019 18:16:00 -0700 X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 30 Sep 2019 18:15:59 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 18:15:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,569,1559545200"; d="scan'208";a="203080842" X-Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga002.jf.intel.com with ESMTP; 30 Sep 2019 18:15:59 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Eric Dong , Liming Gao Subject: [edk2-devel] [edk2-platforms][PATCH V1 2/3] BoardModulePkg/FirmwareBootMediaInfoLib: Add library Date: Mon, 30 Sep 2019 18:15:46 -0700 Message-Id: <20191001011547.14588-3-michael.a.kubacki@intel.com> In-Reply-To: <20191001011547.14588-1-michael.a.kubacki@intel.com> References: <20191001011547.14588-1-michael.a.kubacki@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.a.kubacki@intel.com X-Gm-Message-State: 4i34PzyqwJTZkRY4AYGx3MB5x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1569892560; bh=JgMhkepRAAnwJ8BwdHwgmQeYFjOkFh9+3u/mtlxmcX0=; h=Cc:Date:From:Reply-To:Subject:To; b=wD2HC91Cuj/WCF4E6oUMWv1ik2M5tijsGTybaUCS2IOcGHMckoFnoW2WmH09mpT+trD Z3cWXRgaitrje7VCy1gdaoDQyIuxrWnvwIQM4SqnGte/puhyhehpgT5g/oir0qlkpA5tM SZIssD52OAWeXHulaKtxpi6rnDu0EFrXvNo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2229 Introduces a new library class FirmwareBootMediaInfoLib that is used to report the firmware boot media device. A default library instance is provided that always returns the firmware boot media is SPI flash. For platforms with other firmware boot media options, a board-specific instance of this library should be used instead to provide the correct firmware boot media device information. Cc: Eric Dong Cc: Liming Gao Signed-off-by: Michael Kubacki Reviewed-by: Eric Dong --- Platform/Intel/BoardModulePkg/BoardModulePkg.dec = | 3 ++ Platform/Intel/BoardModulePkg/BoardModulePkg.dsc = | 3 ++ Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmw= areBootMediaInfoLib.inf | 35 ++++++++++++++++++++ Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h = | 26 +++++++++++++++ Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmw= areBootMediaInfoLib.c | 24 ++++++++++++++ 5 files changed, 91 insertions(+) diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec b/Platform/In= tel/BoardModulePkg/BoardModulePkg.dec index 6f13945ca8..c42f38c32a 100644 --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec @@ -33,6 +33,9 @@ ## @libraryclass Provide services to get BIOS ID information. BiosIdLib|Include/Library/BiosIdLib.h =20 + ## @libraryclass Provide a service to determine the firmware boot me= dia device. + FirmwareBootMediaInfoLib|Include/Library/FirmwareBootMediaInfoLib.h + [Guids] ## Include Include/Guid/BiosId.h gBiosIdGuid =3D { 0xC3E36D09, 0x8294, 0x4b97, { 0xA8, 0x57, 0xD5, 0x28, = 0x8F, 0xE3, 0x3E, 0x28 } } diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc b/Platform/In= tel/BoardModulePkg/BoardModulePkg.dsc index 734ead9be8..78c09fbf82 100644 --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc @@ -33,6 +33,8 @@ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf =20 [LibraryClasses.common.PEIM] + FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFi= rmwareBootMediaLib.inf + FirmwareBootMediaInfoLib|BoardModulePkg/Library/PeiFirmwareBootMediaInfo= Lib/PeiFirmwareBootMediaInfoLib.inf HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf =20 @@ -42,6 +44,7 @@ [LibraryClasses.common.DXE_DRIVER] HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSm= mFirmwareBootMediaLib.inf =20 [LibraryClasses.common.UEFI_DRIVER] HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf diff --git a/Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfo= Lib/PeiFirmwareBootMediaInfoLib.inf b/Platform/Intel/BoardModulePkg/Library= /PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf new file mode 100644 index 0000000000..637aeca2af --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei= FirmwareBootMediaInfoLib.inf @@ -0,0 +1,35 @@ +## @file +# Firmware Boot Media Info Library +# +# This library identifies firmware boot media device information used in t= he boot flow for system initialization +# decisions dependent upon the firmware boot media. +# +# This library instance provides a default implementation of the FirmwareB= ootMediaInfoLib library class that always +# returns SPI flash as the boot media device. For any system firmware in w= hich this is not the case, an instance +# of this library class should be provided that returns the correct boot m= edia for the platform. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PeiFirmwareBootMediaInfoLib + FILE_GUID =3D 91CC29F5-AEAD-4108-9E91-C8DECDC1C654 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D FirmwareBootMediaInfoLib + +[Sources] + PeiFirmwareBootMediaInfoLib.c + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + BoardModulePkg/BoardModulePkg.dec + +[LibraryClasses] + BaseLib + FirmwareBootMediaLib diff --git a/Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMedi= aInfoLib.h b/Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMedi= aInfoLib.h new file mode 100644 index 0000000000..b08f21ac74 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi= b.h @@ -0,0 +1,26 @@ +/** @file + This library identifies the firmware boot media device. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FIRMWARE_BOOT_MEDIA_INFO_LIB_H_ +#define _FIRMWARE_BOOT_MEDIA_INFO_LIB_H_ + +#include +#include + +/** + Identifies the firmware boot media type for the current boot. + + @retval BOOT_MEDIA_TYPE The boot media type. A value of FwBootMediaTyp= eMax indicates the firmware boot media + information is unavailable. +**/ +FW_BOOT_MEDIA_TYPE +IdentifyFirmwareBootMediaType ( + VOID + ); + +#endif diff --git a/Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfo= Lib/PeiFirmwareBootMediaInfoLib.c b/Platform/Intel/BoardModulePkg/Library/P= eiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c new file mode 100644 index 0000000000..0c29d96033 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei= FirmwareBootMediaInfoLib.c @@ -0,0 +1,24 @@ +/** @file + This library identifies the firmware boot media device. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +/** + Identifies the firmware boot media type for the current boot. + + @retval BOOT_MEDIA_TYPE The boot media type. A value of FwBootMediaTyp= eMax indicates the firmware boot media + information is unavailable. +**/ +FW_BOOT_MEDIA_TYPE +IdentifyFirmwareBootMediaType ( + VOID + ) +{ + return FwBootMediaSpi; +} --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48333): https://edk2.groups.io/g/devel/message/48333 Mute This Topic: https://groups.io/mt/34352434/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat Apr 27 01:21:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48334+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48334+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1569892560; cv=none; d=zoho.com; s=zohoarc; b=iMpq9JTaloDsFSRHYnTw2jhpDXEbWnZN/8PDj8M/qxnXNj+Z1mGtRdMR5u/lMJ4YiASOIjtTssQ5aZzQIBEL6K2ymdkEAO6jV6kBjTpMhQevFAud7A0vXtZsgbtS7wURkUEWYU88WBasH2GAFNdHNry3j5DUIgRvTHLjWMKBVoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569892560; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=44gPUmrt/h17wxV0NikP7YMUbmTynthZK4+gKa56NVc=; b=Y/JnRT4wme+n1/JiFQ6eNVAu0jfE11Rn3uuPEIu+M1FHh9QWBeoDtPEz8kKZzypcvBdrLDooGfZOHTNDJmv5TVAPYndjSpjzkyTlWf7KJu9iXd9+xmFXm8gR6ZIbDziyatx5SFvm7X4DrA8mF+CaTu1wDeNhTVI8Fff5O+3ycus= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48334+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1569892560945442.3957173955422; Mon, 30 Sep 2019 18:16:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id VqvJYY1788612xlb0XYMeQPt; Mon, 30 Sep 2019 18:16:00 -0700 X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 30 Sep 2019 18:16:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 18:16:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,569,1559545200"; d="scan'208";a="203080847" X-Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga002.jf.intel.com with ESMTP; 30 Sep 2019 18:15:59 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Eric Dong , Liming Gao Subject: [edk2-devel] [edk2-platforms][PATCH V1 3/3] BoardModulePkg/FirmwareBootMediaInfoPei: Add module Date: Mon, 30 Sep 2019 18:15:47 -0700 Message-Id: <20191001011547.14588-4-michael.a.kubacki@intel.com> In-Reply-To: <20191001011547.14588-1-michael.a.kubacki@intel.com> References: <20191001011547.14588-1-michael.a.kubacki@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.a.kubacki@intel.com X-Gm-Message-State: IVoibt4PB52zB8xIzk0D3bHXx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1569892560; bh=HiNcp09tIarPda94eGyR/AHiSZOFsqHmHRIQ7LhYTGY=; h=Cc:Date:From:Reply-To:Subject:To; b=Rv0To9XiZJCYPgA3txxHLutkxoctukSxpOzsBLdgvmXdha+nJFdyWGTFyrQf72NSi4a UiPFuJTDccxEhHf0Lbal42J8bUSraBJWP2p52sgbrlzGVOIB6Xi3GLRmhYHjHWXGTTUIh xzlxLfiQ3ypcKrbhyhRGhdpCLeyzMa03jkw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2229 Adds a new module that is responsible for publishing the boot media device information that will be used in the boot flow for system initialization decisions dependent upon firmware boot media. The module depends on a library class to implement the board- specific details to get the firmware boot media device. This allows the module to remain consistent in its responsibility across implementations and the details to be easily substituted. Cc: Eric Dong Cc: Liming Gao Signed-off-by: Michael Kubacki --- Platform/Intel/BoardModulePkg/BoardModulePkg.dsc = | 2 + Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoP= ei.inf | 46 ++++++++++++ Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoP= ei.c | 76 ++++++++++++++++++++ 3 files changed, 124 insertions(+) diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc b/Platform/In= tel/BoardModulePkg/BoardModulePkg.dsc index 78c09fbf82..50bc704056 100644 --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc @@ -31,6 +31,7 @@ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf =20 [LibraryClasses.common.PEIM] FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFi= rmwareBootMediaLib.inf @@ -74,6 +75,7 @@ ##########################################################################= ######################### =20 [Components] + BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNu= ll.inf =20 diff --git a/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBo= otMediaInfoPei.inf b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/Fi= rmwareBootMediaInfoPei.inf new file mode 100644 index 0000000000..a81932f2a1 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMedia= InfoPei.inf @@ -0,0 +1,46 @@ +## @file +# Firmware Boot Media Info Module +# +# This module publishes firmware boot media device information used in the= boot flow for system initialization +# decisions dependent upon the firmware boot media. +# +# This module depends upon a library instance to actually perform firmware= boot media device detection since the +# detection mechanism will vary across systems. In many cases, the media t= ype may simply be set to a single firmware +# boot media device with no run-time logic required. In any case, this mod= ule should dispatch as early as possible in +# the system boot flow so the firmware boot media information is available= for other modules. If any dependencies are +# required to dynamically determine the firmware boot media device, those = should be in the DEPEX section of the active +# FirmwareBootMediaInfoLib such that this module will dispatch once those = dependencies are satisfied. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010017 + BASE_NAME =3D FirmwareBootMediaInfoPei + FILE_GUID =3D A8F14FA9-FC88-45F4-A622-F06E6C56E632 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D PEIM + ENTRY_POINT =3D FirmwareBootMediaInfoPeiEntry + +[LibraryClasses] + BaseLib + DebugLib + FirmwareBootMediaLib + FirmwareBootMediaInfoLib + HobLib + PeimEntryPoint + PeiServicesLib + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + BoardModulePkg/BoardModulePkg.dec + +[Sources] + FirmwareBootMediaInfoPei.c + +[Depex] + TRUE diff --git a/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBo= otMediaInfoPei.c b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/Firm= wareBootMediaInfoPei.c new file mode 100644 index 0000000000..7a71071053 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMedia= InfoPei.c @@ -0,0 +1,76 @@ +/** @file + Firmware Boot Media Info Module + + This module publishes firmware boot media device information used in the= boot flow for system initialization + decisions dependent upon the firmware boot media. + + This module depends upon a library instance to actually perform firmware= boot media device detection since the + detection mechanism will vary across systems. In many cases, the media t= ype may simply be set to a single firmware + boot media device with no run-time logic required. In any case, this mod= ule should dispatch as early as possible in + the system boot flow so the firmware boot media information is available= for other modules. If any dependencies are + required to dynamically determine the firmware boot media device, those = should be in the DEPEX section of the active + FirmwareBootMediaInfoLib such that this module will dispatch once those = dependencies are satisfied. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +/** + Produces a gFirmwareBootMediaHobGuid HOB instance. + + @retval EFI_SUCCESS The firmware boot media HOB was produced suc= cessfully. + @retval EFI_NOT_FOUND The firmware boot media device information c= ould not be found to produce the + the firmware boot media HOB. +**/ +EFI_STATUS +EFIAPI +ProduceFirmwareBootMediaHob ( + VOID + ) +{ + FW_BOOT_MEDIA_HOB_DATA FwBootMediaHobData; + + FwBootMediaHobData.BootMedia =3D IdentifyFirmwareBootMediaType (); + if (FwBootMediaHobData.BootMedia =3D=3D FwBootMediaMax) { + return EFI_NOT_FOUND; + } + + BuildGuidDataHob ( + &gFirmwareBootMediaHobGuid, + &FwBootMediaHobData, + sizeof (FW_BOOT_MEDIA_HOB_DATA) + ); + + return EFI_SUCCESS; +} + +/** + Attempts to publish the firmware boot media HOB. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS Produce the BootMedia Hob successfully. + +**/ +EFI_STATUS +EFIAPI +FirmwareBootMediaInfoPeiEntry ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + + Status =3D ProduceFirmwareBootMediaHob (); + ASSERT_EFI_ERROR (Status); + + return Status; +} --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48334): https://edk2.groups.io/g/devel/message/48334 Mute This Topic: https://groups.io/mt/34352435/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-