/*-1* Copyright (c) 2013 The FreeBSD Foundation2*3* This software was developed by Benno Rice under sponsorship from4* the FreeBSD Foundation.5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627#ifndef _LOADER_EFI_COPY_H_28#define _LOADER_EFI_COPY_H_2930#include <stand.h>31#include <readin.h>32#include <efi.h>3334#if defined(__amd64__) || defined(__i386__)35enum {36COPY_STAGING_ENABLE,37COPY_STAGING_DISABLE,38COPY_STAGING_AUTO,39};40extern int copy_staging;41#endif4243/* Useful for various calculations */44#define M(x) ((x) * 1024 * 1024)45#define G(x) (1ULL * (x) * 1024 * 1024 * 1024)4647extern EFI_LOADED_IMAGE *boot_img;4849int efi_autoload(void);5051int efi_copy_init(void);5253ssize_t efi_copyin(const void *src, vm_offset_t dest, const size_t len);54ssize_t efi_copyout(const vm_offset_t src, void *dest, const size_t len);55ssize_t efi_readin(readin_handle_t fd, vm_offset_t dest, const size_t len);56void * efi_translate(vm_offset_t ptr);5758void efi_copy_finish(void);59void efi_copy_finish_nop(void);6061#if defined(__amd64__) || defined(__i386__)62/* Need this to setup page tables */63extern EFI_PHYSICAL_ADDRESS staging;64#endif6566int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,67bool exit_bs);6869#endif /* _LOADER_EFI_COPY_H_ */707172