mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 02:15:45 +01:00 
			
		
		
		
	Commit e2f88dfd2d ("libfdt: Introduce new ARCH_FIXUP_FDT option")
allows us to skip memory setup of DTB, but a problem for ARM is that
spin_table_update_dt() and psci_update_dt() are skipped as well if
CONFIG_ARCH_FIXUP_FDT is disabled.
This commit allows us to skip only fdt_fixup_memory_banks() instead
of the whole of arch_fixup_fdt().  It will be useful when we want to
use a memory node from a kernel DTB as is, but need some fixups for
Spin-Table/PSCI.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Simon Glass <sjg@chromium.org>
Fixed build error for x86:
Signed-off-by: Simon Glass <sjg@chromium.org>
		
	
		
			
				
	
	
		
			69 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2011 The Chromium OS Authors.
 | |
|  * Copyright (c) 2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
 | |
|  * SPDX-License-Identifier:	GPL-2.0+
 | |
|  */
 | |
| 
 | |
| #include <common.h>
 | |
| #include <asm/io.h>
 | |
| 
 | |
| DECLARE_GLOBAL_DATA_PTR;
 | |
| 
 | |
| #define	LINUX_ARM_ZIMAGE_MAGIC	0x016f2818
 | |
| 
 | |
| struct arm_z_header {
 | |
| 	uint32_t	code[9];
 | |
| 	uint32_t	zi_magic;
 | |
| 	uint32_t	zi_start;
 | |
| 	uint32_t	zi_end;
 | |
| } __attribute__ ((__packed__));
 | |
| 
 | |
| int bootz_setup(ulong image, ulong *start, ulong *end)
 | |
| {
 | |
| 	uint8_t *zimage = map_sysmem(image, 0);
 | |
| 	struct arm_z_header *arm_hdr = (struct arm_z_header *)zimage;
 | |
| 	int ret = 0;
 | |
| 
 | |
| 	if (memcmp(zimage + 0x202, "HdrS", 4) == 0) {
 | |
| 		uint8_t setup_sects = *(zimage + 0x1f1);
 | |
| 		uint32_t syssize =
 | |
| 			le32_to_cpu(*(uint32_t *)(zimage + 0x1f4));
 | |
| 
 | |
| 		*start = 0;
 | |
| 		*end = (setup_sects + 1) * 512 + syssize * 16;
 | |
| 
 | |
| 		printf("setting up X86 zImage [ %ld - %ld ]\n",
 | |
| 		       *start, *end);
 | |
| 	} else if (le32_to_cpu(arm_hdr->zi_magic) == LINUX_ARM_ZIMAGE_MAGIC) {
 | |
| 		*start = le32_to_cpu(arm_hdr->zi_start);
 | |
| 		*end = le32_to_cpu(arm_hdr->zi_end);
 | |
| 
 | |
| 		printf("setting up ARM zImage [ %ld - %ld ]\n",
 | |
| 		       *start, *end);
 | |
| 	} else {
 | |
| 		printf("Unrecognized zImage\n");
 | |
| 		ret = 1;
 | |
| 	}
 | |
| 
 | |
| 	unmap_sysmem((void *)image);
 | |
| 
 | |
| 	return ret;
 | |
| }
 | |
| 
 | |
| int arch_fixup_fdt(void *blob)
 | |
| {
 | |
| 	return 0;
 | |
| }
 | |
| 
 | |
| int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 | |
| {
 | |
| 	if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
 | |
| 		bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 | |
| 		printf("## Transferring control to Linux (at address %08lx)...\n",
 | |
| 		       images->ep);
 | |
| 		printf("sandbox: continuing, as we cannot run Linux\n");
 | |
| 	}
 | |
| 
 | |
| 	return 0;
 | |
| }
 |