EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h

Go to the documentation of this file.
00001 
00016 #ifndef _EFI_USBMASS_H_
00017 #define _EFI_USBMASS_H_
00018 
00019 
00020 #include <Uefi.h>
00021 
00022 #include <Protocol/BlockIo.h>
00023 #include <Protocol/UsbIo.h>
00024 #include <Protocol/DevicePath.h>
00025 #include <Protocol/DiskInfo.h>
00026 #include <Library/BaseLib.h>
00027 #include <Library/DebugLib.h>
00028 #include <Library/BaseMemoryLib.h>
00029 #include <Library/UefiDriverEntryPoint.h>
00030 #include <Library/UefiBootServicesTableLib.h>
00031 #include <Library/UefiLib.h>
00032 #include <Library/MemoryAllocationLib.h>
00033 #include <Library/DevicePathLib.h>
00034 
00035 typedef struct _USB_MASS_TRANSPORT USB_MASS_TRANSPORT;
00036 typedef struct _USB_MASS_DEVICE    USB_MASS_DEVICE;
00037 
00038 #include "UsbMassBot.h"
00039 #include "UsbMassCbi.h"
00040 #include "UsbMassBoot.h"
00041 #include "UsbMassDiskInfo.h"
00042 #include "UsbMassImpl.h"
00043 
00044 #define USB_IS_IN_ENDPOINT(EndPointAddr)      (((EndPointAddr) & BIT7) == BIT7)
00045 #define USB_IS_OUT_ENDPOINT(EndPointAddr)     (((EndPointAddr) & BIT7) == 0)
00046 #define USB_IS_BULK_ENDPOINT(Attribute)       (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_BULK)
00047 #define USB_IS_INTERRUPT_ENDPOINT(Attribute)  (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT)
00048 #define USB_IS_ERROR(Result, Error)           (((Result) & (Error)) != 0)
00049 
00050 //
00051 // Usb mass storage class code
00052 //
00053 #define USB_MASS_STORE_CLASS    0x08
00054 
00055 //
00056 // Usb mass storage subclass code, specify the command set used.
00057 //
00058 #define USB_MASS_STORE_RBC      0x01 ///< Reduced Block Commands
00059 #define USB_MASS_STORE_8020I    0x02 ///< SFF-8020i, typically a CD/DVD device
00060 #define USB_MASS_STORE_QIC      0x03 ///< Typically a tape device
00061 #define USB_MASS_STORE_UFI      0x04 ///< Typically a floppy disk driver device
00062 #define USB_MASS_STORE_8070I    0x05 ///< SFF-8070i, typically a floppy disk driver device.
00063 #define USB_MASS_STORE_SCSI     0x06 ///< SCSI transparent command set
00064 
00065 //
00066 // Usb mass storage protocol code, specify the transport protocol
00067 //
00068 #define USB_MASS_STORE_CBI0     0x00 ///< CBI protocol with command completion interrupt
00069 #define USB_MASS_STORE_CBI1     0x01 ///< CBI protocol without command completion interrupt
00070 #define USB_MASS_STORE_BOT      0x50 ///< Bulk-Only Transport
00071 
00072 #define USB_MASS_1_MILLISECOND  1000
00073 #define USB_MASS_1_SECOND       (1000 * USB_MASS_1_MILLISECOND)
00074 
00075 #define USB_MASS_CMD_SUCCESS    0
00076 #define USB_MASS_CMD_FAIL       1
00077 #define USB_MASS_CMD_PERSISTENT 2
00078 
00093 typedef
00094 EFI_STATUS
00095 (*USB_MASS_INIT_TRANSPORT) (
00096   IN  EFI_USB_IO_PROTOCOL     *Usb,
00097   OUT VOID                    **Context    OPTIONAL
00098   );
00099 
00117 typedef
00118 EFI_STATUS
00119 (*USB_MASS_EXEC_COMMAND) (
00120   IN  VOID                    *Context,
00121   IN  VOID                    *Cmd,
00122   IN  UINT8                   CmdLen,
00123   IN  EFI_USB_DATA_DIRECTION  DataDir,
00124   IN  VOID                    *Data,
00125   IN  UINT32                  DataLen,
00126   IN  UINT8                   Lun,
00127   IN  UINT32                  Timeout,
00128   OUT UINT32                  *CmdStatus
00129   );
00130 
00142 typedef
00143 EFI_STATUS
00144 (*USB_MASS_RESET) (
00145   IN  VOID                    *Context,
00146   IN  BOOLEAN                 ExtendedVerification
00147   );
00148 
00160 typedef
00161 EFI_STATUS
00162 (*USB_MASS_GET_MAX_LUN) (
00163   IN  VOID                    *Context,
00164   IN  UINT8                   *MaxLun
00165   );
00166 
00175 typedef
00176 EFI_STATUS
00177 (*USB_MASS_CLEAN_UP) (
00178   IN  VOID                    *Context
00179   );
00180 
00189 struct _USB_MASS_TRANSPORT {
00190   UINT8                   Protocol;
00191   USB_MASS_INIT_TRANSPORT Init;        
00192   USB_MASS_EXEC_COMMAND   ExecCommand; 
00193   USB_MASS_RESET          Reset;       
00194   USB_MASS_GET_MAX_LUN    GetMaxLun;   
00195   USB_MASS_CLEAN_UP       CleanUp;     
00196 };
00197 
00198 struct _USB_MASS_DEVICE {
00199   UINT32                    Signature;
00200   EFI_HANDLE                Controller;
00201   EFI_USB_IO_PROTOCOL       *UsbIo;
00202   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
00203   EFI_BLOCK_IO_PROTOCOL     BlockIo;
00204   EFI_BLOCK_IO_MEDIA        BlockIoMedia;
00205   BOOLEAN                   OpticalStorage;
00206   UINT8                     Lun;          
00207   UINT8                     Pdt;          
00208   USB_MASS_TRANSPORT        *Transport;   
00209   VOID                      *Context;
00210   EFI_DISK_INFO_PROTOCOL    DiskInfo;
00211   USB_BOOT_INQUIRY_DATA     InquiryData;
00212 };
00213 
00214 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines