[edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator

Kubacki, Michael A posted 3 patches 4 years, 5 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
Platform/Intel/BoardModulePkg/BoardModulePkg.dec                                                  |   3 +
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4 +-
Platform/Intel/BoardModulePkg/BoardModulePkg.dsc                                                  |   5 +
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4 +-
Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf                  |  46 +++++++++
Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf |  35 +++++++
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf        |  43 ++++++++
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf           |  38 +++++++
Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h                          |  26 +++++
Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h                              | 106 +++++++++++++++++++
Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c                    |  76 ++++++++++++++
Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c   |  24 +++++
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.c          | 107 +++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMediaLib.c                | 109 ++++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.c             |  82 +++++++++++++++
15 files changed, 706 insertions(+), 2 deletions(-)
create mode 100644 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf
create mode 100644 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf
create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf
create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf
create mode 100644 Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h
create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
create mode 100644 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c
create mode 100644 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c
create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.c
create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMediaLib.c
create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.c
[edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator
Posted by Kubacki, Michael A 4 years, 5 months ago
This patch series introduces a mechanism for determining the firmware
boot media device. This allows the firmware boot media to be discovered
through a standardized API.

Traditionally, most systems have only supported firmware storage on SPI
flash. Presently, several other storage technologies are being used to
store boot system firmware such as eMMC, UFS, and NVMe.

The API for all board, platform, and silicon code to consume the
firmware boot media device is provided by the FirmwareBootMediaLib
in IntelSiliconPkg.

A driver (FirmwareBootMediaInfoPei) is added to BoardModulePkg to
serve as a consistent location for reporting the firmware boot device
information. In order to abstract the potentially hardware-specific
details to determine the boot media (for platforms that support
multiple firmware boot media devices), the driver retrieves the
boot media information using a new library class introduced called
FirmwareBootMediaInfoLib. A default instance of this library class
is provided in BoardModulePkg that always returns SPI flash. This
is intended to serve as a default implementation of the library for
the most common scenario and to easily allow a board package to
substitute the logic required to determine the boot media in more
complex scenarios. Ultimately, FirmwareBootMediaInfoPei produces a
HOB containing the firmware boot media device information so it can
be used in the HOB consumer phase.

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>

Michael Kubacki (3):
  IntelSiliconPkg/FirmwareBootMediaLib: Add library
  BoardModulePkg/FirmwareBootMediaInfoLib: Add library
  BoardModulePkg/FirmwareBootMediaInfoPei: Add module

 Platform/Intel/BoardModulePkg/BoardModulePkg.dec                                                  |   3 +
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4 +-
 Platform/Intel/BoardModulePkg/BoardModulePkg.dsc                                                  |   5 +
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4 +-
 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf                  |  46 +++++++++
 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf |  35 +++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf        |  43 ++++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf           |  38 +++++++
 Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h                          |  26 +++++
 Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h                              | 106 +++++++++++++++++++
 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c                    |  76 ++++++++++++++
 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c   |  24 +++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.c          | 107 +++++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMediaLib.c                | 109 ++++++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.c             |  82 +++++++++++++++
 15 files changed, 706 insertions(+), 2 deletions(-)
 create mode 100644 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf
 create mode 100644 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
 create mode 100644 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c
 create mode 100644 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMediaLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.c

-- 
2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48331): https://edk2.groups.io/g/devel/message/48331
Mute This Topic: https://groups.io/mt/34352432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator
Posted by Chaganty, Rangasai V 4 years, 5 months ago
I am not sure if there is a silicon scope around the FirmwareBootMediaLib. Have we considered adding this interface to MdePkg, instead?

-----Original Message-----
From: Kubacki, Michael A 
Sent: Monday, September 30, 2019 6:16 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator

This patch series introduces a mechanism for determining the firmware boot media device. This allows the firmware boot media to be discovered through a standardized API.

Traditionally, most systems have only supported firmware storage on SPI flash. Presently, several other storage technologies are being used to store boot system firmware such as eMMC, UFS, and NVMe.

The API for all board, platform, and silicon code to consume the firmware boot media device is provided by the FirmwareBootMediaLib in IntelSiliconPkg.

A driver (FirmwareBootMediaInfoPei) is added to BoardModulePkg to serve as a consistent location for reporting the firmware boot device information. In order to abstract the potentially hardware-specific details to determine the boot media (for platforms that support multiple firmware boot media devices), the driver retrieves the boot media information using a new library class introduced called FirmwareBootMediaInfoLib. A default instance of this library class is provided in BoardModulePkg that always returns SPI flash. This is intended to serve as a default implementation of the library for the most common scenario and to easily allow a board package to substitute the logic required to determine the boot media in more complex scenarios. Ultimately, FirmwareBootMediaInfoPei produces a HOB containing the firmware boot media device information so it can be used in the HOB consumer phase.

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>

Michael Kubacki (3):
  IntelSiliconPkg/FirmwareBootMediaLib: Add library
  BoardModulePkg/FirmwareBootMediaInfoLib: Add library
  BoardModulePkg/FirmwareBootMediaInfoPei: Add module

 Platform/Intel/BoardModulePkg/BoardModulePkg.dec                                                  |   3 +
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4 +-
 Platform/Intel/BoardModulePkg/BoardModulePkg.dsc                                                  |   5 +
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4 +-
 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf                  |  46 +++++++++
 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf |  35 +++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf        |  43 ++++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf           |  38 +++++++
 Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h                          |  26 +++++
 Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h                              | 106 +++++++++++++++++++
 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c                    |  76 ++++++++++++++
 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c   |  24 +++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.c          | 107 +++++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMediaLib.c                | 109 ++++++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.c             |  82 +++++++++++++++
 15 files changed, 706 insertions(+), 2 deletions(-)  create mode 100644 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf
 create mode 100644 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.inf
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLib.h
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
 create mode 100644 Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c
 create mode 100644 Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/PeiFirmwareBootMediaInfoLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBootMediaLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.c

--
2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48404): https://edk2.groups.io/g/devel/message/48404
Mute This Topic: https://groups.io/mt/34352432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator
Posted by Kubacki, Michael A 4 years, 5 months ago
In platforms built for boot media other than SPI flash there has been a compelling
need for silicon and platform code to be aware of the firmware boot media but
apart from the UEFI variable driver (which is a special case being addressed
here - https://github.com/makubacki/edk2/tree/storage_agnostic_uefi_variables),
this has not been the case for edk2 repository packages. In some cases, code in SEC
has made assumptions about the reset vector or FIT pointer that do not necessarily
translate to storage media that does not support MMIO. These cases have been
handled more gracefully than checking the firmware boot media technology. This is
just an observation, not necessarily a case for it to stay in IntelSiliconPkg (which
does make it accessible to Intel silicon and platform code).

I suppose the firmware boot media properties could be treated in a similar manner
to Boot Mode as defined in the Platform Initialization spec. If this was done, it may
make more sense to abstract the technology impact onto firmware, for example,
whether it supports MMIO or not (NOR vs NAND flash) instead of what is defined
here with specific technologies such as eMMC and UFS. Otherwise, the specification
describing this would be subject to constant expansion over time keeping pace with
new technologies and cross-generation code (not silicon or platform specific drivers)
may base conditionals on something like eMMC when its algorithm really applies to
all NAND media (which, again, has been the proven observation thus far outside
silicon and platform code).

With that said, I see the firmware boot technology details being more pertinent to
silicon and platform code so that's why this change is made now. It can immediately
address existing needs for these details in silicon and platform code.  Some form of
the firmware boot media details in a more generic package could be useful but it
will likely not align closely with the scope of information needed at this level and is
an undertaking, that in my opinion, is separate but compatible with the work done here.

> -----Original Message-----
> From: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>
> Sent: Wednesday, October 2, 2019 4:03 PM
> To: Kubacki, Michael A <michael.a.kubacki@intel.com>;
> devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>;
> Ni, Ray <ray.ni@intel.com>
> Subject: RE: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
> Indicator
> 
> I am not sure if there is a silicon scope around the FirmwareBootMediaLib.
> Have we considered adding this interface to MdePkg, instead?
> 
> -----Original Message-----
> From: Kubacki, Michael A
> Sent: Monday, September 30, 2019 6:16 PM
> To: devel@edk2.groups.io
> Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Ni, Ray
> <ray.ni@intel.com>
> Subject: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
> Indicator
> 
> This patch series introduces a mechanism for determining the firmware boot
> media device. This allows the firmware boot media to be discovered through
> a standardized API.
> 
> Traditionally, most systems have only supported firmware storage on SPI
> flash. Presently, several other storage technologies are being used to store
> boot system firmware such as eMMC, UFS, and NVMe.
> 
> The API for all board, platform, and silicon code to consume the firmware
> boot media device is provided by the FirmwareBootMediaLib in
> IntelSiliconPkg.
> 
> A driver (FirmwareBootMediaInfoPei) is added to BoardModulePkg to serve
> as a consistent location for reporting the firmware boot device information.
> In order to abstract the potentially hardware-specific details to determine
> the boot media (for platforms that support multiple firmware boot media
> devices), the driver retrieves the boot media information using a new library
> class introduced called FirmwareBootMediaInfoLib. A default instance of this
> library class is provided in BoardModulePkg that always returns SPI flash. This
> is intended to serve as a default implementation of the library for the most
> common scenario and to easily allow a board package to substitute the logic
> required to determine the boot media in more complex scenarios.
> Ultimately, FirmwareBootMediaInfoPei produces a HOB containing the
> firmware boot media device information so it can be used in the HOB
> consumer phase.
> 
> Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
> 
> Michael Kubacki (3):
>   IntelSiliconPkg/FirmwareBootMediaLib: Add library
>   BoardModulePkg/FirmwareBootMediaInfoLib: Add library
>   BoardModulePkg/FirmwareBootMediaInfoPei: Add module
> 
>  Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> |   3 +
>  Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4
> +-
>  Platform/Intel/BoardModulePkg/BoardModulePkg.dsc
> |   5 +
>  Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4
> +-
> 
> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
> diaInfoPei.inf                  |  46 +++++++++
> 
> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
> FirmwareBootMediaInfoLib.inf |  35 +++++++
> 
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
> wareBootMediaLib.inf        |  43 ++++++++
> 
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
> ootMediaLib.inf           |  38 +++++++
> 
> Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
> b.h                          |  26 +++++
>  Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
> | 106 +++++++++++++++++++
> 
> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
> diaInfoPei.c                    |  76 ++++++++++++++
> 
> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
> FirmwareBootMediaInfoLib.c   |  24 +++++
> 
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
> wareBootMediaLib.c          | 107 +++++++++++++++++++
> 
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
> tMediaLib.c                | 109 ++++++++++++++++++++
> 
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
> ootMediaLib.c             |  82 +++++++++++++++
>  15 files changed, 706 insertions(+), 2 deletions(-)  create mode 100644
> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
> diaInfoPei.inf
>  create mode 100644
> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
> FirmwareBootMediaInfoLib.inf
>  create mode 100644
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
> wareBootMediaLib.inf
>  create mode 100644
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
> ootMediaLib.inf
>  create mode 100644
> Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
> b.h
>  create mode 100644
> Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
>  create mode 100644
> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
> diaInfoPei.c
>  create mode 100644
> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
> FirmwareBootMediaInfoLib.c
>  create mode 100644
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
> wareBootMediaLib.c
>  create mode 100644
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
> tMediaLib.c
>  create mode 100644
> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
> ootMediaLib.c
> 
> --
> 2.16.2.windows.1
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48406): https://edk2.groups.io/g/devel/message/48406
Mute This Topic: https://groups.io/mt/34352432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator
Posted by Andrew Fish via Groups.Io 4 years, 5 months ago
Since I was around back in the Intel Tiano days and I've worked on all the PI specs I can share the history. 

