blob: b0a5b4550cf3499bb6a9073cc0c1f69c38d51772 [file] [log] [blame]
Aaron Durbin595688a2016-03-31 11:38:13 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2016 Intel Corp.
5 * Copyright 2016 Google Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <arch/cpu.h>
14#include <program_loading.h>
15#include <soc/cpu.h>
16
17/*
18 * This file supports the necessary hoops one needs to jump through since
19 * early FSP component and early stages are running from cache-as-ram.
20 */
21
22static void flush_l1d_to_l2(void)
23{
24 msr_t msr = rdmsr(MSR_POWER_MISC);
25 msr.lo |= (1 << 8);
26 wrmsr(MSR_POWER_MISC, msr);
27}
28
Aaron Durbinfaa74b02016-03-31 14:00:47 -050029void platform_segment_loaded(uintptr_t start, size_t size, int flags)
Aaron Durbin595688a2016-03-31 11:38:13 -050030{
Aaron Durbinfaa74b02016-03-31 14:00:47 -050031 /* TODO: filter on address to see if L1D flushing required. */
32
Aaron Durbin5be350b2016-03-31 13:26:46 -050033 /* Flush L1D cache to L2 on final segment loaded */
34 if (flags & SEG_FINAL)
35 flush_l1d_to_l2();
Aaron Durbin595688a2016-03-31 11:38:13 -050036}