]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - UnixPkg/ResetRuntimeDxe/Reset.c
EmbeddedPkg: Fix mispellings
[mirror_edk2.git] / UnixPkg / ResetRuntimeDxe / Reset.c
... / ...
CommitLineData
1/*++\r
2\r
3Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 Reset.c\r
15\r
16Abstract:\r
17\r
18 Reset Architectural Protocol as defined in Tiano under UNIX Emulation\r
19\r
20--*/\r
21\r
22#include "PiDxe.h"\r
23#include "UnixDxe.h"\r
24#include <Protocol/Reset.h>\r
25\r
26#include <Library/BaseLib.h>\r
27#include <Library/DebugLib.h>\r
28#include <Library/UefiLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/UnixLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33\r
34EFI_STATUS\r
35EFIAPI\r
36InitializeUnixReset (\r
37 IN EFI_HANDLE ImageHandle,\r
38 IN EFI_SYSTEM_TABLE *SystemTable\r
39 );\r
40\r
41VOID\r
42EFIAPI\r
43UnixResetSystem (\r
44 IN EFI_RESET_TYPE ResetType,\r
45 IN EFI_STATUS ResetStatus,\r
46 IN UINTN DataSize,\r
47 IN VOID *ResetData OPTIONAL\r
48 );\r
49\r
50EFI_STATUS\r
51EFIAPI\r
52InitializeUnixReset (\r
53 IN EFI_HANDLE ImageHandle,\r
54 IN EFI_SYSTEM_TABLE *SystemTable\r
55 )\r
56/*++\r
57\r
58Routine Description:\r
59\r
60\r
61Arguments:\r
62\r
63 ImageHandle of the loaded driver\r
64 Pointer to the System Table\r
65\r
66Returns:\r
67\r
68 Status\r
69--*/\r
70// TODO: SystemTable - add argument and description to function comment\r
71{\r
72 EFI_STATUS Status;\r
73 EFI_HANDLE Handle;\r
74\r
75 SystemTable->RuntimeServices->ResetSystem = UnixResetSystem;\r
76\r
77 Handle = NULL;\r
78 Status = gBS->InstallMultipleProtocolInterfaces (\r
79 &Handle,\r
80 &gEfiResetArchProtocolGuid,\r
81 NULL,\r
82 NULL\r
83 );\r
84 ASSERT_EFI_ERROR (Status);\r
85\r
86 return Status;\r
87}\r
88\r
89VOID\r
90EFIAPI\r
91UnixResetSystem (\r
92 IN EFI_RESET_TYPE ResetType,\r
93 IN EFI_STATUS ResetStatus,\r
94 IN UINTN DataSize,\r
95 IN VOID *ResetData OPTIONAL\r
96 )\r
97/*++\r
98\r
99Routine Description:\r
100\r
101 TODO: Add function description\r
102\r
103Arguments:\r
104\r
105 ResetType - TODO: add argument description\r
106 ResetStatus - TODO: add argument description\r
107 DataSize - TODO: add argument description\r
108 ResetData - TODO: add argument description\r
109\r
110Returns:\r
111\r
112 EFI_SUCCESS - TODO: Add description for return value\r
113\r
114--*/\r
115{\r
116 EFI_STATUS Status;\r
117 UINTN HandleCount;\r
118 EFI_HANDLE *HandleBuffer;\r
119 UINTN Index;\r
120\r
121 //\r
122 // Disconnect all\r
123 //\r
124 Status = gBS->LocateHandleBuffer (\r
125 AllHandles,\r
126 NULL,\r
127 NULL,\r
128 &HandleCount,\r
129 &HandleBuffer\r
130 );\r
131 if (!EFI_ERROR (Status)) {\r
132 for (Index = 0; Index < HandleCount; Index++) {\r
133 Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);\r
134 }\r
135 \r
136 gBS->FreePool (HandleBuffer);\r
137 }\r
138\r
139\r
140 //\r
141 // Discard ResetType, always return 0 as exit code\r
142 //\r
143 gUnix->Exit (0);\r
144\r
145 //\r
146 // Should never go here\r
147 //\r
148 ASSERT (FALSE);\r
149\r
150 return;\r
151}\r