CMOS(4)

NAME
cmos - Read/write access to IBM PC/AT CMOS RAM

SYNOPSIS
pseudo-device cmos

DESCRIPTION
The cmos pseudo-device can be used to read the real-time clock and ISA configuration data from an ISA-compatible CMOS RAM, and to write the ISA configuration data.

A program reads between 0 and 48 bytes from the CMOS RAM, starting at byte 0 of the RAM, using a single call to read(2). Likewise, a program writes between 0 and 48 bytes to the CMOS RAM, starting at byte 0 of the RAM, using a single call to write(2).

cmos does not allow programs to overwrite the real-time clock data (bytes 0 through 9), the status registers (10 through 13), the diagnostic status or CMOS shutdown status (bytes 14 and 15), or the CMOS checksum (bytes 46 and 47). Writes to those bytes are ignored.

On writes, cmos recomputes the CMOS checksum and writes it to the CMOS RAM.

EXAMPLES
Display entire contents of CMOS RAM:

    # dd if=/dev/cmos bs=48 count=1 | od -t x1
    0000000   37  00  09  00  22  00  06  13  04  80  26  02  50  80  00  00
    0000020   00  51  f0  00  01  80  02  00  fc  0f  2f  00  00  00  00  00
    0000040   00  80  81  f0  ff  00  00  00  00  00  00  00  00  00  05  ee
    0000060

Change boot order on Soekris net4521 to PXE ROM, Primary HDD, Secondary HDD:

    # dd if=/dev/cmos of=/tmp/cmos0 bs=48 count=1
    1+0 records in
    1+0 records out
    48 bytes transferred in 0.001 secs (48000 bytes/sec)
    # cp /tmp/cmos0 /tmp/cmos
    # printf '\xf0\x80\x81\xff' | dd bs=1 seek=33 conv=notrunc of=/tmp/cmos
    4+0 records in
    4+0 records out
    4 bytes transferred in 0.001 secs (4000 bytes/sec)
    # dd if=/tmp/cmos of=/dev/cmos
    0+1 records in
    0+1 records out
    48 bytes transferred in 0.001 secs (48000 bytes/sec)

ERRORS
A program can read or write no more than 48 bytes to cmos. Both read(2) and write(2) will return EINVAL if more than 48 bytes are read or written at once.

AUTHORS
The original cmos driver was written by Takahiro Kambe <taca@back-street.net>. David Young <dyoung@NetBSD.org> modified the original and added it to NetBSD.