summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authorZhiquan Li <zhiquan1.li@intel.com>2024-01-11 22:02:20 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-01-20 04:35:43 +0000
commitda228b29bdf5d52c029166b51538c9f1d76c88da (patch)
tree5a2842a683a3f99fc0d8afa0fe0b14c5c7197767 /MdePkg
parent5d016fe0a061647ed29562c9f161e454b0f7f9dd (diff)
downloadedk2-da228b29bdf5d52c029166b51538c9f1d76c88da.tar.gz
edk2-da228b29bdf5d52c029166b51538c9f1d76c88da.tar.bz2
edk2-da228b29bdf5d52c029166b51538c9f1d76c88da.zip
MdePkg/Library/BaseIoLibIntrinsic: Fix TD MMIO read type cast
Currently the types of casting mismatch with TD MMIO read 1, 2 and 4 bytes, that might introduce potential issues. So fix the types as conventional MmioRead[8|16|32] does. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
index ec837f5eb0..1acc3b3d96 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
@@ -237,7 +237,7 @@ TdMmioRead8 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_1, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT8 *)Address;
}
return (UINT8)Value;
@@ -294,7 +294,7 @@ TdMmioRead16 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_2, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT16 *)Address;
}
return (UINT16)Value;
@@ -353,7 +353,7 @@ TdMmioRead32 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_4, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT32 *)Address;
}
return (UINT32)Value;