sandbox: Allow ethernet bootdevs to be disabled for tests

Most tests don't want these and can create a lot of noise. Add a way to
disable them. Use that in tests, with a flag provided to enable them for
tests that need this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/net.h b/include/net.h
index ee08f33..759d466 100644
--- a/include/net.h
+++ b/include/net.h
@@ -886,4 +886,20 @@
  */
 void reset_phy(void);
 
+#if CONFIG_IS_ENABLED(NET)
+/**
+ * eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs
+ *
+ * These get in the way of bootstd testing, so are normally disabled by tests.
+ * This provide control of this setting. It only affects binding of Ethernet
+ * devices, so if that has already happened, this flag does nothing.
+ *
+ * @enable: true to enable binding of bootdevs when binding new Ethernet
+ * devices, false to disable it
+ */
+void eth_set_enable_bootdevs(bool enable);
+#else
+static inline void eth_set_enable_bootdevs(bool enable) {}
+#endif
+
 #endif /* __NET_H__ */
diff --git a/include/test/test.h b/include/test/test.h
index 76ec4d7..beabe93 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -71,6 +71,7 @@
 	 * since it cannot access the flags.
 	 */
 	UT_TESTF_MANUAL		= BIT(8),
+	UT_TESTF_ETH_BOOTDEV	= BIT(9),	/* enable Ethernet bootdevs */
 };
 
 /**
@@ -194,4 +195,15 @@
 	return enabled;
 }
 
+/* Allow ethernet bootdev to be ignored for testing purposes */
+static inline bool test_eth_bootdev_enabled(void)
+{
+	bool enabled = true;
+
+#ifdef CONFIG_SANDBOX
+	enabled = sandbox_eth_enabled();
+#endif
+	return enabled;
+}
+
 #endif /* __TEST_TEST_H */