diff options
author | Ian Moffett <ian@osmora.org> | 2024-02-14 11:11:54 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-02-14 11:11:54 -0500 |
commit | 686aa1cf45189cc05d1200e1634eec537ab91ff7 (patch) | |
tree | 7ad26afd5b6670ad2ad95b0184dc69d8e8c4dea2 | |
parent | c10de830906f4c819d06a90e906178b1512c4677 (diff) |
kernel/amd64: hpet: HPET is architecture specific
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/arch/amd64/amd64/hpet.c (renamed from sys/dev/timer/hpet.c) | 2 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/lapic.c | 2 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 12 | ||||
-rw-r--r-- | sys/firmware/acpi/acpi_init.c | 9 | ||||
-rw-r--r-- | sys/include/arch/amd64/hpet.h (renamed from sys/include/dev/timer/hpet.h) | 0 | ||||
-rw-r--r-- | sys/include/sys/machdep.h | 1 | ||||
-rw-r--r-- | sys/kern/init_main.c | 4 |
7 files changed, 19 insertions, 11 deletions
diff --git a/sys/dev/timer/hpet.c b/sys/arch/amd64/amd64/hpet.c index b836205..9835d6c 100644 --- a/sys/dev/timer/hpet.c +++ b/sys/arch/amd64/amd64/hpet.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <dev/timer/hpet.h> +#include <machine/hpet.h> #include <firmware/acpi/acpi.h> #include <sys/panic.h> #include <sys/cdefs.h> diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c index c4e81a6..a1cbbf1 100644 --- a/sys/arch/amd64/amd64/lapic.c +++ b/sys/arch/amd64/amd64/lapic.c @@ -37,13 +37,13 @@ #include <machine/sysvec.h> #include <machine/tss.h> #include <machine/isa/i8254.h> +#include <machine/hpet.h> #include <vm/vm.h> #include <sys/cdefs.h> #include <sys/timer.h> #include <sys/syslog.h> #include <sys/panic.h> #include <sys/mmio.h> -#include <dev/timer/hpet.h> __MODULE_NAME("lapic"); __KERNEL_META("$Hyra$: lapic.c, Ian Marco Moffett, " diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 07f16fc..af3918d 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -29,10 +29,12 @@ #include <sys/machdep.h> #include <sys/cdefs.h> +#include <sys/panic.h> #include <machine/trap.h> #include <machine/idt.h> #include <machine/gdt.h> #include <machine/ioapic.h> +#include <machine/hpet.h> #include <machine/lapic.h> #include <machine/tss.h> #include <machine/spectre.h> @@ -94,6 +96,16 @@ serial_dbgch(char c) uart8250_write(c); } +void +chips_init(void) +{ + /* Hyra requires HPET on x86_64 */ + if (hpet_init() != 0) + panic("Machine does not support HPET!\n"); + + hpet_init(); +} + /* * Things set up before processor_init() call... */ diff --git a/sys/firmware/acpi/acpi_init.c b/sys/firmware/acpi/acpi_init.c index f267d91..c23506b 100644 --- a/sys/firmware/acpi/acpi_init.c +++ b/sys/firmware/acpi/acpi_init.c @@ -33,7 +33,6 @@ #include <sys/cdefs.h> #include <sys/panic.h> #include <sys/syslog.h> -#include <dev/timer/hpet.h> #include <vm/vm.h> __MODULE_NAME("acpi"); @@ -107,12 +106,4 @@ acpi_init(void) panic("Root SDT has an invalid checksum!\n"); } root_sdt_entries = (root_sdt->hdr.length - sizeof(root_sdt->hdr)) / 4; - -#if defined(__x86_64__) - /* Hyra requires HPET on x86_64 */ - if (hpet_init() != 0) - panic("Machine does not support HPET!\n"); -#else - hpet_init(); -#endif /* defined(__x86_64__) */ } diff --git a/sys/include/dev/timer/hpet.h b/sys/include/arch/amd64/hpet.h index dc4366c..dc4366c 100644 --- a/sys/include/dev/timer/hpet.h +++ b/sys/include/arch/amd64/hpet.h diff --git a/sys/include/sys/machdep.h b/sys/include/sys/machdep.h index b97748c..3180e1d 100644 --- a/sys/include/sys/machdep.h +++ b/sys/include/sys/machdep.h @@ -37,6 +37,7 @@ #define MAXCPUS 32 +__weak void chips_init(void); __weak void processor_init(void); __weak void pre_init(void); __weak void processor_halt(void); diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 2fe84ed..a5d7577 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -87,6 +87,10 @@ main(void) acpi_init(); + if (chips_init == NULL) { + chips_init(); + } + processor_init(); list_timers(); |