]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg: Add package and include headers
authorMichael Kubacki <michael.kubacki@microsoft.com>
Tue, 7 Apr 2020 18:00:28 +0000 (11:00 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds a new package to maintain Platform Runtime Mechanism (PRM)
support.

This package is intended to include generic code that provides a
common infrastructure to support PRM in firmware and a collection
of sample PRM modules that demonstrate how to use the interfaces
and other package resources to author a PRM module.

The following initial headers are included in this commit:

* Prm.h - Includes common content for PRM with no dependencies on
  other PRM header files.

* PrmContextBuffer.h - Includes definitions for PRM context buffers.

  Context buffers are standardized structures that point to various
  resources available to a PRM handler during its execution.

* PrmDataBuffer.h - Includes definitions for PRM data buffers.

  Within the context of PRM, these data buffers are composed of a
  generic header followed by a variable length blob of arbitrary
  data.

* PrmExportDescriptor.h - Includes definitions for  creating PRM
  export descriptors.

  A PRM export descriptor is a structure referenced in the export
  table of PRM module that contains PRM-specific metadata about the
  module.

* PrmMmio.h - Includes definitions for describing MMIO ranges uses
  by PRM modules.

* PrmModule.h - Includes definitions commonly used by PRM module
  authors.

  This file is provided to serve as a convenient include for PRM
  module authors.

* PrmOsServices.h - Includes content specific to PRM OS services.

  OS Services will not planned to be present in the final version
  of PRM. The OS Services have been reduced to a simple debug print
  function. So this is currently planned to be a temporary file to
  support debugging during PRM development.

Note: Modules built for the UEFI environment can be built by Visual
      Studio and non-Visual Studio toolchains. However, PRM modules
      are currently only supported on Visual Studio toolchain due to
      usage of export tables.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
PrmPkg/Include/Prm.h [new file with mode: 0644]
PrmPkg/Include/PrmContextBuffer.h [new file with mode: 0644]
PrmPkg/Include/PrmDataBuffer.h [new file with mode: 0644]
PrmPkg/Include/PrmExportDescriptor.h [new file with mode: 0644]
PrmPkg/Include/PrmMmio.h [new file with mode: 0644]
PrmPkg/Include/PrmModule.h [new file with mode: 0644]
PrmPkg/Include/PrmModuleUpdate.h [new file with mode: 0644]
PrmPkg/Include/PrmOsServices.h [new file with mode: 0644]
PrmPkg/PrmPkg.dec [new file with mode: 0644]
PrmPkg/PrmPkg.uni [new file with mode: 0644]

diff --git a/PrmPkg/Include/Prm.h b/PrmPkg/Include/Prm.h
new file mode 100644 (file)
index 0000000..0e3ccff
--- /dev/null
@@ -0,0 +1,46 @@
+/** @file\r
+\r
+  Common Platform Runtime Mechanism (PRM) definitions.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_H_\r
+#define PRM_H_\r
+\r
+#include <Uefi.h>\r
+#include <PrmContextBuffer.h>\r
+\r
+#if defined(_MSC_VER)\r
+  #define PRM_EXPORT_API                          __declspec(dllexport)\r
+#else\r
+  #define PRM_EXPORT_API\r
+#endif\r
+\r
+#define PRM_HANDLER_NAME_MAXIMUM_LENGTH           128\r
+\r
+#define PRM_STRING_(x)                            #x\r
+#define PRM_STRING(x)                             PRM_STRING_(x)\r
+\r
+/**\r
+  A Platform Runtime Mechanism (PRM) handler function.\r
+\r
+  @param[in]  ParameterBuffer             A pointer to a buffer with arbitrary data that is allocated and populated\r
+                                          by the PRM handler caller.\r
+  @param[in]  ContextBuffer               A pointer to a buffer with arbitrary data that is allocated in the firmware\r
+                                          boot environment.\r
+\r
+  @retval EFI_STATUS              The PRM handler executed successfully.\r
+  @retval Others                  An error occurred in the PRM handler.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI PRM_HANDLER) (\r
+  IN VOID                 *ParameterBuffer  OPTIONAL,\r
+  IN PRM_CONTEXT_BUFFER   *ContextBuffer  OPTIONAL\r
+  );\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmContextBuffer.h b/PrmPkg/Include/PrmContextBuffer.h
new file mode 100644 (file)
index 0000000..8f81445
--- /dev/null
@@ -0,0 +1,131 @@
+/** @file\r
+\r
+  Definitions for the Platform Runtime Mechanism (PRM) context buffer structures.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_CONTEXT_BUFFER_H_\r
+#define PRM_CONTEXT_BUFFER_H_\r
+\r
+#include <PrmDataBuffer.h>\r
+#include <PrmMmio.h>\r
+#include <Uefi.h>\r
+\r
+#define PRM_CONTEXT_BUFFER_SIGNATURE          SIGNATURE_32('P','R','M','C')\r
+#define PRM_CONTEXT_BUFFER_INTERFACE_VERSION  1\r
+\r
+#pragma pack(push, 1)\r
+\r
+//\r
+// This is the context buffer structure that is passed to a PRM handler.\r
+//\r
+// At OS runtime, the OS will allocate and populate this structure and\r
+// place virtual addresses in the pointer fields.\r
+//\r
+// It is also reused internally in FW (in the PRM_MODULE_CONTEXT_BUFFERS structure)\r
+// to track context buffers within a given PRM module. In that internal usage,\r
+// the addresses will be physical addresses.\r
+//\r
+typedef struct {\r
+  ///\r
+  /// Signature of this interface.\r
+  ///\r
+  UINT32                                  Signature;\r
+\r
+  ///\r
+  /// Version of this interface.\r
+  ///\r
+  UINT16                                  Version;\r
+\r
+  ///\r
+  /// Reserved field.\r
+  ///\r
+  UINT16                                  Reserved;\r
+\r
+  ///\r
+  /// The GUID of the PRM handler represented by this context instance.\r
+  ///\r
+  EFI_GUID                                HandlerGuid;\r
+\r
+  ///\r
+  /// A virtual address pointer to the static data buffer allocated for\r
+  /// the PRM handler represented by this context instance.\r
+  ///\r
+  /// The static buffer is intended to be populated in the PRM module\r
+  /// configuration library and treated as read-only data at OS runtime.\r
+  ///\r
+  /// This pointer may be NULL if a static data buffer is not needed.\r
+  ///\r
+  PRM_DATA_BUFFER                         *StaticDataBuffer;\r
+\r
+  ///\r
+  /// A virtual address pointer to an array of PRM_RUNTIME_MMIO_RANGE\r
+  /// structures that describe MMIO physical address ranges mapped to\r
+  /// virtual memory addresses for access at OS runtime.\r
+  ///\r
+  /// This pointer is ignored in firmware internal usage of this structure\r
+  /// as this field is present to allow a PRM handler to get the list\r
+  /// of MMIO ranges described as accessible by its PRM module.\r
+  ///\r
+  /// The module list of MMIO ranges is specified by the PRM configuration\r
+  /// code as a single array in PRM_MODULE_CONTEXT_BUFFERS.\r
+  ///\r
+  /// The OS is responsible for ensuring the pointer to the array in this\r
+  /// structure is converted to a virtual address during construction of\r
+  /// of the context buffer in the OS.\r
+  ///\r
+  /// This pointer may be NULL if runtime memory ranges are not needed.\r
+  ///\r
+  PRM_RUNTIME_MMIO_RANGES                 *RuntimeMmioRanges;\r
+} PRM_CONTEXT_BUFFER;\r
+\r
+//\r
+// A firmware internal data structure used to track context buffer and\r
+// runtime MMIO range usage across a PRM module.\r
+//\r
+typedef struct\r
+{\r
+  ///\r
+  /// The GUID of the PRM module.\r
+  ///\r
+  EFI_GUID                                ModuleGuid;\r
+\r
+  ///\r
+  /// The number of PRM context buffers in ContextBuffers[].\r
+  /// This count should equal the number of PRM handlers in the module being configured.\r
+  ///\r
+  UINTN                                   BufferCount;\r
+\r
+  ///\r
+  /// A pointer to an array of PRM context buffers\r
+  ///\r
+  PRM_CONTEXT_BUFFER                      *Buffer;\r
+\r
+  /// The MMIO ranges are defined in the firmware boot environment.\r
+  /// The addresses within the PRM_RUNTIME_MMIO_RANGES structure will\r
+  /// be converted to virtual addresses by firmware.\r
+\r
+  ///\r
+  /// A physical address pointer to an array of PRM_RUNTIME_MMIO_RANGE\r
+  /// structures that describe memory ranges that need to be mapped to\r
+  /// virtual memory addresses for access at OS runtime.\r
+  ///\r
+  /// This is a consolidated array of MMIO ranges accessed by any PRM\r
+  /// handler in the PRM module at OS runtime. The MMIO range physical\r
+  /// addresses registered here will automatically be converted to the\r
+  /// corresponding virtual address in the structure by PRM infrastructure\r
+  /// code. No action is required to convert MMIO range base physical\r
+  /// addresses to virtual addresses by either the PRM configuration code\r
+  /// or the OS.\r
+  ///\r
+  /// This pointer may be NULL if runtime memory ranges are not needed.\r
+  ///\r
+  PRM_RUNTIME_MMIO_RANGES                 *RuntimeMmioRanges;\r
+} PRM_MODULE_CONTEXT_BUFFERS;\r
+\r
+#pragma pack(pop)\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmDataBuffer.h b/PrmPkg/Include/PrmDataBuffer.h
new file mode 100644 (file)
index 0000000..70d690c
--- /dev/null
@@ -0,0 +1,50 @@
+/** @file\r
+\r
+  Definitions for the Platform Runtime Mechanism (PRM) data buffer structures.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_DATA_BUFFER_H_\r
+#define PRM_DATA_BUFFER_H_\r
+\r
+#include <Uefi.h>\r
+\r
+#define PRM_DATA_BUFFER_HEADER_SIGNATURE      SIGNATURE_32('P','R','M','D')\r
+\r
+#pragma pack(push, 1)\r
+\r
+///\r
+/// A generic header that describes the PRM data buffer.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// PRM Data Buffer signature.\r
+  ///\r
+  UINT32                                  Signature;\r
+  ///\r
+  /// Length of the entire data buffer, including the size of the header.\r
+  ///\r
+  UINT32                                  Length;\r
+} PRM_DATA_BUFFER_HEADER;\r
+\r
+///\r
+/// A PRM data buffer is a generic header followed by variable length arbitrary data.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// The header is required at the beginning of every PRM data buffer.\r
+  ///\r
+  PRM_DATA_BUFFER_HEADER                  Header;\r
+\r
+  ///\r
+  /// The beginning of data immediately follows the header.\r
+  ///\r
+  UINT8                                   Data[1];\r
+} PRM_DATA_BUFFER;\r
+\r
+#pragma pack(pop)\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmExportDescriptor.h b/PrmPkg/Include/PrmExportDescriptor.h
new file mode 100644 (file)
index 0000000..95198ce
--- /dev/null
@@ -0,0 +1,87 @@
+/** @file\r
+\r
+  Definitions for the Platform Runtime Mechanism (PRM) export descriptor structures.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_EXPORT_DESCRIPTOR_H_\r
+#define PRM_EXPORT_DESCRIPTOR_H_\r
+\r
+#include <Prm.h>\r
+\r
+#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME         PrmModuleExportDescriptor\r
+#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE    SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')\r
+#define PRM_MODULE_EXPORT_REVISION                0x0\r
+\r
+//\r
+// Platform Runtime Mechanism (PRM) Export Descriptor Structures\r
+//\r
+#pragma pack(push, 1)\r
+\r
+typedef struct {\r
+  GUID                                  PrmHandlerGuid;\r
+  CHAR8                                 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];\r
+} PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;\r
+\r
+typedef struct {\r
+  UINT64                                Signature;\r
+  UINT16                                Revision;\r
+  UINT16                                NumberPrmHandlers;\r
+  GUID                                  ModuleGuid;\r
+  PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT  PrmHandlerExportDescriptors[3];\r
+} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;\r
+\r
+#pragma pack(pop)\r
+\r
+/**\r
+  A macro that declares a PRM Handler Export Descriptor for a PRM Handler.\r
+\r
+  This macro is intended to be used once per PRM Handler to describe the handler when the\r
+  module description is defined. It should be provided as an argument to PRM_MODULE_EXPORT.\r
+\r
+  @param  Guid    The GUID of the PRM Handler being exported.\r
+\r
+  @param  Name    The name of the PRM Handler being exported. This string should exactly\r
+                  match the function name.\r
+\r
+**/\r
+#define PRM_HANDLER_EXPORT_ENTRY(Guid, Name)  \\r
+      {                                       \\r
+        Guid,                                 \\r
+        PRM_STRING_(Name)                     \\r
+      }                                       \\r
+\r
+/**\r
+  A macro that returns the count of the number of variable-length arguments given.\r
+\r
+  @param  VariableArgumentList  A variable argument list of elements that will be included\r
+                                in the return value of the list count.\r
+**/\r
+#define VA_ARG_COUNT(...)  (sizeof((PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT[]){__VA_ARGS__})/sizeof(PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT))\r
+\r
+/**\r
+  A macro that declares the PRM Module Export Descriptor for a PRM Module.\r
+\r
+  This macro is intended to be used once in a PRM Module after all of the PRM Handler definitions\r
+  to describe the PRM Handlers being exported in the module.\r
+\r
+  @param  PrmHandlerExportEntries   A variable argument list of PRM_HANDLER_EXPORT_ENTRY values.\r
+                                    This list should include all PRM Handlers being exported by\r
+                                    this module.\r
+\r
+**/\r
+#define PRM_MODULE_EXPORT(...)                                                              \\r
+  PRM_EXPORT_API PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT PRM_MODULE_EXPORT_DESCRIPTOR_NAME = {               \\r
+    {                                                                                                     \\r
+      PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE,                                                             \\r
+      PRM_MODULE_EXPORT_REVISION,                                                                         \\r
+      VA_ARG_COUNT(__VA_ARGS__),                                                                          \\r
+      EFI_CALLER_ID_GUID                                                                                  \\r
+    },                                                                                                    \\r
+    { __VA_ARGS__ }                                                                                       \\r
+  }                                                                                                       \\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmMmio.h b/PrmPkg/Include/PrmMmio.h
new file mode 100644 (file)
index 0000000..fb216c2
--- /dev/null
@@ -0,0 +1,45 @@
+/** @file\r
+\r
+  Definitions for the Platform Runtime Mechanism (PRM) MMIO elements.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_MMIO_H_\r
+#define PRM_MMIO_H_\r
+\r
+#include <Uefi.h>\r
+\r
+#pragma pack(push, 1)\r
+\r
+///\r
+/// Describes a memory range that needs to be made accessible at OS runtime.\r
+///\r
+/// The memory range with the given base address and length will be marked as EFI_MEMORY_RUNTIME.\r
+///\r
+typedef struct {\r
+  EFI_PHYSICAL_ADDRESS                    PhysicalBaseAddress;\r
+  EFI_PHYSICAL_ADDRESS                    VirtualBaseAddress;\r
+  UINT32                                  Length;\r
+} PRM_RUNTIME_MMIO_RANGE;\r
+\r
+///\r
+/// Describes a buffer with an array of PRM module\r
+/// config runtime memory ranges.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// The number of runtime memory range elements in this buffer.\r
+  ///\r
+  UINT64                                  Count;\r
+  ///\r
+  /// The beginning of the runtime memory range data.\r
+  ///\r
+  PRM_RUNTIME_MMIO_RANGE                  Range[1];\r
+} PRM_RUNTIME_MMIO_RANGES;\r
+\r
+#pragma pack(pop)\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmModule.h b/PrmPkg/Include/PrmModule.h
new file mode 100644 (file)
index 0000000..f40fb42
--- /dev/null
@@ -0,0 +1,68 @@
+/** @file\r
+\r
+  Common definitions needed for Platform Runtime Mechanism (PRM) modules.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_MODULE_H_\r
+#define PRM_MODULE_H_\r
+\r
+#include <Prm.h>\r
+#include <PrmContextBuffer.h>\r
+#include <PrmDataBuffer.h>\r
+#include <PrmExportDescriptor.h>\r
+#include <PrmMmio.h>\r
+#include <PrmModuleUpdate.h>\r
+#include <PrmOsServices.h>\r
+\r
+/**\r
+  Macro that provides a condensed form of a PRM Handler.\r
+\r
+  This macro can be used to define a PRM Handler that uses the standard PRM Handle\r
+  signature. It is simply provided for convenience.\r
+\r
+**/\r
+#define PRM_HANDLER_EXPORT(Name)                                                  \\r
+  STATIC_ASSERT (sizeof (PRM_STRING_(Name)) <= PRM_HANDLER_NAME_MAXIMUM_LENGTH, "The PRM handler exceeds the maximum allowed size of 128.");  \\r
+                                                                                  \\r
+/**                                                                               \\r
+  A Platform Runtime Mechanism (PRM) handler.                                     \\r
+                                                                                  \\r
+  @param[in]  ParameterBuffer     A pointer to the PRM handler parameter buffer   \\r
+  @param[in]  ContextBUffer       A pointer to the PRM handler context buffer     \\r
+                                                                                  \\r
+  @retval EFI_STATUS              The PRM handler executed successfully.          \\r
+  @retval Others                  An error occurred in the PRM handler.           \\r
+                                                                                  \\r
+**/                                                                               \\r
+  EFI_STATUS                                    \\r
+  PRM_EXPORT_API                                \\r
+  EFIAPI                                        \\r
+  Name (                                        \\r
+    IN VOID                 *ParameterBuffer,   \\r
+    IN PRM_CONTEXT_BUFFER   *ContextBuffer      \\r
+    )                                           \\r
+\r
+/**\r
+  A macro that declares the PRM Module Update Lock Descriptor for a PRM Module.\r
+\r
+  This macro is intended to be used once in a PRM Module so the module update lock descriptor is\r
+  exported for the module.\r
+\r
+**/\r
+#define PRM_MODULE_UPDATE_LOCK_EXPORT                                                           \\r
+  PRM_EXPORT_API PRM_MODULE_UPDATE_LOCK_DESCRIPTOR PRM_MODULE_UPDATE_LOCK_DESCRIPTOR_NAME = {   \\r
+    PRM_MODULE_UPDATE_LOCK_DESCRIPTOR_SIGNATURE,                                                \\r
+    PRM_MODULE_UPDATE_LOCK_REVISION,                                                            \\r
+    { 0 }                                                                                       \\r
+  }                                                                                             \\r
+\r
+//\r
+// A PRM module is required to export the PRM Module Update Lock\r
+//\r
+PRM_MODULE_UPDATE_LOCK_EXPORT;\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmModuleUpdate.h b/PrmPkg/Include/PrmModuleUpdate.h
new file mode 100644 (file)
index 0000000..fde97ef
--- /dev/null
@@ -0,0 +1,46 @@
+/** @file\r
+\r
+  Definition for the Platform Runtime Mechanism (PRM) module update structures.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_MODULE_UPDATE_H_\r
+#define PRM_MODULE_UPDATE_H_\r
+\r
+#include <Uefi.h>\r
+\r
+#define PRM_MODULE_UPDATE_LOCK_DESCRIPTOR_NAME        PrmModuleUpdateLock\r
+#define PRM_MODULE_UPDATE_LOCK_DESCRIPTOR_SIGNATURE   SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'U', 'L', '_')\r
+#define PRM_MODULE_UPDATE_LOCK_REVISION               0x0\r
+\r
+#pragma pack(push, 1)\r
+\r
+///\r
+/// Maintains the PRM Module Update Lock state\r
+///\r
+typedef union {\r
+  ///\r
+  /// Individual bit fields\r
+  ///\r
+  struct {\r
+    UINT8 Acquired          : 1;  ///< [0] - If 1 lock is acquired. If 0 lock is released.\r
+    UINT8 Reserved          : 7;  ///< [7:1] - Reserved\r
+  } Bits;\r
+  ///\r
+  /// All bit fields as an 8-bit value\r
+  ///\r
+  UINT8 Uint8;\r
+} PRM_MODULE_UPDATE_LOCK;\r
+\r
+typedef struct {\r
+  UINT64                                Signature;\r
+  UINT16                                Revision;\r
+  PRM_MODULE_UPDATE_LOCK                Lock;\r
+} PRM_MODULE_UPDATE_LOCK_DESCRIPTOR;\r
+\r
+#pragma pack(pop)\r
+\r
+#endif\r
diff --git a/PrmPkg/Include/PrmOsServices.h b/PrmPkg/Include/PrmOsServices.h
new file mode 100644 (file)
index 0000000..62dfa00
--- /dev/null
@@ -0,0 +1,45 @@
+/** @file\r
+\r
+  Definitions for the Platform Runtime Mechanism (PRM) OS Services.\r
+\r
+  Note: OS Services have been removed from POR. This file has been reduced to just debug print\r
+        OS Service for use during PRM enabling.\r
+\r
+  Copyright (c) Microsoft Corporation\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PRM_OS_SERVICES_H_\r
+#define PRM_OS_SERVICES_H_\r
+\r
+#include <Uefi.h>\r
+\r
+typedef struct _PRM_OS_SERVICES PRM_OS_SERVICES;\r
+\r
+//\r
+// PRM OS Services function signatures\r
+//\r
+typedef\r
+VOID\r
+(EFIAPI *PRM_OS_SERVICE_DEBUG_PRINT) (\r
+  IN  CONST CHAR8           *String\r
+  );\r
+\r
+#pragma pack(push, 1)\r
+\r
+//\r
+// PRM OS Services table\r
+//\r
+struct _PRM_OS_SERVICES {\r
+    // Structure information\r
+    UINT16                                MajorVersion;\r
+    UINT16                                MinorVersion;\r
+\r
+    // OS Services\r
+    PRM_OS_SERVICE_DEBUG_PRINT            DebugPrint;\r
+};\r
+\r
+#pragma pack(pop)\r
+\r
+#endif\r
diff --git a/PrmPkg/PrmPkg.dec b/PrmPkg/PrmPkg.dec
new file mode 100644 (file)
index 0000000..ff681d4
--- /dev/null
@@ -0,0 +1,49 @@
+## @file  PrmPkg.dec\r
+# This package provides support for the Platform Runtime Mechanism (PRM).\r
+#\r
+# The following key elements of PRM are maintained in this package:\r
+#\r
+# 1. PRM interfaces - Comprised of interfaces shared with the operating system such as ACPI table structures\r
+#                     in addition to internal firmware interfaces such as protocols and library interfaces.\r
+#\r
+# 2. PRM generic drivers - EDK II drivers that implement generic functionality such that a platform can quickly\r
+#                          and reliably adopt PRM.\r
+#\r
+# 3. PRM module - An independently updatable PE/COFF binary that conforms to the unique requirements of a PRM module.\r
+#                 PRM modules expose functions for operating system invocation referred to as PRM handlers.\r
+#\r
+# 4. PRM handler - A function in a PRM module. The function is identified through PRM interfaces in the OS by a GUID.\r
+#\r
+# Copyright (c) Microsoft Corporation<BR>\r
+## SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+\r
+[Defines]\r
+  DEC_SPECIFICATION              = 0x00010005\r
+  PACKAGE_NAME                   = PrmPkg\r
+  PACKAGE_UNI_FILE               = PrmPkg.uni\r
+  PACKAGE_GUID                   = 3D22F66E-9090-46CE-B260-1836070AFA5E\r
+  PACKAGE_VERSION                = 0.1\r
+\r
+[Includes]\r
+  Include\r
+\r
+[Guids]\r
+  gPrmPkgTokenSpaceGuid = { 0x46f56acc, 0x600b, 0x450f, { 0xa5, 0x9c, 0x3a, 0x1a, 0x4a, 0xd4, 0x35, 0x3e }}\r
+\r
+[LibraryClasses]\r
+  ## @libraryclass Provides a general abstraction for PRM context buffer management\r
+  #\r
+  PrmContextBufferLib|Include/Library/PrmContextBufferLib.h\r
+\r
+[Protocols]\r
+  ## PRM Configuration Protocol\r
+  #\r
+  gPrmConfigProtocolGuid = { 0x4e5b4fea, 0x936a, 0x45bc, { 0xac, 0x6a, 0x2f, 0x8f, 0x14, 0xa6, 0xc2, 0x9e }}\r
+\r
+[PcdsFixedAtBuild]\r
+  ## Flash base address of a PRM firmware volume\r
+  gPrmPkgTokenSpaceGuid.PcdFlashFvPrmBase|0x00000000|UINT32|0x00000001\r
+\r
+  ## Size in bytes of a PRM firmware volume\r
+  gPrmPkgTokenSpaceGuid.PcdFlashFvPrmSize|0x00000000|UINT32|0x00000002\r
diff --git a/PrmPkg/PrmPkg.uni b/PrmPkg/PrmPkg.uni
new file mode 100644 (file)
index 0000000..3575b35
--- /dev/null
@@ -0,0 +1,10 @@
+// /** @file\r
+//\r
+// Copyright (c) Microsoft Corporation\r
+// SPDX-License-Identifier: BSD-2-Clause-Patent\r
+// **/\r
+\r
+\r
+#string STR_PACKAGE_ABSTRACT            #language en-US "This package provides support for the Platform Runtime Mechanism (PRM)."\r
+\r
+#string STR_PACKAGE_DESCRIPTION         #language en-US "Provides infrastructure support code and sample PRM modules for PRM authors."\r