diff options
Diffstat (limited to 'src/pc80/mc146818rtc_early.c')
-rw-r--r-- | src/pc80/mc146818rtc_early.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/pc80/mc146818rtc_early.c b/src/pc80/mc146818rtc_early.c index 0c7d822718..83e340c70b 100644 --- a/src/pc80/mc146818rtc_early.c +++ b/src/pc80/mc146818rtc_early.c @@ -10,14 +10,24 @@ static unsigned char cmos_read(unsigned char addr) { - outb(addr, RTC_BASE_PORT + 0); - return inb(RTC_BASE_PORT + 1); + int offs = 0; + if (addr >= 128) { + offs = 2; + addr -= 128; + } + outb(addr, RTC_BASE_PORT + offs + 0); + return inb(RTC_BASE_PORT + offs + 1); } static void cmos_write(unsigned char val, unsigned char addr) { - outb(addr, RTC_BASE_PORT + 0); - outb(val, RTC_BASE_PORT + 1); + int offs = 0; + if (addr >= 128) { + offs = 2; + addr -= 128; + } + outb(addr, RTC_BASE_PORT + offs + 0); + outb(val, RTC_BASE_PORT + offs + 1); } static int cmos_error(void) |