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