1
2
3
4
5
6
7
8
9#ifndef HW_ACPI_TCO_H
10#define HW_ACPI_TCO_H
11
12#include "qemu-common.h"
13
14
15#define TCO_TICK_NSEC 600000000LL
16
17
18enum {
19 TCO_RLD = 0x00,
20 TCO_DAT_IN = 0x02,
21 TCO_DAT_OUT = 0x03,
22 TCO1_STS = 0x04,
23 TCO2_STS = 0x06,
24 TCO1_CNT = 0x08,
25 TCO2_CNT = 0x0a,
26 TCO_MESSAGE1 = 0x0c,
27 TCO_MESSAGE2 = 0x0d,
28 TCO_WDCNT = 0x0e,
29 SW_IRQ_GEN = 0x10,
30 TCO_TMR = 0x12,
31};
32
33
34enum {
35 SW_TCO_SMI = 1 << 1,
36 TCO_INT_STS = 1 << 2,
37 TCO_LOCK = 1 << 12,
38 TCO_TMR_HLT = 1 << 11,
39 TCO_TIMEOUT = 1 << 3,
40 TCO_SECOND_TO_STS = 1 << 1,
41 TCO_BOOT_STS = 1 << 2,
42};
43
44
45enum {
46 TCO_RLD_MASK = 0x3ff,
47 TCO1_STS_MASK = 0xe870,
48 TCO2_STS_MASK = 0xfff8,
49 TCO1_CNT_MASK = 0xfeff,
50 TCO_TMR_MASK = 0x3ff,
51};
52
53typedef struct TCOIORegs {
54 struct {
55 uint16_t rld;
56 uint8_t din;
57 uint8_t dout;
58 uint16_t sts1;
59 uint16_t sts2;
60 uint16_t cnt1;
61 uint16_t cnt2;
62 uint8_t msg1;
63 uint8_t msg2;
64 uint8_t wdcnt;
65 uint16_t tmr;
66 } tco;
67 uint8_t sw_irq_gen;
68
69 QEMUTimer *tco_timer;
70 int64_t expire_time;
71 uint8_t timeouts_no;
72
73 MemoryRegion io;
74} TCOIORegs;
75
76
77void acpi_pm_tco_init(TCOIORegs *tr, MemoryRegion *parent);
78
79extern const VMStateDescription vmstate_tco_io_sts;
80
81#endif
82