1. Import UEFI PxeBc module in MdeModulePkg
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / ComponentName.c
1 /** @file
2
3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. 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 ComponentName.c
14
15 Abstract:
16
17
18 **/
19
20
21 #include "PxeBcImpl.h"
22
23 //
24 // EFI Component Name Functions
25 //
26 EFI_STATUS
27 EFIAPI
28 PxeBcComponentNameGetDriverName (
29 IN EFI_COMPONENT_NAME_PROTOCOL * This,
30 IN CHAR8 *Language,
31 OUT CHAR16 **DriverName
32 );
33
34 EFI_STATUS
35 EFIAPI
36 PxeBcComponentNameGetControllerName (
37 IN EFI_COMPONENT_NAME_PROTOCOL * This,
38 IN EFI_HANDLE ControllerHandle,
39 IN EFI_HANDLE ChildHandle OPTIONAL,
40 IN CHAR8 *Language,
41 OUT CHAR16 **ControllerName
42 );
43
44 //
45 // EFI Component Name Protocol
46 //
47 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
48 PxeBcComponentNameGetDriverName,
49 PxeBcComponentNameGetControllerName,
50 "eng"
51 };
52 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPxeBcComponentName2 = {
53 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeBcComponentNameGetDriverName,
54 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeBcComponentNameGetControllerName,
55 "en"
56 };
57
58 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
59 {
60 "eng;en",
61 L"UEFI PXE Base Code Driver"
62 },
63 {
64 NULL,
65 NULL
66 }
67 };
68
69 EFI_STATUS
70 EFIAPI
71 PxeBcComponentNameGetDriverName (
72 IN EFI_COMPONENT_NAME_PROTOCOL * This,
73 IN CHAR8 *Language,
74 OUT CHAR16 **DriverName
75 )
76 /*++
77
78 Routine Description:
79 Retrieves a Unicode string that is the user readable name of the EFI Driver.
80
81 Arguments:
82 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
83 Language - A pointer to a three character ISO 639-2 language identifier.
84 This is the language of the driver name that that the caller
85 is requesting, and it must match one of the languages specified
86 in SupportedLanguages. The number of languages supported by a
87 driver is up to the driver writer.
88 DriverName - A pointer to the Unicode string to return. This Unicode string
89 is the name of the driver specified by This in the language
90 specified by Language.
91
92 Returns:
93 EFI_SUCCESS - The Unicode string for the Driver specified by This
94 and the language specified by Language was returned
95 in DriverName.
96 EFI_INVALID_PARAMETER - Language is NULL.
97 EFI_INVALID_PARAMETER - DriverName is NULL.
98 EFI_UNSUPPORTED - The driver specified by This does not support the
99 language specified by Language.
100
101 --*/
102 {
103 return LookupUnicodeString2 (
104 Language,
105 This->SupportedLanguages,
106 mPxeBcDriverNameTable,
107 DriverName,
108 (BOOLEAN)(This == &gPxeBcComponentName)
109 );
110 }
111
112 EFI_STATUS
113 EFIAPI
114 PxeBcComponentNameGetControllerName (
115 IN EFI_COMPONENT_NAME_PROTOCOL * This,
116 IN EFI_HANDLE ControllerHandle,
117 IN EFI_HANDLE ChildHandle OPTIONAL,
118 IN CHAR8 *Language,
119 OUT CHAR16 **ControllerNameString
120 )
121 /*++
122
123 Routine Description:
124 Retrieves a Unicode string that is the user readable name of the controller
125 that is being managed by an EFI Driver.
126
127 Arguments:
128 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
129 ControllerHandle - The handle of a controller that the driver specified by
130 This is managing. This handle specifies the controller
131 whose name is to be returned.
132 ChildHandle - The handle of the child controller to retrieve the name
133 of. This is an optional parameter that may be NULL. It
134 will be NULL for device drivers. It will also be NULL
135 for a bus drivers that wish to retrieve the name of the
136 bus controller. It will not be NULL for a bus driver
137 that wishes to retrieve the name of a child controller.
138 Language - A pointer to a three character ISO 639-2 language
139 identifier. This is the language of the controller name
140 that that the caller is requesting, and it must match one
141 of the languages specified in SupportedLanguages. The
142 number of languages supported by a driver is up to the
143 driver writer.
144 ControllerName - A pointer to the Unicode string to return. This Unicode
145 string is the name of the controller specified by
146 ControllerHandle and ChildHandle in the language specified
147 by Language from the point of view of the driver specified
148 by This.
149
150 Returns:
151 EFI_SUCCESS - The Unicode string for the user readable name in the
152 language specified by Language for the driver
153 specified by This was returned in DriverName.
154 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
155 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
156 EFI_INVALID_PARAMETER - Language is NULL.
157 EFI_INVALID_PARAMETER - ControllerName is NULL.
158 EFI_UNSUPPORTED - The driver specified by This is not currently managing
159 the controller specified by ControllerHandle and
160 ChildHandle.
161 EFI_UNSUPPORTED - The driver specified by This does not support the
162 language specified by Language.
163
164 --*/
165 {
166 return EFI_UNSUPPORTED;
167 }
168