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