summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3088e81)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2170
6f19259b-4bc3-4df7-8a09-
765794883524
\r
if (Status == EFI_INVALID_PARAMETER) {\r
return Status;\r
\r
if (Status == EFI_INVALID_PARAMETER) {\r
return Status;\r
- }\r
- //\r
- // The size of the VariableName, including the Unicode Null in bytes plus\r
- // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
- //\r
- else if (sizeof (VARIABLE_HEADER) + (ArrayLength (VariableName) + DataSize) > MAX_VARIABLE_SIZE) {\r
+ } else if (!EFI_ERROR (Status) && Variable.Volatile && EfiAtRuntime()) {\r
+ //\r
+ // If EfiAtRuntime and the variable is Volatile and Runtime Access, \r
+ // the volatile is ReadOnly, and SetVariable should be aborted and \r
+ // return EFI_WRITE_PROTECTED.\r
+ //\r
+ return EFI_WRITE_PROTECTED;\r
+ } else if (sizeof (VARIABLE_HEADER) + (ArrayLength (VariableName) + DataSize) > MAX_VARIABLE_SIZE) {\r
+ //\r
+ // The size of the VariableName, including the Unicode Null in bytes plus\r
+ // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Make sure if runtime bit is set, boot service bit is set also\r
- //\r
- else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS\r
+ } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS\r
+ //\r
+ // Make sure if runtime bit is set, boot service bit is set also\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Runtime but Attribute is not Runtime\r
- //\r
- else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {\r
+ } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {\r
+ //\r
+ // Runtime but Attribute is not Runtime\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Cannot set volatile variable in Runtime\r
- //\r
- else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {\r
+ } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {\r
+ //\r
+ // Cannot set volatile variable in Runtime\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Setting a data variable with no access, or zero DataSize attributes\r
- // specified causes it to be deleted.\r
- //\r
- else if (DataSize == 0 || Attributes == 0) {\r
+ } else if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {\r
+ //\r
+ // Setting a data variable with no access, or zero DataSize attributes\r
+ // specified causes it to be deleted.\r
+ //\r
if (!EFI_ERROR (Status)) {\r
Variable.CurrPtr->State &= VAR_DELETED;\r
return EFI_SUCCESS;\r
if (!EFI_ERROR (Status)) {\r
Variable.CurrPtr->State &= VAR_DELETED;\r
return EFI_SUCCESS;\r
// Make sure RT Attribute is set if we are in Runtime phase.\r
//\r
return EFI_INVALID_PARAMETER;\r
// Make sure RT Attribute is set if we are in Runtime phase.\r
//\r
return EFI_INVALID_PARAMETER;\r
+ } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {\r
+ //\r
+ // Cannot Query volatile variable in Runtime\r
+ //\r
+ return EFI_INVALID_PARAMETER;\r
}\r
\r
if((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {\r
}\r
\r
if((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {\r
\r
if (Status == EFI_INVALID_PARAMETER) {\r
return Status;\r
\r
if (Status == EFI_INVALID_PARAMETER) {\r
return Status;\r
- }\r
- //\r
- // The size of the VariableName, including the Unicode Null in bytes plus\r
- // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
- //\r
- else if ((DataSize > MAX_VARIABLE_SIZE) ||\r
- (sizeof (VARIABLE_HEADER) + ArrayLength (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {\r
+ } else if (!EFI_ERROR (Status) && Variable.Volatile && EfiAtRuntime()) {\r
+ //\r
+ // If EfiAtRuntime and the variable is Volatile and Runtime Access, \r
+ // the volatile is ReadOnly, and SetVariable should be aborted and \r
+ // return EFI_WRITE_PROTECTED.\r
+ //\r
+ return EFI_WRITE_PROTECTED;\r
+ } else if (sizeof (VARIABLE_HEADER) + ArrayLength (VariableName) + DataSize > MAX_VARIABLE_SIZE) {\r
+ //\r
+ // The size of the VariableName, including the Unicode Null in bytes plus\r
+ // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Make sure if runtime bit is set, boot service bit is set also\r
- //\r
- else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS\r
- ) {\r
+ } else if (Attributes == EFI_VARIABLE_NON_VOLATILE) {\r
+ //\r
+ // Make sure not only EFI_VARIABLE_NON_VOLATILE is set \r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Runtime but Attribute is not Runtime\r
- //\r
- else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {\r
+ } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == \r
+ EFI_VARIABLE_RUNTIME_ACCESS) {\r
+ //\r
+ // Make sure if runtime bit is set, boot service bit is set also\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Cannot set volatile variable in Runtime\r
- //\r
- else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {\r
+ } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {\r
+ //\r
+ // Runtime but Attribute is not Runtime\r
+ //\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Setting a data variable with no access, or zero DataSize attributes\r
- // specified causes it to be deleted.\r
- //\r
- else if (DataSize == 0 || Attributes == 0) {\r
+ } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {\r
+ //\r
+ // Cannot set volatile variable in Runtime\r
+ //\r
+ return EFI_INVALID_PARAMETER;\r
+ } else if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {\r
+ //\r
+ // Setting a data variable with no access, or zero DataSize attributes\r
+ // specified causes it to be deleted.\r
+ //\r
if (!EFI_ERROR (Status)) {\r
State = Variable.CurrPtr->State;\r
State &= VAR_DELETED;\r
if (!EFI_ERROR (Status)) {\r
State = Variable.CurrPtr->State;\r
State &= VAR_DELETED;\r