blob: 5b3467c39862117ccfb185cb44c5d52635b0d2df [file] [log] [blame]
Stefan Reinauer838c5a52010-01-17 14:08:17 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 *
Uwe Hermannc70e9fc2010-02-15 23:10:19 +00006 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
Stefan Reinauer838c5a52010-01-17 14:08:17 +00009 *
10 * This program 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.
Stefan Reinauer838c5a52010-01-17 14:08:17 +000014 */
15
Sven Schnelle7592e8b2011-01-27 11:43:03 +000016#ifndef _EC_ACPI_H
17#define _EC_ACPI_H
Stefan Reinauer838c5a52010-01-17 14:08:17 +000018
19#define EC_DATA 0x62
20#define EC_SC 0x66
21
22/* EC_SC input */
23#define EC_SMI_EVT (1 << 6) // 1: SMI event pending
24#define EC_SCI_EVT (1 << 5) // 1: SCI event pending
25#define EC_BURST (1 << 4) // controller is in burst mode
26#define EC_CMD (1 << 3) // 1: byte in data register is command
27 // 0: byte in data register is data
28#define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec)
29#define EC_OBF (1 << 0) // 1: output buffer full (data ready for host)
30/* EC_SC output */
31#define RD_EC 0x80 // Read Embedded Controller
32#define WR_EC 0x81 // Write Embedded Controller
33#define BE_EC 0x82 // Burst Enable Embedded Controller
34#define BD_EC 0x83 // Burst Disable Embedded Controller
35#define QR_EC 0x84 // Query Embedded Controller
36
37int send_ec_command(u8 command);
38int send_ec_data(u8 data);
39int send_ec_data_nowait(u8 data);
40u8 recv_ec_data(void);
Sven Schnellef9a0b922011-03-15 09:52:07 +000041u8 ec_query(void);
Stefan Reinauer838c5a52010-01-17 14:08:17 +000042u8 ec_read(u8 addr);
43int ec_write(u8 addr, u8 data);
Sven Schnelle8d94d7c2011-03-14 08:18:17 +000044void ec_set_bit(u8 addr, u8 bit);
45void ec_clr_bit(u8 addr, u8 bit);
Sven Schnelle0238a9c2011-03-14 08:18:27 +000046void ec_set_ports(u16 cmd_reg, u16 data_reg);
Stefan Reinauer838c5a52010-01-17 14:08:17 +000047
Edward O'Callaghanb57fef92014-06-17 20:13:08 +100048#endif /* _EC_ACPI_H */