3 .\" Copyright (c) 1997 Michael Smith
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
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
35 .Nd interact with PC BIOS
44 .Fn bios_sigsearch "u_int32_t start" "u_char *sig" "int siglen" "int paralen" "int sigofs"
46 .Fn bios32_SDlookup "struct bios32_SDentry *ent"
48 .Fn bios32 "struct bios_regs *br" "u_int offset" "u_short segment"
49 .Fn BIOS_PADDRTOVADDR "addr"
50 .Fn BIOS_VADDRTOPADDR "addr"
51 .Vt extern struct bios32_SDentry PCIbios ;
52 .Vt extern struct SMBIOS_table SMBIOStable ;
53 .Vt extern struct DMI_table DMItable ;
55 .Fn bios_oem_strings "struct bios_oem *oem" "u_char *buffer" "size_t maxlen"
57 struct bios_oem_signature {
58 char * anchor; /* search anchor string in BIOS memory */
59 size_t offset; /* offset from anchor (may be negative) */
60 size_t totlen; /* total length of BIOS string to copy */
62 struct bios_oem_range {
63 u_int from; /* shouldn't be below 0xe0000 */
64 u_int to; /* shouldn't be above 0xfffff */
67 struct bios_oem_range range;
68 struct bios_oem_signature signature[];
72 These functions provide a general-purpose interface for dealing with
73 the BIOS functions and data encountered on x86 PC-architecture systems.
76 Searches the BIOS address space for a service signature, usually an
77 uppercase ASCII sequence surrounded by underscores.
80 or at the beginning of the BIOS if
84 bytes of the BIOS image and
88 bytes offset from the current location.
89 If no match is found, the
90 current location is incremented by
92 bytes and the search repeated.
93 If the signature is found, its effective
94 physical address is returned.
95 If no signature is found, zero is returned.
96 .It Fn bios_oem_strings
97 Searches a given BIOS memory range for one or more strings,
98 and composes a printable concatenation of those found.
99 The routine expects a structure describing the BIOS address
101 (within 0xe0000 - 0xfffff), and a { NULL, 0, 0 } -terminated array of
102 .Fa bios_oem_signature
103 structures which define the
107 from the beginning of the match (which may be negative), and
109 number of bytes to be collected from BIOS memory starting at that offset.
110 Unmatched anchors are ignored, whereas matches are copied from BIOS memory
111 starting at their corresponding
113 with unprintable characters being replaced with space, and consecutive spaces
114 being suppressed. This composed string is stored in
118 bytes (including trailing '\\0', and any trailing space surpressed).
119 If an error is encountered, i.e. trying to read out of said BIOS range,
120 other invalid input, or
122 overflow, a negative integer is returned, otherwise the
123 length of the composed string is returned. In particular, a return
124 value of 0 means that none of the given anchor strings were found in
125 the specified BIOS memory range.
126 .It Fn BIOS_VADDRTOPADDR
127 Returns the effective physical address which corresponds to the kernel
130 .It Fn BIOS_PADDRTOVADDR
131 Returns the kernel virtual address which corresponds to the effective
135 If not NULL, points to a
136 .Ft struct SMBIOS_table
137 structure containing information read from the System Management BIOS table
138 during system startup.
140 If not NULL, points to a
142 structure containing information read from the Desktop Management Interface
143 parameter table during system startup.
146 At system startup, the BIOS is scanned for the BIOS32 Service Directory
147 (part of the PCI specification), and the existence of the directory is
149 This can then be used to locate other services.
151 .It Fn bios32_SDlookup
152 Attempts to locate the BIOS32 service matching the 4-byte identifier
159 Calls a bios32 function.
160 This presumes that the function is capable of
161 working within the kernel segment (normally the case).
163 of the entrypoint is supplied in
165 and the register arguments to the function are supplied in
168 If not NULL, points to a
169 .Ft struct bios32_SDentry
170 structure describing the PCI BIOS entrypoint which was found during system