MdeModulePkg/AtaAtapiPassThru: enable/disable PUIS per policy

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Ruiyu Ni
2018-05-29 13:08:21 +08:00
parent f87a1e4158
commit 06766c0e19
4 changed files with 71 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
This file implements ATA_PASSTHRU_PROCTOCOL and EXT_SCSI_PASSTHRU_PROTOCOL interfaces
for managed ATA controllers.
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -142,6 +142,15 @@ UINT8 mScsiId[TARGET_MAX_BYTES] = {
0xFF, 0xFF, 0xFF, 0xFF
};
EDKII_ATA_ATAPI_POLICY_PROTOCOL *mAtaAtapiPolicy;
EDKII_ATA_ATAPI_POLICY_PROTOCOL mDefaultAtaAtapiPolicy = {
EDKII_ATA_ATAPI_POLICY_VERSION,
2, // PuisEnable
0, // DeviceSleepEnable
0, // AggressiveDeviceSleepEnable
0 // Reserved
};
/**
Sends an ATA command to an ATA device that is attached to the ATA controller. This function
supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,
@@ -739,6 +748,14 @@ AtaAtapiPassThruStart (
goto ErrorExit;
}
Status = gBS->LocateProtocol (&gEdkiiAtaAtapiPolicyProtocolGuid, NULL, (VOID **)&mAtaAtapiPolicy);
if (EFI_ERROR (Status)) {
//
// If there is no AtaAtapiPolicy exposed, use the default policy.
//
mAtaAtapiPolicy = &mDefaultAtaAtapiPolicy;
}
//
// Allocate a buffer to store the ATA_ATAPI_PASS_THRU_INSTANCE data structure
//