[edk2-devel] [edk2-platforms] [PATCH v4 0/4] Add Large Variable Libraries

Nate DeSimone posted 4 patches 1 week ago
Failed in applying to current master (apply log)
.../Include/Dsc/CoreCommonLib.dsc             |   6 +-
.../MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc |  12 +-
.../MinPlatformPkg/Include/Dsc/CorePeiLib.dsc |   9 +-
.../Include/Library/LargeVariableReadLib.h    |  61 +++
.../Include/Library/LargeVariableWriteLib.h   |  69 +++
.../Include/Library/VariableReadLib.h         |  94 ++++
.../Include/Library/VariableWriteLib.h        | 138 ++++++
.../BaseLargeVariableReadLib.inf              |  51 ++
.../BaseLargeVariableWriteLib.inf             |  51 ++
.../LargeVariableCommon.h                     |  47 ++
.../LargeVariableReadLib.c                    | 176 +++++++
.../LargeVariableWriteLib.c                   | 450 ++++++++++++++++++
.../DxeRuntimeVariableReadLib.c               | 117 +++++
.../DxeRuntimeVariableReadLib.inf             |  41 ++
.../DxeRuntimeVariableWriteLib.c              | 265 +++++++++++
.../DxeRuntimeVariableWriteLib.inf            |  49 ++
.../PeiVariableReadLib/PeiVariableReadLib.c   | 155 ++++++
.../PeiVariableReadLib/PeiVariableReadLib.inf |  42 ++
.../SmmVariableReadCommon.c                   | 116 +++++
.../StandaloneMmVariableReadLib.inf           |  50 ++
.../StandaloneMmVariableReadLibConstructor.c  |  51 ++
.../TraditionalMmVariableReadLib.inf          |  49 ++
.../TraditionalMmVariableReadLibConstructor.c |  51 ++
.../SmmVariableWriteCommon.c                  | 171 +++++++
.../StandaloneMmVariableWriteLib.inf          |  45 ++
.../StandaloneMmVariableWriteLibConstructor.c |  51 ++
.../TraditionalMmVariableWriteLib.inf         |  44 ++
...TraditionalMmVariableWriteLibConstructor.c |  51 ++
.../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |   4 +-
29 files changed, 2506 insertions(+), 10 deletions(-)
create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableReadLib.h
create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableWriteLib.h
create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/VariableReadLib.h
create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/VariableWriteLib.h
create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableCommon.h
create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableReadLib.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/SmmVariableReadCommon.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLibConstructor.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLibConstructor.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/SmmVariableWriteCommon.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLibConstructor.c
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLib.inf
create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLibConstructor.c

[edk2-devel] [edk2-platforms] [PATCH v4 0/4] Add Large Variable Libraries

Posted by Nate DeSimone 1 week ago
Changes from V3:
 - Added header guards
 - Documented the possibility of returning EFI_UNSUPPORTED
 - Added MM_CORE_STANDALONE to the StandaloneMm library
   implementations
 - Documented library constructor return status
 - Moved LargeVariableReadLib and LargeVariableWriteLib into
   a single BaseLargeVariableLib folder
 - Added LargeVariableCommon.h for shared macro definitions
 - Converted some debug macros from DEBUG_INFO to DEBUG_VERBOSE

Changes from V2:
 - Added comment to LargeVariableLib INF and header files
   describing the usage for drivers that cannot assume that
   PcdMaxVariableSize has been set to a certain minimum value.

Changes from V1:
 - Changed prefix from "Min" to "VarLib"
 - Better comments
 - Added more whitespace for readability
 - Removed unused INF sections
 - Better debug messages

This patch series introduces libaries that enable large data sets
to be stored using the UEFI Variable Services. At present, most
UEFI Variable Services implementations have a maximum variable
size of <=64KB. The exact value varies depending on platform.

These libaries enable a data set to use as much space as needed,
up to the remaining space in the UEFI Variable non-volatile storage.

To implement this, I have broken the problem down into two parts:

 1. Phase angostic UEFI Variable access.
 2. Storage of data across multiple UEFI Variables.

For the first part, I have created two new LibraryClasses:
VariableReadLib and VariableWriteLib. I have provided
implementation instances of VariableReadLib for PEI, DXE, and SMM.
For VariableWriteLib, I have provided implementation instances for
DXE and SMM. This enables code that accesses UEFI variables
to be written in a matter than is phase agnostic, so the same
code can be used in PEI, DXE, or SMM without modification.

