Added DebugAgentTimerLib. Cleaned up .h files and other code.
[mirror_edk2.git] / Omap35xxPkg / Library / ResetSystemLib / ResetSystemLib.c
CommitLineData
a3f98646 1/** @file\r
2 Template library implementation to support ResetSystem Runtime call.\r
3 \r
4 Fill in the templates with what ever makes you system reset.\r
5\r
6\r
7 Copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
8 \r
9 All rights reserved. This program and the accompanying materials\r
10 are licensed and made available under the terms and conditions of the BSD License\r
11 which accompanies this distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17**/\r
18\r
19\r
20#include <PiDxe.h>\r
21\r
22#include <Library/PcdLib.h>\r
23#include <Library/ArmLib.h>\r
24#include <Library/CacheMaintenanceLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/EfiResetSystemLib.h>\r
27\r
28#include <Library/BeagleBoardSystemLib.h>\r
29\r
30/**\r
31 Resets the entire platform.\r
32\r
33 @param ResetType The type of reset to perform.\r
34 @param ResetStatus The status code for the reset.\r
35 @param DataSize The size, in bytes, of WatchdogData.\r
36 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
37 EfiResetShutdown the data buffer starts with a Null-terminated\r
38 Unicode string, optionally followed by additional binary data.\r
39\r
40**/\r
41EFI_STATUS\r
42EFIAPI\r
43LibResetSystem (\r
44 IN EFI_RESET_TYPE ResetType,\r
45 IN EFI_STATUS ResetStatus,\r
46 IN UINTN DataSize,\r
47 IN CHAR16 *ResetData OPTIONAL\r
48 )\r
49{\r
50 if (ResetData != NULL) {\r
51 DEBUG((EFI_D_ERROR, "%s", ResetData));\r
52 }\r
53\r
54 switch (ResetType) {\r
55 case EfiResetWarm:\r
56 // Map a warm reset into a cold reset\r
57 case EfiResetCold:\r
58 case EfiResetShutdown:\r
59 default:\r
60 // Perform cold reset of the system.\r
61 MmioOr32 (PRM_RSTCTRL, RST_DPLL3);\r
43263288 62 while ((MmioRead32 (PRM_RSTST) & GLOBAL_COLD_RST) != 0x1);\r
a3f98646 63 break;\r
64 }\r
65\r
66 // If the reset didn't work, return an error.\r
67 ASSERT (FALSE);\r
68 return EFI_DEVICE_ERROR;\r
69}\r
70 \r
71\r
72\r
73/**\r
74 Initialize any infrastructure required for LibResetSystem () to function.\r
75\r
76 @param ImageHandle The firmware allocated handle for the EFI image.\r
77 @param SystemTable A pointer to the EFI System Table.\r
78 \r
79 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
80\r
81**/\r
82EFI_STATUS\r
83EFIAPI\r
84LibInitializeResetSystem (\r
85 IN EFI_HANDLE ImageHandle,\r
86 IN EFI_SYSTEM_TABLE *SystemTable\r
87 )\r
88{\r
89 return EFI_SUCCESS;\r
90}\r
91\r