The reset vector is a hardware thing. It is usually at the top or bottom of the address space. For x86 it is at the TOP of the ROM and that is why the FV has a VoluteTop file GUID that places the file at the end of the FV, thus the end of that file is the reset vector. If the reset vector is low then the FV header starts with a 16 byte ZeroVector that can contain the reset jump instruction. The other architecture that is out there is a mask ROM, and the mask ROM is the reset vector, and that code hands off to the 2nd level, and sometimes that can be in DRAM or ROM. 

The PI FVs (Firmware Volumes) are abstracted by Firmware Volume Blocks (FVB) the FVB instances abstract the storage media for the firmware. Thus from a PI spec point of view there is not need to define the storage type of the "ROM". That is just an implementation detail, that needs to be managed by the implementation. 

If you think about in UEFI disk are abstracted by the Block IO protocol. We can boot an OS from any Block device, and the firmware does not need to know what kind of disk it is. The purpose of the Block IO protocol is to abstract all possible implementations o block devices. For the "Boot ROM", FVB is the same kind of abstraction. So you can implement PI with out knowing the media type. Managing the media type was is a platform abstraction, thus there is no need for a boot media abstraction in the MdePkg. 

That being said the PI architecture is abstract to a fault. It was designed to abstract all possible future platforms. If there are a family of platforms that share common properties it makes sense to build a platform abstraction package that a set of platforms can share. This is the intent of the PI architecture and the EDKII source base. 

