x86: Allow adding non-aligned size for MTRR
authorSimon Glass <sjg@chromium.org>
Sat, 15 Mar 2025 14:25:46 +0000 (14:25 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 3 Apr 2025 17:41:55 +0000 (11:41 -0600)
commit66c9ade35b520510856511ed388aee138c5eb388
tree1698498e4d017dfcc631c3175bc2e40bb429707d
parenta9d106421d48776569fe144c3431739e0fe81b65
x86: Allow adding non-aligned size for MTRR

At present mtrr_add_request() requires that the size is a power of two.
This is too limiting for machines with 4GB (or more) of RAM, since they
often must take account of a memory hole at 3GB.

Update the function to automatically deal with an unaligned size, using
more MTRRs as required.

The algorithm is taken from coreboot commit 60bce10750

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/mtrr.c