From ast@marabu.ch  Wed Aug 29 07:00:05 2007
Return-Path: <ast@marabu.ch>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C801E16A417
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 29 Aug 2007 07:00:05 +0000 (UTC)
	(envelope-from ast@marabu.ch)
Received: from oneplusone.ch (unknown [IPv6:2001:8a8:24::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 45A1D13C47E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 29 Aug 2007 07:00:04 +0000 (UTC)
	(envelope-from ast@marabu.ch)
Received: from oneplusone.ch (localhost [127.0.0.1])
	by oneplusone.ch (8.13.8/8.13.8) with ESMTP id l7T7035k025478
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 29 Aug 2007 09:00:03 +0200 (CEST)
	(envelope-from ast@marabu.ch)
Received: (from uucp@localhost)
	by oneplusone.ch (8.13.8/8.13.8/Submit) with UUCP id l7T703jM025477
	for FreeBSD-gnats-submit@freebsd.org; Wed, 29 Aug 2007 09:00:03 +0200 (CEST)
	(envelope-from ast@marabu.ch)
Received: from pano.marabu.ch (localhost [127.0.0.1])
	by pano.marabu.ch (8.13.8/8.13.8) with ESMTP id l7T6u6NB025510
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 29 Aug 2007 08:56:06 +0200 (CEST)
	(envelope-from ast@pano.marabu.ch)
Received: (from ast@localhost)
	by pano.marabu.ch (8.13.8/8.13.8/Submit) id l7T6u6Vp025509;
	Wed, 29 Aug 2007 08:56:06 +0200 (CEST)
	(envelope-from ast)
Message-Id: <200708290656.l7T6u6Vp025509@pano.marabu.ch>
Date: Wed, 29 Aug 2007 08:56:06 +0200 (CEST)
From: Adrian Steinmann <ast@webgroup.ch>
Reply-To: Adrian Steinmann <ast@webgroup.ch>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: missing bios_oem_strings(9) documentation [PATCH]
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         115918
>Category:       docs
>Synopsis:       [PATCH]: missing bios_oem_strings(9) documentation
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 29 07:10:00 GMT 2007
>Closed-Date:    Wed Jan 23 07:24:12 UTC 2008
>Last-Modified:  Wed Jan 23 07:24:12 UTC 2008
>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:
Responsible-Changed-From-To: freebsd-i386->freebsd-docs 
Responsible-Changed-By: remko 
Responsible-Changed-When: Thu Aug 30 11:33:22 UTC 2007 
Responsible-Changed-Why:  
Reassign to doc team 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115918 
Responsible-Changed-From-To: freebsd-docs->freebsd-doc 
Responsible-Changed-By: remko 
Responsible-Changed-When: Wed Nov 28 19:14:33 UTC 2007 
Responsible-Changed-Why:  
This should have been -doc. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115918 
State-Changed-From-To: open->closed 
State-Changed-By: trhodes 
State-Changed-When: Wed Jan 23 07:22:44 UTC 2008 
State-Changed-Why:  
Review of the bios.9 manual page indicates that this patch was already applied. 
Thanks for the submission! 


Responsible-Changed-From-To: freebsd-doc->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Wed Jan 23 07:22:44 UTC 2008 
Responsible-Changed-Why:  
Over to me as closer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115918 
>Unformatted:
