1.\" $NetBSD: nvram.4,v 1.2 2007/03/02 20:51:21 wiz Exp $ 2.\" 3.\" Copyright (c) 2007 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Tim Rightnour 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.Dd March 1, 2007 38.Dt NVRAM 4 prep 39.Os 40.Sh NAME 41.Nm nvram 42.Nd PReP nvram interface 43.Sh SYNOPSIS 44.In machine/nvram.h 45.Sh DESCRIPTION 46The file 47.Nm /dev/nvram 48is an interface to the PReP NVRAM, including the Global Environment Area. 49This interface is highly stylized; 50ioctls are used for all operations. 51These ioctls refer to individual variables in the 52Global Environment Area and thier values. 53.Pp 54The calls that take and/or return a variable 55use a pointer to an 56.Li int 57variable for this purpose; 58others use a pointer to an 59.Li struct pnviocdesc 60descriptor, 61which contains a variable and two counted strings. 62The first string comprises the fields 63.Li pnv_namelen 64(an 65.Li int ) 66and 67.Li pnv_name 68(a 69.Li "char *" ) , 70giving the name of a field. 71The second string comprises the fields 72.Li pnv_buflen 73and 74.Li pnv_buf , 75used analogously. 76These two counted strings work in a 77.Dq value-result 78fashion. 79At entry to the ioctl, 80the counts are expected to reflect the buffer size; 81on return, 82the counts are updated to reflect the buffer contents. 83.Pp 84The following ioctls are supported: 85.Bl -tag -width PNVIOCGETNEXTNAME 86.It PNVIOCGETNEXTNAME 87Takes a variable name and returns the name of the following variable. 88If a 89.Dv NULL 90is passed as the variable name, the first variable name 91will be returned. 92If the last variable is given as an argument, the ioctl will return 93.Er EINVAL . 94.It Dv PNVIOCGET 95Fills in the value of the named property for the given variable. 96If no such property is associated with that variable, 97the value length is set to \-1. 98If the named property exists but has no value, 99the value length is set to 0. 100.It Dv PNVIOCSET 101Writes the given value under the given name. 102.It Dv PNVIOCGETNUMGE 103Returns the number of variables in the Global Environment Area. 104.El 105.Sh FILES 106.Pa /dev/nvram 107.Sh ERRORS 108The following may result in rejection of an operation: 109.Bl -tag -width Er 110.It Bq Er EINVAL 111The given variable name does not exist. 112.It Bq Er EINVAL 113The buffer set up to retrieve values from the nvram was not large enough 114to hold the result. 115.El 116.Sh SEE ALSO 117.Xr ioctl 2 118.Pp 119.Pa PowerPC Reference Platform Specification Version 1.1, Section 5.5 120.Sh BUGS 121Due to limitations within the 122.Nm 123itself, these functions run at elevated priority 124and may adversely affect system performance. 125.Pp 126.Dv PNVIOCSET 127is not currently supported, making the 128.Nm 129driver read-only at this time. 130