Monday, November 29, 2010

CMOS read/wirte in coreboot/Linux

0x70 is the CMOS memory address I/O port,and 0x71 is the CMOS memory data I/O port

There are 128 bytes data in CMOS, or say 1024 bits in CMOS. The layout format of CMOS is at:
/coreboot/src/mainboard/asus/m2v-mx_se/cmos.layout
or link
http://www.bioscentral.com/misc/cmosmap.htm


If you want to read the 125th byte of CMOS memory:

#include <arch/io.h>
unsigned char addr = 125;
unsigned char data
outb(addr, 0x70);
data = inb(0x71)

If you want to write to the 125th byte of CMOS memory:

#include <arch/io.h>
unsigned char addr = 125;
unsgined char data = 0x01;
outb(addr, 0x70);
outb(data, 0x71);
There are also cmos_read() and cmos_write function at /coreboot/src/include/pc80/mc146818rtc.h

No comments: