1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-08-01 06:04:08 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1997 Michael Smith
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2005-11-18 10:56:28 +00:00
|
|
|
.Dd August 9, 2005
|
1997-08-01 15:17:54 +00:00
|
|
|
.Dt BIOS 9
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1997-08-01 06:04:08 +00:00
|
|
|
.Sh NAME
|
2001-07-14 19:41:16 +00:00
|
|
|
.Nm bios_sigsearch ,
|
1997-08-01 06:04:08 +00:00
|
|
|
.Nm bios32_SDlookup ,
|
2005-07-21 09:48:37 +00:00
|
|
|
.Nm bios32 ,
|
|
|
|
.Nm bios_oem_strings
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd interact with PC BIOS
|
1997-08-01 06:04:08 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-12-26 23:14:04 +00:00
|
|
|
.In sys/param.h
|
|
|
|
.In vm/vm.h
|
|
|
|
.In vm/pmap.h
|
2001-10-01 16:09:29 +00:00
|
|
|
.In machine/pc/bios.h
|
2012-02-12 18:29:56 +00:00
|
|
|
.Ft uint32_t
|
|
|
|
.Fn bios_sigsearch "uint32_t start" "u_char *sig" "int siglen" "int paralen" "int sigofs"
|
1997-08-01 06:04:08 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn bios32_SDlookup "struct bios32_SDentry *ent"
|
2001-12-26 23:14:04 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn bios32 "struct bios_regs *br" "u_int offset" "u_short segment"
|
1997-08-01 06:04:08 +00:00
|
|
|
.Fn BIOS_PADDRTOVADDR "addr"
|
|
|
|
.Fn BIOS_VADDRTOPADDR "addr"
|
2001-01-12 15:46:56 +00:00
|
|
|
.Vt extern struct bios32_SDentry PCIbios ;
|
|
|
|
.Vt extern struct SMBIOS_table SMBIOStable ;
|
|
|
|
.Vt extern struct DMI_table DMItable ;
|
2005-07-21 09:48:37 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn bios_oem_strings "struct bios_oem *oem" "u_char *buffer" "size_t maxlen"
|
|
|
|
.Bd -literal
|
|
|
|
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[];
|
|
|
|
};
|
|
|
|
.Ed
|
1997-08-01 06:04:08 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
These functions provide a general-purpose interface for dealing with
|
|
|
|
the BIOS functions and data encountered on x86 PC-architecture systems.
|
|
|
|
.Bl -tag -width 20n
|
|
|
|
.It Fn bios_sigsearch
|
|
|
|
Searches the BIOS address space for a service signature, usually an
|
2003-10-23 01:14:18 +00:00
|
|
|
uppercase ASCII sequence surrounded by underscores.
|
|
|
|
The search begins at
|
1997-08-01 06:04:08 +00:00
|
|
|
.Fa start ,
|
|
|
|
or at the beginning of the BIOS if
|
|
|
|
.Fa start
|
|
|
|
is zero.
|
|
|
|
.Fa siglen
|
|
|
|
bytes of the BIOS image and
|
|
|
|
.Fa sig
|
|
|
|
are compared at
|
|
|
|
.Fa sigofs
|
2003-10-23 01:14:18 +00:00
|
|
|
bytes offset from the current location.
|
|
|
|
If no match is found, the
|
1997-08-01 06:04:08 +00:00
|
|
|
current location is incremented by
|
|
|
|
.Fa paralen
|
2003-10-23 01:14:18 +00:00
|
|
|
bytes and the search repeated.
|
|
|
|
If the signature is found, its effective
|
|
|
|
physical address is returned.
|
|
|
|
If no signature is found, zero is returned.
|
2005-07-21 09:48:37 +00:00
|
|
|
.It Fn bios_oem_strings
|
|
|
|
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
|
|
|
|
.Fa range
|
2005-11-18 10:56:28 +00:00
|
|
|
(within
|
|
|
|
.Li 0xe0000
|
|
|
|
-
|
|
|
|
.Li 0xfffff ) ,
|
|
|
|
and a {
|
|
|
|
.Dv NULL , Li 0 , 0
|
|
|
|
} -terminated array of
|
|
|
|
.Vt bios_oem_signature
|
2005-07-21 09:48:37 +00:00
|
|
|
structures which define the
|
2005-11-18 10:56:28 +00:00
|
|
|
.Va anchor
|
2005-07-21 09:48:37 +00:00
|
|
|
string, an
|
2005-11-18 10:56:28 +00:00
|
|
|
.Va offset
|
2005-07-21 09:48:37 +00:00
|
|
|
from the beginning of the match (which may be negative), and
|
2005-11-18 10:56:28 +00:00
|
|
|
.Va totlen
|
2005-07-21 09:48:37 +00:00
|
|
|
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
|
2005-11-18 10:56:28 +00:00
|
|
|
.Vt offset
|
2005-07-21 09:48:37 +00:00
|
|
|
with unprintable characters being replaced with space, and consecutive spaces
|
2005-11-18 10:56:28 +00:00
|
|
|
being suppressed.
|
|
|
|
This composed string is stored in
|
2005-07-21 09:48:37 +00:00
|
|
|
.Fa buffer
|
|
|
|
up to the given
|
|
|
|
.Fa maxlen
|
2005-11-18 10:56:28 +00:00
|
|
|
bytes (including trailing
|
|
|
|
.Ql \e0 ,
|
2010-07-31 10:01:15 +00:00
|
|
|
and any trailing space suppressed).
|
2005-11-18 10:56:28 +00:00
|
|
|
If an error is encountered, i.e.\& trying to read out of said BIOS range,
|
2005-07-21 09:48:37 +00:00
|
|
|
other invalid input, or
|
|
|
|
.Fa buffer
|
|
|
|
overflow, a negative integer is returned, otherwise the
|
2005-11-18 10:56:28 +00:00
|
|
|
length of the composed string is returned.
|
|
|
|
In particular, a return
|
2005-07-21 09:48:37 +00:00
|
|
|
value of 0 means that none of the given anchor strings were found in
|
|
|
|
the specified BIOS memory range.
|
1997-08-01 06:04:08 +00:00
|
|
|
.It Fn BIOS_VADDRTOPADDR
|
|
|
|
Returns the effective physical address which corresponds to the kernel
|
|
|
|
virtual address
|
|
|
|
.Fa addr .
|
2005-08-09 13:55:21 +00:00
|
|
|
.It Fn BIOS_PADDRTOVADDR
|
1997-08-01 06:04:08 +00:00
|
|
|
Returns the kernel virtual address which corresponds to the effective
|
|
|
|
physical address
|
|
|
|
.Fa addr .
|
|
|
|
.It SMBIOStable
|
|
|
|
If not NULL, points to a
|
|
|
|
.Ft struct SMBIOS_table
|
2001-07-14 19:41:16 +00:00
|
|
|
structure containing information read from the System Management BIOS table
|
1997-08-01 06:04:08 +00:00
|
|
|
during system startup.
|
|
|
|
.It DMItable
|
|
|
|
If not NULL, points to a
|
|
|
|
.Ft struct DMI_table
|
|
|
|
structure containing information read from the Desktop Management Interface
|
|
|
|
parameter table during system startup.
|
|
|
|
.El
|
|
|
|
.Sh BIOS32
|
|
|
|
At system startup, the BIOS is scanned for the BIOS32 Service Directory
|
|
|
|
(part of the PCI specification), and the existence of the directory is
|
2003-10-23 01:14:18 +00:00
|
|
|
recorded.
|
|
|
|
This can then be used to locate other services.
|
1997-08-01 06:04:08 +00:00
|
|
|
.Bl -tag -width 20n
|
|
|
|
.It Fn bios32_SDlookup
|
|
|
|
Attempts to locate the BIOS32 service matching the 4-byte identifier
|
|
|
|
passed in the
|
|
|
|
.Fa ident
|
|
|
|
field of the
|
|
|
|
.Fa ent
|
|
|
|
argument.
|
|
|
|
.It Fn bios32
|
2003-10-23 01:14:18 +00:00
|
|
|
Calls a bios32 function.
|
|
|
|
This presumes that the function is capable of
|
|
|
|
working within the kernel segment (normally the case).
|
|
|
|
The virtual address
|
1997-08-01 06:04:08 +00:00
|
|
|
of the entrypoint is supplied in
|
|
|
|
.Fa entry
|
|
|
|
and the register arguments to the function are supplied in
|
|
|
|
.Fa args .
|
|
|
|
.It PCIbios
|
|
|
|
If not NULL, points to a
|
|
|
|
.Ft struct bios32_SDentry
|
|
|
|
structure describing the PCI BIOS entrypoint which was found during system
|
|
|
|
startup.
|
|
|
|
.El
|