> 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 rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"