|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2010-2014 Richard Braun. ! 3: * ! 4: * This program is free software: you can redistribute it and/or modify ! 5: * it under the terms of the GNU General Public License as published by ! 6: * the Free Software Foundation, either version 2 of the License, or ! 7: * (at your option) any later version. ! 8: * ! 9: * This program is distributed in the hope that it will be useful, ! 10: * but WITHOUT ANY WARRANTY; without even the implied warranty of ! 11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 12: * GNU General Public License for more details. ! 13: * ! 14: * You should have received a copy of the GNU General Public License ! 15: * along with this program. If not, see <http://www.gnu.org/licenses/>. ! 16: */ ! 17: ! 18: #ifndef _X86_BIOSMEM_H ! 19: #define _X86_BIOSMEM_H ! 20: ! 21: #include <mach/machine/vm_types.h> ! 22: #include <mach/machine/multiboot.h> ! 23: ! 24: /* ! 25: * Address where the address of the Extended BIOS Data Area segment can be ! 26: * found. ! 27: */ ! 28: #define BIOSMEM_EBDA_PTR 0x40e ! 29: ! 30: /* ! 31: * Significant low memory addresses. ! 32: * ! 33: * The first 64 KiB are reserved for various reasons (e.g. to preserve BIOS ! 34: * data and to work around data corruption on some hardware). ! 35: */ ! 36: #define BIOSMEM_BASE 0x010000 ! 37: #define BIOSMEM_BASE_END 0x0a0000 ! 38: #define BIOSMEM_EXT_ROM 0x0e0000 ! 39: #define BIOSMEM_ROM 0x0f0000 ! 40: #define BIOSMEM_END 0x100000 ! 41: ! 42: /* ! 43: * Early initialization of the biosmem module. ! 44: * ! 45: * This function processes the given multiboot data for BIOS-provided ! 46: * memory information, and sets up a bootstrap physical page allocator. ! 47: * ! 48: * It is called before paging is enabled. ! 49: */ ! 50: #ifdef MACH_HYP ! 51: void biosmem_xen_bootstrap(void); ! 52: #else /* MACH_HYP */ ! 53: void biosmem_bootstrap(struct multiboot_raw_info *mbi); ! 54: #endif /* MACH_HYP */ ! 55: ! 56: /* ! 57: * Allocate contiguous physical pages during bootstrap. ! 58: * ! 59: * This function is called before paging is enabled. It should only be used ! 60: * to allocate initial page table pages. Those pages are later loaded into ! 61: * the VM system (as reserved pages) which means they can be freed like other ! 62: * regular pages. Users should fix up the type of those pages once the VM ! 63: * system is initialized. ! 64: */ ! 65: unsigned long biosmem_bootalloc(unsigned int nr_pages); ! 66: ! 67: /* ! 68: * Return the amount of physical memory that can be directly mapped. ! 69: * ! 70: * This includes the size of both the DMA/DMA32 and DIRECTMAP segments. ! 71: */ ! 72: phys_addr_t biosmem_directmap_size(void); ! 73: ! 74: /* ! 75: * Set up physical memory based on the information obtained during bootstrap ! 76: * and load it in the VM system. ! 77: */ ! 78: void biosmem_setup(void); ! 79: ! 80: /* ! 81: * Free all usable memory. ! 82: * ! 83: * This includes ranges that weren't part of the bootstrap allocator initial ! 84: * heap, e.g. because they contained boot data. ! 85: */ ! 86: void biosmem_free_usable(void); ! 87: ! 88: #endif /* _X86_BIOSMEM_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.