+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2011-2012 The Chromium OS Authors.
- * SPDX-License-Identifier: GPL-2.0+
*/
#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>
/**
};
struct sandbox_spi_info {
- const char *spec;
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 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 */
+ 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 */
/* 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 */
};
/* Minimum space we guarantee in the state FDT when calling read/write*/
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);
+
+/**
* Initialize the test system state
*/
int state_init(void);