blob: 252e73a416790a4c1d4d41064c4c8d72ea413957 [file] [log] [blame]
Kevin O'Connor8b7861c2013-09-15 02:29:06 -04001#ifndef __RTC_H
2#define __RTC_H
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05003
Kevin O'Connor4ade5232013-09-18 21:41:48 -04004#define PORT_CMOS_INDEX 0x0070
5#define PORT_CMOS_DATA 0x0071
6
7// PORT_CMOS_INDEX nmi disable bit
8#define NMI_DISABLE_BIT 0x80
9
Kevin O'Connor4bd33ca2013-03-03 15:46:00 -050010// Standard BIOS RTC chip entries
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050011#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
Kevin O'Connor4b60c002008-02-25 22:29:55 -050017#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
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050022#define CMOS_STATUS_B 0x0b
Kevin O'Connor4b60c002008-02-25 22:29:55 -050023#define CMOS_STATUS_C 0x0c
24#define CMOS_STATUS_D 0x0d
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050025#define CMOS_RESET_CODE 0x0f
Kevin O'Connor4bd33ca2013-03-03 15:46:00 -050026
27// QEMU cmos config fields. DO NOT ADD MORE. (All new content should
28// be passed via the fw_cfg "file" interface.)
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050029#define CMOS_FLOPPY_DRIVE_TYPE 0x10
Kevin O'Connorbdce35f2008-02-26 21:33:14 -050030#define CMOS_DISK_DATA 0x12
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050031#define CMOS_EQUIPMENT_INFO 0x14
Kevin O'Connorbdce35f2008-02-26 21:33:14 -050032#define CMOS_DISK_DRIVE1_TYPE 0x19
33#define CMOS_DISK_DRIVE2_TYPE 0x1a
34#define CMOS_DISK_DRIVE1_CYL 0x1b
35#define CMOS_DISK_DRIVE2_CYL 0x24
Kevin O'Connore09b9822008-03-06 19:16:37 -050036#define CMOS_MEM_EXTMEM_LOW 0x30
37#define CMOS_MEM_EXTMEM_HIGH 0x31
Kevin O'Connor4b60c002008-02-25 22:29:55 -050038#define CMOS_CENTURY 0x32
Kevin O'Connore09b9822008-03-06 19:16:37 -050039#define CMOS_MEM_EXTMEM2_LOW 0x34
40#define CMOS_MEM_EXTMEM2_HIGH 0x35
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -050041#define CMOS_BIOS_BOOTFLAG1 0x38
Kevin O'Connor15aee2e2008-03-01 13:34:04 -050042#define CMOS_BIOS_DISKTRANSFLAG 0x39
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -050043#define CMOS_BIOS_BOOTFLAG2 0x3d
Kevin O'Connor59c35f22008-10-25 23:05:42 -040044#define CMOS_MEM_HIGHMEM_LOW 0x5b
45#define CMOS_MEM_HIGHMEM_MID 0x5c
46#define CMOS_MEM_HIGHMEM_HIGH 0x5d
Kevin O'Connor31bfad62008-12-16 23:50:52 -050047#define CMOS_BIOS_SMP_COUNT 0x5f
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050048
Kevin O'Connor8b7861c2013-09-15 02:29:06 -040049// RTC register flags
50#define RTC_A_UIP 0x80
51
52#define RTC_B_SET 0x80
53#define RTC_B_PIE 0x40
54#define RTC_B_AIE 0x20
55#define RTC_B_UIE 0x10
56#define RTC_B_BIN 0x04
57#define RTC_B_24HR 0x02
58#define RTC_B_DSE 0x01
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050059
Kevin O'Connor18e38b22008-12-10 20:40:13 -050060#ifndef __ASSEMBLY__
61
Kevin O'Connor8b7861c2013-09-15 02:29:06 -040062#include "types.h" // u8
Kevin O'Connor18e38b22008-12-10 20:40:13 -050063
Kevin O'Connor8b7861c2013-09-15 02:29:06 -040064// rtc.c
65u8 rtc_read(u8 index);
66void rtc_write(u8 index, u8 val);
67void rtc_mask(u8 index, u8 off, u8 on);
68int rtc_updating(void);
69void rtc_setup(void);
70void rtc_use(void);
71void rtc_release(void);
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050072
Kevin O'Connor18e38b22008-12-10 20:40:13 -050073#endif // !__ASSEMBLY__
74
Kevin O'Connor8b7861c2013-09-15 02:29:06 -040075#endif // rtc.h