]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Library/TemplateResetSystemLib/ResetSystemLib.c
ARM Packages: Removed trailing spaces
[mirror_edk2.git] / EmbeddedPkg / Library / TemplateResetSystemLib / ResetSystemLib.c
CommitLineData
2ef2b01e
A
1/** @file\r
2 Template library implementation to support ResetSystem Runtime call.\r
3402aac7 3\r
2ef2b01e
A
4 Fill in the templates with what ever makes you system reset.\r
5\r
6\r
60274cca 7 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
3402aac7 8\r
60274cca 9 This program and the accompanying materials\r
2ef2b01e
A
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/BaseLib.h>\r
23#include <Library/IoLib.h>\r
24#include <Library/EfiResetSystemLib.h>\r
25\r
26\r
27/**\r
28 Resets the entire platform.\r
29\r
30 @param ResetType The type of reset to perform.\r
31 @param ResetStatus The status code for the reset.\r
32 @param DataSize The size, in bytes, of WatchdogData.\r
33 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
34 EfiResetShutdown the data buffer starts with a Null-terminated\r
35 Unicode string, optionally followed by additional binary data.\r
36\r
37**/\r
38EFI_STATUS\r
39EFIAPI\r
40LibResetSystem (\r
41 IN EFI_RESET_TYPE ResetType,\r
42 IN EFI_STATUS ResetStatus,\r
43 IN UINTN DataSize,\r
44 IN CHAR16 *ResetData OPTIONAL\r
45 )\r
46{\r
47 UINTN Address;\r
48 UINT8 Data;\r
3402aac7
RC
49\r
50\r
2ef2b01e
A
51 switch (ResetType) {\r
52 case EfiResetCold:\r
53 // system power cycle\r
3402aac7 54\r
2ef2b01e
A
55 // Example using IoLib functions to do IO.\r
56 Address = 0x12345678;\r
57 Data = MmioRead8 (Address);\r
58 MmioWrite8 (Address, Data | 0x01);\r
3402aac7 59\r
2ef2b01e
A
60 // Note this is a bad example asa MmioOr8 (Address, 0x01) does the same thing\r
61 break;\r
3402aac7 62\r
2ef2b01e 63 case EfiResetWarm:\r
3402aac7 64 // not a full power cycle, maybe memory stays around.\r
2ef2b01e
A
65 // if not support do the same thing as EfiResetCold.\r
66 break;\r
3402aac7 67\r
2ef2b01e
A
68 case EfiResetShutdown:\r
69 // turn off the system.\r
70 // if not support do the same thing as EfiResetCold.\r
71 break;\r
3402aac7 72\r
2ef2b01e
A
73 default:\r
74 return EFI_INVALID_PARAMETER;\r
75 }\r
76\r
77 //\r
78 // If we reset, we would not have returned...\r
79 //\r
80 return EFI_DEVICE_ERROR;\r
81}\r
3402aac7 82\r
2ef2b01e
A
83\r
84\r
85/**\r
86 Initialize any infrastructure required for LibResetSystem () to function.\r
87\r
88 @param ImageHandle The firmware allocated handle for the EFI image.\r
89 @param SystemTable A pointer to the EFI System Table.\r
3402aac7 90\r
2ef2b01e
A
91 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
92\r
93**/\r
94EFI_STATUS\r
95EFIAPI\r
96LibInitializeResetSystem (\r
97 IN EFI_HANDLE ImageHandle,\r
98 IN EFI_SYSTEM_TABLE *SystemTable\r
99 )\r
100{\r
101 return EFI_SUCCESS;\r
102}\r
103\r