aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/acpi
diff options
context:
space:
mode:
authorMarvin Borner2020-05-06 19:04:05 +0200
committerMarvin Borner2020-05-06 19:04:05 +0200
commitd94ffac4a584dc7a4f6f2ec567b8caab05ce9253 (patch)
tree559cd596a0a407d4b40c1d12d3c6a0686494da16 /src/kernel/acpi
parent1a8563a05608b5b5e27eada44cf4790926001c68 (diff)
New build parameters and shared includes
This changes many files but I've just applied some replace commands.. So - nothing special!
Diffstat (limited to 'src/kernel/acpi')
-rw-r--r--src/kernel/acpi/acpi.c30
-rw-r--r--src/kernel/acpi/acpi.h180
2 files changed, 105 insertions, 105 deletions
diff --git a/src/kernel/acpi/acpi.c b/src/kernel/acpi/acpi.c
index 1fced51..2f1c29f 100644
--- a/src/kernel/acpi/acpi.c
+++ b/src/kernel/acpi/acpi.c
@@ -2,15 +2,15 @@
// HPET: https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/software-developers-hpet-spec-1-0a.pdf
#include <stddef.h>
-#include <kernel/system.h>
-#include <kernel/multiboot.h>
-#include <kernel/io/io.h>
-#include <kernel/lib/lib.h>
-#include <kernel/lib/stdlib.h>
-#include <kernel/lib/stdio.h>
-#include <kernel/acpi/acpi.h>
-#include <kernel/memory/paging.h>
-#include <kernel/memory/alloc.h>
+#include <system.h>
+#include <multiboot.h>
+#include <io/io.h>
+#include <lib/lib.h>
+#include <lib/stdlib.h>
+#include <lib/stdio.h>
+#include <acpi/acpi.h>
+#include <memory/paging.h>
+#include <memory/alloc.h>
struct rsdt *rsdt;
struct fadt *fadt;
@@ -19,9 +19,9 @@ struct madt *madt;
int check_sum(struct sdt_header *header)
{
- uint8_t sum = 0;
+ u8 sum = 0;
- for (uint32_t i = 0; i < header->length; i++)
+ for (u32 i = 0; i < header->length; i++)
sum += ((char *)header)[i];
return sum == 0;
@@ -44,11 +44,11 @@ void acpi_init(struct rsdp *rsdp)
if (!check_sum((struct sdt_header *)rsdt)) {
warn("Corrupted RSDT!");
} else {
- uint32_t *pointer = (uint32_t *)(rsdt + 1);
- uint32_t *end = (uint32_t *)((uint8_t *)rsdt + rsdt->header.length);
+ u32 *pointer = (u32 *)(rsdt + 1);
+ u32 *end = (u32 *)((u8 *)rsdt + rsdt->header.length);
while (pointer < end) {
- uint32_t address = *pointer++;
+ u32 address = *pointer++;
memcpy(header, (void *)address, sizeof(struct sdt_header));
if (strncmp(header->signature, "FACP", 4) == 0) {
@@ -103,7 +103,7 @@ void reboot()
outb(fadt->reset_reg.address, fadt->reset_value);
halt_loop();
} else {
- uint8_t good = 0x02;
+ u8 good = 0x02;
while (good & 0x02)
good = inb(0x64);
outb(0x64, 0xFE);
diff --git a/src/kernel/acpi/acpi.h b/src/kernel/acpi/acpi.h
index 0b98552..d487bdd 100644
--- a/src/kernel/acpi/acpi.h
+++ b/src/kernel/acpi/acpi.h
@@ -2,7 +2,7 @@
#define MELVIX_ACPI_H
#include <stdint.h>
-#include <kernel/multiboot.h>
+#include <multiboot.h>
/**
* Initialize the ACP interface
@@ -21,38 +21,38 @@ void reboot();
void acpi_poweroff();
struct address_structure {
- uint8_t address_space_id;
- uint8_t register_bit_width;
- uint8_t register_bit_offset;
- uint8_t reserved;
- uint64_t address;
+ u8 address_space_id;
+ u8 register_bit_width;
+ u8 register_bit_offset;
+ u8 reserved;
+ u64 address;
};
// p. 138
struct fadt_flags {
- uint8_t WBINVD : 1;
- uint8_t WBINVD_flush : 1;
- uint8_t C1_support : 1;
- uint8_t C2_mp_support : 1;
- uint8_t power_button : 1; // 1 if not present
- uint8_t sleep_button : 1; // 1 if not present
- uint8_t rtc_fix_reg : 1;
- uint8_t rtc_wakes_S4 : 1;
- uint8_t timer_32 : 1;
- uint8_t dock_support : 1;
- uint8_t reset_support : 1;
- uint8_t sealed_case : 1;
- uint8_t headless : 1;
- uint8_t slp_instruction : 1;
- uint8_t pci_wake_support : 1;
- uint8_t use_platform_clock : 1;
- uint8_t rtc_valid_S4 : 1;
- uint8_t remote_on_support : 1;
- uint8_t force_apic_cluster : 1;
- uint8_t force_apic_physical : 1;
- uint8_t hw_reduced_acpi : 1;
- uint8_t low_power_S0_support : 1;
- uint16_t reserved : 10;
+ u8 WBINVD : 1;
+ u8 WBINVD_flush : 1;
+ u8 C1_support : 1;
+ u8 C2_mp_support : 1;
+ u8 power_button : 1; // 1 if not present
+ u8 sleep_button : 1; // 1 if not present
+ u8 rtc_fix_reg : 1;
+ u8 rtc_wakes_S4 : 1;
+ u8 timer_32 : 1;
+ u8 dock_support : 1;
+ u8 reset_support : 1;
+ u8 sealed_case : 1;
+ u8 headless : 1;
+ u8 slp_instruction : 1;
+ u8 pci_wake_support : 1;
+ u8 use_platform_clock : 1;
+ u8 rtc_valid_S4 : 1;
+ u8 remote_on_support : 1;
+ u8 force_apic_cluster : 1;
+ u8 force_apic_physical : 1;
+ u8 hw_reduced_acpi : 1;
+ u8 low_power_S0_support : 1;
+ u16 reserved : 10;
};
struct rsdp {
@@ -60,76 +60,76 @@ struct rsdp {
char checksum;
char oem_id[6];
char revision;
- uint32_t *rsdt_address;
+ u32 *rsdt_address;
};
struct sdt_header {
char signature[4];
- uint32_t length;
- uint8_t revision;
- uint8_t checksum;
+ u32 length;
+ u8 revision;
+ u8 checksum;
char oem_id[6];
char oem_table_id[8];
- uint32_t oem_revision;
- uint32_t creator_id;
- uint32_t creator_revision;
+ u32 oem_revision;
+ u32 creator_id;
+ u32 creator_revision;
};
struct rsdt {
struct sdt_header header;
- uint32_t sdt_pointer[];
+ u32 sdt_pointer[];
};
struct xsdt {
struct sdt_header header;
- uint32_t sdt_pointer[];
+ u32 sdt_pointer[];
};
struct fadt {
struct sdt_header header;
- uint32_t firmware_ctl;
- uint32_t dsdt;
- uint8_t reserved;
- uint8_t preferred_power_management;
- uint16_t sci_interrupt;
- uint32_t smi_commandPort;
- uint8_t acpi_enable;
- uint8_t acpi_disable;
- uint8_t S4BIOS_req;
- uint8_t PSTATE_control;
- uint32_t PM1a_event_block;
- uint32_t PM1b_event_block;
- uint32_t PM1a_control_block;
- uint32_t PM1b_control_block;
- uint32_t PM2_control_block;
- uint32_t PM_timer_block;
- uint32_t GPE0_block;
- uint32_t GPE1_block;
- uint8_t PM1_event_length;
- uint8_t PM1_control_length;
- uint8_t PM2_control_length;
- uint8_t PM_timer_length;
- uint8_t GPE0_length;
- uint8_t GPE1_length;
- uint8_t GPE1_base;
- uint8_t C_state_control;
- uint16_t worst_C2_latency;
- uint16_t worst_C3_latency;
- uint16_t flush_size;
- uint16_t flush_stride;
- uint8_t duty_offset;
- uint8_t duty_width;
- uint8_t day_alarm;
- uint8_t month_alarm;
- uint8_t century;
- uint16_t boot_architecture_flags; // Reserved in 1.0
- uint8_t reserved2;
+ u32 firmware_ctl;
+ u32 dsdt;
+ u8 reserved;
+ u8 preferred_power_management;
+ u16 sci_interrupt;
+ u32 smi_commandPort;
+ u8 acpi_enable;
+ u8 acpi_disable;
+ u8 S4BIOS_req;
+ u8 PSTATE_control;
+ u32 PM1a_event_block;
+ u32 PM1b_event_block;
+ u32 PM1a_control_block;
+ u32 PM1b_control_block;
+ u32 PM2_control_block;
+ u32 PM_timer_block;
+ u32 GPE0_block;
+ u32 GPE1_block;
+ u8 PM1_event_length;
+ u8 PM1_control_length;
+ u8 PM2_control_length;
+ u8 PM_timer_length;
+ u8 GPE0_length;
+ u8 GPE1_length;
+ u8 GPE1_base;
+ u8 C_state_control;
+ u16 worst_C2_latency;
+ u16 worst_C3_latency;
+ u16 flush_size;
+ u16 flush_stride;
+ u8 duty_offset;
+ u8 duty_width;
+ u8 day_alarm;
+ u8 month_alarm;
+ u8 century;
+ u16 boot_architecture_flags; // Reserved in 1.0
+ u8 reserved2;
struct fadt_flags flags;
struct address_structure reset_reg;
- uint8_t reset_value;
- uint8_t reserved3[3];
- uint64_t x_firmware_control; // Reserved in 1.0
- uint64_t x_dsdt; // Reserved in 1.0
+ u8 reset_value;
+ u8 reserved3[3];
+ u64 x_firmware_control; // Reserved in 1.0
+ u64 x_dsdt; // Reserved in 1.0
struct address_structure x_PM1a_event_block;
struct address_structure x_PM1b_event_block;
struct address_structure x_PM1a_control_block;
@@ -142,22 +142,22 @@ struct fadt {
struct hpet {
struct sdt_header header;
- uint8_t hardware_rev_id;
- uint8_t comparator_count : 5;
- uint8_t counter_size : 1;
- uint8_t reserved : 1;
- uint8_t legacy_replacement : 1;
- uint16_t pci_vendor_id;
+ u8 hardware_rev_id;
+ u8 comparator_count : 5;
+ u8 counter_size : 1;
+ u8 reserved : 1;
+ u8 legacy_replacement : 1;
+ u16 pci_vendor_id;
struct address_structure address;
- uint8_t hpet_number;
- uint16_t minimum_tick;
- uint8_t page_protection;
+ u8 hpet_number;
+ u16 minimum_tick;
+ u8 page_protection;
};
struct madt {
struct sdt_header header;
- uint32_t address;
- uint32_t flags;
+ u32 address;
+ u32 flags;
// Interrupt devices...
};