make vfs & filesystems use failable copying
[minix3.git] / kernel / arch / i386 / acpi.h
blob06e978c9ae99cd08b758e8571c9eca4535598d39
1 #ifndef __ACPI_H__
2 #define __ACPI_H__
4 #include "kernel/kernel.h"
6 /* ACPI root system description pointer */
7 struct acpi_rsdp {
8 char signature[8]; /* must be "RSD PTR " */
9 u8_t checksum;
10 char oemid[6];
11 u8_t revision;
12 u32_t rsdt_addr;
13 u32_t length;
14 };
16 #define ACPI_SDT_SIGNATURE_LEN 4
18 #define ACPI_SDT_SIGNATURE(name) #name
20 /* header common to all system description tables */
21 struct acpi_sdt_header {
22 char signature[ACPI_SDT_SIGNATURE_LEN];
23 u32_t length;
24 u8_t revision;
25 u8_t checksum;
26 char oemid[6];
27 char oem_table_id[8];
28 u32_t oem_revision;
29 u32_t creator_id;
30 u32_t creator_revision;
33 struct acpi_generic_address {
34 u8_t address_space_id;
35 u8_t register_bit_width;
36 u8_t register_bit_offset;
37 u8_t access_size;
38 u64_t address;
41 struct acpi_fadt_header
43 struct acpi_sdt_header hdr;
44 u32_t facs;
45 u32_t dsdt;
46 u8_t model;
47 u8_t preferred_pm_profile;
48 u16_t sci_int;
49 u32_t smi_cmd;
50 u8_t acpi_enable;
51 u8_t acpi_disable;
52 u8_t s4bios_req;
53 u8_t pstate_cnt;
54 u32_t pm1a_evt_blk;
55 u32_t pm1b_evt_blk;
56 u32_t pm1a_cnt_blk;
57 u32_t pm1b_cnt_blk;
58 u32_t pm2_cnt_blk;
59 u32_t pm_tmr_blk;
60 u32_t gpe0_blk;
61 u32_t gpe1_blk;
62 u8_t pm1_evt_len;
63 u8_t pm1_cnt_len;
64 u8_t pm2_cnt_len;
65 u8_t pm_tmr_len;
66 u8_t gpe0_blk_len;
67 u8_t gpe1_blk_len;
68 u8_t gpe1_base;
69 u8_t cst_cnt;
70 u16_t p_lvl2_lat;
71 u16_t p_lvl3_lat;
72 u16_t flush_size;
73 u16_t flush_stride;
74 u8_t duty_offset;
75 u8_t duty_width;
76 u8_t day_alrm;
77 u8_t mon_alrm;
78 u8_t century;
79 u16_t iapc_boot_arch;
80 u8_t reserved1;
81 u32_t flags;
82 struct acpi_generic_address reset_reg;
83 u8_t reset_value;
84 u8_t reserved2[3];
85 u64_t xfacs;
86 u64_t xdsdt;
87 struct acpi_generic_address xpm1a_evt_blk;
88 struct acpi_generic_address xpm1b_evt_blk;
89 struct acpi_generic_address xpm1a_cnt_blk;
90 struct acpi_generic_address xpm1b_cnt_blk;
91 struct acpi_generic_address xpm2_cnt_blk;
92 struct acpi_generic_address xpm_tmr_blk;
93 struct acpi_generic_address xgpe0_blk;
94 struct acpi_generic_address xgpe1_blk;
97 struct acpi_madt_hdr {
98 struct acpi_sdt_header hdr;
99 u32_t local_apic_address;
100 u32_t flags;
103 #define ACPI_MADT_TYPE_LAPIC 0
104 #define ACPI_MADT_TYPE_IOAPIC 1
105 #define ACPI_MADT_TYPE_INT_SRC 2
106 #define ACPI_MADT_TYPE_NMI_SRC 3
107 #define ACPI_MADT_TYPE_LAPIC_NMI 4
108 #define ACPI_MADT_TYPE_LAPIC_ADRESS 5
109 #define ACPI_MADT_TYPE_IOSAPIC 6
110 #define ACPI_MADT_TYPE_LSAPIC 7
111 #define ACPI_MADT_TYPE_PLATFORM_INT_SRC 8
112 #define ACPI_MADT_TYPE_Lx2APIC 9
113 #define ACPI_MADT_TYPE_Lx2APIC_NMI 10
115 struct acpi_madt_item_hdr{
116 u8_t type;
117 u8_t length;
120 struct acpi_madt_lapic {
121 struct acpi_madt_item_hdr hdr;
122 u8_t acpi_cpu_id;
123 u8_t apic_id;
124 u32_t flags;
127 struct acpi_madt_ioapic {
128 struct acpi_madt_item_hdr hdr;
129 u8_t id;
130 u8_t __reserved;
131 u32_t address;
132 u32_t global_int_base;
135 struct acpi_madt_int_src {
136 struct acpi_madt_item_hdr hdr;
137 u8_t bus;
138 u8_t bus_int;
139 u32_t global_int;
140 u16_t mps_flags;
143 struct acpi_madt_nmi {
144 struct acpi_madt_item_hdr hdr;
145 u16_t flags;
146 u32_t global_int;
149 void acpi_init(void);
151 void acpi_poweroff(void);
154 * Returns a pointer to the io acpi structure in the MADT table in ACPI. The
155 * pointer is valid only until paging is turned off. No memory is allocated in
156 * this function thus no memory needs to be freed
158 struct acpi_madt_ioapic * acpi_get_ioapic_next(void);
159 /* same as above for local APICs */
160 struct acpi_madt_lapic * acpi_get_lapic_next(void);
162 #endif /* __ACPI_H__ */