/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (c) 2011-2012 The Chromium OS Authors.
 */

#ifndef __SANDBOX_STATE_H
#define __SANDBOX_STATE_H

#include <config.h>
#include <sysreset.h>
#include <stdbool.h>
#include <linux/list.h>
#include <linux/stringify.h>

/**
 * Selects the behavior of the serial terminal.
 *
 * If Ctrl-C is processed by U-Boot, then the only way to quit sandbox is with
 * the 'reset' command, or equivalent.
 *
 * If the terminal is cooked, then Ctrl-C will terminate U-Boot, and the
 * command line will not be quite such a faithful emulation.
 *
 * Options are:
 *
 *	raw-with-sigs		- Raw, but allow signals (Ctrl-C will quit)
 *	raw			- Terminal is always raw
 *	cooked			- Terminal is always cooked
 */
enum state_terminal_raw {
	STATE_TERM_RAW_WITH_SIGS,	/* Default */
	STATE_TERM_RAW,
	STATE_TERM_COOKED,

	STATE_TERM_COUNT,
};

struct sandbox_spi_info {
	struct udevice *emul;
};

struct sandbox_wdt_info {
	unsigned long long counter;
	uint reset_count;
	bool running;
};

/**
 * struct sandbox_mapmem_entry - maps pointers to/from U-Boot addresses
 *
 * When map_to_sysmem() is called with an address outside sandbox's emulated
 * RAM, a record is created with a tag that can be used to reference that
 * pointer. When map_sysmem() is called later with that tag, the pointer will
 * be returned, just as it would for a normal sandbox address.
 *
 * @tag: Address tag (a value which U-Boot uses to refer to the address)
 * @ptr: Associated pointer for that tag
 */
struct sandbox_mapmem_entry {
	ulong tag;
	void *ptr;
	struct list_head sibling_node;
};

/* The complete state of the test system */
struct sandbox_state {
	const char *cmd;		/* Command to execute */
	bool interactive;		/* Enable cmdline after execute */
	bool run_distro_boot;		/* Automatically run distro bootcommands */
	const char *fdt_fname;		/* Filename of FDT binary */
	const char *parse_err;		/* Error to report from parsing */
	int argc;			/* Program arguments */
	char **argv;			/* Command line arguments */
	const char *jumped_fname;	/* Jumped from previous U-Boot */
	const char *prog_fname;		/* U-Boot executable filename */
	uint8_t *ram_buf;		/* Emulated RAM buffer */
	unsigned long ram_size;		/* Size of RAM buffer */
	const char *ram_buf_fname;	/* Filename to use for RAM buffer */
	bool ram_buf_rm;		/* Remove RAM buffer file after read */
	bool write_ram_buf;		/* Write RAM buffer on exit */
	const char *state_fname;	/* File containing sandbox state */
	void *state_fdt;		/* Holds saved state for sandbox */
	bool read_state;		/* Read sandbox state on startup */
	bool write_state;		/* Write sandbox state on exit */
	bool ignore_missing_state_on_read;	/* No error if state missing */
	bool show_lcd;			/* Show LCD on start-up */
	bool double_lcd;		/* Double display size for high-DPI */
	enum sysreset_t last_sysreset;	/* Last system reset type */
	bool sysreset_allowed[SYSRESET_COUNT];	/* Allowed system reset types */
	enum state_terminal_raw term_raw;	/* Terminal raw/cooked */
	bool skip_delays;		/* Ignore any time delays (for test) */
	bool show_test_output;		/* Don't suppress stdout in tests */
	int default_log_level;		/* Default log level for sandbox */
	bool ram_buf_read;		/* true if we read the RAM buffer */
	bool run_unittests;		/* Run unit tests */
	const char *select_unittests;	/* Unit test to run */
	bool handle_signals;		/* Handle signals within sandbox */
	bool autoboot_keyed;		/* Use keyed-autoboot feature */

	/* Pointer to information for each SPI bus/cs */
	struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
					[CONFIG_SANDBOX_SPI_MAX_CS];

	/* Information about Watchdog */
	struct sandbox_wdt_info wdt;

	ulong next_tag;			/* Next address tag to allocate */
	struct list_head mapmem_head;	/* struct sandbox_mapmem_entry */
	bool hwspinlock;		/* Hardware Spinlock status */
	bool allow_memio;		/* Allow readl() etc. to work */

	void *other_fdt_buf;		/* 'other' FDT blob used by tests */
	int other_size;			/* size of other FDT blob */

	/*
	 * This struct is getting large.
	 *
	 * Consider putting test data in driver-private structs, like
	 * sandbox_pch.c.
	 *
	 * If you add new members, please put them above this comment.
	 */
};

/* Minimum space we guarantee in the state FDT when calling read/write*/
#define SANDBOX_STATE_MIN_SPACE		0x1000

