diff mbox series

[edk2,edk2-platforms,v3,32/36] Silicon/Hisilicon/Setup: Support SPCR table switch

Message ID 20180816121239.44129-33-ming.huang@linaro.org
State New
Headers show
Series Upload for D06 platform | expand

Commit Message

Ming Huang Aug. 16, 2018, 12:12 p.m. UTC
If install SPCR table, KVM will not output while install or boot
some OS, like ubuntu, so add SPCR switch setup item and set it
disable by default.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>

Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

---
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c   | 24 ++++++++++++++++++++
 2 files changed, 25 insertions(+)

-- 
2.17.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Aug. 21, 2018, 9:11 p.m. UTC | #1
On Thu, Aug 16, 2018 at 08:12:35PM +0800, Ming Huang wrote:
> If install SPCR table, KVM will not output while install or boot

> some OS, like ubuntu, so add SPCR switch setup item and set it

> disable by default.


This one was supposed to be replaced with
EmbeddedPkg/Drivers/ConsolePrefDxe, right?

/
    Leif

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ming Huang <ming.huang@linaro.org>

> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

> ---

>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +

>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c   | 24 ++++++++++++++++++++

>  2 files changed, 25 insertions(+)

> 

> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> index 281a4f2ebd..3d133aff85 100644

> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> @@ -51,6 +51,7 @@

>  

>  [Guids]

>    gHisiEfiMemoryMapGuid

> +  gOemConfigGuid

>  

>  [Pcd]

>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES

> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> index 54f49977c3..32878ca4f9 100644

> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> @@ -16,8 +16,10 @@

>  #include <Library/DebugLib.h>

>  #include <Library/HobLib.h>

>  #include <Library/HwMemInitLib.h>

> +#include <Library/OemConfigData.h>

>  #include <Library/OemMiscLib.h>

>  #include <Library/UefiBootServicesTableLib.h>

> +#include <Library/UefiRuntimeServicesTableLib.h>

>  #include <Library/UefiLib.h>

>  

>  #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)

> @@ -114,6 +116,25 @@ UpdateSlit (

>    return  EFI_SUCCESS;

>  }

>  

> +STATIC

> +EFI_STATUS

> +IsNeedSpcr (

> +  IN OUT EFI_ACPI_DESCRIPTION_HEADER  *Table

> +  )

> +{

> +  EFI_STATUS                     Status;

> +  OEM_CONFIG_DATA                SetupData;

> +  UINTN                          DataSize = sizeof (OEM_CONFIG_DATA);

> +

> +  Status = gRT->GetVariable (OEM_CONFIG_NAME, &gOemConfigGuid, NULL, &DataSize, &SetupData);

> +  if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) {

> +    return EFI_ABORTED;

> +  }

> +

> +  return EFI_SUCCESS;

> +}

> +

> +

>  EFI_STATUS

>  UpdateAcpiTable (

>    IN OUT EFI_ACPI_DESCRIPTION_HEADER      *TableHeader

> @@ -130,6 +151,9 @@ UpdateAcpiTable (

>    case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:

>      Status = UpdateSlit (TableHeader);

>      break;

> +  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:

> +    Status = IsNeedSpcr (TableHeader);

> +    break;

>    }

>    return Status;

>  }

> -- 

> 2.17.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ming Huang Aug. 23, 2018, 10:50 a.m. UTC | #2
Hi Leif,

Is it ok replace with ConsolePrefDxe after ERP 18.08?


On 8/22/2018 10:49 AM, Ming wrote:
> 

> 

> On 8/22/2018 5:11 AM, Leif Lindholm wrote:

>> On Thu, Aug 16, 2018 at 08:12:35PM +0800, Ming Huang wrote:

>>> If install SPCR table, KVM will not output while install or boot

>>> some OS, like ubuntu, so add SPCR switch setup item and set it

>>> disable by default.

>>

>> This one was supposed to be replaced with

>> EmbeddedPkg/Drivers/ConsolePrefDxe, right?

> 

> Yes, I will take a look ConsolePrefDxe and replace with it after ERP 18.08.

> 

>>

>> /

>>     Leif

>>

>>> Contributed-under: TianoCore Contribution Agreement 1.1

>>> Signed-off-by: Ming Huang <ming.huang@linaro.org>

>>> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

>>> ---

>>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +

