1/*
2 * Copyright (c) 2009, ETH Zurich. All rights reserved.
3 *
4 * This file is distributed under the terms in the attached LICENSE file.
5 * If you do not find this file, copies can be found by writing to:
6 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
7 */
8
9/*
10 * acpi_ec.dev
11 *
12 * DESCRIPTION: ACPI Embedded Controller (EC)
13 *
14 * This file describes the interface to the ACPI standard embedded controller.
15 * See ACPI specification v4.0 section 12.2 (p445).
16 *
17 * The EC device consists of two 8-bit registers: status/command and data.
18 *
19 * FIXME: according to the ACPI spec (12.11) the controller may reside in
20 *   either IO or memory space. This driver assumes IO (because supporting
21 *   both in Mackerel would be quite clunky).
22 */
23
24device acpi_ec_mem msbfirst (addr data, addr sc) "ACPI embedded controller" {
25    // 12.2.1
26    regtype status "Status" {
27        _       1;
28        smi_evt 1 "SMI event pending";
29        sci_evt 1 "SCI event pending";
30        burst   1 "Controller is in burst mode";
31        cmd     1 "Byte in data register is a command byte";
32        _       1;
33        ibf     1 "Input buffer is full";
34        obf     1 "Output buffer is full";
35    };
36
37    // 12.3
38    constants commands width(8) "Command encodings" {
39        read      = 0x80 "Read";
40        write     = 0x81 "Write";
41        burst_en  = 0x82 "Burst enable";
42        burst_dis = 0x83 "Burst disable";
43        query     = 0x84 "Query";
44    };
45
46    // 12.2.1
47    register status ro addr(sc, 0) "Status" type(status);
48
49    // 12.2.2
50    register cmd wo also addr(sc, 0) "Command" type(commands);
51
52    // 12.2.3
53    register data rw addr(data, 0) "Data" type(uint8);
54};
55