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_
35 // The package level header files this module uses
39 // The protocols, PPI and GUID defintions for this module
41 #include <Protocol/BlockIo.h>
42 #include <Protocol/UsbIo.h>
44 // The Library classes this module consumes
46 #include <Library/DebugLib.h>
47 #include <Library/BaseMemoryLib.h>
48 #include <Library/UefiDriverEntryPoint.h>
49 #include <Library/UefiBootServicesTableLib.h>
50 #include <Library/UefiLib.h>
51 #include <Library/MemoryAllocationLib.h>
53 #define USB_IS_IN_ENDPOINT(EndPointAddr) (((EndPointAddr) & 0x80) == 0x80)
54 #define USB_IS_OUT_ENDPOINT(EndPointAddr) (((EndPointAddr) & 0x80) == 0)
55 #define USB_IS_BULK_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x02)
56 #define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x03)
57 #define USB_IS_ERROR(Result, Error) (((Result) & (Error)) != 0)
61 // Usb mass storage class code
63 USB_MASS_STORE_CLASS
= 0x08,
66 // Usb mass storage subclass code, specify the command set used.
68 USB_MASS_STORE_RBC
= 0x01, // Reduced Block Commands
69 USB_MASS_STORE_8020I
= 0x02, // SFF-8020i, typically a CD/DVD device
70 USB_MASS_STORE_QIC
= 0x03, // Typically a tape device
71 USB_MASS_STORE_UFI
= 0x04, // Typically a floopy disk driver device
72 USB_MASS_STORE_8070I
= 0x05, // SFF-8070i, typically a floppy disk driver device.
73 USB_MASS_STORE_SCSI
= 0x06, // SCSI transparent command set
76 // Usb mass storage protocol code, specify the transport protocol
78 USB_MASS_STORE_CBI0
= 0x00, // CBI protocol with command completion interrupt
79 USB_MASS_STORE_CBI1
= 0x01, // CBI protocol without command completion interrupt
80 USB_MASS_STORE_BOT
= 0x50, // Bulk-Only Transport
82 USB_MASS_STALL_1_MS
= 1000,
83 USB_MASS_STALL_1_S
= 1000 * USB_MASS_STALL_1_MS
,
85 USB_MASS_CMD_SUCCESS
= 0,
87 USB_MASS_CMD_PERSISTENT
,
92 (*USB_MASS_INIT_TRANSPORT
) (
93 IN EFI_USB_IO_PROTOCOL
*Usb
,
94 IN EFI_HANDLE Controller
,
95 OUT VOID
**Context OPTIONAL
100 (*USB_MASS_EXEC_COMMAND
) (
104 IN EFI_USB_DATA_DIRECTION DataDir
,
108 OUT UINT32
*CmdStatus
115 IN BOOLEAN ExtendedVerification
125 // This structure contains information necessary to select the
126 // proper transport protocol. The mass storage class defines
127 // two transport protocols. One is the CBI, and the other is BOT.
128 // CBI is being obseleted. The design is made modular by this
129 // structure so that the CBI protocol can be easily removed when
130 // it is no longer necessary.
134 USB_MASS_INIT_TRANSPORT Init
; // Initialize the mass storage transport protocol
135 USB_MASS_EXEC_COMMAND ExecCommand
; // Transport command to the device then get result
136 USB_MASS_RESET Reset
; // Reset the device
137 USB_MASS_FINI Fini
; // Clean up the resources.
138 } USB_MASS_TRANSPORT
;
142 UsbClearEndpointStall (
143 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
144 IN UINT8 EndpointAddress
147 extern UINTN mUsbMscInfo
;
148 extern UINTN mUsbMscError
;