vaseboot/include/VasEBoot/mips/loongson/ec.h

46 lines
1.5 KiB
C

/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* VasEBoot 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.
*
* VasEBoot 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 VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VasEBoot_EC_MACHINE_HEADER
#define VasEBoot_EC_MACHINE_HEADER 1
#include <VasEBoot/types.h>
#include <VasEBoot/cpu/io.h>
#include <VasEBoot/pci.h>
#define VasEBoot_MACHINE_EC_MAGIC_PORT1 0x381
#define VasEBoot_MACHINE_EC_MAGIC_PORT2 0x382
#define VasEBoot_MACHINE_EC_DATA_PORT 0x383
#define VasEBoot_MACHINE_EC_MAGIC_VAL1 0xf4
#define VasEBoot_MACHINE_EC_MAGIC_VAL2 0xec
#define VasEBoot_MACHINE_EC_COMMAND_REBOOT 1
static inline void
VasEBoot_write_ec (VasEBoot_uint8_t value)
{
VasEBoot_outb (VasEBoot_MACHINE_EC_MAGIC_VAL1,
VasEBoot_MACHINE_PCI_IO_BASE + VasEBoot_MACHINE_EC_MAGIC_PORT1);
VasEBoot_outb (VasEBoot_MACHINE_EC_MAGIC_VAL2,
VasEBoot_MACHINE_PCI_IO_BASE + VasEBoot_MACHINE_EC_MAGIC_PORT2);
VasEBoot_outb (value, VasEBoot_MACHINE_PCI_IO_BASE + VasEBoot_MACHINE_EC_DATA_PORT);
}
#endif