The MdePkg implements the UEFI and PI specs, and other industry standards, with some common libs thrown in. So the MdePkg is not the place to put some implementation hint about the Media Device. You could use a GUIDed HOB for that if needed?

Thanks,

Andrew Fish

> On Oct 2, 2019, at 8:02 PM, Kubacki, Michael A <michael.a.kubacki@intel.com> wrote:
> 
> In platforms built for boot media other than SPI flash there has been a compelling
> need for silicon and platform code to be aware of the firmware boot media but
> apart from the UEFI variable driver (which is a special case being addressed
> here - https://github.com/makubacki/edk2/tree/storage_agnostic_uefi_variables <https://github.com/makubacki/edk2/tree/storage_agnostic_uefi_variables>),
> this has not been the case for edk2 repository packages. In some cases, code in SEC
> has made assumptions about the reset vector or FIT pointer that do not necessarily
> translate to storage media that does not support MMIO. These cases have been
> handled more gracefully than checking the firmware boot media technology. This is
> just an observation, not necessarily a case for it to stay in IntelSiliconPkg (which
> does make it accessible to Intel silicon and platform code).
> 
> I suppose the firmware boot media properties could be treated in a similar manner
> to Boot Mode as defined in the Platform Initialization spec. If this was done, it may
> make more sense to abstract the technology impact onto firmware, for example,
> whether it supports MMIO or not (NOR vs NAND flash) instead of what is defined
> here with specific technologies such as eMMC and UFS. Otherwise, the specification
> describing this would be subject to constant expansion over time keeping pace with
> new technologies and cross-generation code (not silicon or platform specific drivers)
> may base conditionals on something like eMMC when its algorithm really applies to
> all NAND media (which, again, has been the proven observation thus far outside
> silicon and platform code).
> 
> With that said, I see the firmware boot technology details being more pertinent to
> silicon and platform code so that's why this change is made now. It can immediately
> address existing needs for these details in silicon and platform code.  Some form of
> the firmware boot media details in a more generic package could be useful but it
> will likely not align closely with the scope of information needed at this level and is
> an undertaking, that in my opinion, is separate but compatible with the work done here.
> 
>> -----Original Message-----
>> From: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com <mailto:rangasai.v.chaganty@intel.com>>
>> Sent: Wednesday, October 2, 2019 4:03 PM
>> To: Kubacki, Michael A <michael.a.kubacki@intel.com <mailto:michael.a.kubacki@intel.com>>;
>> devel@edk2.groups.io <mailto:devel@edk2.groups.io>
>> Cc: Dong, Eric <eric.dong@intel.com <mailto:eric.dong@intel.com>>; Gao, Liming <liming.gao@intel.com <mailto:liming.gao@intel.com>>;
>> Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com>>
>> Subject: RE: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
>> Indicator
>> 
>> I am not sure if there is a silicon scope around the FirmwareBootMediaLib.
>> Have we considered adding this interface to MdePkg, instead?
>> 
>> -----Original Message-----
>> From: Kubacki, Michael A
>> Sent: Monday, September 30, 2019 6:16 PM
>> To: devel@edk2.groups.io
>> Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Dong, Eric
>> <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Ni, Ray
>> <ray.ni@intel.com>
>> Subject: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
>> Indicator
>> 
>> This patch series introduces a mechanism for determining the firmware boot
>> media device. This allows the firmware boot media to be discovered through
>> a standardized API.
>> 
>> Traditionally, most systems have only supported firmware storage on SPI
>> flash. Presently, several other storage technologies are being used to store
>> boot system firmware such as eMMC, UFS, and NVMe.
>> 
>> The API for all board, platform, and silicon code to consume the firmware
>> boot media device is provided by the FirmwareBootMediaLib in
>> IntelSiliconPkg.
>> 
>> A driver (FirmwareBootMediaInfoPei) is added to BoardModulePkg to serve
>> as a consistent location for reporting the firmware boot device information.
>> In order to abstract the potentially hardware-specific details to determine
>> the boot media (for platforms that support multiple firmware boot media
>> devices), the driver retrieves the boot media information using a new library
>> class introduced called FirmwareBootMediaInfoLib. A default instance of this
>> library class is provided in BoardModulePkg that always returns SPI flash. This
>> is intended to serve as a default implementation of the library for the most
>> common scenario and to easily allow a board package to substitute the logic
>> required to determine the boot media in more complex scenarios.
>> Ultimately, FirmwareBootMediaInfoPei produces a HOB containing the
>> firmware boot media device information so it can be used in the HOB
>> consumer phase.
>> 
>> Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
>> 
>> Michael Kubacki (3):
>>  IntelSiliconPkg/FirmwareBootMediaLib: Add library
>>  BoardModulePkg/FirmwareBootMediaInfoLib: Add library
>>  BoardModulePkg/FirmwareBootMediaInfoPei: Add module
>> 
>> Platform/Intel/BoardModulePkg/BoardModulePkg.dec
>> |   3 +
>> Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4
>> +-
>> Platform/Intel/BoardModulePkg/BoardModulePkg.dsc
>> |   5 +
>> Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4
>> +-
>> 
>> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
>> diaInfoPei.inf                  |  46 +++++++++
>> 
>> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
>> FirmwareBootMediaInfoLib.inf |  35 +++++++
>> 
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
>> wareBootMediaLib.inf        |  43 ++++++++
>> 
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
>> ootMediaLib.inf           |  38 +++++++
>> 
>> Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
>> b.h                          |  26 +++++
>> Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
>> | 106 +++++++++++++++++++
>> 
>> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
>> diaInfoPei.c                    |  76 ++++++++++++++
>> 
>> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
>> FirmwareBootMediaInfoLib.c   |  24 +++++
>> 
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
>> wareBootMediaLib.c          | 107 +++++++++++++++++++
>> 
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
>> tMediaLib.c                | 109 ++++++++++++++++++++
>> 
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
>> ootMediaLib.c             |  82 +++++++++++++++
>> 15 files changed, 706 insertions(+), 2 deletions(-)  create mode 100644
>> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
>> diaInfoPei.inf
>> create mode 100644
>> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
>> FirmwareBootMediaInfoLib.inf
>> create mode 100644
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
>> wareBootMediaLib.inf
>> create mode 100644
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
>> ootMediaLib.inf
>> create mode 100644
>> Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
>> b.h
>> create mode 100644
>> Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
>> create mode 100644
>> Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
>> diaInfoPei.c
>> create mode 100644
>> Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
>> FirmwareBootMediaInfoLib.c
>> create mode 100644
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
>> wareBootMediaLib.c
>> create mode 100644
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
>> tMediaLib.c
>> create mode 100644
>> Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
>> ootMediaLib.c
>> 
>> --
>> 2.16.2.windows.1
>> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48410): https://edk2.groups.io/g/devel/message/48410
Mute This Topic: https://groups.io/mt/34352432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator
Posted by Kubacki, Michael A 4 years, 5 months ago
Thanks for sharing. You articulated well why I also don't think this is required in MdePkg. My
description of the reset vector problem was kind of incomplete. While the x86 reset vector
is fixed at the top of the address space, that does not mean that a FV has to be mapped to it
(or any SPI flash based content). SEC has made that assumption. For example, the top
address space could be mapped to another random access memory with x86 instructions.
In this case, assumptions previously made in SecCore such as calculating the BFV size as follows are invalid:
  SecCoreData.BootFirmwareVolumeSize = (UINTN)(0x100000000ULL - (UINTN) BootFirmwareVolume);

