bootstd: Provide a bootmeth method to obtain state info

Some bootmeths can provide information about what is available to boot.
For example, VBE simple provides access to the firmware state.

Add a new method for this, along with a sandbox test.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c
index 81421f5..5d2e87b 100644
--- a/test/boot/bootmeth.c
+++ b/test/boot/bootmeth.c
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#include <bootmeth.h>
 #include <bootstd.h>
+#include <dm.h>
 #include <test/suites.h>
 #include <test/ut.h>
 #include "bootstd_common.h"
@@ -120,3 +122,19 @@
 	return 0;
 }
 BOOTSTD_TEST(bootmeth_env, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
+
+/* Check the get_state_desc() method */
+static int bootmeth_state(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+	char buf[50];
+
+	ut_assertok(uclass_first_device(UCLASS_BOOTMETH, &dev));
+	ut_assertnonnull(dev);
+
+	ut_assertok(bootmeth_get_state_desc(dev, buf, sizeof(buf)));
+	ut_asserteq_str("OK", buf);
+
+	return 0;
+}
+BOOTSTD_TEST(bootmeth_state, UT_TESTF_DM | UT_TESTF_SCAN_FDT);