- added instructions how to update the online documentation
[bochs-mirror.git] / iodev / acpi.h
blob40d7b2da4e4a21a890d06d50e8836ab8a48e952b
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: acpi.h,v 1.7 2007/09/28 19:51:59 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2006 Volker Ruppert
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Lesser General Public License for more details.
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef BX_IODEV_ACPI_H
22 #define BX_IODEV_ACPI_H
24 #if BX_USE_ACPI_SMF
25 # define BX_ACPI_SMF static
26 # define BX_ACPI_THIS theACPIController->
27 # define BX_ACPI_THIS_PTR theACPIController
28 #else
29 # define BX_ACPI_SMF
30 # define BX_ACPI_THIS this->
31 # define BX_ACPI_THIS_PTR this
32 #endif
34 class bx_acpi_ctrl_c : public bx_acpi_ctrl_stub_c {
35 public:
36 bx_acpi_ctrl_c();
37 virtual ~bx_acpi_ctrl_c();
38 virtual void init(void);
39 virtual void reset(unsigned type);
40 virtual void generate_smi(Bit8u value);
41 virtual void register_state(void);
42 virtual void after_restore_state(void);
44 virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
45 virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
47 static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
48 static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
49 #if !BX_USE_ACPI_SMF
50 Bit32u read(Bit32u address, unsigned io_len);
51 void write(Bit32u address, Bit32u value, unsigned io_len);
52 #endif
53 BX_ACPI_SMF void timer(void);
55 private:
56 BX_ACPI_SMF void set_irq_level(bx_bool level);
57 BX_ACPI_SMF Bit32u get_pmtmr(void);
58 BX_ACPI_SMF Bit16u get_pmsts(void);
59 BX_ACPI_SMF void pm_update_sci(void);
60 static void timer_handler(void *);
62 struct {
63 Bit8u pci_conf[256];
64 Bit8u devfunc;
65 Bit32u pm_base;
66 Bit32u sm_base;
67 Bit16u pmsts;
68 Bit16u pmen;
69 Bit16u pmcntrl;
70 Bit64u tmr_overflow_time;
71 int timer_index;
72 struct {
73 Bit8u stat;
74 Bit8u ctl;
75 Bit8u cmd;
76 Bit8u addr;
77 Bit8u data0;
78 Bit8u data1;
79 Bit8u index;
80 Bit8u data[32];
81 } smbus;
82 } s;
85 #endif