1 /** @file
2 
3   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #include <PiDxe.h>
16 #include <Protocol/Reset.h>
17 #include <Library/DebugLib.h>
18 #include <Library/UefiDriverEntryPoint.h>
19 #include <Library/UefiBootServicesTableLib.h>
20 #include <Library/EfiResetSystemLib.h>
21 
22 
23 /**
24   Resets the entire platform.
25 
26   @param  ResetType             The type of reset to perform.
27   @param  ResetStatus           The status code for the reset.
28   @param  DataSize              The size, in bytes, of WatchdogData.
29   @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or
30                                 EfiResetShutdown the data buffer starts with a Null-terminated
31                                 Unicode string, optionally followed by additional binary data.
32 
33 **/
34 VOID
35 EFIAPI
ResetSystemViaLib(IN EFI_RESET_TYPE ResetType,IN EFI_STATUS ResetStatus,IN UINTN DataSize,IN VOID * ResetData OPTIONAL)36 ResetSystemViaLib (
37   IN EFI_RESET_TYPE   ResetType,
38   IN EFI_STATUS       ResetStatus,
39   IN UINTN            DataSize,
40   IN VOID             *ResetData OPTIONAL
41   )
42 {
43   LibResetSystem (ResetType, ResetStatus, DataSize, ResetData);
44   return;
45 }
46 
47 
48 
49 EFI_STATUS
50 EFIAPI
InitializeReset(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)51 InitializeReset (
52   IN EFI_HANDLE        ImageHandle,
53   IN EFI_SYSTEM_TABLE  *SystemTable
54   )
55 {
56   EFI_STATUS  Status;
57   EFI_HANDLE  Handle;
58 
59   LibInitializeResetSystem (ImageHandle, SystemTable);
60 
61   SystemTable->RuntimeServices->ResetSystem = ResetSystemViaLib;
62 
63   Handle = NULL;
64   Status = gBS->InstallMultipleProtocolInterfaces (
65                   &Handle,
66                   &gEfiResetArchProtocolGuid,
67                   NULL,
68                   NULL
69                   );
70   ASSERT_EFI_ERROR (Status);
71 
72   return Status;
73 }
74 
75