]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/bios.9
bhnd(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / share / man / man9 / bios.9
1 .\" $FreeBSD$
2 .\"
3 .\" Copyright (c) 1997 Michael Smith
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .Dd August 9, 2005
28 .Dt BIOS 9
29 .Os
30 .Sh NAME
31 .Nm bios_sigsearch ,
32 .Nm bios32_SDlookup ,
33 .Nm bios32 ,
34 .Nm bios_oem_strings
35 .Nd interact with PC BIOS
36 .Sh SYNOPSIS
37 .In sys/param.h
38 .In vm/vm.h
39 .In vm/pmap.h
40 .In machine/pc/bios.h
41 .Ft uint32_t
42 .Fn bios_sigsearch "uint32_t start" "u_char *sig" "int siglen" "int paralen" "int sigofs"
43 .Ft int
44 .Fn bios32_SDlookup "struct bios32_SDentry *ent"
45 .Ft int
46 .Fn bios32 "struct bios_regs *br" "u_int offset" "u_short segment"
47 .Fn BIOS_PADDRTOVADDR "addr"
48 .Fn BIOS_VADDRTOPADDR "addr"
49 .Vt extern struct bios32_SDentry PCIbios ;
50 .Vt extern struct SMBIOS_table SMBIOStable ;
51 .Vt extern struct DMI_table DMItable ;
52 .Ft int
53 .Fn bios_oem_strings "struct bios_oem *oem" "u_char *buffer" "size_t maxlen"
54 .Bd -literal
55 struct bios_oem_signature {
56         char * anchor;          /* search anchor string in BIOS memory */
57         size_t offset;          /* offset from anchor (may be negative) */
58         size_t totlen;          /* total length of BIOS string to copy */
59 };
60 struct bios_oem_range {
61         u_int from;             /* shouldn't be below 0xe0000 */
62         u_int to;               /* shouldn't be above 0xfffff */
63 };
64 struct bios_oem {
65         struct bios_oem_range range;
66         struct bios_oem_signature signature[];
67 };
68 .Ed
69 .Sh DESCRIPTION
70 These functions provide a general-purpose interface for dealing with
71 the BIOS functions and data encountered on x86 PC-architecture systems.
72 .Bl -tag -width 20n
73 .It Fn bios_sigsearch
74 Searches the BIOS address space for a service signature, usually an
75 uppercase ASCII sequence surrounded by underscores.
76 The search begins at
77 .Fa start ,
78 or at the beginning of the BIOS if
79 .Fa start
80 is zero.
81 .Fa siglen
82 bytes of the BIOS image and
83 .Fa sig
84 are compared at
85 .Fa sigofs
86 bytes offset from the current location.
87 If no match is found, the
88 current location is incremented by
89 .Fa paralen
90 bytes and the search repeated.
91 If the signature is found, its effective
92 physical address is returned.
93 If no signature is found, zero is returned.
94 .It Fn bios_oem_strings
95 Searches a given BIOS memory range for one or more strings,
96 and composes a printable concatenation of those found.
97 The routine expects a structure describing the BIOS address
98 .Fa range
99 (within
100 .Li 0xe0000
101 -
102 .Li 0xfffff ) ,
103 and a {
104 .Dv NULL , Li 0 , 0
105 } -terminated array of
106 .Vt bios_oem_signature
107 structures which define the
108 .Va anchor
109 string, an
110 .Va offset
111 from the beginning of the match (which may be negative), and
112 .Va totlen
113 number of bytes to be collected from BIOS memory starting at that offset.
114 Unmatched anchors are ignored, whereas matches are copied from BIOS memory
115 starting at their corresponding
116 .Vt offset
117 with unprintable characters being replaced with space, and consecutive spaces
118 being suppressed.
119 This composed string is stored in
120 .Fa buffer
121 up to the given
122 .Fa maxlen
123 bytes (including trailing
124 .Ql \e0 ,
125 and any trailing space suppressed).
126 If an error is encountered, i.e.\& trying to read out of said BIOS range,
127 other invalid input, or
128 .Fa buffer
129 overflow, a negative integer is returned, otherwise the
130 length of the composed string is returned.
131 In particular, a return
132 value of 0 means that none of the given anchor strings were found in
133 the specified BIOS memory range.
134 .It Fn BIOS_VADDRTOPADDR
135 Returns the effective physical address which corresponds to the kernel
136 virtual address
137 .Fa addr .
138 .It Fn BIOS_PADDRTOVADDR
139 Returns the kernel virtual address which corresponds to the effective
140 physical address
141 .Fa addr .
142 .It SMBIOStable
143 If not NULL, points to a
144 .Ft struct SMBIOS_table
145 structure containing information read from the System Management BIOS table
146 during system startup.
147 .It DMItable
148 If not NULL, points to a
149 .Ft struct DMI_table
150 structure containing information read from the Desktop Management Interface
151 parameter table during system startup.
152 .El
153 .Sh BIOS32
154 At system startup, the BIOS is scanned for the BIOS32 Service Directory
155 (part of the PCI specification), and the existence of the directory is
156 recorded.
157 This can then be used to locate other services.
158 .Bl -tag -width 20n
159 .It Fn bios32_SDlookup
160 Attempts to locate the BIOS32 service matching the 4-byte identifier
161 passed in the
162 .Fa ident
163 field of the
164 .Fa ent
165 argument.
166 .It Fn bios32
167 Calls a bios32 function.
168 This presumes that the function is capable of
169 working within the kernel segment (normally the case).
170 The virtual address
171 of the entrypoint is supplied in
172 .Fa entry
173 and the register arguments to the function are supplied in
174 .Fa args .
175 .It PCIbios
176 If not NULL, points to a
177 .Ft struct bios32_SDentry
178 structure describing the PCI BIOS entrypoint which was found during system
179 startup.
180 .El