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