From nobody Sun Dec 29 02:19:28 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 1494498438370757.9214602286164; Thu, 11 May 2017 03:27:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 229EE2095C86D; Thu, 11 May 2017 03:27:14 -0700 (PDT) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 C4D5721A16E36 for ; Thu, 11 May 2017 03:27:12 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2017 03:27:12 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.15]) by orsmga005.jf.intel.com with ESMTP; 11 May 2017 03:27:11 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,323,1491289200"; d="scan'208";a="98630271" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Thu, 11 May 2017 18:27:05 +0800 Message-Id: <20170511102706.89404-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 In-Reply-To: <20170511102706.89404-1-ruiyu.ni@intel.com> References: <20170511102706.89404-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH 1/2] ShellPkg/memmap: Refine code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaben Carsey 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" The patch changes Buffer to Descriptors, changes (UINT8 *Walker) to (EFI_MEMORY_DESCRIPTOR *Walker). The change makes lots of type conversion unnecessary. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey --- .../Library/UefiShellDebug1CommandsLib/MemMap.c | 107 +++++++++++------= ---- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c b/ShellPk= g/Library/UefiShellDebug1CommandsLib/MemMap.c index a4eb1be27e..a99e3c4723 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c @@ -3,7 +3,7 @@ =20 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which acModeanies this distribution. The full text of the license may b= e found at @@ -66,11 +66,11 @@ ShellCommandRunMemMap ( CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; UINTN Size; - EFI_MEMORY_DESCRIPTOR *Buffer; + EFI_MEMORY_DESCRIPTOR *Descriptors; UINTN MapKey; UINTN ItemSize; UINT32 Version; - UINT8 *Walker; + EFI_MEMORY_DESCRIPTOR *Walker; UINT64 ReservedPages; UINT64 LoadCodePages; UINT64 LoadDataPages; @@ -122,7 +122,7 @@ ShellCommandRunMemMap ( PalCodePages =3D 0; PersistentPages =3D 0; Size =3D 0; - Buffer =3D NULL; + Descriptors =3D NULL; ShellStatus =3D SHELL_SUCCESS; Status =3D EFI_SUCCESS; =20 @@ -152,11 +152,11 @@ ShellCommandRunMemMap ( ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShel= lDebug1HiiHandle, L"memmap"); =20 ShellStatus =3D SHELL_INVALID_PARAMETER; } else { - Status =3D gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Ver= sion); + Status =3D gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize,= &Version); if (Status =3D=3D EFI_BUFFER_TOO_SMALL){ Size +=3D SIZE_1KB; - Buffer =3D AllocateZeroPool(Size); - Status =3D gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &V= ersion); + Descriptors =3D AllocateZeroPool(Size); + Status =3D gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSiz= e, &Version); } if (EFI_ERROR(Status)) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED)= , gShellDebug1HiiHandle, L"memmap"); =20 @@ -171,78 +171,81 @@ ShellCommandRunMemMap ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER)= , gShellDebug1HiiHandle, L"memmap"); } =20 - for (Walker =3D (UINT8*)Buffer; Walker < (((UINT8*)Buffer)+Size) &= & Walker !=3D NULL; Walker +=3D ItemSize){ - switch (((EFI_MEMORY_DESCRIPTOR*)Walker)->Type) { + for ( Walker =3D Descriptors + ; (Walker < (EFI_MEMORY_DESCRIPTOR *) ((UINT8*)Descriptors + S= ize)) && (Walker !=3D NULL) + ; Walker =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *)Walker + Item= Size) + ){ + switch (Walker->Type) { case EfiReservedMemoryType: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiReservedMemoryType, ((EFI_MEMORY_DESCRIPTOR*)Walker= )->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x6= 4(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY= _DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attr= ibute); - ReservedPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberO= fPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->= PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberO= fPages, Walker->Attribute); + ReservedPages +=3D Walker->NumberOfPages; break; case EfiLoaderCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiLoaderCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Physi= calStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4= KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIP= TOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); - LoadCodePages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberO= fPages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiLoaderCode, Walker->PhysicalStart, Walker->Physical= Start+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, = Walker->Attribute); + LoadCodePages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiLoaderData: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiLoaderData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Physi= calStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4= KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIP= TOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); - LoadDataPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberO= fPages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiLoaderData, Walker->PhysicalStart, Walker->Physical= Start+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, = Walker->Attribute); + LoadDataPages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiBootServicesCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiBootServicesCodeShort:NameEfiBootServicesCode,= ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)= Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)= ->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_= MEMORY_DESCRIPTOR*)Walker)->Attribute); - BSCodePages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfP= ages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiBootServicesCodeShort:NameEfiBootServicesCode,= Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->N= umberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + BSCodePages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiBootServicesData: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiBootServicesDataShort:NameEfiBootServicesData,= ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)= Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)= ->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_= MEMORY_DESCRIPTOR*)Walker)->Attribute); - BSDataPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfP= ages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiBootServicesDataShort:NameEfiBootServicesData,= Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->N= umberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + BSDataPages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiRuntimeServicesCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiRuntimeServicesCodeShort:NameEfiRuntimeService= sCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRI= PTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)W= alker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, = ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); - RTCodePages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfP= ages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiRuntimeServicesCodeShort:NameEfiRuntimeService= sCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Wal= ker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + RTCodePages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiRuntimeServicesData: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiRuntimeServicesDataShort:NameEfiRuntimeService= sData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRI= PTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)W= alker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, = ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); - RTDataPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfP= ages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiRuntimeServicesDataShort:NameEfiRuntimeService= sData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Wal= ker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + RTDataPages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiConventionalMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiConventionalMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker= )->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x6= 4(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY= _DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attr= ibute); - AvailPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiConventionalMemory, Walker->PhysicalStart, Walker->= PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberO= fPages, Walker->Attribute); + AvailPages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiPersistentMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiPersistentMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)-= >PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(= SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_D= ESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attrib= ute); - PersistentPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->Numbe= rOfPages; - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->Numbe= rOfPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiPersistentMemory, Walker->PhysicalStart, Walker->Ph= ysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfP= ages, Walker->Attribute); + PersistentPages +=3D Walker->NumberOfPages; + TotalPages +=3D Walker->NumberOfPages; break; case EfiUnusableMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiUnusableMemoryShort:NameEfiUnusableMemory, ((E= FI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walk= er)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->Nu= mberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMO= RY_DESCRIPTOR*)Walker)->Attribute); - UnusableMemoryPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->N= umberOfPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiUnusableMemoryShort:NameEfiUnusableMemory, Wal= ker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->Numbe= rOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + UnusableMemoryPages +=3D Walker->NumberOfPages; break; case EfiACPIReclaimMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiACPIReclaimMemoryShort:NameEfiACPIReclaimMemor= y, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR= *)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walke= r)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EF= I_MEMORY_DESCRIPTOR*)Walker)->Attribute); - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; - AcpiReclaimPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->Numb= erOfPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiACPIReclaimMemoryShort:NameEfiACPIReclaimMemor= y, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker-= >NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + TotalPages +=3D Walker->NumberOfPages; + AcpiReclaimPages +=3D Walker->NumberOfPages; break; case EfiACPIMemoryNVS: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiACPIMemoryNVSShort:NameEfiACPIMemoryNVS, ((EFI= _MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker= )->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->Numb= erOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY= _DESCRIPTOR*)Walker)->Attribute); - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; - AcpiNvsPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->Numbe= rOfPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiACPIMemoryNVSShort:NameEfiACPIMemoryNVS, Walke= r->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberO= fPages)-1, Walker->NumberOfPages, Walker->Attribute); + TotalPages +=3D Walker->NumberOfPages; + AcpiNvsPages +=3D Walker->NumberOfPages; break; case EfiMemoryMappedIO: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiMemoryMappedIOShort:NameEfiMemoryMappedIO, ((E= FI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walk= er)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->Nu= mberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMO= RY_DESCRIPTOR*)Walker)->Attribute); - MmioSpacePages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->Numbe= rOfPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiMemoryMappedIOShort:NameEfiMemoryMappedIO, Wal= ker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->Numbe= rOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + MmioSpacePages +=3D Walker->NumberOfPages; break; case EfiMemoryMappedIOPortSpace: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiMemoryMappedIOPortSpaceShort:NameEfiMemoryMapp= edIOPortSpace, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMOR= Y_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCR= IPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberO= fPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); - MmioPortPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberO= fPages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, !Sfo?NameEfiMemoryMappedIOPortSpaceShort:NameEfiMemoryMapp= edIOPortSpace, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE= _4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); + MmioPortPages +=3D Walker->NumberOfPages; break; case EfiPalCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiPalCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Physical= Start, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,= ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR= *)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); - TotalPages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPa= ges; - PalCodePages +=3D ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOf= Pages; + ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TO= KEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShell= Debug1HiiHandle, NameEfiPalCode, Walker->PhysicalStart, Walker->PhysicalSta= rt+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Wal= ker->Attribute); + TotalPages +=3D Walker->NumberOfPages; + PalCodePages +=3D Walker->NumberOfPages; break; default: ASSERT(FALSE); @@ -310,8 +313,8 @@ ShellCommandRunMemMap ( ShellCommandLineFreeVarList (Package); } =20 - if (Buffer !=3D NULL) { - FreePool(Buffer); + if (Descriptors !=3D NULL) { + FreePool(Descriptors); } =20 return (ShellStatus); --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel