The device configuration protocol definition.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daniil Egranov daniil.egranov@arm.com --- EmbeddedPkg/EmbeddedPkg.dec | 1 + .../Include/Protocol/EmbeddedDeviceConfig.h | 127 +++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 EmbeddedPkg/Include/Protocol/EmbeddedDeviceConfig.h
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 775d863..7e1d9ed 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -69,6 +69,7 @@ gAndroidFastbootPlatformProtocolGuid = { 0x524685a0, 0x89a0, 0x11e3, {0x9d, 0x4d, 0xbf, 0xa9, 0xf6, 0xa4, 0x03, 0x08}} gUsbDeviceProtocolGuid = { 0x021bd2ca, 0x51d2, 0x11e3, {0x8e, 0x56, 0xb7, 0x54, 0x17, 0xc7, 0x0b, 0x44 }} gPlatformGpioProtocolGuid = { 0x52ce9845, 0x5af4, 0x43e2, {0xba, 0xfd, 0x23, 0x08, 0x12, 0x54, 0x7a, 0xc2 }} + gEfiEmbeddedDeviceConfigProtocolGuid = { 0x735F8C64, 0xD696, 0x44D0, { 0xBD, 0xF2, 0x44, 0x7F, 0xD0, 0x5A, 0x54, 0x06 }}
[PcdsFeatureFlag.common] gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|FALSE|BOOLEAN|0x00000001 diff --git a/EmbeddedPkg/Include/Protocol/EmbeddedDeviceConfig.h b/EmbeddedPkg/Include/Protocol/EmbeddedDeviceConfig.h new file mode 100644 index 0000000..f397036 --- /dev/null +++ b/EmbeddedPkg/Include/Protocol/EmbeddedDeviceConfig.h @@ -0,0 +1,127 @@ +/** @file +* +* Copyright (c) 2016, 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. +* +**/ + +#ifndef __EMBEDDED_DEVICE_CONFIG_H__ +#define __EMBEDDED_DEVICE_CONFIG_H__ + +// +// Protocol GUID +// +#define EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL_GUID { 0x735F8C64, 0xD696, 0x44D0, { 0xBD, 0xF2, 0x44, 0x7F, 0xD0, 0x5A, 0x54, 0x06 }} + +// +// Protocol interface structure +// +typedef struct _EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL; + +#define EFI_EMBEDDED_DEVICE_CONFIG_REVISION 0x00010000 + +// Device configuration types and structures +typedef enum { + EfiConfigMacAddress, + EfiMaxDeviceConfigurationType +} EFI_DEVICE_CONFIGURATION_TYPE; + +typedef struct { + BOOLEAN Writable; + EFI_DEVICE_CONFIGURATION_TYPE Type; +} EFI_DEVICE_CONFIGURATION_BLOCK; + +typedef struct { + EFI_HANDLE Controller; + UINT32 SupportedConfigs; + EFI_DEVICE_CONFIGURATION_BLOCK ConfigList[EfiMaxDeviceConfigurationType]; +} EFI_DEVICE_CONFIGURATION_RECORD; + +// +// Function Prototypes +// + +/** + Check for device configuration support. + + @param This Instance pointer for this protocol + + @retval Buffer Array of configuration records. + @retval RecordCount Number of configuration records. + @retval EFI_SUCCESS Device supports external configuration. + @retval EFI_UNSUPPORTED Device does not support external configuration. + @retval EFI_DEVICE_ERROR Device configuration read error. +**/ + +typedef +EFI_STATUS +(EFIAPI *EFI_EMBEDDED_DEVICE_CONFIG_SUPPORTED) ( + IN EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL *This, + OUT EFI_DEVICE_CONFIGURATION_RECORD **Buffer, + OUT UINTN *RecordCount + ); + +/** + Set device configuration. + + @param This Instance pointer for this protocol. + @param Controller Handle of device to configure. + @param ConfigType Configuration type. + @param Buffer Configuration data. + + @retval EFI_SUCCESS Device configured successfully. + @retval EFI_UNSUPPORTED Device does not support specified configuration or + device configuration is read only. + @retval EFI_DEVICE_ERROR Device configuration failed. + +**/ + +typedef +EFI_STATUS +(EFIAPI *EFI_EMBEDDED_DEVICE_CONFIG_SET) ( + IN EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_CONFIGURATION_TYPE ConfigType, + IN VOID *Buffer + ); + +/** + Get device configuration. + + @param This Instance pointer for this protocol + @param Controller Handle of device to get a configuration. + @param ConfigType Configuration type to update. + + @retval Buffer Configuration data. + @retval EFI_SUCCESS Configuration data is available. + @retval EFI_UNSUPPORTED Device does not support specified configuration. + @retval EFI_DEVICE_ERROR Device configuration read error. + +**/ + +typedef +EFI_STATUS +(EFIAPI *EFI_EMBEDDED_DEVICE_CONFIG_GET) ( + IN EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_CONFIGURATION_TYPE ConfigType, + OUT VOID **Buffer + ); + +struct _EFI_EMBEDDED_DEVICE_CONFIG_PROTOCOL { + UINT64 Revision; + EFI_EMBEDDED_DEVICE_CONFIG_SUPPORTED Supported; + EFI_EMBEDDED_DEVICE_CONFIG_SET Set; + EFI_EMBEDDED_DEVICE_CONFIG_GET Get; +}; + +extern EFI_GUID gEfiEmbeddedDeviceConfigProtocolGuid; + +#endif // __EMBEDDED_DEVICE_CONFIG_H__