+/**\r
+ Internal function. Used by the pool functions to allocate pages\r
+ to back pool allocation requests.\r
+\r
+ @param PoolType The type of memory for the new pool pages\r
+ @param NoPages No of pages to allocate\r
+ @param Granularity Bits to align.\r
+\r
+ @return The allocated memory, or NULL\r
+\r
+**/\r
+STATIC\r
+VOID *\r
+CoreAllocatePoolPagesI (\r
+ IN EFI_MEMORY_TYPE PoolType,\r
+ IN UINTN NoPages,\r
+ IN UINTN Granularity\r
+ )\r
+{\r
+ VOID *Buffer;\r
+ EFI_STATUS Status;\r
+\r
+ Status = CoreAcquireLockOrFail (&gMemoryLock);\r
+ if (EFI_ERROR (Status)) {\r
+ return NULL;\r
+ }\r
+\r
+ Buffer = CoreAllocatePoolPages (PoolType, NoPages, Granularity);\r
+ CoreReleaseMemoryLock ();\r
+\r
+ if (Buffer != NULL) {\r
+ ApplyMemoryProtectionPolicy (EfiConventionalMemory, PoolType,\r
+ (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, EFI_PAGES_TO_SIZE (NoPages));\r
+ }\r
+ return Buffer;\r
+}\r
+\r