Home | History | Annotate | Download | only in SnpNt32Dxe
      1 /** @file
      2 
      3 Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 Module Name:
     13 
     14   ComponentName.c
     15 
     16 Abstract:
     17 
     18 
     19 **/
     20 
     21 #include "SnpNt32.h"
     22 
     23 //
     24 // EFI Component Name Functions
     25 //
     26 /**
     27   Retrieves a Unicode string that is the user readable name of the driver.
     28 
     29   This function retrieves the user readable name of a driver in the form of a
     30   Unicode string. If the driver specified by This has a user readable name in
     31   the language specified by Language, then a pointer to the driver name is
     32   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
     33   by This does not support the language specified by Language,
     34   then EFI_UNSUPPORTED is returned.
     35 
     36   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
     37                                 EFI_COMPONENT_NAME_PROTOCOL instance.
     38 
     39   @param  Language[in]          A pointer to a Null-terminated ASCII string
     40                                 array indicating the language. This is the
     41                                 language of the driver name that the caller is
     42                                 requesting, and it must match one of the
     43                                 languages specified in SupportedLanguages. The
     44                                 number of languages supported by a driver is up
     45                                 to the driver writer. Language is specified
     46                                 in RFC 4646 or ISO 639-2 language code format.
     47 
     48   @param  DriverName[out]       A pointer to the Unicode string to return.
     49                                 This Unicode string is the name of the
     50                                 driver specified by This in the language
     51                                 specified by Language.
     52 
     53   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
     54                                 This and the language specified by Language was
     55                                 returned in DriverName.
     56 
     57   @retval EFI_INVALID_PARAMETER Language is NULL.
     58 
     59   @retval EFI_INVALID_PARAMETER DriverName is NULL.
     60 
     61   @retval EFI_UNSUPPORTED       The driver specified by This does not support
     62                                 the language specified by Language.
     63 
     64 **/
     65 EFI_STATUS
     66 EFIAPI
     67 SnpNt32DriverComponentNameGetDriverName (
     68   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
     69   IN  CHAR8                        *Language,
     70   OUT CHAR16                       **DriverName
     71   );
     72 
     73 
     74 /**
     75   Retrieves a Unicode string that is the user readable name of the controller
     76   that is being managed by a driver.
     77 
     78   This function retrieves the user readable name of the controller specified by
     79   ControllerHandle and ChildHandle in the form of a Unicode string. If the
     80   driver specified by This has a user readable name in the language specified by
     81   Language, then a pointer to the controller name is returned in ControllerName,
     82   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
     83   managing the controller specified by ControllerHandle and ChildHandle,
     84   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
     85   support the language specified by Language, then EFI_UNSUPPORTED is returned.
     86 
     87   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
     88                                 EFI_COMPONENT_NAME_PROTOCOL instance.
     89 
     90   @param  ControllerHandle[in]  The handle of a controller that the driver
     91                                 specified by This is managing.  This handle
     92                                 specifies the controller whose name is to be
     93                                 returned.
     94 
     95   @param  ChildHandle[in]       The handle of the child controller to retrieve
     96                                 the name of.  This is an optional parameter that
     97                                 may be NULL.  It will be NULL for device
     98                                 drivers.  It will also be NULL for a bus drivers
     99                                 that wish to retrieve the name of the bus
    100                                 controller.  It will not be NULL for a bus
    101                                 driver that wishes to retrieve the name of a
    102                                 child controller.
    103 
    104   @param  Language[in]          A pointer to a Null-terminated ASCII string
    105                                 array indicating the language.  This is the
    106                                 language of the driver name that the caller is
    107                                 requesting, and it must match one of the
    108                                 languages specified in SupportedLanguages. The
    109                                 number of languages supported by a driver is up
    110                                 to the driver writer. Language is specified in
    111                                 RFC 4646 or ISO 639-2 language code format.
    112 
    113   @param  ControllerName[out]   A pointer to the Unicode string to return.
    114                                 This Unicode string is the name of the
    115                                 controller specified by ControllerHandle and
    116                                 ChildHandle in the language specified by
    117                                 Language from the point of view of the driver
    118                                 specified by This.
    119 
    120   @retval EFI_SUCCESS           The Unicode string for the user readable name in
    121                                 the language specified by Language for the
    122                                 driver specified by This was returned in
    123                                 DriverName.
    124 
    125   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
    126 
    127   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
    128                                 EFI_HANDLE.
    129 
    130   @retval EFI_INVALID_PARAMETER Language is NULL.
    131 
    132   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
    133 
    134   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
    135                                 managing the controller specified by
    136                                 ControllerHandle and ChildHandle.
    137 
    138   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    139                                 the language specified by Language.
    140 
    141 **/
    142 EFI_STATUS
    143 EFIAPI
    144 SnpNt32DriverComponentNameGetControllerName (
    145   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
    146   IN  EFI_HANDLE                                      ControllerHandle,
    147   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
    148   IN  CHAR8                                           *Language,
    149   OUT CHAR16                                          **ControllerName
    150   );
    151 
    152 
    153 //
    154 // EFI Component Name Protocol
    155 //
    156 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gSnpNt32DriverComponentName = {
    157   SnpNt32DriverComponentNameGetDriverName,
    158   SnpNt32DriverComponentNameGetControllerName,
    159   "eng"
    160 };
    161 
    162 //
    163 // EFI Component Name 2 Protocol
    164 //
    165 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSnpNt32DriverComponentName2 = {
    166   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SnpNt32DriverComponentNameGetDriverName,
    167   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SnpNt32DriverComponentNameGetControllerName,
    168   "en"
    169 };
    170 
    171 
    172 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSnpNt32DriverNameTable[] = {
    173   {
    174     "eng;en",
    175     L"SNP NT32 Driver"
    176   },
    177   {
    178     NULL,
    179     NULL
    180   }
    181 };
    182 
    183 /**
    184   Retrieves a Unicode string that is the user readable name of the driver.
    185 
    186   This function retrieves the user readable name of a driver in the form of a
    187   Unicode string. If the driver specified by This has a user readable name in
    188   the language specified by Language, then a pointer to the driver name is
    189   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
    190   by This does not support the language specified by Language,
    191   then EFI_UNSUPPORTED is returned.
    192 
    193   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
    194                                 EFI_COMPONENT_NAME_PROTOCOL instance.
    195 
    196   @param  Language[in]          A pointer to a Null-terminated ASCII string
    197                                 array indicating the language. This is the
    198                                 language of the driver name that the caller is
    199                                 requesting, and it must match one of the
    200                                 languages specified in SupportedLanguages. The
    201                                 number of languages supported by a driver is up
    202                                 to the driver writer. Language is specified
    203                                 in RFC 4646 or ISO 639-2 language code format.
    204 
    205   @param  DriverName[out]       A pointer to the Unicode string to return.
    206                                 This Unicode string is the name of the
    207                                 driver specified by This in the language
    208                                 specified by Language.
    209 
    210   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
    211                                 This and the language specified by Language was
    212                                 returned in DriverName.
    213 
    214   @retval EFI_INVALID_PARAMETER Language is NULL.
    215 
    216   @retval EFI_INVALID_PARAMETER DriverName is NULL.
    217 
    218   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    219                                 the language specified by Language.
    220 
    221 **/
    222 EFI_STATUS
    223 EFIAPI
    224 SnpNt32DriverComponentNameGetDriverName (
    225   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
    226   IN  CHAR8                        *Language,
    227   OUT CHAR16                       **DriverName
    228   )
    229 {
    230   return LookupUnicodeString2 (
    231            Language,
    232            This->SupportedLanguages,
    233            mSnpNt32DriverNameTable,
    234            DriverName,
    235            (BOOLEAN)(This == &gSnpNt32DriverComponentName)
    236            );
    237 }
    238 
    239 /**
    240   Retrieves a Unicode string that is the user readable name of the controller
    241   that is being managed by a driver.
    242 
    243   This function retrieves the user readable name of the controller specified by
    244   ControllerHandle and ChildHandle in the form of a Unicode string. If the
    245   driver specified by This has a user readable name in the language specified by
    246   Language, then a pointer to the controller name is returned in ControllerName,
    247   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
    248   managing the controller specified by ControllerHandle and ChildHandle,
    249   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
    250   support the language specified by Language, then EFI_UNSUPPORTED is returned.
    251 
    252   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
    253                                 EFI_COMPONENT_NAME_PROTOCOL instance.
    254 
    255   @param  ControllerHandle[in]  The handle of a controller that the driver
    256                                 specified by This is managing.  This handle
    257                                 specifies the controller whose name is to be
    258                                 returned.
    259 
    260   @param  ChildHandle[in]       The handle of the child controller to retrieve
    261                                 the name of.  This is an optional parameter that
    262                                 may be NULL.  It will be NULL for device
    263                                 drivers.  It will also be NULL for a bus drivers
    264                                 that wish to retrieve the name of the bus
    265                                 controller.  It will not be NULL for a bus
    266                                 driver that wishes to retrieve the name of a
    267                                 child controller.
    268 
    269   @param  Language[in]          A pointer to a Null-terminated ASCII string
    270                                 array indicating the language.  This is the
    271                                 language of the driver name that the caller is
    272                                 requesting, and it must match one of the
    273                                 languages specified in SupportedLanguages. The
    274                                 number of languages supported by a driver is up
    275                                 to the driver writer. Language is specified in
    276                                 RFC 4646 or ISO 639-2 language code format.
    277 
    278   @param  ControllerName[out]   A pointer to the Unicode string to return.
    279                                 This Unicode string is the name of the
    280                                 controller specified by ControllerHandle and
    281                                 ChildHandle in the language specified by
    282                                 Language from the point of view of the driver
    283                                 specified by This.
    284 
    285   @retval EFI_SUCCESS           The Unicode string for the user readable name in
    286                                 the language specified by Language for the
    287                                 driver specified by This was returned in
    288                                 DriverName.
    289 
    290   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
    291 
    292   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
    293                                 EFI_HANDLE.
    294 
    295   @retval EFI_INVALID_PARAMETER Language is NULL.
    296 
    297   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
    298 
    299   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
    300                                 managing the controller specified by
    301                                 ControllerHandle and ChildHandle.
    302 
    303   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    304                                 the language specified by Language.
    305 
    306 **/
    307 EFI_STATUS
    308 EFIAPI
    309 SnpNt32DriverComponentNameGetControllerName (
    310   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
    311   IN  EFI_HANDLE                                      ControllerHandle,
    312   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
    313   IN  CHAR8                                           *Language,
    314   OUT CHAR16                                          **ControllerName
    315   )
    316 {
    317   return EFI_UNSUPPORTED;
    318 }
    319