1 // Definitions for X86 CMOS non-volatile memory access.
3 // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
5 // This file may be distributed under the terms of the GNU GPLv3 license.
9 #include "ioport.h" // inb, outb
11 #define CMOS_RTC_SECONDS 0x00
12 #define CMOS_RTC_SECONDS_ALARM 0x01
13 #define CMOS_RTC_MINUTES 0x02
14 #define CMOS_RTC_MINUTES_ALARM 0x03
15 #define CMOS_RTC_HOURS 0x04
16 #define CMOS_RTC_HOURS_ALARM 0x05
17 #define CMOS_RTC_DAY_WEEK 0x06
18 #define CMOS_RTC_DAY_MONTH 0x07
19 #define CMOS_RTC_MONTH 0x08
20 #define CMOS_RTC_YEAR 0x09
21 #define CMOS_STATUS_A 0x0a
22 #define CMOS_STATUS_B 0x0b
23 #define CMOS_STATUS_C 0x0c
24 #define CMOS_STATUS_D 0x0d
25 #define CMOS_RESET_CODE 0x0f
26 #define CMOS_FLOPPY_DRIVE_TYPE 0x10
27 #define CMOS_EQUIPMENT_INFO 0x14
28 #define CMOS_BIOS_CONFIG 0x2d
29 #define CMOS_EXTMEM_LOW 0x30
30 #define CMOS_EXTMEM_HIGH 0x31
31 #define CMOS_CENTURY 0x32
32 #define CMOS_EXTMEM2_LOW 0x34
33 #define CMOS_EXTMEM2_HIGH 0x35
34 #define CMOS_BIOS_BOOTFLAG1 0x38
35 #define CMOS_BIOS_BOOTFLAG2 0x3d
37 // CMOS_STATUS_B bitdefs
38 #define CSB_EN_ALARM_IRQ (1<<5)
40 // CMOS_FLOPPY_DRIVE_TYPE bitdefs
41 #define CFD_NO_DRIVE 0
51 outb(reg, PORT_CMOS_INDEX);
52 return inb(PORT_CMOS_DATA);
56 outb_cmos(u8 val, u8 reg)
58 outb(reg, PORT_CMOS_INDEX);
59 outb(val, PORT_CMOS_DATA);