2 BOT Transportation implementation.
4 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution. The
9 full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _PEI_BOT_PEIM_H_
18 #define _PEI_BOT_PEIM_H_
23 #include <Ppi/UsbIo.h>
24 #include <Ppi/UsbHostController.h>
25 #include <Ppi/BlockIo.h>
27 //#include <Library/DebugLib.h>
28 #include <Library/PeimEntryPoint.h>
29 #include <Library/PeiServicesLib.h>
30 #include <Library/BaseMemoryLib.h>
32 #include <IndustryStandard/Atapi.h>
36 // Bulk Only device protocol
41 UINT32 DataTransferLength
;
57 // Status code, see Usb Bot device spec
59 #define CSWSIG 0x53425355
60 #define CBWSIG 0x43425355
63 Sends out ATAPI Inquiry Packet Command to the specified device. This command will
64 return INQUIRY data of the device.
66 @param PeiServices The pointer of EFI_PEI_SERVICES.
67 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
69 @retval EFI_SUCCESS Inquiry command completes successfully.
70 @retval EFI_DEVICE_ERROR Inquiry command failed.
75 IN EFI_PEI_SERVICES
**PeiServices
,
76 IN PEI_BOT_DEVICE
*PeiBotDevice
80 Sends out ATAPI Test Unit Ready Packet Command to the specified device
81 to find out whether device is accessible.
83 @param PeiServices The pointer of EFI_PEI_SERVICES.
84 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
86 @retval EFI_SUCCESS TestUnit command executed successfully.
87 @retval EFI_DEVICE_ERROR Device cannot be executed TestUnit command successfully.
92 IN EFI_PEI_SERVICES
**PeiServices
,
93 IN PEI_BOT_DEVICE
*PeiBotDevice
97 Sends out ATAPI Request Sense Packet Command to the specified device.
99 @param PeiServices The pointer of EFI_PEI_SERVICES.
100 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
101 @param SenseCounts Length of sense buffer.
102 @param SenseKeyBuffer Pointer to sense buffer.
104 @retval EFI_SUCCESS Command executed successfully.
105 @retval EFI_DEVICE_ERROR Some device errors happen.
110 IN EFI_PEI_SERVICES
**PeiServices
,
111 IN PEI_BOT_DEVICE
*PeiBotDevice
,
112 OUT UINTN
*SenseCounts
,
113 IN UINT8
*SenseKeyBuffer
117 Sends out ATAPI Read Capacity Packet Command to the specified device.
118 This command will return the information regarding the capacity of the
121 @param PeiServices The pointer of EFI_PEI_SERVICES.
122 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
124 @retval EFI_SUCCESS Command executed successfully.
125 @retval EFI_DEVICE_ERROR Some device errors happen.
130 IN EFI_PEI_SERVICES
**PeiServices
,
131 IN PEI_BOT_DEVICE
*PeiBotDevice
135 Sends out ATAPI Read Format Capacity Data Command to the specified device.
136 This command will return the information regarding the capacity of the
139 @param PeiServices The pointer of EFI_PEI_SERVICES.
140 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
142 @retval EFI_SUCCESS Command executed successfully.
143 @retval EFI_DEVICE_ERROR Some device errors happen.
147 PeiUsbReadFormattedCapacity (
148 IN EFI_PEI_SERVICES
**PeiServices
,
149 IN PEI_BOT_DEVICE
*PeiBotDevice
153 Execute Read(10) ATAPI command on a specific SCSI target.
155 Executes the ATAPI Read(10) command on the ATAPI target specified by PeiBotDevice.
157 @param PeiServices The pointer of EFI_PEI_SERVICES.
158 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
159 @param Buffer The pointer to data buffer.
160 @param Lba The start logic block address of reading.
161 @param NumberOfBlocks The block number of reading.
163 @retval EFI_SUCCESS Command executed successfully.
164 @retval EFI_DEVICE_ERROR Some device errors happen.
169 IN EFI_PEI_SERVICES
**PeiServices
,
170 IN PEI_BOT_DEVICE
*PeiBotDevice
,
173 IN UINTN NumberOfBlocks
177 Check if there is media according to sense data.
179 @param SenseData Pointer to sense data.
180 @param SenseCounts Count of sense data.
182 @retval TRUE No media
183 @retval FALSE Media exists
188 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
193 Check if there is media error according to sense data.
195 @param SenseData Pointer to sense data.
196 @param SenseCounts Count of sense data.
198 @retval TRUE Media error
199 @retval FALSE No media error
204 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
209 Check if media is changed according to sense data.
211 @param SenseData Pointer to sense data.
212 @param SenseCounts Count of sense data.
214 @retval TRUE There is media change event.
215 @retval FALSE media is NOT changed.
220 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,