From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.41073.1617529294169250305 for ; Sun, 04 Apr 2021 02:41:34 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: nathaniel.l.desimone@intel.com) IronPort-SDR: 7RM5VEfjxqpZ7xc1LE8uWhjTNlq2KFcIZl6MxPihEp/CaGmH2EqE+aEiixH78fMHCk+aHr8BCH vlUgJ3l7OXcA== X-IronPort-AV: E=McAfee;i="6000,8403,9943"; a="172133869" X-IronPort-AV: E=Sophos;i="5.81,304,1610438400"; d="scan'208";a="172133869" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2021 02:41:33 -0700 IronPort-SDR: y4Ew9geAWKiq6m7V9DAiDYK2ESpUsKK3EebecF+aiLRBelNDSsxKqNXcLhIudxy7S826nCWn4v 338hHfALvNfA== X-IronPort-AV: E=Sophos;i="5.81,304,1610438400"; d="scan'208";a="420334759" Received: from nldesimo-desk1.amr.corp.intel.com ([10.212.146.162]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2021 02:41:33 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu , Liming Gao , Eric Dong , Michael Kubacki , Isaac Oram Subject: [edk2-platforms] [PATCH v2 0/4] Add Large Variable Libraries Date: Sun, 4 Apr 2021 02:40:35 -0700 Message-Id: <20210404094039.2701-1-nathaniel.l.desimone@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Liming Gao Cc: Eric Dong Cc: Michael Kubacki Cc: Isaac Oram Signed-off-by: Nate DeSimone 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 | 50 ++ .../Include/Library/LargeVariableWriteLib.h | 58 +++ .../Include/Library/VariableReadLib.h | 87 ++++ .../Include/Library/VariableWriteLib.h | 129 +++++ .../BaseLargeVariableReadLib.inf | 44 ++ .../LargeVariableReadLib.c | 199 ++++++++ .../BaseLargeVariableWriteLib.inf | 44 ++ .../LargeVariableWriteLib.c | 479 ++++++++++++++++++ .../DxeRuntimeVariableReadLib.c | 115 +++++ .../DxeRuntimeVariableReadLib.inf | 41 ++ .../DxeRuntimeVariableWriteLib.c | 256 ++++++++++ .../DxeRuntimeVariableWriteLib.inf | 49 ++ .../PeiVariableReadLib/PeiVariableReadLib.c | 153 ++++++ .../PeiVariableReadLib/PeiVariableReadLib.inf | 42 ++ .../SmmVariableReadCommon.c | 114 +++++ .../StandaloneMmVariableReadLib.inf | 50 ++ .../StandaloneMmVariableReadLibConstructor.c | 48 ++ .../TraditionalMmVariableReadLib.inf | 49 ++ .../TraditionalMmVariableReadLibConstructor.c | 48 ++ .../SmmVariableWriteCommon.c | 167 ++++++ .../StandaloneMmVariableWriteLib.inf | 45 ++ .../StandaloneMmVariableWriteLibConstructor.c | 48 ++ .../TraditionalMmVariableWriteLib.inf | 44 ++ ...TraditionalMmVariableWriteLibConstructor.c | 48 ++ .../Intel/MinPlatformPkg/MinPlatformPkg.dsc | 4 +- 28 files changed, 2428 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/BaseLargeVariableReadLib/BaseLargeVariableReadLib.inf create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableReadLib/LargeVariableReadLib.c create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableWriteLib/BaseLargeVariableWriteLib.inf create mode 100644 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableWriteLib/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