]> git.proxmox.com Git - mirror_edk2.git/blob - 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
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 ComponentName.c
15
16 Abstract:
17
18 --*/
19
20
21 #include <PiDxe.h>
22
23
24 #include <Protocol/ScsiPassThru.h>
25 #include <Protocol/ScsiPassThruExt.h>
26 #include <Protocol/ScsiIo.h>
27 #include <Protocol/ComponentName.h>
28 #include <Protocol/DriverBinding.h>
29 #include <Protocol/DevicePath.h>
30
31 #include <Library/DebugLib.h>
32 #include <Library/UefiDriverEntryPoint.h>
33 #include <Library/UefiLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/ScsiLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/DevicePathLib.h>
38
39
40 #include "ScsiBus.h"
41
42 //
43 // EFI Component Name Protocol
44 //
45 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName = {
46 ScsiBusComponentNameGetDriverName,
47 ScsiBusComponentNameGetControllerName,
48 "eng"
49 };
50
51 //
52 // EFI Component Name 2 Protocol
53 //
54 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2 = {
55 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ScsiBusComponentNameGetDriverName,
56 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ScsiBusComponentNameGetControllerName,
57 "en"
58 };
59
60
61 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] = {
62 { "eng;en", (CHAR16 *) L"SCSI Bus Driver" },
63 { NULL , NULL }
64 };
65
66 /**
67 Retrieves a Unicode string that is the user readable name of the driver.
68
69 This function retrieves the user readable name of a driver in the form of a
70 Unicode string. If the driver specified by This has a user readable name in
71 the language specified by Language, then a pointer to the driver name is
72 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
73 by This does not support the language specified by Language,
74 then EFI_UNSUPPORTED is returned.
75
76 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
77 EFI_COMPONENT_NAME_PROTOCOL instance.
78
79 @param Language[in] A pointer to a Null-terminated ASCII string
80 array indicating the language. This is the
81 language of the driver name that the caller is
82 requesting, and it must match one of the
83 languages specified in SupportedLanguages. The
84 number of languages supported by a driver is up
85 to the driver writer. Language is specified
86 in RFC 3066 or ISO 639-2 language code format.
87
88 @param DriverName[out] A pointer to the Unicode string to return.
89 This Unicode string is the name of the
90 driver specified by This in the language
91 specified by Language.
92
93 @retval EFI_SUCCESS The Unicode string for the Driver specified by
94 This and the language specified by Language was
95 returned in DriverName.
96
97 @retval EFI_INVALID_PARAMETER Language is NULL.
98
99 @retval EFI_INVALID_PARAMETER DriverName is NULL.
100
101 @retval EFI_UNSUPPORTED The driver specified by This does not support
102 the language specified by Language.
103
104 **/
105 EFI_STATUS
106 EFIAPI
107 ScsiBusComponentNameGetDriverName (
108 IN EFI_COMPONENT_NAME_PROTOCOL *This,
109 IN CHAR8 *Language,
110 OUT CHAR16 **DriverName
111 )
112 {
113 return LookupUnicodeString2 (
114 Language,
115 This->SupportedLanguages,
116 mScsiBusDriverNameTable,
117 DriverName,
118 (BOOLEAN)(This == &gScsiBusComponentName)
119 );
120 }
121
122 /**
123 Retrieves a Unicode string that is the user readable name of the controller
124 that is being managed by a driver.
125
126 This function retrieves the user readable name of the controller specified by
127 ControllerHandle and ChildHandle in the form of a Unicode string. If the
128 driver specified by This has a user readable name in the language specified by
129 Language, then a pointer to the controller name is returned in ControllerName,
130 and EFI_SUCCESS is returned. If the driver specified by This is not currently
131 managing the controller specified by ControllerHandle and ChildHandle,
132 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
133 support the language specified by Language, then EFI_UNSUPPORTED is returned.
134
135 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
136 EFI_COMPONENT_NAME_PROTOCOL instance.
137
138 @param ControllerHandle[in] The handle of a controller that the driver
139 specified by This is managing. This handle
140 specifies the controller whose name is to be
141 returned.
142
143 @param ChildHandle[in] The handle of the child controller to retrieve
144 the name of. This is an optional parameter that
145 may be NULL. It will be NULL for device
146 drivers. It will also be NULL for a bus drivers
147 that wish to retrieve the name of the bus
148 controller. It will not be NULL for a bus
149 driver that wishes to retrieve the name of a
150 child controller.
151
152 @param Language[in] A pointer to a Null-terminated ASCII string
153 array indicating the language. This is the
154 language of the driver name that the caller is
155 requesting, and it must match one of the
156 languages specified in SupportedLanguages. The
157 number of languages supported by a driver is up
158 to the driver writer. Language is specified in
159 RFC 3066 or ISO 639-2 language code format.
160
161 @param ControllerName[out] A pointer to the Unicode string to return.
162 This Unicode string is the name of the
163 controller specified by ControllerHandle and
164 ChildHandle in the language specified by
165 Language from the point of view of the driver
166 specified by This.
167
168 @retval EFI_SUCCESS The Unicode string for the user readable name in
169 the language specified by Language for the
170 driver specified by This was returned in
171 DriverName.
172
173 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
174
175 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
176 EFI_HANDLE.
177
178 @retval EFI_INVALID_PARAMETER Language is NULL.
179
180 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
181
182 @retval EFI_UNSUPPORTED The driver specified by This is not currently
183 managing the controller specified by
184 ControllerHandle and ChildHandle.
185
186 @retval EFI_UNSUPPORTED The driver specified by This does not support
187 the language specified by Language.
188
189 **/
190 EFI_STATUS
191 EFIAPI
192 ScsiBusComponentNameGetControllerName (
193 IN EFI_COMPONENT_NAME_PROTOCOL *This,
194 IN EFI_HANDLE ControllerHandle,
195 IN EFI_HANDLE ChildHandle OPTIONAL,
196 IN CHAR8 *Language,
197 OUT CHAR16 **ControllerName
198 )
199 {
200 return EFI_UNSUPPORTED;
201 }