]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/Memory/MemoryServices.c
Temporarily rollback the change from 5625 though 5628 for more investigation.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Memory / MemoryServices.c
index 457804fef2b5197a661dbcdca63d3e10d6d52efc..d24897d7767b505022f074df42f25342b67881b3 100644 (file)
@@ -1,5 +1,6 @@
-/*++\r
-\r
+/** @file\r
+  EFI PEI Core memory services\r
+  \r
 Copyright (c) 2006, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
@@ -9,55 +10,37 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
+**/\r
 \r
-  MemoryServices.c\r
+#include <PeiMain.h>\r
 \r
-Abstract:\r
+/**\r
 \r
-  EFI PEI Core memory services\r
-\r
---*/\r
+  Initialize the memory services.\r
 \r
-#include <PeiMain.h>\r
 \r
-static EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiPeiMemoryDiscoveredPpiGuid,\r
-  NULL\r
-};\r
+  @param PrivateData     Add parameter description\r
+  @param SecCoreData     Points to a data structure containing information about the PEI core's operating\r
+                         environment, such as the size and location of temporary RAM, the stack location and\r
+                         the BFV location.\r
+  @param OldCoreData     Pointer to the PEI Core data.\r
+                         NULL if being run in non-permament memory mode.\r
 \r
+**/\r
 VOID\r
 InitializeMemoryServices (\r
   IN PEI_CORE_INSTANCE           *PrivateData,\r
   IN CONST EFI_SEC_PEI_HAND_OFF  *SecCoreData,\r
   IN PEI_CORE_INSTANCE           *OldCoreData\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialize the memory services.\r
-\r
-Arguments:\r
-\r
-  PeiServices          - The PEI core services table.\r
-  SecCoreData          - Points to a data structure containing information about the PEI core's operating\r
-                         environment, such as the size and location of temporary RAM, the stack location and\r
-                         the BFV location.\r
-\r
-  OldCoreData          - Pointer to the PEI Core data.\r
-                         NULL if being run in non-permament memory mode.\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   \r
   PrivateData->SwitchStackSignal      = FALSE;\r
 \r
+  //\r
+  // First entering PeiCore, following code will initialized some field\r
+  // in PeiCore's private data according to hand off data from sec core.\r
+  //\r
   if (OldCoreData == NULL) {\r
 \r
     PrivateData->PeiMemoryInstalled = FALSE;\r
@@ -91,6 +74,18 @@ Returns:
   return;\r
 }\r
 \r
+/**\r
+\r
+  Install the permanent memory is now available.\r
+  Creates HOB (PHIT and Stack).\r
+\r
+  @param PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param MemoryBegin        Start of memory address.\r
+  @param MemoryLength       Length of memory.\r
+\r
+  @return EFI_SUCCESS Always success.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiInstallPeiMemory (\r
@@ -98,24 +93,6 @@ PeiInstallPeiMemory (
   IN EFI_PHYSICAL_ADDRESS    MemoryBegin,\r
   IN UINT64                  MemoryLength\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Install the permanent memory is now available.\r
-  Creates HOB (PHIT and Stack).\r
-\r
-Arguments:\r
-\r
-  PeiServices   - The PEI core services table.\r
-  MemoryBegin   - Start of memory address.\r
-  MemoryLength  - Length of memory.\r
-\r
-Returns:\r
-\r
-  Status  - EFI_SUCCESS\r
-            \r
---*/\r
 {\r
   PEI_CORE_INSTANCE                     *PrivateData;\r
 \r
@@ -131,6 +108,24 @@ Returns:
   return EFI_SUCCESS;   \r
 }\r
 \r
+/**\r
+\r
+  Memory allocation service on permanent memory,\r
+  not usable prior to the memory installation.\r
+\r
+\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param MemoryType      Type of memory to allocate.\r
+  @param Pages           Number of pages to allocate.\r
+  @param Memory          Pointer of memory allocated.\r
+\r
+  @retval EFI_SUCCESS              The allocation was successful\r
+  @retval EFI_INVALID_PARAMETER    Only AllocateAnyAddress is supported.\r
+  @retval EFI_NOT_AVAILABLE_YET    Called with permanent memory not available\r
+  @retval EFI_OUT_OF_RESOURCES     There is not enough HOB heap to satisfy the requirement\r
+                                   to allocate the number of pages.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiAllocatePages (\r
@@ -139,29 +134,6 @@ PeiAllocatePages (
   IN UINTN                      Pages,\r
   OUT EFI_PHYSICAL_ADDRESS      *Memory\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Memory allocation service on permanent memory, \r
-  not usable prior to the memory installation.\r
-\r
-Arguments:\r
-\r
-  PeiServices - The PEI core services table.\r
-  MemoryType  - Type of memory to allocate.\r
-  Pages       - Number of pages to allocate.\r
-  Memory      - Pointer of memory allocated.\r
-\r
-Returns:\r
-\r
-  Status - EFI_SUCCESS              The allocation was successful\r
-           EFI_INVALID_PARAMETER    Only AllocateAnyAddress is supported.\r
-           EFI_NOT_AVAILABLE_YET    Called with permanent memory not available\r
-           EFI_OUT_OF_RESOURCES     There is not enough HOB heap to satisfy the requirement\r
-                                    to allocate the number of pages.\r
-\r
---*/\r
 {\r
   PEI_CORE_INSTANCE                       *PrivateData;\r
   EFI_PEI_HOB_POINTERS                    Hob;\r
@@ -191,8 +163,6 @@ Returns:
     FreeMemoryBottom  = &(Hob.HandoffInformationTable->EfiFreeMemoryBottom);\r
   }\r
 \r
-  \r
-\r
   //\r
   // Check to see if on 4k boundary\r
   //\r
@@ -238,7 +208,20 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+\r
+  Memory allocation service on the CAR.\r
+\r
+\r
+  @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param Size            Amount of memory required\r
+  @param Buffer          Address of pointer to the buffer\r
+\r
+  @retval EFI_SUCCESS              The allocation was successful\r
+  @retval EFI_OUT_OF_RESOURCES     There is not enough heap to satisfy the requirement\r
+                                   to allocate the requested size.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiAllocatePool (\r
@@ -246,27 +229,6 @@ PeiAllocatePool (
   IN UINTN                      Size,\r
   OUT VOID                      **Buffer\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Memory allocation service on the CAR.  \r
-\r
-Arguments:\r
-\r
-  PeiServices - The PEI core services table.\r
-\r
-  Size        - Amount of memory required\r
-\r
-  Buffer      - Address of pointer to the buffer\r
-\r
-Returns:\r
-\r
-  Status - EFI_SUCCESS              The allocation was successful\r
-           EFI_OUT_OF_RESOURCES     There is not enough heap to satisfy the requirement\r
-                                    to allocate the requested size.\r
-                                    \r
---*/\r
 {\r
   EFI_STATUS               Status;\r
   EFI_HOB_MEMORY_POOL      *Hob;\r