efiemu: Handle persistent RAM and unknown possible future additions.
This commit is contained in:
parent
dab148891e
commit
ae3b83a4d4
1 changed files with 22 additions and 3 deletions
|
@ -99,7 +99,8 @@ grub_efiemu_request_memalign (grub_size_t align, grub_size_t size,
|
||||||
grub_size_t align_overhead;
|
grub_size_t align_overhead;
|
||||||
struct grub_efiemu_memrequest *ret, *cur, *prev;
|
struct grub_efiemu_memrequest *ret, *cur, *prev;
|
||||||
/* Check that the request is correct */
|
/* Check that the request is correct */
|
||||||
if (type >= GRUB_EFI_MAX_MEMORY_TYPE || type <= GRUB_EFI_LOADER_CODE)
|
if (type <= GRUB_EFI_LOADER_CODE || type == GRUB_EFI_PERSISTENT_MEMORY ||
|
||||||
|
type >= GRUB_EFI_MAX_MEMORY_TYPE)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
/* Add new size to requested size */
|
/* Add new size to requested size */
|
||||||
|
@ -166,6 +167,13 @@ efiemu_alloc_requests (void)
|
||||||
GRUB_EFI_MEMORY_MAPPED_IO,
|
GRUB_EFI_MEMORY_MAPPED_IO,
|
||||||
GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE,
|
GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE,
|
||||||
GRUB_EFI_PAL_CODE
|
GRUB_EFI_PAL_CODE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These are not allocatable:
|
||||||
|
* GRUB_EFI_RESERVED_MEMORY_TYPE
|
||||||
|
* GRUB_EFI_PERSISTENT_MEMORY
|
||||||
|
* >= GRUB_EFI_MAX_MEMORY_TYPE
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Compute total memory needed */
|
/* Compute total memory needed */
|
||||||
|
@ -402,6 +410,10 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
|
||||||
return grub_efiemu_add_to_mmap (addr, size,
|
return grub_efiemu_add_to_mmap (addr, size,
|
||||||
GRUB_EFI_ACPI_MEMORY_NVS);
|
GRUB_EFI_ACPI_MEMORY_NVS);
|
||||||
|
|
||||||
|
case GRUB_MEMORY_PRAM:
|
||||||
|
case GRUB_MEMORY_PMEM:
|
||||||
|
return grub_efiemu_add_to_mmap (addr, size,
|
||||||
|
GRUB_EFI_PERSISTENT_MEMORY);
|
||||||
default:
|
default:
|
||||||
grub_dprintf ("efiemu",
|
grub_dprintf ("efiemu",
|
||||||
"Unknown memory type %d. Assuming unusable\n", type);
|
"Unknown memory type %d. Assuming unusable\n", type);
|
||||||
|
@ -445,7 +457,7 @@ grub_efiemu_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
||||||
case GRUB_EFI_MEMORY_MAPPED_IO:
|
case GRUB_EFI_MEMORY_MAPPED_IO:
|
||||||
case GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE:
|
case GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE:
|
||||||
case GRUB_EFI_PAL_CODE:
|
case GRUB_EFI_PAL_CODE:
|
||||||
case GRUB_EFI_MAX_MEMORY_TYPE:
|
default:
|
||||||
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
||||||
GRUB_MEMORY_RESERVED, hook_data);
|
GRUB_MEMORY_RESERVED, hook_data);
|
||||||
break;
|
break;
|
||||||
|
@ -468,6 +480,12 @@ grub_efiemu_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
||||||
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
||||||
GRUB_MEMORY_NVS, hook_data);
|
GRUB_MEMORY_NVS, hook_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GRUB_EFI_PERSISTENT_MEMORY:
|
||||||
|
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
||||||
|
GRUB_MEMORY_PMEM, hook_data);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -503,7 +521,8 @@ grub_efiemu_mmap_sort_and_uniq (void)
|
||||||
[GRUB_EFI_ACPI_MEMORY_NVS] = 3,
|
[GRUB_EFI_ACPI_MEMORY_NVS] = 3,
|
||||||
[GRUB_EFI_MEMORY_MAPPED_IO] = 4,
|
[GRUB_EFI_MEMORY_MAPPED_IO] = 4,
|
||||||
[GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE] = 4,
|
[GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE] = 4,
|
||||||
[GRUB_EFI_PAL_CODE] = 4
|
[GRUB_EFI_PAL_CODE] = 4,
|
||||||
|
[GRUB_EFI_PERSISTENT_MEMORY] = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
int i, j, k, done;
|
int i, j, k, done;
|
||||||
|
|
Loading…
Reference in a new issue