Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Feb 2017 23:18:45 +0000 (UTC)
From:      Diane Bruce <db@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r433183 - in head/sysutils/u-boot-rpi3: . files
Message-ID:  <201702022318.v12NIjc9040023@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: db
Date: Thu Feb  2 23:18:45 2017
New Revision: 433183
URL: https://svnweb.freebsd.org/changeset/ports/433183

Log:
  Add gonzo's psci monitor code to support RPI3 SMP

Added:
  head/sysutils/u-boot-rpi3/files/patch-arch_arm_include_asm_system.h   (contents, props changed)
  head/sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_rpi.c   (contents, props changed)
Modified:
  head/sysutils/u-boot-rpi3/Makefile
  head/sysutils/u-boot-rpi3/distinfo

Modified: head/sysutils/u-boot-rpi3/Makefile
==============================================================================
--- head/sysutils/u-boot-rpi3/Makefile	Thu Feb  2 22:48:50 2017	(r433182)
+++ head/sysutils/u-boot-rpi3/Makefile	Thu Feb  2 23:18:45 2017	(r433183)
@@ -2,12 +2,14 @@
 
 PORTNAME=	u-boot
 PORTVERSION=	2016.11
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	ftp://ftp.denx.de/pub/u-boot/ \
 		LOCAL/db:bootfiles
 PKGNAMESUFFIX=	-rpi3
 DISTFILES=	u-boot-${PORTVERSION}.tar.bz2 \
-		rpi3-boot-files-2016.05.tar.bz2:bootfiles
+		rpi3-boot-files-2016.05.tar.bz2:bootfiles \
+		rpi3-psci-monitor-master.tgz:bootfiles
 
 MAINTAINER=	db@FreeBSD.org
 COMMENT=	Cross-build U-Boot loader for RPi3
@@ -23,6 +25,8 @@ USES=		gmake tar:bzip2
 SSP_UNSAFE=	yes # cross-LD does not support -fstack-protector
 
 WRK_BOOTFILES=	${WRKDIR}/rpi3-boot-files-2016.05
+PSCI_MONITOR=	rpi3-psci-monitor-master
+PSCI_DIR=	${WRKDIR}/${PSCI_MONITOR}
 
 U_BOOT_DIR=	share/u-boot/${PORTNAME}${PKGNAMESUFFIX}
 PLIST_FILES=	${U_BOOT_DIR}/u-boot.bin \
@@ -37,14 +41,20 @@ PLIST_FILES=	${U_BOOT_DIR}/u-boot.bin \
 		${U_BOOT_DIR}/start_db.elf \
 		${U_BOOT_DIR}/start_x.elf \
 		${U_BOOT_DIR}/config.txt \
-		${U_BOOT_DIR}/LICENCE.broadcom
+		${U_BOOT_DIR}/LICENCE.broadcom \
+		${U_BOOT_DIR}/armstub8.bin
 MAKE_ARGS+=	ARCH=arm \
 		CROSS_COMPILE=aarch64-none-elf- \
 		CONFIG_EFI=y
 
 do-configure:
+	(cd ${WRKDIR}; tar xvf ${DISTDIR}/${PSCI_MONITOR}.tgz)
 	(cd ${WRKSRC}; ${GMAKE} rpi_3_defconfig)
 
+do-build:
+	(cd ${WRKSRC}; ${GMAKE} ${MAKE_ARGS})
+	(cd ${PSCI_DIR}; ${MAKE})
+
 # The output of the u-boot build process is u-boot.bin.  Older firmware
 # versions require a standard header, but the recent versions (our case)
 # are capable of booting u-boot.bin directly.  Also copy the entire
