88 lines
2.8 KiB
C
88 lines
2.8 KiB
C
/* memory.h - describe the memory map */
|
|
/*
|
|
* VAS_EBOOT -- GRand Unified Bootloader
|
|
* Copyright (C) 2002,2007,2008 Free Software Foundation, Inc.
|
|
*
|
|
* VAS_EBOOT is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* VAS_EBOOT is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef VAS_EBOOT_MEMORY_HEADER
|
|
#define VAS_EBOOT_MEMORY_HEADER 1
|
|
|
|
#include <VasEBoot/types.h>
|
|
#include <VasEBoot/err.h>
|
|
|
|
typedef enum VasEBoot_memory_type
|
|
{
|
|
VAS_EBOOT_MEMORY_AVAILABLE = 1,
|
|
VAS_EBOOT_MEMORY_RESERVED = 2,
|
|
VAS_EBOOT_MEMORY_ACPI = 3,
|
|
VAS_EBOOT_MEMORY_NVS = 4,
|
|
VAS_EBOOT_MEMORY_BADRAM = 5,
|
|
VAS_EBOOT_MEMORY_PERSISTENT = 7,
|
|
VAS_EBOOT_MEMORY_PERSISTENT_LEGACY = 12,
|
|
VAS_EBOOT_MEMORY_COREBOOT_TABLES = 16,
|
|
VAS_EBOOT_MEMORY_CODE = 20,
|
|
/* This one is special: it's used internally but is never reported
|
|
by firmware. Don't use -1 as it's used internally for other purposes. */
|
|
VAS_EBOOT_MEMORY_HOLE = -2,
|
|
VAS_EBOOT_MEMORY_MAX = 0x10000
|
|
} VasEBoot_memory_type_t;
|
|
|
|
typedef int (*VasEBoot_memory_hook_t) (VasEBoot_uint64_t,
|
|
VasEBoot_uint64_t,
|
|
VasEBoot_memory_type_t,
|
|
void *);
|
|
|
|
VasEBoot_err_t VasEBoot_mmap_iterate (VasEBoot_memory_hook_t hook, void *hook_data);
|
|
|
|
#ifdef VAS_EBOOT_MACHINE_EFI
|
|
VasEBoot_err_t
|
|
VasEBoot_efi_mmap_iterate (VasEBoot_memory_hook_t hook, void *hook_data,
|
|
int avoid_efi_boot_services);
|
|
#endif
|
|
|
|
#if !defined (VAS_EBOOT_MACHINE_EMU) && !defined (VAS_EBOOT_MACHINE_EFI)
|
|
VasEBoot_err_t EXPORT_FUNC(VasEBoot_machine_mmap_iterate) (VasEBoot_memory_hook_t hook,
|
|
void *hook_data);
|
|
#else
|
|
VasEBoot_err_t VasEBoot_machine_mmap_iterate (VasEBoot_memory_hook_t hook,
|
|
void *hook_data);
|
|
#endif
|
|
|
|
int VasEBoot_mmap_register (VasEBoot_uint64_t start, VasEBoot_uint64_t size, int type);
|
|
VasEBoot_err_t VasEBoot_mmap_unregister (int handle);
|
|
|
|
void *VasEBoot_mmap_malign_and_register (VasEBoot_uint64_t align, VasEBoot_uint64_t size,
|
|
int *handle, int type, int flags);
|
|
|
|
void VasEBoot_mmap_free_and_unregister (int handle);
|
|
|
|
#ifndef VAS_EBOOT_MMAP_REGISTER_BY_FIRMWARE
|
|
|
|
struct VasEBoot_mmap_region
|
|
{
|
|
struct VasEBoot_mmap_region *next;
|
|
VasEBoot_uint64_t start;
|
|
VasEBoot_uint64_t end;
|
|
VasEBoot_memory_type_t type;
|
|
int handle;
|
|
int priority;
|
|
};
|
|
|
|
extern struct VasEBoot_mmap_region *VasEBoot_mmap_overlays;
|
|
#endif
|
|
|
|
#endif /* ! VAS_EBOOT_MEMORY_HEADER */
|