In a system with NAND media, the BFV could be located in CAR at a base of 4GB-xKB/MB with
execution entry via a jump from the code at top of memory. In this particular case, the FvLength
field can more reliably determine the FV size.

These patches use a GUIDed HOB. It just hides that detail behind a function API largely added
for convenience so firmware boot media consumers do not need to handle the HOB related logic.

Thanks,
Michael

From: afish@apple.com <afish@apple.com>
Sent: Wednesday, October 2, 2019 9:20 PM
To: devel@edk2.groups.io; Kubacki, Michael A <michael.a.kubacki@intel.com>
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator

Since I was around back in the Intel Tiano days and I've worked on all the PI specs I can share the history.

The reset vector is a hardware thing. It is usually at the top or bottom of the address space. For x86 it is at the TOP of the ROM and that is why the FV has a VoluteTop file GUID that places the file at the end of the FV, thus the end of that file is the reset vector. If the reset vector is low then the FV header starts with a 16 byte ZeroVector that can contain the reset jump instruction. The other architecture that is out there is a mask ROM, and the mask ROM is the reset vector, and that code hands off to the 2nd level, and sometimes that can be in DRAM or ROM.

The PI FVs (Firmware Volumes) are abstracted by Firmware Volume Blocks (FVB) the FVB instances abstract the storage media for the firmware. Thus from a PI spec point of view there is not need to define the storage type of the "ROM". That is just an implementation detail, that needs to be managed by the implementation.

