summaryrefslogtreecommitdiff
path: root/src/include/pc80/mc146818rtc.h
diff options
context:
space:
mode:
authorEdwin Beasant <edwin_beasant@virtensys.com>2010-07-06 21:05:04 +0000
committerMyles Watson <mylesgw@gmail.com>2010-07-06 21:05:04 +0000
commiteb50c7d922e91f0247b3705eccb2d2eec638c277 (patch)
tree2def570d089b2f6deb2beac165e18756a578e308 /src/include/pc80/mc146818rtc.h
parent8376831eafc1be1175529fd21e0d2fe40339d4eb (diff)
downloadcoreboot-eb50c7d922e91f0247b3705eccb2d2eec638c277.tar.xz
Re-integrate "USE_OPTION_TABLE" code.
Signed-off-by: Edwin Beasant <edwin_beasant@virtensys.com> Signed-off-by: Myles Watson <mylesgw@gmail.com> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5653 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/include/pc80/mc146818rtc.h')
-rw-r--r--src/include/pc80/mc146818rtc.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index cd8c8181aa..0abb2a6b4b 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -85,15 +85,48 @@
* LB_CKS_RANGE_START, LB_CKS_RANGE_END and LB_CKS_LOC are defined
* in option_table.h
*/
+#if CONFIG_HAVE_OPTION_TABLE
+#include <option_table.h>
+#endif
+
+#ifndef UTIL_BUILD_OPTION_TABLE
+#include <arch/io.h>
+static inline unsigned char cmos_read(unsigned char addr)
+{
+ int offs = 0;
+ if (addr >= 128) {
+ offs = 2;
+ addr -= 128;
+ }
+ outb(addr, RTC_BASE_PORT + offs + 0);
+ return inb(RTC_BASE_PORT + offs + 1);
+}
-#if !defined(ASSEMBLY) && !defined(__PRE_RAM__)
+static inline void cmos_write(unsigned char val, unsigned char addr)
+{
+ int offs = 0;
+ if (addr >= 128) {
+ offs = 2;
+ addr -= 128;
+ }
+ outb(addr, RTC_BASE_PORT + offs + 0);
+ outb(val, RTC_BASE_PORT + offs + 1);
+}
+#endif
+
+#if !defined(__ROMCC__)
void rtc_init(int invalid);
-#if CONFIG_USE_OPTION_TABLE == 1
+#if CONFIG_USE_OPTION_TABLE
int get_option(void *dest, const char *name);
+unsigned read_option(unsigned start, unsigned size, unsigned def);
#else
static inline int get_option(void *dest __attribute__((unused)),
const char *name __attribute__((unused))) { return -2; }
+static inline unsigned read_option(unsigned start, unsigned size, unsigned def)
+ { return def; }
#endif
+#else
+#include <pc80/mc146818rtc_early.c>
#endif
#endif /* PC80_MC146818RTC_H */