coreboot/src/include/cpu/x86
Subrata Banik 5f941893ef cpu/x86/mtrr: Introduce mtrrlib with common MTRR helper functions
This change refactors MTRR handling by consolidating helper functions
from `earlymtrr.c` and `mtrr.c` into a new MTRR library (`mtrrlib`).
This approach improves code modularity and reusability, making these
utilities consistently available across different coreboot boot phases.

The following functions are now part of `mtrrlib`:

- `get_free_var_mtrr`: Retrieves the index of the first available
  variable MTRR.
- `set_var_mtrr`: Configures the variable MTRR, specified by an `index`,
  for a memory region defined by `base`, `size`, and `type`.
- `clear_var_mtrr`: Disables the variable MTRR at a given index.
- `acquire_and_configure_mtrr`: Acquires a free variable MTRR, configures
   it with the given `base`, `size`, and `type`.

BUG=b:409718202
TEST=Built and booted google/fatcat successfully.

Change-Id: Iba332b7088221fd930e973fad9410833bff184b9
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87539
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
2025-05-08 16:51:17 +00:00
..
bist.h include: Add SPDX identifiers to files missing them 2022-08-11 17:53:11 +00:00
cache.h include/cpu/x86: Simplify en/dis cache functions 2023-06-02 01:51:09 +00:00
cr.h arch/x86: Use ENV_X86_64 instead of _x86_64_ 2021-07-06 06:09:13 +00:00
gdt.h arch/x86: Unify GDT entries 2025-05-08 12:29:24 +00:00
lapic.h cpu/x86/lapic: Always have LAPIC enabled 2024-08-11 17:06:41 +00:00
lapic_def.h cpu/x86: Replace LAPIC_DM_* with LAPIC_MT_* 2025-04-05 14:38:22 +00:00
legacy_save_state.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
mp.h drivers/ipmi to lib: Fix misspellings & capitalization issues 2023-12-13 10:42:30 +00:00
msr.h include/cpu/x86: Add Misc Enable and Thermal Interrupt Register Macro 2024-09-04 04:38:43 +00:00
msr_access.h include/cpu/msr.h: transform into an union 2022-11-12 14:23:35 +00:00
mtrr.h cpu/x86/mtrr: Introduce mtrrlib with common MTRR helper functions 2025-05-08 16:51:17 +00:00
name.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
pae.h cpu/x86/pae/pgtbl.c: extract reusable code from memset_pae() 2024-05-29 13:04:30 +00:00
post_code.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
save_state.h src/acpi to src/lib: Fix spelling errors 2021-10-05 18:06:39 +00:00
smm.h region: Introduce region_create() functions 2024-08-11 17:07:32 +00:00
topology.h cpu/x86/topology: Simplify CPU topology initialization 2024-12-17 17:24:15 +00:00
tsc.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00