|
@@ -0,0 +1,66 @@
|
|
1
|
+/*
|
|
2
|
+ * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
|
|
3
|
+ *
|
|
4
|
+ * This program is free software; you can redistribute it and/or
|
|
5
|
+ * modify it under the terms of the GNU General Public License as
|
|
6
|
+ * published by the Free Software Foundation; either version 2 of the
|
|
7
|
+ * License, or any later version.
|
|
8
|
+ *
|
|
9
|
+ * This program is distributed in the hope that it will be useful, but
|
|
10
|
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+ * General Public License for more details.
|
|
13
|
+ *
|
|
14
|
+ * You should have received a copy of the GNU General Public License
|
|
15
|
+ * along with this program; if not, write to the Free Software
|
|
16
|
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
17
|
+ */
|
|
18
|
+
|
|
19
|
+#include <realmode.h>
|
|
20
|
+#include <ipxe/command.h>
|
|
21
|
+#include <ipxe/parseopt.h>
|
|
22
|
+
|
|
23
|
+FILE_LICENCE ( GPL2_OR_LATER );
|
|
24
|
+
|
|
25
|
+/** @file
|
|
26
|
+ *
|
|
27
|
+ * Reboot command
|
|
28
|
+ *
|
|
29
|
+ */
|
|
30
|
+
|
|
31
|
+/** "reboot" options */
|
|
32
|
+struct reboot_options {};
|
|
33
|
+
|
|
34
|
+/** "reboot" option list */
|
|
35
|
+static struct option_descriptor reboot_opts[] = {};
|
|
36
|
+
|
|
37
|
+/** "reboot" command descriptor */
|
|
38
|
+static struct command_descriptor reboot_cmd =
|
|
39
|
+ COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "", "" );
|
|
40
|
+
|
|
41
|
+/**
|
|
42
|
+ * The "reboot" command
|
|
43
|
+ *
|
|
44
|
+ * @v argc Argument count
|
|
45
|
+ * @v argv Argument list
|
|
46
|
+ * @ret rc Return status code
|
|
47
|
+ */
|
|
48
|
+static int reboot_exec ( int argc, char **argv ) {
|
|
49
|
+ struct reboot_options opts;
|
|
50
|
+ int rc;
|
|
51
|
+
|
|
52
|
+ /* Parse options */
|
|
53
|
+ if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 )
|
|
54
|
+ return rc;
|
|
55
|
+
|
|
56
|
+ /* Reboot system */
|
|
57
|
+ __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : : );
|
|
58
|
+
|
|
59
|
+ return 0;
|
|
60
|
+}
|
|
61
|
+
|
|
62
|
+/** "reboot" command */
|
|
63
|
+struct command reboot_command __command = {
|
|
64
|
+ .name = "reboot",
|
|
65
|
+ .exec = reboot_exec,
|
|
66
|
+};
|