ACK: [PATCH] uefirtvariable: add new test for UEFI runtime QueryVariableInfo
Alex Hung
alex.hung at canonical.com
Wed Jan 2 02:45:27 UTC 2013
On 12/27/2012 04:06 PM, Ivan Hu wrote:
> This test tests the UEFI runtime service QueryVariableInfo interface.
> The QueryVaruableInfo interface is supported after UEFI spec 2.0.
> The kernel in efi.c will check the revision of system table got from
> firmware to see if the firmware implemented after UEFI spec 2.0, i.e.
> the value FirmeareRevision. If the value less than
> EFI_2_00_SYSTEM_TABLE_REVISION, kernel returns EFI_UNSUPPORT.
> If test returns EFI_UNSUPPORT, suggest firmware also need to check the
> system table item FirmwareRevision, to avoid that directly return unsupported
> from kernel.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> src/uefi/uefirtvariable/uefirtvariable.c | 46 ++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 189d8b3..2b66371 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -695,6 +695,26 @@ static int setvariable_test6(fwts_framework *fw)
> return FWTS_OK;
> }
>
> +static int do_queryvariableinfo(uint64_t *status, uint64_t *remvarstoragesize, uint64_t *maxvariablesize)
> +{
> + long ioret;
> + struct efi_queryvariableinfo queryvariableinfo;
> + uint64_t maxvarstoragesize;
> +
> + queryvariableinfo.Attributes = attributes;
> + queryvariableinfo.MaximumVariableStorageSize = &maxvarstoragesize;
> + queryvariableinfo.RemainingVariableStorageSize = remvarstoragesize;
> + queryvariableinfo.MaximumVariableSize = maxvariablesize;
> + queryvariableinfo.status = status;
> +
> + ioret = ioctl(fd, EFI_RUNTIME_QUERY_VARIABLEINFO, &queryvariableinfo);
> +
> + if (ioret == -1)
> + return FWTS_ERROR;
> +
> + return FWTS_OK;
> +}
> +
> static int uefirtvariable_test1(fwts_framework *fw)
> {
> uint64_t datasize = 10;
> @@ -754,10 +774,36 @@ static int uefirtvariable_test3(fwts_framework *fw)
> return FWTS_OK;
> }
>
> +static int uefirtvariable_test4(fwts_framework *fw)
> +{
> + uint64_t status;
> + uint64_t remvarstoragesize;
> + uint64_t maxvariablesize;
> +
> + if (do_queryvariableinfo(&status, &remvarstoragesize, &maxvariablesize) == FWTS_ERROR) {
> + if (status == EFI_UNSUPPORTED) {
> + fwts_skipped(fw, "Not support the QueryVariableInfo UEFI runtime interface: cannot test.");
> + fwts_advice(fw, "Firmware also needs to check if the revision of system table is correct or not."
> + " Linux kernel returns EFI_UNSUPPORTED as well, if the FirmwareRevision"
> + " of system table is less than EFI_2_00_SYSTEM_TABLE_REVISION.");
> + return FWTS_SKIP;
> + } else {
> + fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeQueryVariableInfo",
> + "Failed to query variable info with UEFI runtime service.");
> + fwts_uefi_print_status_info(fw, status);
> + return FWTS_ERROR;
> + }
> + }
> + fwts_passed(fw, "UEFI runtime service query variable info interface test passed.");
> +
> + return FWTS_OK;
> +}
> +
> static fwts_framework_minor_test uefirtvariable_tests[] = {
> { uefirtvariable_test1, "Test UEFI RT service get variable interface." },
> { uefirtvariable_test2, "Test UEFI RT service get next variable name interface." },
> { uefirtvariable_test3, "Test UEFI RT service set variable interface." },
> + { uefirtvariable_test4, "Test UEFI RT service query variable info interface." },
> { NULL, NULL }
> };
>
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list