From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::441; helo=mail-wr1-x441.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 80EA12194D387 for ; Fri, 23 Nov 2018 04:14:51 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id c14so6511868wrr.0 for ; Fri, 23 Nov 2018 04:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1A7tDWivKr1et7g8yBGgA5/Ar+Kjtyc+Vx0UG8BNon0=; b=Of8btlsCA5CvSBn1IzYDLYNOSv7eyufEnn5omZ9ZqOMXI9zMEM2o3S4gP6kKzW5wm7 MpJXKkbWeFxPIpFBRce1JRlV4FAfrewoCPeDIsFTNsKLLugxjf8StCNaguUAHDwpLpsj LtZT+uHu6km7gm6Oo11lNV9QSOfTk+fI44TNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1A7tDWivKr1et7g8yBGgA5/Ar+Kjtyc+Vx0UG8BNon0=; b=N3gyacaGwZ84AXsYiwy+lnthWELSbUp2369b8755WpjbfPWLqwEOhLukLOsPAEM9Qe bMlECarVO/t5i6sD38URCvCnkNv7WO8yFaraSKlxU6KUvoE+HiNwDo4Y1EdkdIzDUbdu RGvo/DGyvUbTcwi2YWaC551Ji7rJ9zMT6KZUc6dVnMSX+6bDrk3SusO1hu0HkXIMrlu1 zyQZxuVuutc1ibDBJTxtxjT9zZB/8ik4ScvVePdDZE8Lm3mL7bdVuuuD+1aUNX4Nrty/ 6lxfmgjr7++ds/9Oc+0FUUs1F0d0sygYrMneJl5D9IQee7oirkczi2GQ5Iy3DYWuODun 5bgw== X-Gm-Message-State: AA+aEWZCEMEtmAq2DYt5XhhduPjUyz8uN+6G1FjF91yH9QUGOBDE/F8I 1NvA3gqG0oG/HXBprqwQfQ6fzj0QBiWtLw== X-Google-Smtp-Source: AFSGD/V8nYwHkaSfC9q4P8YxzKPKhkqOwULRV+n8rJVT5cw4q3PvlZESIBiH06XMpo8qtqTZ2JLjmw== X-Received: by 2002:adf:e846:: with SMTP id d6mr14166016wrn.72.1542975289774; Fri, 23 Nov 2018 04:14:49 -0800 (PST) Received: from mba13.wifi.ns.nl (33.153.69.91.rev.sfr.net. [91.69.153.33]) by smtp.gmail.com with ESMTPSA id x79sm16469106wmd.42.2018.11.23.04.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Nov 2018 04:14:49 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Eric Auger , Andrew Jones , Philippe Mathieu-Daude , Julien Grall Date: Fri, 23 Nov 2018 13:14:30 +0100 Message-Id: <20181123121431.22353-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181123121431.22353-1-ard.biesheuvel@linaro.org> References: <20181123121431.22353-1-ard.biesheuvel@linaro.org> Subject: [PATCH 4/5] ArmVirtPkg: disregard PcdPrePiCpuMemorySize PCD when sizing the GCD space X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 12:14:52 -0000 Move the call to BuildCpuHob () into ArmVirtMemoryInitPeiLib (which is shared between all the ArmVirtPkg targets), and drop the inclusion of CpuPei.inf [which calls it on ArmVirtQemu] and the BuildCpuHob () call from ArmVirtPrePiUniCoreRelocatable [for the other targets]. This makes the size of the GCD address space and page table mappings depend only on the size of the physical address space as exposed by the CPU system registers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 1 - ArmVirtPkg/ArmVirtQemu.fdf | 1 - ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 3 +++ ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf | 1 + ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c | 5 +---- ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf | 1 - ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf | 1 - ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 3 --- ArmVirtPkg/PrePi/PrePi.c | 3 --- 9 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 885c6b14b844..cb59c790afcc 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -226,7 +226,6 @@ } ArmPlatformPkg/PlatformPei/PlatformPeim.inf ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf - ArmPkg/Drivers/CpuPei/CpuPei.inf MdeModulePkg/Universal/Variable/Pei/VariablePei.inf diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf index c6a22dc018f3..12bc570c4cb3 100644 --- a/ArmVirtPkg/ArmVirtQemu.fdf +++ b/ArmVirtPkg/ArmVirtQemu.fdf @@ -106,7 +106,6 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Core/Pei/PeiMain.inf INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf - INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c index 3f0e9b3a0579..3d86d31ab50e 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -116,5 +116,8 @@ MemoryPeim ( BuildMemoryTypeInformationHob (); } + // Publish the CPU memory and io spaces sizes + BuildCpuHob (ArmGetPhysicalAddressBits (), FixedPcdGet8 (PcdPrePiCpuIoSize)); + return EFI_SUCCESS; } diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf index 54879d590a8a..d0e39df84b20 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf @@ -59,6 +59,7 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize [Pcd] gArmTokenSpaceGuid.PcdSystemMemoryBase diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c index 4eca9b895354..ded87d604f4f 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c @@ -46,7 +46,6 @@ ArmVirtGetMemoryMap ( ) { ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; - UINT64 TopOfMemory; ASSERT (VirtualMemoryMap != NULL); @@ -80,11 +79,9 @@ ArmVirtGetMemoryMap ( VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; // Peripheral space after DRAM - TopOfMemory = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize), - TopOfAddressSpace); VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length; VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Length = TopOfMemory - + VirtualMemoryTable[2].Length = TopOfAddressSpace - VirtualMemoryTable[2].PhysicalBase; VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf index f2c461e3b55a..5c5b841051ad 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf @@ -45,4 +45,3 @@ [FixedPcd] gArmTokenSpaceGuid.PcdFdSize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf index f54fb51ee1d4..d12089760b22 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf @@ -49,4 +49,3 @@ [FixedPcd] gArmTokenSpaceGuid.PcdFdSize gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index 1587bd92f206..e04bd1b7c497 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -85,9 +85,6 @@ gArmPlatformTokenSpaceGuid.PcdCoreCount - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize - gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c index f6abe2f2016b..ecaaac1545c4 100755 --- a/ArmVirtPkg/PrePi/PrePi.c +++ b/ArmVirtPkg/PrePi/PrePi.c @@ -79,9 +79,6 @@ PrePiMain ( StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize); BuildStackHob (StacksBase, StacksSize); - //TODO: Call CpuPei as a library - BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); - // Set the Boot Mode SetBootMode (BOOT_WITH_FULL_CONFIGURATION); -- 2.17.1