MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,6 @@ EFI_PEI_NOTIFY_DESCRIPTOR mAhciEndOfPeiNotifyListTemplate = {
|
||||
AhciPeimEndOfPei
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Free the DMA resources allocated by an ATA AHCI controller.
|
||||
|
||||
@@ -50,10 +49,10 @@ EFI_PEI_NOTIFY_DESCRIPTOR mAhciEndOfPeiNotifyListTemplate = {
|
||||
**/
|
||||
VOID
|
||||
AhciFreeDmaResource (
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private
|
||||
)
|
||||
{
|
||||
EFI_AHCI_REGISTERS *AhciRegisters;
|
||||
EFI_AHCI_REGISTERS *AhciRegisters;
|
||||
|
||||
ASSERT (Private != NULL);
|
||||
|
||||
@@ -61,18 +60,18 @@ AhciFreeDmaResource (
|
||||
|
||||
if (AhciRegisters->AhciRFisMap != NULL) {
|
||||
IoMmuFreeBuffer (
|
||||
EFI_SIZE_TO_PAGES (AhciRegisters->MaxRFisSize),
|
||||
AhciRegisters->AhciRFis,
|
||||
AhciRegisters->AhciRFisMap
|
||||
);
|
||||
EFI_SIZE_TO_PAGES (AhciRegisters->MaxRFisSize),
|
||||
AhciRegisters->AhciRFis,
|
||||
AhciRegisters->AhciRFisMap
|
||||
);
|
||||
}
|
||||
|
||||
if (AhciRegisters->AhciCmdListMap != NULL) {
|
||||
IoMmuFreeBuffer (
|
||||
EFI_SIZE_TO_PAGES (AhciRegisters->MaxCmdListSize),
|
||||
AhciRegisters->AhciCmdList,
|
||||
AhciRegisters->AhciCmdListMap
|
||||
);
|
||||
EFI_SIZE_TO_PAGES (AhciRegisters->MaxCmdListSize),
|
||||
AhciRegisters->AhciCmdList,
|
||||
AhciRegisters->AhciCmdListMap
|
||||
);
|
||||
}
|
||||
|
||||
if (AhciRegisters->AhciCmdTableMap != NULL) {
|
||||
@@ -82,7 +81,6 @@ AhciFreeDmaResource (
|
||||
AhciRegisters->AhciCmdTableMap
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +102,7 @@ AhciPeimEndOfPei (
|
||||
IN VOID *Ppi
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY (NotifyDescriptor);
|
||||
AhciFreeDmaResource (Private);
|
||||
@@ -124,20 +122,20 @@ AhciPeimEndOfPei (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaAhciPeimEntry (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_MODE BootMode;
|
||||
EDKII_ATA_AHCI_HOST_CONTROLLER_PPI *AhciHcPpi;
|
||||
UINT8 Controller;
|
||||
UINTN MmioBase;
|
||||
UINTN DevicePathLength;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINT32 PortBitMap;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
UINT8 NumberOfPorts;
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_MODE BootMode;
|
||||
EDKII_ATA_AHCI_HOST_CONTROLLER_PPI *AhciHcPpi;
|
||||
UINT8 Controller;
|
||||
UINTN MmioBase;
|
||||
UINTN DevicePathLength;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINT32 PortBitMap;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
UINT8 NumberOfPorts;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Enters.\n", __FUNCTION__));
|
||||
|
||||
@@ -157,7 +155,7 @@ AtaAhciPeimEntry (
|
||||
&gEdkiiPeiAtaAhciHostControllerPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &AhciHcPpi
|
||||
(VOID **)&AhciHcPpi
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Failed to locate AtaAhciHostControllerPpi.\n", __FUNCTION__));
|
||||
@@ -187,8 +185,10 @@ AtaAhciPeimEntry (
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR, "%a: Fail to allocate get the device path for Controller %d.\n",
|
||||
__FUNCTION__, Controller
|
||||
DEBUG_ERROR,
|
||||
"%a: Fail to allocate get the device path for Controller %d.\n",
|
||||
__FUNCTION__,
|
||||
Controller
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
@@ -199,8 +199,10 @@ AtaAhciPeimEntry (
|
||||
Status = AhciIsHcDevicePathValid (DevicePath, DevicePathLength);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR, "%a: The device path is invalid for Controller %d.\n",
|
||||
__FUNCTION__, Controller
|
||||
DEBUG_ERROR,
|
||||
"%a: The device path is invalid for Controller %d.\n",
|
||||
__FUNCTION__,
|
||||
Controller
|
||||
));
|
||||
Controller++;
|
||||
continue;
|
||||
@@ -231,8 +233,10 @@ AtaAhciPeimEntry (
|
||||
Private = AllocateZeroPool (sizeof (PEI_AHCI_CONTROLLER_PRIVATE_DATA));
|
||||
if (Private == NULL) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR, "%a: Fail to allocate private data for Controller %d.\n",
|
||||
__FUNCTION__, Controller
|
||||
DEBUG_ERROR,
|
||||
"%a: Fail to allocate private data for Controller %d.\n",
|
||||
__FUNCTION__,
|
||||
Controller
|
||||
));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -260,8 +264,8 @@ AtaAhciPeimEntry (
|
||||
continue;
|
||||
}
|
||||
|
||||
Private->AtaPassThruMode.Attributes = EFI_ATA_PASS_THRU_ATTRIBUTES_PHYSICAL |
|
||||
EFI_ATA_PASS_THRU_ATTRIBUTES_LOGICAL;
|
||||
Private->AtaPassThruMode.Attributes = EFI_ATA_PASS_THRU_ATTRIBUTES_PHYSICAL |
|
||||
EFI_ATA_PASS_THRU_ATTRIBUTES_LOGICAL;
|
||||
Private->AtaPassThruMode.IoAlign = sizeof (UINTN);
|
||||
Private->AtaPassThruPpi.Revision = EDKII_PEI_ATA_PASS_THRU_PPI_REVISION;
|
||||
Private->AtaPassThruPpi.Mode = &Private->AtaPassThruMode;
|
||||
@@ -274,18 +278,18 @@ AtaAhciPeimEntry (
|
||||
&mAhciAtaPassThruPpiListTemplate,
|
||||
sizeof (EFI_PEI_PPI_DESCRIPTOR)
|
||||
);
|
||||
Private->AtaPassThruPpiList.Ppi = &Private->AtaPassThruPpi;
|
||||
Private->AtaPassThruPpiList.Ppi = &Private->AtaPassThruPpi;
|
||||
PeiServicesInstallPpi (&Private->AtaPassThruPpiList);
|
||||
|
||||
Private->BlkIoPpi.GetNumberOfBlockDevices = AhciBlockIoGetDeviceNo;
|
||||
Private->BlkIoPpi.GetBlockDeviceMediaInfo = AhciBlockIoGetMediaInfo;
|
||||
Private->BlkIoPpi.ReadBlocks = AhciBlockIoReadBlocks;
|
||||
Private->BlkIoPpi.GetNumberOfBlockDevices = AhciBlockIoGetDeviceNo;
|
||||
Private->BlkIoPpi.GetBlockDeviceMediaInfo = AhciBlockIoGetMediaInfo;
|
||||
Private->BlkIoPpi.ReadBlocks = AhciBlockIoReadBlocks;
|
||||
CopyMem (
|
||||
&Private->BlkIoPpiList,
|
||||
&mAhciBlkIoPpiListTemplate,
|
||||
sizeof (EFI_PEI_PPI_DESCRIPTOR)
|
||||
);
|
||||
Private->BlkIoPpiList.Ppi = &Private->BlkIoPpi;
|
||||
Private->BlkIoPpiList.Ppi = &Private->BlkIoPpi;
|
||||
PeiServicesInstallPpi (&Private->BlkIoPpiList);
|
||||
|
||||
Private->BlkIo2Ppi.Revision = EFI_PEI_RECOVERY_BLOCK_IO2_PPI_REVISION;
|
||||
@@ -297,14 +301,15 @@ AtaAhciPeimEntry (
|
||||
&mAhciBlkIo2PpiListTemplate,
|
||||
sizeof (EFI_PEI_PPI_DESCRIPTOR)
|
||||
);
|
||||
Private->BlkIo2PpiList.Ppi = &Private->BlkIo2Ppi;
|
||||
Private->BlkIo2PpiList.Ppi = &Private->BlkIo2Ppi;
|
||||
PeiServicesInstallPpi (&Private->BlkIo2PpiList);
|
||||
|
||||
if (Private->TrustComputingDevices != 0) {
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: Security Security Command PPI will be produced for Controller %d.\n",
|
||||
__FUNCTION__, Controller
|
||||
__FUNCTION__,
|
||||
Controller
|
||||
));
|
||||
Private->StorageSecurityPpi.Revision = EDKII_STORAGE_SECURITY_PPI_REVISION;
|
||||
Private->StorageSecurityPpi.GetNumberofDevices = AhciStorageSecurityGetDeviceNo;
|
||||
@@ -316,7 +321,7 @@ AtaAhciPeimEntry (
|
||||
&mAhciStorageSecurityPpiListTemplate,
|
||||
sizeof (EFI_PEI_PPI_DESCRIPTOR)
|
||||
);
|
||||
Private->StorageSecurityPpiList.Ppi = &Private->StorageSecurityPpi;
|
||||
Private->StorageSecurityPpiList.Ppi = &Private->StorageSecurityPpi;
|
||||
PeiServicesInstallPpi (&Private->StorageSecurityPpiList);
|
||||
}
|
||||
|
||||
@@ -325,11 +330,13 @@ AtaAhciPeimEntry (
|
||||
&mAhciEndOfPeiNotifyListTemplate,
|
||||
sizeof (EFI_PEI_NOTIFY_DESCRIPTOR)
|
||||
);
|
||||
PeiServicesNotifyPpi (&Private->EndOfPeiNotifyList);
|
||||
PeiServicesNotifyPpi (&Private->EndOfPeiNotifyList);
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO, "%a: Controller %d has been successfully initialized.\n",
|
||||
__FUNCTION__, Controller
|
||||
DEBUG_INFO,
|
||||
"%a: Controller %d has been successfully initialized.\n",
|
||||
__FUNCTION__,
|
||||
Controller
|
||||
));
|
||||
Controller++;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@
|
||||
//
|
||||
// Structure forward declarations
|
||||
//
|
||||
typedef struct _PEI_AHCI_CONTROLLER_PRIVATE_DATA PEI_AHCI_CONTROLLER_PRIVATE_DATA;
|
||||
typedef struct _PEI_AHCI_CONTROLLER_PRIVATE_DATA PEI_AHCI_CONTROLLER_PRIVATE_DATA;
|
||||
|
||||
#include "AhciPeiPassThru.h"
|
||||
#include "AhciPeiBlockIo.h"
|
||||
@@ -46,107 +46,107 @@ typedef struct _PEI_AHCI_CONTROLLER_PRIVATE_DATA PEI_AHCI_CONTROLLER_PRIVATE_DA
|
||||
// Refer SATA1.0a spec section 5.2, the Phy detection time should be less than 10ms.
|
||||
// The value is in millisecond units. Add a bit of margin for robustness.
|
||||
//
|
||||
#define AHCI_BUS_PHY_DETECT_TIMEOUT 15
|
||||
#define AHCI_BUS_PHY_DETECT_TIMEOUT 15
|
||||
//
|
||||
// Refer SATA1.0a spec, the bus reset time should be less than 1s.
|
||||
// The value is in 100ns units.
|
||||
//
|
||||
#define AHCI_PEI_RESET_TIMEOUT 10000000
|
||||
#define AHCI_PEI_RESET_TIMEOUT 10000000
|
||||
//
|
||||
// Time out Value for ATA pass through protocol, in 100ns units.
|
||||
//
|
||||
#define ATA_TIMEOUT 30000000
|
||||
#define ATA_TIMEOUT 30000000
|
||||
//
|
||||
// Maximal number of Physical Region Descriptor Table entries supported.
|
||||
//
|
||||
#define AHCI_MAX_PRDT_NUMBER 8
|
||||
#define AHCI_MAX_PRDT_NUMBER 8
|
||||
|
||||
#define AHCI_CAPABILITY_OFFSET 0x0000
|
||||
#define AHCI_CAP_SAM BIT18
|
||||
#define AHCI_CAP_SSS BIT27
|
||||
#define AHCI_CAPABILITY_OFFSET 0x0000
|
||||
#define AHCI_CAP_SAM BIT18
|
||||
#define AHCI_CAP_SSS BIT27
|
||||
|
||||
#define AHCI_GHC_OFFSET 0x0004
|
||||
#define AHCI_GHC_RESET BIT0
|
||||
#define AHCI_GHC_ENABLE BIT31
|
||||
#define AHCI_GHC_OFFSET 0x0004
|
||||
#define AHCI_GHC_RESET BIT0
|
||||
#define AHCI_GHC_ENABLE BIT31
|
||||
|
||||
#define AHCI_IS_OFFSET 0x0008
|
||||
#define AHCI_PI_OFFSET 0x000C
|
||||
#define AHCI_IS_OFFSET 0x0008
|
||||
#define AHCI_PI_OFFSET 0x000C
|
||||
|
||||
#define AHCI_MAX_PORTS 32
|
||||
#define AHCI_MAX_PORTS 32
|
||||
|
||||
typedef struct {
|
||||
UINT32 Lower32;
|
||||
UINT32 Upper32;
|
||||
UINT32 Lower32;
|
||||
UINT32 Upper32;
|
||||
} DATA_32;
|
||||
|
||||
typedef union {
|
||||
DATA_32 Uint32;
|
||||
UINT64 Uint64;
|
||||
DATA_32 Uint32;
|
||||
UINT64 Uint64;
|
||||
} DATA_64;
|
||||
|
||||
#define AHCI_ATAPI_SIG_MASK 0xFFFF0000
|
||||
#define AHCI_ATA_DEVICE_SIG 0x00000000
|
||||
#define AHCI_ATAPI_SIG_MASK 0xFFFF0000
|
||||
#define AHCI_ATA_DEVICE_SIG 0x00000000
|
||||
|
||||
//
|
||||
// Each PRDT entry can point to a memory block up to 4M byte
|
||||
//
|
||||
#define AHCI_MAX_DATA_PER_PRDT 0x400000
|
||||
#define AHCI_MAX_DATA_PER_PRDT 0x400000
|
||||
|
||||
#define AHCI_FIS_REGISTER_H2D 0x27 //Register FIS - Host to Device
|
||||
#define AHCI_FIS_REGISTER_H2D_LENGTH 20
|
||||
#define AHCI_FIS_REGISTER_D2H 0x34 //Register FIS - Device to Host
|
||||
#define AHCI_FIS_PIO_SETUP 0x5F //PIO Setup FIS - Device to Host
|
||||
#define AHCI_FIS_REGISTER_H2D 0x27 // Register FIS - Host to Device
|
||||
#define AHCI_FIS_REGISTER_H2D_LENGTH 20
|
||||
#define AHCI_FIS_REGISTER_D2H 0x34 // Register FIS - Device to Host
|
||||
#define AHCI_FIS_PIO_SETUP 0x5F // PIO Setup FIS - Device to Host
|
||||
|
||||
#define AHCI_D2H_FIS_OFFSET 0x40
|
||||
#define AHCI_PIO_FIS_OFFSET 0x20
|
||||
#define AHCI_FIS_TYPE_MASK 0xFF
|
||||
#define AHCI_D2H_FIS_OFFSET 0x40
|
||||
#define AHCI_PIO_FIS_OFFSET 0x20
|
||||
#define AHCI_FIS_TYPE_MASK 0xFF
|
||||
|
||||
//
|
||||
// Port register
|
||||
//
|
||||
#define AHCI_PORT_START 0x0100
|
||||
#define AHCI_PORT_REG_WIDTH 0x0080
|
||||
#define AHCI_PORT_CLB 0x0000
|
||||
#define AHCI_PORT_CLBU 0x0004
|
||||
#define AHCI_PORT_FB 0x0008
|
||||
#define AHCI_PORT_FBU 0x000C
|
||||
#define AHCI_PORT_IS 0x0010
|
||||
#define AHCI_PORT_IE 0x0014
|
||||
#define AHCI_PORT_CMD 0x0018
|
||||
#define AHCI_PORT_CMD_ST BIT0
|
||||
#define AHCI_PORT_CMD_SUD BIT1
|
||||
#define AHCI_PORT_CMD_POD BIT2
|
||||
#define AHCI_PORT_CMD_CLO BIT3
|
||||
#define AHCI_PORT_CMD_FRE BIT4
|
||||
#define AHCI_PORT_CMD_FR BIT14
|
||||
#define AHCI_PORT_CMD_CR BIT15
|
||||
#define AHCI_PORT_CMD_CPD BIT20
|
||||
#define AHCI_PORT_CMD_ATAPI BIT24
|
||||
#define AHCI_PORT_CMD_DLAE BIT25
|
||||
#define AHCI_PORT_CMD_ALPE BIT26
|
||||
#define AHCI_PORT_CMD_ACTIVE (1 << 28)
|
||||
#define AHCI_PORT_CMD_ICC_MASK (BIT28 | BIT29 | BIT30 | BIT31)
|
||||
#define AHCI_PORT_START 0x0100
|
||||
#define AHCI_PORT_REG_WIDTH 0x0080
|
||||
#define AHCI_PORT_CLB 0x0000
|
||||
#define AHCI_PORT_CLBU 0x0004
|
||||
#define AHCI_PORT_FB 0x0008
|
||||
#define AHCI_PORT_FBU 0x000C
|
||||
#define AHCI_PORT_IS 0x0010
|
||||
#define AHCI_PORT_IE 0x0014
|
||||
#define AHCI_PORT_CMD 0x0018
|
||||
#define AHCI_PORT_CMD_ST BIT0
|
||||
#define AHCI_PORT_CMD_SUD BIT1
|
||||
#define AHCI_PORT_CMD_POD BIT2
|
||||
#define AHCI_PORT_CMD_CLO BIT3
|
||||
#define AHCI_PORT_CMD_FRE BIT4
|
||||
#define AHCI_PORT_CMD_FR BIT14
|
||||
#define AHCI_PORT_CMD_CR BIT15
|
||||
#define AHCI_PORT_CMD_CPD BIT20
|
||||
#define AHCI_PORT_CMD_ATAPI BIT24
|
||||
#define AHCI_PORT_CMD_DLAE BIT25
|
||||
#define AHCI_PORT_CMD_ALPE BIT26
|
||||
#define AHCI_PORT_CMD_ACTIVE (1 << 28)
|
||||
#define AHCI_PORT_CMD_ICC_MASK (BIT28 | BIT29 | BIT30 | BIT31)
|
||||
|
||||
#define AHCI_PORT_TFD 0x0020
|
||||
#define AHCI_PORT_TFD_ERR BIT0
|
||||
#define AHCI_PORT_TFD_DRQ BIT3
|
||||
#define AHCI_PORT_TFD_BSY BIT7
|
||||
#define AHCI_PORT_TFD_MASK (BIT7 | BIT3 | BIT0)
|
||||
#define AHCI_PORT_TFD 0x0020
|
||||
#define AHCI_PORT_TFD_ERR BIT0
|
||||
#define AHCI_PORT_TFD_DRQ BIT3
|
||||
#define AHCI_PORT_TFD_BSY BIT7
|
||||
#define AHCI_PORT_TFD_MASK (BIT7 | BIT3 | BIT0)
|
||||
|
||||
#define AHCI_PORT_SIG 0x0024
|
||||
#define AHCI_PORT_SSTS 0x0028
|
||||
#define AHCI_PORT_SSTS_DET_MASK 0x000F
|
||||
#define AHCI_PORT_SSTS_DET 0x0001
|
||||
#define AHCI_PORT_SSTS_DET_PCE 0x0003
|
||||
#define AHCI_PORT_SIG 0x0024
|
||||
#define AHCI_PORT_SSTS 0x0028
|
||||
#define AHCI_PORT_SSTS_DET_MASK 0x000F
|
||||
#define AHCI_PORT_SSTS_DET 0x0001
|
||||
#define AHCI_PORT_SSTS_DET_PCE 0x0003
|
||||
|
||||
#define AHCI_PORT_SCTL 0x002C
|
||||
#define AHCI_PORT_SCTL_IPM_INIT 0x0300
|
||||
#define AHCI_PORT_SCTL 0x002C
|
||||
#define AHCI_PORT_SCTL_IPM_INIT 0x0300
|
||||
|
||||
#define AHCI_PORT_SERR 0x0030
|
||||
#define AHCI_PORT_CI 0x0038
|
||||
#define AHCI_PORT_SERR 0x0030
|
||||
#define AHCI_PORT_CI 0x0038
|
||||
|
||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||
#define TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)
|
||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||
#define TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
@@ -170,19 +170,19 @@ typedef struct {
|
||||
// The entry Data structure is listed at the following.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 AhciCmdCfl:5; //Command FIS Length
|
||||
UINT32 AhciCmdA:1; //ATAPI
|
||||
UINT32 AhciCmdW:1; //Write
|
||||
UINT32 AhciCmdP:1; //Prefetchable
|
||||
UINT32 AhciCmdR:1; //Reset
|
||||
UINT32 AhciCmdB:1; //BIST
|
||||
UINT32 AhciCmdC:1; //Clear Busy upon R_OK
|
||||
UINT32 AhciCmdRsvd:1;
|
||||
UINT32 AhciCmdPmp:4; //Port Multiplier Port
|
||||
UINT32 AhciCmdPrdtl:16; //Physical Region Descriptor Table Length
|
||||
UINT32 AhciCmdPrdbc; //Physical Region Descriptor Byte Count
|
||||
UINT32 AhciCmdCtba; //Command Table Descriptor Base Address
|
||||
UINT32 AhciCmdCtbau; //Command Table Descriptor Base Address Upper 32-BITs
|
||||
UINT32 AhciCmdCfl : 5; // Command FIS Length
|
||||
UINT32 AhciCmdA : 1; // ATAPI
|
||||
UINT32 AhciCmdW : 1; // Write
|
||||
UINT32 AhciCmdP : 1; // Prefetchable
|
||||
UINT32 AhciCmdR : 1; // Reset
|
||||
UINT32 AhciCmdB : 1; // BIST
|
||||
UINT32 AhciCmdC : 1; // Clear Busy upon R_OK
|
||||
UINT32 AhciCmdRsvd : 1;
|
||||
UINT32 AhciCmdPmp : 4; // Port Multiplier Port
|
||||
UINT32 AhciCmdPrdtl : 16; // Physical Region Descriptor Table Length
|
||||
UINT32 AhciCmdPrdbc; // Physical Region Descriptor Byte Count
|
||||
UINT32 AhciCmdCtba; // Command Table Descriptor Base Address
|
||||
UINT32 AhciCmdCtbau; // Command Table Descriptor Base Address Upper 32-BITs
|
||||
UINT32 AhciCmdRsvd1[4];
|
||||
} EFI_AHCI_COMMAND_LIST;
|
||||
|
||||
@@ -192,28 +192,28 @@ typedef struct {
|
||||
// specified in the Serial ATA Revision 2.6 specification.
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 AhciCFisType;
|
||||
UINT8 AhciCFisPmNum:4;
|
||||
UINT8 AhciCFisRsvd:1;
|
||||
UINT8 AhciCFisRsvd1:1;
|
||||
UINT8 AhciCFisRsvd2:1;
|
||||
UINT8 AhciCFisCmdInd:1;
|
||||
UINT8 AhciCFisCmd;
|
||||
UINT8 AhciCFisFeature;
|
||||
UINT8 AhciCFisSecNum;
|
||||
UINT8 AhciCFisClyLow;
|
||||
UINT8 AhciCFisClyHigh;
|
||||
UINT8 AhciCFisDevHead;
|
||||
UINT8 AhciCFisSecNumExp;
|
||||
UINT8 AhciCFisClyLowExp;
|
||||
UINT8 AhciCFisClyHighExp;
|
||||
UINT8 AhciCFisFeatureExp;
|
||||
UINT8 AhciCFisSecCount;
|
||||
UINT8 AhciCFisSecCountExp;
|
||||
UINT8 AhciCFisRsvd3;
|
||||
UINT8 AhciCFisControl;
|
||||
UINT8 AhciCFisRsvd4[4];
|
||||
UINT8 AhciCFisRsvd5[44];
|
||||
UINT8 AhciCFisType;
|
||||
UINT8 AhciCFisPmNum : 4;
|
||||
UINT8 AhciCFisRsvd : 1;
|
||||
UINT8 AhciCFisRsvd1 : 1;
|
||||
UINT8 AhciCFisRsvd2 : 1;
|
||||
UINT8 AhciCFisCmdInd : 1;
|
||||
UINT8 AhciCFisCmd;
|
||||
UINT8 AhciCFisFeature;
|
||||
UINT8 AhciCFisSecNum;
|
||||
UINT8 AhciCFisClyLow;
|
||||
UINT8 AhciCFisClyHigh;
|
||||
UINT8 AhciCFisDevHead;
|
||||
UINT8 AhciCFisSecNumExp;
|
||||
UINT8 AhciCFisClyLowExp;
|
||||
UINT8 AhciCFisClyHighExp;
|
||||
UINT8 AhciCFisFeatureExp;
|
||||
UINT8 AhciCFisSecCount;
|
||||
UINT8 AhciCFisSecCountExp;
|
||||
UINT8 AhciCFisRsvd3;
|
||||
UINT8 AhciCFisControl;
|
||||
UINT8 AhciCFisRsvd4[4];
|
||||
UINT8 AhciCFisRsvd5[44];
|
||||
} EFI_AHCI_COMMAND_FIS;
|
||||
|
||||
//
|
||||
@@ -230,12 +230,12 @@ typedef struct {
|
||||
// list entry for this command slot.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 AhciPrdtDba; //Data Base Address
|
||||
UINT32 AhciPrdtDbau; //Data Base Address Upper 32-BITs
|
||||
UINT32 AhciPrdtDba; // Data Base Address
|
||||
UINT32 AhciPrdtDbau; // Data Base Address Upper 32-BITs
|
||||
UINT32 AhciPrdtRsvd;
|
||||
UINT32 AhciPrdtDbc:22; //Data Byte Count
|
||||
UINT32 AhciPrdtRsvd1:9;
|
||||
UINT32 AhciPrdtIoc:1; //Interrupt on Completion
|
||||
UINT32 AhciPrdtDbc : 22; // Data Byte Count
|
||||
UINT32 AhciPrdtRsvd1 : 9;
|
||||
UINT32 AhciPrdtIoc : 1; // Interrupt on Completion
|
||||
} EFI_AHCI_COMMAND_PRDT;
|
||||
|
||||
//
|
||||
@@ -268,7 +268,7 @@ typedef struct {
|
||||
//
|
||||
// Unique signature for AHCI ATA device information structure.
|
||||
//
|
||||
#define AHCI_PEI_ATA_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('A', 'P', 'A', 'D')
|
||||
#define AHCI_PEI_ATA_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('A', 'P', 'A', 'D')
|
||||
|
||||
//
|
||||
// AHCI mode device information structure.
|
||||
@@ -301,7 +301,7 @@ typedef struct {
|
||||
//
|
||||
// Unique signature for private data structure.
|
||||
//
|
||||
#define AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('A','P','C','P')
|
||||
#define AHCI_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('A','P','C','P')
|
||||
|
||||
//
|
||||
// ATA AHCI controller private data structure.
|
||||
@@ -348,7 +348,7 @@ struct _PEI_AHCI_CONTROLLER_PRIVATE_DATA {
|
||||
//
|
||||
// Global variables
|
||||
//
|
||||
extern UINT32 mMaxTransferBlockNumber[2];
|
||||
extern UINT32 mMaxTransferBlockNumber[2];
|
||||
|
||||
//
|
||||
// Internal functions
|
||||
@@ -394,9 +394,9 @@ IoMmuAllocateBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IoMmuFreeBuffer (
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress,
|
||||
IN VOID *Mapping
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress,
|
||||
IN VOID *Mapping
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -420,11 +420,11 @@ IoMmuFreeBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IoMmuMap (
|
||||
IN EDKII_IOMMU_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
IN EDKII_IOMMU_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -438,7 +438,7 @@ IoMmuMap (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IoMmuUnmap (
|
||||
IN VOID *Mapping
|
||||
IN VOID *Mapping
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -470,7 +470,7 @@ AhciPeimEndOfPei (
|
||||
**/
|
||||
UINT8
|
||||
AhciGetNumberOfPortsFromMap (
|
||||
IN UINT32 PortBitMap
|
||||
IN UINT32 PortBitMap
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -497,16 +497,16 @@ AhciGetNumberOfPortsFromMap (
|
||||
**/
|
||||
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
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -529,13 +529,13 @@ AhciPioTransfer (
|
||||
**/
|
||||
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
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -554,7 +554,7 @@ AhciNonDataTransfer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AhciModeInitialization (
|
||||
IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private
|
||||
IN OUT PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -576,11 +576,11 @@ AhciModeInitialization (
|
||||
**/
|
||||
EFI_STATUS
|
||||
TransferAtaDevice (
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
IN OUT VOID *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINT32 TransferLength,
|
||||
IN BOOLEAN IsWrite
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
IN OUT VOID *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINT32 TransferLength,
|
||||
IN BOOLEAN IsWrite
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -621,14 +621,14 @@ TransferAtaDevice (
|
||||
**/
|
||||
EFI_STATUS
|
||||
TrustTransferAtaDevice (
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN TransferLength,
|
||||
IN BOOLEAN IsTrustSend,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINTN *TransferLengthOut
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN TransferLength,
|
||||
IN BOOLEAN IsTrustSend,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINTN *TransferLengthOut
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -662,9 +662,9 @@ NextDevicePathNode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetDevicePathInstanceSize (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINTN *InstanceSize,
|
||||
OUT BOOLEAN *EntireDevicePathEnd
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINTN *InstanceSize,
|
||||
OUT BOOLEAN *EntireDevicePathEnd
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -680,8 +680,8 @@ GetDevicePathInstanceSize (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AhciIsHcDevicePathValid (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN UINTN DevicePathLength
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN UINTN DevicePathLength
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -702,11 +702,11 @@ AhciIsHcDevicePathValid (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AhciBuildDevicePath (
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -723,9 +723,9 @@ AhciBuildDevicePath (
|
||||
**/
|
||||
UINT8
|
||||
AhciS3GetEumeratePorts (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HcDevicePath,
|
||||
IN UINTN HcDevicePathLength,
|
||||
OUT UINT32 *PortBitMap
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HcDevicePath,
|
||||
IN UINTN HcDevicePathLength,
|
||||
OUT UINT32 *PortBitMap
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -23,12 +23,12 @@
|
||||
**/
|
||||
PEI_AHCI_ATA_DEVICE_DATA *
|
||||
SearchDeviceByIndex (
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINTN DeviceIndex
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINTN DeviceIndex
|
||||
)
|
||||
{
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
|
||||
if ((DeviceIndex == 0) || (DeviceIndex > Private->ActiveDevices)) {
|
||||
return NULL;
|
||||
@@ -66,26 +66,26 @@ SearchDeviceByIndex (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AccessAtaDevice (
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN NumberOfBlocks
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN NumberOfBlocks
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN MaxTransferBlockNumber;
|
||||
UINTN TransferBlockNumber;
|
||||
UINTN BlockSize;
|
||||
EFI_STATUS Status;
|
||||
UINTN MaxTransferBlockNumber;
|
||||
UINTN TransferBlockNumber;
|
||||
UINTN BlockSize;
|
||||
|
||||
//
|
||||
// Ensure Lba48Bit is a valid boolean value
|
||||
//
|
||||
ASSERT ((UINTN) DeviceData->Lba48Bit < 2);
|
||||
if ((UINTN) DeviceData->Lba48Bit >= 2) {
|
||||
ASSERT ((UINTN)DeviceData->Lba48Bit < 2);
|
||||
if ((UINTN)DeviceData->Lba48Bit >= 2) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
MaxTransferBlockNumber = mMaxTransferBlockNumber[DeviceData->Lba48Bit];
|
||||
BlockSize = DeviceData->Media.BlockSize;
|
||||
|
||||
@@ -93,20 +93,24 @@ AccessAtaDevice (
|
||||
if (NumberOfBlocks > MaxTransferBlockNumber) {
|
||||
TransferBlockNumber = MaxTransferBlockNumber;
|
||||
NumberOfBlocks -= MaxTransferBlockNumber;
|
||||
} else {
|
||||
} else {
|
||||
TransferBlockNumber = NumberOfBlocks;
|
||||
NumberOfBlocks = 0;
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_BLKIO, "%a: Blocking AccessAtaDevice, TransferBlockNumber = %x; StartLba = %x\n",
|
||||
__FUNCTION__, TransferBlockNumber, StartLba
|
||||
DEBUG_BLKIO,
|
||||
"%a: Blocking AccessAtaDevice, TransferBlockNumber = %x; StartLba = %x\n",
|
||||
__FUNCTION__,
|
||||
TransferBlockNumber,
|
||||
StartLba
|
||||
));
|
||||
|
||||
Status = TransferAtaDevice (
|
||||
DeviceData,
|
||||
Buffer,
|
||||
StartLba,
|
||||
(UINT32) TransferBlockNumber,
|
||||
(UINT32)TransferBlockNumber,
|
||||
FALSE // Read
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -134,15 +138,15 @@ AccessAtaDevice (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AhciRead (
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
OUT VOID *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN BufferSize
|
||||
IN PEI_AHCI_ATA_DEVICE_DATA *DeviceData,
|
||||
OUT VOID *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BlockSize;
|
||||
UINTN NumberOfBlocks;
|
||||
EFI_STATUS Status;
|
||||
UINTN BlockSize;
|
||||
UINTN NumberOfBlocks;
|
||||
|
||||
//
|
||||
// Check parameters.
|
||||
@@ -163,7 +167,8 @@ AhciRead (
|
||||
if (StartLba > DeviceData->Media.LastBlock) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
NumberOfBlocks = BufferSize / BlockSize;
|
||||
|
||||
NumberOfBlocks = BufferSize / BlockSize;
|
||||
if (NumberOfBlocks - 1 > DeviceData->Media.LastBlock - StartLba) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -176,7 +181,6 @@ AhciRead (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Gets the count of block I/O devices that one specific block driver detects.
|
||||
|
||||
@@ -201,13 +205,13 @@ AhciBlockIoGetDeviceNo (
|
||||
OUT UINTN *NumberBlockDevices
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
|
||||
if (This == NULL || NumberBlockDevices == NULL) {
|
||||
if ((This == NULL) || (NumberBlockDevices == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);
|
||||
*NumberBlockDevices = Private->ActiveDevices;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -263,10 +267,10 @@ AhciBlockIoGetMediaInfo (
|
||||
OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
|
||||
if (This == NULL || MediaInfo == NULL) {
|
||||
if ((This == NULL) || (MediaInfo == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -276,9 +280,9 @@ AhciBlockIoGetMediaInfo (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
MediaInfo->DeviceType = (EFI_PEI_BLOCK_DEVICE_TYPE) EDKII_PEI_BLOCK_DEVICE_TYPE_ATA_HARD_DISK;
|
||||
MediaInfo->DeviceType = (EFI_PEI_BLOCK_DEVICE_TYPE)EDKII_PEI_BLOCK_DEVICE_TYPE_ATA_HARD_DISK;
|
||||
MediaInfo->MediaPresent = TRUE;
|
||||
MediaInfo->LastBlock = (UINTN) DeviceData->Media.LastBlock;
|
||||
MediaInfo->LastBlock = (UINTN)DeviceData->Media.LastBlock;
|
||||
MediaInfo->BlockSize = DeviceData->Media.BlockSize;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -329,8 +333,8 @@ AhciBlockIoReadBlocks (
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -369,13 +373,13 @@ AhciBlockIoGetDeviceNo2 (
|
||||
OUT UINTN *NumberBlockDevices
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
|
||||
if (This == NULL || NumberBlockDevices == NULL) {
|
||||
if ((This == NULL) || (NumberBlockDevices == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
|
||||
*NumberBlockDevices = Private->ActiveDevices;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -431,10 +435,10 @@ AhciBlockIoGetMediaInfo2 (
|
||||
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
|
||||
if (This == NULL || MediaInfo == NULL) {
|
||||
if ((This == NULL) || (MediaInfo == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -498,7 +502,7 @@ AhciBlockIoReadBlocks2 (
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
//
|
||||
// ATA hard disk device for EFI_PEI_BLOCK_DEVICE_TYPE
|
||||
//
|
||||
#define EDKII_PEI_BLOCK_DEVICE_TYPE_ATA_HARD_DISK 8
|
||||
#define EDKII_PEI_BLOCK_DEVICE_TYPE_ATA_HARD_DISK 8
|
||||
|
||||
/**
|
||||
Gets the count of block I/O devices that one specific block driver detects.
|
||||
|
@@ -25,20 +25,21 @@
|
||||
**/
|
||||
PEI_AHCI_ATA_DEVICE_DATA *
|
||||
SearchDeviceByPort (
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort
|
||||
)
|
||||
{
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
|
||||
Node = GetFirstNode (&Private->DeviceList);
|
||||
while (!IsNull (&Private->DeviceList, Node)) {
|
||||
DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
|
||||
|
||||
if ((DeviceData->Port == Port) &&
|
||||
(DeviceData->PortMultiplier == PortMultiplierPort)) {
|
||||
(DeviceData->PortMultiplier == PortMultiplierPort))
|
||||
{
|
||||
return DeviceData;
|
||||
}
|
||||
|
||||
@@ -82,21 +83,21 @@ SearchDeviceByPort (
|
||||
**/
|
||||
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
|
||||
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 Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
switch (Packet->Protocol) {
|
||||
case EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA:
|
||||
Status = AhciNonDataTransfer (
|
||||
Private,
|
||||
(UINT8) Port,
|
||||
(UINT8) PortMultiplierPort,
|
||||
(UINT8)Port,
|
||||
(UINT8)PortMultiplierPort,
|
||||
FisIndex,
|
||||
Packet->Acb,
|
||||
Packet->Asb,
|
||||
@@ -106,8 +107,8 @@ AhciPassThruExecute (
|
||||
case EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN:
|
||||
Status = AhciPioTransfer (
|
||||
Private,
|
||||
(UINT8) Port,
|
||||
(UINT8) PortMultiplierPort,
|
||||
(UINT8)Port,
|
||||
(UINT8)PortMultiplierPort,
|
||||
FisIndex,
|
||||
TRUE,
|
||||
Packet->Acb,
|
||||
@@ -120,8 +121,8 @@ AhciPassThruExecute (
|
||||
case EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_OUT:
|
||||
Status = AhciPioTransfer (
|
||||
Private,
|
||||
(UINT8) Port,
|
||||
(UINT8) PortMultiplierPort,
|
||||
(UINT8)Port,
|
||||
(UINT8)PortMultiplierPort,
|
||||
FisIndex,
|
||||
FALSE,
|
||||
Packet->Acb,
|
||||
@@ -176,19 +177,19 @@ AhciPassThruExecute (
|
||||
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
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet
|
||||
)
|
||||
{
|
||||
UINT32 IoAlign;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
UINT32 MaxSectorCount;
|
||||
UINT32 BlockSize;
|
||||
UINT32 IoAlign;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
UINT32 MaxSectorCount;
|
||||
UINT32 BlockSize;
|
||||
|
||||
if (This == NULL || Packet == NULL) {
|
||||
if ((This == NULL) || (Packet == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -205,7 +206,7 @@ AhciAtaPassThruPassThru (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (This);
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_PASS_THRU (This);
|
||||
DeviceData = SearchDeviceByPort (Private, Port, PortMultiplierPort);
|
||||
if (DeviceData == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
@@ -218,7 +219,8 @@ AhciAtaPassThruPassThru (
|
||||
// Convert the transfer length from sector count to byte.
|
||||
//
|
||||
if (((Packet->Length & EFI_ATA_PASS_THRU_LENGTH_BYTES) == 0) &&
|
||||
(Packet->InTransferLength != 0)) {
|
||||
(Packet->InTransferLength != 0))
|
||||
{
|
||||
Packet->InTransferLength = Packet->InTransferLength * BlockSize;
|
||||
}
|
||||
|
||||
@@ -226,7 +228,8 @@ AhciAtaPassThruPassThru (
|
||||
// Convert the transfer length from sector count to byte.
|
||||
//
|
||||
if (((Packet->Length & EFI_ATA_PASS_THRU_LENGTH_BYTES) == 0) &&
|
||||
(Packet->OutTransferLength != 0)) {
|
||||
(Packet->OutTransferLength != 0))
|
||||
{
|
||||
Packet->OutTransferLength = Packet->OutTransferLength * BlockSize;
|
||||
}
|
||||
|
||||
@@ -236,7 +239,8 @@ AhciAtaPassThruPassThru (
|
||||
// command, then no data is transferred and EFI_BAD_BUFFER_SIZE is returned.
|
||||
//
|
||||
if (((Packet->InTransferLength != 0) && (Packet->InTransferLength > MaxSectorCount * BlockSize)) ||
|
||||
((Packet->OutTransferLength != 0) && (Packet->OutTransferLength > MaxSectorCount * BlockSize))) {
|
||||
((Packet->OutTransferLength != 0) && (Packet->OutTransferLength > MaxSectorCount * BlockSize)))
|
||||
{
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
@@ -284,15 +288,15 @@ AhciAtaPassThruPassThru (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciAtaPassThruGetNextPort (
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN OUT UINT16 *Port
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN OUT UINT16 *Port
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
|
||||
if (This == NULL || Port == NULL) {
|
||||
if ((This == NULL) || (Port == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -318,7 +322,7 @@ AhciAtaPassThruGetNextPort (
|
||||
while (!IsNull (&Private->DeviceList, Node)) {
|
||||
DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
|
||||
|
||||
if (DeviceData->Port > *Port){
|
||||
if (DeviceData->Port > *Port) {
|
||||
*Port = DeviceData->Port;
|
||||
goto Exit;
|
||||
}
|
||||
@@ -393,16 +397,16 @@ Exit:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciAtaPassThruGetNextDevice (
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN UINT16 Port,
|
||||
IN OUT UINT16 *PortMultiplierPort
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN UINT16 Port,
|
||||
IN OUT UINT16 *PortMultiplierPort
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
|
||||
if (This == NULL || PortMultiplierPort == NULL) {
|
||||
if ((This == NULL) || (PortMultiplierPort == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -425,7 +429,8 @@ AhciAtaPassThruGetNextDevice (
|
||||
DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
|
||||
|
||||
if ((DeviceData->Port == Port) &&
|
||||
(DeviceData->PortMultiplier > *PortMultiplierPort)){
|
||||
(DeviceData->PortMultiplier > *PortMultiplierPort))
|
||||
{
|
||||
*PortMultiplierPort = DeviceData->PortMultiplier;
|
||||
goto Exit;
|
||||
}
|
||||
@@ -444,7 +449,7 @@ AhciAtaPassThruGetNextDevice (
|
||||
while (!IsNull (&Private->DeviceList, Node)) {
|
||||
DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
|
||||
|
||||
if (DeviceData->Port == Port){
|
||||
if (DeviceData->Port == Port) {
|
||||
*PortMultiplierPort = DeviceData->PortMultiplier;
|
||||
goto Exit;
|
||||
}
|
||||
@@ -490,14 +495,14 @@ Exit:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciAtaPassThruGetDevicePath (
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
|
||||
if (This == NULL || DevicePathLength == NULL || DevicePath == NULL) {
|
||||
if ((This == NULL) || (DevicePathLength == NULL) || (DevicePath == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@@ -49,10 +49,10 @@
|
||||
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
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -90,8 +90,8 @@ AhciAtaPassThruPassThru (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciAtaPassThruGetNextPort (
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN OUT UINT16 *Port
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN OUT UINT16 *Port
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -144,9 +144,9 @@ AhciAtaPassThruGetNextPort (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciAtaPassThruGetNextDevice (
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN UINT16 Port,
|
||||
IN OUT UINT16 *PortMultiplierPort
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
IN UINT16 Port,
|
||||
IN OUT UINT16 *PortMultiplierPort
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -169,9 +169,9 @@ AhciAtaPassThruGetNextDevice (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciAtaPassThruGetDevicePath (
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -28,19 +28,19 @@
|
||||
**/
|
||||
UINT8
|
||||
AhciS3GetEumeratePorts (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HcDevicePath,
|
||||
IN UINTN HcDevicePathLength,
|
||||
OUT UINT32 *PortBitMap
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HcDevicePath,
|
||||
IN UINTN HcDevicePathLength,
|
||||
OUT UINT32 *PortBitMap
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 DummyData;
|
||||
UINTN S3InitDevicesLength;
|
||||
EFI_DEVICE_PATH_PROTOCOL *S3InitDevices;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
UINTN DevicePathInstLength;
|
||||
BOOLEAN EntireEnd;
|
||||
SATA_DEVICE_PATH *SataDeviceNode;
|
||||
EFI_STATUS Status;
|
||||
UINT8 DummyData;
|
||||
UINTN S3InitDevicesLength;
|
||||
EFI_DEVICE_PATH_PROTOCOL *S3InitDevices;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
UINTN DevicePathInstLength;
|
||||
BOOLEAN EntireEnd;
|
||||
SATA_DEVICE_PATH *SataDeviceNode;
|
||||
|
||||
*PortBitMap = 0;
|
||||
|
||||
@@ -51,7 +51,7 @@ AhciS3GetEumeratePorts (
|
||||
S3InitDevices = NULL;
|
||||
S3InitDevicesLength = sizeof (DummyData);
|
||||
EntireEnd = FALSE;
|
||||
Status = RestoreLockBox (&gS3StorageDeviceInitListGuid, &DummyData, &S3InitDevicesLength);
|
||||
Status = RestoreLockBox (&gS3StorageDeviceInitListGuid, &DummyData, &S3InitDevicesLength);
|
||||
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -87,7 +87,7 @@ AhciS3GetEumeratePorts (
|
||||
}
|
||||
|
||||
DevicePathInst = S3InitDevices;
|
||||
S3InitDevices = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN) S3InitDevices + DevicePathInstLength);
|
||||
S3InitDevices = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)S3InitDevices + DevicePathInstLength);
|
||||
|
||||
if (HcDevicePathLength >= DevicePathInstLength) {
|
||||
continue;
|
||||
@@ -101,25 +101,30 @@ AhciS3GetEumeratePorts (
|
||||
DevicePathInst,
|
||||
HcDevicePath,
|
||||
HcDevicePathLength - sizeof (EFI_DEVICE_PATH_PROTOCOL)
|
||||
) == 0) {
|
||||
) == 0)
|
||||
{
|
||||
//
|
||||
// Get the port number.
|
||||
//
|
||||
while (DevicePathInst->Type != END_DEVICE_PATH_TYPE) {
|
||||
if ((DevicePathInst->Type == MESSAGING_DEVICE_PATH) &&
|
||||
(DevicePathInst->SubType == MSG_SATA_DP)) {
|
||||
SataDeviceNode = (SATA_DEVICE_PATH *) DevicePathInst;
|
||||
(DevicePathInst->SubType == MSG_SATA_DP))
|
||||
{
|
||||
SataDeviceNode = (SATA_DEVICE_PATH *)DevicePathInst;
|
||||
//
|
||||
// For now, the driver only support upto AHCI_MAX_PORTS ports and
|
||||
// devices directly connected to a HBA.
|
||||
//
|
||||
if ((SataDeviceNode->HBAPortNumber >= AHCI_MAX_PORTS) ||
|
||||
(SataDeviceNode->PortMultiplierPortNumber != 0xFFFF)) {
|
||||
(SataDeviceNode->PortMultiplierPortNumber != 0xFFFF))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
*PortBitMap |= (UINT32)BIT0 << SataDeviceNode->HBAPortNumber;
|
||||
break;
|
||||
}
|
||||
|
||||
DevicePathInst = NextDevicePathNode (DevicePathInst);
|
||||
}
|
||||
}
|
||||
|
@@ -24,12 +24,12 @@
|
||||
**/
|
||||
PEI_AHCI_ATA_DEVICE_DATA *
|
||||
SearchTrustComputingDeviceByIndex (
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINTN TrustComputingDeviceIndex
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINTN TrustComputingDeviceIndex
|
||||
)
|
||||
{
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
LIST_ENTRY *Node;
|
||||
|
||||
Node = GetFirstNode (&Private->DeviceList);
|
||||
while (!IsNull (&Private->DeviceList, Node)) {
|
||||
@@ -58,17 +58,17 @@ SearchTrustComputingDeviceByIndex (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStorageSecurityGetDeviceNo (
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
OUT UINTN *NumberofDevices
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
OUT UINTN *NumberofDevices
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
|
||||
if (This == NULL || NumberofDevices == NULL) {
|
||||
if ((This == NULL) || (NumberofDevices == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This);
|
||||
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This);
|
||||
*NumberofDevices = Private->TrustComputingDevices;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -102,17 +102,17 @@ AhciStorageSecurityGetDeviceNo (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStorageSecurityGetDevicePath (
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
EFI_STATUS Status;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (This == NULL || DevicePathLength == NULL || DevicePath == NULL) {
|
||||
if ((This == NULL) || (DevicePathLength == NULL) || (DevicePath == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -229,18 +229,18 @@ AhciStorageSecurityGetDevicePath (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStorageSecurityReceiveData (
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
|
||||
if ((PayloadBuffer == NULL) || (PayloadTransferSize == NULL) || (PayloadBufferSize == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -349,8 +349,8 @@ AhciStorageSecuritySendData (
|
||||
IN VOID *PayloadBuffer
|
||||
)
|
||||
{
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
|
||||
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
|
||||
|
||||
if ((PayloadBuffer == NULL) && (PayloadBufferSize != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@@ -24,8 +24,8 @@
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStorageSecurityGetDeviceNo (
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
OUT UINTN *NumberofDevices
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
OUT UINTN *NumberofDevices
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -56,10 +56,10 @@ AhciStorageSecurityGetDeviceNo (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStorageSecurityGetDevicePath (
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -151,14 +151,14 @@ AhciStorageSecurityGetDevicePath (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStorageSecurityReceiveData (
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
|
||||
IN UINTN DeviceIndex,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
);
|
||||
|
||||
/**
|
||||
|
@@ -17,8 +17,8 @@ SATA_DEVICE_PATH mAhciSataDevicePathNodeTemplate = {
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_SATA_DP,
|
||||
{
|
||||
(UINT8) (sizeof (SATA_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (SATA_DEVICE_PATH)) >> 8)
|
||||
(UINT8)(sizeof (SATA_DEVICE_PATH)),
|
||||
(UINT8)((sizeof (SATA_DEVICE_PATH)) >> 8)
|
||||
}
|
||||
},
|
||||
0x0, // HBAPortNumber
|
||||
@@ -33,8 +33,8 @@ EFI_DEVICE_PATH_PROTOCOL mAhciEndDevicePathNodeTemplate = {
|
||||
END_DEVICE_PATH_TYPE,
|
||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||
{
|
||||
(UINT8) (sizeof (EFI_DEVICE_PATH_PROTOCOL)),
|
||||
(UINT8) ((sizeof (EFI_DEVICE_PATH_PROTOCOL)) >> 8)
|
||||
(UINT8)(sizeof (EFI_DEVICE_PATH_PROTOCOL)),
|
||||
(UINT8)((sizeof (EFI_DEVICE_PATH_PROTOCOL)) >> 8)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,7 +79,7 @@ NextDevicePathNode (
|
||||
)
|
||||
{
|
||||
ASSERT (Node != NULL);
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength (Node));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,14 +97,14 @@ NextDevicePathNode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetDevicePathInstanceSize (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINTN *InstanceSize,
|
||||
OUT BOOLEAN *EntireDevicePathEnd
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINTN *InstanceSize,
|
||||
OUT BOOLEAN *EntireDevicePathEnd
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Walker;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Walker;
|
||||
|
||||
if (DevicePath == NULL || InstanceSize == NULL || EntireDevicePathEnd == NULL) {
|
||||
if ((DevicePath == NULL) || (InstanceSize == NULL) || (EntireDevicePathEnd == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ GetDevicePathInstanceSize (
|
||||
//
|
||||
// Compute the size of the device path instance
|
||||
//
|
||||
*InstanceSize = ((UINTN) Walker - (UINTN) (DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
*InstanceSize = ((UINTN)Walker - (UINTN)(DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -148,12 +148,12 @@ GetDevicePathInstanceSize (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AhciIsHcDevicePathValid (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN UINTN DevicePathLength
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN UINTN DevicePathLength
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Start;
|
||||
UINTN Size;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Start;
|
||||
UINTN Size;
|
||||
|
||||
if (DevicePath == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -168,22 +168,24 @@ AhciIsHcDevicePathValid (
|
||||
|
||||
Start = DevicePath;
|
||||
while (!(DevicePath->Type == END_DEVICE_PATH_TYPE &&
|
||||
DevicePath->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)) {
|
||||
DevicePath->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE))
|
||||
{
|
||||
DevicePath = NextDevicePathNode (DevicePath);
|
||||
|
||||
//
|
||||
// Prevent overflow and invalid zero in the 'Length' field of a device path
|
||||
// node.
|
||||
//
|
||||
if ((UINTN) DevicePath <= (UINTN) Start) {
|
||||
if ((UINTN)DevicePath <= (UINTN)Start) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Prevent touching memory beyond given DevicePathLength.
|
||||
//
|
||||
if ((UINTN) DevicePath - (UINTN) Start >
|
||||
DevicePathLength - sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
|
||||
if ((UINTN)DevicePath - (UINTN)Start >
|
||||
DevicePathLength - sizeof (EFI_DEVICE_PATH_PROTOCOL))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@@ -191,7 +193,7 @@ AhciIsHcDevicePathValid (
|
||||
//
|
||||
// Check if the device path and its size match each other.
|
||||
//
|
||||
Size = ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
Size = ((UINTN)DevicePath - (UINTN)Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
if (Size != DevicePathLength) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -217,17 +219,17 @@ AhciIsHcDevicePathValid (
|
||||
**/
|
||||
EFI_STATUS
|
||||
AhciBuildDevicePath (
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
OUT UINTN *DevicePathLength,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathWalker;
|
||||
SATA_DEVICE_PATH *SataDeviceNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathWalker;
|
||||
SATA_DEVICE_PATH *SataDeviceNode;
|
||||
|
||||
if (DevicePathLength == NULL || DevicePath == NULL) {
|
||||
if ((DevicePathLength == NULL) || (DevicePath == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -251,8 +253,8 @@ AhciBuildDevicePath (
|
||||
//
|
||||
// Construct the SATA device node
|
||||
//
|
||||
DevicePathWalker = (EFI_DEVICE_PATH_PROTOCOL *) ((UINT8 *)DevicePathWalker +
|
||||
(Private->DevicePathLength - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
|
||||
DevicePathWalker = (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePathWalker +
|
||||
(Private->DevicePathLength - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
|
||||
CopyMem (
|
||||
DevicePathWalker,
|
||||
&mAhciSataDevicePathNodeTemplate,
|
||||
@@ -265,8 +267,8 @@ AhciBuildDevicePath (
|
||||
//
|
||||
// Construct the end device node
|
||||
//
|
||||
DevicePathWalker = (EFI_DEVICE_PATH_PROTOCOL *) ((UINT8 *)DevicePathWalker +
|
||||
sizeof (SATA_DEVICE_PATH));
|
||||
DevicePathWalker = (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePathWalker +
|
||||
sizeof (SATA_DEVICE_PATH));
|
||||
CopyMem (
|
||||
DevicePathWalker,
|
||||
&mAhciEndDevicePathNodeTemplate,
|
||||
|
@@ -20,15 +20,15 @@ GetIoMmu (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
EFI_STATUS Status;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
|
||||
IoMmu = NULL;
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gEdkiiIoMmuPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &IoMmu
|
||||
(VOID **)&IoMmu
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (IoMmu != NULL)) {
|
||||
return IoMmu;
|
||||
@@ -58,48 +58,50 @@ GetIoMmu (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IoMmuMap (
|
||||
IN EDKII_IOMMU_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
IN EDKII_IOMMU_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 Attribute;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
EFI_STATUS Status;
|
||||
UINT64 Attribute;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
|
||||
IoMmu = GetIoMmu ();
|
||||
|
||||
if (IoMmu != NULL) {
|
||||
Status = IoMmu->Map (
|
||||
IoMmu,
|
||||
Operation,
|
||||
HostAddress,
|
||||
NumberOfBytes,
|
||||
DeviceAddress,
|
||||
Mapping
|
||||
);
|
||||
IoMmu,
|
||||
Operation,
|
||||
HostAddress,
|
||||
NumberOfBytes,
|
||||
DeviceAddress,
|
||||
Mapping
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
switch (Operation) {
|
||||
case EdkiiIoMmuOperationBusMasterRead:
|
||||
case EdkiiIoMmuOperationBusMasterRead64:
|
||||
Attribute = EDKII_IOMMU_ACCESS_READ;
|
||||
break;
|
||||
case EdkiiIoMmuOperationBusMasterWrite:
|
||||
case EdkiiIoMmuOperationBusMasterWrite64:
|
||||
Attribute = EDKII_IOMMU_ACCESS_WRITE;
|
||||
break;
|
||||
case EdkiiIoMmuOperationBusMasterCommonBuffer:
|
||||
case EdkiiIoMmuOperationBusMasterCommonBuffer64:
|
||||
Attribute = EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE;
|
||||
break;
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
case EdkiiIoMmuOperationBusMasterRead:
|
||||
case EdkiiIoMmuOperationBusMasterRead64:
|
||||
Attribute = EDKII_IOMMU_ACCESS_READ;
|
||||
break;
|
||||
case EdkiiIoMmuOperationBusMasterWrite:
|
||||
case EdkiiIoMmuOperationBusMasterWrite64:
|
||||
Attribute = EDKII_IOMMU_ACCESS_WRITE;
|
||||
break;
|
||||
case EdkiiIoMmuOperationBusMasterCommonBuffer:
|
||||
case EdkiiIoMmuOperationBusMasterCommonBuffer64:
|
||||
Attribute = EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE;
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = IoMmu->SetAttribute (
|
||||
IoMmu,
|
||||
*Mapping,
|
||||
@@ -110,9 +112,10 @@ IoMmuMap (
|
||||
}
|
||||
} else {
|
||||
*DeviceAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress;
|
||||
*Mapping = NULL;
|
||||
Status = EFI_SUCCESS;
|
||||
*Mapping = NULL;
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -127,11 +130,11 @@ IoMmuMap (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IoMmuUnmap (
|
||||
IN VOID *Mapping
|
||||
IN VOID *Mapping
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
EFI_STATUS Status;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
|
||||
IoMmu = GetIoMmu ();
|
||||
|
||||
@@ -141,6 +144,7 @@ IoMmuUnmap (
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -175,7 +179,7 @@ IoMmuAllocateBuffer (
|
||||
EFI_PHYSICAL_ADDRESS HostPhyAddress;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
|
||||
*HostAddress = NULL;
|
||||
*HostAddress = NULL;
|
||||
*DeviceAddress = 0;
|
||||
|
||||
IoMmu = GetIoMmu ();
|
||||
@@ -192,18 +196,19 @@ IoMmuAllocateBuffer (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
NumberOfBytes = EFI_PAGES_TO_SIZE(Pages);
|
||||
Status = IoMmu->Map (
|
||||
IoMmu,
|
||||
EdkiiIoMmuOperationBusMasterCommonBuffer,
|
||||
*HostAddress,
|
||||
&NumberOfBytes,
|
||||
DeviceAddress,
|
||||
Mapping
|
||||
);
|
||||
NumberOfBytes = EFI_PAGES_TO_SIZE (Pages);
|
||||
Status = IoMmu->Map (
|
||||
IoMmu,
|
||||
EdkiiIoMmuOperationBusMasterCommonBuffer,
|
||||
*HostAddress,
|
||||
&NumberOfBytes,
|
||||
DeviceAddress,
|
||||
Mapping
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = IoMmu->SetAttribute (
|
||||
IoMmu,
|
||||
*Mapping,
|
||||
@@ -221,10 +226,12 @@ IoMmuAllocateBuffer (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
*HostAddress = (VOID *)(UINTN)HostPhyAddress;
|
||||
|
||||
*HostAddress = (VOID *)(UINTN)HostPhyAddress;
|
||||
*DeviceAddress = HostPhyAddress;
|
||||
*Mapping = NULL;
|
||||
*Mapping = NULL;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -242,13 +249,13 @@ IoMmuAllocateBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IoMmuFreeBuffer (
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress,
|
||||
IN VOID *Mapping
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress,
|
||||
IN VOID *Mapping
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
EFI_STATUS Status;
|
||||
EDKII_IOMMU_PPI *IoMmu;
|
||||
|
||||
IoMmu = GetIoMmu ();
|
||||
|
||||
@@ -259,5 +266,6 @@ IoMmuFreeBuffer (
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,192 +5,193 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ATA_HC_AHCI_MODE_H__
|
||||
#define __ATA_HC_AHCI_MODE_H__
|
||||
|
||||
#define EFI_AHCI_BAR_INDEX 0x05
|
||||
#define EFI_AHCI_BAR_INDEX 0x05
|
||||
|
||||
#define EFI_AHCI_CAPABILITY_OFFSET 0x0000
|
||||
#define EFI_AHCI_CAP_SAM BIT18
|
||||
#define EFI_AHCI_CAP_SSS BIT27
|
||||
#define EFI_AHCI_CAP_S64A BIT31
|
||||
#define EFI_AHCI_GHC_OFFSET 0x0004
|
||||
#define EFI_AHCI_GHC_RESET BIT0
|
||||
#define EFI_AHCI_GHC_IE BIT1
|
||||
#define EFI_AHCI_GHC_ENABLE BIT31
|
||||
#define EFI_AHCI_IS_OFFSET 0x0008
|
||||
#define EFI_AHCI_PI_OFFSET 0x000C
|
||||
#define EFI_AHCI_CAPABILITY_OFFSET 0x0000
|
||||
#define EFI_AHCI_CAP_SAM BIT18
|
||||
#define EFI_AHCI_CAP_SSS BIT27
|
||||
#define EFI_AHCI_CAP_S64A BIT31
|
||||
#define EFI_AHCI_GHC_OFFSET 0x0004
|
||||
#define EFI_AHCI_GHC_RESET BIT0
|
||||
#define EFI_AHCI_GHC_IE BIT1
|
||||
#define EFI_AHCI_GHC_ENABLE BIT31
|
||||
#define EFI_AHCI_IS_OFFSET 0x0008
|
||||
#define EFI_AHCI_PI_OFFSET 0x000C
|
||||
|
||||
#define EFI_AHCI_MAX_PORTS 32
|
||||
#define EFI_AHCI_MAX_PORTS 32
|
||||
|
||||
#define AHCI_CAPABILITY2_OFFSET 0x0024
|
||||
#define AHCI_CAP2_SDS BIT3
|
||||
#define AHCI_CAP2_SADM BIT4
|
||||
#define AHCI_CAPABILITY2_OFFSET 0x0024
|
||||
#define AHCI_CAP2_SDS BIT3
|
||||
#define AHCI_CAP2_SADM BIT4
|
||||
|
||||
typedef struct {
|
||||
UINT32 Lower32;
|
||||
UINT32 Upper32;
|
||||
UINT32 Lower32;
|
||||
UINT32 Upper32;
|
||||
} DATA_32;
|
||||
|
||||
typedef union {
|
||||
DATA_32 Uint32;
|
||||
UINT64 Uint64;
|
||||
DATA_32 Uint32;
|
||||
UINT64 Uint64;
|
||||
} DATA_64;
|
||||
|
||||
//
|
||||
// Refer SATA1.0a spec section 5.2, the Phy detection time should be less than 10ms.
|
||||
// Add a bit of margin for robustness.
|
||||
//
|
||||
#define EFI_AHCI_BUS_PHY_DETECT_TIMEOUT 15
|
||||
#define EFI_AHCI_BUS_PHY_DETECT_TIMEOUT 15
|
||||
//
|
||||
// Refer SATA1.0a spec, the FIS enable time should be less than 500ms.
|
||||
//
|
||||
#define EFI_AHCI_PORT_CMD_FR_CLEAR_TIMEOUT EFI_TIMER_PERIOD_MILLISECONDS(500)
|
||||
#define EFI_AHCI_PORT_CMD_FR_CLEAR_TIMEOUT EFI_TIMER_PERIOD_MILLISECONDS(500)
|
||||
//
|
||||
// Refer SATA1.0a spec, the bus reset time should be less than 1s.
|
||||
//
|
||||
#define EFI_AHCI_BUS_RESET_TIMEOUT EFI_TIMER_PERIOD_SECONDS(1)
|
||||
#define EFI_AHCI_BUS_RESET_TIMEOUT EFI_TIMER_PERIOD_SECONDS(1)
|
||||
|
||||
#define EFI_AHCI_ATAPI_DEVICE_SIG 0xEB140000
|
||||
#define EFI_AHCI_ATA_DEVICE_SIG 0x00000000
|
||||
#define EFI_AHCI_PORT_MULTIPLIER_SIG 0x96690000
|
||||
#define EFI_AHCI_ATAPI_SIG_MASK 0xFFFF0000
|
||||
#define EFI_AHCI_ATAPI_DEVICE_SIG 0xEB140000
|
||||
#define EFI_AHCI_ATA_DEVICE_SIG 0x00000000
|
||||
#define EFI_AHCI_PORT_MULTIPLIER_SIG 0x96690000
|
||||
#define EFI_AHCI_ATAPI_SIG_MASK 0xFFFF0000
|
||||
|
||||
//
|
||||
// Each PRDT entry can point to a memory block up to 4M byte
|
||||
//
|
||||
#define EFI_AHCI_MAX_DATA_PER_PRDT 0x400000
|
||||
#define EFI_AHCI_MAX_DATA_PER_PRDT 0x400000
|
||||
|
||||
#define EFI_AHCI_FIS_REGISTER_H2D 0x27 //Register FIS - Host to Device
|
||||
#define EFI_AHCI_FIS_REGISTER_H2D_LENGTH 20
|
||||
#define EFI_AHCI_FIS_REGISTER_D2H 0x34 //Register FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_REGISTER_D2H_LENGTH 20
|
||||
#define EFI_AHCI_FIS_DMA_ACTIVATE 0x39 //DMA Activate FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_DMA_ACTIVATE_LENGTH 4
|
||||
#define EFI_AHCI_FIS_DMA_SETUP 0x41 //DMA Setup FIS - Bi-directional
|
||||
#define EFI_AHCI_FIS_DMA_SETUP_LENGTH 28
|
||||
#define EFI_AHCI_FIS_DATA 0x46 //Data FIS - Bi-directional
|
||||
#define EFI_AHCI_FIS_BIST 0x58 //BIST Activate FIS - Bi-directional
|
||||
#define EFI_AHCI_FIS_BIST_LENGTH 12
|
||||
#define EFI_AHCI_FIS_PIO_SETUP 0x5F //PIO Setup FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_PIO_SETUP_LENGTH 20
|
||||
#define EFI_AHCI_FIS_SET_DEVICE 0xA1 //Set Device Bits FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_SET_DEVICE_LENGTH 8
|
||||
#define EFI_AHCI_FIS_REGISTER_H2D 0x27 // Register FIS - Host to Device
|
||||
#define EFI_AHCI_FIS_REGISTER_H2D_LENGTH 20
|
||||
#define EFI_AHCI_FIS_REGISTER_D2H 0x34 // Register FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_REGISTER_D2H_LENGTH 20
|
||||
#define EFI_AHCI_FIS_DMA_ACTIVATE 0x39 // DMA Activate FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_DMA_ACTIVATE_LENGTH 4
|
||||
#define EFI_AHCI_FIS_DMA_SETUP 0x41 // DMA Setup FIS - Bi-directional
|
||||
#define EFI_AHCI_FIS_DMA_SETUP_LENGTH 28
|
||||
#define EFI_AHCI_FIS_DATA 0x46 // Data FIS - Bi-directional
|
||||
#define EFI_AHCI_FIS_BIST 0x58 // BIST Activate FIS - Bi-directional
|
||||
#define EFI_AHCI_FIS_BIST_LENGTH 12
|
||||
#define EFI_AHCI_FIS_PIO_SETUP 0x5F // PIO Setup FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_PIO_SETUP_LENGTH 20
|
||||
#define EFI_AHCI_FIS_SET_DEVICE 0xA1 // Set Device Bits FIS - Device to Host
|
||||
#define EFI_AHCI_FIS_SET_DEVICE_LENGTH 8
|
||||
|
||||
#define EFI_AHCI_D2H_FIS_OFFSET 0x40
|
||||
#define EFI_AHCI_DMA_FIS_OFFSET 0x00
|
||||
#define EFI_AHCI_PIO_FIS_OFFSET 0x20
|
||||
#define EFI_AHCI_SDB_FIS_OFFSET 0x58
|
||||
#define EFI_AHCI_FIS_TYPE_MASK 0xFF
|
||||
#define EFI_AHCI_U_FIS_OFFSET 0x60
|
||||
#define EFI_AHCI_D2H_FIS_OFFSET 0x40
|
||||
#define EFI_AHCI_DMA_FIS_OFFSET 0x00
|
||||
#define EFI_AHCI_PIO_FIS_OFFSET 0x20
|
||||
#define EFI_AHCI_SDB_FIS_OFFSET 0x58
|
||||
#define EFI_AHCI_FIS_TYPE_MASK 0xFF
|
||||
#define EFI_AHCI_U_FIS_OFFSET 0x60
|
||||
|
||||
//
|
||||
// Port register
|
||||
//
|
||||
#define EFI_AHCI_PORT_START 0x0100
|
||||
#define EFI_AHCI_PORT_REG_WIDTH 0x0080
|
||||
#define EFI_AHCI_PORT_CLB 0x0000
|
||||
#define EFI_AHCI_PORT_CLBU 0x0004
|
||||
#define EFI_AHCI_PORT_FB 0x0008
|
||||
#define EFI_AHCI_PORT_FBU 0x000C
|
||||
#define EFI_AHCI_PORT_IS 0x0010
|
||||
#define EFI_AHCI_PORT_IS_DHRS BIT0
|
||||
#define EFI_AHCI_PORT_IS_PSS BIT1
|
||||
#define EFI_AHCI_PORT_IS_DSS BIT2
|
||||
#define EFI_AHCI_PORT_IS_SDBS BIT3
|
||||
#define EFI_AHCI_PORT_IS_UFS BIT4
|
||||
#define EFI_AHCI_PORT_IS_DPS BIT5
|
||||
#define EFI_AHCI_PORT_IS_PCS BIT6
|
||||
#define EFI_AHCI_PORT_IS_DIS BIT7
|
||||
#define EFI_AHCI_PORT_IS_PRCS BIT22
|
||||
#define EFI_AHCI_PORT_IS_IPMS BIT23
|
||||
#define EFI_AHCI_PORT_IS_OFS BIT24
|
||||
#define EFI_AHCI_PORT_IS_INFS BIT26
|
||||
#define EFI_AHCI_PORT_IS_IFS BIT27
|
||||
#define EFI_AHCI_PORT_IS_HBDS BIT28
|
||||
#define EFI_AHCI_PORT_IS_HBFS BIT29
|
||||
#define EFI_AHCI_PORT_IS_TFES BIT30
|
||||
#define EFI_AHCI_PORT_IS_CPDS BIT31
|
||||
#define EFI_AHCI_PORT_IS_CLEAR 0xFFFFFFFF
|
||||
#define EFI_AHCI_PORT_IS_FIS_CLEAR 0x0000000F
|
||||
#define EFI_AHCI_PORT_IS_ERROR_MASK (EFI_AHCI_PORT_IS_INFS | EFI_AHCI_PORT_IS_IFS | EFI_AHCI_PORT_IS_HBDS | EFI_AHCI_PORT_IS_HBFS | EFI_AHCI_PORT_IS_TFES)
|
||||
#define EFI_AHCI_PORT_IS_FATAL_ERROR_MASK (EFI_AHCI_PORT_IS_IFS | EFI_AHCI_PORT_IS_HBDS | EFI_AHCI_PORT_IS_HBFS | EFI_AHCI_PORT_IS_TFES)
|
||||
#define EFI_AHCI_PORT_START 0x0100
|
||||
#define EFI_AHCI_PORT_REG_WIDTH 0x0080
|
||||
#define EFI_AHCI_PORT_CLB 0x0000
|
||||
#define EFI_AHCI_PORT_CLBU 0x0004
|
||||
#define EFI_AHCI_PORT_FB 0x0008
|
||||
#define EFI_AHCI_PORT_FBU 0x000C
|
||||
#define EFI_AHCI_PORT_IS 0x0010
|
||||
#define EFI_AHCI_PORT_IS_DHRS BIT0
|
||||
#define EFI_AHCI_PORT_IS_PSS BIT1
|
||||
#define EFI_AHCI_PORT_IS_DSS BIT2
|
||||
#define EFI_AHCI_PORT_IS_SDBS BIT3
|
||||
#define EFI_AHCI_PORT_IS_UFS BIT4
|
||||
#define EFI_AHCI_PORT_IS_DPS BIT5
|
||||
#define EFI_AHCI_PORT_IS_PCS BIT6
|
||||
#define EFI_AHCI_PORT_IS_DIS BIT7
|
||||
#define EFI_AHCI_PORT_IS_PRCS BIT22
|
||||
#define EFI_AHCI_PORT_IS_IPMS BIT23
|
||||
#define EFI_AHCI_PORT_IS_OFS BIT24
|
||||
#define EFI_AHCI_PORT_IS_INFS BIT26
|
||||
#define EFI_AHCI_PORT_IS_IFS BIT27
|
||||
#define EFI_AHCI_PORT_IS_HBDS BIT28
|
||||
#define EFI_AHCI_PORT_IS_HBFS BIT29
|
||||
#define EFI_AHCI_PORT_IS_TFES BIT30
|
||||
#define EFI_AHCI_PORT_IS_CPDS BIT31
|
||||
#define EFI_AHCI_PORT_IS_CLEAR 0xFFFFFFFF
|
||||
#define EFI_AHCI_PORT_IS_FIS_CLEAR 0x0000000F
|
||||
#define EFI_AHCI_PORT_IS_ERROR_MASK (EFI_AHCI_PORT_IS_INFS | EFI_AHCI_PORT_IS_IFS | EFI_AHCI_PORT_IS_HBDS | EFI_AHCI_PORT_IS_HBFS | EFI_AHCI_PORT_IS_TFES)
|
||||
#define EFI_AHCI_PORT_IS_FATAL_ERROR_MASK (EFI_AHCI_PORT_IS_IFS | EFI_AHCI_PORT_IS_HBDS | EFI_AHCI_PORT_IS_HBFS | EFI_AHCI_PORT_IS_TFES)
|
||||
|
||||
#define EFI_AHCI_PORT_IE 0x0014
|
||||
#define EFI_AHCI_PORT_CMD 0x0018
|
||||
#define EFI_AHCI_PORT_CMD_ST_MASK 0xFFFFFFFE
|
||||
#define EFI_AHCI_PORT_CMD_ST BIT0
|
||||
#define EFI_AHCI_PORT_CMD_SUD BIT1
|
||||
#define EFI_AHCI_PORT_CMD_POD BIT2
|
||||
#define EFI_AHCI_PORT_CMD_CLO BIT3
|
||||
#define EFI_AHCI_PORT_CMD_FRE BIT4
|
||||
#define EFI_AHCI_PORT_CMD_CCS_MASK (BIT8 | BIT9 | BIT10 | BIT11 | BIT12)
|
||||
#define EFI_AHCI_PORT_CMD_CCS_SHIFT 8
|
||||
#define EFI_AHCI_PORT_CMD_FR BIT14
|
||||
#define EFI_AHCI_PORT_CMD_CR BIT15
|
||||
#define EFI_AHCI_PORT_CMD_MASK ~(EFI_AHCI_PORT_CMD_ST | EFI_AHCI_PORT_CMD_FRE | EFI_AHCI_PORT_CMD_COL)
|
||||
#define EFI_AHCI_PORT_CMD_PMA BIT17
|
||||
#define EFI_AHCI_PORT_CMD_HPCP BIT18
|
||||
#define EFI_AHCI_PORT_CMD_MPSP BIT19
|
||||
#define EFI_AHCI_PORT_CMD_CPD BIT20
|
||||
#define EFI_AHCI_PORT_CMD_ESP BIT21
|
||||
#define EFI_AHCI_PORT_CMD_ATAPI BIT24
|
||||
#define EFI_AHCI_PORT_CMD_DLAE BIT25
|
||||
#define EFI_AHCI_PORT_CMD_ALPE BIT26
|
||||
#define EFI_AHCI_PORT_CMD_ASP BIT27
|
||||
#define EFI_AHCI_PORT_CMD_ICC_MASK (BIT28 | BIT29 | BIT30 | BIT31)
|
||||
#define EFI_AHCI_PORT_CMD_ACTIVE (1 << 28 )
|
||||
#define EFI_AHCI_PORT_TFD 0x0020
|
||||
#define EFI_AHCI_PORT_TFD_MASK (BIT7 | BIT3 | BIT0)
|
||||
#define EFI_AHCI_PORT_TFD_BSY BIT7
|
||||
#define EFI_AHCI_PORT_TFD_DRQ BIT3
|
||||
#define EFI_AHCI_PORT_TFD_ERR BIT0
|
||||
#define EFI_AHCI_PORT_TFD_ERR_MASK 0x00FF00
|
||||
#define EFI_AHCI_PORT_SIG 0x0024
|
||||
#define EFI_AHCI_PORT_SSTS 0x0028
|
||||
#define EFI_AHCI_PORT_SSTS_DET_MASK 0x000F
|
||||
#define EFI_AHCI_PORT_SSTS_DET 0x0001
|
||||
#define EFI_AHCI_PORT_SSTS_DET_PCE 0x0003
|
||||
#define EFI_AHCI_PORT_SSTS_SPD_MASK 0x00F0
|
||||
#define EFI_AHCI_PORT_SCTL 0x002C
|
||||
#define EFI_AHCI_PORT_SCTL_DET_MASK 0x000F
|
||||
#define EFI_AHCI_PORT_SCTL_MASK (~EFI_AHCI_PORT_SCTL_DET_MASK)
|
||||
#define EFI_AHCI_PORT_SCTL_DET_INIT 0x0001
|
||||
#define EFI_AHCI_PORT_SCTL_DET_PHYCOMM 0x0003
|
||||
#define EFI_AHCI_PORT_SCTL_SPD_MASK 0x00F0
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_MASK 0x0F00
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_INIT 0x0300
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_PSD 0x0100
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_SSD 0x0200
|
||||
#define EFI_AHCI_PORT_SERR 0x0030
|
||||
#define EFI_AHCI_PORT_SERR_RDIE BIT0
|
||||
#define EFI_AHCI_PORT_SERR_RCE BIT1
|
||||
#define EFI_AHCI_PORT_SERR_TDIE BIT8
|
||||
#define EFI_AHCI_PORT_SERR_PCDIE BIT9
|
||||
#define EFI_AHCI_PORT_SERR_PE BIT10
|
||||
#define EFI_AHCI_PORT_SERR_IE BIT11
|
||||
#define EFI_AHCI_PORT_SERR_PRC BIT16
|
||||
#define EFI_AHCI_PORT_SERR_PIE BIT17
|
||||
#define EFI_AHCI_PORT_SERR_CW BIT18
|
||||
#define EFI_AHCI_PORT_SERR_BDE BIT19
|
||||
#define EFI_AHCI_PORT_SERR_DE BIT20
|
||||
#define EFI_AHCI_PORT_SERR_CRCE BIT21
|
||||
#define EFI_AHCI_PORT_SERR_HE BIT22
|
||||
#define EFI_AHCI_PORT_SERR_LSE BIT23
|
||||
#define EFI_AHCI_PORT_SERR_TSTE BIT24
|
||||
#define EFI_AHCI_PORT_SERR_UFT BIT25
|
||||
#define EFI_AHCI_PORT_SERR_EX BIT26
|
||||
#define EFI_AHCI_PORT_ERR_CLEAR 0xFFFFFFFF
|
||||
#define EFI_AHCI_PORT_SACT 0x0034
|
||||
#define EFI_AHCI_PORT_CI 0x0038
|
||||
#define EFI_AHCI_PORT_SNTF 0x003C
|
||||
#define AHCI_PORT_DEVSLP 0x0044
|
||||
#define AHCI_PORT_DEVSLP_ADSE BIT0
|
||||
#define AHCI_PORT_DEVSLP_DSP BIT1
|
||||
#define AHCI_PORT_DEVSLP_DETO_MASK 0x000003FC
|
||||
#define AHCI_PORT_DEVSLP_MDAT_MASK 0x00007C00
|
||||
#define AHCI_PORT_DEVSLP_DITO_MASK 0x01FF8000
|
||||
#define AHCI_PORT_DEVSLP_DM_MASK 0x1E000000
|
||||
#define EFI_AHCI_PORT_IE 0x0014
|
||||
#define EFI_AHCI_PORT_CMD 0x0018
|
||||
#define EFI_AHCI_PORT_CMD_ST_MASK 0xFFFFFFFE
|
||||
#define EFI_AHCI_PORT_CMD_ST BIT0
|
||||
#define EFI_AHCI_PORT_CMD_SUD BIT1
|
||||
#define EFI_AHCI_PORT_CMD_POD BIT2
|
||||
#define EFI_AHCI_PORT_CMD_CLO BIT3
|
||||
#define EFI_AHCI_PORT_CMD_FRE BIT4
|
||||
#define EFI_AHCI_PORT_CMD_CCS_MASK (BIT8 | BIT9 | BIT10 | BIT11 | BIT12)
|
||||
#define EFI_AHCI_PORT_CMD_CCS_SHIFT 8
|
||||
#define EFI_AHCI_PORT_CMD_FR BIT14
|
||||
#define EFI_AHCI_PORT_CMD_CR BIT15
|
||||
#define EFI_AHCI_PORT_CMD_MASK ~(EFI_AHCI_PORT_CMD_ST | EFI_AHCI_PORT_CMD_FRE | EFI_AHCI_PORT_CMD_COL)
|
||||
#define EFI_AHCI_PORT_CMD_PMA BIT17
|
||||
#define EFI_AHCI_PORT_CMD_HPCP BIT18
|
||||
#define EFI_AHCI_PORT_CMD_MPSP BIT19
|
||||
#define EFI_AHCI_PORT_CMD_CPD BIT20
|
||||
#define EFI_AHCI_PORT_CMD_ESP BIT21
|
||||
#define EFI_AHCI_PORT_CMD_ATAPI BIT24
|
||||
#define EFI_AHCI_PORT_CMD_DLAE BIT25
|
||||
#define EFI_AHCI_PORT_CMD_ALPE BIT26
|
||||
#define EFI_AHCI_PORT_CMD_ASP BIT27
|
||||
#define EFI_AHCI_PORT_CMD_ICC_MASK (BIT28 | BIT29 | BIT30 | BIT31)
|
||||
#define EFI_AHCI_PORT_CMD_ACTIVE (1 << 28 )
|
||||
#define EFI_AHCI_PORT_TFD 0x0020
|
||||
#define EFI_AHCI_PORT_TFD_MASK (BIT7 | BIT3 | BIT0)
|
||||
#define EFI_AHCI_PORT_TFD_BSY BIT7
|
||||
#define EFI_AHCI_PORT_TFD_DRQ BIT3
|
||||
#define EFI_AHCI_PORT_TFD_ERR BIT0
|
||||
#define EFI_AHCI_PORT_TFD_ERR_MASK 0x00FF00
|
||||
#define EFI_AHCI_PORT_SIG 0x0024
|
||||
#define EFI_AHCI_PORT_SSTS 0x0028
|
||||
#define EFI_AHCI_PORT_SSTS_DET_MASK 0x000F
|
||||
#define EFI_AHCI_PORT_SSTS_DET 0x0001
|
||||
#define EFI_AHCI_PORT_SSTS_DET_PCE 0x0003
|
||||
#define EFI_AHCI_PORT_SSTS_SPD_MASK 0x00F0
|
||||
#define EFI_AHCI_PORT_SCTL 0x002C
|
||||
#define EFI_AHCI_PORT_SCTL_DET_MASK 0x000F
|
||||
#define EFI_AHCI_PORT_SCTL_MASK (~EFI_AHCI_PORT_SCTL_DET_MASK)
|
||||
#define EFI_AHCI_PORT_SCTL_DET_INIT 0x0001
|
||||
#define EFI_AHCI_PORT_SCTL_DET_PHYCOMM 0x0003
|
||||
#define EFI_AHCI_PORT_SCTL_SPD_MASK 0x00F0
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_MASK 0x0F00
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_INIT 0x0300
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_PSD 0x0100
|
||||
#define EFI_AHCI_PORT_SCTL_IPM_SSD 0x0200
|
||||
#define EFI_AHCI_PORT_SERR 0x0030
|
||||
#define EFI_AHCI_PORT_SERR_RDIE BIT0
|
||||
#define EFI_AHCI_PORT_SERR_RCE BIT1
|
||||
#define EFI_AHCI_PORT_SERR_TDIE BIT8
|
||||
#define EFI_AHCI_PORT_SERR_PCDIE BIT9
|
||||
#define EFI_AHCI_PORT_SERR_PE BIT10
|
||||
#define EFI_AHCI_PORT_SERR_IE BIT11
|
||||
#define EFI_AHCI_PORT_SERR_PRC BIT16
|
||||
#define EFI_AHCI_PORT_SERR_PIE BIT17
|
||||
#define EFI_AHCI_PORT_SERR_CW BIT18
|
||||
#define EFI_AHCI_PORT_SERR_BDE BIT19
|
||||
#define EFI_AHCI_PORT_SERR_DE BIT20
|
||||
#define EFI_AHCI_PORT_SERR_CRCE BIT21
|
||||
#define EFI_AHCI_PORT_SERR_HE BIT22
|
||||
#define EFI_AHCI_PORT_SERR_LSE BIT23
|
||||
#define EFI_AHCI_PORT_SERR_TSTE BIT24
|
||||
#define EFI_AHCI_PORT_SERR_UFT BIT25
|
||||
#define EFI_AHCI_PORT_SERR_EX BIT26
|
||||
#define EFI_AHCI_PORT_ERR_CLEAR 0xFFFFFFFF
|
||||
#define EFI_AHCI_PORT_SACT 0x0034
|
||||
#define EFI_AHCI_PORT_CI 0x0038
|
||||
#define EFI_AHCI_PORT_SNTF 0x003C
|
||||
#define AHCI_PORT_DEVSLP 0x0044
|
||||
#define AHCI_PORT_DEVSLP_ADSE BIT0
|
||||
#define AHCI_PORT_DEVSLP_DSP BIT1
|
||||
#define AHCI_PORT_DEVSLP_DETO_MASK 0x000003FC
|
||||
#define AHCI_PORT_DEVSLP_MDAT_MASK 0x00007C00
|
||||
#define AHCI_PORT_DEVSLP_DITO_MASK 0x01FF8000
|
||||
#define AHCI_PORT_DEVSLP_DM_MASK 0x1E000000
|
||||
|
||||
#define AHCI_COMMAND_RETRIES 5
|
||||
|
||||
@@ -200,20 +201,20 @@ typedef union {
|
||||
// The entry data structure is listed at the following.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 AhciCmdCfl:5; //Command FIS Length
|
||||
UINT32 AhciCmdA:1; //ATAPI
|
||||
UINT32 AhciCmdW:1; //Write
|
||||
UINT32 AhciCmdP:1; //Prefetchable
|
||||
UINT32 AhciCmdR:1; //Reset
|
||||
UINT32 AhciCmdB:1; //BIST
|
||||
UINT32 AhciCmdC:1; //Clear Busy upon R_OK
|
||||
UINT32 AhciCmdRsvd:1;
|
||||
UINT32 AhciCmdPmp:4; //Port Multiplier Port
|
||||
UINT32 AhciCmdPrdtl:16; //Physical Region Descriptor Table Length
|
||||
UINT32 AhciCmdPrdbc; //Physical Region Descriptor Byte Count
|
||||
UINT32 AhciCmdCtba; //Command Table Descriptor Base Address
|
||||
UINT32 AhciCmdCtbau; //Command Table Descriptor Base Address Upper 32-BITs
|
||||
UINT32 AhciCmdRsvd1[4];
|
||||
UINT32 AhciCmdCfl : 5; // Command FIS Length
|
||||
UINT32 AhciCmdA : 1; // ATAPI
|
||||
UINT32 AhciCmdW : 1; // Write
|
||||
UINT32 AhciCmdP : 1; // Prefetchable
|
||||
UINT32 AhciCmdR : 1; // Reset
|
||||
UINT32 AhciCmdB : 1; // BIST
|
||||
UINT32 AhciCmdC : 1; // Clear Busy upon R_OK
|
||||
UINT32 AhciCmdRsvd : 1;
|
||||
UINT32 AhciCmdPmp : 4; // Port Multiplier Port
|
||||
UINT32 AhciCmdPrdtl : 16; // Physical Region Descriptor Table Length
|
||||
UINT32 AhciCmdPrdbc; // Physical Region Descriptor Byte Count
|
||||
UINT32 AhciCmdCtba; // Command Table Descriptor Base Address
|
||||
UINT32 AhciCmdCtbau; // Command Table Descriptor Base Address Upper 32-BITs
|
||||
UINT32 AhciCmdRsvd1[4];
|
||||
} EFI_AHCI_COMMAND_LIST;
|
||||
|
||||
//
|
||||
@@ -223,11 +224,11 @@ typedef struct {
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 AhciCFisType;
|
||||
UINT8 AhciCFisPmNum:4;
|
||||
UINT8 AhciCFisRsvd:1;
|
||||
UINT8 AhciCFisRsvd1:1;
|
||||
UINT8 AhciCFisRsvd2:1;
|
||||
UINT8 AhciCFisCmdInd:1;
|
||||
UINT8 AhciCFisPmNum : 4;
|
||||
UINT8 AhciCFisRsvd : 1;
|
||||
UINT8 AhciCFisRsvd1 : 1;
|
||||
UINT8 AhciCFisRsvd2 : 1;
|
||||
UINT8 AhciCFisCmdInd : 1;
|
||||
UINT8 AhciCFisCmd;
|
||||
UINT8 AhciCFisFeature;
|
||||
UINT8 AhciCFisSecNum;
|
||||
@@ -266,12 +267,12 @@ typedef struct {
|
||||
// list entry for this command slot.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 AhciPrdtDba; //Data Base Address
|
||||
UINT32 AhciPrdtDbau; //Data Base Address Upper 32-BITs
|
||||
UINT32 AhciPrdtRsvd;
|
||||
UINT32 AhciPrdtDbc:22; //Data Byte Count
|
||||
UINT32 AhciPrdtRsvd1:9;
|
||||
UINT32 AhciPrdtIoc:1; //Interrupt on Completion
|
||||
UINT32 AhciPrdtDba; // Data Base Address
|
||||
UINT32 AhciPrdtDbau; // Data Base Address Upper 32-BITs
|
||||
UINT32 AhciPrdtRsvd;
|
||||
UINT32 AhciPrdtDbc : 22; // Data Byte Count
|
||||
UINT32 AhciPrdtRsvd1 : 9;
|
||||
UINT32 AhciPrdtIoc : 1; // Interrupt on Completion
|
||||
} EFI_AHCI_COMMAND_PRDT;
|
||||
|
||||
//
|
||||
@@ -288,24 +289,24 @@ typedef struct {
|
||||
// Received FIS structure
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 AhciDmaSetupFis[0x1C]; // Dma Setup Fis: offset 0x00
|
||||
UINT8 AhciDmaSetupFisRsvd[0x04];
|
||||
UINT8 AhciPioSetupFis[0x14]; // Pio Setup Fis: offset 0x20
|
||||
UINT8 AhciPioSetupFisRsvd[0x0C];
|
||||
UINT8 AhciD2HRegisterFis[0x14]; // D2H Register Fis: offset 0x40
|
||||
UINT8 AhciD2HRegisterFisRsvd[0x04];
|
||||
UINT64 AhciSetDeviceBitsFis; // Set Device Bits Fix: offset 0x58
|
||||
UINT8 AhciUnknownFis[0x40]; // Unknown Fis: offset 0x60
|
||||
UINT8 AhciUnknownFisRsvd[0x60];
|
||||
UINT8 AhciDmaSetupFis[0x1C]; // Dma Setup Fis: offset 0x00
|
||||
UINT8 AhciDmaSetupFisRsvd[0x04];
|
||||
UINT8 AhciPioSetupFis[0x14]; // Pio Setup Fis: offset 0x20
|
||||
UINT8 AhciPioSetupFisRsvd[0x0C];
|
||||
UINT8 AhciD2HRegisterFis[0x14]; // D2H Register Fis: offset 0x40
|
||||
UINT8 AhciD2HRegisterFisRsvd[0x04];
|
||||
UINT64 AhciSetDeviceBitsFis; // Set Device Bits Fix: offset 0x58
|
||||
UINT8 AhciUnknownFis[0x40]; // Unknown Fis: offset 0x60
|
||||
UINT8 AhciUnknownFisRsvd[0x60];
|
||||
} EFI_AHCI_RECEIVED_FIS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Madt : 5;
|
||||
UINT8 Reserved_5 : 3;
|
||||
UINT8 Deto;
|
||||
UINT16 Reserved_16;
|
||||
UINT32 Reserved_32 : 31;
|
||||
UINT32 Supported : 1;
|
||||
UINT8 Madt : 5;
|
||||
UINT8 Reserved_5 : 3;
|
||||
UINT8 Deto;
|
||||
UINT16 Reserved_16;
|
||||
UINT32 Reserved_32 : 31;
|
||||
UINT32 Supported : 1;
|
||||
} DEVSLP_TIMING_VARIABLES;
|
||||
|
||||
#pragma pack()
|
||||
@@ -343,11 +344,11 @@ typedef struct {
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciPacketCommandExecute (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -366,10 +367,10 @@ AhciPacketCommandExecute (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStartCommand (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 CommandSlot,
|
||||
IN UINT64 Timeout
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 CommandSlot,
|
||||
IN UINT64 Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -387,10 +388,9 @@ AhciStartCommand (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciStopCommand (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Port,
|
||||
IN UINT64 Timeout
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Port,
|
||||
IN UINT64 Timeout
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ATA_ATAPI_PASS_THRU_H__
|
||||
#define __ATA_ATAPI_PASS_THRU_H__
|
||||
|
||||
@@ -36,14 +37,14 @@
|
||||
#include "IdeMode.h"
|
||||
#include "AhciMode.h"
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gAtaAtapiPassThruDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gAtaAtapiPassThruComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gAtaAtapiPassThruDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gAtaAtapiPassThruComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2;
|
||||
|
||||
extern EDKII_ATA_ATAPI_POLICY_PROTOCOL *mAtaAtapiPolicy;
|
||||
extern EDKII_ATA_ATAPI_POLICY_PROTOCOL *mAtaAtapiPolicy;
|
||||
|
||||
#define ATA_ATAPI_PASS_THRU_SIGNATURE SIGNATURE_32 ('a', 'a', 'p', 't')
|
||||
#define ATA_ATAPI_DEVICE_SIGNATURE SIGNATURE_32 ('a', 'd', 'e', 'v')
|
||||
#define ATA_ATAPI_PASS_THRU_SIGNATURE SIGNATURE_32 ('a', 'a', 'p', 't')
|
||||
#define ATA_ATAPI_DEVICE_SIGNATURE SIGNATURE_32 ('a', 'd', 'e', 'v')
|
||||
#define ATA_NONBLOCKING_TASK_SIGNATURE SIGNATURE_32 ('a', 't', 's', 'k')
|
||||
|
||||
typedef struct _ATA_NONBLOCK_TASK ATA_NONBLOCK_TASK;
|
||||
@@ -66,88 +67,88 @@ typedef enum {
|
||||
// Ahci mode device info
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplier;
|
||||
EFI_ATA_DEVICE_TYPE Type;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplier;
|
||||
EFI_ATA_DEVICE_TYPE Type;
|
||||
|
||||
EFI_IDENTIFY_DATA *IdentifyData;
|
||||
EFI_IDENTIFY_DATA *IdentifyData;
|
||||
} EFI_ATA_DEVICE_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;
|
||||
|
||||
EFI_ATA_PASS_THRU_MODE AtaPassThruMode;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru;
|
||||
EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;
|
||||
EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;
|
||||
EFI_ATA_PASS_THRU_MODE AtaPassThruMode;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru;
|
||||
EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;
|
||||
EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;
|
||||
|
||||
EFI_ATA_HC_WORK_MODE Mode;
|
||||
EFI_ATA_HC_WORK_MODE Mode;
|
||||
|
||||
EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel];
|
||||
EFI_AHCI_REGISTERS AhciRegisters;
|
||||
EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel];
|
||||
EFI_AHCI_REGISTERS AhciRegisters;
|
||||
|
||||
//
|
||||
// The attached device list
|
||||
//
|
||||
LIST_ENTRY DeviceList;
|
||||
UINT64 EnabledPciAttributes;
|
||||
UINT64 OriginalPciAttributes;
|
||||
LIST_ENTRY DeviceList;
|
||||
UINT64 EnabledPciAttributes;
|
||||
UINT64 OriginalPciAttributes;
|
||||
|
||||
//
|
||||
// For AtaPassThru protocol, using the following bytes to record the previous call in
|
||||
// GetNextPort()/GetNextDevice().
|
||||
//
|
||||
UINT16 PreviousPort;
|
||||
UINT16 PreviousPortMultiplier;
|
||||
UINT16 PreviousPort;
|
||||
UINT16 PreviousPortMultiplier;
|
||||
//
|
||||
// For ExtScsiPassThru protocol, using the following bytes to record the previous call in
|
||||
// GetNextTarget()/GetNextTargetLun().
|
||||
//
|
||||
UINT16 PreviousTargetId;
|
||||
UINT64 PreviousLun;
|
||||
UINT16 PreviousTargetId;
|
||||
UINT64 PreviousLun;
|
||||
|
||||
//
|
||||
// For Non-blocking.
|
||||
//
|
||||
EFI_EVENT TimerEvent;
|
||||
LIST_ENTRY NonBlockingTaskList;
|
||||
EFI_EVENT TimerEvent;
|
||||
LIST_ENTRY NonBlockingTaskList;
|
||||
} ATA_ATAPI_PASS_THRU_INSTANCE;
|
||||
|
||||
//
|
||||
// Task for Non-blocking mode.
|
||||
//
|
||||
struct _ATA_NONBLOCK_TASK {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplier;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
||||
BOOLEAN IsStart;
|
||||
EFI_EVENT Event;
|
||||
UINT64 RetryTimes;
|
||||
BOOLEAN InfiniteWait;
|
||||
VOID *Map; // Pointer to map.
|
||||
VOID *TableMap; // Pointer to PRD table map.
|
||||
EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map.
|
||||
UINTN PageCount; // The page numbers used by PCIO freebuffer.
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplier;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
||||
BOOLEAN IsStart;
|
||||
EFI_EVENT Event;
|
||||
UINT64 RetryTimes;
|
||||
BOOLEAN InfiniteWait;
|
||||
VOID *Map; // Pointer to map.
|
||||
VOID *TableMap; // Pointer to PRD table map.
|
||||
EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map.
|
||||
UINTN PageCount; // The page numbers used by PCIO freebuffer.
|
||||
};
|
||||
|
||||
//
|
||||
// Timeout value which uses 100ns as a unit.
|
||||
// It means 3 second span.
|
||||
//
|
||||
#define ATA_ATAPI_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)
|
||||
#define ATA_SPINUP_TIMEOUT EFI_TIMER_PERIOD_SECONDS(10)
|
||||
#define ATA_ATAPI_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)
|
||||
#define ATA_SPINUP_TIMEOUT EFI_TIMER_PERIOD_SECONDS(10)
|
||||
|
||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||
|
||||
#define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR (a, \
|
||||
@@ -295,11 +296,11 @@ AtaAtapiPassThruComponentNameGetDriverName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaAtapiPassThruComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -347,9 +348,9 @@ AtaAtapiPassThruComponentNameGetControllerName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaAtapiPassThruSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -390,9 +391,9 @@ AtaAtapiPassThruSupported (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaAtapiPassThruStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -424,10 +425,10 @@ AtaAtapiPassThruStart (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaAtapiPassThruStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -446,9 +447,9 @@ LIST_ENTRY *
|
||||
EFIAPI
|
||||
SearchDeviceInfoList (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplier,
|
||||
IN EFI_ATA_DEVICE_TYPE DeviceType
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplier,
|
||||
IN EFI_ATA_DEVICE_TYPE DeviceType
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -470,10 +471,10 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
CreateNewDeviceInfo (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplier,
|
||||
IN EFI_ATA_DEVICE_TYPE DeviceType,
|
||||
IN EFI_IDENTIFY_DATA *IdentifyData
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplier,
|
||||
IN EFI_ATA_DEVICE_TYPE DeviceType,
|
||||
IN EFI_IDENTIFY_DATA *IdentifyData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -499,7 +500,7 @@ DestroyDeviceInfoList (
|
||||
VOID
|
||||
EFIAPI
|
||||
DestroyAsynTaskList (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||
IN BOOLEAN IsSigEvent
|
||||
);
|
||||
|
||||
@@ -517,7 +518,7 @@ DestroyAsynTaskList (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EnumerateAttachedDevice (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -532,7 +533,7 @@ VOID
|
||||
EFIAPI
|
||||
AsyncNonBlockingTransferRoutine (
|
||||
EFI_EVENT Event,
|
||||
VOID* Context
|
||||
VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -567,11 +568,11 @@ AsyncNonBlockingTransferRoutine (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruPassThru (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -608,8 +609,8 @@ AtaPassThruPassThru (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruGetNextPort (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT16 *Port
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT16 *Port
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -657,9 +658,9 @@ AtaPassThruGetNextPort (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruGetNextDevice (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN OUT UINT16 *PortMultiplierPort
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN OUT UINT16 *PortMultiplierPort
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -697,10 +698,10 @@ AtaPassThruGetNextDevice (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruBuildDevicePath (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -743,10 +744,10 @@ AtaPassThruBuildDevicePath (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruGetDevice (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINT16 *Port,
|
||||
OUT UINT16 *PortMultiplierPort
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINT16 *Port,
|
||||
OUT UINT16 *PortMultiplierPort
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -776,8 +777,8 @@ AtaPassThruGetDevice (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruResetPort (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -814,9 +815,9 @@ AtaPassThruResetPort (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPassThruResetDevice (
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort
|
||||
IN EFI_ATA_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -863,11 +864,11 @@ AtaPassThruResetDevice (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruPassThru (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -899,9 +900,9 @@ ExtScsiPassThruPassThru (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruGetNextTargetLun (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT8 **Target,
|
||||
IN OUT UINT64 *Lun
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT8 **Target,
|
||||
IN OUT UINT64 *Lun
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -934,10 +935,10 @@ ExtScsiPassThruGetNextTargetLun (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruBuildDevicePath (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -962,10 +963,10 @@ ExtScsiPassThruBuildDevicePath (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruGetTargetLun (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINT8 **Target,
|
||||
OUT UINT64 *Lun
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINT8 **Target,
|
||||
OUT UINT64 *Lun
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -982,7 +983,7 @@ ExtScsiPassThruGetTargetLun (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruResetChannel (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1007,9 +1008,9 @@ ExtScsiPassThruResetChannel (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruResetTargetLun (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1037,8 +1038,8 @@ ExtScsiPassThruResetTargetLun (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ExtScsiPassThruGetNextTarget (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT8 **Target
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT8 **Target
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1052,7 +1053,7 @@ ExtScsiPassThruGetNextTarget (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IdeModeInitialization (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1066,7 +1067,7 @@ IdeModeInitialization (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciModeInitialization (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1094,16 +1095,16 @@ AhciModeInitialization (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciNonDataTransfer (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||
IN UINT8 AtapiCommandLength,
|
||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||
IN UINT64 Timeout,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||
IN UINT8 AtapiCommandLength,
|
||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||
IN UINT64 Timeout,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1134,19 +1135,19 @@ AhciNonDataTransfer (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciDmaTransfer (
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||
IN UINT8 AtapiCommandLength,
|
||||
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,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||
IN UINT8 AtapiCommandLength,
|
||||
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,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1177,19 +1178,19 @@ AhciDmaTransfer (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AhciPioTransfer (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||
IN UINT8 AtapiCommandLength,
|
||||
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,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_AHCI_REGISTERS *AhciRegisters,
|
||||
IN UINT8 Port,
|
||||
IN UINT8 PortMultiplier,
|
||||
IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,
|
||||
IN UINT8 AtapiCommandLength,
|
||||
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,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1213,12 +1214,12 @@ AhciPioTransfer (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaNonDataCommandIn (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_IDE_REGISTERS *IdeRegisters,
|
||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||
IN UINT64 Timeout,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_IDE_REGISTERS *IdeRegisters,
|
||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||
IN UINT64 Timeout,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1284,16 +1285,15 @@ AtaUdmaInOut (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPioDataInOut (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_IDE_REGISTERS *IdeRegisters,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT64 ByteCount,
|
||||
IN BOOLEAN Read,
|
||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||
IN UINT64 Timeout,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_IDE_REGISTERS *IdeRegisters,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT64 ByteCount,
|
||||
IN BOOLEAN Read,
|
||||
IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,
|
||||
IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,
|
||||
IN UINT64 Timeout,
|
||||
IN ATA_NONBLOCK_TASK *Task
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -11,22 +11,22 @@
|
||||
//
|
||||
// Driver name table
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaAtapiPassThruDriverNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaAtapiPassThruDriverNameTable[] = {
|
||||
{ "eng;en", L"AtaAtapiPassThru Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
//
|
||||
// Controller name table
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaAtapiPassThruIdeControllerNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaAtapiPassThruIdeControllerNameTable[] = {
|
||||
{ "eng;en", L"IDE Controller" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaAtapiPassThruAhciControllerNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaAtapiPassThruAhciControllerNameTable[] = {
|
||||
{ "eng;en", L"AHCI Controller" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
//
|
||||
@@ -41,9 +41,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gAtaAtapiPassThruComp
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) AtaAtapiPassThruComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) AtaAtapiPassThruComponentNameGetControllerName,
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)AtaAtapiPassThruComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)AtaAtapiPassThruComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
@@ -103,7 +103,6 @@ AtaAtapiPassThruComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -175,11 +174,11 @@ AtaAtapiPassThruComponentNameGetDriverName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaAtapiPassThruComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -187,7 +186,7 @@ AtaAtapiPassThruComponentNameGetControllerName (
|
||||
VOID *Interface;
|
||||
ATA_ATAPI_PASS_THRU_INSTANCE *Instance;
|
||||
|
||||
if (Language == NULL || ControllerName == NULL) {
|
||||
if ((Language == NULL) || (ControllerName == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ATA_HC_IDE_MODE_H__
|
||||
#define __ATA_HC_IDE_MODE_H__
|
||||
|
||||
@@ -59,50 +60,50 @@ typedef enum {
|
||||
#define BMIS_INTERRUPT BIT2
|
||||
#define BMIS_ERROR BIT1
|
||||
|
||||
#define BMIC_OFFSET 0x00
|
||||
#define BMIS_OFFSET 0x02
|
||||
#define BMID_OFFSET 0x04
|
||||
#define BMIC_OFFSET 0x00
|
||||
#define BMIS_OFFSET 0x02
|
||||
#define BMID_OFFSET 0x04
|
||||
|
||||
//
|
||||
// IDE transfer mode
|
||||
//
|
||||
#define EFI_ATA_MODE_DEFAULT_PIO 0x00
|
||||
#define EFI_ATA_MODE_FLOW_PIO 0x01
|
||||
#define EFI_ATA_MODE_MDMA 0x04
|
||||
#define EFI_ATA_MODE_UDMA 0x08
|
||||
#define EFI_ATA_MODE_DEFAULT_PIO 0x00
|
||||
#define EFI_ATA_MODE_FLOW_PIO 0x01
|
||||
#define EFI_ATA_MODE_MDMA 0x04
|
||||
#define EFI_ATA_MODE_UDMA 0x08
|
||||
|
||||
typedef struct {
|
||||
UINT32 RegionBaseAddr;
|
||||
UINT16 ByteCount;
|
||||
UINT16 EndOfTable;
|
||||
UINT32 RegionBaseAddr;
|
||||
UINT16 ByteCount;
|
||||
UINT16 EndOfTable;
|
||||
} EFI_ATA_DMA_PRD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 ModeNumber : 3;
|
||||
UINT8 ModeCategory : 5;
|
||||
UINT8 ModeNumber : 3;
|
||||
UINT8 ModeCategory : 5;
|
||||
} EFI_ATA_TRANSFER_MODE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Sector;
|
||||
UINT8 Heads;
|
||||
UINT8 MultipleSector;
|
||||
UINT8 Sector;
|
||||
UINT8 Heads;
|
||||
UINT8 MultipleSector;
|
||||
} EFI_ATA_DRIVE_PARMS;
|
||||
|
||||
//
|
||||
// IDE registers set
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Data;
|
||||
UINT16 ErrOrFeature;
|
||||
UINT16 SectorCount;
|
||||
UINT16 SectorNumber;
|
||||
UINT16 CylinderLsb;
|
||||
UINT16 CylinderMsb;
|
||||
UINT16 Head;
|
||||
UINT16 CmdOrStatus;
|
||||
UINT16 AltOrDev;
|
||||
UINT16 Data;
|
||||
UINT16 ErrOrFeature;
|
||||
UINT16 SectorCount;
|
||||
UINT16 SectorNumber;
|
||||
UINT16 CylinderLsb;
|
||||
UINT16 CylinderMsb;
|
||||
UINT16 Head;
|
||||
UINT16 CmdOrStatus;
|
||||
UINT16 AltOrDev;
|
||||
|
||||
UINT16 BusMasterBaseAddr;
|
||||
UINT16 BusMasterBaseAddr;
|
||||
} EFI_IDE_REGISTERS;
|
||||
|
||||
//
|
||||
@@ -164,8 +165,8 @@ typedef struct {
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetIdeRegisterIoAddr (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN OUT EFI_IDE_REGISTERS *IdeRegisters
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN OUT EFI_IDE_REGISTERS *IdeRegisters
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -187,12 +188,11 @@ GetIdeRegisterIoAddr (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaPacketCommandExecute (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_IDE_REGISTERS *IdeRegisters,
|
||||
IN UINT8 Channel,
|
||||
IN UINT8 Device,
|
||||
IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_IDE_REGISTERS *IdeRegisters,
|
||||
IN UINT8 Channel,
|
||||
IN UINT8 Device,
|
||||
IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
//
|
||||
// ATA Bus Driver Binding Protocol Instance
|
||||
//
|
||||
EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding = {
|
||||
EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding = {
|
||||
AtaBusDriverBindingSupported,
|
||||
AtaBusDriverBindingStart,
|
||||
AtaBusDriverBindingStop,
|
||||
@@ -27,9 +27,9 @@ EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding = {
|
||||
//
|
||||
// Template for ATA Child Device.
|
||||
//
|
||||
ATA_DEVICE gAtaDeviceTemplate = {
|
||||
ATA_DEVICE_SIGNATURE, // Signature
|
||||
NULL, // Handle
|
||||
ATA_DEVICE gAtaDeviceTemplate = {
|
||||
ATA_DEVICE_SIGNATURE, // Signature
|
||||
NULL, // Handle
|
||||
{ // BlockIo
|
||||
EFI_BLOCK_IO_PROTOCOL_REVISION,
|
||||
NULL,
|
||||
@@ -65,25 +65,27 @@ ATA_DEVICE gAtaDeviceTemplate = {
|
||||
AtaDiskInfoSenseData,
|
||||
AtaDiskInfoWhichIde
|
||||
},
|
||||
NULL, // DevicePath
|
||||
NULL, // DevicePath
|
||||
{
|
||||
AtaStorageSecurityReceiveData,
|
||||
AtaStorageSecuritySendData
|
||||
},
|
||||
NULL, // AtaBusDriverData
|
||||
0, // Port
|
||||
0, // PortMultiplierPort
|
||||
{ 0, }, // Packet
|
||||
{{ 0}, }, // Acb
|
||||
NULL, // Asb
|
||||
FALSE, // UdmaValid
|
||||
FALSE, // Lba48Bit
|
||||
NULL, // IdentifyData
|
||||
NULL, // ControllerNameTable
|
||||
{L'\0', }, // ModelName
|
||||
{NULL, NULL}, // AtaTaskList
|
||||
{NULL, NULL}, // AtaSubTaskList
|
||||
FALSE // Abort
|
||||
NULL, // AtaBusDriverData
|
||||
0, // Port
|
||||
0, // PortMultiplierPort
|
||||
{ 0, }, // Packet
|
||||
{
|
||||
{ 0 },
|
||||
}, // Acb
|
||||
NULL, // Asb
|
||||
FALSE, // UdmaValid
|
||||
FALSE, // Lba48Bit
|
||||
NULL, // IdentifyData
|
||||
NULL, // ControllerNameTable
|
||||
{ L'\0', }, // ModelName
|
||||
{ NULL, NULL }, // AtaTaskList
|
||||
{ NULL, NULL }, // AtaSubTaskList
|
||||
FALSE // Abort
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -101,8 +103,8 @@ ATA_DEVICE gAtaDeviceTemplate = {
|
||||
**/
|
||||
VOID *
|
||||
AllocateAlignedBuffer (
|
||||
IN ATA_DEVICE *AtaDevice,
|
||||
IN UINTN BufferSize
|
||||
IN ATA_DEVICE *AtaDevice,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
{
|
||||
return AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), AtaDevice->AtaBusDriverData->AtaPassThru->Mode->IoAlign);
|
||||
@@ -120,8 +122,8 @@ AllocateAlignedBuffer (
|
||||
**/
|
||||
VOID
|
||||
FreeAlignedBuffer (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN BufferSize
|
||||
IN VOID *Buffer,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
{
|
||||
if (Buffer != NULL) {
|
||||
@@ -129,7 +131,6 @@ FreeAlignedBuffer (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Release all the resources allocated for the ATA device.
|
||||
|
||||
@@ -143,11 +144,11 @@ ReleaseAtaResources (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
)
|
||||
{
|
||||
ATA_BUS_ASYN_SUB_TASK *SubTask;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *DelEntry;
|
||||
EFI_TPL OldTpl;
|
||||
ATA_BUS_ASYN_SUB_TASK *SubTask;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *DelEntry;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
FreeUnicodeStringTable (AtaDevice->ControllerNameTable);
|
||||
FreeAlignedBuffer (AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||
@@ -155,14 +156,16 @@ ReleaseAtaResources (
|
||||
if (AtaDevice->DevicePath != NULL) {
|
||||
FreePool (AtaDevice->DevicePath);
|
||||
}
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
if (!IsListEmpty (&AtaDevice->AtaSubTaskList)) {
|
||||
//
|
||||
// Free the Subtask list.
|
||||
//
|
||||
for(Entry = AtaDevice->AtaSubTaskList.ForwardLink;
|
||||
Entry != (&AtaDevice->AtaSubTaskList);
|
||||
) {
|
||||
for (Entry = AtaDevice->AtaSubTaskList.ForwardLink;
|
||||
Entry != (&AtaDevice->AtaSubTaskList);
|
||||
)
|
||||
{
|
||||
DelEntry = Entry;
|
||||
Entry = Entry->ForwardLink;
|
||||
SubTask = ATA_ASYN_SUB_TASK_FROM_ENTRY (DelEntry);
|
||||
@@ -171,13 +174,15 @@ ReleaseAtaResources (
|
||||
FreeAtaSubTask (SubTask);
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsListEmpty (&AtaDevice->AtaTaskList)) {
|
||||
//
|
||||
// Free the Subtask list.
|
||||
//
|
||||
for(Entry = AtaDevice->AtaTaskList.ForwardLink;
|
||||
Entry != (&AtaDevice->AtaTaskList);
|
||||
) {
|
||||
for (Entry = AtaDevice->AtaTaskList.ForwardLink;
|
||||
Entry != (&AtaDevice->AtaTaskList);
|
||||
)
|
||||
{
|
||||
DelEntry = Entry;
|
||||
Entry = Entry->ForwardLink;
|
||||
AtaTask = ATA_ASYN_TASK_FROM_ENTRY (DelEntry);
|
||||
@@ -186,11 +191,11 @@ ReleaseAtaResources (
|
||||
FreePool (AtaTask);
|
||||
}
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
FreePool (AtaDevice);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Registers an ATA device.
|
||||
|
||||
@@ -210,29 +215,29 @@ ReleaseAtaResources (
|
||||
**/
|
||||
EFI_STATUS
|
||||
RegisterAtaDevice (
|
||||
IN OUT ATA_BUS_DRIVER_DATA *AtaBusDriverData,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort
|
||||
IN OUT ATA_BUS_DRIVER_DATA *AtaBusDriverData,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 PortMultiplierPort
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
|
||||
EFI_HANDLE DeviceHandle;
|
||||
|
||||
AtaDevice = NULL;
|
||||
NewDevicePathNode = NULL;
|
||||
DevicePath = NULL;
|
||||
AtaDevice = NULL;
|
||||
NewDevicePathNode = NULL;
|
||||
DevicePath = NULL;
|
||||
RemainingDevicePath = NULL;
|
||||
|
||||
//
|
||||
// Build device path
|
||||
//
|
||||
AtaPassThru = AtaBusDriverData->AtaPassThru;
|
||||
Status = AtaPassThru->BuildDevicePath (AtaPassThru, Port, PortMultiplierPort, &NewDevicePathNode);
|
||||
Status = AtaPassThru->BuildDevicePath (AtaPassThru, Port, PortMultiplierPort, &NewDevicePathNode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
@@ -243,10 +248,10 @@ RegisterAtaDevice (
|
||||
goto Done;
|
||||
}
|
||||
|
||||
DeviceHandle = NULL;
|
||||
DeviceHandle = NULL;
|
||||
RemainingDevicePath = DevicePath;
|
||||
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);
|
||||
if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {
|
||||
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);
|
||||
if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd (RemainingDevicePath)) {
|
||||
Status = EFI_ALREADY_STARTED;
|
||||
FreePool (DevicePath);
|
||||
goto Done;
|
||||
@@ -270,11 +275,12 @@ RegisterAtaDevice (
|
||||
AtaDevice->DevicePath = DevicePath;
|
||||
AtaDevice->Port = Port;
|
||||
AtaDevice->PortMultiplierPort = PortMultiplierPort;
|
||||
AtaDevice->Asb = AllocateAlignedBuffer (AtaDevice, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||
AtaDevice->Asb = AllocateAlignedBuffer (AtaDevice, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||
if (AtaDevice->Asb == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
AtaDevice->IdentifyData = AllocateAlignedBuffer (AtaDevice, sizeof (ATA_IDENTIFY_DATA));
|
||||
if (AtaDevice->IdentifyData == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -368,13 +374,14 @@ RegisterAtaDevice (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Successfully Install Storage Security Protocol on the ATA device\n"));
|
||||
}
|
||||
|
||||
gBS->OpenProtocol (
|
||||
AtaBusDriverData->Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **) &AtaPassThru,
|
||||
(VOID **)&AtaPassThru,
|
||||
AtaBusDriverData->DriverBindingHandle,
|
||||
AtaDevice->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
@@ -389,10 +396,10 @@ Done:
|
||||
ReleaseAtaResources (AtaDevice);
|
||||
DEBUG ((DEBUG_ERROR | DEBUG_INIT, "Failed to initialize Port %x PortMultiplierPort %x, status = %r\n", Port, PortMultiplierPort, Status));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Unregisters an ATA device.
|
||||
|
||||
@@ -409,25 +416,25 @@ Done:
|
||||
**/
|
||||
EFI_STATUS
|
||||
UnregisterAtaDevice (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_HANDLE Handle
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *StorageSecurity;
|
||||
EFI_STATUS Status;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *StorageSecurity;
|
||||
|
||||
BlockIo2 = NULL;
|
||||
BlockIo = NULL;
|
||||
BlockIo2 = NULL;
|
||||
BlockIo = NULL;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlockIo,
|
||||
(VOID **)&BlockIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -439,7 +446,7 @@ UnregisterAtaDevice (
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
(VOID **) &BlockIo2,
|
||||
(VOID **)&BlockIo2,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -488,13 +495,13 @@ UnregisterAtaDevice (
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **) &AtaPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **)&AtaPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -504,7 +511,7 @@ UnregisterAtaDevice (
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiStorageSecurityCommandProtocolGuid,
|
||||
(VOID **) &StorageSecurity,
|
||||
(VOID **)&StorageSecurity,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -518,13 +525,13 @@ UnregisterAtaDevice (
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **) &AtaPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **)&AtaPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
@@ -533,8 +540,6 @@ UnregisterAtaDevice (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||
@@ -585,11 +590,11 @@ AtaBusDriverBindingSupported (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplierPort;
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplierPort;
|
||||
|
||||
//
|
||||
// Test EFI_ATA_PASS_THRU_PROTOCOL on controller handle.
|
||||
@@ -597,7 +602,7 @@ AtaBusDriverBindingSupported (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **) &AtaPassThru,
|
||||
(VOID **)&AtaPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@@ -619,11 +624,11 @@ AtaBusDriverBindingSupported (
|
||||
// Close the I/O Abstraction(s) used to perform the supported test
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -637,11 +642,11 @@ AtaBusDriverBindingSupported (
|
||||
// Close the I/O Abstraction(s) used to perform the supported test
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
@@ -650,11 +655,11 @@ AtaBusDriverBindingSupported (
|
||||
// Close the I/O Abstraction(s) used to perform the supported test
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
//
|
||||
// Open the EFI Device Path protocol needed to perform the supported test
|
||||
@@ -662,7 +667,7 @@ AtaBusDriverBindingSupported (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
(VOID **)&ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -670,7 +675,6 @@ AtaBusDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Starts a device controller or a bus controller.
|
||||
|
||||
@@ -714,19 +718,19 @@ AtaBusDriverBindingStart (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplierPort;
|
||||
EFI_STATUS Status;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplierPort;
|
||||
|
||||
AtaBusDriverData = NULL;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
(VOID **)&ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -747,7 +751,7 @@ AtaBusDriverBindingStart (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
(VOID **) &AtaPassThru,
|
||||
(VOID **)&AtaPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@@ -766,9 +770,9 @@ AtaBusDriverBindingStart (
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
AtaBusDriverData->AtaPassThru = AtaPassThru;
|
||||
AtaBusDriverData->Controller = Controller;
|
||||
AtaBusDriverData->ParentDevicePath = ParentDevicePath;
|
||||
AtaBusDriverData->AtaPassThru = AtaPassThru;
|
||||
AtaBusDriverData->Controller = Controller;
|
||||
AtaBusDriverData->ParentDevicePath = ParentDevicePath;
|
||||
AtaBusDriverData->DriverBindingHandle = This->DriverBindingHandle;
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
@@ -780,12 +784,11 @@ AtaBusDriverBindingStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
} else {
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiCallerIdGuid,
|
||||
(VOID **) &AtaBusDriverData,
|
||||
(VOID **)&AtaBusDriverData,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -826,14 +829,16 @@ AtaBusDriverBindingStart (
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
RegisterAtaDevice (AtaBusDriverData, Port, PortMultiplierPort);
|
||||
}
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
} else if (!IsDevicePathEnd (RemainingDevicePath)) {
|
||||
Status = AtaPassThru->GetDevice (AtaPassThru, RemainingDevicePath, &Port, &PortMultiplierPort);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = RegisterAtaDevice (AtaBusDriverData,Port, PortMultiplierPort);
|
||||
Status = RegisterAtaDevice (AtaBusDriverData, Port, PortMultiplierPort);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,17 +857,15 @@ ErrorExit:
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stops a device controller or a bus controller.
|
||||
|
||||
@@ -892,42 +895,42 @@ ErrorExit:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN AllChildrenStopped;
|
||||
UINTN Index;
|
||||
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN AllChildrenStopped;
|
||||
UINTN Index;
|
||||
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
|
||||
|
||||
if (NumberOfChildren == 0) {
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiCallerIdGuid,
|
||||
(VOID **) &AtaBusDriverData,
|
||||
(VOID **)&AtaBusDriverData,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
Controller,
|
||||
&gEfiCallerIdGuid,
|
||||
AtaBusDriverData,
|
||||
NULL
|
||||
);
|
||||
Controller,
|
||||
&gEfiCallerIdGuid,
|
||||
AtaBusDriverData,
|
||||
NULL
|
||||
);
|
||||
FreePool (AtaBusDriverData);
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
Controller,
|
||||
&gEfiAtaPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -935,7 +938,6 @@ AtaBusDriverBindingStop (
|
||||
AllChildrenStopped = TRUE;
|
||||
|
||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||
|
||||
Status = UnregisterAtaDevice (This, Controller, ChildHandleBuffer[Index]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AllChildrenStopped = FALSE;
|
||||
@@ -949,7 +951,6 @@ AtaBusDriverBindingStop (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset the Block Device.
|
||||
|
||||
@@ -964,13 +965,13 @@ AtaBusDriverBindingStop (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoReset (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
@@ -986,7 +987,6 @@ AtaBlockIoReset (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read/Write BufferSize bytes from Lba from/into Buffer.
|
||||
|
||||
@@ -1015,30 +1015,30 @@ AtaBlockIoReset (
|
||||
**/
|
||||
EFI_STATUS
|
||||
BlockIoReadWrite (
|
||||
IN VOID *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer,
|
||||
IN BOOLEAN IsBlockIo2,
|
||||
IN BOOLEAN IsWrite
|
||||
IN VOID *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer,
|
||||
IN BOOLEAN IsBlockIo2,
|
||||
IN BOOLEAN IsWrite
|
||||
)
|
||||
{
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_BLOCK_IO_MEDIA *Media;
|
||||
UINTN BlockSize;
|
||||
UINTN NumberOfBlocks;
|
||||
UINTN IoAlign;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_BLOCK_IO_MEDIA *Media;
|
||||
UINTN BlockSize;
|
||||
UINTN NumberOfBlocks;
|
||||
UINTN IoAlign;
|
||||
|
||||
if (IsBlockIo2) {
|
||||
Media = ((EFI_BLOCK_IO2_PROTOCOL *) This)->Media;
|
||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (This);
|
||||
Media = ((EFI_BLOCK_IO2_PROTOCOL *)This)->Media;
|
||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (This);
|
||||
} else {
|
||||
Media = ((EFI_BLOCK_IO_PROTOCOL *) This)->Media;
|
||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (This);
|
||||
Media = ((EFI_BLOCK_IO_PROTOCOL *)This)->Media;
|
||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (This);
|
||||
}
|
||||
|
||||
if (MediaId != Media->MediaId) {
|
||||
@@ -1057,6 +1057,7 @@ BlockIoReadWrite (
|
||||
Token->TransactionStatus = EFI_SUCCESS;
|
||||
gBS->SignalEvent (Token->Event);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1065,13 +1066,13 @@ BlockIoReadWrite (
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
NumberOfBlocks = BufferSize / BlockSize;
|
||||
NumberOfBlocks = BufferSize / BlockSize;
|
||||
if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
IoAlign = Media->IoAlign;
|
||||
if (IoAlign > 0 && (((UINTN) Buffer & (IoAlign - 1)) != 0)) {
|
||||
if ((IoAlign > 0) && (((UINTN)Buffer & (IoAlign - 1)) != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -1087,7 +1088,6 @@ BlockIoReadWrite (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@@ -1110,17 +1110,16 @@ BlockIoReadWrite (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoReadBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, NULL, BufferSize, Buffer, FALSE, FALSE);
|
||||
return BlockIoReadWrite ((VOID *)This, MediaId, Lba, NULL, BufferSize, Buffer, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@@ -1144,17 +1143,16 @@ AtaBlockIoReadBlocks (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoWriteBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, NULL, BufferSize, Buffer, FALSE, TRUE);
|
||||
return BlockIoReadWrite ((VOID *)This, MediaId, Lba, NULL, BufferSize, Buffer, FALSE, TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
@@ -1168,7 +1166,7 @@ AtaBlockIoWriteBlocks (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoFlushBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1195,9 +1193,9 @@ AtaBlockIoResetEx (
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
@@ -1252,10 +1250,9 @@ AtaBlockIoReadBlocksEx (
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, Token, BufferSize, Buffer, TRUE, FALSE);
|
||||
return BlockIoReadWrite ((VOID *)This, MediaId, Lba, Token, BufferSize, Buffer, TRUE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@@ -1289,10 +1286,9 @@ AtaBlockIoWriteBlocksEx (
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, Token, BufferSize, Buffer, TRUE, TRUE);
|
||||
return BlockIoReadWrite ((VOID *)This, MediaId, Lba, Token, BufferSize, Buffer, TRUE, TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
@@ -1314,12 +1310,14 @@ AtaBlockIoFlushBlocksEx (
|
||||
//
|
||||
// Signal event and return directly.
|
||||
//
|
||||
if (Token != NULL && Token->Event != NULL) {
|
||||
if ((Token != NULL) && (Token->Event != NULL)) {
|
||||
Token->TransactionStatus = EFI_SUCCESS;
|
||||
gBS->SignalEvent (Token->Event);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Provides inquiry information for the controller type.
|
||||
|
||||
@@ -1339,15 +1337,14 @@ AtaBlockIoFlushBlocksEx (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoInquiry (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *InquiryData,
|
||||
IN OUT UINT32 *InquiryDataSize
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *InquiryData,
|
||||
IN OUT UINT32 *InquiryDataSize
|
||||
)
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Provides identify information for the controller type.
|
||||
|
||||
@@ -1369,13 +1366,13 @@ AtaDiskInfoInquiry (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoIdentify (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *IdentifyData,
|
||||
IN OUT UINT32 *IdentifyDataSize
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *IdentifyData,
|
||||
IN OUT UINT32 *IdentifyDataSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
|
||||
AtaDevice = ATA_DEVICE_FROM_DISK_INFO (This);
|
||||
|
||||
@@ -1384,12 +1381,12 @@ AtaDiskInfoIdentify (
|
||||
Status = EFI_SUCCESS;
|
||||
CopyMem (IdentifyData, AtaDevice->IdentifyData, sizeof (ATA_IDENTIFY_DATA));
|
||||
}
|
||||
|
||||
*IdentifyDataSize = sizeof (ATA_IDENTIFY_DATA);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Provides sense data information for the controller type.
|
||||
|
||||
@@ -1410,16 +1407,15 @@ AtaDiskInfoIdentify (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoSenseData (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *SenseData,
|
||||
IN OUT UINT32 *SenseDataSize,
|
||||
OUT UINT8 *SenseDataNumber
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *SenseData,
|
||||
IN OUT UINT32 *SenseDataSize,
|
||||
OUT UINT8 *SenseDataNumber
|
||||
)
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is used by the IDE bus driver to get controller information.
|
||||
|
||||
@@ -1434,16 +1430,16 @@ AtaDiskInfoSenseData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoWhichIde (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
OUT UINT32 *IdeChannel,
|
||||
OUT UINT32 *IdeDevice
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
OUT UINT32 *IdeChannel,
|
||||
OUT UINT32 *IdeDevice
|
||||
)
|
||||
{
|
||||
ATA_DEVICE *AtaDevice;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
|
||||
AtaDevice = ATA_DEVICE_FROM_DISK_INFO (This);
|
||||
*IdeChannel = AtaDevice->Port;
|
||||
*IdeDevice = AtaDevice->PortMultiplierPort;
|
||||
AtaDevice = ATA_DEVICE_FROM_DISK_INFO (This);
|
||||
*IdeChannel = AtaDevice->Port;
|
||||
*IdeDevice = AtaDevice->PortMultiplierPort;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -1523,22 +1519,22 @@ AtaDiskInfoWhichIde (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaStorageSecurityReceiveData (
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *Private;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *Private;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "EFI Storage Security Protocol - Read\n"));
|
||||
if ((PayloadBuffer == NULL || PayloadTransferSize == NULL) && PayloadBufferSize != 0) {
|
||||
if (((PayloadBuffer == NULL) || (PayloadTransferSize == NULL)) && (PayloadBufferSize != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -1634,18 +1630,18 @@ AtaStorageSecurityReceiveData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaStorageSecuritySendData (
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
IN VOID *PayloadBuffer
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
IN VOID *PayloadBuffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *Private;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
ATA_DEVICE *Private;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "EFI Storage Security Protocol - Send\n"));
|
||||
if ((PayloadBuffer == NULL) && (PayloadBufferSize != 0)) {
|
||||
@@ -1687,12 +1683,12 @@ AtaStorageSecuritySendData (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeAtaBus(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
InitializeAtaBus (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Install driver model protocol(s).
|
||||
|
@@ -38,27 +38,27 @@
|
||||
//
|
||||
// Time out value for ATA pass through protocol
|
||||
//
|
||||
#define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)
|
||||
#define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)
|
||||
|
||||
//
|
||||
// Maximum number of times to retry ATA command
|
||||
//
|
||||
#define MAX_RETRY_TIMES 3
|
||||
#define MAX_RETRY_TIMES 3
|
||||
|
||||
//
|
||||
// The maximum total sectors count in 28 bit addressing mode
|
||||
//
|
||||
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
||||
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
||||
|
||||
//
|
||||
// The maximum ATA transaction sector count in 28 bit addressing mode.
|
||||
//
|
||||
#define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100
|
||||
#define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100
|
||||
|
||||
//
|
||||
// The maximum ATA transaction sector count in 48 bit addressing mode.
|
||||
//
|
||||
//#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000
|
||||
// #define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000
|
||||
|
||||
//
|
||||
// BugBug: if the TransferLength is equal with 0x10000 (the 48bit max length),
|
||||
@@ -66,109 +66,109 @@
|
||||
// seems not ready. Change the Maximum Sector Numbers to 0xFFFF to work round
|
||||
// this issue.
|
||||
//
|
||||
#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF
|
||||
#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF
|
||||
|
||||
//
|
||||
// The maximum model name in ATA identify data
|
||||
//
|
||||
#define MAX_MODEL_NAME_LEN 40
|
||||
#define MAX_MODEL_NAME_LEN 40
|
||||
|
||||
#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')
|
||||
#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')
|
||||
#define ATA_SUB_TASK_SIGNATURE SIGNATURE_32 ('A', 'S', 'T', 'S')
|
||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||
#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')
|
||||
#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')
|
||||
#define ATA_SUB_TASK_SIGNATURE SIGNATURE_32 ('A', 'S', 'T', 'S')
|
||||
#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
|
||||
|
||||
//
|
||||
// ATA bus data structure for ATA controller
|
||||
//
|
||||
typedef struct {
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_HANDLE Controller;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_HANDLE Controller;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
} ATA_BUS_DRIVER_DATA;
|
||||
|
||||
//
|
||||
// ATA device data structure for each child device
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_BLOCK_IO_PROTOCOL BlockIo;
|
||||
EFI_BLOCK_IO2_PROTOCOL BlockIo2;
|
||||
EFI_BLOCK_IO_MEDIA BlockMedia;
|
||||
EFI_DISK_INFO_PROTOCOL DiskInfo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_BLOCK_IO_PROTOCOL BlockIo;
|
||||
EFI_BLOCK_IO2_PROTOCOL BlockIo2;
|
||||
EFI_BLOCK_IO_MEDIA BlockMedia;
|
||||
EFI_DISK_INFO_PROTOCOL DiskInfo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;
|
||||
|
||||
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplierPort;
|
||||
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
|
||||
UINT16 Port;
|
||||
UINT16 PortMultiplierPort;
|
||||
|
||||
//
|
||||
// Buffer for the execution of ATA pass through protocol
|
||||
//
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;
|
||||
EFI_ATA_COMMAND_BLOCK Acb;
|
||||
EFI_ATA_STATUS_BLOCK *Asb;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;
|
||||
EFI_ATA_COMMAND_BLOCK Acb;
|
||||
EFI_ATA_STATUS_BLOCK *Asb;
|
||||
|
||||
BOOLEAN UdmaValid;
|
||||
BOOLEAN Lba48Bit;
|
||||
BOOLEAN UdmaValid;
|
||||
BOOLEAN Lba48Bit;
|
||||
|
||||
//
|
||||
// Cached data for ATA identify data
|
||||
//
|
||||
ATA_IDENTIFY_DATA *IdentifyData;
|
||||
ATA_IDENTIFY_DATA *IdentifyData;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];
|
||||
|
||||
LIST_ENTRY AtaTaskList;
|
||||
LIST_ENTRY AtaSubTaskList;
|
||||
BOOLEAN Abort;
|
||||
LIST_ENTRY AtaTaskList;
|
||||
LIST_ENTRY AtaSubTaskList;
|
||||
BOOLEAN Abort;
|
||||
} ATA_DEVICE;
|
||||
|
||||
//
|
||||
// Sub-Task for the non blocking I/O
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_BLOCK_IO2_TOKEN *Token;
|
||||
UINTN *UnsignalledEventCount;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;
|
||||
BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.
|
||||
LIST_ENTRY TaskEntry;
|
||||
UINT32 Signature;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
EFI_BLOCK_IO2_TOKEN *Token;
|
||||
UINTN *UnsignalledEventCount;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;
|
||||
BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.
|
||||
LIST_ENTRY TaskEntry;
|
||||
} ATA_BUS_ASYN_SUB_TASK;
|
||||
|
||||
//
|
||||
// Task for the non blocking I/O
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
EFI_BLOCK_IO2_TOKEN *Token;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
UINT8 *Buffer;
|
||||
EFI_LBA StartLba;
|
||||
UINTN NumberOfBlocks;
|
||||
BOOLEAN IsWrite;
|
||||
LIST_ENTRY TaskEntry;
|
||||
UINT32 Signature;
|
||||
EFI_BLOCK_IO2_TOKEN *Token;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
UINT8 *Buffer;
|
||||
EFI_LBA StartLba;
|
||||
UINTN NumberOfBlocks;
|
||||
BOOLEAN IsWrite;
|
||||
LIST_ENTRY TaskEntry;
|
||||
} ATA_BUS_ASYN_TASK;
|
||||
|
||||
#define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_ASYN_SUB_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)
|
||||
#define ATA_ASYN_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)
|
||||
#define ATA_ASYN_SUB_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)
|
||||
#define ATA_ASYN_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;
|
||||
|
||||
/**
|
||||
Allocates an aligned buffer for ATA device.
|
||||
@@ -185,8 +185,8 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;
|
||||
**/
|
||||
VOID *
|
||||
AllocateAlignedBuffer (
|
||||
IN ATA_DEVICE *AtaDevice,
|
||||
IN UINTN BufferSize
|
||||
IN ATA_DEVICE *AtaDevice,
|
||||
IN UINTN BufferSize
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -201,8 +201,8 @@ AllocateAlignedBuffer (
|
||||
**/
|
||||
VOID
|
||||
FreeAlignedBuffer (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN BufferSize
|
||||
IN VOID *Buffer,
|
||||
IN UINTN BufferSize
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -230,10 +230,9 @@ FreeAtaSubTask (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ResetAtaDevice (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Discovers whether it is a valid ATA device.
|
||||
|
||||
@@ -250,7 +249,7 @@ ResetAtaDevice (
|
||||
**/
|
||||
EFI_STATUS
|
||||
DiscoverAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice
|
||||
IN OUT ATA_DEVICE *AtaDevice
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -272,13 +271,13 @@ DiscoverAtaDevice (
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
AccessAtaDevice(
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN NumberOfBlocks,
|
||||
IN BOOLEAN IsWrite,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
AccessAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN NumberOfBlocks,
|
||||
IN BOOLEAN IsWrite,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -313,19 +312,20 @@ AccessAtaDevice(
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TrustTransferAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN TransferLength,
|
||||
IN BOOLEAN IsTrustSend,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINTN *TransferLengthOut
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN TransferLength,
|
||||
IN BOOLEAN IsTrustSend,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINTN *TransferLengthOut
|
||||
);
|
||||
|
||||
//
|
||||
// Protocol interface prototypes
|
||||
//
|
||||
|
||||
/**
|
||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||
@@ -448,13 +448,12 @@ AtaBusDriverBindingStart (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
@@ -502,7 +501,6 @@ AtaBusComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -574,14 +572,13 @@ AtaBusComponentNameGetDriverName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Reset the Block Device.
|
||||
|
||||
@@ -596,11 +593,10 @@ AtaBusComponentNameGetControllerName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoReset (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@@ -623,14 +619,13 @@ AtaBlockIoReset (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoReadBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@@ -654,14 +649,13 @@ AtaBlockIoReadBlocks (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoWriteBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
@@ -675,7 +669,7 @@ AtaBlockIoWriteBlocks (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBlockIoFlushBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -797,7 +791,7 @@ AtaBlockIoFlushBlocksEx (
|
||||
VOID
|
||||
EFIAPI
|
||||
AtaTerminateNonBlockingTask (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -819,12 +813,11 @@ AtaTerminateNonBlockingTask (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoInquiry (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *InquiryData,
|
||||
IN OUT UINT32 *InquiryDataSize
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *InquiryData,
|
||||
IN OUT UINT32 *InquiryDataSize
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Provides identify information for the controller type.
|
||||
|
||||
@@ -846,12 +839,11 @@ AtaDiskInfoInquiry (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoIdentify (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *IdentifyData,
|
||||
IN OUT UINT32 *IdentifyDataSize
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *IdentifyData,
|
||||
IN OUT UINT32 *IdentifyDataSize
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Provides sense data information for the controller type.
|
||||
|
||||
@@ -872,13 +864,12 @@ AtaDiskInfoIdentify (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoSenseData (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *SenseData,
|
||||
IN OUT UINT32 *SenseDataSize,
|
||||
OUT UINT8 *SenseDataNumber
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *SenseData,
|
||||
IN OUT UINT32 *SenseDataSize,
|
||||
OUT UINT8 *SenseDataNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
This function is used by the IDE bus driver to get controller information.
|
||||
|
||||
@@ -893,9 +884,9 @@ AtaDiskInfoSenseData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaDiskInfoWhichIde (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
OUT UINT32 *IdeChannel,
|
||||
OUT UINT32 *IdeDevice
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
OUT UINT32 *IdeChannel,
|
||||
OUT UINT32 *IdeDevice
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -973,14 +964,14 @@ AtaDiskInfoWhichIde (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaStorageSecurityReceiveData (
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
OUT VOID *PayloadBuffer,
|
||||
OUT UINTN *PayloadTransferSize
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1047,13 +1038,13 @@ AtaStorageSecurityReceiveData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaStorageSecuritySendData (
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
IN VOID *PayloadBuffer
|
||||
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Timeout,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN PayloadBufferSize,
|
||||
IN VOID *PayloadBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1069,7 +1060,7 @@ AtaStorageSecuritySendData (
|
||||
**/
|
||||
VOID
|
||||
InitiateTPerReset (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -19,16 +19,16 @@
|
||||
|
||||
#include "AtaBus.h"
|
||||
|
||||
#define ATA_CMD_TRUST_NON_DATA 0x5B
|
||||
#define ATA_CMD_TRUST_RECEIVE 0x5C
|
||||
#define ATA_CMD_TRUST_RECEIVE_DMA 0x5D
|
||||
#define ATA_CMD_TRUST_SEND 0x5E
|
||||
#define ATA_CMD_TRUST_SEND_DMA 0x5F
|
||||
#define ATA_CMD_TRUST_NON_DATA 0x5B
|
||||
#define ATA_CMD_TRUST_RECEIVE 0x5C
|
||||
#define ATA_CMD_TRUST_RECEIVE_DMA 0x5D
|
||||
#define ATA_CMD_TRUST_SEND 0x5E
|
||||
#define ATA_CMD_TRUST_SEND_DMA 0x5F
|
||||
|
||||
//
|
||||
// Look up table (UdmaValid, IsWrite) for EFI_ATA_PASS_THRU_CMD_PROTOCOL
|
||||
//
|
||||
EFI_ATA_PASS_THRU_CMD_PROTOCOL mAtaPassThruCmdProtocols[][2] = {
|
||||
EFI_ATA_PASS_THRU_CMD_PROTOCOL mAtaPassThruCmdProtocols[][2] = {
|
||||
{
|
||||
EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN,
|
||||
EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_OUT
|
||||
@@ -42,7 +42,7 @@ EFI_ATA_PASS_THRU_CMD_PROTOCOL mAtaPassThruCmdProtocols[][2] = {
|
||||
//
|
||||
// Look up table (UdmaValid, Lba48Bit, IsIsWrite) for ATA_CMD
|
||||
//
|
||||
UINT8 mAtaCommands[][2][2] = {
|
||||
UINT8 mAtaCommands[][2][2] = {
|
||||
{
|
||||
{
|
||||
ATA_CMD_READ_SECTORS, // 28-bit LBA; PIO read
|
||||
@@ -68,7 +68,7 @@ UINT8 mAtaCommands[][2][2] = {
|
||||
//
|
||||
// Look up table (UdmaValid, IsTrustSend) for ATA_CMD
|
||||
//
|
||||
UINT8 mAtaTrustCommands[2][2] = {
|
||||
UINT8 mAtaTrustCommands[2][2] = {
|
||||
{
|
||||
ATA_CMD_TRUST_RECEIVE, // PIO read
|
||||
ATA_CMD_TRUST_SEND // PIO write
|
||||
@@ -79,16 +79,14 @@ UINT8 mAtaTrustCommands[2][2] = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Look up table (Lba48Bit) for maximum transfer block number
|
||||
//
|
||||
UINTN mMaxTransferBlockNumber[] = {
|
||||
UINTN mMaxTransferBlockNumber[] = {
|
||||
MAX_28BIT_TRANSFER_BLOCK_NUM,
|
||||
MAX_48BIT_TRANSFER_BLOCK_NUM
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.PassThru().
|
||||
|
||||
@@ -112,21 +110,21 @@ UINTN mMaxTransferBlockNumber[] = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
AtaDevicePassThru (
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *TaskPacket OPTIONAL,
|
||||
IN OUT EFI_EVENT Event OPTIONAL
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *TaskPacket OPTIONAL,
|
||||
IN OUT EFI_EVENT Event OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
||||
EFI_STATUS Status;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;
|
||||
|
||||
//
|
||||
// Assemble packet. If it is non blocking mode, the Ata driver should keep each
|
||||
// subtask and clean them when the event is signaled.
|
||||
//
|
||||
if (TaskPacket != NULL) {
|
||||
Packet = TaskPacket;
|
||||
Packet = TaskPacket;
|
||||
Packet->Asb = AllocateAlignedBuffer (AtaDevice, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||
if (Packet->Asb == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -135,7 +133,7 @@ AtaDevicePassThru (
|
||||
CopyMem (Packet->Asb, AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||
Packet->Acb = AllocateCopyPool (sizeof (EFI_ATA_COMMAND_BLOCK), &AtaDevice->Acb);
|
||||
} else {
|
||||
Packet = &AtaDevice->Packet;
|
||||
Packet = &AtaDevice->Packet;
|
||||
Packet->Asb = AtaDevice->Asb;
|
||||
Packet->Acb = &AtaDevice->Acb;
|
||||
}
|
||||
@@ -159,7 +157,6 @@ AtaDevicePassThru (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().
|
||||
|
||||
@@ -173,10 +170,10 @@ AtaDevicePassThru (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ResetAtaDevice (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
)
|
||||
{
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
|
||||
|
||||
AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
|
||||
|
||||
@@ -196,7 +193,6 @@ ResetAtaDevice (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints ATA model name to ATA device structure.
|
||||
|
||||
@@ -216,20 +212,20 @@ PrintAtaModelName (
|
||||
CHAR8 *Source;
|
||||
CHAR16 *Destination;
|
||||
|
||||
Source = AtaDevice->IdentifyData->ModelName;
|
||||
Source = AtaDevice->IdentifyData->ModelName;
|
||||
Destination = AtaDevice->ModelName;
|
||||
|
||||
//
|
||||
// Swap the byte order in the original module name.
|
||||
//
|
||||
for (Index = 0; Index < MAX_MODEL_NAME_LEN; Index += 2) {
|
||||
Destination[Index] = Source[Index + 1];
|
||||
Destination[Index + 1] = Source[Index];
|
||||
Destination[Index] = Source[Index + 1];
|
||||
Destination[Index + 1] = Source[Index];
|
||||
}
|
||||
|
||||
AtaDevice->ModelName[MAX_MODEL_NAME_LEN] = L'\0';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Gets ATA device Capacity according to ATA 6.
|
||||
|
||||
@@ -244,13 +240,13 @@ PrintAtaModelName (
|
||||
**/
|
||||
EFI_LBA
|
||||
GetAtapi6Capacity (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
)
|
||||
{
|
||||
EFI_LBA Capacity;
|
||||
EFI_LBA TmpLba;
|
||||
UINTN Index;
|
||||
ATA_IDENTIFY_DATA *IdentifyData;
|
||||
EFI_LBA Capacity;
|
||||
EFI_LBA TmpLba;
|
||||
UINTN Index;
|
||||
ATA_IDENTIFY_DATA *IdentifyData;
|
||||
|
||||
IdentifyData = AtaDevice->IdentifyData;
|
||||
if ((IdentifyData->command_set_supported_83 & BIT10) == 0) {
|
||||
@@ -268,14 +264,13 @@ GetAtapi6Capacity (
|
||||
//
|
||||
// Lower byte goes first: word[100] is the lowest word, word[103] is highest
|
||||
//
|
||||
TmpLba = IdentifyData->maximum_lba_for_48bit_addressing[Index];
|
||||
TmpLba = IdentifyData->maximum_lba_for_48bit_addressing[Index];
|
||||
Capacity |= LShiftU64 (TmpLba, 16 * Index);
|
||||
}
|
||||
|
||||
return Capacity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Identifies ATA device via the Identify data.
|
||||
|
||||
@@ -291,14 +286,14 @@ GetAtapi6Capacity (
|
||||
**/
|
||||
EFI_STATUS
|
||||
IdentifyAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice
|
||||
IN OUT ATA_DEVICE *AtaDevice
|
||||
)
|
||||
{
|
||||
ATA_IDENTIFY_DATA *IdentifyData;
|
||||
EFI_BLOCK_IO_MEDIA *BlockMedia;
|
||||
EFI_LBA Capacity;
|
||||
UINT16 PhyLogicSectorSupport;
|
||||
UINT16 UdmaMode;
|
||||
ATA_IDENTIFY_DATA *IdentifyData;
|
||||
EFI_BLOCK_IO_MEDIA *BlockMedia;
|
||||
EFI_LBA Capacity;
|
||||
UINT16 PhyLogicSectorSupport;
|
||||
UINT16 UdmaMode;
|
||||
|
||||
IdentifyData = AtaDevice->IdentifyData;
|
||||
|
||||
@@ -334,16 +329,16 @@ IdentifyAtaDevice (
|
||||
//
|
||||
// This is a hard disk <= 120GB capacity, treat it as normal hard disk
|
||||
//
|
||||
Capacity = ((UINT32)IdentifyData->user_addressable_sectors_hi << 16) | IdentifyData->user_addressable_sectors_lo;
|
||||
Capacity = ((UINT32)IdentifyData->user_addressable_sectors_hi << 16) | IdentifyData->user_addressable_sectors_lo;
|
||||
AtaDevice->Lba48Bit = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Block Media Information:
|
||||
//
|
||||
BlockMedia = &AtaDevice->BlockMedia;
|
||||
BlockMedia = &AtaDevice->BlockMedia;
|
||||
BlockMedia->LastBlock = Capacity - 1;
|
||||
BlockMedia->IoAlign = AtaDevice->AtaBusDriverData->AtaPassThru->Mode->IoAlign;
|
||||
BlockMedia->IoAlign = AtaDevice->AtaBusDriverData->AtaPassThru->Mode->IoAlign;
|
||||
//
|
||||
// Check whether Long Physical Sector Feature is supported
|
||||
//
|
||||
@@ -353,23 +348,26 @@ IdentifyAtaDevice (
|
||||
// Check whether one physical block contains multiple physical blocks
|
||||
//
|
||||
if ((PhyLogicSectorSupport & BIT13) != 0) {
|
||||
BlockMedia->LogicalBlocksPerPhysicalBlock = (UINT32) (1 << (PhyLogicSectorSupport & 0x000f));
|
||||
BlockMedia->LogicalBlocksPerPhysicalBlock = (UINT32)(1 << (PhyLogicSectorSupport & 0x000f));
|
||||
//
|
||||
// Check lowest alignment of logical blocks within physical block
|
||||
//
|
||||
if ((IdentifyData->alignment_logic_in_phy_blocks & (BIT14 | BIT15)) == BIT14) {
|
||||
BlockMedia->LowestAlignedLba = (EFI_LBA) ((BlockMedia->LogicalBlocksPerPhysicalBlock - ((UINT32)IdentifyData->alignment_logic_in_phy_blocks & 0x3fff)) %
|
||||
BlockMedia->LogicalBlocksPerPhysicalBlock);
|
||||
BlockMedia->LowestAlignedLba = (EFI_LBA)((BlockMedia->LogicalBlocksPerPhysicalBlock - ((UINT32)IdentifyData->alignment_logic_in_phy_blocks & 0x3fff)) %
|
||||
BlockMedia->LogicalBlocksPerPhysicalBlock);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check logical block size
|
||||
//
|
||||
if ((PhyLogicSectorSupport & BIT12) != 0) {
|
||||
BlockMedia->BlockSize = (UINT32) (((IdentifyData->logic_sector_size_hi << 16) | IdentifyData->logic_sector_size_lo) * sizeof (UINT16));
|
||||
BlockMedia->BlockSize = (UINT32)(((IdentifyData->logic_sector_size_hi << 16) | IdentifyData->logic_sector_size_lo) * sizeof (UINT16));
|
||||
}
|
||||
|
||||
AtaDevice->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION2;
|
||||
}
|
||||
|
||||
//
|
||||
// Get ATA model name from identify data structure.
|
||||
//
|
||||
@@ -378,7 +376,6 @@ IdentifyAtaDevice (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Discovers whether it is a valid ATA device.
|
||||
|
||||
@@ -395,7 +392,7 @@ IdentifyAtaDevice (
|
||||
**/
|
||||
EFI_STATUS
|
||||
DiscoverAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice
|
||||
IN OUT ATA_DEVICE *AtaDevice
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -406,19 +403,19 @@ DiscoverAtaDevice (
|
||||
//
|
||||
// Prepare for ATA command block.
|
||||
//
|
||||
Acb = ZeroMem (&AtaDevice->Acb, sizeof (EFI_ATA_COMMAND_BLOCK));
|
||||
Acb->AtaCommand = ATA_CMD_IDENTIFY_DRIVE;
|
||||
Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));
|
||||
Acb = ZeroMem (&AtaDevice->Acb, sizeof (EFI_ATA_COMMAND_BLOCK));
|
||||
Acb->AtaCommand = ATA_CMD_IDENTIFY_DRIVE;
|
||||
Acb->AtaDeviceHead = (UINT8)(BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));
|
||||
|
||||
//
|
||||
// Prepare for ATA pass through packet.
|
||||
//
|
||||
Packet = ZeroMem (&AtaDevice->Packet, sizeof (EFI_ATA_PASS_THRU_COMMAND_PACKET));
|
||||
Packet->InDataBuffer = AtaDevice->IdentifyData;
|
||||
Packet = ZeroMem (&AtaDevice->Packet, sizeof (EFI_ATA_PASS_THRU_COMMAND_PACKET));
|
||||
Packet->InDataBuffer = AtaDevice->IdentifyData;
|
||||
Packet->InTransferLength = sizeof (ATA_IDENTIFY_DATA);
|
||||
Packet->Protocol = EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN;
|
||||
Packet->Length = EFI_ATA_PASS_THRU_LENGTH_BYTES | EFI_ATA_PASS_THRU_LENGTH_SECTOR_COUNT;
|
||||
Packet->Timeout = ATA_TIMEOUT;
|
||||
Packet->Protocol = EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN;
|
||||
Packet->Length = EFI_ATA_PASS_THRU_LENGTH_BYTES | EFI_ATA_PASS_THRU_LENGTH_SECTOR_COUNT;
|
||||
Packet->Timeout = ATA_TIMEOUT;
|
||||
|
||||
Retry = MAX_RETRY_TIMES;
|
||||
do {
|
||||
@@ -463,13 +460,13 @@ DiscoverAtaDevice (
|
||||
**/
|
||||
EFI_STATUS
|
||||
TransferAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *TaskPacket OPTIONAL,
|
||||
IN OUT VOID *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINT32 TransferLength,
|
||||
IN BOOLEAN IsWrite,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *TaskPacket OPTIONAL,
|
||||
IN OUT VOID *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINT32 TransferLength,
|
||||
IN BOOLEAN IsWrite,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_ATA_COMMAND_BLOCK *Acb;
|
||||
@@ -478,26 +475,26 @@ TransferAtaDevice (
|
||||
//
|
||||
// Ensure AtaDevice->UdmaValid, AtaDevice->Lba48Bit and IsWrite are valid boolean values
|
||||
//
|
||||
ASSERT ((UINTN) AtaDevice->UdmaValid < 2);
|
||||
ASSERT ((UINTN) AtaDevice->Lba48Bit < 2);
|
||||
ASSERT ((UINTN) IsWrite < 2);
|
||||
ASSERT ((UINTN)AtaDevice->UdmaValid < 2);
|
||||
ASSERT ((UINTN)AtaDevice->Lba48Bit < 2);
|
||||
ASSERT ((UINTN)IsWrite < 2);
|
||||
//
|
||||
// Prepare for ATA command block.
|
||||
//
|
||||
Acb = ZeroMem (&AtaDevice->Acb, sizeof (EFI_ATA_COMMAND_BLOCK));
|
||||
Acb->AtaCommand = mAtaCommands[AtaDevice->UdmaValid][AtaDevice->Lba48Bit][IsWrite];
|
||||
Acb->AtaSectorNumber = (UINT8) StartLba;
|
||||
Acb->AtaCylinderLow = (UINT8) RShiftU64 (StartLba, 8);
|
||||
Acb->AtaCylinderHigh = (UINT8) RShiftU64 (StartLba, 16);
|
||||
Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));
|
||||
Acb->AtaSectorCount = (UINT8) TransferLength;
|
||||
Acb = ZeroMem (&AtaDevice->Acb, sizeof (EFI_ATA_COMMAND_BLOCK));
|
||||
Acb->AtaCommand = mAtaCommands[AtaDevice->UdmaValid][AtaDevice->Lba48Bit][IsWrite];
|
||||
Acb->AtaSectorNumber = (UINT8)StartLba;
|
||||
Acb->AtaCylinderLow = (UINT8)RShiftU64 (StartLba, 8);
|
||||
Acb->AtaCylinderHigh = (UINT8)RShiftU64 (StartLba, 16);
|
||||
Acb->AtaDeviceHead = (UINT8)(BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));
|
||||
Acb->AtaSectorCount = (UINT8)TransferLength;
|
||||
if (AtaDevice->Lba48Bit) {
|
||||
Acb->AtaSectorNumberExp = (UINT8) RShiftU64 (StartLba, 24);
|
||||
Acb->AtaCylinderLowExp = (UINT8) RShiftU64 (StartLba, 32);
|
||||
Acb->AtaCylinderHighExp = (UINT8) RShiftU64 (StartLba, 40);
|
||||
Acb->AtaSectorCountExp = (UINT8) (TransferLength >> 8);
|
||||
Acb->AtaSectorNumberExp = (UINT8)RShiftU64 (StartLba, 24);
|
||||
Acb->AtaCylinderLowExp = (UINT8)RShiftU64 (StartLba, 32);
|
||||
Acb->AtaCylinderHighExp = (UINT8)RShiftU64 (StartLba, 40);
|
||||
Acb->AtaSectorCountExp = (UINT8)(TransferLength >> 8);
|
||||
} else {
|
||||
Acb->AtaDeviceHead = (UINT8) (Acb->AtaDeviceHead | RShiftU64 (StartLba, 24));
|
||||
Acb->AtaDeviceHead = (UINT8)(Acb->AtaDeviceHead | RShiftU64 (StartLba, 24));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -510,15 +507,15 @@ TransferAtaDevice (
|
||||
}
|
||||
|
||||
if (IsWrite) {
|
||||
Packet->OutDataBuffer = Buffer;
|
||||
Packet->OutDataBuffer = Buffer;
|
||||
Packet->OutTransferLength = TransferLength;
|
||||
} else {
|
||||
Packet->InDataBuffer = Buffer;
|
||||
Packet->InDataBuffer = Buffer;
|
||||
Packet->InTransferLength = TransferLength;
|
||||
}
|
||||
|
||||
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsWrite];
|
||||
Packet->Length = EFI_ATA_PASS_THRU_LENGTH_SECTOR_COUNT;
|
||||
Packet->Length = EFI_ATA_PASS_THRU_LENGTH_SECTOR_COUNT;
|
||||
//
|
||||
// |------------------------|-----------------|------------------------|-----------------|
|
||||
// | ATA PIO Transfer Mode | Transfer Rate | ATA DMA Transfer Mode | Transfer Rate |
|
||||
@@ -544,12 +541,12 @@ TransferAtaDevice (
|
||||
//
|
||||
// Calculate the maximum timeout value for DMA read/write operation.
|
||||
//
|
||||
Packet->Timeout = EFI_TIMER_PERIOD_SECONDS (DivU64x32 (MultU64x32 (TransferLength, AtaDevice->BlockMedia.BlockSize), 2100000) + 31);
|
||||
Packet->Timeout = EFI_TIMER_PERIOD_SECONDS (DivU64x32 (MultU64x32 (TransferLength, AtaDevice->BlockMedia.BlockSize), 2100000) + 31);
|
||||
} else {
|
||||
//
|
||||
// Calculate the maximum timeout value for PIO read/write operation
|
||||
//
|
||||
Packet->Timeout = EFI_TIMER_PERIOD_SECONDS (DivU64x32 (MultU64x32 (TransferLength, AtaDevice->BlockMedia.BlockSize), 3300000) + 31);
|
||||
Packet->Timeout = EFI_TIMER_PERIOD_SECONDS (DivU64x32 (MultU64x32 (TransferLength, AtaDevice->BlockMedia.BlockSize), 3300000) + 31);
|
||||
}
|
||||
|
||||
return AtaDevicePassThru (AtaDevice, TaskPacket, Event);
|
||||
@@ -570,6 +567,7 @@ FreeAtaSubTask (
|
||||
if (Task->Packet.Asb != NULL) {
|
||||
FreeAlignedBuffer (Task->Packet.Asb, sizeof (EFI_ATA_STATUS_BLOCK));
|
||||
}
|
||||
|
||||
if (Task->Packet.Acb != NULL) {
|
||||
FreePool (Task->Packet.Acb);
|
||||
}
|
||||
@@ -590,14 +588,14 @@ FreeAtaSubTask (
|
||||
VOID
|
||||
EFIAPI
|
||||
AtaTerminateNonBlockingTask (
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
IN ATA_DEVICE *AtaDevice
|
||||
)
|
||||
{
|
||||
BOOLEAN SubTaskEmpty;
|
||||
EFI_TPL OldTpl;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *List;
|
||||
BOOLEAN SubTaskEmpty;
|
||||
EFI_TPL OldTpl;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *List;
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
//
|
||||
@@ -607,13 +605,14 @@ AtaTerminateNonBlockingTask (
|
||||
|
||||
List = &AtaDevice->AtaTaskList;
|
||||
for (Entry = GetFirstNode (List); !IsNull (List, Entry);) {
|
||||
AtaTask = ATA_ASYN_TASK_FROM_ENTRY (Entry);
|
||||
AtaTask = ATA_ASYN_TASK_FROM_ENTRY (Entry);
|
||||
AtaTask->Token->TransactionStatus = EFI_ABORTED;
|
||||
gBS->SignalEvent (AtaTask->Token->Event);
|
||||
|
||||
Entry = RemoveEntryList (Entry);
|
||||
FreePool (AtaTask);
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
do {
|
||||
@@ -628,7 +627,7 @@ AtaTerminateNonBlockingTask (
|
||||
//
|
||||
// Aborting operation has been done. From now on, don't need to abort normal operation.
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
AtaDevice->Abort = FALSE;
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
@@ -644,17 +643,17 @@ AtaTerminateNonBlockingTask (
|
||||
VOID
|
||||
EFIAPI
|
||||
AtaNonBlockingCallBack (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
ATA_BUS_ASYN_SUB_TASK *Task;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
LIST_ENTRY *Entry;
|
||||
EFI_STATUS Status;
|
||||
ATA_BUS_ASYN_SUB_TASK *Task;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
ATA_DEVICE *AtaDevice;
|
||||
LIST_ENTRY *Entry;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Task = (ATA_BUS_ASYN_SUB_TASK *) Context;
|
||||
Task = (ATA_BUS_ASYN_SUB_TASK *)Context;
|
||||
gBS->CloseEvent (Event);
|
||||
|
||||
AtaDevice = Task->AtaDevice;
|
||||
@@ -682,7 +681,7 @@ AtaNonBlockingCallBack (
|
||||
//
|
||||
// Reduce the SubEventCount, till it comes to zero.
|
||||
//
|
||||
(*Task->UnsignalledEventCount) --;
|
||||
(*Task->UnsignalledEventCount)--;
|
||||
DEBUG ((DEBUG_BLKIO, "UnsignalledEventCount = %d\n", *Task->UnsignalledEventCount));
|
||||
|
||||
//
|
||||
@@ -702,7 +701,6 @@ AtaNonBlockingCallBack (
|
||||
FreePool (Task->UnsignalledEventCount);
|
||||
FreePool (Task->IsError);
|
||||
|
||||
|
||||
//
|
||||
// Finish all subtasks and move to the next task in AtaTaskList.
|
||||
//
|
||||
@@ -723,6 +721,7 @@ AtaNonBlockingCallBack (
|
||||
AtaTask->Token->TransactionStatus = Status;
|
||||
gBS->SignalEvent (AtaTask->Token->Event);
|
||||
}
|
||||
|
||||
RemoveEntryList (Entry);
|
||||
FreePool (AtaTask);
|
||||
}
|
||||
@@ -763,27 +762,27 @@ AtaNonBlockingCallBack (
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
AccessAtaDevice(
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN NumberOfBlocks,
|
||||
IN BOOLEAN IsWrite,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
AccessAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN NumberOfBlocks,
|
||||
IN BOOLEAN IsWrite,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN MaxTransferBlockNumber;
|
||||
UINTN TransferBlockNumber;
|
||||
UINTN BlockSize;
|
||||
ATA_BUS_ASYN_SUB_TASK *SubTask;
|
||||
UINTN *EventCount;
|
||||
UINTN TempCount;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
EFI_EVENT SubEvent;
|
||||
UINTN Index;
|
||||
BOOLEAN *IsError;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
UINTN MaxTransferBlockNumber;
|
||||
UINTN TransferBlockNumber;
|
||||
UINTN BlockSize;
|
||||
ATA_BUS_ASYN_SUB_TASK *SubTask;
|
||||
UINTN *EventCount;
|
||||
UINTN TempCount;
|
||||
ATA_BUS_ASYN_TASK *AtaTask;
|
||||
EFI_EVENT SubEvent;
|
||||
UINTN Index;
|
||||
BOOLEAN *IsError;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
TempCount = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
@@ -797,7 +796,7 @@ AccessAtaDevice(
|
||||
//
|
||||
// Ensure AtaDevice->Lba48Bit is a valid boolean value
|
||||
//
|
||||
ASSERT ((UINTN) AtaDevice->Lba48Bit < 2);
|
||||
ASSERT ((UINTN)AtaDevice->Lba48Bit < 2);
|
||||
MaxTransferBlockNumber = mMaxTransferBlockNumber[AtaDevice->Lba48Bit];
|
||||
BlockSize = AtaDevice->BlockMedia.BlockSize;
|
||||
|
||||
@@ -813,6 +812,7 @@ AccessAtaDevice(
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
AtaTask->AtaDevice = AtaDevice;
|
||||
AtaTask->Buffer = Buffer;
|
||||
AtaTask->IsWrite = IsWrite;
|
||||
@@ -825,10 +825,11 @@ AccessAtaDevice(
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
Token->TransactionStatus = EFI_SUCCESS;
|
||||
EventCount = AllocateZeroPool (sizeof (UINTN));
|
||||
EventCount = AllocateZeroPool (sizeof (UINTN));
|
||||
if (EventCount == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -838,8 +839,9 @@ AccessAtaDevice(
|
||||
FreePool (EventCount);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_BLKIO, "Allocation IsError Addr=%x\n", IsError));
|
||||
*IsError = FALSE;
|
||||
*IsError = FALSE;
|
||||
TempCount = (NumberOfBlocks + MaxTransferBlockNumber - 1) / MaxTransferBlockNumber;
|
||||
*EventCount = TempCount;
|
||||
DEBUG ((DEBUG_BLKIO, "AccessAtaDevice, NumberOfBlocks=%x\n", NumberOfBlocks));
|
||||
@@ -858,7 +860,7 @@ AccessAtaDevice(
|
||||
if (NumberOfBlocks > MaxTransferBlockNumber) {
|
||||
TransferBlockNumber = MaxTransferBlockNumber;
|
||||
NumberOfBlocks -= MaxTransferBlockNumber;
|
||||
} else {
|
||||
} else {
|
||||
TransferBlockNumber = NumberOfBlocks;
|
||||
NumberOfBlocks = 0;
|
||||
}
|
||||
@@ -876,7 +878,7 @@ AccessAtaDevice(
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
SubTask->UnsignalledEventCount = EventCount;
|
||||
SubTask->Signature = ATA_SUB_TASK_SIGNATURE;
|
||||
SubTask->AtaDevice = AtaDevice;
|
||||
@@ -901,13 +903,13 @@ AccessAtaDevice(
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
Status = TransferAtaDevice (AtaDevice, &SubTask->Packet, Buffer, StartLba, (UINT32) TransferBlockNumber, IsWrite, SubEvent);
|
||||
Status = TransferAtaDevice (AtaDevice, &SubTask->Packet, Buffer, StartLba, (UINT32)TransferBlockNumber, IsWrite, SubEvent);
|
||||
} else {
|
||||
//
|
||||
// Blocking Mode.
|
||||
//
|
||||
DEBUG ((DEBUG_BLKIO, "Blocking AccessAtaDevice, TransferBlockNumber=%x; StartLba = %x\n", TransferBlockNumber, StartLba));
|
||||
Status = TransferAtaDevice (AtaDevice, NULL, Buffer, StartLba, (UINT32) TransferBlockNumber, IsWrite, NULL);
|
||||
Status = TransferAtaDevice (AtaDevice, NULL, Buffer, StartLba, (UINT32)TransferBlockNumber, IsWrite, NULL);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -925,10 +927,10 @@ EXIT:
|
||||
// Release resource at non-blocking mode.
|
||||
//
|
||||
if (EFI_ERROR (Status)) {
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
Token->TransactionStatus = Status;
|
||||
*EventCount = (*EventCount) - (TempCount - Index);
|
||||
*IsError = TRUE;
|
||||
*EventCount = (*EventCount) - (TempCount - Index);
|
||||
*IsError = TRUE;
|
||||
|
||||
if (*EventCount == 0) {
|
||||
FreePool (EventCount);
|
||||
@@ -943,6 +945,7 @@ EXIT:
|
||||
if (SubEvent != NULL) {
|
||||
gBS->CloseEvent (SubEvent);
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
}
|
||||
@@ -982,14 +985,14 @@ EXIT:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TrustTransferAtaDevice (
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN TransferLength,
|
||||
IN BOOLEAN IsTrustSend,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINTN *TransferLengthOut
|
||||
IN OUT ATA_DEVICE *AtaDevice,
|
||||
IN OUT VOID *Buffer,
|
||||
IN UINT8 SecurityProtocolId,
|
||||
IN UINT16 SecurityProtocolSpecificData,
|
||||
IN UINTN TransferLength,
|
||||
IN BOOLEAN IsTrustSend,
|
||||
IN UINT64 Timeout,
|
||||
OUT UINTN *TransferLengthOut
|
||||
)
|
||||
{
|
||||
EFI_ATA_COMMAND_BLOCK *Acb;
|
||||
@@ -1001,27 +1004,28 @@ TrustTransferAtaDevice (
|
||||
//
|
||||
// Ensure AtaDevice->UdmaValid and IsTrustSend are valid boolean values
|
||||
//
|
||||
ASSERT ((UINTN) AtaDevice->UdmaValid < 2);
|
||||
ASSERT ((UINTN) IsTrustSend < 2);
|
||||
ASSERT ((UINTN)AtaDevice->UdmaValid < 2);
|
||||
ASSERT ((UINTN)IsTrustSend < 2);
|
||||
//
|
||||
// Prepare for ATA command block.
|
||||
//
|
||||
Acb = ZeroMem (&AtaDevice->Acb, sizeof (EFI_ATA_COMMAND_BLOCK));
|
||||
if (TransferLength == 0) {
|
||||
Acb->AtaCommand = ATA_CMD_TRUST_NON_DATA;
|
||||
Acb->AtaCommand = ATA_CMD_TRUST_NON_DATA;
|
||||
} else {
|
||||
Acb->AtaCommand = mAtaTrustCommands[AtaDevice->UdmaValid][IsTrustSend];
|
||||
Acb->AtaCommand = mAtaTrustCommands[AtaDevice->UdmaValid][IsTrustSend];
|
||||
}
|
||||
Acb->AtaFeatures = SecurityProtocolId;
|
||||
Acb->AtaSectorCount = (UINT8) (TransferLength / 512);
|
||||
Acb->AtaSectorNumber = (UINT8) ((TransferLength / 512) >> 8);
|
||||
|
||||
Acb->AtaFeatures = SecurityProtocolId;
|
||||
Acb->AtaSectorCount = (UINT8)(TransferLength / 512);
|
||||
Acb->AtaSectorNumber = (UINT8)((TransferLength / 512) >> 8);
|
||||
//
|
||||
// NOTE: ATA Spec has no explicitly definition for Security Protocol Specific layout.
|
||||
// Here use big endian for Cylinder register.
|
||||
//
|
||||
Acb->AtaCylinderHigh = (UINT8) SecurityProtocolSpecificData;
|
||||
Acb->AtaCylinderLow = (UINT8) (SecurityProtocolSpecificData >> 8);
|
||||
Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));
|
||||
Acb->AtaCylinderHigh = (UINT8)SecurityProtocolSpecificData;
|
||||
Acb->AtaCylinderLow = (UINT8)(SecurityProtocolSpecificData >> 8);
|
||||
Acb->AtaDeviceHead = (UINT8)(BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));
|
||||
|
||||
//
|
||||
// Prepare for ATA pass through packet.
|
||||
@@ -1030,7 +1034,7 @@ TrustTransferAtaDevice (
|
||||
if (TransferLength == 0) {
|
||||
Packet->InTransferLength = 0;
|
||||
Packet->OutTransferLength = 0;
|
||||
Packet->Protocol = EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA;
|
||||
Packet->Protocol = EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA;
|
||||
} else if (IsTrustSend) {
|
||||
//
|
||||
// Check the alignment of the incoming buffer prior to invoking underlying ATA PassThru
|
||||
@@ -1046,22 +1050,25 @@ TrustTransferAtaDevice (
|
||||
FreePool (Buffer);
|
||||
Buffer = NewBuffer;
|
||||
}
|
||||
Packet->OutDataBuffer = Buffer;
|
||||
Packet->OutTransferLength = (UINT32) TransferLength;
|
||||
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsTrustSend];
|
||||
|
||||
Packet->OutDataBuffer = Buffer;
|
||||
Packet->OutTransferLength = (UINT32)TransferLength;
|
||||
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsTrustSend];
|
||||
} else {
|
||||
Packet->InDataBuffer = Buffer;
|
||||
Packet->InTransferLength = (UINT32) TransferLength;
|
||||
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsTrustSend];
|
||||
Packet->InDataBuffer = Buffer;
|
||||
Packet->InTransferLength = (UINT32)TransferLength;
|
||||
Packet->Protocol = mAtaPassThruCmdProtocols[AtaDevice->UdmaValid][IsTrustSend];
|
||||
}
|
||||
Packet->Length = EFI_ATA_PASS_THRU_LENGTH_BYTES;
|
||||
Packet->Timeout = Timeout;
|
||||
|
||||
Packet->Length = EFI_ATA_PASS_THRU_LENGTH_BYTES;
|
||||
Packet->Timeout = Timeout;
|
||||
|
||||
Status = AtaDevicePassThru (AtaDevice, NULL, NULL);
|
||||
if (TransferLengthOut != NULL) {
|
||||
if (! IsTrustSend) {
|
||||
if (!IsTrustSend) {
|
||||
*TransferLengthOut = Packet->InTransferLength;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@@ -11,20 +11,19 @@
|
||||
//
|
||||
// Driver name table
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaBusDriverNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaBusDriverNameTable[] = {
|
||||
{ "eng;en", L"ATA Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
//
|
||||
// Controller name table
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaBusControllerNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mAtaBusControllerNameTable[] = {
|
||||
{ "eng;en", L"ATA Controller" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
@@ -37,9 +36,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) AtaBusComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) AtaBusComponentNameGetControllerName,
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)AtaBusComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)AtaBusComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
@@ -99,7 +98,6 @@ AtaBusComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -171,11 +169,11 @@ AtaBusComponentNameGetDriverName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtaBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -205,13 +203,14 @@ AtaBusComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the child context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlockIo,
|
||||
(VOID **)&BlockIo,
|
||||
gAtaBusDriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -219,9 +218,11 @@ AtaBusComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
|
||||
ControllerNameTable =AtaDevice->ControllerNameTable;
|
||||
|
||||
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
|
||||
ControllerNameTable = AtaDevice->ControllerNameTable;
|
||||
}
|
||||
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
|
Reference in New Issue
Block a user