Home | History | Annotate | Download | only in ConPlatformDxe
      1 /** @file
      2   UEFI Component Name(2) protocol implementation for ConPlatform driver.
      3 
      4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
      5 This program and the accompanying materials
      6 are licensed and made available under the terms and conditions of the BSD License
      7 which accompanies this distribution.  The full text of the license may be found at
      8 http://opensource.org/licenses/bsd-license.php
      9 
     10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #include "ConPlatform.h"
     16 
     17 //
     18 // EFI Component Name Protocol
     19 //
     20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gConPlatformComponentName = {
     21   ConPlatformComponentNameGetDriverName,
     22   ConPlatformComponentNameGetControllerName,
     23   "eng"
     24 };
     25 
     26 //
     27 // EFI Component Name 2 Protocol
     28 //
     29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2 = {
     30   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConPlatformComponentNameGetDriverName,
     31   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConPlatformComponentNameGetControllerName,
     32   "en"
     33 };
     34 
     35 
     36 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {
     37   {
     38     "eng;en",
     39     L"Platform Console Management Driver"
     40   },
     41   {
     42     NULL,
     43     NULL
     44   }
     45 };
     46 
     47 /**
     48   Retrieves a Unicode string that is the user readable name of the driver.
     49 
     50   This function retrieves the user readable name of a driver in the form of a
     51   Unicode string. If the driver specified by This has a user readable name in
     52   the language specified by Language, then a pointer to the driver name is
     53   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
     54   by This does not support the language specified by Language,
     55   then EFI_UNSUPPORTED is returned.
     56 
     57   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
     58                                 EFI_COMPONENT_NAME_PROTOCOL instance.
     59   @param  Language[in]          A pointer to a Null-terminated ASCII string
     60                                 array indicating the language. This is the
     61                                 language of the driver name that the caller is
     62                                 requesting, and it must match one of the
     63                                 languages specified in SupportedLanguages. The
     64                                 number of languages supported by a driver is up
     65                                 to the driver writer. Language is specified
     66                                 in RFC 4646 or ISO 639-2 language code format.
     67   @param  DriverName[out]       A pointer to the Unicode string to return.
     68                                 This Unicode string is the name of the
     69                                 driver specified by This in the language
     70                                 specified by Language.
     71 
     72   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
     73                                 This and the language specified by Language was
     74                                 returned in DriverName.
     75   @retval EFI_INVALID_PARAMETER Language is NULL.
     76   @retval EFI_INVALID_PARAMETER DriverName is NULL.
     77   @retval EFI_UNSUPPORTED       The driver specified by This does not support
     78                                 the language specified by Language.
     79 
     80 **/
     81 EFI_STATUS
     82 EFIAPI
     83 ConPlatformComponentNameGetDriverName (
     84   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
     85   IN  CHAR8                        *Language,
     86   OUT CHAR16                       **DriverName
     87   )
     88 {
     89   return LookupUnicodeString2 (
     90            Language,
     91            This->SupportedLanguages,
     92            mConPlatformDriverNameTable,
     93            DriverName,
     94            (BOOLEAN)(This == &gConPlatformComponentName)
     95            );
     96 }
     97 
     98 /**
     99   Retrieves a Unicode string that is the user readable name of the controller
    100   that is being managed by a driver.
    101 
    102   This function retrieves the user readable name of the controller specified by
    103   ControllerHandle and ChildHandle in the form of a Unicode string. If the
    104   driver specified by This has a user readable name in the language specified by
    105   Language, then a pointer to the controller name is returned in ControllerName,
    106   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
    107   managing the controller specified by ControllerHandle and ChildHandle,
    108   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
    109   support the language specified by Language, then EFI_UNSUPPORTED is returned.
    110 
    111   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
    112                                 EFI_COMPONENT_NAME_PROTOCOL instance.
    113   @param  ControllerHandle[in]  The handle of a controller that the driver
    114                                 specified by This is managing.  This handle
    115                                 specifies the controller whose name is to be
    116                                 returned.
    117   @param  ChildHandle[in]       The handle of the child controller to retrieve
    118                                 the name of.  This is an optional parameter that
    119                                 may be NULL.  It will be NULL for device
    120                                 drivers.  It will also be NULL for a bus drivers
    121                                 that wish to retrieve the name of the bus
    122                                 controller.  It will not be NULL for a bus
    123                                 driver that wishes to retrieve the name of a
    124                                 child controller.
    125   @param  Language[in]          A pointer to a Null-terminated ASCII string
    126                                 array indicating the language.  This is the
    127                                 language of the driver name that the caller is
    128                                 requesting, and it must match one of the
    129                                 languages specified in SupportedLanguages. The
    130                                 number of languages supported by a driver is up
    131                                 to the driver writer. Language is specified in
    132                                 RFC 4646 or ISO 639-2 language code format.
    133   @param  ControllerName[out]   A pointer to the Unicode string to return.
    134                                 This Unicode string is the name of the
    135                                 controller specified by ControllerHandle and
    136                                 ChildHandle in the language specified by
    137                                 Language from the point of view of the driver
    138                                 specified by This.
    139 
    140   @retval EFI_SUCCESS           The Unicode string for the user readable name in
    141                                 the language specified by Language for the
    142                                 driver specified by This was returned in
    143                                 DriverName.
    144   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
    145   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
    146                                 EFI_HANDLE.
    147   @retval EFI_INVALID_PARAMETER Language is NULL.
    148   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
    149   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
    150                                 managing the controller specified by
    151                                 ControllerHandle and ChildHandle.
    152   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    153                                 the language specified by Language.
    154 
    155 **/
    156 EFI_STATUS
    157 EFIAPI
    158 ConPlatformComponentNameGetControllerName (
    159   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
    160   IN  EFI_HANDLE                                      ControllerHandle,
    161   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
    162   IN  CHAR8                                           *Language,
    163   OUT CHAR16                                          **ControllerName
    164   )
    165 {
    166   return EFI_UNSUPPORTED;
    167 }
    168