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 <krystian.hebel@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82249
Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Krystian Hebel 2024-05-08 16:17:00 +02:00 committed by Felix Held
commit fda9d75d90
3 changed files with 115 additions and 50 deletions

View file

@ -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);