xref: /netbsd/share/man/man4/man4.i386/cmos.4 (revision 6550d01e)
1.\" $NetBSD: cmos.4,v 1.7 2010/04/21 02:59:29 jruoho 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 April 21, 2010
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
39The
40.Nm
41pseudo-device can be used to read the real-time clock and
42.Tn ISA
43configuration data from an ISA-compatible
44.Tn CMOS
45.Tn RAM ,
46and to write the
47.Tn ISA
48configuration data.
49.Pp
50A program reads between 0 and 48 bytes from the
51.Tn CMOS
52.Tn RAM , starting at
53byte 0 of the
54.Tn RAM ,
55using a single call to
56.Xr read 2 .
57Likewise, a program writes between 0 and 48 bytes to the CMOS RAM,
58starting at byte 0 of the RAM, using a single call to
59.Xr write 2 .
60.Pp
61.Nm
62does not allow programs to overwrite the real-time clock data
63(bytes 0 through 9), the status registers (10 through 13),
64the diagnostic status or
65.Tn CMOS
66shutdown status (bytes 14 and 15),
67or the
68.Tn CMOS
69checksum (bytes 46 and 47).
70Writes to those bytes are ignored.
71.Pp
72On writes,
73.Nm
74recomputes the
75.Tn CMOS
76checksum and writes it to the
77.Tn CMOS
78.Tn RAM .
79.Sh EXAMPLES
80Display entire contents of CMOS RAM:
81.Bd -literal -offset 2n
82# dd if=/dev/cmos bs=48 count=1 | od -t x1
830000000   37  00  09  00  22  00  06  13  04  80  26  02  50  80  00  00
840000020   00  51  f0  00  01  80  02  00  fc  0f  2f  00  00  00  00  00
850000040   00  80  81  f0  ff  00  00  00  00  00  00  00  00  00  05  ee
860000060
87.Ed
88.Pp
89Change boot order on Soekris net4521 to
90.Tn PXE
91.Tn ROM ,
92Primary
93.Tn HDD ,
94Secondary
95.Tn HDD :
96.Bd -literal -offset 2n
97# dd if=/dev/cmos of=/tmp/cmos0 bs=48 count=1
981+0 records in
991+0 records out
10048 bytes transferred in 0.001 secs (48000 bytes/sec)
101# cp /tmp/cmos0 /tmp/cmos
102# printf '\exf0\ex80\ex81\exff' | dd bs=1 seek=33 conv=notrunc of=/tmp/cmos
1034+0 records in
1044+0 records out
1054 bytes transferred in 0.001 secs (4000 bytes/sec)
106# dd if=/tmp/cmos of=/dev/cmos
1070+1 records in
1080+1 records out
10948 bytes transferred in 0.001 secs (48000 bytes/sec)
110.Ed
111.Sh ERRORS
112A program can read or write no more than 48 bytes to
113.Nm .
114Both
115.Xr read 2
116and
117.Xr write 2
118will return
119.Er EINVAL
120if more than 48 bytes are read or written at once.
121.Sh AUTHORS
122The original
123.Nm
124driver was written by
125.An Takahiro Kambe Aq taca@back-street.net .
126.An David Young Aq dyoung@NetBSD.org
127modified the original and added it to
128.Nx .
129.\" .Sh BUGS
130