]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c
Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid...
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / DiskIoDxe / ComponentName.c
... / ...
CommitLineData
1/** @file\r
2 UEFI Component Name(2) protocol implementation for DiskIo driver.\r
3\r
4Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "DiskIo.h"\r
16\r
17//\r
18// EFI Component Name Protocol\r
19//\r
20GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName = {\r
21 DiskIoComponentNameGetDriverName,\r
22 DiskIoComponentNameGetControllerName,\r
23 "eng"\r
24};\r
25\r
26//\r
27// EFI Component Name 2 Protocol\r
28//\r
29GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2 = {\r
30 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DiskIoComponentNameGetDriverName,\r
31 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DiskIoComponentNameGetControllerName,\r
32 "en"\r
33};\r
34\r
35//\r
36// Driver name table for DiskIo module.\r
37// It is shared by the implementation of ComponentName & ComponentName2 Protocol.\r
38//\r
39GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {\r
40 {\r
41 "eng;en",\r
42 (CHAR16 *)L"Generic Disk I/O Driver"\r
43 },\r
44 {\r
45 NULL,\r
46 NULL\r
47 }\r
48};\r
49\r
50\r
51\r
52/**\r
53 Retrieves a Unicode string that is the user readable name of the driver.\r
54\r
55 This function retrieves the user readable name of a driver in the form of a\r
56 Unicode string. If the driver specified by This has a user readable name in\r
57 the language specified by Language, then a pointer to the driver name is\r
58 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
59 by This does not support the language specified by Language,\r
60 then EFI_UNSUPPORTED is returned.\r
61\r
62 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
63 EFI_COMPONENT_NAME_PROTOCOL instance.\r
64\r
65 @param Language[in] A pointer to a Null-terminated ASCII string\r
66 array indicating the language. This is the\r
67 language of the driver name that the caller is\r
68 requesting, and it must match one of the\r
69 languages specified in SupportedLanguages. The\r
70 number of languages supported by a driver is up\r
71 to the driver writer. Language is specified\r
72 in RFC 4646 or ISO 639-2 language code format.\r
73\r
74 @param DriverName[out] A pointer to the Unicode string to return.\r
75 This Unicode string is the name of the\r
76 driver specified by This in the language\r
77 specified by Language.\r
78\r
79 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
80 This and the language specified by Language was\r
81 returned in DriverName.\r
82\r
83 @retval EFI_INVALID_PARAMETER Language is NULL.\r
84\r
85 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
86\r
87 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
88 the language specified by Language.\r
89\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
93DiskIoComponentNameGetDriverName (\r
94 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
95 IN CHAR8 *Language,\r
96 OUT CHAR16 **DriverName\r
97 )\r
98{\r
99 return LookupUnicodeString2 (\r
100 Language,\r
101 This->SupportedLanguages,\r
102 mDiskIoDriverNameTable,\r
103 DriverName,\r
104 (BOOLEAN)(This == &gDiskIoComponentName)\r
105 );\r
106}\r
107\r
108\r
109\r
110/**\r
111 Retrieves a Unicode string that is the user readable name of the controller\r
112 that is being managed by a driver.\r
113\r
114 This function retrieves the user readable name of the controller specified by\r
115 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
116 driver specified by This has a user readable name in the language specified by\r
117 Language, then a pointer to the controller name is returned in ControllerName,\r
118 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
119 managing the controller specified by ControllerHandle and ChildHandle,\r
120 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
121 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
122\r
123 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
124 EFI_COMPONENT_NAME_PROTOCOL instance.\r
125\r
126 @param ControllerHandle[in] The handle of a controller that the driver\r
127 specified by This is managing. This handle\r
128 specifies the controller whose name is to be\r
129 returned.\r
130\r
131 @param ChildHandle[in] The handle of the child controller to retrieve\r
132 the name of. This is an optional parameter that\r
133 may be NULL. It will be NULL for device\r
134 drivers. It will also be NULL for a bus drivers\r
135 that wish to retrieve the name of the bus\r
136 controller. It will not be NULL for a bus\r
137 driver that wishes to retrieve the name of a\r
138 child controller.\r
139\r
140 @param Language[in] A pointer to a Null-terminated ASCII string\r
141 array indicating the language. This is the\r
142 language of the driver name that the caller is\r
143 requesting, and it must match one of the\r
144 languages specified in SupportedLanguages. The\r
145 number of languages supported by a driver is up\r
146 to the driver writer. Language is specified in\r
147 RFC 4646 or ISO 639-2 language code format.\r
148\r
149 @param ControllerName[out] A pointer to the Unicode string to return.\r
150 This Unicode string is the name of the\r
151 controller specified by ControllerHandle and\r
152 ChildHandle in the language specified by\r
153 Language from the point of view of the driver\r
154 specified by This.\r
155\r
156 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
157 the language specified by Language for the\r
158 driver specified by This was returned in\r
159 DriverName.\r
160\r
161 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
162\r
163 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
164 EFI_HANDLE.\r
165\r
166 @retval EFI_INVALID_PARAMETER Language is NULL.\r
167\r
168 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
169\r
170 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
171 managing the controller specified by\r
172 ControllerHandle and ChildHandle.\r
173\r
174 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
175 the language specified by Language.\r
176\r
177**/\r
178EFI_STATUS\r
179EFIAPI\r
180DiskIoComponentNameGetControllerName (\r
181 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
182 IN EFI_HANDLE ControllerHandle,\r
183 IN EFI_HANDLE ChildHandle OPTIONAL,\r
184 IN CHAR8 *Language,\r
185 OUT CHAR16 **ControllerName\r
186 )\r
187{\r
188 return EFI_UNSUPPORTED;\r
189}\r