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