33 if ((DeviceIndex == 0) || (DeviceIndex > Private->ActiveDevices)) {
38 while (!
IsNull (&Private->DeviceList, Node)) {
39 DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
41 if (DeviceData->DeviceIndex == DeviceIndex) {
76 UINTN MaxTransferBlockNumber;
77 UINTN TransferBlockNumber;
83 ASSERT ((
UINTN)DeviceData->Lba48Bit < 2);
84 if ((
UINTN)DeviceData->Lba48Bit >= 2) {
85 return EFI_INVALID_PARAMETER;
89 MaxTransferBlockNumber = mMaxTransferBlockNumber[DeviceData->Lba48Bit];
90 BlockSize = DeviceData->Media.BlockSize;
93 if (NumberOfBlocks > MaxTransferBlockNumber) {
94 TransferBlockNumber = MaxTransferBlockNumber;
95 NumberOfBlocks -= MaxTransferBlockNumber;
97 TransferBlockNumber = NumberOfBlocks;
103 "%a: Blocking AccessAtaDevice, TransferBlockNumber = %x; StartLba = %x\n",
113 (UINT32)TransferBlockNumber,
116 if (EFI_ERROR (Status)) {
120 StartLba += TransferBlockNumber;
121 Buffer += TransferBlockNumber * BlockSize;
122 }
while (NumberOfBlocks > 0);
149 UINTN NumberOfBlocks;
154 if (Buffer ==
NULL) {
155 return EFI_INVALID_PARAMETER;
158 if (BufferSize == 0) {
162 BlockSize = DeviceData->Media.BlockSize;
163 if ((BufferSize % BlockSize) != 0) {
164 return EFI_BAD_BUFFER_SIZE;
167 if (StartLba > DeviceData->Media.LastBlock) {
168 return EFI_INVALID_PARAMETER;
171 NumberOfBlocks = BufferSize / BlockSize;
172 if (NumberOfBlocks - 1 > DeviceData->Media.LastBlock - StartLba) {
173 return EFI_INVALID_PARAMETER;
179 Status =
AccessAtaDevice (DeviceData, Buffer, StartLba, NumberOfBlocks);
210 if ((This ==
NULL) || (NumberBlockDevices ==
NULL)) {
211 return EFI_INVALID_PARAMETER;
214 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);
215 *NumberBlockDevices = Private->ActiveDevices;
273 if ((This ==
NULL) || (MediaInfo ==
NULL)) {
274 return EFI_INVALID_PARAMETER;
277 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);
279 if (DeviceData ==
NULL) {
280 return EFI_NOT_FOUND;
284 MediaInfo->MediaPresent =
TRUE;
286 MediaInfo->BlockSize = DeviceData->Media.
BlockSize;
340 return EFI_INVALID_PARAMETER;
343 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);
345 if (DeviceData ==
NULL) {
346 return EFI_NOT_FOUND;
349 return AhciRead (DeviceData, Buffer, StartLBA, BufferSize);
378 if ((This ==
NULL) || (NumberBlockDevices ==
NULL)) {
379 return EFI_INVALID_PARAMETER;
382 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
383 *NumberBlockDevices = Private->ActiveDevices;
441 if ((This ==
NULL) || (MediaInfo ==
NULL)) {
442 return EFI_INVALID_PARAMETER;
445 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
447 if (DeviceData ==
NULL) {
448 return EFI_NOT_FOUND;
508 return EFI_INVALID_PARAMETER;
511 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
EFI_STATUS TransferAtaDevice(IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData, IN OUT VOID *Buffer, IN EFI_LBA StartLba, IN UINT32 TransferLength, IN BOOLEAN IsWrite)
EFI_STATUS EFIAPI AhciBlockIoGetDeviceNo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)
EFI_STATUS AhciRead(IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData, OUT VOID *Buffer, IN EFI_LBA StartLba, IN UINTN BufferSize)
EFI_STATUS EFIAPI AhciBlockIoReadBlocks(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
PEI_AHCI_ATA_DEVICE_DATA * SearchDeviceByIndex(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINTN DeviceIndex)
EFI_STATUS EFIAPI AhciBlockIoGetMediaInfo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo)
EFI_STATUS AccessAtaDevice(IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData, IN OUT UINT8 *Buffer, IN EFI_LBA StartLba, IN UINTN NumberOfBlocks)
EFI_STATUS EFIAPI AhciBlockIoGetDeviceNo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
EFI_STATUS EFIAPI AhciBlockIoGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
EFI_STATUS EFIAPI AhciBlockIoReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define DEBUG(Expression)
EFI_PEI_BLOCK_DEVICE_TYPE