xref: /netbsd-src/share/man/man4/man4.i386/cmos.4 (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1.\" $NetBSD: cmos.4,v 1.3 2007/02/07 07:28:29 dyoung Exp $
2.\"
3.\" Copyright (c) 2007 David Young.  All rights reserved.
4.\"
5.\" This manual page was written by David Young.
6.\"
7.\" Redistribution and use in source and binary forms, with or
8.\" without modification, are permitted provided that the following
9.\" conditions are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above
13.\"    copyright notice, this list of conditions and the following
14.\"    disclaimer in the documentation and/or other materials
15.\"    provided with the distribution.
16.\" 3. David Young's name may not be used to endorse or promote
17.\"    products derived from this software without specific prior
18.\"    written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
21.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22.\" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23.\" PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID
24.\" YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26.\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31.\" POSSIBILITY OF SUCH DAMAGE.
32.\"
33.Dd February 5, 2007
34.Os
35.Dt CMOS 4 i386
36.Sh NAME
37.Nm cmos
38.Nd Read/write access to IBM PC/AT CMOS RAM
39.Sh SYNOPSIS
40.Cd pseudo-device cmos
41.Sh DESCRIPTION
42Use
43.Nm
44to read the real-time clock and ISA configuration data from an
45ISA-compatible CMOS RAM, and to write the ISA configuration data.
46.Pp
47A program reads between 0 and 48 bytes from the CMOS RAM, starting at
48byte 0 of the RAM, using a single call to
49.Xr read 2 .
50Likewise, a program writes between 0 and 48 bytes to the CMOS RAM,
51starting at byte 0 of the RAM, using a single call to
52.Xr write 2 .
53.Pp
54.Nm
55does not allow programs to overwrite the real-time clock data
56(bytes 0 through 9), the status registers (10 through 13),
57the diagnostic status or CMOS shutdown status (bytes 14 and 15),
58or the CMOS checksum (bytes 46 and 47).
59Writes to those bytes are ignored.
60.Pp
61On writes,
62.Nm
63recomputes the CMOS checksum and writes it to the CMOS RAM.
64.Sh EXAMPLES
65Display entire contents of CMOS RAM:
66.Bd -literal -offset indent
67# dd if=/dev/cmos bs=48 count=1 | od -t x1
680000000   37  00  09  00  22  00  06  13  04  80  26  02  50  80  00  00
690000020   00  51  f0  00  01  80  02  00  fc  0f  2f  00  00  00  00  00
700000040   00  80  81  f0  ff  00  00  00  00  00  00  00  00  00  05  ee
710000060
72.Ed
73.Pp
74Change boot order on Soekris net4521 to PXE ROM, Primary HDD,
75Secondary HDD:
76.Bd -literal -offset indent
77# dd if=/dev/cmos of=/tmp/cmos0 bs=48 count=1
781+0 records in
791+0 records out
8048 bytes transferred in 0.001 secs (48000 bytes/sec)
81# cp /tmp/cmos0 /tmp/cmos
82# printf '\exf0\ex80\ex81\exff' | dd bs=1 seek=33 conv=notrunc of=/tmp/cmos
834+0 records in
844+0 records out
854 bytes transferred in 0.001 secs (4000 bytes/sec)
86# dd if=/tmp/cmos of=/dev/cmos
870+1 records in
880+1 records out
8948 bytes transferred in 0.001 secs (48000 bytes/sec)
90.Ed
91.Sh ERRORS
92A program can read or write no more than 48 bytes to
93.Nm .
94.Xr read 2 /
95.Xr write 2
96will return
97.Er EINVAL
98if more than 48 bytes are read / written at once.
99.Sh AUTHORS
100The original
101.Nm
102driver was written by
103.An Takahiro Kambe Aq taca@back-street.net .
104.An David Young Aq dyoung@NetBSD.org
105modified the original and added it to
106.Nx .
107.\" .Sh BUGS
108