|
|
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: /*
1.1.1.2 ! root 43: * Report reserved addresses to the biosmem module.
1.1 root 44: *
1.1.1.2 ! root 45: * Once all boot data have been registered, the user can set up the
! 46: * early page allocator.
1.1 root 47: *
1.1.1.2 ! root 48: * If the range is marked temporary, it will be unregistered when
! 49: * biosmem_free_usable() is called, so that pages that used to store
! 50: * these boot data may be released to the VM system.
! 51: */
! 52: void biosmem_register_boot_data(phys_addr_t start, phys_addr_t end,
! 53: boolean_t temporary);
! 54:
! 55: /*
! 56: * Initialize the early page allocator.
! 57: *
! 58: * This function uses the memory map provided by the boot loader along
! 59: * with the registered boot data addresses to set up a heap of free pages
! 60: * of physical memory.
! 61: *
! 62: * Note that on Xen, this function registers all the Xen boot information
! 63: * as boot data itself.
1.1 root 64: */
65: #ifdef MACH_HYP
66: void biosmem_xen_bootstrap(void);
67: #else /* MACH_HYP */
1.1.1.2 ! root 68: void biosmem_bootstrap(const struct multiboot_raw_info *mbi);
1.1 root 69: #endif /* MACH_HYP */
70:
71: /*
72: * Allocate contiguous physical pages during bootstrap.
73: *
1.1.1.2 ! root 74: * The pages returned are guaranteed to be part of the direct physical
! 75: * mapping when paging is enabled.
! 76: *
! 77: * This function should only be used to allocate initial page table pages.
! 78: * Those pages are later loaded into the VM system (as reserved pages)
! 79: * which means they can be freed like other regular pages. Users should
! 80: * fix up the type of those pages once the VM system is initialized.
1.1 root 81: */
82: unsigned long biosmem_bootalloc(unsigned int nr_pages);
83:
84: /*
1.1.1.2 ! root 85: * Return the limit of physical memory that can be directly mapped.
1.1 root 86: */
1.1.1.2 ! root 87: phys_addr_t biosmem_directmap_end(void);
1.1 root 88:
89: /*
90: * Set up physical memory based on the information obtained during bootstrap
91: * and load it in the VM system.
92: */
93: void biosmem_setup(void);
94:
95: /*
96: * Free all usable memory.
97: *
1.1.1.2 ! root 98: * This function releases all pages that aren't used by boot data and have
! 99: * not already been loaded into the VM system.
1.1 root 100: */
101: void biosmem_free_usable(void);
102:
103: #endif /* _X86_BIOSMEM_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.