1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
<table class="head">
<tr>
<td class="head-ltitle">BIOS(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">BIOS(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">bios_sigsearch</code>,
<code class="Nm">bios32_SDlookup</code>, <code class="Nm">bios32</code>,
<code class="Nm">bios_oem_strings</code> — <span class="Nd">interact
with PC BIOS</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">vm/vm.h</a>></code>
<br/>
<code class="In">#include <<a class="In">vm/pmap.h</a>></code>
<br/>
<code class="In">#include
<<a class="In">machine/pc/bios.h</a>></code></p>
<p class="Pp"><var class="Ft">uint32_t</var>
<br/>
<code class="Fn">bios_sigsearch</code>(<var class="Fa" style="white-space: nowrap;">uint32_t
start</var>, <var class="Fa" style="white-space: nowrap;">u_char *sig</var>,
<var class="Fa" style="white-space: nowrap;">int siglen</var>,
<var class="Fa" style="white-space: nowrap;">int paralen</var>,
<var class="Fa" style="white-space: nowrap;">int sigofs</var>);</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">bios32_SDlookup</code>(<var class="Fa" style="white-space: nowrap;">struct
bios32_SDentry *ent</var>);</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">bios32</code>(<var class="Fa" style="white-space: nowrap;">struct
bios_regs *br</var>, <var class="Fa" style="white-space: nowrap;">u_int
offset</var>, <var class="Fa" style="white-space: nowrap;">u_short
segment</var>);</p>
<p class="Pp"><code class="Fn">BIOS_PADDRTOVADDR</code>(<var class="Fa" style="white-space: nowrap;">addr</var>);</p>
<p class="Pp"><code class="Fn">BIOS_VADDRTOPADDR</code>(<var class="Fa" style="white-space: nowrap;">addr</var>);</p>
<p class="Pp"><var class="Vt">extern struct bios32_SDentry PCIbios</var>;
<br/>
<var class="Vt">extern struct SMBIOS_table SMBIOStable</var>;
<br/>
<var class="Vt">extern struct DMI_table DMItable</var>;</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">bios_oem_strings</code>(<var class="Fa" style="white-space: nowrap;">struct
bios_oem *oem</var>, <var class="Fa" style="white-space: nowrap;">u_char
*buffer</var>, <var class="Fa" style="white-space: nowrap;">size_t
maxlen</var>);</p>
<div class="Bd Pp Li">
<pre>struct bios_oem_signature {
char * anchor; /* search anchor string in BIOS memory */
size_t offset; /* offset from anchor (may be negative) */
size_t totlen; /* total length of BIOS string to copy */
};
struct bios_oem_range {
u_int from; /* shouldn't be below 0xe0000 */
u_int to; /* shouldn't be above 0xfffff */
};
struct bios_oem {
struct bios_oem_range range;
struct bios_oem_signature signature[];
};</pre>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">These functions provide a general-purpose interface for dealing
with the BIOS functions and data encountered on x86 PC-architecture
systems.</p>
<dl class="Bl-tag">
<dt id="bios_sigsearch"><a class="permalink" href="#bios_sigsearch"><code class="Fn">bios_sigsearch</code></a>()</dt>
<dd>Searches the BIOS address space for a service signature, usually an
uppercase ASCII sequence surrounded by underscores. The search begins at
<var class="Fa">start</var>, or at the beginning of the BIOS if
<var class="Fa">start</var> is zero. <var class="Fa">siglen</var> bytes of
the BIOS image and <var class="Fa">sig</var> are compared at
<var class="Fa">sigofs</var> bytes offset from the current location. If no
match is found, the current location is incremented by
<var class="Fa">paralen</var> bytes and the search repeated. If the
signature is found, its effective physical address is returned. If no
signature is found, zero is returned.</dd>
<dt id="bios_oem_strings"><a class="permalink" href="#bios_oem_strings"><code class="Fn">bios_oem_strings</code></a>()</dt>
<dd>Searches a given BIOS memory range for one or more strings, and composes a
printable concatenation of those found. The routine expects a structure
describing the BIOS address <var class="Fa">range</var> (within
<code class="Li">0xe0000</code> - <code class="Li">0xfffff</code>), and a
{ <code class="Dv">NULL</code>, <code class="Li">0</code>,
<code class="Li">0</code> } -terminated array of
<var class="Vt">bios_oem_signature</var> structures which define the
<var class="Va">anchor</var> string, an <var class="Va">offset</var> from
the beginning of the match (which may be negative), and
<var class="Va">totlen</var> number of bytes to be collected from BIOS
memory starting at that offset. Unmatched anchors are ignored, whereas
matches are copied from BIOS memory starting at their corresponding
<var class="Vt">offset</var> with unprintable characters being replaced
with space, and consecutive spaces being suppressed. This composed string
is stored in <var class="Fa">buffer</var> up to the given
<var class="Fa">maxlen</var> bytes (including trailing
‘<code class="Li">\0</code>’, and any trailing space
suppressed). If an error is encountered, i.e. trying to read out of said
BIOS range, other invalid input, or <var class="Fa">buffer</var> overflow,
a negative integer is returned, otherwise the length of the composed
string is returned. In particular, a return value of 0 means that none of
the given anchor strings were found in the specified BIOS memory
range.</dd>
<dt id="BIOS_VADDRTOPADDR"><a class="permalink" href="#BIOS_VADDRTOPADDR"><code class="Fn">BIOS_VADDRTOPADDR</code></a>()</dt>
<dd>Returns the effective physical address which corresponds to the kernel
virtual address <var class="Fa">addr</var>.</dd>
<dt id="BIOS_PADDRTOVADDR"><a class="permalink" href="#BIOS_PADDRTOVADDR"><code class="Fn">BIOS_PADDRTOVADDR</code></a>()</dt>
<dd>Returns the kernel virtual address which corresponds to the effective
physical address <var class="Fa">addr</var>.</dd>
<dt>SMBIOStable</dt>
<dd>If not NULL, points to a <var class="Ft">struct SMBIOS_table</var>
structure containing information read from the System Management BIOS
table during system startup.</dd>
<dt>DMItable</dt>
<dd>If not NULL, points to a <var class="Ft">struct DMI_table</var> structure
containing information read from the Desktop Management Interface
parameter table during system startup.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="BIOS32"><a class="permalink" href="#BIOS32">BIOS32</a></h1>
<p class="Pp">At system startup, the BIOS is scanned for the BIOS32 Service
Directory (part of the PCI specification), and the existence of the
directory is recorded. This can then be used to locate other services.</p>
<dl class="Bl-tag">
<dt id="bios32_SDlookup"><a class="permalink" href="#bios32_SDlookup"><code class="Fn">bios32_SDlookup</code></a>()</dt>
<dd>Attempts to locate the BIOS32 service matching the 4-byte identifier
passed in the <var class="Fa">ident</var> field of the
<var class="Fa">ent</var> argument.</dd>
<dt id="bios32"><a class="permalink" href="#bios32"><code class="Fn">bios32</code></a>()</dt>
<dd>Calls a bios32 function. This presumes that the function is capable of
working within the kernel segment (normally the case). The virtual address
of the entrypoint is supplied in <var class="Fa">entry</var> and the
register arguments to the function are supplied in
<var class="Fa">args</var>.</dd>
<dt>PCIbios</dt>
<dd>If not NULL, points to a <var class="Ft">struct bios32_SDentry</var>
structure describing the PCI BIOS entrypoint which was found during system
startup.</dd>
</dl>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">August 9, 2005</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|