aboutsummaryrefslogtreecommitdiff
path: root/src/pc80/mc146818rtc_early.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2009-04-22 09:03:08 +0000
committerStefan Reinauer <stepan@openbios.org>2009-04-22 09:03:08 +0000
commit73d5daaf97465776a4ef6ae5c99a5badaeba292b (patch)
treeeb21aeb759061616ec4892104d010910f5196ab4 /src/pc80/mc146818rtc_early.c
parent953253f093302ccee1cc634772a4561ffbe32355 (diff)
* Allow coreboot to use the full 256 bytes of CMOS memory
* Make functions out of the accessor macros in mc146818rtc.c * don't hide reserved cmos entries from coreboot, only from the user. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4170 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/pc80/mc146818rtc_early.c')
-rw-r--r--src/pc80/mc146818rtc_early.c18
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)