>>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c   | 24 ++++++++++++++++++++

>>>  2 files changed, 25 insertions(+)

>>>

>>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>>> index 281a4f2ebd..3d133aff85 100644

>>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

>>> @@ -51,6 +51,7 @@

>>>  

>>>  [Guids]

>>>    gHisiEfiMemoryMapGuid

>>> +  gOemConfigGuid

>>>  

>>>  [Pcd]

>>>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES

>>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

>>> index 54f49977c3..32878ca4f9 100644

>>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

>>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

>>> @@ -16,8 +16,10 @@

>>>  #include <Library/DebugLib.h>

>>>  #include <Library/HobLib.h>

>>>  #include <Library/HwMemInitLib.h>

>>> +#include <Library/OemConfigData.h>

>>>  #include <Library/OemMiscLib.h>

>>>  #include <Library/UefiBootServicesTableLib.h>

>>> +#include <Library/UefiRuntimeServicesTableLib.h>

>>>  #include <Library/UefiLib.h>

>>>  

>>>  #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)

>>> @@ -114,6 +116,25 @@ UpdateSlit (

>>>    return  EFI_SUCCESS;

>>>  }

>>>  

>>> +STATIC

>>> +EFI_STATUS

>>> +IsNeedSpcr (

>>> +  IN OUT EFI_ACPI_DESCRIPTION_HEADER  *Table

>>> +  )

>>> +{

>>> +  EFI_STATUS                     Status;

>>> +  OEM_CONFIG_DATA                SetupData;

>>> +  UINTN                          DataSize = sizeof (OEM_CONFIG_DATA);

>>> +

>>> +  Status = gRT->GetVariable (OEM_CONFIG_NAME, &gOemConfigGuid, NULL, &DataSize, &SetupData);

>>> +  if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) {

>>> +    return EFI_ABORTED;

>>> +  }

>>> +

>>> +  return EFI_SUCCESS;

>>> +}

>>> +

>>> +

>>>  EFI_STATUS

>>>  UpdateAcpiTable (

>>>    IN OUT EFI_ACPI_DESCRIPTION_HEADER      *TableHeader

>>> @@ -130,6 +151,9 @@ UpdateAcpiTable (

>>>    case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:

>>>      Status = UpdateSlit (TableHeader);

>>>      break;

>>> +  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:

>>> +    Status = IsNeedSpcr (TableHeader);

>>> +    break;

>>>    }

>>>    return Status;

>>>  }

>>> -- 

>>> 2.17.0

>>>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Aug. 23, 2018, 11:12 a.m. UTC | #3
I don't see how it would be less risky to include new code rather than
using the existing and well-tested solution for the same problem.

On Thu, 23 Aug 2018, 11:51 Ming, <ming.huang@linaro.org> wrote:

> Hi Leif,

>

> Is it ok replace with ConsolePrefDxe after ERP 18.08?

>

>

> On 8/22/2018 10:49 AM, Ming wrote:

> >

> >

> > On 8/22/2018 5:11 AM, Leif Lindholm wrote:

> >> On Thu, Aug 16, 2018 at 08:12:35PM +0800, Ming Huang wrote:

> >>> If install SPCR table, KVM will not output while install or boot

> >>> some OS, like ubuntu, so add SPCR switch setup item and set it

> >>> disable by default.

> >>

> >> This one was supposed to be replaced with

> >> EmbeddedPkg/Drivers/ConsolePrefDxe, right?

> >

> > Yes, I will take a look ConsolePrefDxe and replace with it after ERP

> 18.08.

> >

> >>

> >> /

> >>     Leif

> >>

> >>> Contributed-under: TianoCore Contribution Agreement 1.1

> >>> Signed-off-by: Ming Huang <ming.huang@linaro.org>

> >>> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

> >>> ---

> >>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf |

> 1 +

> >>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c   |

> 24 ++++++++++++++++++++

> >>>  2 files changed, 25 insertions(+)

> >>>

> >>> diff --git

> a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> >>> index 281a4f2ebd..3d133aff85 100644

> >>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> >>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf

> >>> @@ -51,6 +51,7 @@

> >>>

> >>>  [Guids]

> >>>    gHisiEfiMemoryMapGuid

> >>> +  gOemConfigGuid

> >>>

> >>>  [Pcd]

> >>>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ##

