]>
Commit | Line | Data |
---|---|---|
1e57a462 | 1 | /** @file\r |
2 | Template library implementation to support ResetSystem Runtime call.\r | |
1e57a462 | 3 | \r |
18e44b07 | 4 | Fill in the templates with what ever makes you system reset.\r |
1e57a462 | 5 | \r |
6 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
18e44b07 OM |
7 | Copyright (c) 2013, ARM Ltd. All rights reserved.<BR>\r |
8 | \r | |
1e57a462 | 9 | 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 | #include <PiDxe.h>\r | |
20 | \r | |
21 | #include <Library/BaseLib.h>\r | |
22 | #include <Library/DebugLib.h>\r | |
23 | #include <Library/EfiResetSystemLib.h>\r | |
24 | #include <Library/ArmPlatformSysConfigLib.h>\r | |
25 | \r | |
26 | #include <ArmPlatform.h>\r | |
27 | \r | |
28 | /**\r | |
29 | Resets the entire platform.\r | |
30 | \r | |
31 | @param ResetType The type of reset to perform.\r | |
32 | @param ResetStatus The status code for the reset.\r | |
33 | @param DataSize The size, in bytes, of WatchdogData.\r | |
34 | @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r | |
35 | EfiResetShutdown the data buffer starts with a Null-terminated\r | |
36 | Unicode string, optionally followed by additional binary data.\r | |
37 | \r | |
38 | **/\r | |
39 | EFI_STATUS\r | |
40 | EFIAPI\r | |
41 | LibResetSystem (\r | |
42 | IN EFI_RESET_TYPE ResetType,\r | |
43 | IN EFI_STATUS ResetStatus,\r | |
44 | IN UINTN DataSize,\r | |
45 | IN CHAR16 *ResetData OPTIONAL\r | |
46 | )\r | |
47 | {\r | |
48 | switch (ResetType) {\r | |
18e44b07 OM |
49 | case EfiResetPlatformSpecific:\r |
50 | // Map the platform specific reset as reboot\r | |
1e57a462 | 51 | case EfiResetWarm:\r |
52 | // Map a warm reset into a cold reset\r | |
53 | case EfiResetCold:\r | |
1e57a462 | 54 | // Send the REBOOT function to the platform microcontroller\r |
55 | ArmPlatformSysConfigSet (SYS_CFG_REBOOT, 0);\r | |
56 | \r | |
e375b7e0 RH |
57 | // We should never be here\r |
58 | while(1);\r | |
59 | case EfiResetShutdown:\r | |
60 | // Send the SHUTDOWN function to the platform microcontroller\r | |
61 | ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0);\r | |
62 | \r | |
1e57a462 | 63 | // We should never be here\r |
64 | while(1);\r | |
65 | }\r | |
66 | \r | |
67 | ASSERT(FALSE);\r | |
68 | return EFI_UNSUPPORTED;\r | |
69 | }\r | |
70 | \r | |
71 | /**\r | |
72 | Initialize any infrastructure required for LibResetSystem () to function.\r | |
73 | \r | |
74 | @param ImageHandle The firmware allocated handle for the EFI image.\r | |
75 | @param SystemTable A pointer to the EFI System Table.\r | |
3402aac7 | 76 | \r |
1e57a462 | 77 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r |
78 | \r | |
79 | **/\r | |
80 | EFI_STATUS\r | |
81 | EFIAPI\r | |
82 | LibInitializeResetSystem (\r | |
83 | IN EFI_HANDLE ImageHandle,\r | |
84 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
85 | )\r | |
86 | {\r | |
87 | return EFI_SUCCESS;\r | |
88 | }\r |