summaryrefslogtreecommitdiff
path: root/src/include/cpu/x86
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-05-14 13:19:43 +0200
committerArthur Heymans <arthur@aheymans.xyz>2022-05-16 07:05:03 +0000
commit46b409da483ebfc8d9c868c713f5ad68b62c808e (patch)
treef6fd02685ea558df7447dc3449d3fba787c09183 /src/include/cpu/x86
parent645dde77940d12979166555b17dbc81cda1bc48b (diff)
arch/x86/postcar: Set up postcar MTRR in C code
Setting up postcar MTRRs is done when invd is already called so there is no reason to do this in assembly anymore. This also drops the custom code for Quark to set up MTRRs. TESTED on foxconn/g41m and hermes/prodrive that MTRR are properly set in postcar & ramstage. Change-Id: I5ec10e84118197a04de0a5194336ef8bb049bba4 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/54299 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include/cpu/x86')
-rw-r--r--src/include/cpu/x86/mtrr.h42
1 files changed, 9 insertions, 33 deletions
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 5a237845cd..5397d33948 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -114,43 +114,19 @@ void clear_all_var_mtrr(void);
asmlinkage void display_mtrrs(void);
-/* Variable MTRR structure to help track and set MTRRs prior to ramstage. This
- and the following APIs can be used to set up more complex MTRR solutions
- instead of open coding get_free_var_mtrr() and set_var_mtrr() or for determining
- a future solution, such as postcar_loader. */
struct var_mtrr_context {
- uint32_t upper_mask;
- int max_var_mtrrs;
- int used_var_mtrrs;
- void *arg; /* optional callback parameter */
+ uint32_t max_var_mtrrs;
+ uint32_t used_var_mtrrs;
+ struct {
+ msr_t base;
+ msr_t mask;
+ } mtrr[];
};
-/* Returns 0-relative MTRR from context. Use MTRR_PHYS_BASE|MASK macros for calculating
- MSR address value. */
-static inline int var_mtrr_context_current_mtrr(const struct var_mtrr_context *ctx)
-{
- return ctx->used_var_mtrrs;
-}
-
-/* Initialize var_mtrr_context object. Assumes all variable MTRRs are not yet used. */
-void var_mtrr_context_init(struct var_mtrr_context *ctx, void *arg);
-/* Allocate a variable mtrr base and mask, calling the provided callback for each MTRR
- MSR base-mask pair needed to accommodate the address and size request.
- Returns < 0 on error and 0 on success. */
-int var_mtrr_set_with_cb(struct var_mtrr_context *ctx,
- uintptr_t addr, size_t size, int type,
- void (*callback)(const struct var_mtrr_context *ctx,
- uintptr_t base_addr, size_t size,
- msr_t base, msr_t mask));
-/* Same as var_mtrr_set_with_cb() but just write the MSRs directly. */
+void var_mtrr_context_init(struct var_mtrr_context *ctx);
int var_mtrr_set(struct var_mtrr_context *ctx, uintptr_t addr, size_t size, int type);
-
-/*
- * Set the MTRRs using the data on the stack from setup_stack_and_mtrrs.
- * Return a new top_of_stack value which removes the setup_stack_and_mtrrs data.
- */
-asmlinkage void *soc_set_mtrrs(void *top_of_stack);
-asmlinkage void soc_enable_mtrrs(void);
+void commit_mtrr_setup(const struct var_mtrr_context *ctx);
+void postcar_mtrr_setup(void);
/* fms: find most significant bit set, stolen from Linux Kernel Source. */
static inline unsigned int fms(unsigned int x)