> CONSUMES

> >>> diff --git

> a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> >>> index 54f49977c3..32878ca4f9 100644

> >>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> >>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c

> >>> @@ -16,8 +16,10 @@

> >>>  #include <Library/DebugLib.h>

> >>>  #include <Library/HobLib.h>

> >>>  #include <Library/HwMemInitLib.h>

> >>> +#include <Library/OemConfigData.h>

> >>>  #include <Library/OemMiscLib.h>

> >>>  #include <Library/UefiBootServicesTableLib.h>

> >>> +#include <Library/UefiRuntimeServicesTableLib.h>

> >>>  #include <Library/UefiLib.h>

> >>>

> >>>  #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)

> >>> @@ -114,6 +116,25 @@ UpdateSlit (

> >>>    return  EFI_SUCCESS;

> >>>  }

> >>>

> >>> +STATIC

> >>> +EFI_STATUS

> >>> +IsNeedSpcr (

> >>> +  IN OUT EFI_ACPI_DESCRIPTION_HEADER  *Table

> >>> +  )

> >>> +{

> >>> +  EFI_STATUS                     Status;

> >>> +  OEM_CONFIG_DATA                SetupData;

> >>> +  UINTN                          DataSize = sizeof (OEM_CONFIG_DATA);

> >>> +

> >>> +  Status = gRT->GetVariable (OEM_CONFIG_NAME, &gOemConfigGuid, NULL,

> &DataSize, &SetupData);

> >>> +  if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) {

> >>> +    return EFI_ABORTED;

> >>> +  }

> >>> +

> >>> +  return EFI_SUCCESS;

> >>> +}

> >>> +

> >>> +

> >>>  EFI_STATUS

> >>>  UpdateAcpiTable (

> >>>    IN OUT EFI_ACPI_DESCRIPTION_HEADER      *TableHeader

> >>> @@ -130,6 +151,9 @@ UpdateAcpiTable (

> >>>    case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:

> >>>      Status = UpdateSlit (TableHeader);

> >>>      break;

> >>> +  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:

> >>> +    Status = IsNeedSpcr (TableHeader);

> >>> +    break;

> >>>    }

> >>>    return Status;

> >>>  }

> >>> --

> >>> 2.17.0

> >>>

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ming Huang Aug. 23, 2018, 11:58 a.m. UTC | #4
On 8/23/2018 7:12 PM, Leif Lindholm wrote:
> I don't see how it would be less risky to include new code rather than using the existing and well-tested solution for the same problem.

OK, replace with ConsolePrefDxe in v4.

> 
> On Thu, 23 Aug 2018, 11:51 Ming, <ming.huang@linaro.org <mailto:ming.huang@linaro.org>> wrote:
> 
>     Hi Leif,
> 
>     Is it ok replace with ConsolePrefDxe after ERP 18.08?
> 
> 
>     On 8/22/2018 10:49 AM, Ming wrote:
>     >
>     >
>     > On 8/22/2018 5:11 AM, Leif Lindholm wrote:
>     >> On Thu, Aug 16, 2018 at 08:12:35PM +0800, Ming Huang wrote:
>     >>> If install SPCR table, KVM will not output while install or boot
>     >>> some OS, like ubuntu, so add SPCR switch setup item and set it
>     >>> disable by default.
>     >>
>     >> This one was supposed to be replaced with
>     >> EmbeddedPkg/Drivers/ConsolePrefDxe, right?
>     >
>     > Yes, I will take a look ConsolePrefDxe and replace with it after ERP 18.08.
>     >
>     >>
>     >> /
>     >>     Leif
>     >>
>     >>> Contributed-under: TianoCore Contribution Agreement 1.1
>     >>> Signed-off-by: Ming Huang <ming.huang@linaro.org <mailto:ming.huang@linaro.org>>
>     >>> Signed-off-by: Heyi Guo <heyi.guo@linaro.org <mailto:heyi.guo@linaro.org>>
>     >>> ---
>     >>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
>     >>>  Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c   | 24 ++++++++++++++++++++
>     >>>  2 files changed, 25 insertions(+)
>     >>>
>     >>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
>     >>> index 281a4f2ebd..3d133aff85 100644
>     >>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
>     >>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
>     >>> @@ -51,6 +51,7 @@
>     >>> 
>     >>>  [Guids]
>     >>>    gHisiEfiMemoryMapGuid
>     >>> +  gOemConfigGuid
>     >>> 
>     >>>  [Pcd]
>     >>>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES
>     >>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
>     >>> index 54f49977c3..32878ca4f9 100644
>     >>> --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
>     >>> +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
>     >>> @@ -16,8 +16,10 @@
>     >>>  #include <Library/DebugLib.h>
>     >>>  #include <Library/HobLib.h>
>     >>>  #include <Library/HwMemInitLib.h>
>     >>> +#include <Library/OemConfigData.h>
>     >>>  #include <Library/OemMiscLib.h>
>     >>>  #include <Library/UefiBootServicesTableLib.h>
>     >>> +#include <Library/UefiRuntimeServicesTableLib.h>
>     >>>  #include <Library/UefiLib.h>
>     >>> 
>     >>>  #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)
>     >>> @@ -114,6 +116,25 @@ UpdateSlit (
>     >>>    return  EFI_SUCCESS;
>     >>>  }
>     >>> 
>     >>> +STATIC
>     >>> +EFI_STATUS
>     >>> +IsNeedSpcr (
>     >>> +  IN OUT EFI_ACPI_DESCRIPTION_HEADER  *Table
>     >>> +  )
>     >>> +{
>     >>> +  EFI_STATUS                     Status;
>     >>> +  OEM_CONFIG_DATA                SetupData;
>     >>> +  UINTN                          DataSize = sizeof (OEM_CONFIG_DATA);
>     >>> +
>     >>> +  Status = gRT->GetVariable (OEM_CONFIG_NAME, &gOemConfigGuid, NULL, &DataSize, &SetupData);
>     >>> +  if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) {
>     >>> +    return EFI_ABORTED;
>     >>> +  }
>     >>> +
>     >>> +  return EFI_SUCCESS;
>     >>> +}
>     >>> +
>     >>> +
>     >>>  EFI_STATUS
>     >>>  UpdateAcpiTable (
>     >>>    IN OUT EFI_ACPI_DESCRIPTION_HEADER      *TableHeader
>     >>> @@ -130,6 +151,9 @@ UpdateAcpiTable (
>     >>>    case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:
>     >>>      Status = UpdateSlit (TableHeader);
>     >>>      break;
>     >>> +  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:
>     >>> +    Status = IsNeedSpcr (TableHeader);
>     >>> +    break;
>     >>>    }
>     >>>    return Status;
>     >>>  }
>     >>> --
>     >>> 2.17.0
>     >>>
>
diff mbox series

Patch

diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
index 281a4f2ebd..3d133aff85 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -51,6 +51,7 @@ 
 
 [Guids]
   gHisiEfiMemoryMapGuid
+  gOemConfigGuid
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES
diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
index 54f49977c3..32878ca4f9 100644
--- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
+++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
@@ -16,8 +16,10 @@ 
 #include <Library/DebugLib.h>
 #include <Library/HobLib.h>
 #include <Library/HwMemInitLib.h>
+#include <Library/OemConfigData.h>
 #include <Library/OemMiscLib.h>
 #include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/UefiLib.h>
 
 #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET)
@@ -114,6 +116,25 @@  UpdateSlit (
   return  EFI_SUCCESS;
 }
 
+STATIC
+EFI_STATUS
+IsNeedSpcr (
+  IN OUT EFI_ACPI_DESCRIPTION_HEADER  *Table
+  )
+{
+  EFI_STATUS                     Status;
+  OEM_CONFIG_DATA                SetupData;
+  UINTN                          DataSize = sizeof (OEM_CONFIG_DATA);
+
+  Status = gRT->GetVariable (OEM_CONFIG_NAME, &gOemConfigGuid, NULL, &DataSize, &SetupData);
+  if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) {
+    return EFI_ABORTED;
+  }
+
+  return EFI_SUCCESS;
+}
+
+
 EFI_STATUS
 UpdateAcpiTable (
   IN OUT EFI_ACPI_DESCRIPTION_HEADER      *TableHeader
@@ -130,6 +151,9 @@  UpdateAcpiTable (
   case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE:
     Status = UpdateSlit (TableHeader);
     break;
+  case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE:
+    Status = IsNeedSpcr (TableHeader);
+    break;
   }
   return Status;
 }