The second part involves another two new LibaryClasses:
LargeVariableReadLib and LargeVariableWriteLib. Only one BASE
implementation is needed for both of these as the phase dependent
code was seperated out in the first piece. These libraries provide
logic to calculate the maximum size of an individual UEFI variable
and split the data into as many smaller pieces as needed to store
the entire data set in the UEFI Variable storage. They also provide
the ability to stitch the data back together when it is read.
Deleting the data will delete all variables used to store it.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

Nate DeSimone (4):
  MinPlatformPkg: Add VariableReadLib
  MinPlatformPkg: Add VariableWriteLib
  MinPlatformPkg: Add LargeVariableReadLib
  MinPlatformPkg: Add LargeVariableWriteLib

 .../Include/Dsc/CoreCommonLib.dsc             |   6 +-
 .../MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc |  12 +-
 .../MinPlatformPkg/Include/Dsc/CorePeiLib.dsc |   9 +-
 .../Include/Library/LargeVariableReadLib.h    |  61 +++
 .../Include/Library/LargeVariableWriteLib.h   |  69 +++
 .../Include/Library/VariableReadLib.h         |  94 ++++
 .../Include/Library/VariableWriteLib.h        | 138 ++++++
 .../BaseLargeVariableReadLib.inf              |  51 ++
 .../BaseLargeVariableWriteLib.inf             |  51 ++
 .../LargeVariableCommon.h                     |  47 ++
 .../LargeVariableReadLib.c                    | 176 +++++++
 .../LargeVariableWriteLib.c                   | 450 ++++++++++++++++++
 .../DxeRuntimeVariableReadLib.c               | 117 +++++
 .../DxeRuntimeVariableReadLib.inf             |  41 ++
 .../DxeRuntimeVariableWriteLib.c              | 265 +++++++++++
 .../DxeRuntimeVariableWriteLib.inf            |  49 ++
 .../PeiVariableReadLib/PeiVariableReadLib.c   | 155 ++++++
 .../PeiVariableReadLib/PeiVariableReadLib.inf |  42 ++
 .../SmmVariableReadCommon.c                   | 116 +++++
 .../StandaloneMmVariableReadLib.inf           |  50 ++
 .../StandaloneMmVariableReadLibConstructor.c  |  51 ++
 .../TraditionalMmVariableReadLib.inf          |  49 ++
 .../TraditionalMmVariableReadLibConstructor.c |  51 ++
 .../SmmVariableWriteCommon.c                  | 171 +++++++
 .../StandaloneMmVariableWriteLib.inf          |  45 ++
 .../StandaloneMmVariableWriteLibConstructor.c |  51 ++
 .../TraditionalMmVariableWriteLib.inf         |  44 ++
 ...TraditionalMmVariableWriteLibConstructor.c |  51 ++
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |   4 +-
 29 files changed, 2506 insertions(+), 10 deletions(-)
 create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableReadLib.h
 create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableWriteLib.h
 create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/VariableReadLib.h
 create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/VariableWriteLib.h
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableCommon.h
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableReadLib.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/SmmVariableReadCommon.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLibConstructor.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLibConstructor.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/SmmVariableWriteCommon.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLibConstructor.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLib.inf
 create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLibConstructor.c

-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73759): https://edk2.groups.io/g/devel/message/73759
Mute This Topic: https://groups.io/mt/81907531/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 v4 0/4] Add Large Variable Libraries

Posted by Chiu, Chasel 1 week ago
Change looks good to me, just one comment, would you also add new library class into MinPlatformPkg.dec file for reference?

Thanks,
Chasel


> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Sent: Wednesday, April 7, 2021 11:04 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>; Michael
> Kubacki <michael.kubacki@microsoft.com>; Oram, Isaac W
> <isaac.w.oram@intel.com>
> Subject: [edk2-platforms] [PATCH v4 0/4] Add Large Variable Libraries
> 
> Changes from V3:
>  - Added header guards
>  - Documented the possibility of returning EFI_UNSUPPORTED
>  - Added MM_CORE_STANDALONE to the StandaloneMm library
>    implementations
>  - Documented library constructor return status
>  - Moved LargeVariableReadLib and LargeVariableWriteLib into
>    a single BaseLargeVariableLib folder
>  - Added LargeVariableCommon.h for shared macro definitions
>  - Converted some debug macros from DEBUG_INFO to DEBUG_VERBOSE
> 
> Changes from V2:
>  - Added comment to LargeVariableLib INF and header files
>    describing the usage for drivers that cannot assume that
>    PcdMaxVariableSize has been set to a certain minimum value.
> 
> Changes from V1:
>  - Changed prefix from "Min" to "VarLib"
>  - Better comments
>  - Added more whitespace for readability
>  - Removed unused INF sections
>  - Better debug messages
> 
> This patch series introduces libaries that enable large data sets to be stored
> using the UEFI Variable Services. At present, most UEFI Variable Services
> implementations have a maximum variable size of <=64KB. The exact value
> varies depending on platform.
> 
> These libaries enable a data set to use as much space as needed, up to the
> remaining space in the UEFI Variable non-volatile storage.
> 
> To implement this, I have broken the problem down into two parts:
> 
>  1. Phase angostic UEFI Variable access.
>  2. Storage of data across multiple UEFI Variables.
> 
> For the first part, I have created two new LibraryClasses:
> VariableReadLib and VariableWriteLib. I have provided implementation instances
> of VariableReadLib for PEI, DXE, and SMM.
> For VariableWriteLib, I have provided implementation instances for DXE and
> SMM. This enables code that accesses UEFI variables to be written in a matter
> than is phase agnostic, so the same code can be used in PEI, DXE, or SMM
> without modification.
> 
> The second part involves another two new LibaryClasses:
> LargeVariableReadLib and LargeVariableWriteLib. Only one BASE
> implementation is needed for both of these as the phase dependent code was
> seperated out in the first piece. These libraries provide logic to calculate the
> maximum size of an individual UEFI variable and split the data into as many
> smaller pieces as needed to store the entire data set in the UEFI Variable storage.
> They also provide the ability to stitch the data back together when it is read.
> Deleting the data will delete all variables used to store it.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> 
> Nate DeSimone (4):
>   MinPlatformPkg: Add VariableReadLib
>   MinPlatformPkg: Add VariableWriteLib
>   MinPlatformPkg: Add LargeVariableReadLib
>   MinPlatformPkg: Add LargeVariableWriteLib
> 
>  .../Include/Dsc/CoreCommonLib.dsc             |   6 +-
>  .../MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc |  12 +-
>  .../MinPlatformPkg/Include/Dsc/CorePeiLib.dsc |   9 +-
>  .../Include/Library/LargeVariableReadLib.h    |  61 +++
>  .../Include/Library/LargeVariableWriteLib.h   |  69 +++
>  .../Include/Library/VariableReadLib.h         |  94 ++++
>  .../Include/Library/VariableWriteLib.h        | 138 ++++++
>  .../BaseLargeVariableReadLib.inf              |  51 ++
>  .../BaseLargeVariableWriteLib.inf             |  51 ++
>  .../LargeVariableCommon.h                     |  47 ++
>  .../LargeVariableReadLib.c                    | 176 +++++++
>  .../LargeVariableWriteLib.c                   | 450 ++++++++++++++++++
>  .../DxeRuntimeVariableReadLib.c               | 117 +++++
>  .../DxeRuntimeVariableReadLib.inf             |  41 ++
>  .../DxeRuntimeVariableWriteLib.c              | 265 +++++++++++
>  .../DxeRuntimeVariableWriteLib.inf            |  49 ++
>  .../PeiVariableReadLib/PeiVariableReadLib.c   | 155 ++++++
>  .../PeiVariableReadLib/PeiVariableReadLib.inf |  42 ++
>  .../SmmVariableReadCommon.c                   | 116 +++++
>  .../StandaloneMmVariableReadLib.inf           |  50 ++
>  .../StandaloneMmVariableReadLibConstructor.c  |  51 ++
>  .../TraditionalMmVariableReadLib.inf          |  49 ++
>  .../TraditionalMmVariableReadLibConstructor.c |  51 ++
>  .../SmmVariableWriteCommon.c                  | 171 +++++++
>  .../StandaloneMmVariableWriteLib.inf          |  45 ++
>  .../StandaloneMmVariableWriteLibConstructor.c |  51 ++
>  .../TraditionalMmVariableWriteLib.inf         |  44 ++
>  ...TraditionalMmVariableWriteLibConstructor.c |  51 ++
>  .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |   4 +-
>  29 files changed, 2506 insertions(+), 10 deletions(-)  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableReadLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableWriteLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/VariableReadLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/VariableWriteLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariabl
> eReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariabl
> eWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableCo
> mmon.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableRea
> dLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWri
> teLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntim
> eVariableReadLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntim
> eVariableReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRunti
> meVariableWriteLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRunti
> meVariableWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.
> c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.
> inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/SmmVariableRead
> Common.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVa
> riableReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVa
> riableReadLibConstructor.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVar
> iableReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVar
> iableReadLibConstructor.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/SmmVariableWrit
> eCommon.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVa
> riableWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVa
> riableWriteLibConstructor.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVa
> riableWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVa
> riableWriteLibConstructor.c
> 
> --
> 2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73761): https://edk2.groups.io/g/devel/message/73761
Mute This Topic: https://groups.io/mt/81907531/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 v4 0/4] Add Large Variable Libraries

