From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.groups.io with SMTP id smtpd.web10.7656.1632488029923014569 for ; Fri, 24 Sep 2021 05:53:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20210112.gappssmtp.com header.s=20210112 header.b=cbJlHh4V; spf=pass (domain: nuviainc.com, ip: 209.85.221.41, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f41.google.com with SMTP id w29so27135235wra.8 for ; Fri, 24 Sep 2021 05:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9DgxdVkZgNEyeqpfyIusG3u5plcEnC5sjem1Y4vetaU=; b=cbJlHh4VU/rLvm41ZzvMhO40IUqGDgJeHD7kHGay5ANI7NIc3Ns+ro2vBcUQnGRqFT /2R+GLrLV1vBnBlTMPnsvvOhG+lVOFf2BUlMThkEgk4L8bFBYzA3v9QRJpRzWZKc5ocH NxShRigtA8zzAUqVZh6dV6wkarKq06p72fSh9Ndl5DYFXGOb0ybKeurUzGT2GL67WDP1 MbVOhM8d4u2pTelC/YcESHaJm6TEp0iKPQm0BdXvN5uBCMVnHQBLTkIg/ERNZTpDhThA 8H9Ce+yek9wTLTezAMG4DF0x9EJN4aIo3wHHF4vDiBN4ZXB1PTJlo08TWwlHcLSfVVhd cqGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9DgxdVkZgNEyeqpfyIusG3u5plcEnC5sjem1Y4vetaU=; b=pfysZY1Lvwk2geBThi0QEVsOYTCC8GPfmzDJdqkIWvexbg1F0PtEv63M0KVMuxZBsn N7mpyRkATLT+qA8cz3vZHNHNnOA92K0Cqg7O0hHDT2xdbbZkYBzcJi/S6dpkQAcTfct1 DY7T/EgmqY9whfg3i6LiniYYl0071eP5pAKWFIpvVS+VuTA8vt86rPOxuBk3qLVMepMS 6ef7kfnuCT2KQrNHjH/i33RI7r0DG23kKECDkJ7fPNd7rQ2AAhD7gYn1+SQt8yU4eDrV qs18ScNKyzFAMdZWEinDVxNhcAVGLIxk46uBi4cZW8i4H5/La21BPGvhiXOP9GwZsfMQ 4XeQ== X-Gm-Message-State: AOAM531YcyRYXTPc6yNZf1Zz592Rrh7k7gzajYIjPGsXohyve7N8Dg7O h4rI3K7qTkJzlsA8Zx1iukN7wg== X-Google-Smtp-Source: ABdhPJztzAlaj08ILmsNHz16spVpPI7SGXw657kp/SoR5fjOY+UVt42C4VarAefZr6yShcYkgcCqOw== X-Received: by 2002:a05:600c:4e8e:: with SMTP id f14mr1974304wmq.13.1632488028383; Fri, 24 Sep 2021 05:53:48 -0700 (PDT) Return-Path: Received: from leviathan (cpc92314-cmbg19-2-0-cust559.5-4.cable.virginm.net. [82.11.186.48]) by smtp.gmail.com with ESMTPSA id l21sm8254646wmh.31.2021.09.24.05.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 05:53:47 -0700 (PDT) Date: Fri, 24 Sep 2021 13:53:45 +0100 From: "Leif Lindholm" To: Nhi Pham Cc: devel@edk2.groups.io, patches@amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: Re: [PATCH v3 25/28] AmpereAltraPkg: Add configuration screen for ACPI Message-ID: <20210924125345.qyaf2ezpqi4otyw7@leviathan> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> <20210915155527.8176-26-nhi@os.amperecomputing.com> MIME-Version: 1.0 In-Reply-To: <20210915155527.8176-26-nhi@os.amperecomputing.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 15, 2021 at 22:55:24 +0700, Nhi Pham wrote: > This supports: > * Enable/Disable APEI Support > * Enable/Disable CPPC Support > * Enable/Disable LPI support > * Enable/Disable Max Performance Mode > > Cc: Thang Nguyen > Cc: Chuong Tran > Cc: Phong Vo > Cc: Leif Lindholm > Cc: Michael D Kinney > Cc: Ard Biesheuvel > Cc: Nate DeSimone > > Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm > --- > Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + > Platform/Ampere/JadePkg/Jade.dsc | 1 + > Platform/Ampere/JadePkg/Jade.fdf | 1 + > Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + > Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf | 58 ++ > Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h | 7 +- > Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h | 62 ++ > Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h | 28 + > Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h | 19 + > Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr | 69 ++ > Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c | 25 +- > Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c | 729 ++++++++++++++++++++ > Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni | 27 + > 13 files changed, 1026 insertions(+), 4 deletions(-) > > diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec > index 6ea247c75e87..196611d67280 100644 > --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec > +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec > @@ -53,6 +53,9 @@ [Guids] > # GUID for the CPU HII configuration form > gCpuConfigFormSetGuid = { 0x43FAA144, 0xA2DF, 0x4050, { 0xA7, 0xFD, 0xEE, 0x17, 0xC9, 0xB8, 0x88, 0x8E } } > > + # GUID for the ACPI HII configuration form > + gAcpiConfigFormSetGuid = { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } } > + > ## NVParam MM GUID > gNVParamMmGuid = { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } > > diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc > index 8ca3a729728f..daac52e84ea2 100644 > --- a/Platform/Ampere/JadePkg/Jade.dsc > +++ b/Platform/Ampere/JadePkg/Jade.dsc > @@ -199,3 +199,4 @@ [Components.common] > Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf > Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf > Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf > + Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf > diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf > index d9552886fbcf..1564e45c30cd 100644 > --- a/Platform/Ampere/JadePkg/Jade.fdf > +++ b/Platform/Ampere/JadePkg/Jade.fdf > @@ -357,5 +357,6 @@ [FV.FvMain] > INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf > INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf > INF Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf > + INF Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf > > !include Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc > diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf > index 2b2a3728a406..a2b3886a0236 100644 > --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf > +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf > @@ -66,6 +66,7 @@ [Guids] > gArmMpCoreInfoGuid > gEfiAcpiTableGuid > gEfiEventReadyToBootGuid > + gAcpiConfigFormSetGuid > gPlatformHobGuid > > [Protocols] > diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf > new file mode 100644 > index 000000000000..075183aa9c58 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf > @@ -0,0 +1,58 @@ > +## @file > +# > +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION = 0x0001001B > + BASE_NAME = AcpiConfigDxe > + FILE_GUID = F36685AE-2623-4231-ABC0-2C151451E6B7 > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + ENTRY_POINT = AcpiConfigEntryPoint > + > +[Sources.common] > + AcpiConfigDxe.c > + AcpiConfigDxe.h > + AcpiConfigVfr.vfr > + AcpiConfigStrings.uni > + > +[Packages] > + EmbeddedPkg/EmbeddedPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec > + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec > + > +[LibraryClasses] > + AcpiLib > + BaseLib > + BaseMemoryLib > + DebugLib > + DevicePathLib > + HiiLib > + HobLib > + MemoryAllocationLib > + SystemFirmwareInterfaceLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + UefiLib > + > +[Guids] > + gPlatformManagerFormsetGuid > + gAcpiConfigFormSetGuid > + gEfiEventReadyToBootGuid > + gPlatformHobGuid > + > +[Protocols] > + gEfiAcpiSdtProtocolGuid ## COMSUMES > + gEfiDevicePathProtocolGuid ## CONSUMES > + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES > + gEfiHiiConfigAccessProtocolGuid ## PRODUCES > + > +[Depex] > + gEfiVariableArchProtocolGuid AND > + gEfiVariableWriteArchProtocolGuid > diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h > index 2e763422cbc6..035912a1a331 100644 > --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h > +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h > @@ -9,7 +9,9 @@ > #ifndef ACPI_APEI_H_ > #define ACPI_APEI_H_ > > +#include > #include > +#include > #include > #include > #include > @@ -34,9 +36,10 @@ > #define PLAT_CRASH_ITERATOR_SIZE 0x398 > #define SMPRO_CRASH_SIZE 0x800 > #define PMPRO_CRASH_SIZE 0x800 > +#define RASIP_CRASH_SIZE 0x1000 > #define HEST_NUM_ENTRIES_PER_SOC 3 > > -#define CURRENT_BERT_VERSION 0x10 > +#define CURRENT_BERT_VERSION 0x11 > #define BERT_FLASH_OFFSET 0x91B30000ULL > #define BERT_DDR_OFFSET 0x88230000ULL > #define BERT_DDR_LENGTH 0x50000 > @@ -53,8 +56,10 @@ typedef struct { > UINT8 BertRev; > UINT8 S0PmproRegisters[PMPRO_CRASH_SIZE]; > UINT8 S0SmproRegisters[SMPRO_CRASH_SIZE]; > + UINT8 S0RasIpRegisters[RASIP_CRASH_SIZE]; > UINT8 S1PmproRegisters[PMPRO_CRASH_SIZE]; > UINT8 S1SmproRegisters[SMPRO_CRASH_SIZE]; > + UINT8 S1RasIpRegisters[RASIP_CRASH_SIZE]; > UINT8 AtfDump[PLATFORM_CPU_MAX_NUM_CORES * PLAT_CRASH_ITERATOR_SIZE]; > } APEI_CRASH_DUMP_DATA; > > diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h > new file mode 100644 > index 000000000000..8a2cc2f5e679 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h > @@ -0,0 +1,62 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef ACPI_CONFIG_DXE_H_ > +#define ACPI_CONFIG_DXE_H_ > + > +// > +// This is the generated IFR binary data for each formset defined in VFR. > +// > +extern UINT8 AcpiConfigVfrBin[]; > + > +// > +// This is the generated String package data for all .UNI files. > +// > +extern UINT8 AcpiConfigDxeStrings[]; > + > +// > +// Signature: Ampere Computing ACPI Configuration > +// > +#define ACPI_CONFIG_PRIVATE_SIGNATURE SIGNATURE_32 ('A', 'C', 'A', 'C') > + > +typedef struct { > + UINTN Signature; > + > + EFI_HANDLE DriverHandle; > + EFI_HII_HANDLE HiiHandle; > + ACPI_CONFIG_VARSTORE_DATA Configuration; > + PLATFORM_INFO_HOB *PlatformHob; > + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; > + EFI_ACPI_HANDLE AcpiTableHandle; > + > + // > + // Consumed protocol > + // > + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; > + > + // > + // Produced protocol > + // > + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; > +} ACPI_CONFIG_PRIVATE_DATA; > + > +#define ACPI_CONFIG_PRIVATE_FROM_THIS(a) CR (a, ACPI_CONFIG_PRIVATE_DATA, ConfigAccess, ACPI_CONFIG_PRIVATE_SIGNATURE) > + > +#pragma pack(1) > + > +/// > +/// HII specific Vendor Device Path definition. > +/// > +typedef struct { > + VENDOR_DEVICE_PATH VendorDevicePath; > + EFI_DEVICE_PATH_PROTOCOL End; > +} HII_VENDOR_DEVICE_PATH; > + > +#pragma pack() > + > +#endif > diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h b/Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h > new file mode 100644 > index 000000000000..a56bfa9aa694 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h > @@ -0,0 +1,28 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef ACPI_CONFIG_NV_DATA_STRUC_H_ > +#define ACPI_CONFIG_NV_DATA_STRUC_H_ > + > +#pragma pack(1) > + > +// > +// ACPI Configuration NV data structure definition > +// > +typedef struct { > + UINT32 EnableApeiSupport; > + UINT32 AcpiCppcEnable; > + UINT32 AcpiLpiEnable; > + UINT32 AcpiTurboSupport; > + UINT32 AcpiTurboMode; > + UINT32 Reserved[4]; > +} ACPI_CONFIG_VARSTORE_DATA; > + > +#pragma pack() > + > +#endif /* ACPI_CONFIG_NV_DATA_STRUC_H_ */ > diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h > new file mode 100644 > index 000000000000..1779a4543769 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h > @@ -0,0 +1,19 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef ACPI_CONFIG_FORMSET_GUID_H_ > +#define ACPI_CONFIG_FORMSET_GUID_H_ > + > +#define ACPI_CONFIGURATION_FORMSET_GUID \ > + { \ > + 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } \ > + } > + > +extern EFI_GUID gAcpiConfigFormSetGuid; > + > +#endif /* ACPI_CONFIG_FORMSET_GUID_H_ */ > diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr > new file mode 100644 > index 000000000000..18b44f90ddd9 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr > @@ -0,0 +1,69 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > + > +#include > +#include > + > +#define ACPI_CONFIG_FORM_ID 1 > + > +formset > + guid = ACPI_CONFIGURATION_FORMSET_GUID, > + title = STRING_TOKEN(STR_ACPI_FORM), > + help = STRING_TOKEN(STR_ACPI_FORM_HELP), > + classguid = gPlatformManagerFormsetGuid, > + > + varstore ACPI_CONFIG_VARSTORE_DATA, > + name = AcpiConfigNVData, > + guid = ACPI_CONFIGURATION_FORMSET_GUID; > + > + form > + formid = ACPI_CONFIG_FORM_ID, > + title = STRING_TOKEN(STR_ACPI_FORM); > + subtitle text = STRING_TOKEN(STR_ACPI_FORM_HELP); > + > + oneof > + varid = AcpiConfigNVData.EnableApeiSupport, > + prompt = STRING_TOKEN(STR_ACPI_APEI_SUPPORT_PROMPT), > + help = STRING_TOKEN(STR_ACPI_APEI_SUPPORT_HELP), > + option text = STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value = 0, flags = 0; > + option text = STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value = 1, flags = DEFAULT; > + endoneof; > + > + oneof > + varid = AcpiConfigNVData.AcpiCppcEnable, > + prompt = STRING_TOKEN(STR_ACPI_CPPC_PROMPT), > + help = STRING_TOKEN(STR_ACPI_CPPC_HELP), > + option text = STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value = 0, flags = 0; > + option text = STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value = 1, flags = DEFAULT; > + endoneof; > + > + oneof > + varid = AcpiConfigNVData.AcpiLpiEnable, > + prompt = STRING_TOKEN(STR_ACPI_LPI_PROMPT), > + help = STRING_TOKEN(STR_ACPI_LPI_HELP), > + option text = STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value = 0, flags = 0; > + option text = STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value = 1, flags = DEFAULT; > + endoneof; > + > + grayoutif ideqval AcpiConfigNVData.AcpiTurboSupport == 0; > + oneof > + varid = AcpiConfigNVData.AcpiTurboMode, > + prompt = STRING_TOKEN(STR_ACPI_TURBO_PROMPT), > + help = STRING_TOKEN(STR_ACPI_TURBO_HELP), > + option text = STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value = 1, flags = DEFAULT; > + option text = STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value = 0, flags = 0; > + suppressif ideqval AcpiConfigNVData.AcpiTurboSupport > 0; > + option text = STRING_TOKEN(STR_ACPI_UNSUPPORTED), value = 2, flags = 0; > + endif; > + endoneof; > + endif; > + > + endform; > + > +endformset; > diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c > index a216edac60ce..8a46e038c1a7 100644 > --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c > +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c > @@ -149,7 +149,7 @@ WrapBertErrorData ( > CrashSize = PLAT_CRASH_ITERATOR_SIZE * > GetNumberOfSupportedSockets () * > GetMaximumNumberOfCores (); > - CrashSize += 2 * (SMPRO_CRASH_SIZE + PMPRO_CRASH_SIZE); > + CrashSize += 2 * (SMPRO_CRASH_SIZE + PMPRO_CRASH_SIZE + RASIP_CRASH_SIZE); > CrashSize += sizeof (WrappedError->Bed.Vendor) + sizeof (WrappedError->Bed.BertRev); > > WrappedError->Ges.BlockStatus.ErrorDataEntryCount = 1; > @@ -437,8 +437,27 @@ AcpiApeiUpdate ( > VOID > ) > { > - if (!IsSlaveSocketActive ()) { > - AcpiApeiHestUpdateTable1P (); > + EFI_STATUS Status; > + ACPI_CONFIG_VARSTORE_DATA AcpiConfigData; > + UINTN BufferSize; > + > + BufferSize = sizeof (ACPI_CONFIG_VARSTORE_DATA); > + Status = gRT->GetVariable ( > + L"AcpiConfigNVData", > + &gAcpiConfigFormSetGuid, > + NULL, > + &BufferSize, > + &AcpiConfigData > + ); > + if (!EFI_ERROR (Status) && (AcpiConfigData.EnableApeiSupport == 0)) { > + AcpiApeiUninstallTable (EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_SIGNATURE); > + AcpiApeiUninstallTable (EFI_ACPI_6_3_HARDWARE_ERROR_SOURCE_TABLE_SIGNATURE); > + AcpiApeiUninstallTable (EFI_ACPI_6_3_SOFTWARE_DELEGATED_EXCEPTIONS_INTERFACE_TABLE_SIGNATURE); > + AcpiApeiUninstallTable (EFI_ACPI_6_3_ERROR_INJECTION_TABLE_SIGNATURE); > + } else { > + if (!IsSlaveSocketActive ()) { > + AcpiApeiHestUpdateTable1P (); > + } > } > > if (!IsSdeiEnabled ()) { > diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c > new file mode 100644 > index 000000000000..d085389d2865 > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c > @@ -0,0 +1,729 @@ > +/** @file > + > + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "AcpiConfigDxe.h" > + > +#define ACPI_VARSTORE_ATTRIBUTES EFI_VARIABLE_BOOTSERVICE_ACCESS | \ > + EFI_VARIABLE_RUNTIME_ACCESS | \ > + EFI_VARIABLE_NON_VOLATILE > + > +CHAR16 AcpiVarstoreDataName[] = L"AcpiConfigNVData"; > + > +EFI_HANDLE mDriverHandle = NULL; > +ACPI_CONFIG_PRIVATE_DATA *mPrivateData = NULL; > + > +HII_VENDOR_DEVICE_PATH mAcpiConfigHiiVendorDevicePath = { > + { > + { > + HARDWARE_DEVICE_PATH, > + HW_VENDOR_DP, > + { > + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), > + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) > + } > + }, > + ACPI_CONFIGURATION_FORMSET_GUID > + }, > + { > + END_DEVICE_PATH_TYPE, > + END_ENTIRE_DEVICE_PATH_SUBTYPE, > + { > + (UINT8)(END_DEVICE_PATH_LENGTH), > + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) > + } > + } > +}; > + > +/** > + This function allows a caller to extract the current configuration for one > + or more named elements from the target driver. > + > + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. > + @param Request A null-terminated Unicode string in > + format. > + @param Progress On return, points to a character in the Request > + string. Points to the string's null terminator if > + request was successful. Points to the most recent > + '&' before the first failing name/value pair (or > + the beginning of the string if the failure is in > + the first name/value pair) if the request was not > + successful. > + @param Results A null-terminated Unicode string in > + format which has all values filled > + in for the names in the Request string. String to > + be allocated by the called function. > + > + @retval EFI_SUCCESS The Results is filled with the requested values. > + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. > + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name. > + @retval EFI_NOT_FOUND Routing data doesn't match any storage in this > + driver. > + > +**/ > +EFI_STATUS > +EFIAPI > +ExtractConfig ( > + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, > + IN CONST EFI_STRING Request, > + OUT EFI_STRING *Progress, > + OUT EFI_STRING *Results > + ) > +{ > + EFI_STATUS Status; > + UINTN BufferSize; > + ACPI_CONFIG_PRIVATE_DATA *PrivateData; > + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; > + EFI_STRING ConfigRequest; > + EFI_STRING ConfigRequestHdr; > + UINTN Size; > + BOOLEAN AllocatedRequest; > + > + if (Progress == NULL || Results == NULL) { > + return EFI_INVALID_PARAMETER; > + } > + // > + // Initialize the local variables. > + // > + ConfigRequestHdr = NULL; > + ConfigRequest = NULL; > + Size = 0; > + *Progress = Request; > + AllocatedRequest = FALSE; > + > + if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gAcpiConfigFormSetGuid, AcpiVarstoreDataName)) { > + return EFI_NOT_FOUND; > + } > + > + PrivateData = ACPI_CONFIG_PRIVATE_FROM_THIS (This); > + HiiConfigRouting = PrivateData->HiiConfigRouting; > + > + // > + // Get Buffer Storage data from EFI variable. > + // Try to get the current setting from variable. > + // > + BufferSize = sizeof (ACPI_CONFIG_VARSTORE_DATA); > + Status = gRT->GetVariable ( > + AcpiVarstoreDataName, > + &gAcpiConfigFormSetGuid, > + NULL, > + &BufferSize, > + &PrivateData->Configuration > + ); > + if (EFI_ERROR (Status)) { > + return EFI_NOT_FOUND; > + } > + > + // > + // Convert buffer data to by helper function BlockToConfig() > + // > + BufferSize = sizeof (ACPI_CONFIG_VARSTORE_DATA); > + ConfigRequest = Request; > + if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) { > + // > + // Request has no request element, construct full request string. > + // Allocate and fill a buffer large enough to hold the template > + // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator > + // > + ConfigRequestHdr = HiiConstructConfigHdr ( > + &gAcpiConfigFormSetGuid, > + AcpiVarstoreDataName, > + PrivateData->DriverHandle > + ); > + Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); > + ConfigRequest = AllocateZeroPool (Size); > + ASSERT (ConfigRequest != NULL); > + if (ConfigRequest == NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + AllocatedRequest = TRUE; > + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize); > + FreePool (ConfigRequestHdr); > + } > + > + // > + // Convert buffer data to by helper function BlockToConfig() > + // > + Status = HiiConfigRouting->BlockToConfig ( > + HiiConfigRouting, > + ConfigRequest, > + (UINT8 *)&PrivateData->Configuration, > + BufferSize, > + Results, > + Progress > + ); > + > + // > + // Free the allocated config request string. > + // > + if (AllocatedRequest) { > + FreePool (ConfigRequest); > + ConfigRequest = NULL; > + } > + > + // > + // Set Progress string to the original request string. > + // > + if (Request == NULL) { > + *Progress = NULL; > + } else if (StrStr (Request, L"OFFSET") == NULL) { > + *Progress = Request + StrLen (Request); > + } > + > + return Status; > +} > + > +/** > + This function processes the results of changes in configuration. > + > + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. > + @param Configuration A null-terminated Unicode string in > + format. > + @param Progress A pointer to a string filled in with the offset of > + the most recent '&' before the first failing > + name/value pair (or the beginning of the string if > + the failure is in the first name/value pair) or > + the terminating NULL if all was successful. > + > + @retval EFI_SUCCESS The Results is processed successfully. > + @retval EFI_INVALID_PARAMETER Configuration is NULL. > + @retval EFI_NOT_FOUND Routing data doesn't match any storage in this > + driver. > + > +**/ > +EFI_STATUS > +EFIAPI > +RouteConfig ( > + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, > + IN CONST EFI_STRING Configuration, > + OUT EFI_STRING *Progress > + ) > +{ > + EFI_STATUS Status; > + UINTN BufferSize; > + ACPI_CONFIG_PRIVATE_DATA *PrivateData; > + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; > + > + if (Configuration == NULL || Progress == NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + PrivateData = ACPI_CONFIG_PRIVATE_FROM_THIS (This); > + HiiConfigRouting = PrivateData->HiiConfigRouting; > + *Progress = Configuration; > + > + // > + // Check routing data in . > + // Note: if only one Storage is used, then this checking could be skipped. > + // > + if (!HiiIsConfigHdrMatch (Configuration, &gAcpiConfigFormSetGuid, AcpiVarstoreDataName)) { > + return EFI_NOT_FOUND; > + } > + > + // > + // Get Buffer Storage data from EFI variable > + // > + BufferSize = sizeof (ACPI_CONFIG_VARSTORE_DATA); > + Status = gRT->GetVariable ( > + AcpiVarstoreDataName, > + &gAcpiConfigFormSetGuid, > + NULL, > + &BufferSize, > + &PrivateData->Configuration > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + // > + // Convert to buffer data by helper function ConfigToBlock() > + // > + BufferSize = sizeof (ACPI_CONFIG_VARSTORE_DATA); > + Status = HiiConfigRouting->ConfigToBlock ( > + HiiConfigRouting, > + Configuration, > + (UINT8 *)&PrivateData->Configuration, > + &BufferSize, > + Progress > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + // > + // Store Buffer Storage back to EFI variable > + // > + Status = gRT->SetVariable ( > + AcpiVarstoreDataName, > + &gAcpiConfigFormSetGuid, > + ACPI_VARSTORE_ATTRIBUTES, > + sizeof (ACPI_CONFIG_VARSTORE_DATA), > + &PrivateData->Configuration > + ); > + > + return Status; > +} > + > +/** > + This function processes the results of changes in configuration. > + > + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. > + @param Action Specifies the type of action taken by the browser. > + @param QuestionId A unique value which is sent to the original > + exporting driver so that it can identify the type > + of data to expect. > + @param Type The type of value for the question. > + @param Value A pointer to the data being sent to the original > + exporting driver. > + @param ActionRequest On return, points to the action requested by the > + callback function. > + > + @retval EFI_SUCCESS The callback successfully handled the action. > + @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters. > + > +**/ > +EFI_STATUS > +EFIAPI > +DriverCallback ( > + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, > + IN EFI_BROWSER_ACTION Action, > + IN EFI_QUESTION_ID QuestionId, > + IN UINT8 Type, > + IN EFI_IFR_TYPE_VALUE *Value, > + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest > + ) > +{ > + if (Action != EFI_BROWSER_ACTION_CHANGING) { > + // > + // Do nothing for other UEFI Action. Only do call back when data is changed. > + // > + return EFI_UNSUPPORTED; > + } > + if (((Value == NULL) > + && (Action != EFI_BROWSER_ACTION_FORM_OPEN) > + && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) > + || (ActionRequest == NULL)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + return EFI_SUCCESS; > +} > + > +STATIC > +EFI_STATUS > +AcpiNVDataUpdate ( > + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData > + ) > +{ > + EFI_STATUS Status; > + PLATFORM_INFO_HOB *PlatformHob; > + UINT32 TurboSupport; > + > + ASSERT (PrivateData != NULL); > + > + PlatformHob = PrivateData->PlatformHob; > + TurboSupport = PlatformHob->TurboCapability[0] + PlatformHob->TurboCapability[1]; > + > + if (TurboSupport == 0) { > + PrivateData->Configuration.AcpiTurboMode = 2; // Unsupported mode > + PrivateData->Configuration.AcpiTurboSupport = 0; > + } else { > + PrivateData->Configuration.AcpiTurboSupport = 1; > + } > + > + Status = gRT->SetVariable ( > + AcpiVarstoreDataName, > + &gAcpiConfigFormSetGuid, > + ACPI_VARSTORE_ATTRIBUTES, > + sizeof (ACPI_CONFIG_VARSTORE_DATA), > + &PrivateData->Configuration > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a %d gRT->SetVariable() failed \n", __FUNCTION__, __LINE__)); > + return Status; > + } > + > + return EFI_SUCCESS; > +} > + > +STATIC > +EFI_STATUS > +UpdateTurboModeConfig ( > + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData > + ) > +{ > + EFI_STATUS Status; > + PLATFORM_INFO_HOB *PlatformHob; > + BOOLEAN EnableTurbo; > + > + ASSERT (PrivateData != NULL); > + > + if (PrivateData->Configuration.AcpiTurboSupport != 0) { > + PlatformHob = PrivateData->PlatformHob; > + EnableTurbo = (PrivateData->Configuration.AcpiTurboMode != 0) ? TRUE : FALSE; > + > + if (PlatformHob->TurboCapability[0] != 0) { > + Status = MailboxMsgTurboConfig (0, EnableTurbo); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + } > + > + if (PlatformHob->TurboCapability[1] != 0) { > + Status = MailboxMsgTurboConfig (1, EnableTurbo); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + } > + } else { > + DEBUG ((DEBUG_INFO, "%a: Turbo mode is unsupported! \n", __FUNCTION__)); > + } > + > + return EFI_SUCCESS; > +} > + > +STATIC > +EFI_STATUS > +UpdateCPPCConfig ( > + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData > + ) > +{ > + EFI_STATUS Status; > + CHAR8 Buffer[64]; > + > + ASSERT (PrivateData != NULL); > + > + AsciiSPrint (Buffer, sizeof (Buffer), "\\_SB.CPCE"); > + Status = AcpiAmlObjectUpdateInteger ( > + PrivateData->AcpiSdtProtocol, > + PrivateData->AcpiTableHandle, > + Buffer, > + PrivateData->Configuration.AcpiCppcEnable > + ); > + ASSERT_EFI_ERROR (Status); > + > + return Status; > +} > + > +STATIC > +EFI_STATUS > +UpdateLPIConfig ( > + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData > + ) > +{ > + EFI_STATUS Status; > + CHAR8 Buffer[64]; > + > + ASSERT (PrivateData != NULL); > + > + AsciiSPrint (Buffer, sizeof (Buffer), "\\_SB.LPIE"); > + Status = AcpiAmlObjectUpdateInteger ( > + PrivateData->AcpiSdtProtocol, > + PrivateData->AcpiTableHandle, > + Buffer, > + PrivateData->Configuration.AcpiLpiEnable > + ); > + ASSERT_EFI_ERROR (Status); > + > + return Status; > +} > + > +STATIC > +VOID > +UpdateAcpiOnReadyToBoot ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; > + EFI_ACPI_DESCRIPTION_HEADER *Table; > + EFI_ACPI_HANDLE TableHandle; > + UINTN TableKey; > + UINTN TableIndex; > + > + ASSERT (mPrivateData != NULL); > + > + // > + // Find the AcpiTable protocol > + // > + Status = gBS->LocateProtocol ( > + &gEfiAcpiSdtProtocolGuid, > + NULL, > + (VOID **)&AcpiSdtProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n")); > + return; > + } > + > + mPrivateData->AcpiSdtProtocol = AcpiSdtProtocol; > + > + TableIndex = 0; > + Status = AcpiLocateTableBySignature ( > + AcpiSdtProtocol, > + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, > + &TableIndex, > + &Table, > + &TableKey > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + Status = AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + mPrivateData->AcpiTableHandle = TableHandle; > + > + Status = UpdateCPPCConfig (mPrivateData); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + Status = UpdateLPIConfig (mPrivateData); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + Status = UpdateTurboModeConfig (mPrivateData); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + // > + // Close DSDT Table > + // > + AcpiSdtProtocol->Close (TableHandle); > + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); > +} > + > +STATIC > +EFI_STATUS > +AcpiConfigUnload ( > + VOID > + ) > +{ > + ASSERT (mPrivateData != NULL); > + > + if (mDriverHandle != NULL) { > + gBS->UninstallMultipleProtocolInterfaces ( > + mDriverHandle, > + &gEfiDevicePathProtocolGuid, > + &mAcpiConfigHiiVendorDevicePath, > + &gEfiHiiConfigAccessProtocolGuid, > + &mPrivateData->ConfigAccess, > + NULL > + ); > + mDriverHandle = NULL; > + } > + > + if (mPrivateData->HiiHandle != NULL) { > + HiiRemovePackages (mPrivateData->HiiHandle); > + } > + > + FreePool (mPrivateData); > + mPrivateData = NULL; > + > + return EFI_SUCCESS; > +} > + > +EFI_STATUS > +EFIAPI > +AcpiConfigEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + EFI_HII_HANDLE HiiHandle; > + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; > + UINTN BufferSize; > + ACPI_CONFIG_VARSTORE_DATA *Configuration; > + BOOLEAN ActionFlag; > + EFI_STRING ConfigRequestHdr; > + EFI_EVENT ReadyToBootEvent; > + PLATFORM_INFO_HOB *PlatformHob; > + VOID *Hob; > + > + // > + // Initialize the local variables. > + // > + ConfigRequestHdr = NULL; > + > + // > + // Initialize driver private data > + // > + mPrivateData = AllocateZeroPool (sizeof (ACPI_CONFIG_PRIVATE_DATA)); > + if (mPrivateData == NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + mPrivateData->Signature = ACPI_CONFIG_PRIVATE_SIGNATURE; > + > + mPrivateData->ConfigAccess.ExtractConfig = ExtractConfig; > + mPrivateData->ConfigAccess.RouteConfig = RouteConfig; > + mPrivateData->ConfigAccess.Callback = DriverCallback; > + > + // > + // Get the Platform HOB > + // > + Hob = GetFirstGuidHob (&gPlatformHobGuid); > + ASSERT (Hob != NULL); > + if (Hob == NULL) { > + AcpiConfigUnload (); > + return EFI_DEVICE_ERROR; > + } > + PlatformHob = (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); > + > + mPrivateData->PlatformHob = PlatformHob; > + > + // > + // Locate ConfigRouting protocol > + // > + Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&HiiConfigRouting); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + mPrivateData->HiiConfigRouting = HiiConfigRouting; > + > + Status = gBS->InstallMultipleProtocolInterfaces ( > + &mDriverHandle, > + &gEfiDevicePathProtocolGuid, > + &mAcpiConfigHiiVendorDevicePath, > + &gEfiHiiConfigAccessProtocolGuid, > + &mPrivateData->ConfigAccess, > + NULL > + ); > + ASSERT_EFI_ERROR (Status); > + > + mPrivateData->DriverHandle = mDriverHandle; > + > + // > + // Publish our HII data > + // > + HiiHandle = HiiAddPackages ( > + &gAcpiConfigFormSetGuid, > + mDriverHandle, > + AcpiConfigDxeStrings, > + AcpiConfigVfrBin, > + NULL > + ); > + if (HiiHandle == NULL) { > + gBS->UninstallMultipleProtocolInterfaces ( > + mDriverHandle, > + &gEfiDevicePathProtocolGuid, > + &mAcpiConfigHiiVendorDevicePath, > + &gEfiHiiConfigAccessProtocolGuid, > + &mPrivateData->ConfigAccess, > + NULL > + ); > + return EFI_OUT_OF_RESOURCES; > + } > + > + mPrivateData->HiiHandle = HiiHandle; > + > + // > + // Initialize configuration data > + // > + Configuration = &mPrivateData->Configuration; > + ZeroMem (Configuration, sizeof (ACPI_CONFIG_VARSTORE_DATA)); > + > + // > + // Try to read NV config EFI variable first > + // > + ConfigRequestHdr = HiiConstructConfigHdr (&gAcpiConfigFormSetGuid, AcpiVarstoreDataName, mDriverHandle); > + ASSERT (ConfigRequestHdr != NULL); > + > + BufferSize = sizeof (ACPI_CONFIG_VARSTORE_DATA); > + Status = gRT->GetVariable (AcpiVarstoreDataName, &gAcpiConfigFormSetGuid, NULL, &BufferSize, Configuration); > + if (EFI_ERROR (Status)) { > + // > + // Store zero data Buffer Storage to EFI variable > + // > + Status = gRT->SetVariable ( > + AcpiVarstoreDataName, > + &gAcpiConfigFormSetGuid, > + ACPI_VARSTORE_ATTRIBUTES, > + sizeof (ACPI_CONFIG_VARSTORE_DATA), > + Configuration > + ); > + if (EFI_ERROR (Status)) { > + AcpiConfigUnload (); > + return Status; > + } > + // > + // EFI variable for NV config doesn't exit, we should build this variable > + // based on default values stored in IFR > + // > + ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD); > + if (!ActionFlag) { > + AcpiConfigUnload (); > + return EFI_INVALID_PARAMETER; > + } > + } else { > + // > + // EFI variable does exist and Validate Current Setting > + // > + ActionFlag = HiiValidateSettings (ConfigRequestHdr); > + if (!ActionFlag) { > + AcpiConfigUnload (); > + return EFI_INVALID_PARAMETER; > + } > + } > + FreePool (ConfigRequestHdr); > + > + Status = gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_NOTIFY, > + UpdateAcpiOnReadyToBoot, > + NULL, > + &gEfiEventReadyToBootGuid, > + &ReadyToBootEvent > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Fail to create ready to boot event %r!\n", Status)); > + return Status; > + } > + > + Status = AcpiNVDataUpdate (mPrivateData); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + return EFI_SUCCESS; > +} > diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni > new file mode 100644 > index 000000000000..21a6188518fd > --- /dev/null > +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni > @@ -0,0 +1,27 @@ > +// > +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
> +// > +// SPDX-License-Identifier: BSD-2-Clause-Patent > +// > + > +#langdef en-US "English" > + > +#string STR_ACPI_FORM #language en-US "ACPI Configuration" > +#string STR_ACPI_FORM_HELP #language en-US "ACPI Configuration" > + > +#string STR_ACPI_FORM_SEPERATE_LINE #language en-US "" > +#string STR_ACPI_COMMON_ENABLE #language en-US "Enabled" > +#string STR_ACPI_COMMON_DISABLE #language en-US "Disabled" > +#string STR_ACPI_UNSUPPORTED #language en-US "Unsupported" > + > +#string STR_ACPI_APEI_SUPPORT_PROMPT #language en-US "APEI Support" > +#string STR_ACPI_APEI_SUPPORT_HELP #language en-US "Enable/Disable ACPI Platform Error Interface support" > + > +#string STR_ACPI_CPPC_PROMPT #language en-US "CPPC Support" > +#string STR_ACPI_CPPC_HELP #language en-US "Enables or Disables System ability to CPPC (Collaborative Processor Performance Control)" > + > +#string STR_ACPI_LPI_PROMPT #language en-US "LPI Support" > +#string STR_ACPI_LPI_HELP #language en-US "Enables or Disables System ability to LPI (Lower Power Idle)" > + > +#string STR_ACPI_TURBO_PROMPT #language en-US "Max Performance" > +#string STR_ACPI_TURBO_HELP #language en-US "Enables or Disables System ability to Max Performance" > -- > 2.17.1 >