TianoCore EDK2 master
Loading...
Searching...
No Matches
AhciPeiPassThru.c File Reference
#include "AhciPei.h"

Go to the source code of this file.

Functions

PEI_AHCI_ATA_DEVICE_DATASearchDeviceByPort (IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort)
 
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)
 
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)
 
EFI_STATUS EFIAPI AhciAtaPassThruGetNextPort (IN EDKII_PEI_ATA_PASS_THRU_PPI *This, IN OUT UINT16 *Port)
 
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)
 

Detailed Description

The AhciPei driver is used to manage ATA hard disk device working under AHCI mode at PEI phase.

Copyright (c) 2019, Intel Corporation. All rights reserved.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AhciPeiPassThru.c.

Function Documentation

◆ AhciAtaPassThruGetDevicePath()

EFI_STATUS EFIAPI AhciAtaPassThruGetDevicePath ( IN EDKII_PEI_ATA_PASS_THRU_PPI This,
OUT UINTN DevicePathLength,
OUT EFI_DEVICE_PATH_PROTOCOL **  DevicePath 
)

Gets the device path information of the underlying ATA host controller.

Parameters
[in]ThisThe PPI instance pointer.
[out]DevicePathLengthThe length of the device path in bytes specified by DevicePath.
[out]DevicePathThe device path of the underlying ATA host controller. This field re-uses EFI Device Path Protocol as defined by Section 10.2 EFI Device Path Protocol of UEFI 2.7 Specification.
Return values
EFI_SUCCESSThe device path of the ATA host controller has been successfully returned.
EFI_INVALID_PARAMETERDevicePathLength or DevicePath is NULL.
EFI_OUT_OF_RESOURCESNot enough resource to return the device path.

Definition at line 507 of file AhciPeiPassThru.c.

◆ AhciAtaPassThruGetNextDevice()

EFI_STATUS EFIAPI AhciAtaPassThruGetNextDevice ( IN EDKII_PEI_ATA_PASS_THRU_PPI This,
IN UINT16  Port,
IN OUT UINT16 *  PortMultiplierPort 
)

Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA controller. These can either be the list of port multiplier ports where ATA devices are actually present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this function must probe the port number and port multiplier port number returned to see if an ATA device is actually present.

The GetNextDevice() function retrieves the port multiplier port number of an ATA device present on a port of an ATA controller.

If PortMultiplierPort points to a port multiplier port number value that was returned on a previous call to GetNextDevice(), then the port multiplier port number of the next ATA device on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is returned.

If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first ATA device on port of the ATA controller is returned in PortMultiplierPort and EFI_SUCCESS is returned.

If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER is returned.

If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of the ATA controller, then EFI_NOT_FOUND is returned.

Parameters
[in]ThisThe PPI instance pointer.
[in]PortThe port number present on the ATA controller.
[in,out]PortMultiplierPortOn input, a pointer to the port multiplier port number of an ATA device present on the ATA controller. If on input a PortMultiplierPort of 0xFFFF is specified, then the port multiplier port number of the first ATA device is returned. On output, a pointer to the port multiplier port number of the next ATA device present on an ATA controller.
Return values
EFI_SUCCESSThe port multiplier port number of the next ATA device on the port of the ATA controller was returned in PortMultiplierPort.
EFI_NOT_FOUNDThere are no more ATA devices on this port of the ATA controller.
EFI_INVALID_PARAMETERPortMultiplierPort is not 0xFFFF, and PortMultiplierPort was not returned on a previous call to GetNextDevice().

Definition at line 409 of file AhciPeiPassThru.c.

◆ AhciAtaPassThruGetNextPort()

EFI_STATUS EFIAPI AhciAtaPassThruGetNextPort ( IN EDKII_PEI_ATA_PASS_THRU_PPI This,
IN OUT UINT16 *  Port 
)

Used to retrieve the list of legal port numbers for ATA devices on an ATA controller. These can either be the list of ports where ATA devices are actually present or the list of legal port numbers for the ATA controller. Regardless, the caller of this function must probe the port number returned to see if an ATA device is actually present at that location on the ATA controller.

