]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/nvram2env.4
disk(9): Fix a few mandoc related errors
[FreeBSD/FreeBSD.git] / share / man / man4 / nvram2env.4
1 .\" Copyright (c) 2011 Aleksandr Rybalko
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd April 3, 2011
28 .Dt NVRAM2ENV 4
29 .Os
30 .Sh NAME
31 .Nm nvram2env
32 .Nd "copy nvram-like data into kernel environment"
33 .Sh SYNOPSIS
34 .Cd "device nvram2env"
35 .Sh DESCRIPTION
36 .Nm
37 implements a simple method of reading the NVRAM-like data and information
38 stored in flash and storing it in the kernel environment.
39 It can then be used by various device drivers at boot-time.
40 .Pp
41 The NVRAM-like data is an array of zero terminated strings.
42 Each string contains the string name, "=" delimiter and the string value.
43 .Pp
44 .Nm
45 copies the environment values into kernel environment using the kernel setenv call.
46 .Pp
47 Configuration of
48 .Nm
49 is done in
50 .Xr device.hints 5
51 defining the NVRAM base address, fallback base address, maxsize and flags.
52 .Pp
53 .Nm
54 is currently MIPS-specific.
55 .Ss base
56 base - physical address where data block is stored.
57 .Ss fallbackbase
58 fallbackbase - physical address where data block is stored, but only
59 if not found at base.
60 .Ss maxsize
61 maxsize - maximum size of data block.
62 .Ss flags
63 flags - control flags, used to select nvram type and enable/disable CRC check.
64 .Bl -tag -width indent
65 .It Fa 0x0001
66 Avoid CRC checking.
67 Currently CRC checking is not implemented, so to be future
68 compatible, please set it to "1".
69 .It Fa 0x0002
70 Use format "Generic", skip uint32_t field, then zero terminating array of
71 strings.
72 .It Fa 0x0004
73 Use Broadcom CFE format, uint32_t signature "FLSH", uint32_t size,
74 three unused fields uint32_t, then data.
75 .It Fa 0x0008
76 Use U-Boot format, uint32_t crc, then zero terminating array of strings.
77 .El
78 .Sh EXAMPLES
79 Usage in U-Boot case:
80 .Bd -literal -offset indent
81 hint.nvram.0.base=0x1f030000
82 hint.nvram.0.maxsize=0x2000
83 hint.nvram.0.flags=3 # 1 = No check, 2 = Format Generic
84 hint.nvram.1.base=0x1f032000
85 hint.nvram.1.maxsize=0x4000
86 hint.nvram.1.flags=3 # 1 = No check, 2 = Format Generic
87 .Ed
88 .Pp
89 CFE nvram with fallback:
90 .Bd -literal -offset indent
91 hint.nvram.0.base=0x1fff8000
92 hint.nvram.0.fallbackbase=0x1fc00400
93 hint.nvram.0.flags=4 # 4 = Format Broadcom
94 .Ed
95 .Pp
96 but seems for CFE nvram preferred to read both blocks:
97 .Pp
98 NVRAM partition: Static, CFE internal
99 .Bd -literal -offset indent
100 hint.nvram.0.flags=0x05 # Broadcom + nocheck
101 hint.nvram.0.base=0x1fc00400
102 .Ed
103 .Pp
104 Dynamic, editable form CFE, override values from first
105 .Bd -literal -offset indent
106 hint.nvram.1.flags=0x05 # Broadcom + nocheck
107 hint.nvram.1.base=0x1cff8000
108 .Ed
109 .Sh SEE ALSO
110 .Xr kenv 1 ,
111 .Xr kenv 2
112 .Sh HISTORY
113 .Nm
114 first appeared in
115 .Fx 9.0 .
116 .Sh AUTHORS
117 .An Aleksandr Rybalko Aq Mt ray@ddteam.net