From 03284334ae825d6a7610e5fb3b907f1900a3883e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 8 Jul 2008 07:04:59 +0000 Subject: [PATCH] Add protocol defintions for DriverConfiguration2, DriverDiagnostic2 & Unicode Collcation 2 definitions so that some EDK 1.05 drivers can be built. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5417 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Protocol/ComponentName2/ComponentName2.c | 6 +- .../DriverConfiguration2.c | 30 +++ .../DriverConfiguration2.h | 201 +++++++++++++++++ .../DriverDiagnostics2/DriverDiagnostics2.c | 30 +++ .../DriverDiagnostics2/DriverDiagnostics2.h | 135 +++++++++++ .../Efi/Protocol/EfiProtocolLib.inf | 6 + .../UnicodeCollation/UnicodeCollation.c | 4 +- .../UnicodeCollation/UnicodeCollation.h | 6 - .../UnicodeCollation2/UnicodeCollation2.c | 27 +++ .../UnicodeCollation2/UnicodeCollation2.h | 211 ++++++++++++++++++ 10 files changed, 644 insertions(+), 12 deletions(-) create mode 100644 EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.c create mode 100644 EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.h create mode 100644 EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.c create mode 100644 EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.h create mode 100644 EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.c create mode 100644 EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.h diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/ComponentName2/ComponentName2.c b/EdkCompatibilityPkg/Foundation/Efi/Protocol/ComponentName2/ComponentName2.c index fee053effb..a1aedca658 100644 --- a/EdkCompatibilityPkg/Foundation/Efi/Protocol/ComponentName2/ComponentName2.c +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/ComponentName2/ComponentName2.c @@ -11,11 +11,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: - ComponentName.c + ComponentName2.c Abstract: - EFI Component Name Protocol + EFI Component Name2 Protocol Revision History @@ -26,4 +26,4 @@ Revision History EFI_GUID gEfiComponentName2ProtocolGuid = EFI_COMPONENT_NAME2_PROTOCOL_GUID; -EFI_GUID_STRING(&gEfiComponentName2ProtocolGuid, "Component Name2 Protocol", "EFI 2.0 Component Name2 Protocol"); +EFI_GUID_STRING(&gEfiComponentName2ProtocolGuid, "Component Name2 Protocol", "UEFI 2.0 Component Name2 Protocol"); diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.c b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.c new file mode 100644 index 0000000000..8cbc4a607f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.c @@ -0,0 +1,30 @@ +/*++ + +Copyright (c) 2008, Intel Corporation +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. + +Module Name: + + DriverConfiguration.c + +Abstract: + + EFI Driver Configuration Protocol + +Revision History + +--*/ + +#include "EfiSpec.h" +#include EFI_PROTOCOL_DEFINITION (DriverConfiguration2) + +EFI_GUID gEfiDriverConfiguration2ProtocolGuid = EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID; + +EFI_GUID_STRING + (&gEfiDriverConfiguration2ProtocolGuid, "Driver Configuration2 Protocol", "UEFI 2.0 Driver Configuration2 Protocol"); diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.h b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.h new file mode 100644 index 0000000000..62156bb8d0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverConfiguration2/DriverConfiguration2.h @@ -0,0 +1,201 @@ +/*++ + +Copyright (c) 2008, Intel Corporation +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. + +Module Name: + + DriverConfiguration2.h + +Abstract: + + EFI Driver Configuration2 Protocol + +Revision History + +--*/ + +#ifndef _EFI_DRIVER_CONFIGURATION2_H_ +#define _EFI_DRIVER_CONFIGURATION2_H_ + +#include EFI_PROTOCOL_DEFINITION (DriverConfiguration) + +// +// Global ID for the Driver Configuration Protocol +// +#define EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID \ + { \ + 0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe} \ + } + +EFI_FORWARD_DECLARATION (EFI_DRIVER_CONFIGURATION2_PROTOCOL); + +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_CONFIGURATION2_SET_OPTIONS) ( + IN EFI_DRIVER_CONFIGURATION2_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED * ActionRequired + ); + +/*++ + + Routine Description: + Allows the user to set controller specific options for a controller that a + driver is currently managing. + + Arguments: + This - A pointer to the EFI_DRIVER_CONFIGURATION2_PROTOCOL instance. + ControllerHandle - The handle of the controller to set options on. + ChildHandle - The handle of the child controller to set options on. This + is an optional parameter that may be NULL. It will be NULL + for device drivers, and for a bus drivers that wish to set + options for the bus controller. It will not be NULL for a + bus driver that wishes to set options for one of its child + controllers. + Language - A pointer to a three character RFC 3066 language identifier. + This is the language of the user interface that should be + presented to the user, and it must match one of the languages + specified in SupportedLanguages. The number of languages + supported by a driver is up to the driver writer. + ActionRequired - A pointer to the action that the calling agent is required + to perform when this function returns. See "Related + Definitions" for a list of the actions that the calling + agent is required to perform prior to accessing + ControllerHandle again. + + Returns: + EFI_SUCCESS - The driver specified by This successfully set the + configuration options for the controller specified + by ControllerHandle.. + EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER - ActionRequired is NULL. + EFI_UNSUPPORTED - The driver specified by This does not support setting + configuration options for the controller specified by + ControllerHandle and ChildHandle. + EFI_UNSUPPORTED - The driver specified by This does not support the + language specified by Language. + EFI_DEVICE_ERROR - A device error occurred while attempt to set the + configuration options for the controller specified + by ControllerHandle and ChildHandle. + EFI_OUT_RESOURCES - There are not enough resources available to set the + configuration options for the controller specified + by ControllerHandle and ChildHandle. + +--*/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_CONFIGURATION2_OPTIONS_VALID) ( + IN EFI_DRIVER_CONFIGURATION2_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL + ); + +/*++ + + Routine Description: + Tests to see if a controller's current configuration options are valid. + + Arguments: + This - A pointer to the EFI_DRIVER_CONFIGURATION2_PROTOCOL instance. + ControllerHandle - The handle of the controller to test if it's current + configuration options are valid. + ChildHandle - The handle of the child controller to test if it's current + configuration options are valid. This is an optional + parameter that may be NULL. It will be NULL for device + drivers. It will also be NULL for a bus drivers that wish + to test the configuration options for the bus controller. + It will not be NULL for a bus driver that wishes to test + configuration options for one of its child controllers. + + Returns: + EFI_SUCCESS - The controller specified by ControllerHandle and + ChildHandle that is being managed by the driver + specified by This has a valid set of configuration + options. + EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE. + EFI_UNSUPPORTED - The driver specified by This is not currently + managing the controller specified by ControllerHandle + and ChildHandle. + EFI_DEVICE_ERROR - The controller specified by ControllerHandle and + ChildHandle that is being managed by the driver + specified by This has an invalid set of configuration + options. + +--*/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_CONFIGURATION2_FORCE_DEFAULTS) ( + IN EFI_DRIVER_CONFIGURATION2_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN UINT32 DefaultType, + OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED * ActionRequired + ); + +/*++ + + Routine Description: + Forces a driver to set the default configuration options for a controller. + + Arguments: + This - A pointer to the EFI_DRIVER_CONFIGURATION2_PROTOCOL instance. + ControllerHandle - The handle of the controller to force default configuration options on. + ChildHandle - The handle of the child controller to force default configuration options on This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to force default configuration options for the bus controller. It will not be NULL for a bus driver that wishes to force default configuration options for one of its child controllers. + DefaultType - The type of default configuration options to force on the controller specified by ControllerHandle and ChildHandle. See Table 9-1 for legal values. A DefaultType of 0x00000000 must be supported by this protocol. + ActionRequired - A pointer to the action that the calling agent is required to perform when this function returns. See "Related Definitions" in Section 9.1for a list of the actions that the calling agent is required to perform prior to accessing ControllerHandle again. + + Returns: + EFI_SUCCESS - The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle. + EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER - ActionRequired is NULL. + EFI_UNSUPPORTED - The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle. + EFI_UNSUPPORTED - The driver specified by This does not support the configuration type specified by DefaultType. + EFI_DEVICE_ERROR - A device error occurred while attempt to force the default configuration options on the controller specified by ControllerHandle and ChildHandle. + EFI_OUT_RESOURCES - There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle. + +--*/ + +// +// Interface structure for the Driver Configuration Protocol +// +typedef struct _EFI_DRIVER_CONFIGURATION2_PROTOCOL { + EFI_DRIVER_CONFIGURATION2_SET_OPTIONS SetOptions; + EFI_DRIVER_CONFIGURATION2_OPTIONS_VALID OptionsValid; + EFI_DRIVER_CONFIGURATION2_FORCE_DEFAULTS ForceDefaults; + CHAR8 *SupportedLanguages; +} EFI_DRIVER_CONFIGURATION2_PROTOCOL; + +/*++ + + Protocol Description: + Used to set configuration options for a controller that an EFI Driver is managing. + + Parameters: + SetOptions - Allows the use to set drivers specific configuration + options for a controller that the driver is currently + managing. + OptionsValid - Tests to see if a controller's current configuration + options are valid. + ForceDefaults - Forces a driver to set the default configuration options + for a controller. + SupportedLanguages - A Null-terminated ASCII string that contains one or more + RFC 3066 language codes. This is the list of language + codes that this protocol supports. + +--*/ + +extern EFI_GUID gEfiDriverConfiguration2ProtocolGuid; + +#endif diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.c b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.c new file mode 100644 index 0000000000..87c68139b7 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.c @@ -0,0 +1,30 @@ +/*++ + +Copyright (c) 2008, Intel Corporation +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. + +Module Name: + + DriverDiagnostics2.c + +Abstract: + + EFI Driver Diagnostics2 Protocol + +Revision History + +--*/ + +#include "EfiSpec.h" +#include EFI_PROTOCOL_DEFINITION (DriverDiagnostics2) + +EFI_GUID gEfiDriverDiagnostics2ProtocolGuid = EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID; + +EFI_GUID_STRING + (&gEfiDriverDiagnostics2ProtocolGuid, "Driver Diagnostics Protocol", "UEFI 2.0 Driver Diagnostics2 Protocol"); diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.h b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.h new file mode 100644 index 0000000000..83bc86453e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/DriverDiagnostics2/DriverDiagnostics2.h @@ -0,0 +1,135 @@ +/*++ + +Copyright (c) 2008, Intel Corporation +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. + +Module Name: + + DriverDiagnostics2.h + +Abstract: + + EFI Driver Diagnostics2 Protocol + +Revision History + +--*/ + +#ifndef _EFI_DRIVER_DIAGNOSTICS2_H_ +#define _EFI_DRIVER_DIAGNOSTICS2_H_ + +#include EFI_PROTOCOL_DEFINITION (DriverDiagnostics) + +// +// Global ID for the Driver Diagnostics Protocol +// +#define EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID \ + { \ + 0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x0, 0x17, 0x3b, 0x63} \ + } + +EFI_FORWARD_DECLARATION (EFI_DRIVER_DIAGNOSTICS2_PROTOCOL); + +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) ( + IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType, + IN CHAR8 *Language, + OUT EFI_GUID **ErrorType, + OUT UINTN *BufferSize, + OUT CHAR16 **Buffer + ); + +/*++ + + Routine Description: + Runs diagnostics on a controller. + + Arguments: + This - A pointer to the EFI_DRIVER_DIAGNOSTICS2_PROTOCOL instance. + ControllerHandle - The handle of the controller to run diagnostics on. + ChildHandle - The handle of the child controller to run diagnostics on + This is an optional parameter that may be NULL. It will + be NULL for device drivers. It will also be NULL for a + bus drivers that wish to run diagnostics on the bus + controller. It will not be NULL for a bus driver that + wishes to run diagnostics on one of its child controllers. + DiagnosticType - Indicates type of diagnostics to perform on the controller + specified by ControllerHandle and ChildHandle. See + "Related Definitions" for the list of supported types. + Language - A pointer to a NULL-terminated ASCII string array indicating + the language. This is the language in which the optional + error message should be returned in Buffer, and it must + match one of the languages specified in SupportedLanguages. + The number of languages supported by a driver is up to + the driver writer. Language is specified in RFC 3066 + language code format. + ErrorType - A GUID that defines the format of the data returned in + Buffer. + BufferSize - The size, in bytes, of the data returned in Buffer. + Buffer - A buffer that contains a Null-terminated Unicode string + plus some additional data whose format is defined by + ErrorType. Buffer is allocated by this function with + AllocatePool(), and it is the caller's responsibility + to free it with a call to FreePool(). + + Returns: + EFI_SUCCESS - The controller specified by ControllerHandle and + ChildHandle passed the diagnostic. + EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid + EFI_HANDLE. + EFI_INVALID_PARAMETER - Language is NULL. + EFI_INVALID_PARAMETER - ErrorType is NULL. + EFI_INVALID_PARAMETER - BufferType is NULL. + EFI_INVALID_PARAMETER - Buffer is NULL. + EFI_UNSUPPORTED - The driver specified by This does not support + running diagnostics for the controller specified + by ControllerHandle and ChildHandle. + EFI_UNSUPPORTED - The driver specified by This does not support the + type of diagnostic specified by DiagnosticType. + EFI_UNSUPPORTED - The driver specified by This does not support the + language specified by Language. + EFI_OUT_OF_RESOURCES - There are not enough resources available to complete + the diagnostics. + EFI_OUT_OF_RESOURCES - There are not enough resources available to return + the status information in ErrorType, BufferSize, + and Buffer. + EFI_DEVICE_ERROR - The controller specified by ControllerHandle and + ChildHandle did not pass the diagnostic. + +--*/ + +// +// Interface structure for the Driver Diagnostics Protocol +// +typedef struct _EFI_DRIVER_DIAGNOSTICS2_PROTOCOL { + EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS RunDiagnostics; + CHAR8 *SupportedLanguages; +} EFI_DRIVER_DIAGNOSTICS2_PROTOCOL; + +/*++ + + Protocol Description: + Used to perform diagnostics on a controller that an EFI Driver is managing. + + Parameters: + RunDiagnostics - Runs diagnostics on a controller. + SupportedLanguages - A Null-terminated ASCII string that contains one or more + RFC 3066 language codes. This is the list of language + codes that this protocol supports. + +--*/ + +extern EFI_GUID gEfiDriverDiagnostics2ProtocolGuid; + +#endif diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/EfiProtocolLib.inf b/EdkCompatibilityPkg/Foundation/Efi/Protocol/EfiProtocolLib.inf index 24f7212d17..c075675ed7 100644 --- a/EdkCompatibilityPkg/Foundation/Efi/Protocol/EfiProtocolLib.inf +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/EfiProtocolLib.inf @@ -77,8 +77,12 @@ COMPONENT_TYPE= LIBRARY DriverBinding/DriverBinding.c DriverConfiguration/DriverConfiguration.h DriverConfiguration/DriverConfiguration.c + DriverConfiguration2/DriverConfiguration2.h + DriverConfiguration2/DriverConfiguration2.c DriverDiagnostics/DriverDiagnostics.h DriverDiagnostics/DriverDiagnostics.c + DriverDiagnostics2/DriverDiagnostics2.h + DriverDiagnostics2/DriverDiagnostics2.c Ebc/Ebc.h Ebc/Ebc.c EdidActive/EdidActive.h @@ -157,6 +161,8 @@ COMPONENT_TYPE= LIBRARY UgaIo/UgaIo.c UnicodeCollation/UnicodeCollation.h UnicodeCollation/UnicodeCollation.c + UnicodeCollation2/UnicodeCollation2.h + UnicodeCollation2/UnicodeCollation2.c UsbHostController/UsbHostController.h UsbHostController/UsbHostController.c UsbIo/UsbIo.h diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.c b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.c index 6484a768db..cb6b98bbfb 100644 --- a/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.c +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004, Intel Corporation +Copyright (c) 2004 - 2008, Intel Corporation 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 @@ -23,7 +23,5 @@ Abstract: #include EFI_PROTOCOL_DEFINITION (UnicodeCollation) EFI_GUID gEfiUnicodeCollationProtocolGuid = EFI_UNICODE_COLLATION_PROTOCOL_GUID; -EFI_GUID gEfiUnicodeCollation2ProtocolGuid = EFI_UNICODE_COLLATION2_PROTOCOL_GUID; EFI_GUID_STRING(&gEfiUnicodeCollationProtocolGuid, "Unicode Collation Protocol", "EFI 1.0 Unicode Collation Protocol"); -EFI_GUID_STRING(&gEfiUnicodeCollation2ProtocolGuid, "Unicode Collation Protocol", "UEFI 2.10 Unicode Collation Protocol"); diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.h b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.h index 28a15a2637..3dfbaf7b50 100644 --- a/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.h +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation/UnicodeCollation.h @@ -27,11 +27,6 @@ Abstract: 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} \ } -#define EFI_UNICODE_COLLATION2_PROTOCOL_GUID \ - { \ - 0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49} \ - } - EFI_FORWARD_DECLARATION (EFI_UNICODE_COLLATION_PROTOCOL); // @@ -212,6 +207,5 @@ struct _EFI_UNICODE_COLLATION_PROTOCOL { }; extern EFI_GUID gEfiUnicodeCollationProtocolGuid; -extern EFI_GUID gEfiUnicodeCollation2ProtocolGuid; #endif diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.c b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.c new file mode 100644 index 0000000000..c808187d18 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.c @@ -0,0 +1,27 @@ +/*++ + +Copyright (c) 2008, Intel Corporation +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. + +Module Name: + + UnicodeCollation2.c + +Abstract: + + Unicode Collation2 protocol that follows the UEFI 2.0 specification. + +--*/ + +#include "EfiSpec.h" +#include EFI_PROTOCOL_DEFINITION (UnicodeCollation2) + +EFI_GUID gEfiUnicodeCollation2ProtocolGuid = EFI_UNICODE_COLLATION2_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiUnicodeCollation2ProtocolGuid, "Unicode Collation Protocol", "UEFI 2.0 Unicode Collation2 Protocol"); diff --git a/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.h b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.h new file mode 100644 index 0000000000..d250da5734 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Efi/Protocol/UnicodeCollation2/UnicodeCollation2.h @@ -0,0 +1,211 @@ +/*++ + +Copyright (c) 2008, Intel Corporation +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. + +Module Name: + + UnicodeCollation2.h + +Abstract: + + Unicode Collation2 protocol that follows the UEFI 2.0 specification. + +--*/ + +#ifndef _UNICODE_COLLATION2_H_ +#define _UNICODE_COLLATION2_H_ + +#define EFI_UNICODE_COLLATION2_PROTOCOL_GUID \ + { \ + 0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49} \ + } + +EFI_FORWARD_DECLARATION (EFI_UNICODE_COLLATION2_PROTOCOL); + +// +// Protocol data structures and defines +// +#define EFI_UNICODE_BYTE_ORDER_MARK ((CHAR16)(0xfeff)) +#define EFI_UNICODE_BYTE_ORDER_MARK_REVERSE ((CHAR16)(0xfffe)) + +// +// Protocol member functions +// +typedef +INTN +(EFIAPI *EFI_UNICODE_COLLATION2_STRICOLL) ( + IN EFI_UNICODE_COLLATION2_PROTOCOL * This, + IN CHAR16 *Str1, + IN CHAR16 *Str2 + ) +/*++ + + Routine Description: + Performs a case-insensitive comparison of two Null-terminated Unicode + strings. + + Arguments: + This - Protocol instance pointer. + Str1 - A pointer to a Null-terminated Unicode string. + Str2 - A pointer to a Null-terminated Unicode string. + + Returns: + 0 - Str1 is equivalent to Str2 + > 0 - Str1 is lexically greater than Str2 + < 0 - Str1 is lexically less than Str2 + +--*/ +; + +typedef +BOOLEAN +(EFIAPI *EFI_UNICODE_COLLATION2_METAIMATCH) ( + IN EFI_UNICODE_COLLATION2_PROTOCOL * This, + IN CHAR16 *String, + IN CHAR16 *Pattern + ) +/*++ + + Routine Description: + Performs a case-insensitive comparison of a Null-terminated Unicode + pattern string and a Null-terminated Unicode string. + + Arguments: + This - Protocol instance pointer. + String - A pointer to a Null-terminated Unicode string. + Pattern - A pointer to a Null-terminated Unicode pattern string. + + Returns: + TRUE - Pattern was found in String. + FALSE - Pattern was not found in String. + +--*/ +; + +typedef +VOID +(EFIAPI *EFI_UNICODE_COLLATION2_STRLWR) ( + IN EFI_UNICODE_COLLATION2_PROTOCOL * This, + IN OUT CHAR16 *Str + ) +/*++ + + Routine Description: + Converts all the Unicode characters in a Null-terminated Unicode string to + lower case Unicode characters. + + Arguments: + This - Protocol instance pointer. + String - A pointer to a Null-terminated Unicode string. + + Returns: + NONE + +--*/ +; + +typedef +VOID +(EFIAPI *EFI_UNICODE_COLLATION2_STRUPR) ( + IN EFI_UNICODE_COLLATION2_PROTOCOL * This, + IN OUT CHAR16 *Str + ) +/*++ + + Routine Description: + Converts all the Unicode characters in a Null-terminated Unicode string to upper + case Unicode characters. + + Arguments: + This - Protocol instance pointer. + String - A pointer to a Null-terminated Unicode string. + + Returns: + NONE + +--*/ +; + +typedef +VOID +(EFIAPI *EFI_UNICODE_COLLATION2_FATTOSTR) ( + IN EFI_UNICODE_COLLATION2_PROTOCOL * This, + IN UINTN FatSize, + IN CHAR8 *Fat, + OUT CHAR16 *String + ) +/*++ + + Routine Description: + Converts an 8.3 FAT file name in an OEM character set to a Null-terminated + Unicode string. + + Arguments: + This - Protocol instance pointer. + FatSize - The size of the string Fat in bytes. + Fat - A pointer to a Null-terminated string that contains an 8.3 file + name using an OEM character set. + String - A pointer to a Null-terminated Unicode string. The string must + be preallocated to hold FatSize Unicode characters. + Returns: + NONE + +--*/ +; + +typedef +BOOLEAN +(EFIAPI *EFI_UNICODE_COLLATION2_STRTOFAT) ( + IN EFI_UNICODE_COLLATION2_PROTOCOL * This, + IN CHAR16 *String, + IN UINTN FatSize, + OUT CHAR8 *Fat + ) +/*++ + + Routine Description: + Converts a Null-terminated Unicode string to legal characters in a FAT + filename using an OEM character set. + + Arguments: + This - Protocol instance pointer. + String - A pointer to a Null-terminated Unicode string. The string must + be preallocated to hold FatSize Unicode characters. + FatSize - The size of the string Fat in bytes. + Fat - A pointer to a Null-terminated string that contains an 8.3 file + name using an OEM character set. + Returns: + TRUE - Fat is a Long File Name + FALSE - Fat is an 8.3 file name + +--*/ +; + +typedef struct _EFI_UNICODE_COLLATION2_PROTOCOL { + // + // general + // + EFI_UNICODE_COLLATION2_STRICOLL StriColl; + EFI_UNICODE_COLLATION2_METAIMATCH MetaiMatch; + EFI_UNICODE_COLLATION2_STRLWR StrLwr; + EFI_UNICODE_COLLATION2_STRUPR StrUpr; + + // + // for supporting fat volumes + // + EFI_UNICODE_COLLATION2_FATTOSTR FatToStr; + EFI_UNICODE_COLLATION2_STRTOFAT StrToFat; + + CHAR8 *SupportedLanguages; +} EFI_UNICODE_COLLATION2_PROTOCOL; + +extern EFI_GUID gEfiUnicodeCollation2ProtocolGuid; + +#endif -- 2.39.2