If you think about in UEFI disk are abstracted by the Block IO protocol. We can boot an OS from any Block device, and the firmware does not need to know what kind of disk it is. The purpose of the Block IO protocol is to abstract all possible implementations o block devices. For the "Boot ROM", FVB is the same kind of abstraction. So you can implement PI with out knowing the media type. Managing the media type was is a platform abstraction, thus there is no need for a boot media abstraction in the MdePkg.

That being said the PI architecture is abstract to a fault. It was designed to abstract all possible future platforms. If there are a family of platforms that share common properties it makes sense to build a platform abstraction package that a set of platforms can share. This is the intent of the PI architecture and the EDKII source base.

The MdePkg implements the UEFI and PI specs, and other industry standards, with some common libs thrown in. So the MdePkg is not the place to put some implementation hint about the Media Device. You could use a GUIDed HOB for that if needed?

Thanks,

Andrew Fish


On Oct 2, 2019, at 8:02 PM, Kubacki, Michael A <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>> wrote:

In platforms built for boot media other than SPI flash there has been a compelling
need for silicon and platform code to be aware of the firmware boot media but
apart from the UEFI variable driver (which is a special case being addressed
here - https://github.com/makubacki/edk2/tree/storage_agnostic_uefi_variables),
this has not been the case for edk2 repository packages. In some cases, code in SEC
has made assumptions about the reset vector or FIT pointer that do not necessarily
translate to storage media that does not support MMIO. These cases have been
handled more gracefully than checking the firmware boot media technology. This is
just an observation, not necessarily a case for it to stay in IntelSiliconPkg (which
does make it accessible to Intel silicon and platform code).

I suppose the firmware boot media properties could be treated in a similar manner
to Boot Mode as defined in the Platform Initialization spec. If this was done, it may
make more sense to abstract the technology impact onto firmware, for example,
whether it supports MMIO or not (NOR vs NAND flash) instead of what is defined
here with specific technologies such as eMMC and UFS. Otherwise, the specification
describing this would be subject to constant expansion over time keeping pace with
new technologies and cross-generation code (not silicon or platform specific drivers)
may base conditionals on something like eMMC when its algorithm really applies to
all NAND media (which, again, has been the proven observation thus far outside
silicon and platform code).

With that said, I see the firmware boot technology details being more pertinent to
silicon and platform code so that's why this change is made now. It can immediately
address existing needs for these details in silicon and platform code.  Some form of
the firmware boot media details in a more generic package could be useful but it
will likely not align closely with the scope of information needed at this level and is
an undertaking, that in my opinion, is separate but compatible with the work done here.


-----Original Message-----
From: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>
Sent: Wednesday, October 2, 2019 4:03 PM
To: Kubacki, Michael A <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>>;
devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Dong, Eric <eric.dong@intel.com<mailto:eric.dong@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>;
Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Subject: RE: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
Indicator

I am not sure if there is a silicon scope around the FirmwareBootMediaLib.
Have we considered adding this interface to MdePkg, instead?

-----Original Message-----
From: Kubacki, Michael A
Sent: Monday, September 30, 2019 6:16 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>; Dong, Eric
<eric.dong@intel.com<mailto:eric.dong@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Ni, Ray
<ray.ni@intel.com<mailto:ray.ni@intel.com>>
Subject: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
Indicator

This patch series introduces a mechanism for determining the firmware boot
media device. This allows the firmware boot media to be discovered through
a standardized API.

Traditionally, most systems have only supported firmware storage on SPI
flash. Presently, several other storage technologies are being used to store
boot system firmware such as eMMC, UFS, and NVMe.

The API for all board, platform, and silicon code to consume the firmware
boot media device is provided by the FirmwareBootMediaLib in
IntelSiliconPkg.

A driver (FirmwareBootMediaInfoPei) is added to BoardModulePkg to serve
as a consistent location for reporting the firmware boot device information.
In order to abstract the potentially hardware-specific details to determine
the boot media (for platforms that support multiple firmware boot media
devices), the driver retrieves the boot media information using a new library
class introduced called FirmwareBootMediaInfoLib. A default instance of this
library class is provided in BoardModulePkg that always returns SPI flash. This
is intended to serve as a default implementation of the library for the most
common scenario and to easily allow a board package to substitute the logic
required to determine the boot media in more complex scenarios.
Ultimately, FirmwareBootMediaInfoPei produces a HOB containing the
firmware boot media device information so it can be used in the HOB
consumer phase.

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>
Cc: Eric Dong <eric.dong@intel.com<mailto:eric.dong@intel.com>>
Cc: Liming Gao <liming.gao@intel.com<mailto:liming.gao@intel.com>>
Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>>

Michael Kubacki (3):
 IntelSiliconPkg/FirmwareBootMediaLib: Add library
 BoardModulePkg/FirmwareBootMediaInfoLib: Add library
 BoardModulePkg/FirmwareBootMediaInfoPei: Add module

Platform/Intel/BoardModulePkg/BoardModulePkg.dec
|   3 +
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4
+-
Platform/Intel/BoardModulePkg/BoardModulePkg.dsc
|   5 +
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4
+-

Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.inf                  |  46 +++++++++

Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.inf |  35 +++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.inf        |  43 ++++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.inf           |  38 +++++++

Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
b.h                          |  26 +++++
Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
| 106 +++++++++++++++++++

Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.c                    |  76 ++++++++++++++

Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.c   |  24 +++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.c          | 107 +++++++++++++++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
tMediaLib.c                | 109 ++++++++++++++++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.c             |  82 +++++++++++++++
15 files changed, 706 insertions(+), 2 deletions(-)  create mode 100644
Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.inf
create mode 100644
Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.inf
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.inf
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.inf
create mode 100644
Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
b.h
create mode 100644
Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
create mode 100644
Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.c
create mode 100644
Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.c
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.c
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
tMediaLib.c
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.c

--
2.16.2.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48412): https://edk2.groups.io/g/devel/message/48412
Mute This Topic: https://groups.io/mt/34352432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator
Posted by Chaganty, Rangasai V 4 years, 5 months ago
Thank you both for sharing the background and justification on why this should not be part of MdePkg.
In general, it appeared we could locate a PPI that provides Boot Media (similar to how EFI_SEC_PLATFORM_INFORMATION2_PPI is located to know information gathered in SEC phase into PEI) or a guided HOB produced by the Platform code.
This patch series choses the latter option which is simpler implementation and serves the needs of silicon and platform code for a non- SPI boot media scenario.

Regards,
Sai

From: Kubacki, Michael A
Sent: Thursday, October 03, 2019 12:55 AM
To: afish@apple.com; devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: RE: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator

Thanks for sharing. You articulated well why I also don't think this is required in MdePkg. My
description of the reset vector problem was kind of incomplete. While the x86 reset vector
is fixed at the top of the address space, that does not mean that a FV has to be mapped to it
(or any SPI flash based content). SEC has made that assumption. For example, the top
address space could be mapped to another random access memory with x86 instructions.
In this case, assumptions previously made in SecCore such as calculating the BFV size as follows are invalid:
  SecCoreData.BootFirmwareVolumeSize = (UINTN)(0x100000000ULL - (UINTN) BootFirmwareVolume);

In a system with NAND media, the BFV could be located in CAR at a base of 4GB-xKB/MB with
execution entry via a jump from the code at top of memory. In this particular case, the FvLength
field can more reliably determine the FV size.

These patches use a GUIDed HOB. It just hides that detail behind a function API largely added
for convenience so firmware boot media consumers do not need to handle the HOB related logic.

Thanks,
Michael

From: afish@apple.com<mailto:afish@apple.com> <afish@apple.com<mailto:afish@apple.com>>
Sent: Wednesday, October 2, 2019 9:20 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Kubacki, Michael A <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>>
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>; Dong, Eric <eric.dong@intel.com<mailto:eric.dong@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device Indicator

Since I was around back in the Intel Tiano days and I've worked on all the PI specs I can share the history.

The reset vector is a hardware thing. It is usually at the top or bottom of the address space. For x86 it is at the TOP of the ROM and that is why the FV has a VoluteTop file GUID that places the file at the end of the FV, thus the end of that file is the reset vector. If the reset vector is low then the FV header starts with a 16 byte ZeroVector that can contain the reset jump instruction. The other architecture that is out there is a mask ROM, and the mask ROM is the reset vector, and that code hands off to the 2nd level, and sometimes that can be in DRAM or ROM.

The PI FVs (Firmware Volumes) are abstracted by Firmware Volume Blocks (FVB) the FVB instances abstract the storage media for the firmware. Thus from a PI spec point of view there is not need to define the storage type of the "ROM". That is just an implementation detail, that needs to be managed by the implementation.

If you think about in UEFI disk are abstracted by the Block IO protocol. We can boot an OS from any Block device, and the firmware does not need to know what kind of disk it is. The purpose of the Block IO protocol is to abstract all possible implementations o block devices. For the "Boot ROM", FVB is the same kind of abstraction. So you can implement PI with out knowing the media type. Managing the media type was is a platform abstraction, thus there is no need for a boot media abstraction in the MdePkg.

That being said the PI architecture is abstract to a fault. It was designed to abstract all possible future platforms. If there are a family of platforms that share common properties it makes sense to build a platform abstraction package that a set of platforms can share. This is the intent of the PI architecture and the EDKII source base.

The MdePkg implements the UEFI and PI specs, and other industry standards, with some common libs thrown in. So the MdePkg is not the place to put some implementation hint about the Media Device. You could use a GUIDed HOB for that if needed?

Thanks,

Andrew Fish

On Oct 2, 2019, at 8:02 PM, Kubacki, Michael A <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>> wrote:

