1 /** @file
2   UEFI Component Name(2) protocol implementation for VGA Class 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 "VgaClass.h"
16 
17 //
18 // EFI Component Name Protocol
19 //
20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gVgaClassComponentName = {
21   VgaClassComponentNameGetDriverName,
22   VgaClassComponentNameGetControllerName,
23   "eng"
24 };
25 
26 //
27 // EFI Component Name 2 Protocol
28 //
29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gVgaClassComponentName2 = {
30   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) VgaClassComponentNameGetDriverName,
31   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) VgaClassComponentNameGetControllerName,
32   "en"
33 };
34 
35 
36 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVgaClassDriverNameTable[] = {
37   {
38     "eng;en",
39     L"VGA Class 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                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
58                                 EFI_COMPONENT_NAME_PROTOCOL instance.
59   @param  Language              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            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
VgaClassComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN CHAR8 * Language,OUT CHAR16 ** DriverName)83 VgaClassComponentNameGetDriverName (
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            mVgaClassDriverNameTable,
93            DriverName,
94            (BOOLEAN)(This == &gVgaClassComponentName)
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                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
112                                 EFI_COMPONENT_NAME_PROTOCOL instance.
113   @param  ControllerHandle      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           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              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        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
VgaClassComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)158 VgaClassComponentNameGetControllerName (
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