Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / grub-core / lib / mips / loongson / reboot.c
blobd45d600e2c1d7ed6e5f267a56fda01c10462ff72
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2011 Free Software Foundation, Inc.
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.
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.
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/>.
19 #include <grub/machine/ec.h>
20 #include <grub/machine/kernel.h>
21 #include <grub/machine/memory.h>
22 #include <grub/misc.h>
23 #include <grub/pci.h>
24 #include <grub/cs5536.h>
25 #include <grub/time.h>
26 #include <grub/term.h>
27 #include <grub/i18n.h>
29 void
30 grub_reboot (void)
32 switch (grub_arch_machine)
34 case GRUB_ARCH_MACHINE_FULOONG2E:
35 grub_outl (grub_inl (0xbfe00104) & ~4, 0xbfe00104);
36 grub_outl (grub_inl (0xbfe00104) | 4, 0xbfe00104);
37 break;
38 case GRUB_ARCH_MACHINE_FULOONG2F:
40 grub_pci_device_t dev;
41 if (!grub_cs5536_find (&dev))
42 break;
43 grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_RESET,
44 grub_cs5536_read_msr (dev,
45 GRUB_CS5536_MSR_DIVIL_RESET)
46 | 1);
47 break;
49 case GRUB_ARCH_MACHINE_YEELOONG:
50 grub_write_ec (GRUB_MACHINE_EC_COMMAND_REBOOT);
51 break;
53 grub_millisleep (1500);
55 grub_puts_ (N_("Reboot failed"));
56 grub_refresh ();
57 while (1);