Files
exectos/xtoskrnl/hl/x86/firmware.cc
Aiken Harris f2baa765b4
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in -59m25s
Builds / ExectOS (amd64, release) (push) Successful in -59m26s
Builds / ExectOS (i686, debug) (push) Successful in -59m23s
Builds / ExectOS (i686, release) (push) Successful in -59m25s
Use constants for CMOS port selection
2026-04-24 09:55:36 +02:00

57 lines
1.4 KiB
C++

/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/hl/x86/firmware.cc
* DESCRIPTION: UEFI/BIOS Firmware support
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
*/
#include <xtos.hh>
/**
* Reads a byte from the specified CMOS register.
*
* @param Register
* Supplies the CMOS register index to read from.
*
* @return This routine returns the data read from the register.
*
* @since XT 1.0
*/
XTFASTCALL
UCHAR
HL::Firmware::ReadCmosRegister(IN UCHAR Register)
{
/* Select the register (Setting the highest bit disables NMI) */
HL::IoPort::WritePort8(CMOS_SELECT_PORT, Register | CMOS_NMI_SELECT);
/* Read value from the data port */
return HL::IoPort::ReadPort8(CMOS_DATA_PORT);
}
/**
* Writes a byte to the specified CMOS register.
*
* @param Register
* Supplies the CMOS register index to write to.
*
* @param Value
* Supplies the value to write to the register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTFASTCALL
VOID
HL::Firmware::WriteCmosRegister(IN UCHAR Register,
IN UCHAR Value)
{
/* Select the register (Setting the highest bit disables NMI) */
HL::IoPort::WritePort8(CMOS_SELECT_PORT, Register | CMOS_NMI_SELECT);
/* Write the provided value to the data port */
HL::IoPort::WritePort8(CMOS_DATA_PORT, Value);
}