if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_WARN, "Variable driver failed to get flash memory attribute.\n"));\r
} else {\r
- Status = gDS->SetMemorySpaceAttributes (\r
- BaseAddress,\r
- Length,\r
- GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME\r
- );\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));\r
+ if ((GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME) == 0) {\r
+ Status = gDS->SetMemorySpaceAttributes (\r
+ BaseAddress,\r
+ Length,\r
+ GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));\r
+ }\r
}\r
}\r
\r