]>
Commit | Line | Data |
---|---|---|
804405e7 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | ComponentName.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | --*/\r | |
19 | \r | |
20 | #include "UnixBlockIo.h"\r | |
21 | \r | |
22 | //\r | |
23 | // EFI Component Name Functions\r | |
24 | //\r | |
25 | EFI_STATUS\r | |
26 | EFIAPI\r | |
27 | UnixBlockIoComponentNameGetDriverName (\r | |
28 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
29 | IN CHAR8 *Language,\r | |
30 | OUT CHAR16 **DriverName\r | |
31 | );\r | |
32 | \r | |
33 | EFI_STATUS\r | |
34 | EFIAPI\r | |
35 | UnixBlockIoComponentNameGetControllerName (\r | |
36 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
37 | IN EFI_HANDLE ControllerHandle,\r | |
38 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
39 | IN CHAR8 *Language,\r | |
40 | OUT CHAR16 **ControllerName\r | |
41 | );\r | |
42 | \r | |
43 | //\r | |
44 | // EFI Component Name Protocol\r | |
45 | //\r | |
46 | EFI_COMPONENT_NAME_PROTOCOL gUnixBlockIoComponentName = {\r | |
47 | UnixBlockIoComponentNameGetDriverName,\r | |
48 | UnixBlockIoComponentNameGetControllerName,\r | |
49 | "eng"\r | |
50 | };\r | |
51 | \r | |
7492c63d | 52 | EFI_UNICODE_STRING_TABLE mUnixBlockIoDriverNameTable[] = {\r |
804405e7 | 53 | { "eng", L"Unix Block I/O Driver" },\r |
54 | { NULL , NULL }\r | |
55 | };\r | |
56 | \r | |
57 | EFI_STATUS\r | |
58 | EFIAPI\r | |
59 | UnixBlockIoComponentNameGetDriverName (\r | |
60 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
61 | IN CHAR8 *Language,\r | |
62 | OUT CHAR16 **DriverName\r | |
63 | )\r | |
64 | /*++\r | |
65 | \r | |
66 | Routine Description:\r | |
67 | Retrieves a Unicode string that is the user readable name of the EFI Driver.\r | |
68 | \r | |
69 | Arguments:\r | |
70 | This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
71 | Language - A pointer to a three character ISO 639-2 language identifier.\r | |
72 | This is the language of the driver name that that the caller \r | |
73 | is requesting, and it must match one of the languages specified\r | |
74 | in SupportedLanguages. The number of languages supported by a \r | |
75 | driver is up to the driver writer.\r | |
76 | DriverName - A pointer to the Unicode string to return. This Unicode string\r | |
77 | is the name of the driver specified by This in the language \r | |
78 | specified by Language.\r | |
79 | \r | |
80 | Returns:\r | |
81 | EFI_SUCCESS - The Unicode string for the Driver specified by This\r | |
82 | and the language specified by Language was returned \r | |
83 | in DriverName.\r | |
84 | EFI_INVALID_PARAMETER - Language is NULL.\r | |
85 | EFI_INVALID_PARAMETER - DriverName is NULL.\r | |
86 | EFI_UNSUPPORTED - The driver specified by This does not support the \r | |
87 | language specified by Language.\r | |
88 | \r | |
89 | --*/\r | |
90 | {\r | |
91 | return LookupUnicodeString (\r | |
92 | Language,\r | |
93 | gUnixBlockIoComponentName.SupportedLanguages,\r | |
94 | mUnixBlockIoDriverNameTable,\r | |
95 | DriverName\r | |
96 | );\r | |
97 | }\r | |
98 | \r | |
99 | EFI_STATUS\r | |
100 | EFIAPI\r | |
101 | UnixBlockIoComponentNameGetControllerName (\r | |
102 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
103 | IN EFI_HANDLE ControllerHandle,\r | |
104 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
105 | IN CHAR8 *Language,\r | |
106 | OUT CHAR16 **ControllerName\r | |
107 | )\r | |
108 | /*++\r | |
109 | \r | |
110 | Routine Description:\r | |
111 | Retrieves a Unicode string that is the user readable name of the controller\r | |
112 | that is being managed by an EFI Driver.\r | |
113 | \r | |
114 | Arguments:\r | |
115 | This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
116 | ControllerHandle - The handle of a controller that the driver specified by \r | |
117 | This is managing. This handle specifies the controller \r | |
118 | whose name is to be returned.\r | |
119 | ChildHandle - The handle of the child controller to retrieve the name \r | |
120 | of. This is an optional parameter that may be NULL. It \r | |
121 | will be NULL for device drivers. It will also be NULL \r | |
122 | for a bus drivers that wish to retrieve the name of the \r | |
123 | bus controller. It will not be NULL for a bus driver \r | |
124 | that wishes to retrieve the name of a child controller.\r | |
125 | Language - A pointer to a three character ISO 639-2 language \r | |
126 | identifier. This is the language of the controller name \r | |
127 | that that the caller is requesting, and it must match one\r | |
128 | of the languages specified in SupportedLanguages. The \r | |
129 | number of languages supported by a driver is up to the \r | |
130 | driver writer.\r | |
131 | ControllerName - A pointer to the Unicode string to return. This Unicode\r | |
132 | string is the name of the controller specified by \r | |
133 | ControllerHandle and ChildHandle in the language specified\r | |
134 | by Language from the point of view of the driver specified\r | |
135 | by This. \r | |
136 | \r | |
137 | Returns:\r | |
138 | EFI_SUCCESS - The Unicode string for the user readable name in the \r | |
139 | language specified by Language for the driver \r | |
140 | specified by This was returned in DriverName.\r | |
141 | EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r | |
142 | EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r | |
143 | EFI_INVALID_PARAMETER - Language is NULL.\r | |
144 | EFI_INVALID_PARAMETER - ControllerName is NULL.\r | |
145 | EFI_UNSUPPORTED - The driver specified by This is not currently managing \r | |
146 | the controller specified by ControllerHandle and \r | |
147 | ChildHandle.\r | |
148 | EFI_UNSUPPORTED - The driver specified by This does not support the \r | |
149 | language specified by Language.\r | |
150 | \r | |
151 | --*/\r | |
152 | {\r | |
153 | EFI_STATUS Status;\r | |
154 | EFI_BLOCK_IO_PROTOCOL *BlockIo;\r | |
155 | UNIX_BLOCK_IO_PRIVATE *Private;\r | |
156 | \r | |
157 | //\r | |
158 | // This is a device driver, so ChildHandle must be NULL.\r | |
159 | //\r | |
160 | if (ChildHandle != NULL) {\r | |
161 | return EFI_UNSUPPORTED;\r | |
162 | }\r | |
163 | //\r | |
164 | // Make sure this driver is currently managing ControllerHandle\r | |
165 | //\r | |
166 | Status = EfiTestManagedDevice (\r | |
167 | ControllerHandle,\r | |
168 | gUnixBlockIoDriverBinding.DriverBindingHandle,\r | |
169 | &gEfiUnixIoProtocolGuid\r | |
170 | );\r | |
171 | if (EFI_ERROR (Status)) {\r | |
172 | return EFI_UNSUPPORTED;\r | |
173 | }\r | |
174 | //\r | |
175 | // Get our context back\r | |
176 | //\r | |
177 | Status = gBS->OpenProtocol (\r | |
178 | ControllerHandle,\r | |
179 | &gEfiBlockIoProtocolGuid,\r | |
180 | (void *)&BlockIo,\r | |
181 | gUnixBlockIoDriverBinding.DriverBindingHandle,\r | |
182 | ControllerHandle,\r | |
183 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
184 | );\r | |
185 | if (EFI_ERROR (Status)) {\r | |
186 | return EFI_UNSUPPORTED;\r | |
187 | }\r | |
188 | \r | |
189 | Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);\r | |
190 | \r | |
191 | return LookupUnicodeString (\r | |
192 | Language,\r | |
193 | gUnixBlockIoComponentName.SupportedLanguages,\r | |
194 | Private->ControllerNameTable,\r | |
195 | ControllerName\r | |
196 | );\r | |
197 | }\r |