]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | \r | |
4d1fe68e | 3 | Copyright (c) 2006, 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 | |
878ddf1f | 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 "bot.h"\r | |
21 | \r | |
878ddf1f | 22 | //\r |
23 | // EFI Component Name Protocol\r | |
24 | //\r | |
25 | EFI_COMPONENT_NAME_PROTOCOL gUsbBotComponentName = {\r | |
26 | UsbBotComponentNameGetDriverName,\r | |
27 | UsbBotComponentNameGetControllerName,\r | |
28 | "eng"\r | |
29 | };\r | |
30 | \r | |
31 | STATIC EFI_UNICODE_STRING_TABLE mUsbBotDriverNameTable[] = {\r | |
32 | { "eng", (CHAR16 *) L"Usb Bot Mass Storage Driver" },\r | |
33 | { NULL , NULL }\r | |
34 | };\r | |
35 | \r | |
36 | \r | |
37 | EFI_STATUS\r | |
38 | EFIAPI\r | |
39 | UsbBotComponentNameGetDriverName (\r | |
40 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
41 | IN CHAR8 *Language,\r | |
42 | OUT CHAR16 **DriverName\r | |
43 | )\r | |
44 | /*++\r | |
45 | \r | |
46 | Routine Description:\r | |
47 | Retrieves a Unicode string that is the user readable name of the EFI Driver.\r | |
48 | \r | |
49 | Arguments:\r | |
50 | This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
51 | Language - A pointer to a three character ISO 639-2 language identifier.\r | |
4d1fe68e | 52 | This is the language of the driver name that that the caller\r |
878ddf1f | 53 | is requesting, and it must match one of the languages specified\r |
4d1fe68e | 54 | in SupportedLanguages. The number of languages supported by a\r |
878ddf1f | 55 | driver is up to the driver writer.\r |
56 | DriverName - A pointer to the Unicode string to return. This Unicode string\r | |
4d1fe68e | 57 | is the name of the driver specified by This in the language\r |
878ddf1f | 58 | specified by Language.\r |
59 | \r | |
60 | Returns:\r | |
61 | EFI_SUCCESS - The Unicode string for the Driver specified by This\r | |
4d1fe68e | 62 | and the language specified by Language was returned\r |
878ddf1f | 63 | in DriverName.\r |
64 | EFI_INVALID_PARAMETER - Language is NULL.\r | |
65 | EFI_INVALID_PARAMETER - DriverName is NULL.\r | |
4d1fe68e | 66 | EFI_UNSUPPORTED - The driver specified by This does not support the\r |
878ddf1f | 67 | language specified by Language.\r |
68 | \r | |
69 | --*/\r | |
70 | {\r | |
71 | return LookupUnicodeString (\r | |
72 | Language,\r | |
73 | gUsbBotComponentName.SupportedLanguages,\r | |
74 | mUsbBotDriverNameTable,\r | |
75 | DriverName\r | |
76 | );\r | |
77 | }\r | |
78 | \r | |
79 | EFI_STATUS\r | |
80 | EFIAPI\r | |
81 | UsbBotComponentNameGetControllerName (\r | |
82 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
83 | IN EFI_HANDLE ControllerHandle,\r | |
84 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
85 | IN CHAR8 *Language,\r | |
86 | OUT CHAR16 **ControllerName\r | |
87 | )\r | |
88 | /*++\r | |
89 | \r | |
90 | Routine Description:\r | |
91 | Retrieves a Unicode string that is the user readable name of the controller\r | |
92 | that is being managed by an EFI Driver.\r | |
93 | \r | |
94 | Arguments:\r | |
95 | This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
4d1fe68e | 96 | ControllerHandle - The handle of a controller that the driver specified by\r |
97 | This is managing. This handle specifies the controller\r | |
878ddf1f | 98 | whose name is to be returned.\r |
4d1fe68e | 99 | ChildHandle - The handle of the child controller to retrieve the name\r |
100 | of. This is an optional parameter that may be NULL. It\r | |
101 | will be NULL for device drivers. It will also be NULL\r | |
102 | for a bus drivers that wish to retrieve the name of the\r | |
103 | bus controller. It will not be NULL for a bus driver\r | |
878ddf1f | 104 | that wishes to retrieve the name of a child controller.\r |
4d1fe68e | 105 | Language - A pointer to a three character ISO 639-2 language\r |
106 | identifier. This is the language of the controller name\r | |
878ddf1f | 107 | that that the caller is requesting, and it must match one\r |
4d1fe68e | 108 | of the languages specified in SupportedLanguages. The\r |
109 | number of languages supported by a driver is up to the\r | |
878ddf1f | 110 | driver writer.\r |
111 | ControllerName - A pointer to the Unicode string to return. This Unicode\r | |
4d1fe68e | 112 | string is the name of the controller specified by\r |
878ddf1f | 113 | ControllerHandle and ChildHandle in the language specified\r |
114 | by Language from the point of view of the driver specified\r | |
4d1fe68e | 115 | by This.\r |
878ddf1f | 116 | \r |
117 | Returns:\r | |
4d1fe68e | 118 | EFI_SUCCESS - The Unicode string for the user readable name in the\r |
119 | language specified by Language for the driver\r | |
878ddf1f | 120 | specified by This was returned in DriverName.\r |
121 | EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r | |
122 | EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r | |
123 | EFI_INVALID_PARAMETER - Language is NULL.\r | |
124 | EFI_INVALID_PARAMETER - ControllerName is NULL.\r | |
4d1fe68e | 125 | EFI_UNSUPPORTED - The driver specified by This is not currently managing\r |
126 | the controller specified by ControllerHandle and\r | |
878ddf1f | 127 | ChildHandle.\r |
4d1fe68e | 128 | EFI_UNSUPPORTED - The driver specified by This does not support the\r |
878ddf1f | 129 | language specified by Language.\r |
130 | \r | |
131 | --*/\r | |
132 | {\r | |
133 | EFI_STATUS Status;\r | |
134 | USB_BOT_DEVICE *UsbBotDev;\r | |
135 | EFI_USB_ATAPI_PROTOCOL *UsbAtapi;\r | |
136 | \r | |
137 | //\r | |
138 | // This is a device driver, so ChildHandle must be NULL.\r | |
139 | //\r | |
140 | if (ChildHandle != NULL) {\r | |
141 | return EFI_UNSUPPORTED;\r | |
142 | }\r | |
61fb1657 | 143 | //\r |
144 | // Make sure this driver is currently managing ControllerHandle\r | |
145 | //\r | |
146 | Status = EfiTestManagedDevice (\r | |
147 | ControllerHandle,\r | |
148 | gUsbBotDriverBinding.DriverBindingHandle,\r | |
149 | &gEfiUsbIoProtocolGuid\r | |
150 | );\r | |
151 | if (EFI_ERROR (Status)) {\r | |
152 | return Status;\r | |
153 | }\r | |
878ddf1f | 154 | //\r |
155 | // Get the device context\r | |
156 | //\r | |
157 | Status = gBS->OpenProtocol (\r | |
158 | ControllerHandle,\r | |
159 | &gEfiUsbAtapiProtocolGuid,\r | |
160 | (VOID **) &UsbAtapi,\r | |
161 | gUsbBotDriverBinding.DriverBindingHandle,\r | |
162 | ControllerHandle,\r | |
163 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
164 | );\r | |
165 | \r | |
166 | if (EFI_ERROR (Status)) {\r | |
167 | return Status;\r | |
168 | }\r | |
169 | \r | |
170 | UsbBotDev = USB_BOT_DEVICE_FROM_THIS (UsbAtapi);\r | |
171 | \r | |
172 | return LookupUnicodeString (\r | |
173 | Language,\r | |
174 | gUsbBotComponentName.SupportedLanguages,\r | |
175 | UsbBotDev->ControllerNameTable,\r | |
176 | ControllerName\r | |
177 | );\r | |
178 | \r | |
179 | }\r |