]>
Commit | Line | Data |
---|---|---|
d55ffb02 VS |
1 | /* |
2 | * GRUB -- GRand Unified Bootloader | |
3 | * Copyright (C) 2009,2013 Free Software Foundation, Inc. | |
4 | * | |
5 | * GRUB is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * GRUB is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with GRUB. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | #include <grub/dl.h> | |
20 | #include <grub/command.h> | |
21 | #include <grub/misc.h> | |
22 | #include <grub/cmos.h> | |
23 | #include <grub/i18n.h> | |
24 | ||
25 | GRUB_MOD_LICENSE ("GPLv3+"); | |
26 | ||
27 | static grub_err_t | |
28 | grub_cmd_cmosdump (struct grub_command *cmd __attribute__ ((unused)), | |
29 | int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused))) | |
30 | { | |
31 | int i; | |
32 | ||
33 | for (i = 0; i < 256; i++) | |
34 | { | |
35 | grub_err_t err; | |
36 | grub_uint8_t value; | |
37 | if ((i & 0xf) == 0) | |
38 | grub_printf ("%02x: ", i); | |
39 | ||
40 | err = grub_cmos_read (i, &value); | |
41 | if (err) | |
42 | return err; | |
43 | ||
44 | grub_printf ("%02x ", value); | |
45 | if ((i & 0xf) == 0xf) | |
46 | grub_printf ("\n"); | |
47 | } | |
48 | return GRUB_ERR_NONE; | |
49 | } | |
50 | ||
51 | static grub_command_t cmd; | |
52 | ||
53 | \f | |
54 | GRUB_MOD_INIT(cmosdump) | |
55 | { | |
56 | cmd = grub_register_command ("cmosdump", grub_cmd_cmosdump, | |
57 | 0, | |
bfdfeb25 | 58 | N_("Show raw dump of the CMOS contents.")); |
d55ffb02 VS |
59 | } |
60 | ||
61 | GRUB_MOD_FINI(cmosdump) | |
62 | { | |
63 | grub_unregister_command (cmd); | |
64 | } |