]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h
1. Fixed tools_def.template to meet ICC build for IA32
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMass.h
CommitLineData
e237e7ae 1/** @file\r
2\r
3Copyright (c) 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 UsbMass.h\r
15\r
16Abstract:\r
17\r
18 Defination for the USB mass storage class driver. The USB mass storage\r
19 class is specified in two layers: the bottom layer is the transportation\r
20 protocol. The top layer is the command set. The transportation layer\r
21 provides the transportation of the command, data and result. The command\r
22 set defines what the command, data and result. The Bulk-Only-Transport and\r
23 Control/Bulk/Interrupt transport are two transportation protocol. USB mass\r
24 storage class adopts various industrial standard as its command set.\r
25\r
26Revision History\r
27\r
28\r
29**/\r
30\r
31#ifndef _EFI_USBMASS_H_\r
32#define _EFI_USBMASS_H_\r
33\r
34//\r
35// The package level header files this module uses\r
36//\r
37#include <PiDxe.h>\r
38//\r
39// The protocols, PPI and GUID defintions for this module\r
40//\r
41#include <Protocol/BlockIo.h>\r
42#include <Protocol/UsbIo.h>\r
43//\r
44// The Library classes this module consumes\r
45//\r
46#include <Library/DebugLib.h>\r
47#include <Library/BaseMemoryLib.h>\r
48#include <Library/UefiDriverEntryPoint.h>\r
49#include <Library/UefiBootServicesTableLib.h>\r
50#include <Library/UefiLib.h>\r
51#include <Library/MemoryAllocationLib.h>\r
52\r
53#define USB_IS_IN_ENDPOINT(EndPointAddr) (((EndPointAddr) & 0x80) == 0x80)\r
54#define USB_IS_OUT_ENDPOINT(EndPointAddr) (((EndPointAddr) & 0x80) == 0)\r
55#define USB_IS_BULK_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x02)\r
56#define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x03)\r
57#define USB_IS_ERROR(Result, Error) (((Result) & (Error)) != 0)\r
58\r
59enum {\r
60 //\r
61 // Usb mass storage class code\r
62 //\r
63 USB_MASS_STORE_CLASS = 0x08,\r
64\r
65 //\r
66 // Usb mass storage subclass code, specify the command set used.\r
67 //\r
68 USB_MASS_STORE_RBC = 0x01, // Reduced Block Commands\r
69 USB_MASS_STORE_8020I = 0x02, // SFF-8020i, typically a CD/DVD device\r
70 USB_MASS_STORE_QIC = 0x03, // Typically a tape device\r
71 USB_MASS_STORE_UFI = 0x04, // Typically a floopy disk driver device\r
72 USB_MASS_STORE_8070I = 0x05, // SFF-8070i, typically a floppy disk driver device.\r
73 USB_MASS_STORE_SCSI = 0x06, // SCSI transparent command set\r
74\r
75 //\r
76 // Usb mass storage protocol code, specify the transport protocol\r
77 //\r
78 USB_MASS_STORE_CBI0 = 0x00, // CBI protocol with command completion interrupt\r
79 USB_MASS_STORE_CBI1 = 0x01, // CBI protocol without command completion interrupt\r
80 USB_MASS_STORE_BOT = 0x50, // Bulk-Only Transport\r
81\r
82 USB_MASS_STALL_1_MS = 1000,\r
83 USB_MASS_STALL_1_S = 1000 * USB_MASS_STALL_1_MS,\r
84\r
85 USB_MASS_CMD_SUCCESS = 0,\r
86 USB_MASS_CMD_FAIL,\r
c52fa98c 87 USB_MASS_CMD_PERSISTENT\r
e237e7ae 88};\r
89\r
90typedef\r
91EFI_STATUS\r
92(*USB_MASS_INIT_TRANSPORT) (\r
93 IN EFI_USB_IO_PROTOCOL *Usb,\r
94 IN EFI_HANDLE Controller,\r
95 OUT VOID **Context OPTIONAL\r
96 );\r
97\r
98typedef\r
99EFI_STATUS\r
100(*USB_MASS_EXEC_COMMAND) (\r
101 IN VOID *Context,\r
102 IN VOID *Cmd,\r
103 IN UINT8 CmdLen,\r
104 IN EFI_USB_DATA_DIRECTION DataDir,\r
105 IN VOID *Data,\r
106 IN UINT32 DataLen,\r
107 IN UINT32 Timeout,\r
108 OUT UINT32 *CmdStatus\r
109 );\r
110\r
111typedef\r
112EFI_STATUS\r
113(*USB_MASS_RESET) (\r
114 IN VOID *Context,\r
115 IN BOOLEAN ExtendedVerification\r
116 );\r
117\r
118typedef\r
119EFI_STATUS\r
120(*USB_MASS_FINI) (\r
121 IN VOID *Context\r
122 );\r
123\r
124//\r
125// This structure contains information necessary to select the\r
126// proper transport protocol. The mass storage class defines\r
127// two transport protocols. One is the CBI, and the other is BOT.\r
128// CBI is being obseleted. The design is made modular by this\r
129// structure so that the CBI protocol can be easily removed when\r
130// it is no longer necessary.\r
131//\r
132typedef struct {\r
133 UINT8 Protocol;\r
134 USB_MASS_INIT_TRANSPORT Init; // Initialize the mass storage transport protocol\r
135 USB_MASS_EXEC_COMMAND ExecCommand; // Transport command to the device then get result\r
136 USB_MASS_RESET Reset; // Reset the device\r
137 USB_MASS_FINI Fini; // Clean up the resources.\r
138} USB_MASS_TRANSPORT;\r
139\r
140\r
141EFI_STATUS\r
142UsbClearEndpointStall (\r
143 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
144 IN UINT8 EndpointAddress\r
145 );\r
146\r
147extern UINTN mUsbMscInfo;\r
148extern UINTN mUsbMscError;\r
149#endif\r