From fda9d75d90dfb8b5a441eea9d108e6f075087dc0 Mon Sep 17 00:00:00 2001 From: Krystian Hebel Date: Wed, 8 May 2024 16:17:00 +0200 Subject: cpu/x86/pae/pgtbl.c: extract reusable code from memset_pae() Code dealing with PAE can be used outside of memset_pae(). This change extracts creation of identity mapped pagetables to init_pae_pagetables() and mapping of single 2 MiB map to pae_map_2M_page(). Both functions are exported in include/cpu/x86/pae.h to allow use outside of pgtbl.c. MEMSET_PAE_* macros were renamed to PAE_* since they no longer apply only to memset_pae(). Change-Id: I8aa80eb246ff0e77e1f51d71933d3d00ab75aaeb Signed-off-by: Krystian Hebel Reviewed-on: https://review.coreboot.org/c/coreboot/+/82249 Reviewed-by: Sergii Dmytruk Tested-by: build bot (Jenkins) --- src/include/cpu/x86/pae.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/include/cpu') diff --git a/src/include/cpu/x86/pae.h b/src/include/cpu/x86/pae.h index d1cf7347c2..e4b0a2c4c9 100644 --- a/src/include/cpu/x86/pae.h +++ b/src/include/cpu/x86/pae.h @@ -35,11 +35,15 @@ void paging_set_default_pat(void); * failure. */ int paging_enable_for_car(const char *pdpt_name, const char *pt_name); -/* 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) +/* To be used with memset_pae and pae_map_2M_page */ +#define PAE_VMEM_ALIGN (2 * MiB) +#define PAE_VMEM_SIZE (2 * MiB) +#define PAE_PGTL_ALIGN (4 * KiB) +#define PAE_PGTL_SIZE (20 * KiB) + +int init_pae_pagetables(void *pgtbl); + +void pae_map_2M_page(void *pgtbl, uint64_t paddr, void *vmem_addr); int memset_pae(uint64_t dest, unsigned char pat, uint64_t length, void *pgtbl, void *vmem_addr); -- cgit v1.2.3