]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.h
Replace references to RFC 3066 with RFC 4646.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassImpl.h
CommitLineData
e237e7ae 1/** @file\r
3e03cb4d 2 Definitions of functions for Driver Binding Protocol and Block I/O Protocol,\r
3 and other internal definitions.\r
cc5166ff 4\r
c7e39923 5Copyright (c) 2007 - 2008, Intel Corporation\r
e237e7ae 6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
e237e7ae 14**/\r
15\r
16#ifndef _EFI_USBMASS_IMPL_H_\r
17#define _EFI_USBMASS_IMPL_H_\r
18\r
e237e7ae 19#include "UsbMass.h"\r
20#include "UsbMassBot.h"\r
21#include "UsbMassCbi.h"\r
22#include "UsbMassBoot.h"\r
23\r
f3f2e05d 24#define USB_MASS_SIGNATURE SIGNATURE_32 ('U', 's', 'b', 'M')\r
cc5166ff 25\r
d80ed2a7 26#define USB_MASS_DEVICE_FROM_BLOCK_IO(a) \\r
e237e7ae 27 CR (a, USB_MASS_DEVICE, BlockIo, USB_MASS_SIGNATURE)\r
28\r
62b9bb55 29extern EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName;\r
30extern EFI_COMPONENT_NAME2_PROTOCOL gUsbMassStorageComponentName2;\r
e237e7ae 31\r
d80ed2a7 32//\r
33// Functions for Driver Binding Protocol\r
34//\r
35\r
36/**\r
37 Check whether the controller is a supported USB mass storage.\r
38\r
39 @param This The USB mass storage driver binding protocol.\r
40 @param Controller The controller handle to check.\r
41 @param RemainingDevicePath The remaining device path.\r
42\r
43 @retval EFI_SUCCESS The driver supports this controller.\r
44 @retval other This device isn't supported.\r
45\r
46**/\r
47EFI_STATUS\r
48EFIAPI\r
49USBMassDriverBindingSupported (\r
50 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
51 IN EFI_HANDLE Controller,\r
52 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
53 );\r
54\r
55/**\r
56 Starts the USB mass storage device with this driver.\r
57\r
58 This function consumes USB I/O Portocol, intializes USB mass storage device,\r
59 installs Block I/O Protocol, and submits Asynchronous Interrupt\r
60 Transfer to manage the USB mass storage device.\r
61\r
3e03cb4d 62 @param This The USB mass storage driver binding protocol.\r
63 @param Controller The USB mass storage device to start on\r
64 @param RemainingDevicePath The remaining device path.\r
d80ed2a7 65\r
66 @retval EFI_SUCCESS This driver supports this device.\r
67 @retval EFI_UNSUPPORTED This driver does not support this device.\r
68 @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.\r
69 @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.\r
70 @retval EFI_ALREADY_STARTED This driver has been started.\r
71\r
72**/\r
73EFI_STATUS\r
74EFIAPI\r
75USBMassDriverBindingStart (\r
76 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
77 IN EFI_HANDLE Controller,\r
78 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
79 );\r
80\r
81/**\r
82 Stop controlling the device.\r
83\r
84 @param This The USB mass storage driver binding\r
85 @param Controller The device controller controlled by the driver.\r
86 @param NumberOfChildren The number of children of this device\r
87 @param ChildHandleBuffer The buffer of children handle.\r
88\r
89 @retval EFI_SUCCESS The driver stopped from controlling the device.\r
3e03cb4d 90 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
91 @retval EFI_UNSUPPORTED Block I/O Protocol is not installed on Controller.\r
d80ed2a7 92 @retval Others Failed to stop the driver\r
93\r
94**/\r
95EFI_STATUS\r
96EFIAPI\r
97USBMassDriverBindingStop (\r
98 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
99 IN EFI_HANDLE Controller,\r
100 IN UINTN NumberOfChildren,\r
101 IN EFI_HANDLE *ChildHandleBuffer\r
102 );\r
103\r
104//\r
105// Functions for Block I/O Protocol\r
106//\r
107\r
108/**\r
109 Reset the block device.\r
110\r
111 This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). \r
112 It resets the block device hardware.\r
113 ExtendedVerification is ignored in this implementation.\r
114\r
115 @param This Indicates a pointer to the calling context.\r
116 @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
117 verification operation of the device during reset.\r
118\r
119 @retval EFI_SUCCESS The block device was reset.\r
120 @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be reset.\r
121\r
122**/\r
123EFI_STATUS\r
124EFIAPI\r
125UsbMassReset (\r
126 IN EFI_BLOCK_IO_PROTOCOL *This,\r
127 IN BOOLEAN ExtendedVerification\r
128 );\r
129\r
130/**\r
131 Reads the requested number of blocks from the device.\r
132\r
133 This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). \r
134 It reads the requested number of blocks from the device.\r
135 All the blocks are read, or an error is returned.\r
136\r
137 @param This Indicates a pointer to the calling context.\r
138 @param MediaId The media ID that the read request is for.\r
139 @param Lba The starting logical block address to read from on the device.\r
140 @param BufferSize The size of the Buffer in bytes.\r
141 This must be a multiple of the intrinsic block size of the device.\r
142 @param Buffer A pointer to the destination buffer for the data. The caller is\r
143 responsible for either having implicit or explicit ownership of the buffer.\r
144\r
145 @retval EFI_SUCCESS The data was read correctly from the device.\r
146 @retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.\r
147 @retval EFI_NO_MEDIA There is no media in the device.\r
148 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
149 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic block size of the device.\r
150 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
151 or the buffer is not on proper alignment.\r
152\r
153**/\r
154EFI_STATUS\r
155EFIAPI\r
156UsbMassReadBlocks (\r
157 IN EFI_BLOCK_IO_PROTOCOL *This,\r
158 IN UINT32 MediaId,\r
159 IN EFI_LBA Lba,\r
160 IN UINTN BufferSize,\r
161 OUT VOID *Buffer\r
162 );\r
163\r
164/**\r
165 Writes a specified number of blocks to the device.\r
166\r
167 This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks(). \r
168 It writes a specified number of blocks to the device.\r
169 All blocks are written, or an error is returned.\r
170\r
171 @param This Indicates a pointer to the calling context.\r
172 @param MediaId The media ID that the write request is for.\r
173 @param Lba The starting logical block address to be written.\r
174 @param BufferSize The size of the Buffer in bytes.\r
175 This must be a multiple of the intrinsic block size of the device.\r
176 @param Buffer Pointer to the source buffer for the data.\r
177\r
178 @retval EFI_SUCCESS The data were written correctly to the device.\r
179 @retval EFI_WRITE_PROTECTED The device cannot be written to.\r
180 @retval EFI_NO_MEDIA There is no media in the device.\r
181 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
182 @retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the write operation.\r
183 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic\r
184 block size of the device.\r
185 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
186 or the buffer is not on proper alignment.\r
187\r
188**/\r
189EFI_STATUS\r
190EFIAPI\r
191UsbMassWriteBlocks (\r
192 IN EFI_BLOCK_IO_PROTOCOL *This,\r
193 IN UINT32 MediaId,\r
194 IN EFI_LBA Lba,\r
195 IN UINTN BufferSize,\r
196 IN VOID *Buffer\r
197 );\r
198\r
199/**\r
200 Flushes all modified data to a physical block device.\r
201\r
202 This function implements EFI_BLOCK_IO_PROTOCOL.FlushBlocks().\r
203 USB mass storage device doesn't support write cache,\r
204 so return EFI_SUCCESS directly.\r
205\r
206 @param This Indicates a pointer to the calling context.\r
207\r
208 @retval EFI_SUCCESS All outstanding data were written correctly to the device.\r
209 @retval EFI_DEVICE_ERROR The device reported an error while attempting to write data.\r
210 @retval EFI_NO_MEDIA There is no media in the device.\r
211\r
212**/\r
213EFI_STATUS\r
214EFIAPI\r
215UsbMassFlushBlocks (\r
216 IN EFI_BLOCK_IO_PROTOCOL *This\r
217 );\r
218\r
3e03cb4d 219//\r
220// EFI Component Name Functions\r
221//\r
222\r
223/**\r
224 Retrieves a Unicode string that is the user readable name of the driver.\r
225\r
226 This function retrieves the user readable name of a driver in the form of a\r
227 Unicode string. If the driver specified by This has a user readable name in\r
228 the language specified by Language, then a pointer to the driver name is\r
229 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
230 by This does not support the language specified by Language,\r
231 then EFI_UNSUPPORTED is returned.\r
232\r
233 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
234 EFI_COMPONENT_NAME_PROTOCOL instance.\r
235 @param Language A pointer to a Null-terminated ASCII string\r
236 array indicating the language. This is the\r
237 language of the driver name that the caller is\r
238 requesting, and it must match one of the\r
239 languages specified in SupportedLanguages. The\r
240 number of languages supported by a driver is up\r
241 to the driver writer. Language is specified\r
242 in RFC 3066 or ISO 639-2 language code format.\r
243 @param DriverName A pointer to the Unicode string to return.\r
244 This Unicode string is the name of the\r
245 driver specified by This in the language\r
246 specified by Language.\r
247\r
248 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
249 This and the language specified by Language was\r
250 returned in DriverName.\r
251 @retval EFI_INVALID_PARAMETER Language is NULL.\r
252 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
253 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
254 the language specified by Language.\r
255\r
256**/\r
257EFI_STATUS\r
258EFIAPI\r
259UsbMassStorageGetDriverName (\r
260 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
261 IN CHAR8 *Language,\r
262 OUT CHAR16 **DriverName\r
263 );\r
264\r
265\r
266/**\r
267 Retrieves a Unicode string that is the user readable name of the controller\r
268 that is being managed by a driver.\r
269\r
270 This function retrieves the user readable name of the controller specified by\r
271 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
272 driver specified by This has a user readable name in the language specified by\r
273 Language, then a pointer to the controller name is returned in ControllerName,\r
274 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
275 managing the controller specified by ControllerHandle and ChildHandle,\r
276 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
277 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
278\r
279 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
280 EFI_COMPONENT_NAME_PROTOCOL instance.\r
281 @param ControllerHandle The handle of a controller that the driver\r
282 specified by This is managing. This handle\r
283 specifies the controller whose name is to be\r
284 returned.\r
285 @param ChildHandle The handle of the child controller to retrieve\r
286 the name of. This is an optional parameter that\r
287 may be NULL. It will be NULL for device\r
288 drivers. It will also be NULL for a bus drivers\r
289 that wish to retrieve the name of the bus\r
290 controller. It will not be NULL for a bus\r
291 driver that wishes to retrieve the name of a\r
292 child controller.\r
293 @param Language A pointer to a Null-terminated ASCII string\r
294 array indicating the language. This is the\r
295 language of the driver name that the caller is\r
296 requesting, and it must match one of the\r
297 languages specified in SupportedLanguages. The\r
298 number of languages supported by a driver is up\r
299 to the driver writer. Language is specified in\r
300 RFC 3066 or ISO 639-2 language code format.\r
301 @param ControllerName A pointer to the Unicode string to return.\r
302 This Unicode string is the name of the\r
303 controller specified by ControllerHandle and\r
304 ChildHandle in the language specified by\r
305 Language from the point of view of the driver\r
306 specified by This.\r
307\r
308 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
309 the language specified by Language for the\r
310 driver specified by This was returned in\r
311 DriverName.\r
312 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
313 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
314 EFI_HANDLE.\r
315 @retval EFI_INVALID_PARAMETER Language is NULL.\r
316 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
317 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
318 managing the controller specified by\r
319 ControllerHandle and ChildHandle.\r
320 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
321 the language specified by Language.\r
322\r
323**/\r
324EFI_STATUS\r
325EFIAPI\r
326UsbMassStorageGetControllerName (\r
327 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
328 IN EFI_HANDLE ControllerHandle,\r
329 IN EFI_HANDLE ChildHandle OPTIONAL,\r
330 IN CHAR8 *Language,\r
331 OUT CHAR16 **ControllerName\r
332 );\r
d80ed2a7 333\r
e237e7ae 334#endif\r