xref: /netbsd-src/share/man/man4/man4.i386/cmos.4 (revision 3816d47b2c42fcd6e549e3407f842a5b1a1d23ad)
1.\" $NetBSD: cmos.4,v 1.6 2009/10/19 23:19:38 rmind 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.\"
17.\" THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
18.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19.\" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20.\" PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID
21.\" YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23.\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd February 5, 2007
31.Dt CMOS 4 i386
32.Os
33.Sh NAME
34.Nm cmos
35.Nd Read/write access to IBM PC/AT CMOS RAM
36.Sh SYNOPSIS
37.Cd pseudo-device cmos
38.Sh DESCRIPTION
39Use
40.Nm
41to read the real-time clock and ISA configuration data from an
42ISA-compatible CMOS RAM, and to write the ISA configuration data.
43.Pp
44A program reads between 0 and 48 bytes from the CMOS RAM, starting at
45byte 0 of the RAM, using a single call to
46.Xr read 2 .
47Likewise, a program writes between 0 and 48 bytes to the CMOS RAM,
48starting at byte 0 of the RAM, using a single call to
49.Xr write 2 .
50.Pp
51.Nm
52does not allow programs to overwrite the real-time clock data
53(bytes 0 through 9), the status registers (10 through 13),
54the diagnostic status or CMOS shutdown status (bytes 14 and 15),
55or the CMOS checksum (bytes 46 and 47).
56Writes to those bytes are ignored.
57.Pp
58On writes,
59.Nm
60recomputes the CMOS checksum and writes it to the CMOS RAM.
61.Sh EXAMPLES
62Display entire contents of CMOS RAM:
63.Bd -literal -offset indent
64# dd if=/dev/cmos bs=48 count=1 | od -t x1
650000000   37  00  09  00  22  00  06  13  04  80  26  02  50  80  00  00
660000020   00  51  f0  00  01  80  02  00  fc  0f  2f  00  00  00  00  00
670000040   00  80  81  f0  ff  00  00  00  00  00  00  00  00  00  05  ee
680000060
69.Ed
70.Pp
71Change boot order on Soekris net4521 to PXE ROM, Primary HDD,
72Secondary HDD:
73.Bd -literal -offset indent
74# dd if=/dev/cmos of=/tmp/cmos0 bs=48 count=1
751+0 records in
761+0 records out
7748 bytes transferred in 0.001 secs (48000 bytes/sec)
78# cp /tmp/cmos0 /tmp/cmos
79# printf '\exf0\ex80\ex81\exff' | dd bs=1 seek=33 conv=notrunc of=/tmp/cmos
804+0 records in
814+0 records out
824 bytes transferred in 0.001 secs (4000 bytes/sec)
83# dd if=/tmp/cmos of=/dev/cmos
840+1 records in
850+1 records out
8648 bytes transferred in 0.001 secs (48000 bytes/sec)
87.Ed
88.Sh ERRORS
89A program can read or write no more than 48 bytes to
90.Nm .
91.Xr read 2
92/
93.Xr write 2
94will return
95.Er EINVAL
96if more than 48 bytes are read / written at once.
97.Sh AUTHORS
98The original
99.Nm
100driver was written by
101.An Takahiro Kambe Aq taca@back-street.net .
102.An David Young Aq dyoung@NetBSD.org
103modified the original and added it to
104.Nx .
105.\" .Sh BUGS
106