]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Scsi/ScsiBusDxe/ComponentName.c
Add compiler hint of "GLOBAL_REMOVE_IF_UNREFERENCED" to prevent static unicode string...
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiBusDxe / ComponentName.c
CommitLineData
3a10d471 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
ed7748fe 20\r
3a10d471 21#include <PiDxe.h>\r
22\r
ed7748fe 23\r
3a10d471 24#include <Protocol/ScsiPassThru.h>\r
70c94b3b 25#include <Protocol/ScsiPassThruExt.h>\r
3a10d471 26#include <Protocol/ScsiIo.h>\r
27#include <Protocol/ComponentName.h>\r
28#include <Protocol/DriverBinding.h>\r
29#include <Protocol/DevicePath.h>\r
ed7748fe 30\r
3a10d471 31#include <Library/DebugLib.h>\r
32#include <Library/UefiDriverEntryPoint.h>\r
33#include <Library/UefiLib.h>\r
34#include <Library/BaseMemoryLib.h>\r
35#include <Library/ScsiLib.h>\r
36#include <Library/UefiBootServicesTableLib.h>\r
37#include <Library/DevicePathLib.h>\r
38\r
39\r
40#include "ScsiBus.h"\r
41\r
42//\r
43// EFI Component Name Protocol\r
44//\r
1307dcd7 45GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName = {\r
3a10d471 46 ScsiBusComponentNameGetDriverName,\r
47 ScsiBusComponentNameGetControllerName,\r
48 "eng"\r
1307dcd7 49};\r
70da5bc2 50\r
51//\r
52// EFI Component Name 2 Protocol\r
53//\r
1307dcd7 54GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2 = {\r
70da5bc2 55 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ScsiBusComponentNameGetDriverName,\r
56 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ScsiBusComponentNameGetControllerName,\r
57 "en"\r
1307dcd7 58};\r
70da5bc2 59\r
3a10d471 60\r
d1aeb0bd 61GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] = {\r
70da5bc2 62 { "eng;en", (CHAR16 *) L"SCSI Bus Driver" },\r
3a10d471 63 { NULL , NULL }\r
64};\r
65\r
70da5bc2 66/**\r
67 Retrieves a Unicode string that is the user readable name of the driver.\r
68\r
69 This function retrieves the user readable name of a driver in the form of a\r
70 Unicode string. If the driver specified by This has a user readable name in\r
71 the language specified by Language, then a pointer to the driver name is\r
72 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
73 by This does not support the language specified by Language,\r
74 then EFI_UNSUPPORTED is returned.\r
75\r
76 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
77 EFI_COMPONENT_NAME_PROTOCOL instance.\r
78\r
79 @param Language[in] A pointer to a Null-terminated ASCII string\r
80 array indicating the language. This is the\r
81 language of the driver name that the caller is\r
82 requesting, and it must match one of the\r
83 languages specified in SupportedLanguages. The\r
84 number of languages supported by a driver is up\r
85 to the driver writer. Language is specified\r
86 in RFC 3066 or ISO 639-2 language code format.\r
87\r
88 @param DriverName[out] A pointer to the Unicode string to return.\r
89 This Unicode string is the name of the\r
90 driver specified by This in the language\r
91 specified by Language.\r
92\r
93 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
94 This and the language specified by Language was\r
95 returned in DriverName.\r
96\r
97 @retval EFI_INVALID_PARAMETER Language is NULL.\r
98\r
99 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
100\r
101 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
102 the language specified by Language.\r
103\r
104**/\r
3a10d471 105EFI_STATUS\r
106EFIAPI\r
107ScsiBusComponentNameGetDriverName (\r
108 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
109 IN CHAR8 *Language,\r
110 OUT CHAR16 **DriverName\r
111 )\r
3a10d471 112{\r
70da5bc2 113 return LookupUnicodeString2 (\r
114 Language,\r
115 This->SupportedLanguages,\r
116 mScsiBusDriverNameTable,\r
117 DriverName,\r
118 (BOOLEAN)(This == &gScsiBusComponentName)\r
119 );\r
3a10d471 120}\r
121\r
70da5bc2 122/**\r
123 Retrieves a Unicode string that is the user readable name of the controller\r
124 that is being managed by a driver.\r
125\r
126 This function retrieves the user readable name of the controller specified by\r
127 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
128 driver specified by This has a user readable name in the language specified by\r
129 Language, then a pointer to the controller name is returned in ControllerName,\r
130 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
131 managing the controller specified by ControllerHandle and ChildHandle,\r
132 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
133 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
134\r
135 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
136 EFI_COMPONENT_NAME_PROTOCOL instance.\r
137\r
138 @param ControllerHandle[in] The handle of a controller that the driver\r
139 specified by This is managing. This handle\r
140 specifies the controller whose name is to be\r
141 returned.\r
142\r
143 @param ChildHandle[in] The handle of the child controller to retrieve\r
144 the name of. This is an optional parameter that\r
145 may be NULL. It will be NULL for device\r
146 drivers. It will also be NULL for a bus drivers\r
147 that wish to retrieve the name of the bus\r
148 controller. It will not be NULL for a bus\r
149 driver that wishes to retrieve the name of a\r
150 child controller.\r
151\r
152 @param Language[in] A pointer to a Null-terminated ASCII string\r
153 array indicating the language. This is the\r
154 language of the driver name that the caller is\r
155 requesting, and it must match one of the\r
156 languages specified in SupportedLanguages. The\r
157 number of languages supported by a driver is up\r
158 to the driver writer. Language is specified in\r
159 RFC 3066 or ISO 639-2 language code format.\r
160\r
161 @param ControllerName[out] A pointer to the Unicode string to return.\r
162 This Unicode string is the name of the\r
163 controller specified by ControllerHandle and\r
164 ChildHandle in the language specified by\r
165 Language from the point of view of the driver\r
166 specified by This.\r
167\r
168 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
169 the language specified by Language for the\r
170 driver specified by This was returned in\r
171 DriverName.\r
172\r
173 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
174\r
175 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
176 EFI_HANDLE.\r
177\r
178 @retval EFI_INVALID_PARAMETER Language is NULL.\r
179\r
180 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
181\r
182 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
183 managing the controller specified by\r
184 ControllerHandle and ChildHandle.\r
185\r
186 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
187 the language specified by Language.\r
188\r
189**/\r
3a10d471 190EFI_STATUS\r
191EFIAPI\r
192ScsiBusComponentNameGetControllerName (\r
193 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
194 IN EFI_HANDLE ControllerHandle,\r
195 IN EFI_HANDLE ChildHandle OPTIONAL,\r
196 IN CHAR8 *Language,\r
197 OUT CHAR16 **ControllerName\r
198 )\r
3a10d471 199{\r
200 return EFI_UNSUPPORTED;\r
201}\r