31 IN UINT16 PortMultiplierPort
38 while (!
IsNull (&Private->DeviceList, Node)) {
39 DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
41 if ((DeviceData->Port == Port) &&
42 (DeviceData->PortMultiplier == PortMultiplierPort))
89 IN UINT16 PortMultiplierPort,
96 if (PortMultiplierPort == 0xFFFF) {
102 PortMultiplierPort = 0;
105 switch (Packet->Protocol) {
106 case EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA:
110 (UINT8)PortMultiplierPort,
117 case EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN:
121 (UINT8)PortMultiplierPort,
126 Packet->InDataBuffer,
127 Packet->InTransferLength,
131 case EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_OUT:
135 (UINT8)PortMultiplierPort,
140 Packet->OutDataBuffer,
141 Packet->OutTransferLength,
146 return EFI_UNSUPPORTED;
192 IN UINT16 PortMultiplierPort,
199 UINT32 MaxSectorCount;
202 if ((This ==
NULL) || (Packet ==
NULL)) {
203 return EFI_INVALID_PARAMETER;
206 IoAlign = This->Mode->IoAlign;
208 return EFI_INVALID_PARAMETER;
212 return EFI_INVALID_PARAMETER;
216 return EFI_INVALID_PARAMETER;
219 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (This);
221 if (DeviceData ==
NULL) {
222 return EFI_NOT_FOUND;
225 MaxSectorCount = mMaxTransferBlockNumber[DeviceData->Lba48Bit];
231 if (((Packet->Length & EFI_ATA_PASS_THRU_LENGTH_BYTES) == 0) &&
232 (Packet->InTransferLength != 0))
234 Packet->InTransferLength = Packet->InTransferLength * BlockSize;
240 if (((Packet->Length & EFI_ATA_PASS_THRU_LENGTH_BYTES) == 0) &&
241 (Packet->OutTransferLength != 0))
243 Packet->OutTransferLength = Packet->OutTransferLength * BlockSize;
251 if (((Packet->InTransferLength != 0) && (Packet->InTransferLength > MaxSectorCount * BlockSize)) ||
252 ((Packet->OutTransferLength != 0) && (Packet->OutTransferLength > MaxSectorCount * BlockSize)))
254 return EFI_BAD_BUFFER_SIZE;
260 DeviceData->PortMultiplier,
261 DeviceData->FisIndex,
309 if ((This ==
NULL) || (Port ==
NULL)) {
310 return EFI_INVALID_PARAMETER;
313 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (This);
315 if (*Port == 0xFFFF) {
321 if (!
IsNull (&Private->DeviceList, Node)) {
322 DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
324 *Port = DeviceData->Port;
328 return EFI_NOT_FOUND;
329 }
else if (*Port == Private->PreviousPort) {
332 while (!
IsNull (&Private->DeviceList, Node)) {
333 DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
335 if (DeviceData->Port > *Port) {
336 *Port = DeviceData->Port;
343 return EFI_NOT_FOUND;
348 return EFI_INVALID_PARAMETER;
355 Private->PreviousPort = *Port;
412 IN OUT UINT16 *PortMultiplierPort
419 if ((This ==
NULL) || (PortMultiplierPort ==
NULL)) {
420 return EFI_INVALID_PARAMETER;
423 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (This);
425 if (Private->PreviousPortMultiplier == 0xFFFF) {
431 Private->PreviousPortMultiplier = 0;
432 return EFI_NOT_FOUND;
435 if (*PortMultiplierPort == Private->PreviousPortMultiplier) {
438 while (!
IsNull (&Private->DeviceList, Node)) {
439 DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
441 if ((DeviceData->Port == Port) &&
442 (DeviceData->PortMultiplier > *PortMultiplierPort))
444 *PortMultiplierPort = DeviceData->PortMultiplier;
451 return EFI_NOT_FOUND;
452 }
else if (*PortMultiplierPort == 0xFFFF) {
459 while (!
IsNull (&Private->DeviceList, Node)) {
460 DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
462 if (DeviceData->Port == Port) {
463 *PortMultiplierPort = DeviceData->PortMultiplier;
470 return EFI_NOT_FOUND;
476 return EFI_INVALID_PARAMETER;
483 Private->PreviousPortMultiplier = *PortMultiplierPort;
515 if ((This ==
NULL) || (DevicePathLength ==
NULL) || (DevicePath ==
NULL)) {
516 return EFI_INVALID_PARAMETER;
519 Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (This);
521 *DevicePathLength = Private->DevicePathLength;
522 *DevicePath =
AllocateCopyPool (Private->DevicePathLength, Private->DevicePath);
523 if (*DevicePath ==
NULL) {
524 *DevicePathLength = 0;
525 return EFI_OUT_OF_RESOURCES;
EFI_STATUS AhciNonDataTransfer(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN UINT64 Timeout)
EFI_STATUS AhciPioTransfer(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT8 Port, IN UINT8 PortMultiplier, IN UINT8 FisIndex, IN BOOLEAN Read, IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, IN OUT VOID *MemoryAddr, IN UINT32 DataCount, IN UINT64 Timeout)
EFI_STATUS EFIAPI AhciAtaPassThruGetNextDevice(IN EDKII_PEI_ATA_PASS_THRU_PPI *This, IN UINT16 Port, IN OUT UINT16 *PortMultiplierPort)
EFI_STATUS EFIAPI AhciAtaPassThruGetDevicePath(IN EDKII_PEI_ATA_PASS_THRU_PPI *This, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI AhciAtaPassThruPassThru(IN EDKII_PEI_ATA_PASS_THRU_PPI *This, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet)
PEI_AHCI_ATA_DEVICE_DATA * SearchDeviceByPort(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort)
EFI_STATUS EFIAPI AhciAtaPassThruGetNextPort(IN EDKII_PEI_ATA_PASS_THRU_PPI *This, IN OUT UINT16 *Port)
EFI_STATUS AhciPassThruExecute(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN UINT8 FisIndex, IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet)
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 AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define ADDRESS_IS_ALIGNED(Address, Alignment)
VOID EFIAPI Exit(IN EFI_STATUS Status)