Home | History | Annotate | Download | only in VgaMiniPortDxe
      1 /** @file
      2   Implements EFI Component Name Protocol for VGA Mini Port 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 "VgaMiniPort.h"
     16 
     17 
     18 //
     19 // EFI Component Name Protocol
     20 //
     21 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gPciVgaMiniPortComponentName = {
     22   PciVgaMiniPortComponentNameGetDriverName,
     23   PciVgaMiniPortComponentNameGetControllerName,
     24   "eng"
     25 };
     26 
     27 //
     28 // EFI Component Name 2 Protocol
     29 //
     30 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2 = {
     31   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PciVgaMiniPortComponentNameGetDriverName,
     32   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PciVgaMiniPortComponentNameGetControllerName,
     33   "en"
     34 };
     35 
     36 
     37 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPciVgaMiniPortDriverNameTable[] = {
     38   {
     39     "eng;en",
     40     L"PCI VGA Mini Port Driver"
     41   },
     42   {
     43     NULL,
     44     NULL
     45   }
     46 };
     47 
     48 /**
     49   Retrieves a Unicode string that is the user readable name of the driver.
     50 
     51   This function retrieves the user readable name of a driver in the form of a
     52   Unicode string. If the driver specified by This has a user readable name in
     53   the language specified by Language, then a pointer to the driver name is
     54   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
     55   by This does not support the language specified by Language,
     56   then EFI_UNSUPPORTED is returned.
     57 
     58   @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
     59                                 EFI_COMPONENT_NAME_PROTOCOL instance.
     60   @param  Language              A pointer to a Null-terminated ASCII string
     61                                 array indicating the language. This is the
     62                                 language of the driver name that the caller is
     63                                 requesting, and it must match one of the
     64                                 languages specified in SupportedLanguages. The
     65                                 number of languages supported by a driver is up
     66                                 to the driver writer. Language is specified
     67                                 in RFC 4646 or ISO 639-2 language code format.
     68   @param  DriverName            A pointer to the Unicode string to return.
     69                                 This Unicode string is the name of the
     70                                 driver specified by This in the language
     71                                 specified by Language.
     72 
     73   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
     74                                 This and the language specified by Language was
     75                                 returned in DriverName.
     76   @retval EFI_INVALID_PARAMETER Language is NULL.
     77   @retval EFI_INVALID_PARAMETER DriverName is NULL.
     78   @retval EFI_UNSUPPORTED       The driver specified by This does not support
     79                                 the language specified by Language.
     80 
     81 **/
     82 EFI_STATUS
     83 EFIAPI
     84 PciVgaMiniPortComponentNameGetDriverName (
     85   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
     86   IN  CHAR8                        *Language,
     87   OUT CHAR16                       **DriverName
     88   )
     89 {
     90   return LookupUnicodeString2 (
     91            Language,
     92            This->SupportedLanguages,
     93            mPciVgaMiniPortDriverNameTable,
     94            DriverName,
     95            (BOOLEAN)(This == &gPciVgaMiniPortComponentName)
     96            );
     97 }
     98 
     99 /**
    100   Retrieves a Unicode string that is the user readable name of the controller
    101   that is being managed by a driver.
    102 
    103   This function retrieves the user readable name of the controller specified by
    104   ControllerHandle and ChildHandle in the form of a Unicode string. If the
    105   driver specified by This has a user readable name in the language specified by
    106   Language, then a pointer to the controller name is returned in ControllerName,
    107   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
    108   managing the controller specified by ControllerHandle and ChildHandle,
    109   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
    110   support the language specified by Language, then EFI_UNSUPPORTED is returned.
    111 
    112   @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
    113                                 EFI_COMPONENT_NAME_PROTOCOL instance.
    114   @param  ControllerHandle      The handle of a controller that the driver
    115                                 specified by This is managing.  This handle
    116                                 specifies the controller whose name is to be
    117                                 returned.
    118   @param  ChildHandle           The handle of the child controller to retrieve
    119                                 the name of.  This is an optional parameter that
    120                                 may be NULL.  It will be NULL for device
    121                                 drivers.  It will also be NULL for a bus drivers
    122                                 that wish to retrieve the name of the bus
    123                                 controller.  It will not be NULL for a bus
    124                                 driver that wishes to retrieve the name of a
    125                                 child controller.
    126   @param  Language              A pointer to a Null-terminated ASCII string
    127                                 array indicating the language.  This is the
    128                                 language of the driver name that the caller is
    129                                 requesting, and it must match one of the
    130                                 languages specified in SupportedLanguages. The
    131                                 number of languages supported by a driver is up
    132                                 to the driver writer. Language is specified in
    133                                 RFC 4646 or ISO 639-2 language code format.
    134   @param  ControllerName        A pointer to the Unicode string to return.
    135                                 This Unicode string is the name of the
    136                                 controller specified by ControllerHandle and
    137                                 ChildHandle in the language specified by
    138                                 Language from the point of view of the driver
    139                                 specified by This.
    140 
    141   @retval EFI_SUCCESS           The Unicode string for the user readable name in
    142                                 the language specified by Language for the
    143                                 driver specified by This was returned in
    144                                 DriverName.
    145   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
    146   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
    147                                 EFI_HANDLE.
    148   @retval EFI_INVALID_PARAMETER Language is NULL.
    149   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
    150   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
    151                                 managing the controller specified by
    152                                 ControllerHandle and ChildHandle.
    153   @retval EFI_UNSUPPORTED       The driver specified by This does not support
    154                                 the language specified by Language.
    155 
    156 **/
    157 EFI_STATUS
    158 EFIAPI
    159 PciVgaMiniPortComponentNameGetControllerName (
    160   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
    161   IN  EFI_HANDLE                                      ControllerHandle,
    162   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
    163   IN  CHAR8                                           *Language,
    164   OUT CHAR16                                          **ControllerName
    165   )
    166 {
    167   return EFI_UNSUPPORTED;
    168 }
    169