vaseboot/VasEBoot-core/lib/mips/loongson/reboot.c

65 lines
2.1 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2011 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#include <VasEBoot/machine/ec.h>
#include <VasEBoot/machine/kernel.h>
#include <VasEBoot/machine/memory.h>
#include <VasEBoot/misc.h>
#include <VasEBoot/pci.h>
#include <VasEBoot/cs5536.h>
#include <VasEBoot/time.h>
#include <VasEBoot/term.h>
#include <VasEBoot/i18n.h>
void
VasEBoot_reboot (void)
{
switch (VasEBoot_arch_machine)
{
case VAS_EBOOT_ARCH_MACHINE_FULOONG2E:
VasEBoot_outl (VasEBoot_inl (0xbfe00104) & ~4, 0xbfe00104);
VasEBoot_outl (VasEBoot_inl (0xbfe00104) | 4, 0xbfe00104);
break;
case VAS_EBOOT_ARCH_MACHINE_FULOONG2F:
{
VasEBoot_pci_device_t dev;
if (!VasEBoot_cs5536_find (&dev))
break;
VasEBoot_cs5536_write_msr (dev, VAS_EBOOT_CS5536_MSR_DIVIL_RESET,
VasEBoot_cs5536_read_msr (dev,
VAS_EBOOT_CS5536_MSR_DIVIL_RESET)
| 1);
break;
}
case VAS_EBOOT_ARCH_MACHINE_YEELOONG:
VasEBoot_write_ec (VAS_EBOOT_MACHINE_EC_COMMAND_REBOOT);
break;
case VAS_EBOOT_ARCH_MACHINE_YEELOONG_3A:
VasEBoot_millisleep (1);
VasEBoot_outb (0x4e, VAS_EBOOT_MACHINE_PCI_IO_BASE_3A | 0x66);
VasEBoot_millisleep (1);
VasEBoot_outb (1, VAS_EBOOT_MACHINE_PCI_IO_BASE_3A | 0x62);
VasEBoot_millisleep (5000);
}
VasEBoot_millisleep (1500);
VasEBoot_puts_ (N_("Reboot failed"));
VasEBoot_refresh ();
while (1);
}