3 Copyright (c) 2007, 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
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.
18 Defination for the USB mass storage class driver. The USB mass storage
19 class is specified in two layers: the bottom layer is the transportation
20 protocol. The top layer is the command set. The transportation layer
21 provides the transportation of the command, data and result. The command
22 set defines what the command, data and result. The Bulk-Only-Transport and
23 Control/Bulk/Interrupt transport are two transportation protocol. USB mass
24 storage class adopts various industrial standard as its command set.
31 #ifndef _EFI_USBMASS_H_
32 #define _EFI_USBMASS_H_
37 #include <Protocol/BlockIo.h>
38 #include <Protocol/UsbIo.h>
40 #include <Library/DebugLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/UefiDriverEntryPoint.h>
43 #include <Library/UefiBootServicesTableLib.h>
44 #include <Library/UefiLib.h>
45 #include <Library/MemoryAllocationLib.h>
47 #define USB_IS_IN_ENDPOINT(EndPointAddr) (((EndPointAddr) & 0x80) == 0x80)
48 #define USB_IS_OUT_ENDPOINT(EndPointAddr) (((EndPointAddr) & 0x80) == 0)
49 #define USB_IS_BULK_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x02)
50 #define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x03)
51 #define USB_IS_ERROR(Result, Error) (((Result) & (Error)) != 0)
55 // Usb mass storage class code
57 USB_MASS_STORE_CLASS
= 0x08,
60 // Usb mass storage subclass code, specify the command set used.
62 USB_MASS_STORE_RBC
= 0x01, // Reduced Block Commands
63 USB_MASS_STORE_8020I
= 0x02, // SFF-8020i, typically a CD/DVD device
64 USB_MASS_STORE_QIC
= 0x03, // Typically a tape device
65 USB_MASS_STORE_UFI
= 0x04, // Typically a floopy disk driver device
66 USB_MASS_STORE_8070I
= 0x05, // SFF-8070i, typically a floppy disk driver device.
67 USB_MASS_STORE_SCSI
= 0x06, // SCSI transparent command set
70 // Usb mass storage protocol code, specify the transport protocol
72 USB_MASS_STORE_CBI0
= 0x00, // CBI protocol with command completion interrupt
73 USB_MASS_STORE_CBI1
= 0x01, // CBI protocol without command completion interrupt
74 USB_MASS_STORE_BOT
= 0x50, // Bulk-Only Transport
76 USB_MASS_STALL_1_MS
= 1000,
77 USB_MASS_STALL_1_S
= 1000 * USB_MASS_STALL_1_MS
,
79 USB_MASS_CMD_SUCCESS
= 0,
81 USB_MASS_CMD_PERSISTENT
86 (*USB_MASS_INIT_TRANSPORT
) (
87 IN EFI_USB_IO_PROTOCOL
*Usb
,
88 IN EFI_HANDLE Controller
,
89 OUT VOID
**Context OPTIONAL
94 (*USB_MASS_EXEC_COMMAND
) (
98 IN EFI_USB_DATA_DIRECTION DataDir
,
102 OUT UINT32
*CmdStatus
109 IN BOOLEAN ExtendedVerification
119 // This structure contains information necessary to select the
120 // proper transport protocol. The mass storage class defines
121 // two transport protocols. One is the CBI, and the other is BOT.
122 // CBI is being obseleted. The design is made modular by this
123 // structure so that the CBI protocol can be easily removed when
124 // it is no longer necessary.
128 USB_MASS_INIT_TRANSPORT Init
; // Initialize the mass storage transport protocol
129 USB_MASS_EXEC_COMMAND ExecCommand
; // Transport command to the device then get result
130 USB_MASS_RESET Reset
; // Reset the device
131 USB_MASS_FINI Fini
; // Clean up the resources.
132 } USB_MASS_TRANSPORT
;
136 UsbClearEndpointStall (
137 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
138 IN UINT8 EndpointAddress
141 extern UINTN mUsbMscInfo
;
142 extern UINTN mUsbMscError
;