Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2007 08:56:06 +0200 (CEST)
From:      Adrian Steinmann <ast@webgroup.ch>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/115918: missing bios_oem_strings(9) documentation [PATCH]
Message-ID:  <200708290656.l7T6u6Vp025509@pano.marabu.ch>
Resent-Message-ID: <200708290710.l7T7A13W063784@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         115918
>Category:       i386
>Synopsis:       missing bios_oem_strings(9) documentation [PATCH]
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 29 07:10:00 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Adrian Steinmann
>Release:        FreeBSD 6.2-RELEASE-p7 i386
>Organization:
>Environment:
System: FreeBSD pano.marabu.ch 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #6: Sun Aug 5 22:11:16 CEST 2007 root@pano.marabu.ch:/r/pan/obj/r/pan/src/sys/T40 i386


	
>Description:
	http://www.freebsd.org/cgi/query-pr.cgi?pr=81360 was commited without documentation of new bios_oem_strings() routine in i386/i386/bios.c
        
>How-To-Repeat:
	NA
>Fix:
	commit the attached patch

--- usr/src/share/man/man9/bios.9	23 Oct 2003 01:14:18 -0000	1.13
+++ usr/src/share/man/man9/bios.9	16 Jul 2005 08:45:43 -0000
@@ -30,7 +30,8 @@
 .Sh NAME
 .Nm bios_sigsearch ,
 .Nm bios32_SDlookup ,
-.Nm bios32
+.Nm bios32 ,
+.Nm bios_oem_strings
 .Nd interact with PC BIOS
 .Sh SYNOPSIS
 .In sys/param.h
@@ -50,6 +51,23 @@
 .Vt extern struct bios32_SDentry PCIbios ;
 .Vt extern struct SMBIOS_table SMBIOStable ;
 .Vt extern struct DMI_table DMItable ;
+.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
 .Sh DESCRIPTION
 These functions provide a general-purpose interface for dealing with
 the BIOS functions and data encountered on x86 PC-architecture systems.
@@ -75,6 +93,36 @@
 If the signature is found, its effective
 physical address is returned.
 If no signature is found, zero is returned.
+.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
+(within 0xe0000 - 0xfffff), and a { NULL, 0, 0 } -terminated array of
+.Fa bios_oem_signature
+structures which define the
+.Fa anchor
+string, an
+.Fa offset
+from the beginning of the match (which may be negative), and
+.Fa totlen
+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
+.Fa offset
+with unprintable characters being replaced with space, and consecutive spaces
+being suppressed. This composed string is stored in
+.Fa buffer
+up to the given
+.Fa maxlen
+bytes (including trailing '\\0', and any trailing space surpressed).
+If an error is encountered, i.e. trying to read out of said BIOS range,
+other invalid input, or
+.Fa buffer
+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.
 .It Fn BIOS_VADDRTOPADDR
 Returns the effective physical address which corresponds to the kernel
 virtual address
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708290656.l7T6u6Vp025509>