Skip to content

Commit

Permalink
SecurityPkg Tcg: Use SW SMI IO port PCD in Tpm.asl
Browse files Browse the repository at this point in the history
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2416

Replaces the hardcoded value of 0xB2 with a PCD for the SMI port access
operation region. This allows platforms to customize the IO port value if
necessary.

Cc: Kun Qin <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Chao Zhang <[email protected]>
Signed-off-by: Michael Kubacki <[email protected]>
Reviewed-by: Guomin Jiang <[email protected]>
Reviewed-by: Bret Barkelew <[email protected]>
  • Loading branch information
makubacki authored and mergify[bot] committed Apr 21, 2020
1 parent cda6f94 commit 6e3c834
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
4 changes: 4 additions & 0 deletions SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# This external input must be validated carefully to avoid security issue.
#
# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
Expand Down Expand Up @@ -70,6 +71,9 @@
gEfiSmmVariableProtocolGuid ## CONSUMES
gEfiAcpiTableProtocolGuid ## CONSUMES

[FixedPcd]
gEfiSecurityPkgTokenSpaceGuid.PcdSmiCommandIoPort ## CONSUMES

[Pcd]
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId ## SOMETIMES_CONSUMES
Expand Down
18 changes: 9 additions & 9 deletions SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
(c)Copyright 2016 HP Development Company, L.P.<BR>
Copyright (c) 2017, Microsoft Corporation. All rights reserved. <BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down Expand Up @@ -41,10 +41,10 @@ DefinitionBlock (
//
// Operational region for Smi port access
//
OperationRegion (SMIP, SystemIO, 0xB2, 1)
OperationRegion (SMIP, SystemIO, FixedPcdGet16 (PcdSmiCommandIoPort), 1)
Field (SMIP, ByteAcc, NoLock, Preserve)
{
IOB2, 8
IOPN, 8
}

//
Expand Down Expand Up @@ -258,7 +258,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (MCIN, IOB2)
Store (MCIN, IOPN)
}
}
Return (0)
Expand Down Expand Up @@ -359,7 +359,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)
Return (FRET)


Expand Down Expand Up @@ -390,7 +390,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)

Store (LPPR, Index (TPM3, 0x01))
Store (PPRP, Index (TPM3, 0x02))
Expand Down Expand Up @@ -422,7 +422,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)
Return (FRET)
}
Case (8)
Expand All @@ -436,7 +436,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)

Return (FRET)
}
Expand Down Expand Up @@ -475,7 +475,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (MCIN, IOB2)
Store (MCIN, IOPN)
Return (MRET)
}
Default {BreakPoint}
Expand Down
4 changes: 4 additions & 0 deletions SecurityPkg/Tcg/TcgSmm/TcgSmm.inf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# This external input must be validated carefully to avoid security issue.
#
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
Expand Down Expand Up @@ -63,6 +64,9 @@
gEfiSmmVariableProtocolGuid ## CONSUMES
gEfiAcpiTableProtocolGuid ## CONSUMES

[FixedPcd]
gEfiSecurityPkgTokenSpaceGuid.PcdSmiCommandIoPort ## CONSUMES

[Pcd]
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId ## SOMETIMES_CONSUMES
Expand Down
17 changes: 9 additions & 8 deletions SecurityPkg/Tcg/TcgSmm/Tpm.asl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
and MemoryClear.
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down Expand Up @@ -41,10 +42,10 @@ DefinitionBlock (
//
// Operational region for Smi port access
//
OperationRegion (SMIP, SystemIO, 0xB2, 1)
OperationRegion (SMIP, SystemIO, FixedPcdGet16 (PcdSmiCommandIoPort), 1)
Field (SMIP, ByteAcc, NoLock, Preserve)
{
IOB2, 8
IOPN, 8
}

//
Expand Down Expand Up @@ -96,7 +97,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (MCIN, IOB2)
Store (MCIN, IOPN)
}
}
Return (0)
Expand Down Expand Up @@ -196,7 +197,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)
Return (FRET)


Expand Down Expand Up @@ -227,7 +228,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)

Store (LPPR, Index (TPM3, 0x01))
Store (PPRP, Index (TPM3, 0x02))
Expand Down Expand Up @@ -255,7 +256,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)
Return (FRET)
}
Case (8)
Expand All @@ -269,7 +270,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (PPIN, IOB2)
Store (PPIN, IOPN)

Return (FRET)
}
Expand Down Expand Up @@ -308,7 +309,7 @@ DefinitionBlock (
//
// Trigger the SMI interrupt
//
Store (MCIN, IOB2)
Store (MCIN, IOPN)
Return (MRET)
}
Default {BreakPoint}
Expand Down

0 comments on commit 6e3c834

Please sign in to comment.