diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2019-02-21 10:27:04 +0100 |
---|---|---|
committer | Philipp Deppenwiese <zaolin.daisuki@gmail.com> | 2019-07-02 08:45:50 +0000 |
commit | c1b7e8a60be9853b5b00fc70615cea2fa8bfafc5 (patch) | |
tree | bddec84d4dfa2bae068eb73fe6e85a1c2594ba58 /src/include/cpu | |
parent | c796a8f238f70a09828d5c40c23c05650803cb3c (diff) |
cpu/x86/pae/pgtbl: Add memset with PAE
To clear all DRAM on x86_32, add a new method that uses PAE to access
more than 32bit of address space.
Add Documentation as well.
Required for clearing all system memory as part of security API.
Tested on wedge100s:
Takes less than 2 seconds to clear 8GiB of DRAM.
Tested on P8H61M-Pro:
Takes less than 1 second to clear 4GiB of DRAM.
Change-Id: I00f7ecf87b5c9227a9d58a0b61eecc38007e1a57
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31549
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include/cpu')
-rw-r--r-- | src/include/cpu/x86/pae.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/include/cpu/x86/pae.h b/src/include/cpu/x86/pae.h index 7627187a52..72bae53d68 100644 --- a/src/include/cpu/x86/pae.h +++ b/src/include/cpu/x86/pae.h @@ -1,3 +1,19 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 9elements Agency GmbH + * Copyright (C) 2019 Facebook Inc. + * + * This program 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; version 2 of the License. + * + * This program 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. + */ + #ifndef CPU_X86_PAE_H #define CPU_X86_PAE_H @@ -41,4 +57,13 @@ int paging_identity_map_addr(uintptr_t base, size_t size, int pat); #define MAPPING_ERROR ((void *)0xffffffffUL) void *map_2M_page(unsigned long page); +/* To be used with memset_pae */ +#define MEMSET_PAE_VMEM_ALIGN (2 * MiB) +#define MEMSET_PAE_VMEM_SIZE (2 * MiB) +#define MEMSET_PAE_PGTL_ALIGN (4 * KiB) +#define MEMSET_PAE_PGTL_SIZE (20 * KiB) + +int memset_pae(uint64_t dest, unsigned char pat, uint64_t length, void *pgtbl, + void *vmem_addr); + #endif /* CPU_X86_PAE_H */ |