From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web10.2001.1583231971510785084 for ; Tue, 03 Mar 2020 02:39:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=lbDCnrie; spf=pass (domain: linaro.org, ip: 209.85.128.68, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f68.google.com with SMTP id 6so2509614wmi.5 for ; Tue, 03 Mar 2020 02:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NbtXVT9lRkUtb4iLZnl0TdZgUoHX2MHXlI9TMa2zDZQ=; b=lbDCnrie9PhhHgGeHI2P3fZe5ba6hls3fzSfnGUE1PWeq+LNUxr8spY7YtlJvqSL3+ n4UU+E+sYoKW3Ckh+qhmtV7e1hOtxzYY3JEFaEHfuT2L8a4qPBSFi6xJ++45FVmY33Z0 46kWbt9DBEz13I9LisXmZh/R1c2/GMd0k5dWlLsuhILKVxP7exR3NiIw2Dt1rCCE9xTS oJIu3GnpWYTIWr7E5p1DQRm69VFj2KGn0JmN2WeWw0zQTeyXBtK6LHZsQ9oBLPDEiqEj 4l7aCO3a4QVh5wiuZuCL7KN5e3lppgMVVthIjQ/lXlSbylS0+3VYi9JcCVqcfyTso4qx 9gOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NbtXVT9lRkUtb4iLZnl0TdZgUoHX2MHXlI9TMa2zDZQ=; b=gtn45+HEqSWocsDVvciaUuUZxX6T+ylpXNGj8hd1sUQZfgz6sLwHUDUFkTLc8IO+YZ VdaN8JVXqZYH3Xt3/8JBIXbwB9cNw7/fXtQQbdQhbVJxWaa18pCQyN+fSx9imGlpE5fa 3qIZ8O30gFX1j+Q2+HRMxBR+NFumVHSoY410ruylvLB7n6QLel7Ta6rSr0ChTLMABGKq STm6pvdwaksz+t068zN1b1GiIULb2boqYYSXwDEkGAwBXdBOYoel1FPHvT6mKBkCEmTB 98zudeJ0umXqeAZ8oQKeMP+I2wZn4sa1O1VbikEvMr6w7RdN1diOZmcdX5koQojQkSNW Gy2g== X-Gm-Message-State: ANhLgQ0nclhgcxuW9UTcTYo0Z7m0LvoQ9hV+dL6A78qMaUkOiH9QoNTZ m8Uq7HGHvaMNGY6mhMmhIKXqjsaP61ApBrxOIR0OtQ== X-Google-Smtp-Source: ADFU+vsr+pw9+GvhAJlggNOwaUiA5CrxwdItLjsd9Bj0cOSd/TOtFF/PzpTuenocq1LwS98WfFCKm0NODTrqgc7p9k8= X-Received: by 2002:a7b:cb93:: with SMTP id m19mr3860340wmi.133.1583231970001; Tue, 03 Mar 2020 02:39:30 -0800 (PST) MIME-Version: 1.0 References: <20200303103339.7468-1-pete@akeo.ie> <20200303103339.7468-3-pete@akeo.ie> In-Reply-To: <20200303103339.7468-3-pete@akeo.ie> From: "Ard Biesheuvel" Date: Tue, 3 Mar 2020 11:39:19 +0100 Message-ID: Subject: Re: [edk2-devel][PATCH 2/5] Platform/RPi: Separate RAM descriptors between 0-3 GB and 3+ GB To: Pete Batard Cc: edk2-devel-groups-io , Leif Lindholm , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= , Andrei Warkentin Content-Type: text/plain; charset="UTF-8" On Tue, 3 Mar 2020 at 11:33, Pete Batard wrote: > > From: Andrei Warkentin > > This is required so that we can make the 3 to 4 GB segment of > the Raspberry Pi 4 a user-configurable option. > > This also removes the need for the PcdAcpiBasicMode PCD. > > Signed-off-by: Pete Batard Please fix the commit log so it is clear what 'this' means > --- > Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 3 -- > Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 33 ++++++++++++++------ > 2 files changed, 23 insertions(+), 13 deletions(-) > > diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf > index 9abcc2cc0075..77cdbe399a06 100644 > --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf > +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf > @@ -59,8 +59,5 @@ [FixedPcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize > > -[FeaturePcd] > - gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode > - > [Ppis] > gArmMpCoreInfoPpiGuid > diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > index 4b388465cdde..3f257d4fa528 100644 > --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > @@ -25,7 +25,7 @@ UINT32 mBoardRevision; > > > // The total number of descriptors, including the final "end-of-table" descriptor. > -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 10 > +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 11 > > STATIC BOOLEAN VirtualMemoryInfoInitialized = FALSE; > STATIC RPI_MEMORY_REGION_INFO VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS]; > @@ -60,6 +60,7 @@ ArmPlatformGetVirtualMemoryMap ( > { > UINTN Index = 0; > UINTN GpuIndex; > + INT64 OrigMemorySize; > INT64 SystemMemorySize; > ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; > > @@ -78,7 +79,6 @@ ArmPlatformGetVirtualMemoryMap ( > return; > } > > - > // Firmware Volume > VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdFdBaseAddress); > VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; Drop this hunk please > @@ -155,13 +155,13 @@ ArmPlatformGetVirtualMemoryMap ( > VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION; > VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)"; > > - if (FeaturePcdGet (PcdAcpiBasicMode)) { > - // > - // Limit the memory to 3 GB to work around the DMA bugs in the SoC without > - // having to rely on IORT or _DMA descriptions. > - // > - SystemMemorySize = MIN(SystemMemorySize, 3U * SIZE_1GB); > - } > + // > + // By default we limit the memory to 3 GB to work around the DMA bugs in the SoC, for > + // OSes that don't support _DMA range descriptors. On 4GB boards, it's runtime > + // setting to boot with 4GB, and the additional 1GB is added by ConfigDxe. > + // > + OrigMemorySize = SystemMemorySize; > + SystemMemorySize = MIN(SystemMemorySize, 3U * SIZE_1GB); > > // If we have RAM above the 1 GB mark, declare it > if (SystemMemorySize - SIZE_1GB > 0) { > @@ -170,7 +170,20 @@ ArmPlatformGetVirtualMemoryMap ( > VirtualMemoryTable[Index].Length = SystemMemorySize - SIZE_1GB; > VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > VirtualMemoryInfo[Index].Type = RPI_MEM_BASIC_REGION; > - VirtualMemoryInfo[Index++].Name = L"Extended System RAM"; > + VirtualMemoryInfo[Index++].Name = L"Extended System RAM below 3GB"; > + } > + > + // > + // If we have RAM above 3 GB mark, declare it so it's mapped, but > + // don't add it to the memory map. This is done later by ConfigDxe if necessary. > + // > + if (OrigMemorySize > (3UL * SIZE_1GB)) { > + VirtualMemoryTable[Index].PhysicalBase = 3UL * SIZE_1GB; > + VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > + VirtualMemoryTable[Index].Length = OrigMemorySize - VirtualMemoryTable[Index].PhysicalBase; > + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION; > + VirtualMemoryInfo[Index++].Name = L"Extended System RAM above 3GB"; > } > > // End of Table > -- > 2.21.0.windows.1 >