Merge tag 'u-boot-imx-20191009' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[oweals/u-boot.git] / arch / sandbox / include / asm / state.h
index 617f95291ab816f6d658d8c2157433c38fab1959..ad3e94beb9a77e79e6167cf2852b2eb7614ecf52 100644 (file)
@@ -1,6 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (c) 2011-2012 The Chromium OS Authors.
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef __SANDBOX_STATE_H
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <sysreset.h>
 #include <stdbool.h>
+#include <linux/list.h>
 #include <linux/stringify.h>
 
 /**
@@ -35,7 +36,6 @@ enum state_terminal_raw {
 };
 
 struct sandbox_spi_info {
-       const char *spec;
        struct udevice *emul;
 };
 
@@ -45,6 +45,23 @@ struct sandbox_wdt_info {
        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 */
@@ -71,6 +88,9 @@ struct sandbox_state {
        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 show_of_platdata;          /* Show of-platdata in SPL */
+       bool ram_buf_read;              /* true if we read the RAM buffer */
 
        /* Pointer to information for each SPI bus/cs */
        struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
@@ -78,6 +98,20 @@ struct sandbox_state {
 
        /* 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 */
+
+       /*
+        * 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*/
@@ -220,6 +254,13 @@ bool state_get_skip_delays(void);
  */
 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);
+
 /**
  * Initialize the test system state
  */