2 BOT Transportation implementation.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _PEI_BOT_PEIM_H_
11 #define _PEI_BOT_PEIM_H_
16 #include <Ppi/UsbIo.h>
17 #include <Ppi/UsbHostController.h>
18 #include <Ppi/BlockIo.h>
20 //#include <Library/DebugLib.h>
21 #include <Library/PeimEntryPoint.h>
22 #include <Library/PeiServicesLib.h>
23 #include <Library/BaseMemoryLib.h>
25 #include <IndustryStandard/Atapi.h>
29 // Bulk Only device protocol
34 UINT32 DataTransferLength
;
50 // Status code, see Usb Bot device spec
52 #define CSWSIG 0x53425355
53 #define CBWSIG 0x43425355
56 Sends out ATAPI Inquiry Packet Command to the specified device. This command will
57 return INQUIRY data of the device.
59 @param PeiServices The pointer of EFI_PEI_SERVICES.
60 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
62 @retval EFI_SUCCESS Inquiry command completes successfully.
63 @retval EFI_DEVICE_ERROR Inquiry command failed.
68 IN EFI_PEI_SERVICES
**PeiServices
,
69 IN PEI_BOT_DEVICE
*PeiBotDevice
73 Sends out ATAPI Test Unit Ready Packet Command to the specified device
74 to find out whether device is accessible.
76 @param PeiServices The pointer of EFI_PEI_SERVICES.
77 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
79 @retval EFI_SUCCESS TestUnit command executed successfully.
80 @retval EFI_DEVICE_ERROR Device cannot be executed TestUnit command successfully.
85 IN EFI_PEI_SERVICES
**PeiServices
,
86 IN PEI_BOT_DEVICE
*PeiBotDevice
90 Sends out ATAPI Request Sense Packet Command to the specified device.
92 @param PeiServices The pointer of EFI_PEI_SERVICES.
93 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
94 @param SenseCounts Length of sense buffer.
95 @param SenseKeyBuffer Pointer to sense buffer.
97 @retval EFI_SUCCESS Command executed successfully.
98 @retval EFI_DEVICE_ERROR Some device errors happen.
103 IN EFI_PEI_SERVICES
**PeiServices
,
104 IN PEI_BOT_DEVICE
*PeiBotDevice
,
105 OUT UINTN
*SenseCounts
,
106 IN UINT8
*SenseKeyBuffer
110 Sends out ATAPI Read Capacity Packet Command to the specified device.
111 This command will return the information regarding the capacity of the
114 @param PeiServices The pointer of EFI_PEI_SERVICES.
115 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
117 @retval EFI_SUCCESS Command executed successfully.
118 @retval EFI_DEVICE_ERROR Some device errors happen.
123 IN EFI_PEI_SERVICES
**PeiServices
,
124 IN PEI_BOT_DEVICE
*PeiBotDevice
128 Sends out ATAPI Read Format Capacity Data Command to the specified device.
129 This command will return the information regarding the capacity of the
132 @param PeiServices The pointer of EFI_PEI_SERVICES.
133 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
135 @retval EFI_SUCCESS Command executed successfully.
136 @retval EFI_DEVICE_ERROR Some device errors happen.
140 PeiUsbReadFormattedCapacity (
141 IN EFI_PEI_SERVICES
**PeiServices
,
142 IN PEI_BOT_DEVICE
*PeiBotDevice
146 Execute Read(10) ATAPI command on a specific SCSI target.
148 Executes the ATAPI Read(10) command on the ATAPI target specified by PeiBotDevice.
150 @param PeiServices The pointer of EFI_PEI_SERVICES.
151 @param PeiBotDevice The pointer to PEI_BOT_DEVICE instance.
152 @param Buffer The pointer to data buffer.
153 @param Lba The start logic block address of reading.
154 @param NumberOfBlocks The block number of reading.
156 @retval EFI_SUCCESS Command executed successfully.
157 @retval EFI_DEVICE_ERROR Some device errors happen.
162 IN EFI_PEI_SERVICES
**PeiServices
,
163 IN PEI_BOT_DEVICE
*PeiBotDevice
,
166 IN UINTN NumberOfBlocks
170 Check if there is media according to sense data.
172 @param SenseData Pointer to sense data.
173 @param SenseCounts Count of sense data.
175 @retval TRUE No media
176 @retval FALSE Media exists
181 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
186 Check if there is media error according to sense data.
188 @param SenseData Pointer to sense data.
189 @param SenseCounts Count of sense data.
191 @retval TRUE Media error
192 @retval FALSE No media error
197 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
202 Check if media is changed according to sense data.
204 @param SenseData Pointer to sense data.
205 @param SenseCounts Count of sense data.
207 @retval TRUE There is media change event.
208 @retval FALSE media is NOT changed.
213 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,