@@ -55,5 +65,6 @@ do-install:
 	${INSTALL_DATA} ${WRKSRC}/u-boot.bin ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/
 	${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README
 	${INSTALL_DATA} ${WRK_BOOTFILES}/* ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
+	${INSTALL_DATA} ${PSCI_DIR}/pscimon.bin ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/armstub8.bin
 
 .include <bsd.port.mk>

Modified: head/sysutils/u-boot-rpi3/distinfo
==============================================================================
--- head/sysutils/u-boot-rpi3/distinfo	Thu Feb  2 22:48:50 2017	(r433182)
+++ head/sysutils/u-boot-rpi3/distinfo	Thu Feb  2 23:18:45 2017	(r433183)
@@ -1,5 +1,7 @@
-TIMESTAMP = 1479225351
+TIMESTAMP = 1486071382
 SHA256 (u-boot-2016.11.tar.bz2) = 45813e6565dcc0436abe6752624324cdbf5f3ac106570d76d32b46ec529bcdc8
 SIZE (u-boot-2016.11.tar.bz2) = 12019669
 SHA256 (rpi3-boot-files-2016.05.tar.bz2) = 8d5a2e453c9140d989133bc7cd991456138f4eb6c9722cd9eee4af4c1722e216
 SIZE (rpi3-boot-files-2016.05.tar.bz2) = 6905733
+SHA256 (rpi3-psci-monitor-master.tgz) = 47bbda7baede4e0a018869e9a7a9a05e37de5f8255ce6b5939c90bbd4f42f5a2
+SIZE (rpi3-psci-monitor-master.tgz) = 5033

Added: head/sysutils/u-boot-rpi3/files/patch-arch_arm_include_asm_system.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-rpi3/files/patch-arch_arm_include_asm_system.h	Thu Feb  2 23:18:45 2017	(r433183)
@@ -0,0 +1,48 @@
+--- arch/arm/include/asm/system.h.orig	2016-11-14 16:27:11 UTC
++++ arch/arm/include/asm/system.h
+@@ -201,22 +201,6 @@ void __noreturn psci_system_off(void);
+  * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3);
+  */
+ 
+-/**
+- * save_boot_params_ret() - Return from save_boot_params()
+- *
+- * If you provide save_boot_params(), then you should jump back to this
+- * function when done. Try to preserve all registers.
+- *
+- * If your implementation of save_boot_params() is in C then it is acceptable
+- * to simply call save_boot_params_ret() at the end of your function. Since
+- * there is no link register set up, you cannot just exit the function. U-Boot
+- * will return to the (initialised) value of lr, and likely crash/hang.
+- *
+- * If your implementation of save_boot_params() is in assembler then you
+- * should use 'b' or 'bx' to return to save_boot_params_ret.
+- */
+-void save_boot_params_ret(void);
+-
+ #ifdef CONFIG_ARMV7_LPAE
+ void switch_to_hypervisor_ret(void);
+ #endif
+@@ -410,6 +394,22 @@ void mmu_page_table_flush(unsigned long 
+ 
+ #ifndef __ASSEMBLY__
+ /**
++ * save_boot_params_ret() - Return from save_boot_params()
++ *
++ * If you provide save_boot_params(), then you should jump back to this
++ * function when done. Try to preserve all registers.
++ *
++ * If your implementation of save_boot_params() is in C then it is acceptable
++ * to simply call save_boot_params_ret() at the end of your function. Since
++ * there is no link register set up, you cannot just exit the function. U-Boot
++ * will return to the (initialised) value of lr, and likely crash/hang.
++ *
++ * If your implementation of save_boot_params() is in assembler then you
++ * should use 'b' or 'bx' to return to save_boot_params_ret.
++ */
++void save_boot_params_ret(void);
++
++/**
+  * Change the cache settings for a region.
+  *
+  * \param start		start address of memory region to change

Added: head/sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_rpi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_rpi.c	Thu Feb  2 23:18:45 2017	(r433183)
@@ -0,0 +1,44 @@
+--- board/raspberrypi/rpi/rpi.c.orig	2016-11-14 16:27:11 UTC
++++ board/raspberrypi/rpi/rpi.c
+@@ -13,6 +13,7 @@
+ #include <lcd.h>
+ #include <memalign.h>
+ #include <mmc.h>
++#include <asm/system.h>
+ #include <asm/gpio.h>
+ #include <asm/arch/mbox.h>
+ #include <asm/arch/sdhci.h>
+@@ -253,6 +254,22 @@ static struct mm_region bcm2837_mem_map[
+ };
+ 
+ struct mm_region *mem_map = bcm2837_mem_map;
++
++static u64 fw_fdt_address  __attribute__ ((section(".data")));
++static u64 reserve_memory  __attribute__ ((section(".data")));
++
++void save_boot_params(u64 x0, u64 x1, u64 x2, u64 x3)
++{
++	fw_fdt_address = x0;
++	reserve_memory = x1;
++	save_boot_params_ret();
++}
++
++void dram_init_banksize(void)
++{
++	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE + reserve_memory;
++	gd->bd->bi_dram[0].size = get_effective_memsize() - reserve_memory;
++}
+ #endif
+ 
+ int dram_init(void)
+@@ -362,6 +379,10 @@ int misc_init_r(void)
+ 	set_board_info();
+ #endif
+ 	set_serial_number();
++#ifdef CONFIG_ARM64
++	if (fw_fdt_address)
++		setenv_hex("fdt_addr_r", (ulong)fw_fdt_address);
++#endif
+ 
+ 	return 0;
+ }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702022318.v12NIjc9040023>