In platforms built for boot media other than SPI flash there has been a compelling
need for silicon and platform code to be aware of the firmware boot media but
apart from the UEFI variable driver (which is a special case being addressed
here - https://github.com/makubacki/edk2/tree/storage_agnostic_uefi_variables),
this has not been the case for edk2 repository packages. In some cases, code in SEC
has made assumptions about the reset vector or FIT pointer that do not necessarily
translate to storage media that does not support MMIO. These cases have been
handled more gracefully than checking the firmware boot media technology. This is
just an observation, not necessarily a case for it to stay in IntelSiliconPkg (which
does make it accessible to Intel silicon and platform code).

I suppose the firmware boot media properties could be treated in a similar manner
to Boot Mode as defined in the Platform Initialization spec. If this was done, it may
make more sense to abstract the technology impact onto firmware, for example,
whether it supports MMIO or not (NOR vs NAND flash) instead of what is defined
here with specific technologies such as eMMC and UFS. Otherwise, the specification
describing this would be subject to constant expansion over time keeping pace with
new technologies and cross-generation code (not silicon or platform specific drivers)
may base conditionals on something like eMMC when its algorithm really applies to
all NAND media (which, again, has been the proven observation thus far outside
silicon and platform code).

With that said, I see the firmware boot technology details being more pertinent to
silicon and platform code so that's why this change is made now. It can immediately
address existing needs for these details in silicon and platform code.  Some form of
the firmware boot media details in a more generic package could be useful but it
will likely not align closely with the scope of information needed at this level and is
an undertaking, that in my opinion, is separate but compatible with the work done here.

-----Original Message-----
From: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>
Sent: Wednesday, October 2, 2019 4:03 PM
To: Kubacki, Michael A <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>>;
devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Dong, Eric <eric.dong@intel.com<mailto:eric.dong@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>;
Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Subject: RE: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
Indicator

I am not sure if there is a silicon scope around the FirmwareBootMediaLib.
Have we considered adding this interface to MdePkg, instead?

-----Original Message-----
From: Kubacki, Michael A
Sent: Monday, September 30, 2019 6:16 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>; Dong, Eric
<eric.dong@intel.com<mailto:eric.dong@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Ni, Ray
<ray.ni@intel.com<mailto:ray.ni@intel.com>>
Subject: [edk2-platforms][PATCH V1 0/3] Add FW Boot Media Device
Indicator

This patch series introduces a mechanism for determining the firmware boot
media device. This allows the firmware boot media to be discovered through
a standardized API.

Traditionally, most systems have only supported firmware storage on SPI
flash. Presently, several other storage technologies are being used to store
boot system firmware such as eMMC, UFS, and NVMe.

The API for all board, platform, and silicon code to consume the firmware
boot media device is provided by the FirmwareBootMediaLib in
IntelSiliconPkg.

A driver (FirmwareBootMediaInfoPei) is added to BoardModulePkg to serve
as a consistent location for reporting the firmware boot device information.
In order to abstract the potentially hardware-specific details to determine
the boot media (for platforms that support multiple firmware boot media
devices), the driver retrieves the boot media information using a new library
class introduced called FirmwareBootMediaInfoLib. A default instance of this
library class is provided in BoardModulePkg that always returns SPI flash. This
is intended to serve as a default implementation of the library for the most
common scenario and to easily allow a board package to substitute the logic
required to determine the boot media in more complex scenarios.
Ultimately, FirmwareBootMediaInfoPei produces a HOB containing the
firmware boot media device information so it can be used in the HOB
consumer phase.

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com<mailto:rangasai.v.chaganty@intel.com>>
Cc: Eric Dong <eric.dong@intel.com<mailto:eric.dong@intel.com>>
Cc: Liming Gao <liming.gao@intel.com<mailto:liming.gao@intel.com>>
Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com<mailto:michael.a.kubacki@intel.com>>

Michael Kubacki (3):
 IntelSiliconPkg/FirmwareBootMediaLib: Add library
 BoardModulePkg/FirmwareBootMediaInfoLib: Add library
 BoardModulePkg/FirmwareBootMediaInfoPei: Add module

Platform/Intel/BoardModulePkg/BoardModulePkg.dec
|   3 +
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                                                 |   4
+-
Platform/Intel/BoardModulePkg/BoardModulePkg.dsc
|   5 +
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                                                 |   4
+-

Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.inf                  |  46 +++++++++

Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.inf |  35 +++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.inf        |  43 ++++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.inf           |  38 +++++++

Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
b.h                          |  26 +++++
Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
| 106 +++++++++++++++++++

Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.c                    |  76 ++++++++++++++

Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.c   |  24 +++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.c          | 107 +++++++++++++++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
tMediaLib.c                | 109 ++++++++++++++++++++

Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.c             |  82 +++++++++++++++
15 files changed, 706 insertions(+), 2 deletions(-)  create mode 100644
Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.inf
create mode 100644
Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.inf
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.inf
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.inf
create mode 100644
Platform/Intel/BoardModulePkg/Include/Library/FirmwareBootMediaInfoLi
b.h
create mode 100644
Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h
create mode 100644
Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe
diaInfoPei.c
create mode 100644
Platform/Intel/BoardModulePkg/Library/PeiFirmwareBootMediaInfoLib/Pei
FirmwareBootMediaInfoLib.c
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm
wareBootMediaLib.c
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo
tMediaLib.c
create mode 100644
Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB
ootMediaLib.c

--
2.16.2.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48500): https://edk2.groups.io/g/devel/message/48500
Mute This Topic: https://groups.io/mt/34352432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-