From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.106.55; helo=cam-smtp0.cambridge.arm.com; envelope-from=sami.mujawar@arm.com; receiver=edk2-devel@lists.01.org Received: from cam-smtp0.cambridge.arm.com (unknown [217.140.106.55]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 78ED721164EF2 for ; Fri, 21 Dec 2018 09:40:10 -0800 (PST) Received: from E107187.Arm.com (e107187.arm.com [10.1.195.55]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id wBLGvOUe018491; Fri, 21 Dec 2018 16:59:41 GMT From: Sami Mujawar To: edk2-devel@lists.01.org Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org, Matteo.Carlini@arm.com, Stephanie.Hughes-Fitt@arm.com, nd@arm.com Date: Fri, 21 Dec 2018 16:57:09 +0000 Message-Id: <20181221165719.49480-13-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20181221165719.49480-1-sami.mujawar@arm.com> References: <20181221165719.49480-1-sami.mujawar@arm.com> Subject: [PATCH v1 12/22] DynamicTablesPkg: Dynamic Table Factory Protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 X-List-Received-Date: Fri, 21 Dec 2018 17:40:10 -0000 This patch introduces the dynamic table factory protocol that provides an interface to register and retrieve registered generators. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sami Mujawar --- DynamicTablesPkg/DynamicTablesPkg.dec | 3 + DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h | 269 ++++++++++++++++++++ 2 files changed, 272 insertions(+) diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec index e5e731085a721f5f2a0129b4678dedbb0c7b985a..3137c14247920974082bd74173cab4e7ac02b3f7 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dec +++ b/DynamicTablesPkg/DynamicTablesPkg.dec @@ -27,3 +27,6 @@ [Protocols] # Configuration Manager Protocol GUID gEdkiiConfigurationManagerProtocolGuid = { 0xd85a4835, 0x5a82, 0x4894, { 0xac, 0x2, 0x70, 0x6f, 0x43, 0xd5, 0x97, 0x8e } } + # Dynamic Table Factory Protocol GUID + gEdkiiDynamicTableFactoryProtocolGuid = { 0x91d1e327, 0xfe5a, 0x49b8, { 0xab, 0x65, 0xe, 0xce, 0x2d, 0xdb, 0x45, 0xec } } + diff --git a/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h b/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h new file mode 100644 index 0000000000000000000000000000000000000000..55d62c9e7244c1cca35aaa6c7e3b1dbf9125c3b5 --- /dev/null +++ b/DynamicTablesPkg/Include/Protocol/DynamicTableFactoryProtocol.h @@ -0,0 +1,269 @@ +/** @file + + Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + @par Glossary: + - ACPI - Advanced Configuration and Power Interface + - SMBIOS - System Management BIOS + - DT - Device Tree +**/ + +#ifndef DYNAMIC_TABLE_FACTORY_PROTOCOL_H_ +#define DYNAMIC_TABLE_FACTORY_PROTOCOL_H_ + +#include +#include +#include + +/** This macro defines the Dynamic Table Factory Protocol GUID. + + GUID: {91D1E327-FE5A-49B8-AB65-0ECE2DDB45EC} +*/ +#define EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL_GUID \ + { 0x91d1e327, 0xfe5a, 0x49b8, \ + { 0xab, 0x65, 0xe, 0xce, 0x2d, 0xdb, 0x45, 0xec } \ + }; + +/** This macro defines the Configuration Manager Protocol Revision. +*/ +#define EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL_REVISION CREATE_REVISION (1, 0) + +#pragma pack(1) + +/** + Forward declarations: +*/ +typedef struct DynamicTableFactoryProtocol EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL; +typedef struct DynamicTableFactoryInfo EDKII_DYNAMIC_TABLE_FACTORY_INFO; + +/** Return a pointer to the ACPI table generator. + + @param [in] This Pointer to the Dynamic Table Factory Protocol. + @param [in] TableId The ACPI table generator ID for the + requested generator. + @param [out] Generator Pointer to the requested ACPI table + generator. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The requested generator is not found + in the list of registered generators. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR) ( + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, + IN CONST ACPI_TABLE_GENERATOR_ID GeneratorId, + OUT CONST ACPI_TABLE_GENERATOR ** CONST Generator + ); + +/** Registers an ACPI table generator. + + @param [in] Generator Pointer to the ACPI table generator. + + @retval EFI_SUCCESS The Generator was registered + successfully. + @retval EFI_INVALID_PARAMETER The Generator ID is invalid or + the Generator pointer is NULL. + @retval EFI_ALREADY_STARTED The Generator for the Table ID is + already registered. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR) ( + IN CONST ACPI_TABLE_GENERATOR * CONST Generator + ); + +/** Deregister an ACPI table generator. + + @param [in] Generator Pointer to the ACPI table generator. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER The generator is invalid. + @retval EFI_NOT_FOUND The requested generator is not found + in the list of registered generators. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR) ( + IN CONST ACPI_TABLE_GENERATOR * CONST Generator + ); + +/** Return a pointer to the SMBIOS table generator. + + @param [in] This Pointer to the Dynamic Table Factory Protocol. + @param [in] TableId The SMBIOS table generator ID for the + requested generator. + @param [out] Generator Pointer to the requested SMBIOS table + generator. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The requested generator is not found + in the list of registered generators. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR) ( + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, + IN CONST SMBIOS_TABLE_GENERATOR_ID GeneratorId, + OUT CONST SMBIOS_TABLE_GENERATOR ** CONST Generator + ); + +/** Register a SMBIOS table generator. + + @param [in] Generator Pointer to the SMBIOS table generator. + + @retval EFI_SUCCESS The Generator was registered + successfully. + @retval EFI_INVALID_PARAMETER The Generator ID is invalid or + the Generator pointer is NULL. + @retval EFI_ALREADY_STARTED The Generator for the Table ID is + already registered. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR) ( + IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator + ); + +/** Deregister a SMBIOS table generator. + + @param [in] Generator Pointer to the SMBIOS table generator. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER The generator is invalid. + @retval EFI_NOT_FOUND The requested generator is not found + in the list of registered generators. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_SMBIOS_TABLE_GENERATOR) ( + IN CONST SMBIOS_TABLE_GENERATOR * CONST Generator + ); + +/** Return a pointer to the Device Tree table generator. + + @param [in] This Pointer to the Dynamic Table Factory Protocol. + @param [in] TableId The Device Tree table generator ID for the + requested generator. + @param [out] Generator Pointer to the requested Device Tree table + generator. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The requested generator is not found + in the list of registered generators. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR) ( + IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * CONST This, + IN CONST DT_TABLE_GENERATOR_ID GeneratorId, + OUT CONST DT_TABLE_GENERATOR ** CONST Generator + ); + +/** Register a DT table generator. + + @param [in] Generator Pointer to the DT table generator. + + @retval EFI_SUCCESS The Generator was registered + successfully. + @retval EFI_INVALID_PARAMETER The Generator ID is invalid or + the Generator pointer is NULL. + @retval EFI_ALREADY_STARTED The Generator for the Table ID is + already registered. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR) ( + IN CONST DT_TABLE_GENERATOR * CONST Generator + ); + +/** Deregister a DT table generator. + + This function is called by the DT table generator to deregister itself + from the DT table factory. + + @param [in] Generator Pointer to the DT table generator. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER The generator is invalid. + @retval EFI_NOT_FOUND The requested generator is not found + in the list of registered generators. +**/ +typedef +EFI_STATUS +EFIAPI +(EFIAPI * EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR) ( + IN CONST DT_TABLE_GENERATOR * CONST Generator + ); + +/** A structure describing the Dynamic Table Factory Protocol interface. +*/ +typedef struct DynamicTableFactoryProtocol { + /// The Dynamic Table Factory Protocol revision. + UINT32 Revision; + + /// The interface used to request an ACPI Table Generator. + EDKII_DYNAMIC_TABLE_FACTORY_GET_ACPI_TABLE_GENERATOR GetAcpiTableGenerator; + + /// Register an ACPI table Generator + EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_ACPI_TABLE_GENERATOR + RegisterAcpiTableGenerator; + + /// Deregister an ACPI table Generator + EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_ACPI_TABLE_GENERATOR + DeregisterAcpiTableGenerator; + + /// The interface used to request a SMBIOS Table Generator. + EDKII_DYNAMIC_TABLE_FACTORY_GET_SMBIOS_TABLE_GENERATOR GetSmbiosTableGenerator; + + /// Register an SMBIOS table Generator + EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR + RegisterSmbiosTableGenerator; + + /// Deregister an SMBIOS table Generator + EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_SMBIOS_TABLE_GENERATOR + DeregisterSmbiosTableGenerator; + + /// The interface used to request a Device Tree Table Generator. + EDKII_DYNAMIC_TABLE_FACTORY_GET_DT_TABLE_GENERATOR GetDtTableGenerator; + + /// Register a DT generator + EDKII_DYNAMIC_TABLE_FACTORY_REGISTER_DT_TABLE_GENERATOR + RegisterDtTableGenerator; + + /// Deregister a DT generator + EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR + DeregisterDtTableGenerator; + + /** Pointer to the data structure that holds the + list of registered table generators + */ + EDKII_DYNAMIC_TABLE_FACTORY_INFO * TableFactoryInfo; +} EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL; + +/** The Dynamic Table Factory Protocol GUID. +*/ +extern EFI_GUID gEdkiiDynamicTableFactoryProtocolGuid; + +#pragma pack() + +#endif // DYNAMIC_TABLE_FACTORY_PROTOCOL_H_ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'