Posted by Nate DeSimone 6 days, 13 hours ago
Hi Chasel,

Good catch! I'll added the new LibraryClasses to MinPlatformPkg.dec in patch series V5.

Thanks,
Nate

-----Original Message-----
From: Chiu, Chasel <chasel.chiu@intel.com> 
Sent: Tuesday, April 6, 2021 10:01 PM
To: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>; Michael Kubacki <michael.kubacki@microsoft.com>; Oram, Isaac W <isaac.w.oram@intel.com>
Subject: RE: [edk2-platforms] [PATCH v4 0/4] Add Large Variable Libraries


Change looks good to me, just one comment, would you also add new library class into MinPlatformPkg.dec file for reference?

Thanks,
Chasel


> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Sent: Wednesday, April 7, 2021 11:04 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Liming Gao 
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>; Michael 
> Kubacki <michael.kubacki@microsoft.com>; Oram, Isaac W 
> <isaac.w.oram@intel.com>
> Subject: [edk2-platforms] [PATCH v4 0/4] Add Large Variable Libraries
> 
> Changes from V3:
>  - Added header guards
>  - Documented the possibility of returning EFI_UNSUPPORTED
>  - Added MM_CORE_STANDALONE to the StandaloneMm library
>    implementations
>  - Documented library constructor return status
>  - Moved LargeVariableReadLib and LargeVariableWriteLib into
>    a single BaseLargeVariableLib folder
>  - Added LargeVariableCommon.h for shared macro definitions
>  - Converted some debug macros from DEBUG_INFO to DEBUG_VERBOSE
> 
> Changes from V2:
>  - Added comment to LargeVariableLib INF and header files
>    describing the usage for drivers that cannot assume that
>    PcdMaxVariableSize has been set to a certain minimum value.
> 
> Changes from V1:
>  - Changed prefix from "Min" to "VarLib"
>  - Better comments
>  - Added more whitespace for readability
>  - Removed unused INF sections
>  - Better debug messages
> 
> This patch series introduces libaries that enable large data sets to 
> be stored using the UEFI Variable Services. At present, most UEFI 
> Variable Services implementations have a maximum variable size of 
> <=64KB. The exact value varies depending on platform.
> 
> These libaries enable a data set to use as much space as needed, up to 
> the remaining space in the UEFI Variable non-volatile storage.
> 
> To implement this, I have broken the problem down into two parts:
> 
>  1. Phase angostic UEFI Variable access.
>  2. Storage of data across multiple UEFI Variables.
> 
> For the first part, I have created two new LibraryClasses:
> VariableReadLib and VariableWriteLib. I have provided implementation 
> instances of VariableReadLib for PEI, DXE, and SMM.
> For VariableWriteLib, I have provided implementation instances for DXE 
> and SMM. This enables code that accesses UEFI variables to be written 
> in a matter than is phase agnostic, so the same code can be used in 
> PEI, DXE, or SMM without modification.
> 
> The second part involves another two new LibaryClasses:
> LargeVariableReadLib and LargeVariableWriteLib. Only one BASE 
> implementation is needed for both of these as the phase dependent code 
> was seperated out in the first piece. These libraries provide logic to 
> calculate the maximum size of an individual UEFI variable and split 
> the data into as many smaller pieces as needed to store the entire data set in the UEFI Variable storage.
> They also provide the ability to stitch the data back together when it is read.
> Deleting the data will delete all variables used to store it.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> 
> Nate DeSimone (4):
>   MinPlatformPkg: Add VariableReadLib
>   MinPlatformPkg: Add VariableWriteLib
>   MinPlatformPkg: Add LargeVariableReadLib
>   MinPlatformPkg: Add LargeVariableWriteLib
> 
>  .../Include/Dsc/CoreCommonLib.dsc             |   6 +-
>  .../MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc |  12 +-
>  .../MinPlatformPkg/Include/Dsc/CorePeiLib.dsc |   9 +-
>  .../Include/Library/LargeVariableReadLib.h    |  61 +++
>  .../Include/Library/LargeVariableWriteLib.h   |  69 +++
>  .../Include/Library/VariableReadLib.h         |  94 ++++
>  .../Include/Library/VariableWriteLib.h        | 138 ++++++
>  .../BaseLargeVariableReadLib.inf              |  51 ++
>  .../BaseLargeVariableWriteLib.inf             |  51 ++
>  .../LargeVariableCommon.h                     |  47 ++
>  .../LargeVariableReadLib.c                    | 176 +++++++
>  .../LargeVariableWriteLib.c                   | 450 ++++++++++++++++++
>  .../DxeRuntimeVariableReadLib.c               | 117 +++++
>  .../DxeRuntimeVariableReadLib.inf             |  41 ++
>  .../DxeRuntimeVariableWriteLib.c              | 265 +++++++++++
>  .../DxeRuntimeVariableWriteLib.inf            |  49 ++
>  .../PeiVariableReadLib/PeiVariableReadLib.c   | 155 ++++++
>  .../PeiVariableReadLib/PeiVariableReadLib.inf |  42 ++
>  .../SmmVariableReadCommon.c                   | 116 +++++
>  .../StandaloneMmVariableReadLib.inf           |  50 ++
>  .../StandaloneMmVariableReadLibConstructor.c  |  51 ++
>  .../TraditionalMmVariableReadLib.inf          |  49 ++
>  .../TraditionalMmVariableReadLibConstructor.c |  51 ++
>  .../SmmVariableWriteCommon.c                  | 171 +++++++
>  .../StandaloneMmVariableWriteLib.inf          |  45 ++
>  .../StandaloneMmVariableWriteLibConstructor.c |  51 ++
>  .../TraditionalMmVariableWriteLib.inf         |  44 ++
>  ...TraditionalMmVariableWriteLibConstructor.c |  51 ++
>  .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |   4 +-
>  29 files changed, 2506 insertions(+), 10 deletions(-)  create mode 
> 100644 
> Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableReadLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableWriteLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/VariableReadLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Include/Library/VariableWriteLib.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVa
> riabl
> eReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVa
> riabl
> eWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariab
> leCo
> mmon.h
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariab
> leRea
> dLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariab
> leWri
> teLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRun
> tim
> eVariableReadLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRun
> tim
> eVariableReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRu
> nti
> meVariableWriteLib.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRu
> nti
> meVariableWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.
> c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.
> inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/SmmVariableRe
> ad
> Common.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmV
> a
> riableReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmV
> a
> riableReadLibConstructor.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMm
> Var
> iableReadLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMm
> Var
> iableReadLibConstructor.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/SmmVariableW
> rit
> eCommon.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMm
> Va
> riableWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMm
> Va
> riableWriteLibConstructor.c
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalM
> mVa
> riableWriteLib.inf
>  create mode 100644
> Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalM
> mVa
> riableWriteLibConstructor.c
> 
> --
> 2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73794): https://edk2.groups.io/g/devel/message/73794
Mute This Topic: https://groups.io/mt/81907531/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 v4 0/4] Add Large Variable Libraries

Posted by Michael Kubacki 1 week ago
For the series:
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>

On 4/6/2021 8:04 PM, Nate DeSimone wrote:
> Changes from V3:
>   - Added header guards
>   - Documented the possibility of returning EFI_UNSUPPORTED
>   - Added MM_CORE_STANDALONE to the StandaloneMm library
>     implementations
>   - Documented library constructor return status
>   - Moved LargeVariableReadLib and LargeVariableWriteLib into
>     a single BaseLargeVariableLib folder
>   - Added LargeVariableCommon.h for shared macro definitions
>   - Converted some debug macros from DEBUG_INFO to DEBUG_VERBOSE
> 
> Changes from V2:
>   - Added comment to LargeVariableLib INF and header files
>     describing the usage for drivers that cannot assume that
>     PcdMaxVariableSize has been set to a certain minimum value.
> 
> Changes from V1:
>   - Changed prefix from "Min" to "VarLib"
>   - Better comments
>   - Added more whitespace for readability
>   - Removed unused INF sections
>   - Better debug messages
> 
> This patch series introduces libaries that enable large data sets
> to be stored using the UEFI Variable Services. At present, most
> UEFI Variable Services implementations have a maximum variable
> size of <=64KB. The exact value varies depending on platform.
> 
> These libaries enable a data set to use as much space as needed,
> up to the remaining space in the UEFI Variable non-volatile storage.
> 
> To implement this, I have broken the problem down into two parts:
> 
>   1. Phase angostic UEFI Variable access.
>   2. Storage of data across multiple UEFI Variables.
> 
> For the first part, I have created two new LibraryClasses:
> VariableReadLib and VariableWriteLib. I have provided
> implementation instances of VariableReadLib for PEI, DXE, and SMM.
> For VariableWriteLib, I have provided implementation instances for
> DXE and SMM. This enables code that accesses UEFI variables
> to be written in a matter than is phase agnostic, so the same
> code can be used in PEI, DXE, or SMM without modification.
> 
> The second part involves another two new LibaryClasses:
> LargeVariableReadLib and LargeVariableWriteLib. Only one BASE
> implementation is needed for both of these as the phase dependent
> code was seperated out in the first piece. These libraries provide
> logic to calculate the maximum size of an individual UEFI variable
> and split the data into as many smaller pieces as needed to store
> the entire data set in the UEFI Variable storage. They also provide
> the ability to stitch the data back together when it is read.
> Deleting the data will delete all variables used to store it.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> 
> Nate DeSimone (4):
>    MinPlatformPkg: Add VariableReadLib
>    MinPlatformPkg: Add VariableWriteLib
>    MinPlatformPkg: Add LargeVariableReadLib
>    MinPlatformPkg: Add LargeVariableWriteLib
> 
>   .../Include/Dsc/CoreCommonLib.dsc             |   6 +-
>   .../MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc |  12 +-
>   .../MinPlatformPkg/Include/Dsc/CorePeiLib.dsc |   9 +-
>   .../Include/Library/LargeVariableReadLib.h    |  61 +++
>   .../Include/Library/LargeVariableWriteLib.h   |  69 +++
>   .../Include/Library/VariableReadLib.h         |  94 ++++
>   .../Include/Library/VariableWriteLib.h        | 138 ++++++
>   .../BaseLargeVariableReadLib.inf              |  51 ++
>   .../BaseLargeVariableWriteLib.inf             |  51 ++
>   .../LargeVariableCommon.h                     |  47 ++
>   .../LargeVariableReadLib.c                    | 176 +++++++
>   .../LargeVariableWriteLib.c                   | 450 ++++++++++++++++++
>   .../DxeRuntimeVariableReadLib.c               | 117 +++++
>   .../DxeRuntimeVariableReadLib.inf             |  41 ++
>   .../DxeRuntimeVariableWriteLib.c              | 265 +++++++++++
>   .../DxeRuntimeVariableWriteLib.inf            |  49 ++
>   .../PeiVariableReadLib/PeiVariableReadLib.c   | 155 ++++++
>   .../PeiVariableReadLib/PeiVariableReadLib.inf |  42 ++
>   .../SmmVariableReadCommon.c                   | 116 +++++
>   .../StandaloneMmVariableReadLib.inf           |  50 ++
>   .../StandaloneMmVariableReadLibConstructor.c  |  51 ++
>   .../TraditionalMmVariableReadLib.inf          |  49 ++
>   .../TraditionalMmVariableReadLibConstructor.c |  51 ++
>   .../SmmVariableWriteCommon.c                  | 171 +++++++
>   .../StandaloneMmVariableWriteLib.inf          |  45 ++
>   .../StandaloneMmVariableWriteLibConstructor.c |  51 ++
>   .../TraditionalMmVariableWriteLib.inf         |  44 ++
>   ...TraditionalMmVariableWriteLibConstructor.c |  51 ++
>   .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |   4 +-
>   29 files changed, 2506 insertions(+), 10 deletions(-)
>   create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableReadLib.h
>   create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/LargeVariableWriteLib.h
>   create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/VariableReadLib.h
>   create mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/VariableWriteLib.h
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableCommon.h
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableReadLib.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/SmmVariableReadCommon.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLibConstructor.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLibConstructor.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/SmmVariableWriteCommon.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLibConstructor.c
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLib.inf
>   create mode 100644 Platform/Intel/MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteLibConstructor.c
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73760): https://edk2.groups.io/g/devel/message/73760
Mute This Topic: https://groups.io/mt/81907531/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-