Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 coresystems GmbH |
| 5 | * |
Uwe Hermann | c70e9fc | 2010-02-15 23:10:19 +0000 | [diff] [blame] | 6 | * 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 Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 9 | * |
| 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 Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Sven Schnelle | 7592e8b | 2011-01-27 11:43:03 +0000 | [diff] [blame] | 16 | #ifndef _EC_ACPI_H |
| 17 | #define _EC_ACPI_H |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 18 | |
Nico Huber | 8a9b7b5 | 2016-10-25 16:03:22 +0200 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 21 | #define EC_DATA 0x62 |
| 22 | #define EC_SC 0x66 |
| 23 | |
| 24 | /* EC_SC input */ |
| 25 | #define EC_SMI_EVT (1 << 6) // 1: SMI event pending |
| 26 | #define EC_SCI_EVT (1 << 5) // 1: SCI event pending |
| 27 | #define EC_BURST (1 << 4) // controller is in burst mode |
| 28 | #define EC_CMD (1 << 3) // 1: byte in data register is command |
| 29 | // 0: byte in data register is data |
| 30 | #define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec) |
| 31 | #define EC_OBF (1 << 0) // 1: output buffer full (data ready for host) |
| 32 | /* EC_SC output */ |
| 33 | #define RD_EC 0x80 // Read Embedded Controller |
| 34 | #define WR_EC 0x81 // Write Embedded Controller |
| 35 | #define BE_EC 0x82 // Burst Enable Embedded Controller |
Elyes HAOUAS | 610d465 | 2018-05-29 11:02:43 +0200 | [diff] [blame] | 36 | #define BD_EC 0x83 // Burst Disable Embedded Controller |
| 37 | #define QR_EC 0x84 // Query Embedded Controller |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 38 | |
| 39 | int send_ec_command(u8 command); |
| 40 | int send_ec_data(u8 data); |
| 41 | int send_ec_data_nowait(u8 data); |
| 42 | u8 recv_ec_data(void); |
Bill XIE | eb4ded6 | 2017-10-26 11:45:49 +0800 | [diff] [blame] | 43 | void ec_clear_out_queue(void); |
Nico Huber | 105d8e8 | 2017-01-23 13:54:41 +0100 | [diff] [blame] | 44 | u8 ec_status(void); |
Sven Schnelle | f9a0b92 | 2011-03-15 09:52:07 +0000 | [diff] [blame] | 45 | u8 ec_query(void); |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 46 | u8 ec_read(u8 addr); |
| 47 | int ec_write(u8 addr, u8 data); |
Sven Schnelle | 8d94d7c | 2011-03-14 08:18:17 +0000 | [diff] [blame] | 48 | void ec_set_bit(u8 addr, u8 bit); |
| 49 | void ec_clr_bit(u8 addr, u8 bit); |
Sven Schnelle | 0238a9c | 2011-03-14 08:18:27 +0000 | [diff] [blame] | 50 | void ec_set_ports(u16 cmd_reg, u16 data_reg); |
Stefan Reinauer | 838c5a5 | 2010-01-17 14:08:17 +0000 | [diff] [blame] | 51 | |
Edward O'Callaghan | b57fef9 | 2014-06-17 20:13:08 +1000 | [diff] [blame] | 52 | #endif /* _EC_ACPI_H */ |