]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - PcAtChipsetPkg/KbcResetDxe/ResetEntry.c
Fix DDK3790 build failure.
[mirror_edk2.git] / PcAtChipsetPkg / KbcResetDxe / ResetEntry.c
... / ...
CommitLineData
1/** @file\r
2 Driver entry for KbcReset driver.\r
3\r
4Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12**/\r
13\r
14#include <PiDxe.h>\r
15\r
16#include <Library/DebugLib.h>\r
17#include <Library/UefiBootServicesTableLib.h>\r
18#include <Library/ResetSystemLib.h>\r
19\r
20#include <Protocol/Reset.h>\r
21\r
22//\r
23// The handle onto which the Reset Architectural Protocol is installed\r
24//\r
25EFI_HANDLE mResetHandle = NULL;\r
26\r
27/**\r
28 Reset the system.\r
29\r
30 @param ResetType warm or cold\r
31 @param ResetStatus possible cause of reset\r
32 @param DataSize Size of ResetData in bytes\r
33 @param ResetData Optional Unicode string\r
34\r
35**/\r
36VOID\r
37EFIAPI\r
38KbcResetSystem (\r
39 IN EFI_RESET_TYPE ResetType,\r
40 IN EFI_STATUS ResetStatus,\r
41 IN UINTN DataSize,\r
42 IN VOID *ResetData OPTIONAL\r
43 )\r
44{\r
45 switch (ResetType) {\r
46 case EfiResetWarm:\r
47 ResetWarm ();\r
48 break;\r
49 case EfiResetCold:\r
50 ResetCold ();\r
51 break;\r
52 case EfiResetShutdown:\r
53 ResetShutdown ();\r
54 break;\r
55 default:\r
56 return;\r
57 }\r
58\r
59 //\r
60 // Given we should have reset getting here would be bad\r
61 //\r
62 ASSERT (FALSE);\r
63}\r
64\r
65/**\r
66 Initialize the state information for the Reset Architectural Protocol.\r
67\r
68 @param ImageHandle Handle of the loaded driver \r
69 @param SystemTable Pointer to the System Table\r
70\r
71 @retval EFI_SUCCESS Thread can be successfully created\r
72 @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure\r
73 @retval EFI_DEVICE_ERROR Cannot create the timer service\r
74\r
75**/\r
76EFI_STATUS\r
77EFIAPI\r
78InitializeReset (\r
79 IN EFI_HANDLE ImageHandle,\r
80 IN EFI_SYSTEM_TABLE *SystemTable\r
81 )\r
82{\r
83 EFI_STATUS Status;\r
84\r
85 //\r
86 // Make sure the Reset Architectural Protocol is not already installed in the system\r
87 //\r
88 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiResetArchProtocolGuid);\r
89\r
90 //\r
91 // Hook the runtime service table\r
92 //\r
93 SystemTable->RuntimeServices->ResetSystem = KbcResetSystem;\r
94\r
95 //\r
96 // Now install the Reset RT AP on a new handle\r
97 //\r
98 Status = gBS->InstallMultipleProtocolInterfaces (\r
99 &mResetHandle,\r
100 &gEfiResetArchProtocolGuid, NULL,\r
101 NULL\r
102 );\r
103 ASSERT_EFI_ERROR (Status);\r
104\r
105 return Status;\r
106}\r