PatchworkOS
Loading...
Searching...
No Matches
acpi.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
kernel/fs/sysfs.h
>
4
5
#include <
boot/boot_info.h
>
6
#include <
kernel/defs.h
>
7
8
#include <
stdint.h
>
9
66
#define RSDP_CURRENT_REVISION 2
67
71
#define SDT_SIGNATURE_LENGTH 4
72
76
#define SDT_OEM_ID_LENGTH 6
77
81
#define SDT_OEM_TABLE_ID_LENGTH 8
82
89
typedef
struct
PACKED
90
{
91
uint8_t
signature[
SDT_SIGNATURE_LENGTH
];
92
uint32_t
length
;
93
uint8_t
revision
;
94
uint8_t
checkSum
;
95
uint8_t
oemId[
SDT_OEM_ID_LENGTH
];
96
uint8_t
oemTableId[
SDT_OEM_TABLE_ID_LENGTH
];
97
uint32_t
oemRevision
;
98
uint32_t
creatorID
;
99
uint32_t
creatorRevision
;
100
}
sdt_header_t
;
101
105
#define RSDP_SIGNATURE_LENGTH 8
106
113
typedef
struct
PACKED
114
{
115
char
signature[
RSDP_SIGNATURE_LENGTH
];
116
uint8_t
checksum
;
117
char
oemId[
SDT_OEM_ID_LENGTH
];
118
uint8_t
revision
;
119
uint32_t
rsdtAddress
;
120
uint32_t
length
;
121
uint64_t
xsdtAddress
;
122
uint8_t
extendedChecksum
;
123
uint8_t
reserved[3];
124
}
rsdp_t
;
125
129
#define RSDP_V1_LENGTH 20
130
137
typedef
struct
PACKED
138
{
139
sdt_header_t
header
;
140
sdt_header_t
* tables[];
141
}
xsdt_t
;
142
151
bool
acpi_is_checksum_valid
(
void
* table,
uint64_t
length);
152
160
dentry_t
*
acpi_get_sysfs_root
(
void
);
161
171
void
acpi_reclaim_memory
(
const
boot_memory_map_t
*
map
);
172
boot_info.h
defs.h
acpi_get_sysfs_root
dentry_t * acpi_get_sysfs_root(void)
Retrieve the sysfs root directory for ACPI.
Definition
acpi.c:28
SDT_OEM_ID_LENGTH
#define SDT_OEM_ID_LENGTH
The length of the OEM ID field in the SDT header structure.
Definition
acpi.h:76
SDT_OEM_TABLE_ID_LENGTH
#define SDT_OEM_TABLE_ID_LENGTH
The length of the OEM Table ID field in the SDT header structure.
Definition
acpi.h:81
acpi_is_checksum_valid
bool acpi_is_checksum_valid(void *table, uint64_t length)
Check if the sum of all bytes in a table is 0.
Definition
acpi.c:17
SDT_SIGNATURE_LENGTH
#define SDT_SIGNATURE_LENGTH
The length of the signature field in the SDT header structure.
Definition
acpi.h:71
RSDP_SIGNATURE_LENGTH
#define RSDP_SIGNATURE_LENGTH
Length of the signature field in the RSDP structure.
Definition
acpi.h:105
acpi_reclaim_memory
void acpi_reclaim_memory(const boot_memory_map_t *map)
Reclaim ACPI memory regions.
Definition
acpi.c:44
PACKED
#define PACKED
GCC packed attribute.
Definition
defs.h:32
map
boot_memory_map_t * map
Definition
mem.c:19
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:15
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:17
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:11
boot_memory_map_t
Definition
boot_info.h:45
dentry_t
Directory entry structure.
Definition
dentry.h:83
rsdp_t
Root System Description Pointer.
Definition
acpi.h:114
rsdp_t::extendedChecksum
uint8_t extendedChecksum
This is the checksum for the entire table.
Definition
acpi.h:122
rsdp_t::rsdtAddress
uint32_t rsdtAddress
Definition
acpi.h:119
rsdp_t::revision
uint8_t revision
Definition
acpi.h:118
rsdp_t::length
uint32_t length
Definition
acpi.h:120
rsdp_t::checksum
uint8_t checksum
This is the checksum for the first 20 bytes only.
Definition
acpi.h:116
rsdp_t::xsdtAddress
uint64_t xsdtAddress
Definition
acpi.h:121
sdt_header_t
System Description Table Header.
Definition
acpi.h:90
sdt_header_t::oemRevision
uint32_t oemRevision
Definition
acpi.h:97
sdt_header_t::creatorRevision
uint32_t creatorRevision
Definition
acpi.h:99
sdt_header_t::revision
uint8_t revision
Definition
acpi.h:93
sdt_header_t::length
uint32_t length
Definition
acpi.h:92
sdt_header_t::checkSum
uint8_t checkSum
Definition
acpi.h:94
sdt_header_t::creatorID
uint32_t creatorID
Definition
acpi.h:98
xsdt_t
Extended System Description Table.
Definition
acpi.h:138
xsdt_t::header
sdt_header_t header
Definition
acpi.h:139
sysfs.h
include
kernel
acpi
acpi.h
Generated by
1.9.8