Commit ff6301da authored by Ivan Hu's avatar Ivan Hu Committed by Matt Fleming

efi: Add efi_test driver for exporting UEFI runtime service interfaces

This driver is used by the Firmware Test Suite (FWTS) for testing the UEFI
runtime interfaces readiness of the firmware.

This driver exports UEFI runtime service interfaces into userspace,
which allows to use and test UEFI runtime services provided by the
firmware.

This driver uses the efi.<service> function pointers directly instead of
going through the efivar API to allow for direct testing of the UEFI
runtime service interfaces provided by the firmware.

Details for FWTS are available from,
<https://wiki.ubuntu.com/FirmwareTestSuite>
Signed-off-by: default avatarIvan Hu <ivan.hu@canonical.com>
Cc: joeyli <jlee@suse.com>
Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
parent 3dad6f7f
......@@ -4583,6 +4583,13 @@ M: Peter Jones <pjones@redhat.com>
S: Maintained
F: drivers/video/fbdev/efifb.c
EFI TEST DRIVER
L: linux-efi@vger.kernel.org
M: Ivan Hu <ivan.hu@canonical.com>
M: Matt Fleming <matt@codeblueprint.co.uk>
S: Maintained
F: drivers/firmware/efi/test/
EFS FILESYSTEM
W: http://aeschi.ch.eu.org/efs/
S: Orphan
......
......@@ -112,6 +112,23 @@ config EFI_CAPSULE_LOADER
Most users should say N.
config EFI_TEST
tristate "EFI Runtime Service Tests Support"
depends on EFI
default n
help
This driver uses the efi.<service> function pointers directly instead
of going through the efivar API, because it is not trying to test the
kernel subsystem, just for testing the UEFI runtime service
interfaces which are provided by the firmware. This driver is used
by the Firmware Test Suite (FWTS) for testing the UEFI runtime
interfaces readiness of the firmware.
Details for FWTS are available from:
<https://wiki.ubuntu.com/FirmwareTestSuite>
Say Y here to enable the runtime services support via /dev/efi_test.
If unsure, say N.
endmenu
config UEFI_CPER
......
......@@ -20,6 +20,7 @@ obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o
obj-$(CONFIG_EFI_STUB) += libstub/
obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_mem.o
obj-$(CONFIG_EFI_BOOTLOADER_CONTROL) += efibc.o
obj-$(CONFIG_EFI_TEST) += test/
arm-obj-$(CONFIG_EFI) := arm-init.o arm-runtime.o
obj-$(CONFIG_ARM) += $(arm-obj-y)
......
obj-$(CONFIG_EFI_TEST) += efi_test.o
This diff is collapsed.
/*
* EFI Test driver Header
*
* Copyright(C) 2012-2016 Canonical Ltd.
*
*/
#ifndef _DRIVERS_FIRMWARE_EFI_TEST_H_
#define _DRIVERS_FIRMWARE_EFI_TEST_H_
#include <linux/efi.h>
struct efi_getvariable {
efi_char16_t *variable_name;
efi_guid_t *vendor_guid;
u32 *attributes;
unsigned long *data_size;
void *data;
efi_status_t *status;
} __packed;
struct efi_setvariable {
efi_char16_t *variable_name;
efi_guid_t *vendor_guid;
u32 attributes;
unsigned long data_size;
void *data;
efi_status_t *status;
} __packed;
struct efi_getnextvariablename {
unsigned long *variable_name_size;
efi_char16_t *variable_name;
efi_guid_t *vendor_guid;
efi_status_t *status;
} __packed;
struct efi_queryvariableinfo {
u32 attributes;
u64 *maximum_variable_storage_size;
u64 *remaining_variable_storage_size;
u64 *maximum_variable_size;
efi_status_t *status;
} __packed;
struct efi_gettime {
efi_time_t *time;
efi_time_cap_t *capabilities;
efi_status_t *status;
} __packed;
struct efi_settime {
efi_time_t *time;
efi_status_t *status;
} __packed;
struct efi_getwakeuptime {
efi_bool_t *enabled;
efi_bool_t *pending;
efi_time_t *time;
efi_status_t *status;
} __packed;
struct efi_setwakeuptime {
efi_bool_t enabled;
efi_time_t *time;
efi_status_t *status;
} __packed;
struct efi_getnexthighmonotoniccount {
u32 *high_count;
efi_status_t *status;
} __packed;
struct efi_querycapsulecapabilities {
efi_capsule_header_t **capsule_header_array;
unsigned long capsule_count;
u64 *maximum_capsule_size;
int *reset_type;
efi_status_t *status;
} __packed;
#define EFI_RUNTIME_GET_VARIABLE \
_IOWR('p', 0x01, struct efi_getvariable)
#define EFI_RUNTIME_SET_VARIABLE \
_IOW('p', 0x02, struct efi_setvariable)
#define EFI_RUNTIME_GET_TIME \
_IOR('p', 0x03, struct efi_gettime)
#define EFI_RUNTIME_SET_TIME \
_IOW('p', 0x04, struct efi_settime)
#define EFI_RUNTIME_GET_WAKETIME \
_IOR('p', 0x05, struct efi_getwakeuptime)
#define EFI_RUNTIME_SET_WAKETIME \
_IOW('p', 0x06, struct efi_setwakeuptime)
#define EFI_RUNTIME_GET_NEXTVARIABLENAME \
_IOWR('p', 0x07, struct efi_getnextvariablename)
#define EFI_RUNTIME_QUERY_VARIABLEINFO \
_IOR('p', 0x08, struct efi_queryvariableinfo)
#define EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT \
_IOR('p', 0x09, struct efi_getnexthighmonotoniccount)
#define EFI_RUNTIME_QUERY_CAPSULECAPABILITIES \
_IOR('p', 0x0A, struct efi_querycapsulecapabilities)
#endif /* _DRIVERS_FIRMWARE_EFI_TEST_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment