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