]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg DXE Core: Update implementation of SetMemorySpaceAttributes() DXE Servic...
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 23 Nov 2011 08:15:14 +0000 (08:15 +0000)
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 23 Nov 2011 08:15:14 +0000 (08:15 +0000)
Signed-off-by: rsun3
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12766 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/Core/Dxe/Gcd/Gcd.c

index 4949b9f552cd0c5ce2fab7837652cedf03e6c419..8cdfe0605432a879e3b30aebf2558a6468cbd65a 100644 (file)
@@ -1683,8 +1683,18 @@ CoreGetMemorySpaceDescriptor (
   @param  Length                 Specified length\r
   @param  Attributes             Specified attributes\r
 \r
-  @retval EFI_SUCCESS            Successfully set attribute of a segment of\r
-                                 memory space.\r
+  @retval EFI_SUCCESS           The attributes were set for the memory region.\r
+  @retval EFI_INVALID_PARAMETER Length is zero. \r
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory\r
+                                resource range specified by BaseAddress and Length.\r
+  @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for the memory resource\r
+                                range specified by BaseAddress and Length.\r
+  @retval EFI_ACCESS_DEFINED    The attributes for the memory resource range specified by\r
+                                BaseAddress and Length cannot be modified.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of\r
+                                the memory resource range.\r
+  @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
+                                not available yet.\r
 \r
 **/\r
 EFI_STATUS\r
index 5292d368c5a0a89a1aa6dd795fedf754dd86821b..49697ae89c0535a7ae9dbfca0fcee8e8c5e434d1 100644 (file)
@@ -689,7 +689,8 @@ ConverToCpuArchAttributes (
   @retval EFI_NOT_FOUND          Free a non-using space or remove a non-exist\r
                                  space, and so on.\r
   @retval EFI_OUT_OF_RESOURCES   No buffer could be allocated.\r
-\r
+  @retval EFI_NOT_AVAILABLE_YET  The attributes cannot be set because CPU architectural protocol\r
+                                 is not available yet.\r
 **/\r
 EFI_STATUS\r
 CoreConvertSpace (\r
@@ -831,16 +832,20 @@ CoreConvertSpace (
     //\r
     CpuArchAttributes = ConverToCpuArchAttributes (Attributes);\r
     if (CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES) {\r
-      if (gCpu != NULL) {\r
+      if (gCpu == NULL) {\r
+        Status = EFI_NOT_AVAILABLE_YET;\r
+      } else {\r
         Status = gCpu->SetMemoryAttributes (\r
                          gCpu,\r
                          BaseAddress,\r
                          Length,\r
                          CpuArchAttributes\r
                          );\r
-        if (EFI_ERROR (Status)) {\r
-          goto Done;\r
-        }\r
+      }\r
+      if (EFI_ERROR (Status)) {\r
+        CoreFreePool (TopEntry);\r
+        CoreFreePool (BottomEntry);\r
+        goto Done;\r
       }\r
     }\r
   }\r
@@ -1524,8 +1529,18 @@ CoreGetMemorySpaceDescriptor (
   @param  Length                 Specified length\r
   @param  Attributes             Specified attributes\r
 \r
-  @retval EFI_SUCCESS            Successfully set attribute of a segment of\r
-                                 memory space.\r
+  @retval EFI_SUCCESS           The attributes were set for the memory region.\r
+  @retval EFI_INVALID_PARAMETER Length is zero. \r
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory\r
+                                resource range specified by BaseAddress and Length.\r
+  @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for the memory resource\r
+                                range specified by BaseAddress and Length.\r
+  @retval EFI_ACCESS_DEFINED    The attributes for the memory resource range specified by\r
+                                BaseAddress and Length cannot be modified.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of\r
+                                the memory resource range.\r
+  @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
+                                not available yet.\r
 \r
 **/\r
 EFI_STATUS\r