+/**\r
+ Modifies the capabilities for a memory region in the global coherency domain of the\r
+ processor.\r
+\r
+ @param BaseAddress The physical address that is the start address of a memory region.\r
+ @param Length The size in bytes of the memory region.\r
+ @param Capabilities The bit mask of capabilities that the memory region supports.\r
+\r
+ @retval EFI_SUCCESS The capabilities were set for the memory region.\r
+ @retval EFI_INVALID_PARAMETER Length is zero.\r
+ @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the\r
+ memory region attributes currently in use.\r
+ @retval EFI_ACCESS_DENIED The capabilities 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 capabilities\r
+ of the memory resource range.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreSetMemorySpaceCapabilities (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN UINT64 Capabilities\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ DEBUG ((DEBUG_GCD, "GCD:CoreSetMemorySpaceCapabilities(Base=%016lx,Length=%016lx)\n", BaseAddress, Length));\r
+ DEBUG ((DEBUG_GCD, " Capabilities = %016lx\n", Capabilities));\r
+\r
+ Status = CoreConvertSpace (GCD_SET_CAPABILITIES_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, Capabilities, 0);\r
+ if (!EFI_ERROR(Status)) {\r
+ CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length, EFI_PAGE_SHIFT), Capabilities);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+\r