/**
 * struct sandbox_state_io - methods to saved/restore sandbox state
 * @name: Name of of the device tree node, also the name of the variable
 *	holding this data so it should be an identifier (use underscore
 *	instead of minus)
 * @compat: Compatible string for the node containing this state
 *
 * @read: Function to read state from FDT
 *	If data is available, then blob and node will provide access to it. If
 *	not (blob == NULL and node == -1) this function should set up an empty
 *	data set for start-of-day.
 *	@param blob: Pointer to device tree blob, or NULL if no data to read
 *	@param node: Node offset to read from
 *	Return: 0 if OK, -ve on error
 *
 * @write: Function to write state to FDT
 *	The caller will ensure that there is a node ready for the state. The
 *	node may already contain the old state, in which case it should be
 *	overridden. There is guaranteed to be SANDBOX_STATE_MIN_SPACE bytes
 *	of free space, so error checking is not required for fdt_setprop...()
 *	calls which add up to less than this much space.
 *
 *	For adding larger properties, use state_setprop().
 *
 * @param blob: Device tree blob holding state
 * @param node: Node to write our state into
 *
 * Note that it is possible to save data as large blobs or as individual
 * hierarchical properties. However, unless you intend to keep state files
 * around for a long time and be able to run an old state file on a new
 * sandbox, it might not be worth using individual properties for everything.
 * This is certainly supported, it is just a matter of the effort you wish
 * to put into the state read/write feature.
 */
struct sandbox_state_io {
	const char *name;
	const char *compat;
	int (*write)(void *blob, int node);
	int (*read)(const void *blob, int node);
};

/**
 * SANDBOX_STATE_IO - Declare sandbox state to read/write
 *
 * Sandbox permits saving state from one run and restoring it in another. This
 * allows the test system to retain state between runs and thus better
 * emulate a real system. Examples of state that might be useful to save are
 * the emulated GPIOs pin settings, flash memory contents and TPM private
 * data. U-Boot memory contents is dealth with separately since it is large
 * and it is not normally useful to save it (since a normal system does not
 * preserve DRAM between runs). See the '-m' option for this.
 *
 * See struct sandbox_state_io above for member documentation.
 */
#define SANDBOX_STATE_IO(_name, _compat, _read, _write) \
	ll_entry_declare(struct sandbox_state_io, _name, state_io) = { \
		.name = __stringify(_name), \
		.read = _read, \
		.write = _write, \
		.compat = _compat, \
	}

/**
 * Gets a pointer to the current state.
 *
 * Return: pointer to state
 */
struct sandbox_state *state_get_current(void);

/**
 * Read the sandbox state from the supplied device tree file
 *
 * This calls all registered state handlers to read in the sandbox state
 * from a previous test run.
 *
 * @param state		Sandbox state to update
 * @param fname		Filename of device tree file to read from
 * Return: 0 if OK, -ve on error
 */
int sandbox_read_state(struct sandbox_state *state, const char *fname);

/**
 * Write the sandbox state to the supplied device tree file
 *
 * This calls all registered state handlers to write out the sandbox state
 * so that it can be preserved for a future test run.
 *
 * If the file exists it is overwritten.
 *
 * @param state		Sandbox state to update
 * @param fname		Filename of device tree file to write to
 * Return: 0 if OK, -ve on error
 */
int sandbox_write_state(struct sandbox_state *state, const char *fname);

/**
 * Add a property to a sandbox state node
 *
 * This is equivalent to fdt_setprop except that it automatically enlarges
 * the device tree if necessary. That means it is safe to write any amount
 * of data here.
 *
 * This function can only be called from within struct sandbox_state_io's
 * ->write method, i.e. within state I/O drivers.
 *
 * @param node		Device tree node to write to
 * @param prop_name	Property to write
 * @param data		Data to write into property
 * @param size		Size of data to write into property
 */
int state_setprop(int node, const char *prop_name, const void *data, int size);

/**
 * Control skipping of time delays
 *
 * Some tests have unnecessay time delays (e.g. USB). Allow these to be
 * skipped to speed up testing
 *
 * @param skip_delays	true to skip delays from now on, false to honour delay
 *			requests
 */
void state_set_skip_delays(bool skip_delays);

/**
 * See if delays should be skipped
 *
 * Return: true if delays should be skipped, false if they should be honoured
 */
bool state_get_skip_delays(void);

/**
 * state_reset_for_test() - Reset ready to re-run tests
 *
 * This clears out any test state ready for another test run.
 */
void state_reset_for_test(struct sandbox_state *state);

/**
 * state_show() - Show information about the sandbox state
 *
 * @param state		Sandbox state to show
 */
void state_show(struct sandbox_state *state);

/**
 * state_get_rel_filename() - Get a filename relative to the executable
 *
 * This uses argv[0] to obtain a filename path
 *
 * @rel_path: Relative path to build, e.g. "arch/sandbox/dts/test.dtb". Must not
 * have a trailing /
 * @buf: Buffer to use to return the filename
 * @size: Size of buffer
 * @return length of filename (including terminator), -ENOSPC if @size is too
 * small
 */
int state_get_rel_filename(const char *rel_path, char *buf, int size);

/**
 * state_load_other_fdt() - load the 'other' FDT into a buffer
 *
 * This loads the other.dtb file into a buffer. This is typically used in tests.
 *
 * @bufp: Place to put allocated buffer pointer. The buffer is read using
 * os_read_file() which calls os_malloc(), so does affect U-Boot's own malloc()
 * space
 * @sizep: Returns the size of the buffer
 * @return 0 if OK, -ve on error
 */
int state_load_other_fdt(const char **bufp, int *sizep);

/**
 * Initialize the test system state
 */
int state_init(void);

/**
 * Uninitialize the test system state, writing out state if configured to
 * do so.
 *
 * Return: 0 if OK, -ve on error
 */
int state_uninit(void);

#endif
