From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 7B0B4207DF47D for ; Fri, 27 Apr 2018 22:40:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2018 22:40:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,337,1520924400"; d="scan'208";a="46692192" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 27 Apr 2018 22:40:19 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 27 Apr 2018 22:40:19 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 27 Apr 2018 22:40:19 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.79]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.240]) with mapi id 14.03.0319.002; Sat, 28 Apr 2018 13:40:17 +0800 From: "Zeng, Star" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH] IntelFrameworkModule/LegacyBios: Use reserved memory for legacy data Thread-Index: AQHT3GP7v2HvFDLro0K6AwKBk56RWaQVrbQQ Date: Sat, 28 Apr 2018 05:40:16 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE5E8A@shsmsx102.ccr.corp.intel.com> References: <20180425070616.18108-1-ruiyu.ni@intel.com> In-Reply-To: <20180425070616.18108-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] IntelFrameworkModule/LegacyBios: Use reserved memory for legacy data X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2018 05:40:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please also update the function comment " Do an AllocatePages () of type = AllocateMaxAddress for EfiBootServicesCode memory." With that, Reviewed-by: Star Zeng . Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiy= u Ni Sent: Wednesday, April 25, 2018 3:06 PM To: edk2-devel@lists.01.org Cc: Zeng, Star Subject: [edk2] [PATCH] IntelFrameworkModule/LegacyBios: Use reserved memor= y for legacy data Certain Legacy USB implementation needs to access legacy data (BDA, etc.) from SMM environment. While currently it's not allowed to access BS m= emory from SMM after EndofDxe, change the legacy data to use reserved memor= y type. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng --- IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c | 13 +++++++++= ++-- .../Csm/LegacyBiosDxe/LegacyBiosInterface.h | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c b/Intel= FrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c index fca08a8fa2..a96f9b5610 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c @@ -46,7 +46,8 @@ BOOLEAN mEndOfDxe =3D FALSE; Do an AllocatePages () of type AllocateMaxAddress for EfiBootServicesCod= e memory. =20 - @param AllocateType Allocated Legacy Memory Type + @param AllocateType The type of allocation to perform. + @param MemoryType The type of memory to allocate. @param StartPageAddress Start address of range @param Pages Number of pages to allocate @param Result Result of allocation @@ -58,6 +59,7 @@ BOOLEAN mEndOfDxe =3D FALSE; EFI_STATUS AllocateLegacyMemory ( IN EFI_ALLOCATE_TYPE AllocateType, + IN EFI_MEMORY_TYPE MemoryType, IN EFI_PHYSICAL_ADDRESS StartPageAddress, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Result @@ -72,7 +74,7 @@ AllocateLegacyMemory ( MemPage =3D (EFI_PHYSICAL_ADDRESS) (UINTN) StartPageAddress; Status =3D gBS->AllocatePages ( AllocateType, - EfiBootServicesCode, + MemoryType, Pages, &MemPage ); @@ -974,6 +976,7 @@ LegacyBiosInstall ( // AllocateLegacyMemory ( AllocateAddress, + EfiReservedMemoryType, 0, 1, &MemoryAddress @@ -999,6 +1002,7 @@ LegacyBiosInstall ( =20 Status =3D AllocateLegacyMemory ( AllocateAddress, + EfiReservedMemoryType, CONVENTIONAL_MEMORY_TOP - MemorySize, EFI_SIZE_TO_PAGES (MemorySize), &MemoryAddress @@ -1027,6 +1031,7 @@ LegacyBiosInstall ( for (MemStart =3D MemoryAddress; MemStart < MemoryAddress + MemorySize; = MemStart +=3D 0x1000) { Status =3D AllocateLegacyMemory ( AllocateAddress, + EfiBootServicesCode, MemStart, 1, &StartAddress @@ -1046,6 +1051,7 @@ LegacyBiosInstall ( ASSERT ((MemorySize & 0xFFF) =3D=3D 0); =20 Status =3D AllocateLegacyMemory ( AllocateMaxAddress, + EfiBootServicesCode, CONVENTIONAL_MEMORY_TOP, EFI_SIZE_TO_PAGES (MemorySize), &MemoryAddressUnder1MB @@ -1059,6 +1065,7 @@ LegacyBiosInstall ( // Status =3D AllocateLegacyMemory ( AllocateMaxAddress, + EfiReservedMemoryType, CONVENTIONAL_MEMORY_TOP, (sizeof (LOW_MEMORY_THUNK) / EFI_PAGE_SIZE) + 2, &MemoryAddress @@ -1086,6 +1093,7 @@ LegacyBiosInstall ( // =20 Status =3D AllocateLegacyMemory ( AllocateMaxAddress, + EfiBootServicesCode, 0x1000000, EFI_SIZE_TO_PAGES (MemorySize), &MemoryAddress @@ -1096,6 +1104,7 @@ LegacyBiosInstall ( // =20 Status =3D AllocateLegacyMemory ( AllocateMaxAddress, + EfiBootServicesCode, 0xFFFFFFFF, EFI_SIZE_TO_PAGES (MemorySize), &MemoryAddress diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.= h b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h index cc2fc9fc13..595fe0eade 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h @@ -1264,7 +1264,8 @@ GenerateSoftInit ( Do an AllocatePages () of type AllocateMaxAddress for EfiBootServicesCod= e memory. =20 - @param AllocateType Allocated Legacy Memory Type + @param AllocateType The type of allocation to perform. + @param MemoryType The type of memory to allocate. @param StartPageAddress Start address of range @param Pages Number of pages to allocate @param Result Result of allocation @@ -1276,6 +1277,7 @@ GenerateSoftInit ( EFI_STATUS AllocateLegacyMemory = ( IN EFI_ALLOCATE_TYPE AllocateType, + IN EFI_MEMORY_TYPE MemoryType, IN EFI_PHYSICAL_ADDRESS StartPageAddress, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Result -- 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel