u-boot/arch/sandbox/lib/bootm.c
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00

61 lines
1.5 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2011 The Chromium OS Authors.
* Copyright (c) 2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
*/
#include <common.h>
#include <asm/io.h>
#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 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;
}