summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/IoMmuDxe
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2017-08-30 14:00:58 +0200
committerLaszlo Ersek <lersek@redhat.com>2017-09-01 14:20:40 +0200
commit2ad6ba80a1bd58382bde6b994070f7c01d2fb48d (patch)
tree827cf990c2de2f8a1abc9a361f008097441cb3c8 /OvmfPkg/IoMmuDxe
parentd8d33741e85cc074a5f665cdf25b5c324fed5bb8 (diff)
downloadedk2-2ad6ba80a1bd58382bde6b994070f7c01d2fb48d.tar.gz
edk2-2ad6ba80a1bd58382bde6b994070f7c01d2fb48d.tar.bz2
edk2-2ad6ba80a1bd58382bde6b994070f7c01d2fb48d.zip
OvmfPkg/IoMmuDxe: IoMmuMap(): log nicer and more informative DEBUG msgs
Log all relevant IN and IN OUT parameters on entry. When exiting with success, log all relevant OUT and IN OUT parameters. Don't log OUT and IN OUT parameters that are never set or changed after entering the function (i.e., *NumberOfBytes). Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Brijesh Singh <brijesh.singh@amd.com> Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Diffstat (limited to 'OvmfPkg/IoMmuDxe')
-rw-r--r--OvmfPkg/IoMmuDxe/AmdSevIoMmu.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
index ec625166f4..59cee95c0e 100644
--- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
+++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
@@ -45,6 +45,19 @@ STATIC LIST_ENTRY mRecycledMapInfos = INITIALIZE_LIST_HEAD_VARIABLE (
#define COMMON_BUFFER_SIG SIGNATURE_64 ('C', 'M', 'N', 'B', 'U', 'F', 'F', 'R')
//
+// ASCII names for EDKII_IOMMU_OPERATION constants, for debug logging.
+//
+STATIC CONST CHAR8 * CONST
+mBusMasterOperationName[EdkiiIoMmuOperationMaximum] = {
+ "Read",
+ "Write",
+ "CommonBuffer",
+ "Read64",
+ "Write64",
+ "CommonBuffer64"
+};
+
+//
// The following structure enables Map() and Unmap() to perform in-place
// decryption and encryption, respectively, for BusMasterCommonBuffer[64]
// operations, without dynamic memory allocation or release.
@@ -116,6 +129,18 @@ IoMmuMap (
COMMON_BUFFER_HEADER *CommonBufferHeader;
VOID *DecryptionSource;
+ DEBUG ((
+ DEBUG_VERBOSE,
+ "%a: Operation=%a Host=0x%p Bytes=0x%Lx\n",
+ __FUNCTION__,
+ ((Operation >= 0 &&
+ Operation < ARRAY_SIZE (mBusMasterOperationName)) ?
+ mBusMasterOperationName[Operation] :
+ "Invalid"),
+ HostAddress,
+ (UINT64)((NumberOfBytes == NULL) ? 0 : *NumberOfBytes)
+ ));
+
if (HostAddress == NULL || NumberOfBytes == NULL || DeviceAddress == NULL ||
Mapping == NULL) {
return EFI_INVALID_PARAMETER;
@@ -281,12 +306,12 @@ IoMmuMap (
DEBUG ((
DEBUG_VERBOSE,
- "%a PlainText 0x%Lx Crypted 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n",
+ "%a: Mapping=0x%p Device(PlainText)=0x%Lx Crypted=0x%Lx Pages=0x%Lx\n",
__FUNCTION__,
+ MapInfo,
MapInfo->PlainTextAddress,
MapInfo->CryptedAddress,
- (UINT64)MapInfo->NumberOfPages,
- (UINT64)MapInfo->NumberOfBytes
+ (UINT64)MapInfo->NumberOfPages
));
return EFI_SUCCESS;