/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 1997 Michael Smith4* Copyright (c) 1998 Jonathan Lemon5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _MACHINE_PC_BIOS_H_30#define _MACHINE_PC_BIOS_H_3132/*33* Int 15:E820 'SMAP' structure34*/35#define SMAP_SIG 0x534D4150 /* 'SMAP' */3637#define SMAP_TYPE_MEMORY 138#define SMAP_TYPE_RESERVED 239#define SMAP_TYPE_ACPI_RECLAIM 340#define SMAP_TYPE_ACPI_NVS 441#define SMAP_TYPE_ACPI_ERROR 542#define SMAP_TYPE_DISABLED 643#define SMAP_TYPE_PMEM 744#define SMAP_TYPE_PRAM 124546#define SMAP_XATTR_ENABLED 0x0000000147#define SMAP_XATTR_NON_VOLATILE 0x0000000248#define SMAP_XATTR_MASK (SMAP_XATTR_ENABLED | SMAP_XATTR_NON_VOLATILE)4950struct bios_smap {51u_int64_t base;52u_int64_t length;53u_int32_t type;54} __packed;5556/* Structure extended to include extended attribute field in ACPI 3.0. */57struct bios_smap_xattr {58u_int64_t base;59u_int64_t length;60u_int32_t type;61u_int32_t xattr;62} __packed;6364#ifdef _KERNEL65#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE)66#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE)6768struct bios_oem_signature {69char * anchor; /* search anchor string in BIOS memory */70size_t offset; /* offset from anchor (may be negative) */71size_t totlen; /* total length of BIOS string to copy */72} __packed;7374struct bios_oem_range {75u_int from; /* shouldn't be below 0xe0000 */76u_int to; /* shouldn't be above 0xfffff */77} __packed;7879struct bios_oem {80struct bios_oem_range range;81struct bios_oem_signature signature[];82} __packed;8384int bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen);85uint32_t bios_sigsearch(uint32_t start, u_char *sig, int siglen, int paralen,86int sigofs);87void bios_add_smap_entries(struct bios_smap *smapbase, u_int32_t smapsize,88vm_paddr_t *physmap, int *physmap_idx);89#endif9091#endif /* _MACHINE_PC_BIOS_H_ */929394