From owner-freebsd-i386@FreeBSD.ORG Wed Aug 29 07:10:01 2007 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B16C116A46C for ; Wed, 29 Aug 2007 07:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8FEC613C459 for ; Wed, 29 Aug 2007 07:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l7T7A1BZ063785 for ; Wed, 29 Aug 2007 07:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l7T7A13W063784; Wed, 29 Aug 2007 07:10:01 GMT (envelope-from gnats) Resent-Date: Wed, 29 Aug 2007 07:10:01 GMT Resent-Message-Id: <200708290710.l7T7A13W063784@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Adrian Steinmann Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C801E16A417 for ; 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 ; 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 ; 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 ; 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 To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: i386/115918: missing bios_oem_strings(9) documentation [PATCH] X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Adrian Steinmann List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2007 07:10:01 -0000 >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: