diff --git a/paw/stos/arch/amd64/platform/board.c b/paw/stos/arch/amd64/platform/board.c new file mode 100644 index 0000000..64dd5f5 --- /dev/null +++ b/paw/stos/arch/amd64/platform/board.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026, Chloe M. + * Provided under the BSD-3 clause. + * + * Description: Board initialization + * Author: Chloe M. + */ + +#include +#include + +VOID +HalBoardInit(VOID) +{ + MdHpetInit(); +} diff --git a/paw/stos/arch/amd64/platform/hpet.c b/paw/stos/arch/amd64/platform/hpet.c new file mode 100644 index 0000000..cd867ea --- /dev/null +++ b/paw/stos/arch/amd64/platform/hpet.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2026, Chloe M. + * Provided under the BSD-3 clause. + * + * Description: HPET driver + * Author: Chloe M. + */ + +#include +#include +#include +#include +#include + +#define DTRACE(Fmt, ...) \ + TRACE("[ HPET ]: " Fmt, ##__VA_ARGS__) + +VOID +MdHpetInit(VOID) +{ + ACPI_HPET *Hpet; + + Hpet = AcpiQuery("HPET"); + if (Hpet == NULL) { + KeKnot( + KNOT_UNBOUND_RSRC, + "could not detect HPET on this platform\n" + ); + } + + /* Some informational logging */ + DTRACE("detected hpet with pci vendor id : %x\n", Hpet->PciVendorId); + DTRACE("counter size : %d\n", Hpet->CounterSize); + DTRACE("minimum tick : %d\n", Hpet->MinimumTick); +} diff --git a/paw/stos/head/arch/amd64/hpet.h b/paw/stos/head/arch/amd64/hpet.h new file mode 100644 index 0000000..5f79e71 --- /dev/null +++ b/paw/stos/head/arch/amd64/hpet.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2026, Chloe M. + * Provided under the BSD-3 clause. + * + * Description: HPET driver + * Author: Chloe M. + */ + +#ifndef _MACHINE_HPET_H_ +#define _MACHINE_HPET_H_ 1 + +#include + +/* + * Initialize the HPET timer + */ +VOID MdHpetInit(VOID); + +#endif /* !_MACHINE_HPET_H_ */ diff --git a/paw/stos/head/hal/board.h b/paw/stos/head/hal/board.h new file mode 100644 index 0000000..0e90f2a --- /dev/null +++ b/paw/stos/head/hal/board.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2026, Chloe M. + * Provided under the BSD-3 clause. + * + * Description: Board management + * Author: Chloe M. + */ + +#ifndef _HAL_BOARD_H_ +#define _HAL_BOARD_H_ 1 + +#include + +/* + * Initialize board specifics + */ +VOID HalBoardInit(VOID); + +#endif /* !_HAL_BOARD_H_ */ diff --git a/paw/stos/init/init.c b/paw/stos/init/init.c index 0890cff..5a6cce6 100644 --- a/paw/stos/init/init.c +++ b/paw/stos/init/init.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -82,4 +83,7 @@ KiKernelEntry(VOID) /* Initialize the object manager */ ObInitManager(); + + /* Initialize the board */ + HalBoardInit(); }