diff mbox series

[edk2,edk2-platforms,v1,35/38] Silicon/Hisilicon/Setup: Support SPCR table switch

Message ID 20180724070922.63362-36-ming.huang@linaro.org
State Superseded
Headers show
Series Upload for D06 platform | expand

Commit Message

Ming Huang July 24, 2018, 7:09 a.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. 4, 2018, 3:20 p.m. UTC | #1
On Tue, Jul 24, 2018 at 03:09:19PM +0800, Ming Huang wrote:
> If install SPCR table, KVM will not output while install or boot

> some OS, like ubuntu,


Will not output?
Do you mean it disables the graphical output of the OS?

/
    Leif

> 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(+)

> 

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

> index e268a56bbd..c32fe42d60 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. 9, 2018, 2:17 p.m. UTC | #2
在 8/4/2018 11:20 PM, Leif Lindholm 写道:
> On Tue, Jul 24, 2018 at 03:09:19PM +0800, Ming Huang wrote:
>> If install SPCR table, KVM will not output while install or boot
>> some OS, like ubuntu,
> 
> Will not output?
> Do you mean it disables the graphical output of the OS?

Yes, the behaviour of OS is like description above.
I guess some OS select serial for output and disable
graphical output when SPCR is installed.

Thanks.

> 
> /
>     Leif
> 
>> 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(+)
>>
>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
>> index e268a56bbd..c32fe42d60 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
>>
Leif Lindholm Aug. 9, 2018, 2:44 p.m. UTC | #3
On Thu, Aug 09, 2018 at 10:17:43PM +0800, Ming wrote:
> 
> 
> 在 8/4/2018 11:20 PM, Leif Lindholm 写道:
> > On Tue, Jul 24, 2018 at 03:09:19PM +0800, Ming Huang wrote:
> >> If install SPCR table, KVM will not output while install or boot
> >> some OS, like ubuntu,
> > 
> > Will not output?
> > Do you mean it disables the graphical output of the OS?
> 
> Yes, the behaviour of OS is like description above.
> I guess some OS select serial for output and disable
> graphical output when SPCR is installed.

OK. Then I'm OK with the idea. But we already have
EmbeddedPkg/Drivers/ConsolePrefDxe to do the same thing, via HII form
instead of magic values in environment variables.
Can you use that instead?

/
    Leif

> > /
> >     Leif
> > 
> >> 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(+)
> >>
> >> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
> >> index e268a56bbd..c32fe42d60 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
> >>
Ming Huang Aug. 9, 2018, 3:40 p.m. UTC | #4
在 8/9/2018 10:44 PM, Leif Lindholm 写道:
> On Thu, Aug 09, 2018 at 10:17:43PM +0800, Ming wrote:
>>
>>
>> 在 8/4/2018 11:20 PM, Leif Lindholm 写道:
>>> On Tue, Jul 24, 2018 at 03:09:19PM +0800, Ming Huang wrote:
>>>> If install SPCR table, KVM will not output while install or boot
>>>> some OS, like ubuntu,
>>>
>>> Will not output?
>>> Do you mean it disables the graphical output of the OS?
>>
>> Yes, the behaviour of OS is like description above.
>> I guess some OS select serial for output and disable
>> graphical output when SPCR is installed.
> 
> OK. Then I'm OK with the idea. But we already have
> EmbeddedPkg/Drivers/ConsolePrefDxe to do the same thing, via HII form
> instead of magic values in environment variables.
> Can you use that instead?

Can ConsolePreDxe provide a setup item for selecting by user?
Do you suggest this patch is not need and add ConsolePrefDxe to dsc/fdf?

> 
> /
>     Leif
> 
>>> /
>>>     Leif
>>>
>>>> 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(+)
>>>>
>>>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
>>>> index e268a56bbd..c32fe42d60 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
>>>>
Leif Lindholm Aug. 9, 2018, 3:48 p.m. UTC | #5
On Thu, Aug 09, 2018 at 11:40:12PM +0800, Ming wrote:
> 
> 
> 在 8/9/2018 10:44 PM, Leif Lindholm 写道:
> > On Thu, Aug 09, 2018 at 10:17:43PM +0800, Ming wrote:
> >>
> >>
> >> 在 8/4/2018 11:20 PM, Leif Lindholm 写道:
> >>> On Tue, Jul 24, 2018 at 03:09:19PM +0800, Ming Huang wrote:
> >>>> If install SPCR table, KVM will not output while install or boot
> >>>> some OS, like ubuntu,
> >>>
> >>> Will not output?
> >>> Do you mean it disables the graphical output of the OS?
> >>
> >> Yes, the behaviour of OS is like description above.
> >> I guess some OS select serial for output and disable
> >> graphical output when SPCR is installed.
> > 
> > OK. Then I'm OK with the idea. But we already have
> > EmbeddedPkg/Drivers/ConsolePrefDxe to do the same thing, via HII form
> > instead of magic values in environment variables.
> > Can you use that instead?
> 
> Can ConsolePreDxe provide a setup item for selecting by user?

That is exactly what it does.

> Do you suggest this patch is not need and add ConsolePrefDxe to dsc/fdf?

Yes. Look at Platforms/AMD/OverdriveBoard for an example.

/
    Leif

> > 
> > /
> >     Leif
> > 
> >>> /
> >>>     Leif
> >>>
> >>>> 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(+)
> >>>>
> >>>> diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf
> >>>> index e268a56bbd..c32fe42d60 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 e268a56bbd..c32fe42d60 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;
 }