The GetNextPort() function retrieves the port number on an ATA controller. If on input Port is 0xFFFF, then the port number of the first port on the ATA controller is returned in Port and EFI_SUCCESS is returned.

If Port is a port number that was returned on a previous call to GetNextPort(), then the port number of the next port on the ATA controller is returned in Port, and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.

If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is returned.

Parameters
[in]ThisThe PPI instance pointer.
[in,out]PortOn input, a pointer to the port number on the ATA controller. On output, a pointer to the next port number on the ATA controller. An input value of 0xFFFF retrieves the first port number on the ATA controller.
Return values
EFI_SUCCESSThe next port number on the ATA controller was returned in Port.
EFI_NOT_FOUNDThere are no more ports on this ATA controller.
EFI_INVALID_PARAMETERPort is not 0xFFFF and Port was not returned on a previous call to GetNextPort().

Definition at line 300 of file AhciPeiPassThru.c.

◆ AhciAtaPassThruPassThru()

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 
)

Sends an ATA command to an ATA device that is attached to the ATA controller.

Parameters
[in]ThisThe PPI instance pointer.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
[in,out]PacketA pointer to the ATA command to send to the ATA device specified by Port and PortMultiplierPort.
Return values
EFI_SUCCESSThe ATA command was sent by the host. For bi-directional commands, InTransferLength bytes were transferred from InDataBuffer. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
EFI_NOT_FOUNDThe specified ATA device is not found.
EFI_INVALID_PARAMETERThe contents of Acb are invalid. The ATA command was not sent, so no additional status information is available.
EFI_BAD_BUFFER_SIZEThe ATA command was not executed. The number of bytes that could be transferred is returned in InTransferLength. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
EFI_NOT_READYThe ATA command could not be sent because there are too many ATA commands already queued. The caller may retry again later.
EFI_DEVICE_ERRORA device error occurred while attempting to send the ATA command.

Definition at line 189 of file AhciPeiPassThru.c.

◆ AhciPassThruExecute()

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 
)

Sends an ATA command to an ATA device that is attached to the ATA controller.

Parameters
[in]PrivatePointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA.
[in]PortThe port number of the ATA device.
[in]PortMultiplierPortThe port multiplier port number of the ATA device.
[in]FisIndexThe index of the FIS.
[in,out]PacketA pointer to the ATA command to send to the ATA device specified by Port and PortMultiplierPort.
Return values
EFI_SUCCESSThe ATA command was sent by the host. For bi-directional commands, InTransferLength bytes were transferred from InDataBuffer. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
EFI_BAD_BUFFER_SIZEThe ATA command was not executed. The number of bytes that could be transferred is returned in InTransferLength. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.
EFI_NOT_READYThe ATA command could not be sent because there are too many ATA commands already queued. The caller may retry again later.
EFI_DEVICE_ERRORA device error occurred while attempting to send the ATA command.
EFI_INVALID_PARAMETERPort, PortMultiplierPort, or the contents of Acb are invalid. The ATA command was not sent, so no additional status information is available.

Definition at line 86 of file AhciPeiPassThru.c.

◆ SearchDeviceByPort()

PEI_AHCI_ATA_DEVICE_DATA * SearchDeviceByPort ( IN PEI_AHCI_CONTROLLER_PRIVATE_DATA Private,
IN UINT16  Port,
IN UINT16  PortMultiplierPort 
)

Traverse the attached ATA devices list to find out the device with given Port and PortMultiplierPort.

Parameters
[in]PrivateA pointer to the PEI_AHCI_CONTROLLER_PRIVATE_DATA instance.
[in]PortThe port number of the ATA device.
[in]PortMultiplierPortThe port multiplier port number of the ATA device.
Return values
Thepointer to the PEI_AHCI_ATA_DEVICE_DATA structure of the device info to access.

Definition at line 28 of file AhciPeiPassThru.c.