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