public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Kubacki" <mikuback@linux.microsoft.com>
To: devel@edk2.groups.io
Cc: Andrew Fish <afish@apple.com>, Kang Gao <kang.gao@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Michael Kubacki <michael.kubacki@microsoft.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Benjamin You <benjamin.you@intel.com>,
	Liu Yun <yun.y.liu@intel.com>,
	Ankit Sinha <ankit.sinha@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>
Subject: [PATCH v1 24/41] PrmPkg/Samples/Readme.md: Add initial file
Date: Tue, 22 Mar 2022 12:19:30 -0400	[thread overview]
Message-ID: <20220322161947.9319-25-mikuback@linux.microsoft.com> (raw)
In-Reply-To: <20220322161947.9319-1-mikuback@linux.microsoft.com>

From: Michael Kubacki <michael.kubacki@microsoft.com>

Adds a Readme.md file for the Samples to help a user get started
building and using the PRM sample modules.

Includes a reference to the Samples/Readme.md file in the top-level
file to help make the reader aware the file exists.

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>
---
 PrmPkg/Readme.md         |   5 +-
 PrmPkg/Samples/Readme.md | 263 ++++++++++++++++++++
 2 files changed, 267 insertions(+), 1 deletion(-)

diff --git a/PrmPkg/Readme.md b/PrmPkg/Readme.md
index 52b44a95ddbc..b79cb66c4790 100644
--- a/PrmPkg/Readme.md
+++ b/PrmPkg/Readme.md
@@ -9,7 +9,7 @@ The `PrmPkg` maintained in this branch provides a single cohesive set of generic
 to be leveraged by platform firmware with minimal overhead to integrate PRM functionality in the firmware.
 
 ## **IMPORTANT NOTE**
-> The code provided  in this package and branch are for proof-of-concept purposes only. The code does not represent a
+> The code provided in this package and branch are for proof-of-concept purposes only. The code does not represent a
 formal design and is not validated at product quality. The development of this feature is shared in the edk2-staging
 branch to simplify collaboration by allowing direct code contributions and early feedback throughout its development.
 
@@ -120,6 +120,9 @@ prevent the package from being used as-is should be addressed directly in PrmPkg
 
 ## PRM Module
 
+> __*Note*__: You can find simple examples of PRM modules in the Samples directory of this package.
+> [Samples/Readme.md](PrmPkg/Samples/Readme.md) has more information.
+
 By default, the EDK II implementation of UEFI does not allow images with the subsystem type
 IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER to be built with exports. 
 
