github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/bootstrap/e820.h (about) 1 /* 2 * e820.h: support functions for manipulating the e820 table 3 * 4 * Copyright (c) 2006-2009, Intel Corporation 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above 14 * copyright notice, this list of conditions and the following 15 * disclaimer in the documentation and/or other materials provided 16 * with the distribution. 17 * * Neither the name of the Intel Corporation nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 32 * OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 */ 35 36 #ifndef __E820_H__ 37 #define __E820_H__ 38 39 #include "multiboot.h" 40 41 #ifndef E820_RAM 42 #define E820_RAM 1 43 #endif 44 45 #ifndef E820_RESERVED 46 #define E820_RESERVED 2 47 #endif 48 49 #ifndef E820_ACPI 50 #define E820_ACPI 3 51 #endif 52 53 #ifndef E820_NVS 54 #define E820_NVS 4 55 #endif 56 57 #ifndef E820_UNUSABLE 58 #define E820_UNUSABLE 5 59 #endif 60 61 /* these are only used by e820_check_region() */ 62 #define E820_MIXED ((uint32_t)-1 - 1) 63 #define E820_GAP ((uint32_t)-1) 64 65 #define E820MAX 128 66 67 typedef struct __packed { 68 uint64_t addr; /* start of memory segment */ 69 uint64_t size; /* size of memory segment */ 70 uint32_t type; /* type of memory segment */ 71 } e820entry_t; 72 73 extern bool copy_e820_map(const multiboot_info_t *mbi); 74 extern bool e820_protect_region(uint64_t addr, uint64_t size, uint32_t type); 75 extern bool e820_reserve_ram(uint64_t base, uint64_t length); 76 extern void print_e820_map(void); 77 extern void replace_e820_map(multiboot_info_t *mbi); 78 extern uint32_t e820_check_region(uint64_t base, uint64_t length); 79 extern bool get_ram_ranges(uint64_t *min_lo_ram, uint64_t *max_lo_ram, 80 uint64_t *min_hi_ram, uint64_t *max_hi_ram); 81 extern void get_highest_sized_ram(uint64_t size, uint64_t limit, 82 uint64_t *ram_base, uint64_t *ram_size); 83 extern void print_map(memory_map_t *e820, int nr_map); 84 #endif /* __E820_H__ */ 85 86