Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2019 15:07:06 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355289 - in head/sys: arm64/arm64 arm64/conf arm64/include conf
Message-ID:  <201912021507.xB2F76BO071612@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Mon Dec  2 15:07:06 2019
New Revision: 355289
URL: https://svnweb.freebsd.org/changeset/base/355289

Log:
  revert r354714 "Boot arm64 kernel using booti command from U-boot."
  
  After discussing with mmel@, it was clear this is insufficient to address
  all the needs.  mmel@ will commit his original patch, from
  https://reviews.freebsd.org/D13861, and the additions needed from r354714
  will be made afterward.
  
  Requested by:	mmel
  Sponsored by:	Juniper Networks, Inc.

Deleted:
  head/sys/arm64/arm64/machdep_boot.c
Modified:
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/conf/GENERIC
  head/sys/arm64/include/machdep.h
  head/sys/conf/Makefile.arm64
  head/sys/conf/files.arm64
  head/sys/conf/options.arm64

Modified: head/sys/arm64/arm64/locore.S
==============================================================================
--- head/sys/arm64/arm64/locore.S	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/arm64/arm64/locore.S	Mon Dec  2 15:07:06 2019	(r355289)
@@ -54,29 +54,6 @@
 	.text
 	.globl _start
 _start:
-#ifdef LINUX_BOOT_ABI
-	/*
-	 * See Documentation/arm64/booting.txt in the Linux kernel.
-	 * This is needed to boot using U-Boot's booti command.
-	 */
-
-#define	BOOTI_MAGIC		0x644d5241
-#define	UBOOT_IMAGE_OFFSET	0
-#define	UBOOT_IMAGE_SIZE	_end - _start
-#define	UBOOT_IMAGE_FLAGS	0
-
-	b	1f			/* Executable code */
-	.long	0			/* Executable code */
-	.quad	UBOOT_IMAGE_OFFSET	/* Image load offset, little endian */
-	.quad	UBOOT_IMAGE_SIZE	/* Effective Image size, little endian */
-	.quad	UBOOT_IMAGE_FLAGS	/* kernel flags, little endian */
-	.quad	0			/* reserved */
-	.quad	0			/* reserved */
-	.quad	0			/* reserved */
-	.long	BOOTI_MAGIC		/* Magic number, little endian, "ARM\x64" */
-	.long	0			/* reserved (used for PE COFF offset) */
-1:
-#endif
 	/* Drop to EL1 */
 	bl	drop_to_el1
 
@@ -371,25 +348,15 @@ create_pagetables:
 	 * Build the TTBR1 maps.
 	 */
 
+	/* Find the size of the kernel */
 	mov	x6, #(KERNBASE)
-	and	x7, x0, x6
-	cmp	x7, x6
-	b.eq	1f
-	/* booted from U-Boot */
-	ldr     x7, .Lend
-	sub	x8, x7, x6	/* kernel size = end - begin */
-	b	2f
-1:
-	/* booted from FreeBSD loader */
-	sub	x8, x0, x6	/* size = modulep - begin */
+	/* Find modulep - begin */
+	sub	x8, x0, x6
 	/* Add two 2MiB pages for the module data and round up */
 	ldr	x7, =(3 * L2_SIZE - 1)
 	add	x8, x8, x7
-2:
 	/* Get the number of l2 pages to allocate, rounded down */
 	lsr	x10, x8, #(L2_SHIFT)
-	/* Add 1 to get actual count */
-	add	x10, x10, #1
 
 	/* Create the kernel space L2 table */
 	mov	x6, x26

Modified: head/sys/arm64/arm64/machdep.c
==============================================================================
--- head/sys/arm64/arm64/machdep.c	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/arm64/arm64/machdep.c	Mon Dec  2 15:07:06 2019	(r355289)
@@ -964,16 +964,6 @@ try_load_dtb(caddr_t kmdp)
 	vm_offset_t dtbp;
 
 	dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t);
-
-#if defined(FDT_DTB_STATIC)
-	/*
-	 * In case the device tree blob was not retrieved (from metadata) try
-	 * to use the statically embedded one.
-	 */
-	if (dtbp == 0)
-		dtbp = (vm_offset_t)&fdt_static_dtb;
-#endif
-
 	if (dtbp == (vm_offset_t)NULL) {
 		printf("ERROR loading DTB\n");
 		return;
@@ -1077,26 +1067,6 @@ cache_setup(void)
 	}
 }
 