diff --git a/PrmPkg/Samples/Readme.md b/PrmPkg/Samples/Readme.md
new file mode 100644
index 000000000000..4926be243018
--- /dev/null
+++ b/PrmPkg/Samples/Readme.md
@@ -0,0 +1,263 @@
+# **Platform Runtime Mechanism Sample Modules**
+
+The PRM module samples provided here serve as focused examples of how to perform various tasks in a PRM module. The
+samples can also be used to verify the basic infrastructure needed in your firmware implementation is working as
+expected by checking that the sample modules are found properly and the handlers perform their tasks as noted.
+
+## **IMPORTANT NOTE**
+> The sample modules have currently only been tested on the Visual Studio compiler tool chain. Sample module
+build may fail on other tool chains. A future work item is to enable broader build support.
+
+## How to Build PRM Sample Modules
+The sample modules are built as part of the normal `PrmPkg` build so you can follow the
+[package build instructions](../../Readme.md#how-to-build-prmpkg) and then find the PRM sample binaries in your
+workspace build output directory. For example, if your build workspace is called "edk2" and you build
+64-bit binaries on the Visual Studio 2017 tool chain, your sample module binaries will be in the following
+location: \
+``edk2/Build/Prm/DEBUG_VS2017/X64/PrmPkg/Samples``
+
+### Build an Individual PRM Sample Module
+Note that the build command does provide the option to build a specific module in a package which can result in
+faster build time. If you would like to just build a single PRM module that can be done by specifying the path to
+the module INF file with the "-m" argument to `build`. For example, this command builds 32-bit and 64-bit binaries
+with Visual Studio 2019: \
+``build -p PrmPkg/PrmPkg.dsc -m PrmPkg/Samples/PrmSamplePrintModule/PrmSamplePrintModule.inf -a IA32 -a X64 -t VS2019``
+
+## PRM Sample Module User's Guide
+
+The following table provides an overview of each sample module provided. By nature, different PRM handlers have
+different requirements. The information here is summarized for a user to understand how to use a given sample
+PRM handler along with GUID/name information to identify the sample PRM modules and their PRM handlers.
+
+It is recommended that all PRM authors write a similar set of documentation for their users to better understand
+and interact with their PRM modules.
+
+---
+### Module: PRM Sample Print Module
+>* Name: `PrmSamplePrintModule`
+>* GUID: `1652b3c2-a7a1-46ac-af93-dd6dee446669`
+> * Purpose:
+>   * Simplest PRM module example
+>   * Example of a PRM module with multiple PRM handlers
+
+**Handlers:**
+#### Handler: PRM Handler 1
+* Name: `PrmHandler1`
+* GUID: `d5f2ad5f-a347-4d3e-87bc-c2ce63029cc8`
+* Actions:
+  * Use an OS-provided function pointer (pointer at the beginning of the parameter buffer) to write the message
+    “PRM1 handler sample message!”
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  ```c
+  typedef struct {
+
+    PRM_OS_SERVICE_DEBUG_PRINT *
+
+  } SAMPLE_OSDEBUGPRINT_PARAMETER_BUFFER;
+  ```
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+#### Handler: PRM Handler 2
+* Name: `PrmHandler2`
+* GUID: `a9e7adc3-8cd0-429a-8915-10946ebde318`
+* Actions:
+  * Use an OS-provided function pointer (pointer at the beginning of the parameter buffer) to write the message
+    “PRM2 handler sample message!”
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  ```c
+  typedef struct {
+
+    PRM_OS_SERVICE_DEBUG_PRINT *
+
+  } SAMPLE_OSDEBUGPRINT_PARAMETER_BUFFER;
+  ```
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+#### Handler: PRM Handler N
+* Name: `PrmHandlerN`
+* GUID: `b688c214-4081-4eeb-8d26-1eb5a3bcf11a`
+* Actions:
+  * Use an OS-provided function pointer (pointer at the beginning of the parameter buffer) to write the message
+    “PRMN handler sample message!”
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  ```c
+  typedef struct {
+
+    PRM_OS_SERVICE_DEBUG_PRINT *
+
+  } SAMPLE_OSDEBUGPRINT_PARAMETER_BUFFER;
+  ```
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+### Module: PRM Sample ACPI Parameter Buffer
+>* Name: `PrmSampleAcpiParameterBufferModule`
+>* GUID: `dc2a58a6-5927-4776-b995-d118a27335a2`
+> * Purpose:
+>   * Provides an example of how to configure an ACPI parameter buffer
+
+**Handlers:**
+#### Handler: Check Parameter Buffer PRM Handler
+* Name: `CheckParamBufferPrmHandler`
+* GUID: `2e4f2d13-6240-4ed0-a401-c723fbdc34e8`
+* Actions:
+  * Checks for the data signature ‘T’, ‘E’, ‘S’, ‘T’ (DWORD) at the beginning of the parameter buffer.
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  * A data signature of ['T', 'E', 'S', 'T'] (DWORD) at the beginning of the buffer.
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+### Module: PRM Sample Context Buffer
+>* Name: `PrmSampleContextBufferModule`
+>* GUID: `5a6cf42b-8bb4-472c-a233-5c4dc4033dc7`
+> * Purpose:
+>   * Provides an example of how to configure a static data buffer (which is pointed to in a context buffer) in
+      firmware and consume the buffer contents at runtime
+
+**Handlers:**
+#### Handler: Check Static Data Buffer PRM Handler
+* Name: `CheckStaticDataBufferPrmHandler`
+* GUID: `e1466081-7562-430f-896b-b0e523dc335a`
+* Actions:
+  * Checks that the context buffer signature and static data buffer signature match in the context buffer provided.
+
+* Parameter Buffer Required: No
+
+* Context Buffer Required: Yes
+  * Static Data Buffer Contents:
+  ```c
+  #define   SOME_VALUE_ARRAY_MAX_VALUES   16
+
+  typedef struct {
+    BOOLEAN       Policy1Enabled;
+    BOOLEAN       Policy2Enabled;
+    UINT8         SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
+  } STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE;
+  ```
+
+* Runtime MMIO Range(s) Required: No
+
+### Module: PRM Sample Hardware Access Buffer
+>* Name: `PrmSampleHardwareAccessModule`
+>* GUID: `0ef93ed7-14ae-425b-928f-b85a6213b57e`
+> * Purpose:
+>   * Demonstrate access of several types of hardware resources from a PRM module
+
+**Handlers:**
+#### Handler: MSR Access Microcode Signature PRM Handler
+* Name: `MsrAccessMicrocodeSignaturePrmHandler`
+* GUID: `2120cd3c-848b-4d8f-abbb-4b74ce64ac89`
+* Actions:
+  * Access the loaded microcode signature at MSR 0x8B.
+
+* Parameter Buffer Required: No
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+#### Handler: MSR Access MTRR Dump PRM Handler
+* Name: `MsrAccessMtrrDumpPrmHandler`
+* GUID: `ea0935a7-506b-4159-bbbb-48deeecb6f58`
+* Actions:
+  * Access the fixed and variable MTRR values using MSRs.
+
+* Parameter Buffer Required: No
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+#### Handler: HPET MMIO Access PRM Handler
+* Name: `MmioAccessHpetPrmHandler`
+* GUID: `1bd1bda9-909a-4614-9699-25ec0c2783f7`
+* Actions:
+  * Access some HPET registers using MMIO at 0xFED00000.
+
+* Parameter Buffer Required: No
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: Yes
+  * Physical Base Address: 0xFED00000
+  * Length: 0x1000
+
+#### Handler: MSR Print Microcode Signature PRM Handler
+* Name: `MsrPrintMicrocodeSignaturePrmHandler`
+* GUID: `5d28b4e7-3867-4aee-aa09-51fc282c3b22`
+* Actions:
+  * Use the provided print function to print the loaded microcode signature at MSR 0x8B.
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  ```c
+  typedef struct {
+
+    PRM_OS_SERVICE_DEBUG_PRINT *
+
+  } SAMPLE_OSDEBUGPRINT_PARAMETER_BUFFER;
+  ```
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+#### Handler: MSR Print MTRR Dump PRM Handler
+* Name: `MsrPrintMtrrDumpPrmHandler`
+* GUID: `4b64b702-4d2b-4dfe-ac5a-0b4110a2ca47`
+* Actions:
+  * Use the provided print function to print the fixed and variable MTRR values using MSRs.
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  ```c
+  typedef struct {
+
+    PRM_OS_SERVICE_DEBUG_PRINT *
+
+  } SAMPLE_OSDEBUGPRINT_PARAMETER_BUFFER;
+  ```
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: No
+
+#### Handler: HPET MMIO Print PRM Handler
+* Name: `MmioPrintHpetPrmHandler`
+* GUID: `8a0efdde-78d0-45f0-aea0-c28245c7e1db`
+* Actions:
+  * Use the provided print function to print some HPET registers using MMIO at 0xFED00000.
+
+* Parameter Buffer Required: Yes
+* Parameter Buffer Contents:
+  ```c
+  typedef struct {
+
+    PRM_OS_SERVICE_DEBUG_PRINT *
+
+  } SAMPLE_OSDEBUGPRINT_PARAMETER_BUFFER;
+  ```
+
+* Context Buffer Required: No
+
+* Runtime MMIO Range(s) Required: Yes
+  * Physical Base Address: 0xFED00000
+  * Length: 0x1000
-- 
2.28.0.windows.1


  parent reply	other threads:[~2022-03-22 16:22 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 16:19 [PATCH v1 00/41] Add PrmPkg Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 01/41] PrmPkg: Add package and include headers Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 02/41] PrmPkg: Add PrmConfig protocol interface Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 03/41] PrmPkg/PrmContextBufferLib: Add initial library instance Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 04/41] PrmPkg/PrmConfigDxe: Add initial driver Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 05/41] PrmPkg: Add initial PrmSamplePrintModule Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 06/41] PrmPkg: Add initial PrmSampleMemoryAllocationModule Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 07/41] PrmPkg: Add initial PrmSampleHardwareAccessModule Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 08/41] PrmPkg: Add initial PrmSampleContextBufferModule Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 09/41] PrmPkg: Add initial package DSC file Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 10/41] Readme.md: Add initial content Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 11/41] PrmPkg: Add ALLOCATE_CONTEXT_BUFFER_IN_FW build option Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 12/41] PrmPkg: Enable variable growth for the PRM_MODULE_EXPORT macro Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 13/41] PrmPkg: Publish PRM operation region to support PRM ACPI _DSM invocation Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 14/41] PrmPkg: Export major/minor version in PRM module PE COFF header Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 15/41] PrmPkg: Add initial PrmSsdtInstallDxe module Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 16/41] PrmPkg: Remove PRM Module Update Lock Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 17/41] PrmPkg: Remove ALLOCATE_CONTEXT_BUFFER_IN_FW build flag Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 18/41] PrmPkg/PrmContextBuffer.h: Add ACPI parameter support structures Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 19/41] PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 20/41] PrmPkg/PrmSampleContextBufferModule: Remove OS debug print requirement Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 21/41] PrmPkg/PrmSampleHardwareAccessModule: Add non-print PRM handlers Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 22/41] PrmPkg/SampleAcpiParameterBufferModule: Add initial module Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 23/41] PrmPkg/HardwareAccessModuleConfigLib: Add initial library Michael Kubacki
