]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h
remove some comments introduced by tools.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMass.h
1 /** @file
2
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
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 UsbMass.h
15
16 Abstract:
17
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.
25
26 Revision History
27
28
29 **/
30
31 #ifndef _EFI_USBMASS_H_
32 #define _EFI_USBMASS_H_
33
34
35 #include <PiDxe.h>
36
37 #include <Protocol/BlockIo.h>
38 #include <Protocol/UsbIo.h>
39
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>
46
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)
52
53 enum {
54 //
55 // Usb mass storage class code
56 //
57 USB_MASS_STORE_CLASS = 0x08,
58
59 //
60 // Usb mass storage subclass code, specify the command set used.
61 //
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
68
69 //
70 // Usb mass storage protocol code, specify the transport protocol
71 //
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
75
76 USB_MASS_STALL_1_MS = 1000,
77 USB_MASS_STALL_1_S = 1000 * USB_MASS_STALL_1_MS,
78
79 USB_MASS_CMD_SUCCESS = 0,
80 USB_MASS_CMD_FAIL,
81 USB_MASS_CMD_PERSISTENT
82 };
83
84 typedef
85 EFI_STATUS
86 (*USB_MASS_INIT_TRANSPORT) (
87 IN EFI_USB_IO_PROTOCOL *Usb,
88 IN EFI_HANDLE Controller,
89 OUT VOID **Context OPTIONAL
90 );
91
92 typedef
93 EFI_STATUS
94 (*USB_MASS_EXEC_COMMAND) (
95 IN VOID *Context,
96 IN VOID *Cmd,
97 IN UINT8 CmdLen,
98 IN EFI_USB_DATA_DIRECTION DataDir,
99 IN VOID *Data,
100 IN UINT32 DataLen,
101 IN UINT32 Timeout,
102 OUT UINT32 *CmdStatus
103 );
104
105 typedef
106 EFI_STATUS
107 (*USB_MASS_RESET) (
108 IN VOID *Context,
109 IN BOOLEAN ExtendedVerification
110 );
111
112 typedef
113 EFI_STATUS
114 (*USB_MASS_FINI) (
115 IN VOID *Context
116 );
117
118 //
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.
125 //
126 typedef struct {
127 UINT8 Protocol;
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;
133
134
135 EFI_STATUS
136 UsbClearEndpointStall (
137 IN EFI_USB_IO_PROTOCOL *UsbIo,
138 IN UINT8 EndpointAddress
139 );
140
141 extern UINTN mUsbMscInfo;
142 extern UINTN mUsbMscError;
143 #endif