-static vm_offset_t
-freebsd_parse_boot_param(struct arm64_bootparams *abp)
-{
-	vm_offset_t lastaddr;
-	void *kmdp;
-	static char *loader_envp;
-
-	preload_metadata = (caddr_t)(uintptr_t)(abp->modulep);
-	kmdp = preload_search_by_type("elf kernel");
-	if (kmdp == NULL)
-		return (0);
-
-	boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
-	loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
-	init_static_kenv(loader_envp, 0);
-	lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
-
-	return (lastaddr);
-}
-
 void
 initarm(struct arm64_bootparams *abp)
 {
@@ -1112,31 +1082,26 @@ initarm(struct arm64_bootparams *abp)
 	caddr_t kmdp;
 	bool valid;
 
-	if ((abp->modulep & VM_MIN_KERNEL_ADDRESS) ==
-	    VM_MIN_KERNEL_ADDRESS)
-		/* Booted from loader. */
-		lastaddr = freebsd_parse_boot_param(abp);
-#ifdef LINUX_BOOT_ABI
-	else
-		/* Booted from U-Boot. */
-		lastaddr = linux_parse_boot_param(abp);
-#endif
+	/* Set the module data location */
+	preload_metadata = (caddr_t)(uintptr_t)(abp->modulep);
 
 	/* Find the kernel address */
 	kmdp = preload_search_by_type("elf kernel");
 	if (kmdp == NULL)
 		kmdp = preload_search_by_type("elf64 kernel");
 
+	boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
+	init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0);
 	link_elf_ireloc(kmdp);
 
 #ifdef FDT
 	try_load_dtb(kmdp);
-#ifdef LINUX_BOOT_ABI
-	parse_bootargs(&lastaddr, abp);
 #endif
-#endif
 
 	efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t);
+
+	/* Find the address to start allocating from */
+	lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
 
 	/* Load the physical memory ranges */
 	efihdr = (struct efi_map_header *)preload_search_info(kmdp,

Modified: head/sys/arm64/conf/GENERIC
==============================================================================
--- head/sys/arm64/conf/GENERIC	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/arm64/conf/GENERIC	Mon Dec  2 15:07:06 2019	(r355289)
@@ -77,7 +77,6 @@ options 	RACCT_DEFAULT_TO_DISABLED # Set kern.racct.en
 options 	RCTL			# Resource limits
 options 	SMP
 options 	INTRNG
-options		LINUX_BOOT_ABI		# Boot using booti command from U-Boot
 
 # Debugging support.  Always need this:
 options 	KDB			# Enable kernel debugger support.

Modified: head/sys/arm64/include/machdep.h
==============================================================================
--- head/sys/arm64/include/machdep.h	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/arm64/include/machdep.h	Mon Dec  2 15:07:06 2019	(r355289)
@@ -48,9 +48,5 @@ extern enum arm64_bus arm64_bus_method;
 void dbg_init(void);
 void initarm(struct arm64_bootparams *);
 extern void (*pagezero)(void *);
-vm_offset_t linux_parse_boot_param(struct arm64_bootparams *);
-#ifdef LINUX_BOOT_ABI
-void parse_bootargs(vm_offset_t *, struct arm64_bootparams *);
-#endif
 
 #endif /* _MACHINE_MACHDEP_H_ */

Modified: head/sys/conf/Makefile.arm64
==============================================================================
--- head/sys/conf/Makefile.arm64	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/conf/Makefile.arm64	Mon Dec  2 15:07:06 2019	(r355289)
@@ -31,18 +31,6 @@ INCLUDES+= -I$S/contrib/libfdt
 CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif
 
-SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \
-	${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \
-	--dynamic-linker /red/herring \
-	-o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
-
-SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// $(LDSCRIPT)\
-		>ldscript.$M.noheader;\
-		${SYSTEM_LD_}; \
-		${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \
-		${KERNEL_KO}.bin; \
-		rm ${FULLKERNEL}.noheader
-
 %BEFORE_DEPEND
 
 %OBJS

Modified: head/sys/conf/files.arm64
==============================================================================
--- head/sys/conf/files.arm64	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/conf/files.arm64	Mon Dec  2 15:07:06 2019	(r355289)
@@ -154,7 +154,6 @@ arm64/arm64/identcpu.c		standard
 arm64/arm64/in_cksum.c		optional	inet | inet6
 arm64/arm64/locore.S		standard	no-obj
 arm64/arm64/machdep.c		standard
-arm64/arm64/machdep_boot.c	optional	linux_boot_abi
 arm64/arm64/mem.c		standard
 arm64/arm64/memcpy.S		standard
 arm64/arm64/memmove.S		standard

Modified: head/sys/conf/options.arm64
==============================================================================
--- head/sys/conf/options.arm64	Mon Dec  2 14:22:55 2019	(r355288)
+++ head/sys/conf/options.arm64	Mon Dec  2 15:07:06 2019	(r355289)
@@ -2,7 +2,6 @@
 
 ARM64				opt_global.h
 INTRNG				opt_global.h
-LINUX_BOOT_ABI			opt_global.h
 SOCDEV_PA			opt_global.h
 SOCDEV_VA			opt_global.h
 THUNDERX_PASS_1_1_ERRATA	opt_global.h



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