Loading...
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (c) 2011 The Chromium OS Authors.
 *
 * (C) Copyright 2002
 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
 * Marius Groeger <mgroeger@sysgo.de>
 *
 * (C) Copyright 2002
 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
 * Alex Zuepke <azu@sysgo.de>
 */

#ifndef _U_BOOT_SANDBOX_H_
#define _U_BOOT_SANDBOX_H_

#include <linux/compiler_attributes.h>

struct global_data;

/* board/.../... */
int board_init(void);

/* start.c */
int sandbox_early_getopt_check(void);
int sandbox_main_loop_init(void);

/* drivers/video/sandbox_sdl.c */
int sandbox_lcd_sdl_early_init(void);

struct udevice;

/**
 * sandbox_reset() - reset sandbox
 *
 * This functions implements the cold reboot of the sandbox. It relaunches the
 * U-Boot binary with the same command line parameters as the original call.
 * The PID of the process stays the same. All file descriptors that have not
 * been opened with O_CLOEXEC stay open including stdin, stdout, stderr.
 */
void sandbox_reset(void);

/* Exit sandbox (quit U-Boot) */
void __noreturn sandbox_exit(int exit_code);

/**
 * sandbox_init() - init sandbox
 *
 * This function initialises sandbox state, parses arguments, and sets up the
 * global data structure, but does not call board_init_f().
 *
 * The caller must zero @data before calling this function. This function sets
 * gd to point to @data so it must remain valid for the life of sandbox.
 *
 * @argc:	the number of arguments passed to the program
 * @argv:	array of argc pointers, plus a NULL terminator
 * @data:	pointer to global data structure to init
 * Return: 0 if OK, -ve on error
 */
int sandbox_init(int argc, char *argv[], struct global_data *data);

/**
 * sandbox_main() - main entrypoint for sandbox
 *
 * @argc:	the number of arguments passed to the program
 * @argv:	array of argc+1 pointers, of which the last one is null
 *
 * This calls sandbox_init(), then board_init_f/r(). It does not return unless
 * something goes wrong.
 *
 * @argc:	the number of arguments passed to the program
 * @argv:	array of argc pointers, plus a NULL terminator
 *
 * Return: 1 on error
 */
int sandbox_main(int argc, char *argv[]);

#endif	/* _U_BOOT_SANDBOX_H_ */