OvmfPkg/SerializeVariablesLib: Relax check for the read-only variable

When OVMF tried to restore the variables from the file-based NvVars, it
failed to set the read-only variable and aborted the restoration with
this message:

Variable Check ReadOnly variable fail Write Protected - 04B37FE8-F6AE-480B-BDD5-37D98C5E89AA:VarErrorFlag

Since it's a read-only variable maintained by the firmware, it's
pointless to restore the previous value, so the check can be
relaxed to allow EFI_WRITE_PROTECTED returned from SetVariable.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Gary Lin 2016-05-26 18:24:14 +08:00 committed by Laszlo Ersek
parent 251ca60496
commit db827286e2
1 changed files with 5 additions and 0 deletions

View File

@ -302,6 +302,11 @@ IterateVariablesCallbackSetSystemVariable (
"failed with EFI_SECURITY_VIOLATION, ignoring\n", __FUNCTION__,
VariableName));
Status = EFI_SUCCESS;
} else if (Status == EFI_WRITE_PROTECTED) {
DEBUG ((DEBUG_WARN, "%a: setting ReadOnly variable \"%s\" "
"failed with EFI_WRITE_PROTECTED, ignoring\n", __FUNCTION__,
VariableName));
Status = EFI_SUCCESS;
}
return Status;
}