]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Disk/PartitionDxe/ComponentName.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / ComponentName.c
CommitLineData
adbcbf8f 1/** @file\r
2 UEFI Component Name protocol for Partition driver.\r
adbcbf8f 3\r
284ee2e8 4Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
adbcbf8f 6\r
7**/\r
8\r
9#include "Partition.h"\r
10\r
11//\r
12// EFI Component Name Protocol\r
13//\r
1307dcd7 14GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName = {\r
adbcbf8f 15 PartitionComponentNameGetDriverName,\r
16 PartitionComponentNameGetControllerName,\r
17 "eng"\r
1307dcd7 18};\r
d38a0f44 19\r
20//\r
21// EFI Component Name 2 Protocol\r
22//\r
1307dcd7 23GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2 = {\r
d38a0f44 24 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PartitionComponentNameGetDriverName,\r
25 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PartitionComponentNameGetControllerName,\r
26 "en"\r
1307dcd7 27};\r
d38a0f44 28\r
ff61847d 29//\r
30// Driver name table for Partition module.\r
31// It is shared by the implementation of ComponentName & ComponentName2 Protocol.\r
32//\r
d1aeb0bd 33GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {\r
adbcbf8f 34 {\r
d38a0f44 35 "eng;en",\r
ff61847d 36 L"Partition Driver(MBR/GPT/El Torito)"\r
adbcbf8f 37 },\r
38 {\r
39 NULL,\r
40 NULL\r
41 }\r
42};\r
43\r
44\r
45\r
46/**\r
d38a0f44 47 Retrieves a Unicode string that is the user readable name of the driver.\r
48\r
49 This function retrieves the user readable name of a driver in the form of a\r
50 Unicode string. If the driver specified by This has a user readable name in\r
51 the language specified by Language, then a pointer to the driver name is\r
52 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
53 by This does not support the language specified by Language,\r
54 then EFI_UNSUPPORTED is returned.\r
55\r
56 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
57 EFI_COMPONENT_NAME_PROTOCOL instance.\r
58\r
59 @param Language[in] A pointer to a Null-terminated ASCII string\r
60 array indicating the language. This is the\r
61 language of the driver name that the caller is\r
62 requesting, and it must match one of the\r
63 languages specified in SupportedLanguages. The\r
64 number of languages supported by a driver is up\r
65 to the driver writer. Language is specified\r
0254efc0 66 in RFC 4646 or ISO 639-2 language code format.\r
d38a0f44 67\r
68 @param DriverName[out] A pointer to the Unicode string to return.\r
69 This Unicode string is the name of the\r
70 driver specified by This in the language\r
71 specified by Language.\r
72\r
73 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
74 This and the language specified by Language was\r
75 returned in DriverName.\r
adbcbf8f 76\r
adbcbf8f 77 @retval EFI_INVALID_PARAMETER Language is NULL.\r
d38a0f44 78\r
adbcbf8f 79 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
d38a0f44 80\r
81 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
82 the language specified by Language.\r
adbcbf8f 83\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87PartitionComponentNameGetDriverName (\r
88 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
89 IN CHAR8 *Language,\r
90 OUT CHAR16 **DriverName\r
91 )\r
92{\r
d38a0f44 93 return LookupUnicodeString2 (\r
94 Language,\r
95 This->SupportedLanguages,\r
96 mPartitionDriverNameTable,\r
97 DriverName,\r
98 (BOOLEAN)(This == &gPartitionComponentName)\r
99 );\r
adbcbf8f 100}\r
101\r
102\r
103/**\r
d38a0f44 104 Retrieves a Unicode string that is the user readable name of the controller\r
105 that is being managed by a driver.\r
106\r
107 This function retrieves the user readable name of the controller specified by\r
108 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
109 driver specified by This has a user readable name in the language specified by\r
110 Language, then a pointer to the controller name is returned in ControllerName,\r
111 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
112 managing the controller specified by ControllerHandle and ChildHandle,\r
113 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
114 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
115\r
116 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
117 EFI_COMPONENT_NAME_PROTOCOL instance.\r
118\r
119 @param ControllerHandle[in] The handle of a controller that the driver\r
120 specified by This is managing. This handle\r
121 specifies the controller whose name is to be\r
122 returned.\r
123\r
124 @param ChildHandle[in] The handle of the child controller to retrieve\r
125 the name of. This is an optional parameter that\r
126 may be NULL. It will be NULL for device\r
127 drivers. It will also be NULL for a bus drivers\r
128 that wish to retrieve the name of the bus\r
129 controller. It will not be NULL for a bus\r
130 driver that wishes to retrieve the name of a\r
131 child controller.\r
132\r
133 @param Language[in] A pointer to a Null-terminated ASCII string\r
134 array indicating the language. This is the\r
135 language of the driver name that the caller is\r
136 requesting, and it must match one of the\r
137 languages specified in SupportedLanguages. The\r
138 number of languages supported by a driver is up\r
139 to the driver writer. Language is specified in\r
0254efc0 140 RFC 4646 or ISO 639-2 language code format.\r
d38a0f44 141\r
142 @param ControllerName[out] A pointer to the Unicode string to return.\r
143 This Unicode string is the name of the\r
144 controller specified by ControllerHandle and\r
145 ChildHandle in the language specified by\r
146 Language from the point of view of the driver\r
147 specified by This.\r
148\r
149 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
150 the language specified by Language for the\r
151 driver specified by This was returned in\r
152 DriverName.\r
153\r
284ee2e8 154 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
d38a0f44 155\r
156 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
adbcbf8f 157 EFI_HANDLE.\r
158\r
adbcbf8f 159 @retval EFI_INVALID_PARAMETER Language is NULL.\r
160\r
161 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
162\r
d38a0f44 163 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
164 managing the controller specified by\r
165 ControllerHandle and ChildHandle.\r
adbcbf8f 166\r
d38a0f44 167 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
168 the language specified by Language.\r
adbcbf8f 169\r
170**/\r
171EFI_STATUS\r
172EFIAPI\r
173PartitionComponentNameGetControllerName (\r
174 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
175 IN EFI_HANDLE ControllerHandle,\r
176 IN EFI_HANDLE ChildHandle OPTIONAL,\r
177 IN CHAR8 *Language,\r
178 OUT CHAR16 **ControllerName\r
179 )\r
180{\r
181 return EFI_UNSUPPORTED;\r
182}\r