]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/ComponentName.c
Make EdkModulePkg pass Intel IPF compiler with /W4 /WX switches, solving warning...
[mirror_edk2.git] / EdkModulePkg / Bus / Usb / UsbCbi / Dxe / Cbi0 / ComponentName.c
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ComponentName.c\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
aab6a96a 20#include "cbi.h"\r
878ddf1f 21\r
878ddf1f 22//\r
23// EFI Component Name Protocol\r
24//\r
25EFI_COMPONENT_NAME_PROTOCOL gUsbCbi0ComponentName = {\r
26 UsbCbi0ComponentNameGetDriverName,\r
27 UsbCbi0ComponentNameGetControllerName,\r
28 "eng"\r
29};\r
30\r
31STATIC EFI_UNICODE_STRING_TABLE mUsbCbi0DriverNameTable[] = {\r
32 { "eng", (CHAR16 *) L"Usb Cbi0 Mass Storage Driver" },\r
33 { NULL , NULL }\r
34};\r
35\r
36\r
37EFI_STATUS\r
38EFIAPI\r
39UsbCbi0ComponentNameGetDriverName (\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
52 This is the language of the driver name that that the caller \r
53 is requesting, and it must match one of the languages specified\r
54 in SupportedLanguages. The number of languages supported by a \r
55 driver is up to the driver writer.\r
56 DriverName - A pointer to the Unicode string to return. This Unicode string\r
57 is the name of the driver specified by This in the language \r
58 specified by Language.\r
59\r
60 Returns:\r
61 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
62 and the language specified by Language was returned \r
63 in DriverName.\r
64 EFI_INVALID_PARAMETER - Language is NULL.\r
65 EFI_INVALID_PARAMETER - DriverName is NULL.\r
66 EFI_UNSUPPORTED - The driver specified by This does not support the \r
67 language specified by Language.\r
68\r
69--*/\r
70{\r
71 return LookupUnicodeString (\r
72 Language,\r
73 gUsbCbi0ComponentName.SupportedLanguages,\r
74 mUsbCbi0DriverNameTable,\r
75 DriverName\r
76 );\r
77}\r
78\r
79EFI_STATUS\r
80EFIAPI\r
81UsbCbi0ComponentNameGetControllerName (\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
96 ControllerHandle - The handle of a controller that the driver specified by \r
97 This is managing. This handle specifies the controller \r
98 whose name is to be returned.\r
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
104 that wishes to retrieve the name of a child controller.\r
105 Language - A pointer to a three character ISO 639-2 language \r
106 identifier. This is the language of the controller name \r
107 that that the caller is requesting, and it must match one\r
108 of the languages specified in SupportedLanguages. The \r
109 number of languages supported by a driver is up to the \r
110 driver writer.\r
111 ControllerName - A pointer to the Unicode string to return. This Unicode\r
112 string is the name of the controller specified by \r
113 ControllerHandle and ChildHandle in the language specified\r
114 by Language from the point of view of the driver specified\r
115 by This. \r
116\r
117 Returns:\r
118 EFI_SUCCESS - The Unicode string for the user readable name in the \r
119 language specified by Language for the driver \r
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
125 EFI_UNSUPPORTED - The driver specified by This is not currently managing \r
126 the controller specified by ControllerHandle and \r
127 ChildHandle.\r
128 EFI_UNSUPPORTED - The driver specified by This does not support the \r
129 language specified by Language.\r
130\r
131--*/\r
132{\r
133 EFI_STATUS Status;\r
134 USB_CBI_DEVICE *UsbCbiDev;\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 gUsbCbi0DriverBinding.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 gUsbCbi0DriverBinding.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 UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (UsbAtapi);\r
171\r
172 return LookupUnicodeString (\r
173 Language,\r
174 gUsbCbi0ComponentName.SupportedLanguages,\r
175 UsbCbiDev->ControllerNameTable,\r
176 ControllerName\r
177 );\r
178\r
179}\r