VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/EmbeddedPkg/Library/TemplateResetSystemLib/ResetSystemLib.c@ 99396

Last change on this file since 99396 was 85718, checked in by vboxsync, 5 years ago

Devices/EFI: Merge edk-stable202005 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/** @file
2 Template library implementation to support ResetSystem Runtime call.
3
4 Fill in the templates with what ever makes you system reset.
5
6
7 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
8
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10
11**/
12
13
14#include <PiDxe.h>
15
16#include <Library/BaseLib.h>
17#include <Library/IoLib.h>
18#include <Library/EfiResetSystemLib.h>
19
20
21/**
22 Resets the entire platform.
23
24 @param ResetType The type of reset to perform.
25 @param ResetStatus The status code for the reset.
26 @param DataSize The size, in bytes, of WatchdogData.
27 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
28 EfiResetShutdown the data buffer starts with a Null-terminated
29 Unicode string, optionally followed by additional binary data.
30
31**/
32EFI_STATUS
33EFIAPI
34LibResetSystem (
35 IN EFI_RESET_TYPE ResetType,
36 IN EFI_STATUS ResetStatus,
37 IN UINTN DataSize,
38 IN CHAR16 *ResetData OPTIONAL
39 )
40{
41 UINTN Address;
42 UINT8 Data;
43
44
45 switch (ResetType) {
46 case EfiResetCold:
47 // system power cycle
48
49 // Example using IoLib functions to do IO.
50 Address = 0x12345678;
51 Data = MmioRead8 (Address);
52 MmioWrite8 (Address, Data | 0x01);
53
54 // Note this is a bad example asa MmioOr8 (Address, 0x01) does the same thing
55 break;
56
57 case EfiResetWarm:
58 // not a full power cycle, maybe memory stays around.
59 // if not support do the same thing as EfiResetCold.
60 break;
61
62 case EfiResetShutdown:
63 // turn off the system.
64 // if not support do the same thing as EfiResetCold.
65 break;
66
67 default:
68 return EFI_INVALID_PARAMETER;
69 }
70
71 //
72 // If we reset, we would not have returned...
73 //
74 return EFI_DEVICE_ERROR;
75}
76
77
78
79/**
80 Initialize any infrastructure required for LibResetSystem () to function.
81
82 @param ImageHandle The firmware allocated handle for the EFI image.
83 @param SystemTable A pointer to the EFI System Table.
84
85 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
86
87**/
88EFI_STATUS
89EFIAPI
90LibInitializeResetSystem (
91 IN EFI_HANDLE ImageHandle,
92 IN EFI_SYSTEM_TABLE *SystemTable
93 )
94{
95 return EFI_SUCCESS;
96}
97
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette