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

46 lines
1.6 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2010 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/>.
*/
#ifndef VAS_EBOOT_EC_MACHINE_HEADER
#define VAS_EBOOT_EC_MACHINE_HEADER 1
#include <VasEBoot/types.h>
#include <VasEBoot/cpu/io.h>
#include <VasEBoot/pci.h>
#define VAS_EBOOT_MACHINE_EC_MAGIC_PORT1 0x381
#define VAS_EBOOT_MACHINE_EC_MAGIC_PORT2 0x382
#define VAS_EBOOT_MACHINE_EC_DATA_PORT 0x383
#define VAS_EBOOT_MACHINE_EC_MAGIC_VAL1 0xf4
#define VAS_EBOOT_MACHINE_EC_MAGIC_VAL2 0xec
#define VAS_EBOOT_MACHINE_EC_COMMAND_REBOOT 1
static inline void
VasEBoot_write_ec (VasEBoot_uint8_t value)
{
VasEBoot_outb (VAS_EBOOT_MACHINE_EC_MAGIC_VAL1,
VAS_EBOOT_MACHINE_PCI_IO_BASE + VAS_EBOOT_MACHINE_EC_MAGIC_PORT1);
VasEBoot_outb (VAS_EBOOT_MACHINE_EC_MAGIC_VAL2,
VAS_EBOOT_MACHINE_PCI_IO_BASE + VAS_EBOOT_MACHINE_EC_MAGIC_PORT2);
VasEBoot_outb (value, VAS_EBOOT_MACHINE_PCI_IO_BASE + VAS_EBOOT_MACHINE_EC_DATA_PORT);
}
#endif