MdeModulePkg PeiCore: Correct the comments of PeiResetSystem2
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Reset / Reset.c
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 Pei Core Reset System Support\r
3 \r
c8721bb2 4Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 5This program and the accompanying materials \r
192f6d4c 6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
b1f6a7c6 13**/\r
192f6d4c 14\r
0d516397 15#include "PeiMain.h"\r
192f6d4c 16\r
b1f6a7c6 17/**\r
192f6d4c 18\r
b1f6a7c6 19 Core version of the Reset System\r
192f6d4c 20\r
192f6d4c 21\r
dc857d56 22 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
192f6d4c 23\r
b1f6a7c6 24 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r
25 @retval EFI_DEVICE_ERROR Did not reset system.\r
26 Otherwise, resets the system.\r
192f6d4c 27\r
b1f6a7c6 28**/\r
192f6d4c 29EFI_STATUS\r
30EFIAPI\r
31PeiResetSystem (\r
b0d803fe 32 IN CONST EFI_PEI_SERVICES **PeiServices\r
192f6d4c 33 )\r
192f6d4c 34{\r
35 EFI_STATUS Status;\r
36 EFI_PEI_RESET_PPI *ResetPpi;\r
37\r
38 Status = PeiServicesLocatePpi (\r
39 &gEfiPeiResetPpiGuid, \r
40 0, \r
41 NULL, \r
42 (VOID **)&ResetPpi \r
43 );\r
44\r
45 //\r
46 // LocatePpi returns EFI_NOT_FOUND on error\r
47 //\r
48 if (!EFI_ERROR (Status)) {\r
49 return ResetPpi->ResetSystem (PeiServices);\r
50 } \r
37623a5c 51 //\r
52 // Report Status Code that Reset PPI is not available\r
53 //\r
54 REPORT_STATUS_CODE (\r
55 EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
56 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)\r
57 );\r
192f6d4c 58 return EFI_NOT_AVAILABLE_YET;\r
59}\r
60\r
672473ea
SZ
61/**\r
62 Resets the entire platform.\r
63\r
64 @param[in] ResetType The type of reset to perform.\r
65 @param[in] ResetStatus The status code for the reset.\r
c8721bb2 66 @param[in] DataSize The size, in bytes, of ResetData.\r
672473ea
SZ
67 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
68 the data buffer starts with a Null-terminated string, optionally\r
69 followed by additional binary data. The string is a description\r
70 that the caller may use to further indicate the reason for the\r
71 system reset. ResetData is only valid if ResetStatus is something\r
72 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific\r
73 where a minimum amount of ResetData is always required.\r
74\r
75**/\r
76VOID\r
77EFIAPI\r
78PeiResetSystem2 (\r
79 IN EFI_RESET_TYPE ResetType,\r
80 IN EFI_STATUS ResetStatus,\r
81 IN UINTN DataSize,\r
82 IN VOID *ResetData OPTIONAL\r
83 )\r
84{\r
85 EFI_STATUS Status;\r
86 EFI_PEI_RESET2_PPI *Reset2Ppi;\r
87\r
88 Status = PeiServicesLocatePpi (\r
89 &gEfiPeiReset2PpiGuid,\r
90 0,\r
91 NULL,\r
92 (VOID **)&Reset2Ppi\r
93 );\r
94\r
95 if (!EFI_ERROR (Status)) {\r
96 Reset2Ppi->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
97 return;\r
98 }\r
99\r
100 //\r
101 // Report Status Code that Reset2 PPI is not available.\r
102 //\r
103 REPORT_STATUS_CODE (\r
104 EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
105 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)\r
106 );\r
107}\r
108\r