stos/amd64+hal: Add hpet init groundwork
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Chloe M.
|
||||||
|
* Provided under the BSD-3 clause.
|
||||||
|
*
|
||||||
|
* Description: Board initialization
|
||||||
|
* Author: Chloe M.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <hal/board.h>
|
||||||
|
#include <machine/hpet.h>
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalBoardInit(VOID)
|
||||||
|
{
|
||||||
|
MdHpetInit();
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Chloe M.
|
||||||
|
* Provided under the BSD-3 clause.
|
||||||
|
*
|
||||||
|
* Description: HPET driver
|
||||||
|
* Author: Chloe M.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <machine/hpet.h>
|
||||||
|
#include <drivers/acpi/tables.h>
|
||||||
|
#include <drivers/acpi/acpi.h>
|
||||||
|
#include <ke/knot.h>
|
||||||
|
#include <ex/trace.h>
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -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 <stdef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the HPET timer
|
||||||
|
*/
|
||||||
|
VOID MdHpetInit(VOID);
|
||||||
|
|
||||||
|
#endif /* !_MACHINE_HPET_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 <stdef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize board specifics
|
||||||
|
*/
|
||||||
|
VOID HalBoardInit(VOID);
|
||||||
|
|
||||||
|
#endif /* !_HAL_BOARD_H_ */
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <ke/bpal.h>
|
#include <ke/bpal.h>
|
||||||
#include <hal/serial.h>
|
#include <hal/serial.h>
|
||||||
#include <hal/kpcr.h>
|
#include <hal/kpcr.h>
|
||||||
|
#include <hal/board.h>
|
||||||
#include <ob/object.h>
|
#include <ob/object.h>
|
||||||
#include <drivers/bootvid/fbio.h>
|
#include <drivers/bootvid/fbio.h>
|
||||||
#include <drivers/acpi/acpi.h>
|
#include <drivers/acpi/acpi.h>
|
||||||
@@ -82,4 +83,7 @@ KiKernelEntry(VOID)
|
|||||||
|
|
||||||
/* Initialize the object manager */
|
/* Initialize the object manager */
|
||||||
ObInitManager();
|
ObInitManager();
|
||||||
|
|
||||||
|
/* Initialize the board */
|
||||||
|
HalBoardInit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user