From owner-svn-src-head@freebsd.org Sun Dec 30 15:21:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF705142B66A; Sun, 30 Dec 2018 15:21:14 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61B2A8935D; Sun, 30 Dec 2018 15:21:13 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wBUFL4uJ060154; Sun, 30 Dec 2018 07:21:04 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wBUFL4ot060153; Sun, 30 Dec 2018 07:21:04 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201812301521.wBUFL4ot060153@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r342619 - head/stand/i386/libi386 In-Reply-To: <201812300935.wBU9Zlwg052665@repo.freebsd.org> To: Toomas Soome Date: Sun, 30 Dec 2018 07:21:04 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 61B2A8935D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.924,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Dec 2018 15:21:15 -0000 > Author: tsoome > Date: Sun Dec 30 09:35:47 2018 > New Revision: 342619 > URL: https://svnweb.freebsd.org/changeset/base/342619 > > Log: > loader: create bio_alloc and bio_free for bios bounce buffer > > We do have 16KB buffer space defined in pxe.c, move it to bio.c and implement > bio_alloc()/bio_free() interface to make it possible to use this space for > other BIOS calls (notably, from biosdisk.c). > > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D17131 > > Added: > head/stand/i386/libi386/bio.c (contents, props changed) > Modified: > head/stand/i386/libi386/Makefile > head/stand/i386/libi386/biosdisk.c > head/stand/i386/libi386/libi386.h > head/stand/i386/libi386/pxe.c > > Modified: head/stand/i386/libi386/Makefile > ============================================================================== > --- head/stand/i386/libi386/Makefile Sun Dec 30 09:13:38 2018 (r342618) > +++ head/stand/i386/libi386/Makefile Sun Dec 30 09:35:47 2018 (r342619) > @@ -4,7 +4,7 @@ > > LIB= i386 > > -SRCS= biosacpi.c biosdisk.c biosmem.c biospnp.c \ > +SRCS= bio.c biosacpi.c biosdisk.c biosmem.c biospnp.c \ > biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ > comconsole.c devicename.c elf32_freebsd.c \ > elf64_freebsd.c multiboot.c multiboot_tramp.S relocater_tramp.S \ > > Added: head/stand/i386/libi386/bio.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/stand/i386/libi386/bio.c Sun Dec 30 09:35:47 2018 (r342619) > @@ -0,0 +1,65 @@ > +/*- > + * 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. > + */ This file has no copyright... please correct that. > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include "libi386.h" > + > +/* > + * The idea is borrowed from pxe.c and zfsimpl.c. The original buffer > + * space in pxe.c was 2x 0x2000. Allocating it from BSS will give us needed > + * memory below 1MB and usable for real mode calls. > + * > + * Note the allocations and frees are to be done in reverse order (LIFO). > + */ > + > +static char bio_buffer[BIO_BUFFER_SIZE]; > +static char *bio_buffer_end = bio_buffer + BIO_BUFFER_SIZE; > +static char *bio_buffer_ptr = bio_buffer; > + > +void * > +bio_alloc(size_t size) > +{ > + char *ptr; > + > + ptr = bio_buffer_ptr; > + if (ptr + size > bio_buffer_end) > + return (NULL); > + bio_buffer_ptr += size; > + > + return (ptr); > +} > + > +void > +bio_free(void *ptr, size_t size) > +{ > + > + if (ptr == NULL) > + return; > + > + bio_buffer_ptr -= size; > + if (bio_buffer_ptr != ptr) > + panic("bio_alloc()/bio_free() mismatch\n"); > +} > -- Rod Grimes rgrimes@freebsd.org