19b1aa8d6SNeel Natu /*- 24d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3ce80faa4SMarcelo Araujo * 49b1aa8d6SNeel Natu * Copyright (c) 2015 Neel Natu <neel@freebsd.org> 59b1aa8d6SNeel Natu * All rights reserved. 69b1aa8d6SNeel Natu * 79b1aa8d6SNeel Natu * Redistribution and use in source and binary forms, with or without 89b1aa8d6SNeel Natu * modification, are permitted provided that the following conditions 99b1aa8d6SNeel Natu * are met: 109b1aa8d6SNeel Natu * 1. Redistributions of source code must retain the above copyright 119b1aa8d6SNeel Natu * notice, this list of conditions and the following disclaimer. 129b1aa8d6SNeel Natu * 2. Redistributions in binary form must reproduce the above copyright 139b1aa8d6SNeel Natu * notice, this list of conditions and the following disclaimer in the 149b1aa8d6SNeel Natu * documentation and/or other materials provided with the distribution. 159b1aa8d6SNeel Natu * 169b1aa8d6SNeel Natu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 179b1aa8d6SNeel Natu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189b1aa8d6SNeel Natu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199b1aa8d6SNeel Natu * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 209b1aa8d6SNeel Natu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219b1aa8d6SNeel Natu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229b1aa8d6SNeel Natu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239b1aa8d6SNeel Natu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249b1aa8d6SNeel Natu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259b1aa8d6SNeel Natu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269b1aa8d6SNeel Natu * SUCH DAMAGE. 279b1aa8d6SNeel Natu */ 289b1aa8d6SNeel Natu 299b1aa8d6SNeel Natu #ifndef _BOOTROM_H_ 309b1aa8d6SNeel Natu #define _BOOTROM_H_ 319b1aa8d6SNeel Natu 329b1aa8d6SNeel Natu #include <stdbool.h> 33bb30b08eSConrad Meyer #include <stddef.h> 34bb30b08eSConrad Meyer #include <stdint.h> 35bb30b08eSConrad Meyer #include <limits.h> 369b1aa8d6SNeel Natu 3787f6367fSCorvin Köhne #include "config.h" 3887f6367fSCorvin Köhne 399b1aa8d6SNeel Natu struct vmctx; 409b1aa8d6SNeel Natu 41bb30b08eSConrad Meyer void init_bootrom(struct vmctx *ctx); 42bb30b08eSConrad Meyer enum { 43bb30b08eSConrad Meyer BOOTROM_ALLOC_TOP = 0x80, 44bb30b08eSConrad Meyer _FORCE_INT = INT_MIN, 45bb30b08eSConrad Meyer }; 46bb30b08eSConrad Meyer int bootrom_alloc(struct vmctx *ctx, size_t len, int prot, int flags, 47bb30b08eSConrad Meyer char **region_out, uint64_t *gpa_out); 48*43caa2e8SMark Johnston bool bootrom_boot(void); 49*43caa2e8SMark Johnston int bootrom_loadrom(struct vmctx *ctx); 509b1aa8d6SNeel Natu 519b1aa8d6SNeel Natu #endif 52