-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacpi.h
125 lines (110 loc) · 3.04 KB
/
acpi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef __ACPI_H__
#define __ACPI_H__
// Miejsca gdzie może znajdować się struktura RSDP
#define SEARCH1_START 0x1
#define SEARCH1_END 0x400
#define SEARCH2_START 0x000E0000
#define SEARCH2_END 0x000FFFFF
// Zawartość pola revision mówi o wersji ACPI
#define ACPI10 0
#define ACPI20 2
// RSDP w wersji ACPI 1.0
struct RSDP_descriptor {
char signature[8];
uint8_t checksum;
char OEMID[6];
uint8_t revision;
uint32_t rsdt_address;
} __attribute__ ((packed));
// RSDP w wersji ACPI 2.0
struct RSDP_descriptor20 {
struct RSDP_descriptor first_part;
uint32_t length;
uint64_t xsdt_address;
uint8_t extended_checksum;
uint8_t reserved[3];
} __attribute__ ((packed));
// Wpis w tablicy RSDT
struct ACPISDT_header {
char signature[4];
uint32_t length;
uint8_t revision;
uint8_t checksum;
char OEMID[6];
char OEM_table_ID[8];
uint32_t OEM_revision;
uint32_t creator_ID;
uint32_t creator_revision;
};
// Jakaś struktura wykorzystywana przez ACPI
struct GenericAddressStructure
{
uint8_t AddressSpace;
uint8_t BitWidth;
uint8_t BitOffset;
uint8_t AccessSize;
uint64_t Address;
};
// Tablica Fixed ACPI Description Table - chcemy sprawdzić obsługę myszy
struct FADT
{
struct ACPISDT_header h;
uint32_t FirmwareCtrl;
uint32_t Dsdt;
uint8_t Reserved;
uint8_t PreferredPowerManagementProfile;
uint16_t SCI_Interrupt;
uint32_t SMI_CommandPort;
uint8_t AcpiEnable;
uint8_t AcpiDisable;
uint8_t S4BIOS_REQ;
uint8_t PSTATE_Control;
uint32_t PM1aEventBlock;
uint32_t PM1bEventBlock;
uint32_t PM1aControlBlock;
uint32_t PM1bControlBlock;
uint32_t PM2ControlBlock;
uint32_t PMTimerBlock;
uint32_t GPE0Block;
uint32_t GPE1Block;
uint8_t PM1EventLength;
uint8_t PM1ControlLength;
uint8_t PM2ControlLength;
uint8_t PMTimerLength;
uint8_t GPE0Length;
uint8_t GPE1Length;
uint8_t GPE1Base;
uint8_t CStateControl;
uint16_t WorstC2Latency;
uint16_t WorstC3Latency;
uint16_t FlushSize;
uint16_t FlushStride;
uint8_t DutyOffset;
uint8_t DutyWidth;
uint8_t DayAlarm;
uint8_t MonthAlarm;
uint8_t Century; // Adres rejestru CMOS zawierającego wiek
// ACPI 2
uint16_t BootArchitectureFlags;
uint8_t Reserved2;
uint32_t Flags;
struct GenericAddressStructure ResetReg;
uint8_t ResetValue;
uint8_t Reserved3[3];
// ACPI 2
uint64_t X_FirmwareControl;
uint64_t X_Dsdt;
struct GenericAddressStructure X_PM1aEventBlock;
struct GenericAddressStructure X_PM1bEventBlock;
struct GenericAddressStructure X_PM1aControlBlock;
struct GenericAddressStructure X_PM1bControlBlock;
struct GenericAddressStructure X_PM2ControlBlock;
struct GenericAddressStructure X_PMTimerBlock;
struct GenericAddressStructure X_GPE0Block;
struct GenericAddressStructure X_GPE1Block;
};
// Prototypy
void acpi_initialize(void);
int get_ACPI_version(void);
uint32_t find_table(const char *signature);
#endif