public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork
@ 2019-11-19 11:38 Pete Batard
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Pete Batard
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

Changes from v1 (https://edk2.groups.io/g/devel/message/50689 - 50697):
- Split missing "Raspberry Pi Compute Module 3+" model from the "model name" patch
- Update Samer's e-mail address
- Drop leading __ in new header guards
- List new PCDs, headers and LibraryClasses in alphabetical order where possible
- Use a single PCD for the SoC registers base address and use offsets to derive
  the other registers address from that PCD
- Add a comment in RaspberryPiHelper.S to indicate that x1 keeps its value
- Mention that RaspberryPiMem.c is derived from code from ArmJunoMem.c

Pete Batard (3):
  Silicon/Broadcom: Add Bcm2711 header
  Platform/RPi: Read more variables from VideoCore during early init
  Platform/RPi: Clean up and improve early memory init

Samer El-Haj-Mahmoud (4):
  Platform/RPi: Add missing model name
  Platform/RPi: Add model family detection
  Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  Platform/RPi: Use offsets for Bcm238x SoC register addresses

 Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf   |   2 +
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf                 |   2 +
 Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf           |   4 +
 Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h                    |   4 +-
 Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c         |  64 +++++
 Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf       |   5 +-
 Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf                 |   2 +
 Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h              |   1 +
 Platform/RaspberryPi/Include/Library/RPiMem.h                        |  26 ++
 Platform/RaspberryPi/Include/Protocol/RpiFirmware.h                  |   8 +
 Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c     |  94 ++++---
 Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf   |   1 +
 Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S |  76 +++++-
 Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf             |   6 +-
 Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c            | 256 +++++++++++---------
 Platform/RaspberryPi/RPi3/RPi3.dsc                                   |   7 +-
 Platform/RaspberryPi/RaspberryPi.dec                                 |   1 +
 Silicon/Broadcom/Bcm27xx/Bcm27xx.dec                                 |  22 ++
 Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h          |  15 ++
 Silicon/Broadcom/Bcm283x/Bcm283x.dec                                 |   7 +
 Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf       |   4 +-
 Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf                   |   5 +
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h          |  11 +-
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h      |   4 +-
 Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf                 |   4 +
 25 files changed, 459 insertions(+), 172 deletions(-)
 create mode 100644 Platform/RaspberryPi/Include/Library/RPiMem.h
 create mode 100644 Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
 create mode 100644 Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h

-- 
2.21.0.windows.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 12:02   ` Philippe Mathieu-Daudé
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 2/7] Platform/RPi: Add model family detection Pete Batard
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>

Add a missing entry for the "Raspberry Pi Compute Module 3+" in
RpiFirmwareGetModelName ().

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
index 9b4aa068857c..dcb434fabefe 100644
--- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
+++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
@@ -1,5 +1,6 @@
 /** @file
  *
+ *  Copyright (c) 2019, ARM Limited. All rights reserved.
  *  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
  *  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
  *
@@ -595,6 +596,8 @@ RpiFirmwareGetModelName (
     return "Raspberry Pi 3 Model B+";
   case 0x0E:
     return "Raspberry Pi 3 Model A+";
+  case 0x10:
+    return "Raspberry Pi Compute Module 3+";
   case 0x11:
     return "Raspberry Pi 4 Model B";
   default:
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 2/7] Platform/RPi: Add model family detection
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Pete Batard
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>

Add GetModelFamily to RASPBERRY_PI_FIRMWARE_PROTOCOL.

This uses the board revision to return a numeric value representing
the RPi family (1=RPi, 2=RPi2, 3=RPi3 and 4=RPi4).

Knowing the Pi family will help us set the SD card routing when we
introduce support for the Pi 4 and should also be easier to maintain
than if using individual model detection.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 61 ++++++++++++++++++++
 Platform/RaspberryPi/Include/Protocol/RpiFirmware.h          |  8 +++
 2 files changed, 69 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
index dcb434fabefe..dd61ef089ca7 100644
--- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
+++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
@@ -605,6 +605,66 @@ RpiFirmwareGetModelName (
   }
 }
 
+STATIC
+EFI_STATUS
+EFIAPI
+RPiFirmwareGetModelFamily (
+  OUT   UINT32 *ModelFamily
+  )
+{
+  EFI_STATUS                  Status;
+  UINT32                      Revision;
+  UINT32                      ModelId;
+
+  Status = RpiFirmwareGetModelRevision(&Revision);
+  if (EFI_ERROR(Status)) {
+    DEBUG ((DEBUG_ERROR,
+      "%a: Could not get the board revision: Status == %r\n",
+      __FUNCTION__, Status));
+    return EFI_DEVICE_ERROR;
+  } else {
+    ModelId = (Revision >> 4) & 0xFF;
+  }
+
+  switch (ModelId) {
+  // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
+  case 0x00:          // Raspberry Pi Model A
+  case 0x01:          // Raspberry Pi Model B
+  case 0x02:          // Raspberry Pi Model A+
+  case 0x03:          // Raspberry Pi Model B+
+  case 0x06:          // Raspberry Pi Compute Module 1
+  case 0x09:          // Raspberry Pi Zero
+  case 0x0C:          // Raspberry Pi Zero W
+      *ModelFamily = 1;
+      break;
+  case 0x04:          // Raspberry Pi 2 Model B
+      *ModelFamily = 2;
+      break;
+  case 0x08:          // Raspberry Pi 3 Model B
+  case 0x0A:          // Raspberry Pi Compute Module 3
+  case 0x0D:          // Raspberry Pi 3 Model B+
+  case 0x0E:          // Raspberry Pi 3 Model A+
+  case 0x10:          // Raspberry Pi Compute Module 3+
+      *ModelFamily = 3;
+      break;
+  case 0x11:          // Raspberry Pi 4 Model B
+      *ModelFamily = 4;
+      break;
+  default:
+      *ModelFamily = 0;
+      break;
+  }
+
+  if (*ModelFamily == 0) {
+    DEBUG ((DEBUG_ERROR,
+      "%a: Unknown Raspberry Pi model family : ModelId == 0x%x\n",
+      __FUNCTION__, ModelId));
+    return EFI_UNSUPPORTED;
+    }
+
+  return EFI_SUCCESS;
+}
+
 STATIC
 CHAR8*
 EFIAPI
@@ -1171,6 +1231,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL mRpiFirmwareProtocol = {
   RpiFirmwareGetModel,
   RpiFirmwareGetModelRevision,
   RpiFirmwareGetModelName,
+  RPiFirmwareGetModelFamily,
   RpiFirmwareGetFirmwareRevision,
   RpiFirmwareGetManufacturerName,
   RpiFirmwareGetCpuName,
diff --git a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h b/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h
index e49d6e6132d9..e3287e3c040f 100644
--- a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h
+++ b/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h
@@ -1,5 +1,6 @@
 /** @file
  *
+ *  Copyright (c) 2019, ARM Limited. All rights reserved.
  *  Copyright (c) 2016, Linaro Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -102,6 +103,12 @@ CHAR8*
   INTN ModelId
   );
 
+typedef
+EFI_STATUS
+(EFIAPI *GET_MODEL_FAMILY) (
+  UINT32 *ModelFamily
+  );
+
 typedef
 EFI_STATUS
 (EFIAPI *GET_FIRMWARE_REVISION) (
@@ -143,6 +150,7 @@ typedef struct {
   GET_MODEL             GetModel;
   GET_MODEL_REVISION    GetModelRevision;
   GET_MODEL_NAME        GetModelName;
+  GET_MODEL_FAMILY      GetModelFamily;
   GET_FIRMWARE_REVISION GetFirmwareRevision;
   GET_MANUFACTURER_NAME GetManufacturerName;
   GET_CPU_NAME          GetCpuName;
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Pete Batard
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 2/7] Platform/RPi: Add model family detection Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 11:43   ` Philippe Mathieu-Daudé
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses Pete Batard
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>

Define BCM2836_SOC_REGISTERS from PcdBcm283xRegistersAddress. This is
needed in preparation for adding Raspberry Pi 4 support, since the two
Pi's have a different base addresses for the Bcm283x specific registers.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf | 2 ++
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf               | 2 ++
 Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf         | 4 ++++
 Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf     | 5 ++++-
 Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf               | 2 ++
 Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf           | 3 ++-
 Platform/RaspberryPi/RPi3/RPi3.dsc                                 | 7 ++++++-
 Silicon/Broadcom/Bcm283x/Bcm283x.dec                               | 7 +++++++
 Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf     | 4 +++-
 Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf                 | 5 +++++
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h        | 3 ++-
 Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf               | 4 ++++
 12 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
index 3f0d7b6b9e9d..6db8a1c5e400 100644
--- a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
+++ b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
@@ -1,5 +1,6 @@
 #/** @file
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
 #  Copyright (c) Microsoft Corporation. All rights reserved.
 #
@@ -41,6 +42,7 @@ [Protocols]
   gRaspberryPiFirmwareProtocolGuid ## CONSUMES
 
 [Pcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
   gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
 
 [Depex]
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
index 28fc2682b585..817cb98c1933 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
@@ -1,5 +1,6 @@
 #/** @file
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -54,6 +55,7 @@ [Protocols]
   gRaspberryPiConfigAppliedProtocolGuid ## PRODUCES
 
 [Pcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
   gRaspberryPiTokenSpaceGuid.PcdCpuClock
   gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock
   gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
index e880c2fb0261..8817f20622d6 100644
--- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
+++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
@@ -1,5 +1,6 @@
 #/** @file
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
 #  Copyright (c) 2015-2016, Linaro Limited. All rights reserved.
 #
@@ -51,5 +52,8 @@ [Protocols]
   gEfiUsb2HcProtocolGuid
   gRaspberryPiFirmwareProtocolGuid
 
+[FixedPcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
+
 [Depex]
   gRaspberryPiFirmwareProtocolGuid
diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
index 87bca98fec28..a3fc0fa49a3c 100644
--- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
+++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
@@ -1,5 +1,5 @@
 #/** @file
-#
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
 #  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
 #
@@ -40,5 +40,8 @@ [LibraryClasses]
 [Protocols]
   gRaspberryPiFirmwareProtocolGuid    ## PRODUCES
 
+[FixedPcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
+
 [Depex]
   TRUE
diff --git a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
index 7386ff251864..ca8b30700328 100644
--- a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
+++ b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
@@ -1,5 +1,6 @@
 #/** @file
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
 #  Copyright (c) Microsoft Corporation. All rights reserved.
 #
@@ -43,6 +44,7 @@ [Protocols]
   gRaspberryPiFirmwareProtocolGuid ## CONSUMES
 
 [Pcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
   gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
 
 [Depex]
diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
index ed986034b957..bcc6f8b6ec13 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
@@ -2,7 +2,7 @@
 #
 #  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
 #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
-#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+#  Copyright (c) 2011-2019, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -47,6 +47,7 @@ [FixedPcd]
   gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
   gArmTokenSpaceGuid.PcdArmPrimaryCore
   gArmTokenSpaceGuid.PcdFdSize
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset
   gArmTokenSpaceGuid.PcdSystemMemoryBase
   gArmTokenSpaceGuid.PcdSystemMemorySize
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index a0365c5cf606..98c75e373fa7 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -1,6 +1,6 @@
 # @file
 #
-#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2011 - 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
 #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 #  Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
@@ -372,6 +372,11 @@ [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
   gArmTokenSpaceGuid.PcdSystemMemorySize|0x3FC00000
 
+  #
+  # Device specific addresses
+  #
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000
+
   ## NS16550 compatible UART
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
index ec62ff27fbb3..5b839b00d286 100644
--- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec
+++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
@@ -1,5 +1,6 @@
 ## @file
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -14,3 +15,9 @@ [Defines]
 
 [Includes]
   Include
+
+[Guids]
+  gBcm283xTokenSpaceGuid = {0x82f36a92, 0xfb7e, 0x43a1, {0xb9, 0x9e, 0x49, 0x13, 0x3f, 0xc7, 0xa4, 0x2e}}
+
+[PcdsFixedAtBuild.common]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001
diff --git a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
index cdce11a51e14..f984c4b52623 100644
--- a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
+++ b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
@@ -1,5 +1,5 @@
 #/** @file
-#
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
 #  Copyright (c) 2016 Linaro, Ltd. All rights reserved.
 #
@@ -27,6 +27,7 @@ [LibraryClasses]
   BaseLib
   DebugLib
   IoLib
+  PcdLib
   UefiBootServicesTableLib
   UefiLib
   UefiDriverEntryPoint
@@ -36,6 +37,7 @@ [Protocols]
   gEfiCpuArchProtocolGuid         ## CONSUMES ## NOTIFY
 
 [FixedPcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
   gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
 
 [Depex]
diff --git a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf b/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
index cb1695bd2dfc..8eb90de85cfd 100644
--- a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
+++ b/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
@@ -1,5 +1,6 @@
 #/** @file
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2019 Linaro, Ltd. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -26,6 +27,7 @@ [LibraryClasses]
   BaseMemoryLib
   DebugLib
   IoLib
+  PcdLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
 
@@ -35,5 +37,8 @@ [Protocols]
 [Guids]
   gEfiRngAlgorithmRaw
 
+[FixedPcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
+
 [Depex]
   TRUE
diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
index 4007301228be..8bd68c234bfd 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -1,5 +1,6 @@
 /** @file
  *
+ *  Copyright (c) 2019, ARM Limited. All rights reserved.
  *  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
  *  Copyright (c) 2016, Linaro Limited. All rights reserved.
  *
@@ -13,7 +14,7 @@
 /*
  * Both "core" and SoC perpherals (1M each).
  */
-#define BCM2836_SOC_REGISTERS                               0x3f000000
+#define BCM2836_SOC_REGISTERS                               (FixedPcdGet64 (PcdBcm283xRegistersAddress))
 #define BCM2836_SOC_REGISTER_LENGTH                         0x02000000
 
 /*
diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
index 50da4eb771f3..ff1b5af6db6e 100644
--- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
+++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
@@ -2,6 +2,7 @@
 #
 #  Manipulate GPIOs.
 #
+#  Copyright (c) 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -30,4 +31,7 @@ [LibraryClasses]
   DebugLib
   IoLib
 
+[FixedPcd]
+  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
+
 [Guids]
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
                   ` (2 preceding siblings ...)
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 11:46   ` Philippe Mathieu-Daudé
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header Pete Batard
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>

Remove hardcoded base addresses for Mailbox, Watchdog, SDIO and
DW2 USB and use an offset indexed on PcdBcm283xRegistersAddress
instead. This is needed in preparation for adding Raspberry Pi 4
support.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h               | 4 +++-
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h     | 8 ++++++--
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h | 4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
index 88fd93934fd3..ddbf69a1d608 100644
--- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
+++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
@@ -10,7 +10,9 @@
 #ifndef __DWCHW_H__
 #define __DWCHW_H__
 
-#define DW2_USB_BASE_ADDRESS            0x3f980000
+#define DW2_USB_OFFSET                  0x00980000
+#define DW2_USB_BASE_ADDRESS            (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                                        + DW2_USB_OFFSET)
 
 #define HSOTG_REG(x)    (x)
 
diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
index 8bd68c234bfd..72c8e9dc4b14 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -23,7 +23,9 @@
 #define BCM2836_DMA_DEVICE_OFFSET                           0xc0000000
 
 /* watchdog constants */
-#define BCM2836_WDOG_BASE_ADDRESS                           0x3f100000
+#define BCM2836_WDOG_OFFSET                                 0x00100000
+#define BCM2836_WDOG_BASE_ADDRESS                           (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                                                            + BCM2836_WDOG_OFFSET)
 #define BCM2836_WDOG_PASSWORD                               0x5a000000
 #define BCM2836_WDOG_RSTC_OFFSET                            0x0000001c
 #define BCM2836_WDOG_WDOG_OFFSET                            0x00000024
@@ -31,7 +33,9 @@
 #define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET                  0x00000020
 
 /* mailbox interface constants */
-#define BCM2836_MBOX_BASE_ADDRESS                           0x3f00b880
+#define BCM2836_MBOX_OFFSET                                 0x0000b880
+#define BCM2836_MBOX_BASE_ADDRESS                           (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                                                            + BCM2836_MBOX_OFFSET)
 #define BCM2836_MBOX_READ_OFFSET                            0x00000000
 #define BCM2836_MBOX_STATUS_OFFSET                          0x00000018
 #define BCM2836_MBOX_CONFIG_OFFSET                          0x0000001c
diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
index fb0d02904156..708a1d7a4f47 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
@@ -10,7 +10,9 @@
 #define __BCM2836_SDIO_H__
 
 //MMC/SD/SDIO1 register definitions.
-#define MMCHS1BASE        0x3F300000
+#define MMCHS1_OFFSET     0x00300000
+#define MMCHS1BASE        (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                          + MMCHS1_OFFSET)
 
 #define MMCHS_BLK         (MMCHS1BASE + 0x4)
 #define BLEN_512BYTES     (0x200UL << 0)
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
                   ` (3 preceding siblings ...)
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 11:51   ` Philippe Mathieu-Daudé
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 6/7] Platform/RPi: Read more variables from VideoCore during early init Pete Batard
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

Bcm2711 is the SoC used by the Raspberry Pi 4. For the most part it
is backward compatible with the Bcm283x SoC used by older models but
some new Bcm2711 registers have been introduced such as the ones for
PCIe.

We therefore introduce a new Bcm27xx module, which contains only the
base address for the new registers for now (set from a PCD as is the
case for Bcm283x) but which should get populated further as we add
support for the Raspberry Pi 4.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 Silicon/Broadcom/Bcm27xx/Bcm27xx.dec                        | 22 ++++++++++++++++++++
 Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h | 15 +++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec b/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
new file mode 100644
index 000000000000..815302f6d209
--- /dev/null
+++ b/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
@@ -0,0 +1,22 @@
+## @file
+#
+#  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  DEC_SPECIFICATION              = 0x0001001A
+  PACKAGE_NAME                   = Bcm27xxPkg
+  PACKAGE_GUID                   = D4B585C5-EBCA-4779-B974-05A3CF2F10C4
+  PACKAGE_VERSION                = 1.0
+
+[Includes]
+  Include
+
+[Guids]
+  gBcm27xxTokenSpaceGuid = {0x44045e56, 0x7056, 0x4be6, {0x88, 0xc0, 0x49, 0x0c, 0x67, 0x90, 0x2f, 0xba}}
+
+[PcdsFixedAtBuild.common]
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0x0|UINT32|0x00000001
diff --git a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
new file mode 100644
index 000000000000..356458024e84
--- /dev/null
+++ b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
@@ -0,0 +1,15 @@
+/** @file
+ *
+ *  Copyright (c) 2019, Pete Batard <pete@akeo.ie>.
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#ifndef BCM2711_H__
+#define BCM2711_H__
+
+#define BCM2711_SOC_REGISTERS               (FixedPcdGet64 (PcdBcm27xxRegistersAddress))
+#define BCM2711_SOC_REGISTER_LENGTH         0x02000000
+
+#endif /* BCM2711_H__ */
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 6/7] Platform/RPi: Read more variables from VideoCore during early init
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
                   ` (4 preceding siblings ...)
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 7/7] Platform/RPi: Clean up and improve early memory init Pete Batard
  2019-11-19 18:20 ` [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Leif Lindholm
  7 siblings, 0 replies; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

Besides the base memory size, we can read the GPU/VideoCore base as
well as the model during early init, which we'll need for improving
the memory mapping.

This patch adds the retrieval of these variables, as well as some
early debug display of their values (which can be useful) and also
removes unused variables such as mGPUMemoryBase and mGPUMemoryLength.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h              |  1 +
 Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S | 76 ++++++++++++++++++--
 Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c            | 14 +++-
 3 files changed, 85 insertions(+), 6 deletions(-)

diff --git a/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h b/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h
index d3b6f117cfdf..584786a61dfd 100644
--- a/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h
+++ b/Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h
@@ -34,6 +34,7 @@
 #define RPI_MBOX_GET_MAC_ADDRESS                              0x00010003
 #define RPI_MBOX_GET_BOARD_SERIAL                             0x00010004
 #define RPI_MBOX_GET_ARM_MEMSIZE                              0x00010005
+#define RPI_MBOX_GET_VC_MEMSIZE                               0x00010006
 
 #define RPI_MBOX_SET_POWER_STATE                              0x00028001
 
diff --git a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S
index 36af208d12d8..cc58406e1bfc 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S
+++ b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S
@@ -1,5 +1,6 @@
 /** @file
  *
+ *  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
  *  Copyright (c) 2016, Linaro Limited. All rights reserved.
  *  Copyright (c) 2011-2013, ARM Limited. All rights reserved.
  *
@@ -39,6 +40,7 @@ ASM_FUNC (ArmPlatformPeiBootAction)
     adr     x0, .Lmeminfo_buffer
     mov     x1, #FixedPcdGet64 (PcdDmaDeviceOffset)
     orr     x0, x0, #RPI_MBOX_VC_CHANNEL
+    // x1 holds the value of PcdDmaDeviceOffset throughout this function
     add     x0, x0, x1
 
     MOV32   (x4, BCM2836_MBOX_BASE_ADDRESS)
@@ -52,24 +54,90 @@ ASM_FUNC (ArmPlatformPeiBootAction)
     ldr     wzr, [x4, #BCM2836_MBOX_READ_OFFSET]
     dmb     ld
 
+    ldr     w0, .Lmembase
+    adr     x2, mSystemMemoryBase
+    str     x0, [x2]
+
     ldr     w0, .Lmemsize
     sub     x0, x0, #1
-    adr     x1, mSystemMemoryEnd
-    str     x0, [x1]
+    adr     x2, mSystemMemoryEnd
+    str     x0, [x2]
+
+    adr     x0, .Lvcinfo_buffer
+    orr     x0, x0, #RPI_MBOX_VC_CHANNEL
+    add     x0, x0, x1
+
+    poll    BCM2836_MBOX_STATUS_FULL
+    str     w0, [x4, #BCM2836_MBOX_WRITE_OFFSET]
+    dmb     sy
+    poll    BCM2836_MBOX_STATUS_EMPTY
+    dmb     sy
+    ldr     wzr, [x4, #BCM2836_MBOX_READ_OFFSET]
+    dmb     ld
+
+    ldr     w0, .Lvcbase
+    adr     x2, mVideoCoreBase
+    str     x0, [x2]
+
+    ldr     w0, .Lvcsize
+    adr     x2, mVideoCoreSize
+    str     x0, [x2]
+
+    adr     x0, .Lrevinfo_buffer
+    orr     x0, x0, #RPI_MBOX_VC_CHANNEL
+    add     x0, x0, x1
+
+    poll    BCM2836_MBOX_STATUS_FULL
+    str     w0, [x4, #BCM2836_MBOX_WRITE_OFFSET]
+    dmb     sy
+    poll    BCM2836_MBOX_STATUS_EMPTY
+    dmb     sy
+    ldr     wzr, [x4, #BCM2836_MBOX_READ_OFFSET]
+    dmb     ld
+
+    ldr     w0, .Lrevision
+    adr     x2, mBoardRevision
+    str     w0, [x2]
+
     ret
 
     .align  4
 .Lmeminfo_buffer:
-    .long   .Lbuffer_size
+    .long   .Lmeminfo_size
     .long   0x0
     .long   RPI_MBOX_GET_ARM_MEMSIZE
     .long   8                           // buf size
     .long   0                           // input len
+.Lmembase:
     .long   0                           // mem base
 .Lmemsize:
     .long   0                           // mem size
     .long   0                           // end tag
-    .set    .Lbuffer_size, . - .Lmeminfo_buffer
+    .set    .Lmeminfo_size, . - .Lmeminfo_buffer
+
+.Lvcinfo_buffer:
+    .long   .Lvcinfo_size
+    .long   0x0
+    .long   RPI_MBOX_GET_VC_MEMSIZE
+    .long   8                           // buf size
+    .long   0                           // input len
+.Lvcbase:
+    .long   0                           // videocore base
+.Lvcsize:
+    .long   0                           // videocore size
+    .long   0                           // end tag
+    .set    .Lvcinfo_size, . - .Lvcinfo_buffer
+
+.Lrevinfo_buffer:
+    .long   .Lrevinfo_size
+    .long   0x0
+    .long   RPI_MBOX_GET_BOARD_REVISION
+    .long   4                           // buf size
+    .long   0                           // input len
+.Lrevision:
+    .long   0                           // revision
+    .long   0                           // end tag
+    .set    .Lrevinfo_size, . - .Lrevinfo_buffer
 
 //UINTN
 //ArmPlatformGetPrimaryCoreMpId (
diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
index 97d5af5260c6..2bfd3f020a6e 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
+++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
@@ -12,9 +12,11 @@
 #include <IndustryStandard/Bcm2836.h>
 #include <Library/PcdLib.h>
 
+UINT64 mSystemMemoryBase;
 extern UINT64 mSystemMemoryEnd;
-extern UINT64 mGPUMemoryBase;
-extern UINT64 mGPUMemoryLength;
+UINT64 mVideoCoreBase;
+UINT64 mVideoCoreSize;
+UINT32 mBoardRevision;
 
 #define VariablesSize (FixedPcdGet32(PcdFlashNvStorageVariableSize) +   \
                        FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) + \
@@ -87,6 +89,14 @@ ArmPlatformGetVirtualMemoryMap (
   IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
   )
 {
+  // Early output of the info we got from VideoCore can prove valuable.
+  DEBUG ((DEBUG_INFO, "Board Rev: 0x%lX\n", mBoardRevision));
+  DEBUG ((DEBUG_INFO, "Base RAM : 0x%ll08X (Size 0x%ll08X)\n", mSystemMemoryBase, mSystemMemoryEnd + 1));
+  DEBUG ((DEBUG_INFO, "VideoCore: 0x%ll08X (Size 0x%ll08X)\n", mVideoCoreBase, mVideoCoreSize));
+
+  ASSERT (mSystemMemoryBase == 0);
+  ASSERT (VirtualMemoryMap != NULL);
+
   RaspberryPiMemoryRegionDescriptor[3].Length = mSystemMemoryEnd + 1 -
     FixedPcdGet64 (PcdSystemMemoryBase);
 
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [edk2-platforms][PATCH v2 7/7] Platform/RPi: Clean up and improve early memory init
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
                   ` (5 preceding siblings ...)
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 6/7] Platform/RPi: Read more variables from VideoCore during early init Pete Batard
@ 2019-11-19 11:38 ` Pete Batard
  2019-11-19 18:20 ` [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Leif Lindholm
  7 siblings, 0 replies; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:38 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm, philmd, samer.el-haj-mahmoud

This patch improves memory initialization for the Raspberry Pi Platform by:

Using VideoCore mailbox data to reserve only the regions that are actually
mapped. Especially, besides the base RAM size, which was already set using
VideoCore data, we can set the GPU/VideoCore base address as well as the
extended RAM, which is the memory beyond 1 GB that is available on models
such as the Raspberry Pi 4 (for the 2GB or 4GB versions).

Introducing a new PcdExtendedMemoryBase PCD for the base address of the
extended memory region, which currently cannot be retrieved from VideoCore
(MBOX_GET_ARM_MEMSIZE still only returns a single region on Bcm2711).

Introducing a new RpiPlatformGetVirtualMemoryInfo() companion call to
ArmPlatformGetVirtualMemoryMap() that allows us greatly simplify the
registration of each segment in MemoryPeim() as well as making it easier
to maintain for future models.

We also fix SoC register space that should have been marked as reserved
but wasn't until now and remove the unreferenced mSystemMemoryEnd extern
in MemoryInitPeiLib.c.

RaspberryPiMem.c incorporates some code from ArmJunoMem.c.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Include/Library/RPiMem.h                      |  26 +++
 Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c   |  94 ++++----
 Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf |   1 +
 Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf           |   3 +
 Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c          | 242 +++++++++++---------
 Platform/RaspberryPi/RaspberryPi.dec                               |   1 +
 6 files changed, 210 insertions(+), 157 deletions(-)

diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/RaspberryPi/Include/Library/RPiMem.h
new file mode 100644
index 000000000000..9d38e4b6cfb3
--- /dev/null
+++ b/Platform/RaspberryPi/Include/Library/RPiMem.h
@@ -0,0 +1,26 @@
+/** @file
+ *
+ *  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#ifndef RPI_MEM_H__
+#define RPI_MEM_H__
+
+#define RPI_MEM_BASIC_REGION    0
+#define RPI_MEM_RUNTIME_REGION  1
+#define RPI_MEM_RESERVED_REGION 2
+
+typedef struct {
+  CONST CHAR16*                 Name;
+  UINTN                         Type;
+} RPI_MEMORY_REGION_INFO;
+
+VOID
+RpiPlatformGetVirtualMemoryInfo (
+  IN RPI_MEMORY_REGION_INFO** MemoryInfo
+  );
+
+#endif /* RPI_MEM_H__ */
diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
index 60cf397f8baa..3a0f7e19e993 100644
--- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
+++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
@@ -15,8 +15,7 @@
 #include <Library/HobLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/PcdLib.h>
-
-extern UINT64 mSystemMemoryEnd;
+#include <Library/RPiMem.h>
 
 VOID
 BuildMemoryTypeInformationHob (
@@ -39,23 +38,32 @@ InitMmu (
   }
 }
 
+STATIC
+VOID
+AddBasicMemoryRegion (
+  IN ARM_MEMORY_REGION_DESCRIPTOR *Desc
+)
+{
+  BuildResourceDescriptorHob (
+    EFI_RESOURCE_SYSTEM_MEMORY,
+    EFI_RESOURCE_ATTRIBUTE_PRESENT |
+    EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+    EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+    EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+    EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
+    EFI_RESOURCE_ATTRIBUTE_TESTED,
+    Desc->PhysicalBase,
+    Desc->Length
+  );
+}
+
 STATIC
 VOID
 AddRuntimeServicesRegion (
   IN ARM_MEMORY_REGION_DESCRIPTOR *Desc
 )
 {
-  BuildResourceDescriptorHob (
-    EFI_RESOURCE_SYSTEM_MEMORY,
-    EFI_RESOURCE_ATTRIBUTE_PRESENT |
-    EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
-    EFI_RESOURCE_ATTRIBUTE_TESTED,
-    Desc->PhysicalBase,
-    Desc->Length
-  );
+  AddBasicMemoryRegion (Desc);
 
   BuildMemoryAllocationHob (
     Desc->PhysicalBase,
@@ -70,17 +78,7 @@ AddReservedMemoryRegion (
   IN ARM_MEMORY_REGION_DESCRIPTOR *Desc
   )
 {
-  BuildResourceDescriptorHob (
-    EFI_RESOURCE_SYSTEM_MEMORY,
-    EFI_RESOURCE_ATTRIBUTE_PRESENT |
-    EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
-    EFI_RESOURCE_ATTRIBUTE_TESTED,
-    Desc->PhysicalBase,
-    Desc->Length
-  );
+  AddBasicMemoryRegion (Desc);
 
   BuildMemoryAllocationHob (
     Desc->PhysicalBase,
@@ -89,6 +87,12 @@ AddReservedMemoryRegion (
   );
 }
 
+void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) = {
+  AddBasicMemoryRegion,
+  AddRuntimeServicesRegion,
+  AddReservedMemoryRegion,
+  };
+
 /*++
 
 Routine Description:
@@ -113,36 +117,28 @@ MemoryPeim (
   )
 {
   ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable;
+  RPI_MEMORY_REGION_INFO       *MemoryInfo;
+  UINTN                        Index;
 
   // Get Virtual Memory Map from the Platform Library
   ArmPlatformGetVirtualMemoryMap (&MemoryTable);
 
-  // Ensure PcdSystemMemorySize has been set
-  ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
+  // Get additional info not provided by MemoryTable
+  RpiPlatformGetVirtualMemoryInfo (&MemoryInfo);
 
-  // FD without variable store
-  AddReservedMemoryRegion (&MemoryTable[0]);
-
-  // Variable store.
-  AddRuntimeServicesRegion (&MemoryTable[1]);
-
-  // Trusted Firmware region
-  AddReservedMemoryRegion (&MemoryTable[2]);
-
-  // Usable memory.
-  BuildResourceDescriptorHob (
-    EFI_RESOURCE_SYSTEM_MEMORY,
-    EFI_RESOURCE_ATTRIBUTE_PRESENT |
-    EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
-    EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
-    EFI_RESOURCE_ATTRIBUTE_TESTED,
-    MemoryTable[3].PhysicalBase,
-    MemoryTable[3].Length
-  );
-
-  AddReservedMemoryRegion (&MemoryTable[4]);
+  // Register each memory region
+  for (Index = 0; MemoryTable[Index].Length != 0; Index++) {
+    ASSERT (MemoryInfo[Index].Type < ARRAY_SIZE (AddRegion));
+    DEBUG ((DEBUG_INFO, "%s:\n"
+      "\tPhysicalBase: 0x%lX\n"
+      "\tVirtualBase: 0x%lX\n"
+      "\tLength: 0x%lX\n",
+      MemoryInfo[Index].Name,
+      MemoryTable[Index].PhysicalBase,
+      MemoryTable[Index].VirtualBase,
+      MemoryTable[Index].Length));
+    AddRegion[MemoryInfo[Index].Type] (&MemoryTable[Index]);
+  }
 
   // Build Memory Allocation Hob
   InitMmu (MemoryTable);
diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf
index 0084c010936d..d39210c7a4f1 100644
--- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf
+++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf
@@ -24,6 +24,7 @@ [Packages]
   EmbeddedPkg/EmbeddedPkg.dec
   ArmPkg/ArmPkg.dec
   ArmPlatformPkg/ArmPlatformPkg.dec
+  Platform/RaspberryPi/RaspberryPi.dec
 
 [LibraryClasses]
   DebugLib
diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
index bcc6f8b6ec13..77cdbe399a06 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
@@ -22,6 +22,7 @@ [Packages]
   EmbeddedPkg/EmbeddedPkg.dec
   ArmPkg/ArmPkg.dec
   ArmPlatformPkg/ArmPlatformPkg.dec
+  Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
   Silicon/Broadcom/Bcm283x/Bcm283x.dec
   Platform/RaspberryPi/RaspberryPi.dec
 
@@ -47,10 +48,12 @@ [FixedPcd]
   gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
   gArmTokenSpaceGuid.PcdArmPrimaryCore
   gArmTokenSpaceGuid.PcdFdSize
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress
   gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset
   gArmTokenSpaceGuid.PcdSystemMemoryBase
   gArmTokenSpaceGuid.PcdSystemMemorySize
+  gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase
   gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
index 2bfd3f020a6e..cc761bea1307 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
+++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
@@ -1,7 +1,9 @@
 /** @file
  *
+ *  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
  *  Copyright (c) 2017-2018, Andrey Warkentin <andrey.warkentin@gmail.com>
  *  Copyright (c) 2014, Linaro Limited. All rights reserved.
+ *  Copyright (c) 2013-2018, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -9,8 +11,11 @@
 
 #include <Library/ArmPlatformLib.h>
 #include <Library/DebugLib.h>
-#include <IndustryStandard/Bcm2836.h>
+#include <Library/MemoryAllocationLib.h>
 #include <Library/PcdLib.h>
+#include <Library/RPiMem.h>
+#include <IndustryStandard/Bcm2711.h>
+#include <IndustryStandard/Bcm2836.h>
 
 UINT64 mSystemMemoryBase;
 extern UINT64 mSystemMemoryEnd;
@@ -18,6 +23,13 @@ UINT64 mVideoCoreBase;
 UINT64 mVideoCoreSize;
 UINT32 mBoardRevision;
 
+
+// The total number of descriptors, including the final "end-of-table" descriptor.
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 10
+
+STATIC BOOLEAN                  VirtualMemoryInfoInitialized = FALSE;
+STATIC RPI_MEMORY_REGION_INFO   VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS];
+
 #define VariablesSize (FixedPcdGet32(PcdFlashNvStorageVariableSize) +   \
                        FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) + \
                        FixedPcdGet32(PcdFlashNvStorageFtwSpareSize) +  \
@@ -29,49 +41,6 @@ UINT32 mBoardRevision;
 
 #define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize))
 
-STATIC ARM_MEMORY_REGION_DESCRIPTOR RaspberryPiMemoryRegionDescriptor[] = {
-  {
-    /* Firmware Volume. */
-    FixedPcdGet64 (PcdFdBaseAddress), FixedPcdGet64 (PcdFdBaseAddress),
-    FixedPcdGet32 (PcdFdSize) - VariablesSize,
-    ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-  },
-  {
-    /* Variables Volume. */
-    VariablesBase, VariablesBase,
-    VariablesSize,
-    ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-  },
-  {
-    /* ATF reserved RAM. */
-    ATFBase, ATFBase,
-    FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase,
-    ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-  },
-  {
-    /* System RAM. */
-    FixedPcdGet64 (PcdSystemMemoryBase), FixedPcdGet64 (PcdSystemMemoryBase),
-    0,
-    ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
-  },
-  {
-    /* Reserved GPU RAM. */
-    0,
-    0,
-    0,
-    ARM_MEMORY_REGION_ATTRIBUTE_DEVICE
-  },
-  {
-    /* SOC registers. */
-    BCM2836_SOC_REGISTERS,
-    BCM2836_SOC_REGISTERS,
-    BCM2836_SOC_REGISTER_LENGTH,
-    ARM_MEMORY_REGION_ATTRIBUTE_DEVICE
-  },
-  {
-  }
-};
-
 /**
   Return the Virtual Memory Map of your platform
 
@@ -89,6 +58,11 @@ ArmPlatformGetVirtualMemoryMap (
   IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
   )
 {
+  UINTN                         Index = 0;
+  UINTN                         GpuIndex;
+  INT64                         ExtendedMemorySize;
+  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
+
   // Early output of the info we got from VideoCore can prove valuable.
   DEBUG ((DEBUG_INFO, "Board Rev: 0x%lX\n", mBoardRevision));
   DEBUG ((DEBUG_INFO, "Base RAM : 0x%ll08X (Size 0x%ll08X)\n", mSystemMemoryBase, mSystemMemoryEnd + 1));
@@ -97,68 +71,120 @@ ArmPlatformGetVirtualMemoryMap (
   ASSERT (mSystemMemoryBase == 0);
   ASSERT (VirtualMemoryMap != NULL);
 
-  RaspberryPiMemoryRegionDescriptor[3].Length = mSystemMemoryEnd + 1 -
-    FixedPcdGet64 (PcdSystemMemoryBase);
-
-  RaspberryPiMemoryRegionDescriptor[4].PhysicalBase =
-    RaspberryPiMemoryRegionDescriptor[3].PhysicalBase +
-    RaspberryPiMemoryRegionDescriptor[3].Length;
-
-  RaspberryPiMemoryRegionDescriptor[4].VirtualBase =
-    RaspberryPiMemoryRegionDescriptor[4].PhysicalBase;
-
-  RaspberryPiMemoryRegionDescriptor[4].Length =
-    RaspberryPiMemoryRegionDescriptor[5].PhysicalBase -
-    RaspberryPiMemoryRegionDescriptor[4].PhysicalBase;
-
-  DEBUG ((DEBUG_INFO, "FD:\n"
-    "\tPhysicalBase: 0x%lX\n"
-    "\tVirtualBase: 0x%lX\n"
-    "\tLength: 0x%lX\n",
-    RaspberryPiMemoryRegionDescriptor[0].PhysicalBase,
-    RaspberryPiMemoryRegionDescriptor[0].VirtualBase,
-    RaspberryPiMemoryRegionDescriptor[0].Length +
-    RaspberryPiMemoryRegionDescriptor[1].Length));
-
-  DEBUG ((DEBUG_INFO, "Variables (part of FD):\n"
-    "\tPhysicalBase: 0x%lX\n"
-    "\tVirtualBase: 0x%lX\n"
-    "\tLength: 0x%lX\n",
-    RaspberryPiMemoryRegionDescriptor[1].PhysicalBase,
-    RaspberryPiMemoryRegionDescriptor[1].VirtualBase,
-    RaspberryPiMemoryRegionDescriptor[1].Length));
-
-  DEBUG ((DEBUG_INFO, "ATF RAM:\n"
-    "\tPhysicalBase: 0x%lX\n"
-    "\tVirtualBase: 0x%lX\n"
-    "\tLength: 0x%lX\n",
-    RaspberryPiMemoryRegionDescriptor[2].PhysicalBase,
-    RaspberryPiMemoryRegionDescriptor[2].VirtualBase,
-    RaspberryPiMemoryRegionDescriptor[2].Length));
-
-  DEBUG ((DEBUG_INFO, "System RAM:\n"
-    "\tPhysicalBase: 0x%lX\n"
-    "\tVirtualBase: 0x%lX\n"
-    "\tLength: 0x%lX\n",
-    RaspberryPiMemoryRegionDescriptor[3].PhysicalBase,
-    RaspberryPiMemoryRegionDescriptor[3].VirtualBase,
-    RaspberryPiMemoryRegionDescriptor[3].Length));
-
-  DEBUG ((DEBUG_INFO, "GPU Reserved:\n"
-    "\tPhysicalBase: 0x%lX\n"
-    "\tVirtualBase: 0x%lX\n"
-    "\tLength: 0x%lX\n",
-    RaspberryPiMemoryRegionDescriptor[4].PhysicalBase,
-    RaspberryPiMemoryRegionDescriptor[4].VirtualBase,
-    RaspberryPiMemoryRegionDescriptor[4].Length));
-
-  DEBUG ((DEBUG_INFO, "SoC reserved:\n"
-    "\tPhysicalBase: 0x%lX\n"
-    "\tVirtualBase: 0x%lX\n"
-    "\tLength: 0x%lX\n",
-    RaspberryPiMemoryRegionDescriptor[5].PhysicalBase,
-    RaspberryPiMemoryRegionDescriptor[5].VirtualBase,
-    RaspberryPiMemoryRegionDescriptor[5].Length));
-
-  *VirtualMemoryMap = RaspberryPiMemoryRegionDescriptor;
+  VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages
+                       (EFI_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
+                       MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
+  if (VirtualMemoryTable == NULL) {
+    return;
+  }
+
+
+  // Firmware Volume
+  VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64 (PcdFdBaseAddress);
+  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length          = FixedPcdGet32 (PcdFdSize) - VariablesSize;
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
+  VirtualMemoryInfo[Index++].Name           = L"FD";
+
+  // Variable Volume
+  VirtualMemoryTable[Index].PhysicalBase    = VariablesBase;
+  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length          = VariablesSize;
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+  VirtualMemoryInfo[Index].Type             = RPI_MEM_RUNTIME_REGION;
+  VirtualMemoryInfo[Index++].Name           = L"FD Variables";
+
+  // TF-A reserved RAM
+  VirtualMemoryTable[Index].PhysicalBase    = ATFBase;
+  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase;
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
+  VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
+
+  // Base System RAM
+  VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64 (PcdSystemMemoryBase);
+  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length          = mSystemMemoryEnd + 1 - FixedPcdGet64 (PcdSystemMemoryBase);
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+  VirtualMemoryInfo[Index].Type             = RPI_MEM_BASIC_REGION;
+  VirtualMemoryInfo[Index++].Name           = L"Base System RAM";
+
+  // GPU Reserved
+  GpuIndex = Index;
+  VirtualMemoryTable[Index].PhysicalBase    = mVideoCoreBase;
+  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length          = mVideoCoreSize;
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
+  VirtualMemoryInfo[Index++].Name           = L"GPU Reserved";
+
+  // Compute the amount of extended RAM available on this platform
+  ExtendedMemorySize = SIZE_256MB;
+  ExtendedMemorySize <<= (mBoardRevision >> 20) & 0x07;
+  ExtendedMemorySize -= SIZE_1GB;
+  if (ExtendedMemorySize > 0) {
+    VirtualMemoryTable[Index].PhysicalBase  = FixedPcdGet64 (PcdExtendedMemoryBase);
+    VirtualMemoryTable[Index].VirtualBase   = VirtualMemoryTable[Index].PhysicalBase;
+    VirtualMemoryTable[Index].Length        = ExtendedMemorySize;
+    VirtualMemoryTable[Index].Attributes    = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+    VirtualMemoryInfo[Index].Type           = RPI_MEM_BASIC_REGION;
+    VirtualMemoryInfo[Index++].Name         = L"Extended System RAM";
+  }
+
+  // Extended SoC registers (PCIe, genet, ...)
+  if (BCM2711_SOC_REGISTERS > 0) {
+    VirtualMemoryTable[Index].PhysicalBase  = BCM2711_SOC_REGISTERS;
+    VirtualMemoryTable[Index].VirtualBase   = VirtualMemoryTable[Index].PhysicalBase;
+    VirtualMemoryTable[Index].Length        = BCM2711_SOC_REGISTER_LENGTH;
+    VirtualMemoryTable[Index].Attributes    = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+    VirtualMemoryInfo[Index].Type           = RPI_MEM_RESERVED_REGION;
+    VirtualMemoryInfo[Index++].Name         = L"SoC Reserved (27xx)";
+  }
+
+  // Base SoC registers
+  VirtualMemoryTable[Index].PhysicalBase    = BCM2836_SOC_REGISTERS;
+  // On the Pi 3 the SoC registers may overlap VideoCore => fix this
+  if (VirtualMemoryTable[GpuIndex].PhysicalBase + VirtualMemoryTable[GpuIndex].Length > VirtualMemoryTable[Index].PhysicalBase) {
+    VirtualMemoryTable[GpuIndex].Length = VirtualMemoryTable[Index].PhysicalBase - VirtualMemoryTable[GpuIndex].PhysicalBase;
+  }
+  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+  VirtualMemoryTable[Index].Length          = BCM2836_SOC_REGISTER_LENGTH;
+  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
+  VirtualMemoryInfo[Index++].Name           = L"SoC Reserved (283x)";
+
+  // End of Table
+  VirtualMemoryTable[Index].PhysicalBase    = 0;
+  VirtualMemoryTable[Index].VirtualBase     = 0;
+  VirtualMemoryTable[Index].Length          = 0;
+  VirtualMemoryTable[Index++].Attributes    = (ARM_MEMORY_REGION_ATTRIBUTES)0;
+
+  ASSERT(Index <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
+
+  *VirtualMemoryMap = VirtualMemoryTable;
+  VirtualMemoryInfoInitialized = TRUE;
+}
+
+/**
+  Return additional memory info not populated by the above call.
+
+  This call should follow the one to ArmPlatformGetVirtualMemoryMap ().
+
+**/
+VOID
+RpiPlatformGetVirtualMemoryInfo (
+  IN RPI_MEMORY_REGION_INFO** MemoryInfo
+  )
+{
+  ASSERT (VirtualMemoryInfo != NULL);
+
+  if (!VirtualMemoryInfoInitialized) {
+    DEBUG ((DEBUG_ERROR,
+      "ArmPlatformGetVirtualMemoryMap must be called before RpiPlatformGetVirtualMemoryInfo.\n"));
+    return;
+  }
+
+  *MemoryInfo = VirtualMemoryInfo;
 }
diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
index 3e9171eccb13..c7e17350544a 100644
--- a/Platform/RaspberryPi/RaspberryPi.dec
+++ b/Platform/RaspberryPi/RaspberryPi.dec
@@ -42,6 +42,7 @@ [PcdsFixedAtBuild.common]
   gRaspberryPiTokenSpaceGuid.PcdNvStorageVariableBase|0x0|UINT32|0x00000005
   gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|0x0|UINT32|0x00000006
   gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|0x0|UINT32|0x00000007
+  gRaspberryPiTokenSpaceGuid.PcdExtendedMemoryBase|0x0|UINT32|0x00000008
 
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   gRaspberryPiTokenSpaceGuid.PcdCpuClock|0|UINT32|0x0000000d
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Pete Batard
@ 2019-11-19 11:43   ` Philippe Mathieu-Daudé
  2019-11-19 11:57     ` Pete Batard
  0 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-19 11:43 UTC (permalink / raw)
  To: Pete Batard, devel; +Cc: ard.biesheuvel, leif.lindholm, samer.el-haj-mahmoud

On 11/19/19 12:38 PM, Pete Batard wrote:
> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> 
> Define BCM2836_SOC_REGISTERS from PcdBcm283xRegistersAddress. This is
> needed in preparation for adding Raspberry Pi 4 support, since the two
> Pi's have a different base addresses for the Bcm283x specific registers.
> 

Shouldn't this patch also include Samer's S-o-b tag?

Except this question, for the technical part:
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
>   Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf | 2 ++
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf               | 2 ++
>   Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf         | 4 ++++
>   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf     | 5 ++++-
>   Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf               | 2 ++
>   Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf           | 3 ++-
>   Platform/RaspberryPi/RPi3/RPi3.dsc                                 | 7 ++++++-
>   Silicon/Broadcom/Bcm283x/Bcm283x.dec                               | 7 +++++++
>   Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf     | 4 +++-
>   Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf                 | 5 +++++
>   Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h        | 3 ++-
>   Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf               | 4 ++++
>   12 files changed, 43 insertions(+), 5 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
> index 3f0d7b6b9e9d..6db8a1c5e400 100644
> --- a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
> @@ -1,5 +1,6 @@
>   #/** @file
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #  Copyright (c) Microsoft Corporation. All rights reserved.
>   #
> @@ -41,6 +42,7 @@ [Protocols]
>     gRaspberryPiFirmwareProtocolGuid ## CONSUMES
>   
>   [Pcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>     gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
>   
>   [Depex]
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> index 28fc2682b585..817cb98c1933 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -1,5 +1,6 @@
>   #/** @file
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #
>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -54,6 +55,7 @@ [Protocols]
>     gRaspberryPiConfigAppliedProtocolGuid ## PRODUCES
>   
>   [Pcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>     gRaspberryPiTokenSpaceGuid.PcdCpuClock
>     gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock
>     gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
> diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
> index e880c2fb0261..8817f20622d6 100644
> --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
> @@ -1,5 +1,6 @@
>   #/** @file
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #  Copyright (c) 2015-2016, Linaro Limited. All rights reserved.
>   #
> @@ -51,5 +52,8 @@ [Protocols]
>     gEfiUsb2HcProtocolGuid
>     gRaspberryPiFirmwareProtocolGuid
>   
> +[FixedPcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
> +
>   [Depex]
>     gRaspberryPiFirmwareProtocolGuid
> diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
> index 87bca98fec28..a3fc0fa49a3c 100644
> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
> @@ -1,5 +1,5 @@
>   #/** @file
> -#
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
>   #
> @@ -40,5 +40,8 @@ [LibraryClasses]
>   [Protocols]
>     gRaspberryPiFirmwareProtocolGuid    ## PRODUCES
>   
> +[FixedPcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
> +
>   [Depex]
>     TRUE
> diff --git a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
> index 7386ff251864..ca8b30700328 100644
> --- a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
> @@ -1,5 +1,6 @@
>   #/** @file
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #  Copyright (c) Microsoft Corporation. All rights reserved.
>   #
> @@ -43,6 +44,7 @@ [Protocols]
>     gRaspberryPiFirmwareProtocolGuid ## CONSUMES
>   
>   [Pcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>     gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
>   
>   [Depex]
> diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
> index ed986034b957..bcc6f8b6ec13 100644
> --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
> +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
> @@ -2,7 +2,7 @@
>   #
>   #  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
> +#  Copyright (c) 2011-2019, ARM Limited. All rights reserved.
>   #
>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>   #
> @@ -47,6 +47,7 @@ [FixedPcd]
>     gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
>     gArmTokenSpaceGuid.PcdArmPrimaryCore
>     gArmTokenSpaceGuid.PcdFdSize
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>     gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset
>     gArmTokenSpaceGuid.PcdSystemMemoryBase
>     gArmTokenSpaceGuid.PcdSystemMemorySize
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> index a0365c5cf606..98c75e373fa7 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -1,6 +1,6 @@
>   # @file
>   #
> -#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2011 - 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2014, Linaro Limited. All rights reserved.
>   #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
>   #  Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
> @@ -372,6 +372,11 @@ [PcdsFixedAtBuild.common]
>     gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
>     gArmTokenSpaceGuid.PcdSystemMemorySize|0x3FC00000
>   
> +  #
> +  # Device specific addresses
> +  #
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000
> +
>     ## NS16550 compatible UART
>     gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040
>     gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
> diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
> index ec62ff27fbb3..5b839b00d286 100644
> --- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec
> +++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
> @@ -1,5 +1,6 @@
>   ## @file
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
>   #
>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -14,3 +15,9 @@ [Defines]
>   
>   [Includes]
>     Include
> +
> +[Guids]
> +  gBcm283xTokenSpaceGuid = {0x82f36a92, 0xfb7e, 0x43a1, {0xb9, 0x9e, 0x49, 0x13, 0x3f, 0xc7, 0xa4, 0x2e}}
> +
> +[PcdsFixedAtBuild.common]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001
> diff --git a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
> index cdce11a51e14..f984c4b52623 100644
> --- a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
> +++ b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
> @@ -1,5 +1,5 @@
>   #/** @file
> -#
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #  Copyright (c) 2016 Linaro, Ltd. All rights reserved.
>   #
> @@ -27,6 +27,7 @@ [LibraryClasses]
>     BaseLib
>     DebugLib
>     IoLib
> +  PcdLib
>     UefiBootServicesTableLib
>     UefiLib
>     UefiDriverEntryPoint
> @@ -36,6 +37,7 @@ [Protocols]
>     gEfiCpuArchProtocolGuid         ## CONSUMES ## NOTIFY
>   
>   [FixedPcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>     gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
>   
>   [Depex]
> diff --git a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf b/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
> index cb1695bd2dfc..8eb90de85cfd 100644
> --- a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
> +++ b/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
> @@ -1,5 +1,6 @@
>   #/** @file
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2019 Linaro, Ltd. All rights reserved.
>   #
>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -26,6 +27,7 @@ [LibraryClasses]
>     BaseMemoryLib
>     DebugLib
>     IoLib
> +  PcdLib
>     UefiBootServicesTableLib
>     UefiDriverEntryPoint
>   
> @@ -35,5 +37,8 @@ [Protocols]
>   [Guids]
>     gEfiRngAlgorithmRaw
>   
> +[FixedPcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
> +
>   [Depex]
>     TRUE
> diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
> index 4007301228be..8bd68c234bfd 100644
> --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
> +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
> @@ -1,5 +1,6 @@
>   /** @file
>    *
> + *  Copyright (c) 2019, ARM Limited. All rights reserved.
>    *  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>    *  Copyright (c) 2016, Linaro Limited. All rights reserved.
>    *
> @@ -13,7 +14,7 @@
>   /*
>    * Both "core" and SoC perpherals (1M each).
>    */
> -#define BCM2836_SOC_REGISTERS                               0x3f000000
> +#define BCM2836_SOC_REGISTERS                               (FixedPcdGet64 (PcdBcm283xRegistersAddress))
>   #define BCM2836_SOC_REGISTER_LENGTH                         0x02000000
>   
>   /*
> diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
> index 50da4eb771f3..ff1b5af6db6e 100644
> --- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
> +++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
> @@ -2,6 +2,7 @@
>   #
>   #  Manipulate GPIOs.
>   #
> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>   #  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>   #
>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -30,4 +31,7 @@ [LibraryClasses]
>     DebugLib
>     IoLib
>   
> +[FixedPcd]
> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
> +
>   [Guids]
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses Pete Batard
@ 2019-11-19 11:46   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-19 11:46 UTC (permalink / raw)
  To: Pete Batard, devel; +Cc: ard.biesheuvel, leif.lindholm, samer.el-haj-mahmoud

On 11/19/19 12:38 PM, Pete Batard wrote:
> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> 
> Remove hardcoded base addresses for Mailbox, Watchdog, SDIO and
> DW2 USB and use an offset indexed on PcdBcm283xRegistersAddress
> instead. This is needed in preparation for adding Raspberry Pi 4
> support.
> 

Similarly to the previous patch, I'd expect Samer's S-o-b.

> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
>   Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h               | 4 +++-
>   Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h     | 8 ++++++--
>   Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h | 4 +++-
>   3 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
> index 88fd93934fd3..ddbf69a1d608 100644
> --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
> +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
> @@ -10,7 +10,9 @@
>   #ifndef __DWCHW_H__
>   #define __DWCHW_H__
>   
> -#define DW2_USB_BASE_ADDRESS            0x3f980000
> +#define DW2_USB_OFFSET                  0x00980000
> +#define DW2_USB_BASE_ADDRESS            (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
> +                                        + DW2_USB_OFFSET)
>   
>   #define HSOTG_REG(x)    (x)
>   
> diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
> index 8bd68c234bfd..72c8e9dc4b14 100644
> --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
> +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
> @@ -23,7 +23,9 @@
>   #define BCM2836_DMA_DEVICE_OFFSET                           0xc0000000
>   
>   /* watchdog constants */
> -#define BCM2836_WDOG_BASE_ADDRESS                           0x3f100000
> +#define BCM2836_WDOG_OFFSET                                 0x00100000
> +#define BCM2836_WDOG_BASE_ADDRESS                           (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
> +                                                            + BCM2836_WDOG_OFFSET)
>   #define BCM2836_WDOG_PASSWORD                               0x5a000000
>   #define BCM2836_WDOG_RSTC_OFFSET                            0x0000001c
>   #define BCM2836_WDOG_WDOG_OFFSET                            0x00000024
> @@ -31,7 +33,9 @@
>   #define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET                  0x00000020
>   
>   /* mailbox interface constants */
> -#define BCM2836_MBOX_BASE_ADDRESS                           0x3f00b880
> +#define BCM2836_MBOX_OFFSET                                 0x0000b880
> +#define BCM2836_MBOX_BASE_ADDRESS                           (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
> +                                                            + BCM2836_MBOX_OFFSET)

I'm glad you considered v1 comment, now v2 is way simpler to review.
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

>   #define BCM2836_MBOX_READ_OFFSET                            0x00000000
>   #define BCM2836_MBOX_STATUS_OFFSET                          0x00000018
>   #define BCM2836_MBOX_CONFIG_OFFSET                          0x0000001c
> diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
> index fb0d02904156..708a1d7a4f47 100644
> --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
> +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
> @@ -10,7 +10,9 @@
>   #define __BCM2836_SDIO_H__
>   
>   //MMC/SD/SDIO1 register definitions.
> -#define MMCHS1BASE        0x3F300000
> +#define MMCHS1_OFFSET     0x00300000
> +#define MMCHS1BASE        (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
> +                          + MMCHS1_OFFSET)
>   
>   #define MMCHS_BLK         (MMCHS1BASE + 0x4)
>   #define BLEN_512BYTES     (0x200UL << 0)
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header Pete Batard
@ 2019-11-19 11:51   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-19 11:51 UTC (permalink / raw)
  To: Pete Batard, devel; +Cc: ard.biesheuvel, leif.lindholm, samer.el-haj-mahmoud

On 11/19/19 12:38 PM, Pete Batard wrote:
> Bcm2711 is the SoC used by the Raspberry Pi 4. For the most part it
> is backward compatible with the Bcm283x SoC used by older models but
> some new Bcm2711 registers have been introduced such as the ones for
> PCIe.
> 
> We therefore introduce a new Bcm27xx module, which contains only the
> base address for the new registers for now (set from a PCD as is the
> case for Bcm283x) but which should get populated further as we add
> support for the Raspberry Pi 4.
> 
> Signed-off-by: Pete Batard <pete@akeo.ie>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> ---
>   Silicon/Broadcom/Bcm27xx/Bcm27xx.dec                        | 22 ++++++++++++++++++++
>   Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h | 15 +++++++++++++
>   2 files changed, 37 insertions(+)
> 
> diff --git a/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec b/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
> new file mode 100644
> index 000000000000..815302f6d209
> --- /dev/null
> +++ b/Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
> @@ -0,0 +1,22 @@
> +## @file
> +#
> +#  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  DEC_SPECIFICATION              = 0x0001001A
> +  PACKAGE_NAME                   = Bcm27xxPkg
> +  PACKAGE_GUID                   = D4B585C5-EBCA-4779-B974-05A3CF2F10C4
> +  PACKAGE_VERSION                = 1.0
> +
> +[Includes]
> +  Include
> +
> +[Guids]
> +  gBcm27xxTokenSpaceGuid = {0x44045e56, 0x7056, 0x4be6, {0x88, 0xc0, 0x49, 0x0c, 0x67, 0x90, 0x2f, 0xba}}
> +
> +[PcdsFixedAtBuild.common]
> +  gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0x0|UINT32|0x00000001
> diff --git a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
> new file mode 100644
> index 000000000000..356458024e84
> --- /dev/null
> +++ b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
> @@ -0,0 +1,15 @@
> +/** @file
> + *
> + *  Copyright (c) 2019, Pete Batard <pete@akeo.ie>.
> + *
> + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> + *
> + **/
> +
> +#ifndef BCM2711_H__
> +#define BCM2711_H__
> +
> +#define BCM2711_SOC_REGISTERS               (FixedPcdGet64 (PcdBcm27xxRegistersAddress))
> +#define BCM2711_SOC_REGISTER_LENGTH         0x02000000
> +
> +#endif /* BCM2711_H__ */
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  2019-11-19 11:43   ` Philippe Mathieu-Daudé
@ 2019-11-19 11:57     ` Pete Batard
  2019-11-19 12:16       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 21+ messages in thread
From: Pete Batard @ 2019-11-19 11:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, devel
  Cc: ard.biesheuvel, leif.lindholm, samer.el-haj-mahmoud

On 2019.11.19 11:43, Philippe Mathieu-Daudé wrote:
> On 11/19/19 12:38 PM, Pete Batard wrote:
>> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
>>
>> Define BCM2836_SOC_REGISTERS from PcdBcm283xRegistersAddress. This is
>> needed in preparation for adding Raspberry Pi 4 support, since the two
>> Pi's have a different base addresses for the Bcm283x specific registers.
>>
> 
> Shouldn't this patch also include Samer's S-o-b tag?

I think we went over this already (but I can't seem to find that e-mail 
from the list).

As per Leif's comments in 
https://www.mail-archive.com/devel@edk2.groups.io/msg05292.html:

"I don't want patches submitted with anyone other than the
contributor's Signed-off-by"

Regards,

/Pete

> 
> Except this question, for the technical part:
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
> 
>> Signed-off-by: Pete Batard <pete@akeo.ie>
>> ---
>>   Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf | 
>> 2 ++
>>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf               | 
>> 2 ++
>>   Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf         | 
>> 4 ++++
>>   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf     | 
>> 5 ++++-
>>   Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf               | 
>> 2 ++
>>   Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf           | 
>> 3 ++-
>>   Platform/RaspberryPi/RPi3/RPi3.dsc                                 | 
>> 7 ++++++-
>>   Silicon/Broadcom/Bcm283x/Bcm283x.dec                               | 
>> 7 +++++++
>>   Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf     | 
>> 4 +++-
>>   Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf                 | 
>> 5 +++++
>>   Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h        | 
>> 3 ++-
>>   Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf               | 
>> 4 ++++
>>   12 files changed, 43 insertions(+), 5 deletions(-)
>>
>> diff --git 
>> a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf 
>> b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
>> index 3f0d7b6b9e9d..6db8a1c5e400 100644
>> --- a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
>> +++ b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf
>> @@ -1,5 +1,6 @@
>>   #/** @file
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>>   #  Copyright (c) Microsoft Corporation. All rights reserved.
>>   #
>> @@ -41,6 +42,7 @@ [Protocols]
>>     gRaspberryPiFirmwareProtocolGuid ## CONSUMES
>>   [Pcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>>     gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
>>   [Depex]
>> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf 
>> b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
>> index 28fc2682b585..817cb98c1933 100644
>> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
>> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
>> @@ -1,5 +1,6 @@
>>   #/** @file
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>>   #
>>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>> @@ -54,6 +55,7 @@ [Protocols]
>>     gRaspberryPiConfigAppliedProtocolGuid ## PRODUCES
>>   [Pcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>>     gRaspberryPiTokenSpaceGuid.PcdCpuClock
>>     gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock
>>     gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
>> diff --git 
>> a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf 
>> b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
>> index e880c2fb0261..8817f20622d6 100644
>> --- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
>> +++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
>> @@ -1,5 +1,6 @@
>>   #/** @file
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2017-2018, Andrei Warkentin 
>> <andrey.warkentin@gmail.com>
>>   #  Copyright (c) 2015-2016, Linaro Limited. All rights reserved.
>>   #
>> @@ -51,5 +52,8 @@ [Protocols]
>>     gEfiUsb2HcProtocolGuid
>>     gRaspberryPiFirmwareProtocolGuid
>> +[FixedPcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>> +
>>   [Depex]
>>     gRaspberryPiFirmwareProtocolGuid
>> diff --git 
>> a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf 
>> b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> index 87bca98fec28..a3fc0fa49a3c 100644
>> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
>> @@ -1,5 +1,5 @@
>>   #/** @file
>> -#
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2017-2018, Andrei Warkentin 
>> <andrey.warkentin@gmail.com>
>>   #  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
>>   #
>> @@ -40,5 +40,8 @@ [LibraryClasses]
>>   [Protocols]
>>     gRaspberryPiFirmwareProtocolGuid    ## PRODUCES
>> +[FixedPcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>> +
>>   [Depex]
>>     TRUE
>> diff --git a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf 
>> b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
>> index 7386ff251864..ca8b30700328 100644
>> --- a/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
>> +++ b/Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf
>> @@ -1,5 +1,6 @@
>>   #/** @file
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>>   #  Copyright (c) Microsoft Corporation. All rights reserved.
>>   #
>> @@ -43,6 +44,7 @@ [Protocols]
>>     gRaspberryPiFirmwareProtocolGuid ## CONSUMES
>>   [Pcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>>     gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
>>   [Depex]
>> diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf 
>> b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> index ed986034b957..bcc6f8b6ec13 100644
>> --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf
>> @@ -2,7 +2,7 @@
>>   #
>>   #  Copyright (c) 2017-2018, Andrei Warkentin 
>> <andrey.warkentin@gmail.com>
>>   #  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
>> -#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
>> +#  Copyright (c) 2011-2019, ARM Limited. All rights reserved.
>>   #
>>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>>   #
>> @@ -47,6 +47,7 @@ [FixedPcd]
>>     gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
>>     gArmTokenSpaceGuid.PcdArmPrimaryCore
>>     gArmTokenSpaceGuid.PcdFdSize
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>>     gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset
>>     gArmTokenSpaceGuid.PcdSystemMemoryBase
>>     gArmTokenSpaceGuid.PcdSystemMemorySize
>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc 
>> b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> index a0365c5cf606..98c75e373fa7 100644
>> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> @@ -1,6 +1,6 @@
>>   # @file
>>   #
>> -#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>> +#  Copyright (c) 2011 - 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2014, Linaro Limited. All rights reserved.
>>   #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
>>   #  Copyright (c) 2017 - 2018, Andrei Warkentin 
>> <andrey.warkentin@gmail.com>
>> @@ -372,6 +372,11 @@ [PcdsFixedAtBuild.common]
>>     gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
>>     gArmTokenSpaceGuid.PcdSystemMemorySize|0x3FC00000
>> +  #
>> +  # Device specific addresses
>> +  #
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x3f000000
>> +
>>     ## NS16550 compatible UART
>>     gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3f215040
>>     gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
>> diff --git a/Silicon/Broadcom/Bcm283x/Bcm283x.dec 
>> b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> index ec62ff27fbb3..5b839b00d286 100644
>> --- a/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> +++ b/Silicon/Broadcom/Bcm283x/Bcm283x.dec
>> @@ -1,5 +1,6 @@
>>   ## @file
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2019, Pete Batard <pete@akeo.ie>
>>   #
>>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>> @@ -14,3 +15,9 @@ [Defines]
>>   [Includes]
>>     Include
>> +
>> +[Guids]
>> +  gBcm283xTokenSpaceGuid = {0x82f36a92, 0xfb7e, 0x43a1, {0xb9, 0x9e, 
>> 0x49, 0x13, 0x3f, 0xc7, 0xa4, 0x2e}}
>> +
>> +[PcdsFixedAtBuild.common]
>> +  
>> gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0x0|UINT32|0x00000001
>> diff --git 
>> a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf 
>> b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
>> index cdce11a51e14..f984c4b52623 100644
>> --- a/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
>> +++ b/Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf
>> @@ -1,5 +1,5 @@
>>   #/** @file
>> -#
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>>   #  Copyright (c) 2016 Linaro, Ltd. All rights reserved.
>>   #
>> @@ -27,6 +27,7 @@ [LibraryClasses]
>>     BaseLib
>>     DebugLib
>>     IoLib
>> +  PcdLib
>>     UefiBootServicesTableLib
>>     UefiLib
>>     UefiDriverEntryPoint
>> @@ -36,6 +37,7 @@ [Protocols]
>>     gEfiCpuArchProtocolGuid         ## CONSUMES ## NOTIFY
>>   [FixedPcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>>     gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
>>   [Depex]
>> diff --git a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf 
>> b/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
>> index cb1695bd2dfc..8eb90de85cfd 100644
>> --- a/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
>> +++ b/Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf
>> @@ -1,5 +1,6 @@
>>   #/** @file
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2019 Linaro, Ltd. All rights reserved.
>>   #
>>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>> @@ -26,6 +27,7 @@ [LibraryClasses]
>>     BaseMemoryLib
>>     DebugLib
>>     IoLib
>> +  PcdLib
>>     UefiBootServicesTableLib
>>     UefiDriverEntryPoint
>> @@ -35,5 +37,8 @@ [Protocols]
>>   [Guids]
>>     gEfiRngAlgorithmRaw
>> +[FixedPcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>> +
>>   [Depex]
>>     TRUE
>> diff --git 
>> a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h 
>> b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> index 4007301228be..8bd68c234bfd 100644
>> --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
>> @@ -1,5 +1,6 @@
>>   /** @file
>>    *
>> + *  Copyright (c) 2019, ARM Limited. All rights reserved.
>>    *  Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
>>    *  Copyright (c) 2016, Linaro Limited. All rights reserved.
>>    *
>> @@ -13,7 +14,7 @@
>>   /*
>>    * Both "core" and SoC perpherals (1M each).
>>    */
>> -#define BCM2836_SOC_REGISTERS                               0x3f000000
>> +#define BCM2836_SOC_REGISTERS                               
>> (FixedPcdGet64 (PcdBcm283xRegistersAddress))
>>   #define BCM2836_SOC_REGISTER_LENGTH                         0x02000000
>>   /*
>> diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf 
>> b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
>> index 50da4eb771f3..ff1b5af6db6e 100644
>> --- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
>> +++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
>> @@ -2,6 +2,7 @@
>>   #
>>   #  Manipulate GPIOs.
>>   #
>> +#  Copyright (c) 2019, ARM Limited. All rights reserved.
>>   #  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>>   #
>>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>> @@ -30,4 +31,7 @@ [LibraryClasses]
>>     DebugLib
>>     IoLib
>> +[FixedPcd]
>> +  gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
>> +
>>   [Guids]
>>
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Pete Batard
@ 2019-11-19 12:02   ` Philippe Mathieu-Daudé
  2019-11-19 12:14     ` [edk2-devel] " Leif Lindholm
  2019-11-19 12:25     ` Pete Batard
  0 siblings, 2 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-19 12:02 UTC (permalink / raw)
  To: Pete Batard, devel; +Cc: ard.biesheuvel, leif.lindholm, samer.el-haj-mahmoud

On 11/19/19 12:38 PM, Pete Batard wrote:
> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> 
> Add a missing entry for the "Raspberry Pi Compute Module 3+" in
> RpiFirmwareGetModelName ().
> 
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

I feel really lost with how the S-o-b are handled.

I'd have expected, Samer as the author, signs it. Pete forwards it, then 
Leif refactors a bit by extracting a part of the previous bigger patch.
So:

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

Anyway, back to the technical content:
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> ---
>   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> index 9b4aa068857c..dcb434fabefe 100644
> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> @@ -1,5 +1,6 @@
>   /** @file
>    *
> + *  Copyright (c) 2019, ARM Limited. All rights reserved.
>    *  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
>    *  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
>    *
> @@ -595,6 +596,8 @@ RpiFirmwareGetModelName (
>       return "Raspberry Pi 3 Model B+";
>     case 0x0E:
>       return "Raspberry Pi 3 Model A+";
> +  case 0x10:
> +    return "Raspberry Pi Compute Module 3+";
>     case 0x11:
>       return "Raspberry Pi 4 Model B";
>     default:
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name
  2019-11-19 12:02   ` Philippe Mathieu-Daudé
@ 2019-11-19 12:14     ` Leif Lindholm
  2019-11-19 12:25       ` Philippe Mathieu-Daudé
  2019-11-19 12:25     ` Pete Batard
  1 sibling, 1 reply; 21+ messages in thread
From: Leif Lindholm @ 2019-11-19 12:14 UTC (permalink / raw)
  To: devel, philmd; +Cc: Pete Batard, ard.biesheuvel, samer.el-haj-mahmoud

On Tue, Nov 19, 2019 at 01:02:20PM +0100, Philippe Mathieu-Daudé wrote:
> On 11/19/19 12:38 PM, Pete Batard wrote:
> > From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> > 
> > Add a missing entry for the "Raspberry Pi Compute Module 3+" in
> > RpiFirmwareGetModelName ().
> > 
> > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> 
> I feel really lost with how the S-o-b are handled.

Signed-off-by, as per https://developercertificate.org/, starts off
with "By making a contribution to this project, I certify that:".

That is only a valid statement at the point of contributing code to a
project. It is also only a valid statement when given by the person
contributing it. Samer has authored this code, but he has not
contributed it.

My own litmus test is the legal usefulness of the statament
"Samer said he signed the contract.".

> I'd have expected, Samer as the author, signs it. Pete forwards it, then
> Leif refactors a bit by extracting a part of the previous bigger patch.
> So:
> 
> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> Signed-off-by: Pete Batard <pete@akeo.ie>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

What might be confusing you is where a set is collaboratively
developed, or where multiple patch sets are smashed together to be
merged atomically; when someone other than the poster has previously
contributed a given patch to the project but it is being *reposted* by
someone else to the same project, it is customary to include the
original Signed-off-by, since it still applies.

Similarly, when non-trivial changes are made by a maintainer (or
whoever reposted the patches), the maintainer *should* add their own
S-o-b - something that is usually done after a line briefly explaining
[which changes were done]
.

(You will however find that different maintainers have different
opinion of what constitutes "trivial".)

/
    Leif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  2019-11-19 11:57     ` Pete Batard
@ 2019-11-19 12:16       ` Philippe Mathieu-Daudé
  2019-11-19 12:44         ` Leif Lindholm
  0 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-19 12:16 UTC (permalink / raw)
  To: devel, leif.lindholm
  Cc: Pete Batard, ard.biesheuvel, samer.el-haj-mahmoud, Laszlo Ersek

On 11/19/19 12:57 PM, Pete Batard wrote:
> On 2019.11.19 11:43, Philippe Mathieu-Daudé wrote:
>> On 11/19/19 12:38 PM, Pete Batard wrote:
>>> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
>>>
>>> Define BCM2836_SOC_REGISTERS from PcdBcm283xRegistersAddress. This is
>>> needed in preparation for adding Raspberry Pi 4 support, since the two
>>> Pi's have a different base addresses for the Bcm283x specific registers.
>>>
>>
>> Shouldn't this patch also include Samer's S-o-b tag?
> 
> I think we went over this already (but I can't seem to find that e-mail 
> from the list).
> 
> As per Leif's comments in 
> https://www.mail-archive.com/devel@edk2.groups.io/msg05292.html:
> 
> "I don't want patches submitted with anyone other than the
> contributor's Signed-off-by"

I missed this thread, now I'm slightly confused.

Checking the Wiki:

https://github.com/tianocore/edk2/blob/master/Readme.md#code-contributions

and:

https://github.com/tianocore/tianocore.github.io/wiki/Commit-Signature-Format#signed-off-by

Signed-off-by

     Authors should use Signed-off-by (See example below)
     If you've received the code from a trusted source, and are
     forwarding it along, please add a Signed-off-by line for
     yourself to indicate that you know this code to be usable
     by our community.

The guideline is simply "add a S-o-b", but Leif says "[only?] If patches 
are modified after contribution, but before being pushed, then then 
additional contributions can be reflected with additional 
Signed-off-bys." and then "I don't want patches submitted with anyone 
other than the contributor's Signed-off-by:".

Leif, can we clarify and update the documentation accordingly?

Sorry to be picky, but that would clear any confusion.

Thanks,

Phil.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name
  2019-11-19 12:02   ` Philippe Mathieu-Daudé
  2019-11-19 12:14     ` [edk2-devel] " Leif Lindholm
@ 2019-11-19 12:25     ` Pete Batard
  1 sibling, 0 replies; 21+ messages in thread
From: Pete Batard @ 2019-11-19 12:25 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, devel
  Cc: ard.biesheuvel, leif.lindholm, samer.el-haj-mahmoud

On 2019.11.19 12:02, Philippe Mathieu-Daudé wrote:
> On 11/19/19 12:38 PM, Pete Batard wrote:
>> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
>>
>> Add a missing entry for the "Raspberry Pi Compute Module 3+" in
>> RpiFirmwareGetModelName ().
>>
>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> 
> I feel really lost with how the S-o-b are handled.

If you look at the thread, you'll see that Leif provided a patch (he 
basically split a patch from the existing), which he signed of.

I therefore included it as is. Hence the S-o-b being Leif here.

But yeah, I agree this whole business is confusing.

Regards,

/Pete

> 
> I'd have expected, Samer as the author, signs it. Pete forwards it, then 
> Leif refactors a bit by extracting a part of the previous bigger patch.
> So:
> 
> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> Signed-off-by: Pete Batard <pete@akeo.ie>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> 
> Anyway, back to the technical content:
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
> 
>> ---
>>   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git 
>> a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c 
>> b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
>> index 9b4aa068857c..dcb434fabefe 100644
>> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
>> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
>> @@ -1,5 +1,6 @@
>>   /** @file
>>    *
>> + *  Copyright (c) 2019, ARM Limited. All rights reserved.
>>    *  Copyright (c) 2017-2018, Andrei Warkentin 
>> <andrey.warkentin@gmail.com>
>>    *  Copyright (c) 2016, Linaro, Ltd. All rights reserved.
>>    *
>> @@ -595,6 +596,8 @@ RpiFirmwareGetModelName (
>>       return "Raspberry Pi 3 Model B+";
>>     case 0x0E:
>>       return "Raspberry Pi 3 Model A+";
>> +  case 0x10:
>> +    return "Raspberry Pi Compute Module 3+";
>>     case 0x11:
>>       return "Raspberry Pi 4 Model B";
>>     default:
>>
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name
  2019-11-19 12:14     ` [edk2-devel] " Leif Lindholm
@ 2019-11-19 12:25       ` Philippe Mathieu-Daudé
  2019-11-19 12:50         ` Leif Lindholm
  0 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-19 12:25 UTC (permalink / raw)
  To: Leif Lindholm, devel
  Cc: Pete Batard, ard.biesheuvel, samer.el-haj-mahmoud, Laszlo Ersek

On 11/19/19 1:14 PM, Leif Lindholm wrote:
> On Tue, Nov 19, 2019 at 01:02:20PM +0100, Philippe Mathieu-Daudé wrote:
>> On 11/19/19 12:38 PM, Pete Batard wrote:
>>> From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
>>>
>>> Add a missing entry for the "Raspberry Pi Compute Module 3+" in
>>> RpiFirmwareGetModelName ().
>>>
>>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
>>
>> I feel really lost with how the S-o-b are handled.
> 
> Signed-off-by, as per https://developercertificate.org/, starts off
> with "By making a contribution to this project, I certify that:".
> 
> That is only a valid statement at the point of contributing code to a
> project. It is also only a valid statement when given by the person
> contributing it. Samer has authored this code, but he has not
> contributed it.
> 
> My own litmus test is the legal usefulness of the statament
> "Samer said he signed the contract.".

I just asked clarification on another thread and now see this reply.

Now I understand that while being the author, Samer did not contributed 
his code to the project. Then by forwarding his work, Pete is a 
contributor signing the certificate. If Samer did not sign the 
certificate in front of the project (by posting his work), then Pete can 
not sign on his behalf. Phew.

>> I'd have expected, Samer as the author, signs it. Pete forwards it, then
>> Leif refactors a bit by extracting a part of the previous bigger patch.
>> So:
>>
>> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
>> Signed-off-by: Pete Batard <pete@akeo.ie>
>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> 
> What might be confusing you is where a set is collaboratively
> developed, or where multiple patch sets are smashed together to be
> merged atomically; when someone other than the poster has previously
> contributed a given patch to the project but it is being *reposted* by
> someone else to the same project, it is customary to include the
> original Signed-off-by, since it still applies.

Correct.

> Similarly, when non-trivial changes are made by a maintainer (or
> whoever reposted the patches), the maintainer *should* add their own
> S-o-b - something that is usually done after a line briefly explaining
> [which changes were done]

Yes, agreed.

> .
> 
> (You will however find that different maintainers have different
> opinion of what constitutes "trivial".)

Thanks for the clear explanation!

Phil.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  2019-11-19 12:16       ` Philippe Mathieu-Daudé
@ 2019-11-19 12:44         ` Leif Lindholm
  2019-11-19 12:51           ` Ard Biesheuvel
  0 siblings, 1 reply; 21+ messages in thread
From: Leif Lindholm @ 2019-11-19 12:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: devel, Pete Batard, ard.biesheuvel, samer.el-haj-mahmoud,
	Laszlo Ersek

On Tue, Nov 19, 2019 at 01:16:28PM +0100, Philippe Mathieu-Daudé wrote:
> > As per Leif's comments in
> > https://www.mail-archive.com/devel@edk2.groups.io/msg05292.html:
> > 
> > "I don't want patches submitted with anyone other than the
> > contributor's Signed-off-by"
> 
> I missed this thread, now I'm slightly confused.
> 
> Checking the Wiki:
> 
> https://github.com/tianocore/edk2/blob/master/Readme.md#code-contributions
> 
> and:
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Commit-Signature-Format#signed-off-by
> 
> Signed-off-by
> 
>     Authors should use Signed-off-by (See example below)
>     If you've received the code from a trusted source, and are
>     forwarding it along, please add a Signed-off-by line for
>     yourself to indicate that you know this code to be usable
>     by our community.
> 
> The guideline is simply "add a S-o-b", but Leif says "[only?]

No.
Whoever contributes the patch must add an S-o-b.
And contracts are signed in one's own name.

This is not a TianoCore twitch, this is the fundamental way in which
DCO works in all projects that use it - including linux and QEMU.

https://wiki.qemu.org/Contribute/SubmitAPatch:
* You must provide a Signed-off-by: line (this is a hard requirement
  because it's how you say "I'm legally okay to contribute this and
  happy for it to go into QEMU"
which is based on
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v5.4-rc8#n418

The confusing bit I find here is in
https://wiki.qemu.org/Contribute/SubmitAPatch#Patch_emails_must_include_a_Signed-off-by:_line
with its statement of "but again, that author's Signed-off-by: line is
mandatory,", in direct conflict with the text at the top of the page
*if* the patch was not one already contributed to QEMU.

/
    Leif

> If patches are
> modified after contribution, but before being pushed, then then additional
> contributions can be reflected with additional Signed-off-bys." and then "I
> don't want patches submitted with anyone other than the contributor's
> Signed-off-by:".
> 
> Leif, can we clarify and update the documentation accordingly?
>
> Sorry to be picky, but that would clear any confusion.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name
  2019-11-19 12:25       ` Philippe Mathieu-Daudé
@ 2019-11-19 12:50         ` Leif Lindholm
  0 siblings, 0 replies; 21+ messages in thread
From: Leif Lindholm @ 2019-11-19 12:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: devel, Pete Batard, ard.biesheuvel, samer.el-haj-mahmoud,
	Laszlo Ersek

On Tue, Nov 19, 2019 at 01:25:51PM +0100, Philippe Mathieu-Daudé wrote:
> > > I feel really lost with how the S-o-b are handled.
> > 
> > Signed-off-by, as per https://developercertificate.org/, starts off
> > with "By making a contribution to this project, I certify that:".
> > 
> > That is only a valid statement at the point of contributing code to a
> > project. It is also only a valid statement when given by the person
> > contributing it. Samer has authored this code, but he has not
> > contributed it.
> > 
> > My own litmus test is the legal usefulness of the statament
> > "Samer said he signed the contract.".
> 
> I just asked clarification on another thread and now see this reply.
> 
> Now I understand that while being the author, Samer did not contributed his
> code to the project. Then by forwarding his work, Pete is a contributor
> signing the certificate. If Samer did not sign the certificate in front of
> the project (by posting his work), then Pete can not sign on his behalf.

Correct.

> Thanks for the clear explanation!

NP. I only wish I'd have seen this mail sooner :|

/
    Leif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD
  2019-11-19 12:44         ` Leif Lindholm
@ 2019-11-19 12:51           ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2019-11-19 12:51 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: Philippe Mathieu-Daudé, edk2-devel-groups-io, Pete Batard,
	samer.el-haj-mahmoud, Laszlo Ersek

On Tue, 19 Nov 2019 at 13:44, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Tue, Nov 19, 2019 at 01:16:28PM +0100, Philippe Mathieu-Daudé wrote:
> > > As per Leif's comments in
> > > https://www.mail-archive.com/devel@edk2.groups.io/msg05292.html:
> > >
> > > "I don't want patches submitted with anyone other than the
> > > contributor's Signed-off-by"
> >
> > I missed this thread, now I'm slightly confused.
> >
> > Checking the Wiki:
> >
> > https://github.com/tianocore/edk2/blob/master/Readme.md#code-contributions
> >
> > and:
> >
> > https://github.com/tianocore/tianocore.github.io/wiki/Commit-Signature-Format#signed-off-by
> >
> > Signed-off-by
> >
> >     Authors should use Signed-off-by (See example below)
> >     If you've received the code from a trusted source, and are
> >     forwarding it along, please add a Signed-off-by line for
> >     yourself to indicate that you know this code to be usable
> >     by our community.
> >
> > The guideline is simply "add a S-o-b", but Leif says "[only?]
>
> No.
> Whoever contributes the patch must add an S-o-b.
> And contracts are signed in one's own name.
>
> This is not a TianoCore twitch, this is the fundamental way in which
> DCO works in all projects that use it - including linux and QEMU.
>
> https://wiki.qemu.org/Contribute/SubmitAPatch:
> * You must provide a Signed-off-by: line (this is a hard requirement
>   because it's how you say "I'm legally okay to contribute this and
>   happy for it to go into QEMU"
> which is based on
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v5.4-rc8#n418
>
> The confusing bit I find here is in
> https://wiki.qemu.org/Contribute/SubmitAPatch#Patch_emails_must_include_a_Signed-off-by:_line
> with its statement of "but again, that author's Signed-off-by: line is
> mandatory,", in direct conflict with the text at the top of the page
> *if* the patch was not one already contributed to QEMU.
>

The point is really that you should not add a s-o-b line just to
credit authorship. The s-o-b indicates that the person in question
asserts that the contribution is compatible with the project's license
policies. The author may not even be aware that the code is being
contributed to a certain project, and so adding a s-o-b on their
behalf in this case should be avoided. TL;DR: SOB != authorship

It might make sense to permit an Author: or Authored-by: tag to make
this distinction more explicit.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork
  2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
                   ` (6 preceding siblings ...)
  2019-11-19 11:38 ` [edk2-platforms][PATCH v2 7/7] Platform/RPi: Clean up and improve early memory init Pete Batard
@ 2019-11-19 18:20 ` Leif Lindholm
  7 siblings, 0 replies; 21+ messages in thread
From: Leif Lindholm @ 2019-11-19 18:20 UTC (permalink / raw)
  To: Pete Batard
  Cc: edk2-devel-groups-io, Ard Biesheuvel, Philippe Mathieu-Daudé,
	Samer El-Haj-Mahmoud

[-- Attachment #1: Type: text/plain, Size: 3538 bytes --]

On Tue, 19 Nov 2019 at 11:38, Pete Batard <pete@akeo.ie> wrote:
>
> Changes from v1 (https://edk2.groups.io/g/devel/message/50689 - 50697):
> - Split missing "Raspberry Pi Compute Module 3+" model from the "model
name" patch
> - Update Samer's e-mail address
> - Drop leading __ in new header guards
> - List new PCDs, headers and LibraryClasses in alphabetical order where
possible
> - Use a single PCD for the SoC registers base address and use offsets to
derive
>   the other registers address from that PCD
> - Add a comment in RaspberryPiHelper.S to indicate that x1 keeps its value
> - Mention that RaspberryPiMem.c is derived from code from ArmJunoMem.c
>
> Pete Batard (3):
>   Silicon/Broadcom: Add Bcm2711 header
>   Platform/RPi: Read more variables from VideoCore during early init
>   Platform/RPi: Clean up and improve early memory init
>
> Samer El-Haj-Mahmoud (4):
>   Platform/RPi: Add missing model name
>   Platform/RPi: Add model family detection
>   Platform/RPi: Replace Bcm283x SoC base register address with a PCD
>   Platform/RPi: Use offsets for Bcm238x SoC register addresses

For the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Pushed as 6dfc9b39cc2e..61b6c05bdf3e.

Thanks!

/
    Leif

>  Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.inf   |
2 +
>  Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf                 |
2 +
>  Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf           |
4 +
>  Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h                    |
4 +-
>  Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c         |
 64 +++++
>  Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf       |
5 +-
>  Platform/RaspberryPi/Drivers/SdHostDxe/SdHostDxe.inf                 |
2 +
>  Platform/RaspberryPi/Include/IndustryStandard/RpiMbox.h              |
1 +
>  Platform/RaspberryPi/Include/Library/RPiMem.h                        |
 26 ++
>  Platform/RaspberryPi/Include/Protocol/RpiFirmware.h                  |
8 +
>  Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c     |
 94 ++++---
>  Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf   |
1 +
>  Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S |
 76 +++++-
>  Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf             |
6 +-
>  Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c            |
256 +++++++++++---------
>  Platform/RaspberryPi/RPi3/RPi3.dsc                                   |
7 +-
>  Platform/RaspberryPi/RaspberryPi.dec                                 |
1 +
>  Silicon/Broadcom/Bcm27xx/Bcm27xx.dec                                 |
 22 ++
>  Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h          |
 15 ++
>  Silicon/Broadcom/Bcm283x/Bcm283x.dec                                 |
7 +
>  Silicon/Broadcom/Bcm283x/Drivers/InterruptDxe/InterruptDxe.inf       |
4 +-
>  Silicon/Broadcom/Bcm283x/Drivers/RngDxe/RngDxe.inf                   |
5 +
>  Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h          |
 11 +-
>  Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h      |
4 +-
>  Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf                 |
4 +
>  25 files changed, 459 insertions(+), 172 deletions(-)
>  create mode 100644 Platform/RaspberryPi/Include/Library/RPiMem.h
>  create mode 100644 Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
>  create mode 100644
Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
>
> --
> 2.21.0.windows.1
>

[-- Attachment #2: Type: text/html, Size: 4473 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-11-19 18:20 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Pete Batard
2019-11-19 12:02   ` Philippe Mathieu-Daudé
2019-11-19 12:14     ` [edk2-devel] " Leif Lindholm
2019-11-19 12:25       ` Philippe Mathieu-Daudé
2019-11-19 12:50         ` Leif Lindholm
2019-11-19 12:25     ` Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 2/7] Platform/RPi: Add model family detection Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Pete Batard
2019-11-19 11:43   ` Philippe Mathieu-Daudé
2019-11-19 11:57     ` Pete Batard
2019-11-19 12:16       ` Philippe Mathieu-Daudé
2019-11-19 12:44         ` Leif Lindholm
2019-11-19 12:51           ` Ard Biesheuvel
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses Pete Batard
2019-11-19 11:46   ` Philippe Mathieu-Daudé
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header Pete Batard
2019-11-19 11:51   ` Philippe Mathieu-Daudé
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 6/7] Platform/RPi: Read more variables from VideoCore during early init Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 7/7] Platform/RPi: Clean up and improve early memory init Pete Batard
2019-11-19 18:20 ` [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox