From nobody Sat Nov 2 14:31:45 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 14890485735081003.9734283709498; Thu, 9 Mar 2017 00:36:13 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 379588038B; Thu, 9 Mar 2017 00:36:11 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3DA2C80390 for ; Thu, 9 Mar 2017 00:36:09 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2017 00:36:09 -0800 Received: from jfan12-desk.ccr.corp.intel.com ([10.239.158.57]) by fmsmga002.fm.intel.com with ESMTP; 09 Mar 2017 00:36:07 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,268,1486454400"; d="scan'208";a="1139930903" From: Jeff Fan To: edk2-devel@lists.01.org Date: Thu, 9 Mar 2017 16:35:44 +0800 Message-Id: <20170309083553.6016-3-jeff.fan@intel.com> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20170309083553.6016-1-jeff.fan@intel.com> References: <20170309083553.6016-1-jeff.fan@intel.com> Subject: [edk2] [PATCH 02/11] UefiCpuPkg/CpuS3DataDxe: Consume the existing PcdCpuS3DataAddress X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Kinney , Feng Tian MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If PCD PcdCpuS3DataAddress is set before, CpuS3DataDxe should get RegisterT= able and PreSmmRegisterTable from existing PCD pointed buffer and needn't to all= ocate new buffer for RegisterTable and PreSmmRegisterTable. Cc: Feng Tian Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 54 ++++++++++++++++++++++-----------= ---- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c b/UefiCpuPkg/CpuS3DataDxe/= CpuS3Data.c index 07c7102..dccb406 100644 --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c @@ -160,12 +160,18 @@ CpuS3DataInitialize ( VOID *Gdt; VOID *Idt; EFI_EVENT Event; + ACPI_CPU_DATA *OldAcpiCpuData; =20 if (!PcdGetBool (PcdAcpiS3Enable)) { return EFI_UNSUPPORTED; } =20 // + // Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA stru= cture + // + OldAcpiCpuData =3D (ACPI_CPU_DATA *) (UINTN) PcdGet64 (PcdCpuS3DataAddre= ss); + + // // Allocate ACPI NVS memory below 4G memory for use on ACPI S3 resume. // AcpiCpuDataEx =3D AllocateAcpiNvsMemoryBelow4G (sizeof (ACPI_CPU_DATA_EX= )); @@ -229,32 +235,38 @@ CpuS3DataInitialize ( AcpiCpuDataEx->GdtrProfile.Base =3D (UINTN)Gdt; AcpiCpuDataEx->IdtrProfile.Base =3D (UINTN)Idt; =20 - // - // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable f= or all CPUs - // - TableSize =3D 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE); - RegisterTable =3D (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G (Ta= bleSize); - ASSERT (RegisterTable !=3D NULL); - for (Index =3D 0; Index < NumberOfCpus; Index++) { - Status =3D MpServices->GetProcessorInfo ( + if (OldAcpiCpuData !=3D NULL) { + AcpiCpuData->RegisterTable =3D OldAcpiCpuData->RegisterTable; + AcpiCpuData->PreSmmInitRegisterTable =3D OldAcpiCpuData->PreSmmInitReg= isterTable; + } else { + // + // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable= for all CPUs + // + TableSize =3D 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE); + RegisterTable =3D (CPU_REGISTER_TABLE *)AllocateAcpiNvsMemoryBelow4G (= TableSize); + ASSERT (RegisterTable !=3D NULL); + + for (Index =3D 0; Index < NumberOfCpus; Index++) { + Status =3D MpServices->GetProcessorInfo ( MpServices, Index, &ProcessorInfoBuffer ); - ASSERT_EFI_ERROR (Status); - - RegisterTable[Index].InitialApicId =3D (UINT32)ProcessorInfoBuffe= r.ProcessorId; - RegisterTable[Index].TableLength =3D 0; - RegisterTable[Index].AllocatedSize =3D 0; - RegisterTable[Index].RegisterTableEntry =3D 0; - - RegisterTable[NumberOfCpus + Index].InitialApicId =3D (UINT32)Pro= cessorInfoBuffer.ProcessorId; - RegisterTable[NumberOfCpus + Index].TableLength =3D 0; - RegisterTable[NumberOfCpus + Index].AllocatedSize =3D 0; - RegisterTable[NumberOfCpus + Index].RegisterTableEntry =3D 0; + ASSERT_EFI_ERROR (Status); + + RegisterTable[Index].InitialApicId =3D (UINT32)ProcessorInfoBuf= fer.ProcessorId; + RegisterTable[Index].TableLength =3D 0; + RegisterTable[Index].AllocatedSize =3D 0; + RegisterTable[Index].RegisterTableEntry =3D 0; + + RegisterTable[NumberOfCpus + Index].InitialApicId =3D (UINT32)P= rocessorInfoBuffer.ProcessorId; + RegisterTable[NumberOfCpus + Index].TableLength =3D 0; + RegisterTable[NumberOfCpus + Index].AllocatedSize =3D 0; + RegisterTable[NumberOfCpus + Index].RegisterTableEntry =3D 0; + } + AcpiCpuData->RegisterTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)= RegisterTable; + AcpiCpuData->PreSmmInitRegisterTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)= (RegisterTable + NumberOfCpus); } - AcpiCpuData->RegisterTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Re= gisterTable; - AcpiCpuData->PreSmmInitRegisterTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)(R= egisterTable + NumberOfCpus); =20 // // Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA stru= cture --=20 2.9.3.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel