I'm planning to submit support for Standalone MM in SpiFlashCommonLib soon. Currently, there's quite a bit of duplication with SpiFlashCommonLib.
I would like to have this Standalone MM support be available in as consistent of a location as possible so I'd like to see if there is anything I can do to help clean this up in the early part of the patch series.
The library interface is currently defined in the following header files:
Instances of SmmSpiFlashCommonLib implementation exist in a mix of platform and silicon packages:
The library class is currently consumed in the following INFs:
My understanding is:
1. The header file is defined in each silicon package because silicon cannot depend upon platform (i.e. the MinPlatformPkg header).
2. The header is present in each silicon package because the implementation is silicon-specific and these packages cannot depend on one another.
3. The header is defined in MinPlatformPkg because MinPlatformPkg should be silicon vendor agnostic (cannot depend on the silicon packages).
4. The header is needed in MinPlatformPkg because the SpiFvbService there depends on SPI flash operations implemented in SpiFlashCommonLib.
Here's an initial proposal:
1. Consolidate the library interface into a single header. In IntelSiliconPkg?
2. Consolidate library implementation into a single instance. In IntelSiliconPkg?
3. Move SpiFvbServiceXyz out of MinPlatformPkg.
3.a. Make a "SPI flash" feature?
3.b. Allow the Intel implementation of this feature to depend on SpiFlashCommonLib defined in IntelSiliconPkg.
Intel board packages could then use the SpiFlashCommonLib from IntelSiliconPkg (a generation specific instance could be created if needed) and use the SpiFvbServiceXyz driver from the "SpiFlash" feature.
Look forward to your thoughts and feedback.