]>
Commit | Line | Data |
---|---|---|
9f7f5161 | 1 | /** |
2 | @file | |
4684b66f | 3 | Reboot the system |
4 | ||
bcb96695 MK |
5 | Copyright (c) 2011-2012, Intel Corporation. All rights reserved. |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent | |
9f7f5161 | 7 | |
4684b66f | 8 | **/ |
9 | ||
10 | #include <WebServer.h> | |
11 | #include <Library/UefiRuntimeServicesTableLib.h> | |
12 | ||
13 | ||
14 | /** | |
15 | Page to reboot the system | |
16 | ||
17 | @param [in] SocketFD The socket's file descriptor to add to the list. | |
18 | @param [in] pPort The WSDT_PORT structure address | |
19 | @param [out] pbDone Address to receive the request completion status | |
20 | ||
21 | @retval EFI_SUCCESS The request was successfully processed | |
22 | ||
23 | **/ | |
24 | EFI_STATUS | |
25 | RebootPage ( | |
26 | IN int SocketFD, | |
27 | IN WSDT_PORT * pPort, | |
28 | OUT BOOLEAN * pbDone | |
29 | ) | |
30 | { | |
31 | EFI_STATUS Status; | |
32 | ||
33 | DBG_ENTER ( ); | |
34 | ||
35 | // | |
9f7f5161 | 36 | // Send the Reboot page |
4684b66f | 37 | // |
38 | for ( ; ; ) { | |
39 | // | |
40 | // Send the page header | |
41 | // | |
42 | Status = HttpPageHeader ( SocketFD, pPort, L"Reboot" ); | |
43 | if ( EFI_ERROR ( Status )) { | |
44 | break; | |
45 | } | |
46 | ||
47 | // | |
48 | // Send the page body | |
49 | // | |
50 | Status = HttpSendAnsiString ( SocketFD, | |
51 | pPort, | |
52 | "<h1>Reboot</h1>\r\n" | |
53 | "<p>\r\n" | |
54 | " Ouch! The system is rebooting!\r\n" ); | |
55 | if ( EFI_ERROR ( Status )) { | |
56 | break; | |
57 | } | |
58 | ||
59 | // | |
60 | // Send the page trailer | |
61 | // | |
62 | Status = HttpPageTrailer ( SocketFD, pPort, pbDone ); | |
63 | if ( EFI_ERROR ( Status )) { | |
64 | break; | |
65 | } | |
66 | ||
67 | // | |
68 | // Deliver the data to the remote system by | |
69 | // closing the socket | |
70 | // | |
71 | close ( SocketFD ); | |
72 | ||
73 | // | |
74 | // Attempt to reboot the system | |
75 | // | |
76 | DEBUG (( DEBUG_REQUEST, "Reseting System\r\n" )); | |
77 | gRT->ResetSystem ( EfiResetCold, | |
78 | EFI_SUCCESS, | |
79 | 0, | |
80 | NULL ); | |
81 | break; | |
82 | } | |
83 | ||
84 | // | |
85 | // Return the operation status | |
86 | // | |
87 | DBG_EXIT_STATUS ( Status ); | |
88 | return Status; | |
89 | } |