2022-03-22 16:19 ` Michael Kubacki [this message]
2022-03-22 16:19 ` [PATCH v1 25/41] PrmPkg: Refactor some PrmLoaderDxe functionality into libraries Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 26/41] PrmPkg/Application/PrmInfo: Add initial application Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 27/41] PrmPkg: Enforce stricter types Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 28/41] PrmPkg/Test/PrmPkgHostTest.dsc: Add initial file Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 29/41] PrmPkg/Test/UnitTest/Library: Add initial UEFI Boot Services test lib Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 30/41] PrmPkg/Library/DxePrmContextBufferLib: Add host-based unit tests Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 31/41] PrmPkg/DxePrmModuleDiscoveryLib: Add initial " Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 32/41] PrmPkg: Add PlatformGuid Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 33/41] PrmPkg: Update PRM OpRegion Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 34/41] Readme.md: Add iASL note and QEMU sample link Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 35/41] PrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUID Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 36/41] PrmPkg/Samples: Remove PrmSampleMemoryAllocationModule Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 37/41] PrmPkg/Samples: Remove PrmSamplePrintModule Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 38/41] PrmPkg: Remove the concept of OS services Michael Kubacki
2022-03-22 16:19 ` [PATCH v1 39/41] Readme.md: Add a link to PRM Specification Michael Kubacki
2022-03-28  8:48 ` 回复: [edk2-devel] [PATCH v1 00/41] Add PrmPkg gaoliming
2022-03-28 14:05   ` Michael Kubacki
2022-03-29 16:28 ` Sinha, Ankit
2022-03-31  0:52   ` 回复: " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220322161947.9319-25-mikuback@linux.microsoft.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox