X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fefi_selftest.h;h=08dd8e43ad1c1ec4f829257f68914cef2c294df5;hb=fbebea27e16eb760f1f2109a7535003bf359ba2b;hp=7ec42a0406bca52da1add4ddcc224c38ffa2b7c5;hpb=5ca23ed5bc63832baa24a6107537fdd229c458ae;p=u-boot diff --git a/include/efi_selftest.h b/include/efi_selftest.h index 7ec42a0406..08dd8e43ad 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -12,19 +12,35 @@ #include #include #include +#include #include #define EFI_ST_SUCCESS 0 #define EFI_ST_FAILURE 1 +/* + * Prints a message. + */ +#define efi_st_printf(...) \ + (efi_st_printc(-1, __VA_ARGS__)) + /* * Prints an error message. * * @... format string followed by fields to print */ #define efi_st_error(...) \ - (efi_st_printf("%s(%u):\nERROR: ", __FILE__, __LINE__), \ - efi_st_printf(__VA_ARGS__)) \ + (efi_st_printc(EFI_LIGHTRED, "%s(%u):\nERROR: ", __FILE__, __LINE__), \ + efi_st_printc(EFI_LIGHTRED, __VA_ARGS__)) + +/* + * Prints a TODO message. + * + * @... format string followed by fields to print + */ +#define efi_st_todo(...) \ + (efi_st_printc(EFI_YELLOW, "%s(%u):\nTODO: ", __FILE__, __LINE__), \ + efi_st_printc(EFI_YELLOW, __VA_ARGS__)) \ /* * A test may be setup and executed at boottime, @@ -51,14 +67,15 @@ extern struct efi_simple_input_interface *con_in; void efi_st_exit_boot_services(void); /* - * Print a pointer to an u16 string + * Print a colored message * - * @pointer: pointer - * @buf: pointer to buffer address - * on return position of terminating zero word + * @color color, see constants in efi_api.h, use -1 for no color + * @fmt printf format + * @... arguments to be printed + * on return position of terminating zero word */ -void efi_st_printf(const char *fmt, ...) - __attribute__ ((format (__printf__, 1, 2))); +void efi_st_printc(int color, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); /* * Compare memory. @@ -71,6 +88,15 @@ void efi_st_printf(const char *fmt, ...) */ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length); +/* + * Compare an u16 string to a char string. + * + * @buf1: u16 string + * @buf2: char string + * @return: 0 if both buffers contain the same bytes + */ +int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2); + /* * Reads an Unicode character from the input device. * @@ -88,6 +114,7 @@ u16 efi_st_get_key(void); * @setup: set up the unit test * @teardown: tear down the unit test * @execute: execute the unit test + * @on_request: test is only executed on request */ struct efi_unit_test { const char *name; @@ -96,6 +123,7 @@ struct efi_unit_test { const struct efi_system_table *systable); int (*execute)(void); int (*teardown)(void); + bool on_request; }; /* Declare a new EFI unit test */