audk/PrmPkg/Include/Prm.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.4 KiB
C
Raw Normal View History

PrmPkg: Add package and include headers 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>
2020-04-07 20:00:28 +02:00
/** @file
Common Platform Runtime Mechanism (PRM) definitions.
Copyright (c) Microsoft Corporation
Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
PrmPkg: Add package and include headers 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>
2020-04-07 20:00:28 +02:00
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef PRM_H_
#define PRM_H_
#include <Uefi.h>
#include <PrmContextBuffer.h>
#if defined (_MSC_VER)
#define PRM_EXPORT_API __declspec(dllexport)
#elif defined (__GNUC__)
#define PRM_EXPORT_API __attribute__ ((visibility ("default")))
PrmPkg: Add package and include headers 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>
2020-04-07 20:00:28 +02:00
#else
#define PRM_EXPORT_API
#endif
#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128
#define PRM_STRING_(x) #x
#define PRM_STRING(x) PRM_STRING_(x)
/**
A Platform Runtime Mechanism (PRM) handler function.
@param[in] ParameterBuffer A pointer to a buffer with arbitrary data that is allocated and populated
by the PRM handler caller.
@param[in] ContextBuffer A pointer to a buffer with arbitrary data that is allocated in the firmware
boot environment.
@retval EFI_STATUS The PRM handler executed successfully.
@retval Others An error occurred in the PRM handler.
**/
typedef
EFI_STATUS
(EFIAPI PRM_HANDLER)(
IN VOID *ParameterBuffer OPTIONAL,
IN PRM_CONTEXT_BUFFER *ContextBuffer OPTIONAL
);
#endif