]>
Commit | Line | Data |
---|---|---|
4684b66f | 1 | /*++ |
2 | This file contains an 'Intel UEFI Application' and is | |
3 | licensed for Intel CPUs and chipsets under the terms of your | |
4 | license agreement with Intel or your vendor. This file may | |
5 | be modified by the user, subject to additional terms of the | |
6 | license agreement | |
7 | --*/ | |
8 | /*++ | |
9 | ||
10 | Copyright (c) 2011 Intel Corporation. All rights reserved | |
11 | This software and associated documentation (if any) is furnished | |
12 | under a license and may only be used or copied in accordance | |
13 | with the terms of the license. Except as permitted by such | |
14 | license, no part of this software or documentation may be | |
15 | reproduced, stored in a retrieval system, or transmitted in any | |
16 | form or by any means without the express written consent of | |
17 | Intel Corporation. | |
18 | ||
19 | --*/ | |
20 | ||
21 | /** @file | |
22 | Reboot the system | |
23 | ||
24 | **/ | |
25 | ||
26 | #include <WebServer.h> | |
27 | #include <Library/UefiRuntimeServicesTableLib.h> | |
28 | ||
29 | ||
30 | /** | |
31 | Page to reboot the system | |
32 | ||
33 | @param [in] SocketFD The socket's file descriptor to add to the list. | |
34 | @param [in] pPort The WSDT_PORT structure address | |
35 | @param [out] pbDone Address to receive the request completion status | |
36 | ||
37 | @retval EFI_SUCCESS The request was successfully processed | |
38 | ||
39 | **/ | |
40 | EFI_STATUS | |
41 | RebootPage ( | |
42 | IN int SocketFD, | |
43 | IN WSDT_PORT * pPort, | |
44 | OUT BOOLEAN * pbDone | |
45 | ) | |
46 | { | |
47 | EFI_STATUS Status; | |
48 | ||
49 | DBG_ENTER ( ); | |
50 | ||
51 | // | |
52 | // Send the Hello World page | |
53 | // | |
54 | for ( ; ; ) { | |
55 | // | |
56 | // Send the page header | |
57 | // | |
58 | Status = HttpPageHeader ( SocketFD, pPort, L"Reboot" ); | |
59 | if ( EFI_ERROR ( Status )) { | |
60 | break; | |
61 | } | |
62 | ||
63 | // | |
64 | // Send the page body | |
65 | // | |
66 | Status = HttpSendAnsiString ( SocketFD, | |
67 | pPort, | |
68 | "<h1>Reboot</h1>\r\n" | |
69 | "<p>\r\n" | |
70 | " Ouch! The system is rebooting!\r\n" ); | |
71 | if ( EFI_ERROR ( Status )) { | |
72 | break; | |
73 | } | |
74 | ||
75 | // | |
76 | // Send the page trailer | |
77 | // | |
78 | Status = HttpPageTrailer ( SocketFD, pPort, pbDone ); | |
79 | if ( EFI_ERROR ( Status )) { | |
80 | break; | |
81 | } | |
82 | ||
83 | // | |
84 | // Deliver the data to the remote system by | |
85 | // closing the socket | |
86 | // | |
87 | close ( SocketFD ); | |
88 | ||
89 | // | |
90 | // Attempt to reboot the system | |
91 | // | |
92 | DEBUG (( DEBUG_REQUEST, "Reseting System\r\n" )); | |
93 | gRT->ResetSystem ( EfiResetCold, | |
94 | EFI_SUCCESS, | |
95 | 0, | |
96 | NULL ); | |
97 | break; | |
98 | } | |
99 | ||
100 | // | |
101 | // Return the operation status | |
102 | // | |
103 | DBG_EXIT_STATUS ( Status ); | |
104 | return Status; | |
105 | } |