[coreboot] New patch to review for coreboot: 0739dfa Add cmos helper functions for reading/writing a dword

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Mar 6 00:52:41 CET 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/717

-gerrit

commit 0739dfa33e71e00d87ba9fd107a73d9758c9ebb9
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Mon Sep 26 13:24:40 2011 -0700

    Add cmos helper functions for reading/writing a dword
    
    These get used later for saving/restoring the MRC scrambler
    seed values on each boot.
    
    Change-Id: I6e23f17649bea6d22c4b279ed8d0e5cb6c0885e7
    Signed-off-by: Duncan Laurie <dlaurie at google.com>
---
 src/include/pc80/mc146818rtc.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index 3e5a61a..24dac2c 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -104,6 +104,22 @@ static inline void cmos_write(unsigned char val, unsigned char addr)
 	outb(addr, RTC_BASE_PORT + offs + 0);
 	outb(val, RTC_BASE_PORT + offs + 1);
 }
+
+static inline u32 cmos_read32(u8 offset)
+{
+	u32 value = 0;
+	u8 i;
+	for (i = 0; i < sizeof(value); ++i)
+		value |= cmos_read(offset + i) << (i << 3);
+	return value;
+}
+
+static inline void cmos_write32(u8 offset, u32 value)
+{
+	u8 i;
+	for (i = 0; i < sizeof(value); ++i)
+		cmos_write((value >> (i << 3)) & 0xff, offset + i);
+}
 #endif
 
 #if !defined(__ROMCC__)




More information about the coreboot mailing list