blob: 86fa4e55d55b51ac5147047ba472b232eeb43790 [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
Nico Huber8a9b7b52016-10-25 16:03:22 +020019#include <stdint.h>
20
Stefan Reinauer838c5a52010-01-17 14:08:17 +000021#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 HAOUAS610d4652018-05-29 11:02:43 +020036#define BD_EC 0x83 // Burst Disable Embedded Controller
37#define QR_EC 0x84 // Query Embedded Controller
Stefan Reinauer838c5a52010-01-17 14:08:17 +000038
39int send_ec_command(u8 command);
40int send_ec_data(u8 data);
41int send_ec_data_nowait(u8 data);
42u8 recv_ec_data(void);
Bill XIEeb4ded62017-10-26 11:45:49 +080043void ec_clear_out_queue(void);
Nico Huber105d8e82017-01-23 13:54:41 +010044u8 ec_status(void);
Sven Schnellef9a0b922011-03-15 09:52:07 +000045u8 ec_query(void);
Stefan Reinauer838c5a52010-01-17 14:08:17 +000046u8 ec_read(u8 addr);
47int ec_write(u8 addr, u8 data);
Sven Schnelle8d94d7c2011-03-14 08:18:17 +000048void ec_set_bit(u8 addr, u8 bit);
49void ec_clr_bit(u8 addr, u8 bit);
Sven Schnelle0238a9c2011-03-14 08:18:27 +000050void ec_set_ports(u16 cmd_reg, u16 data_reg);
Stefan Reinauer838c5a52010-01-17 14:08:17 +000051
Edward O'Callaghanb57fef92014-06-17 20:13:08 +100052#endif /* _EC_ACPI_H */