-/* $OpenBSD: exec.c,v 1.7 2016/05/17 23:16:10 kettenis Exp $ */
+/* $OpenBSD: exec.c,v 1.8 2016/06/21 15:39:51 kettenis Exp $ */
/*
* Copyright (c) 2006, 2016 Mark Kettenis
#include <sys/param.h>
#include <sys/reboot.h>
-#include <machine/bootconfig.h>
#include <dev/cons.h>
#include <lib/libkern/libkern.h>
#include "efiboot.h"
#include "libsa.h"
-extern void *fdt;
-
typedef void (*startfuncp)(void *, void *, void *) __attribute__ ((noreturn));
-struct uboot_tag_header {
- uint32_t size;
- uint32_t tag;
-};
-struct uboot_tag_core {
- uint32_t flags;
- uint32_t pagesize;
- uint32_t rootdev;
-};
-struct uboot_tag_serialnr {
- uint32_t low;
- uint32_t high;
-};
-struct uboot_tag_revision {
- uint32_t rev;
-};
-struct uboot_tag_mem32 {
- uint32_t size;
- uint32_t start;
-};
-struct uboot_tag_cmdline {
- char cmdline[64];
-};
-
-#define ATAG_CORE 0x54410001
-#define ATAG_MEM 0x54410002
-#define ATAG_CMDLINE 0x54410009
-#define ATAG_SERIAL 0x54410006
-#define ATAG_REVISION 0x54410007
-#define ATAG_NONE 0x00000000
-struct uboot_tag {
- struct uboot_tag_header hdr;
- union {
- struct uboot_tag_core core;
- struct uboot_tag_mem32 mem;
- struct uboot_tag_revision rev;
- struct uboot_tag_serialnr serialnr;
- struct uboot_tag_cmdline cmdline;
- } u;
-};
-
-struct uboot_tag tags[3];
-
void
run_loadfile(u_long *marks, int howto)
{
*++cp = 0;
fdt = efi_makebootargs(args, &board_id);
- if (fdt == 0) {
- tags[0].hdr.tag = ATAG_MEM;
- tags[0].hdr.size = sizeof(struct uboot_tag) / sizeof(uint32_t);
- tags[0].u.mem.start = 0x10000000;
- tags[0].u.mem.size = 0x80000000;
- tags[1].hdr.tag = ATAG_CMDLINE;
- tags[1].hdr.size = sizeof(struct uboot_tag) / sizeof(uint32_t);
- strlcpy(tags[1].u.cmdline.cmdline, args,
- sizeof(tags[1].u.cmdline.cmdline));
-
- memcpy((void *)0x10000000, tags, sizeof(tags));
- fdt = (void *)0x10000000;
- board_id = 4821;
- }
efi_cleanup();