<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/26567">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cpu/x86/mtrr: Prepare for ROM_SIZE > 16MiB<br><br>Most, if not all, chipsets have MMIO between 0xfe000000 and 0xff000000.<br>So don't try to cache more than 16MiB of the ROM. It's also common that<br>at most 16MiB are memory mapped.<br><br>Change-Id: I5dfa2744190a34c56c86e108a8c50dca9d428268<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M src/include/cpu/x86/mtrr.h<br>1 file changed, 14 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/67/26567/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h</span><br><span>index ad0e5d6..aa67033 100644</span><br><span>--- a/src/include/cpu/x86/mtrr.h</span><br><span>+++ b/src/include/cpu/x86/mtrr.h</span><br><span>@@ -1,6 +1,8 @@</span><br><span> #ifndef CPU_X86_MTRR_H</span><br><span> #define CPU_X86_MTRR_H</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#include <commonlib/helpers.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*  These are the region types  */</span><br><span> #define MTRR_TYPE_UNCACHEABLE              0</span><br><span> #define MTRR_TYPE_WRCOMB           1</span><br><span>@@ -149,12 +151,20 @@</span><br><span> /* Make sure it doesn't overlap CAR, though. */</span><br><span> #define CAR_END (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - 1)</span><br><span> #if CAR_END >= OPTIMAL_CACHE_ROM_BASE</span><br><span style="color: hsl(0, 100%, 40%);">-# define CACHE_ROM_SIZE (_ALIGN_UP_POW2(FROM_TOP(CAR_END)) / 2)</span><br><span style="color: hsl(120, 100%, 40%);">+# define CAR_CACHE_ROM_SIZE (_ALIGN_UP_POW2(FROM_TOP(CAR_END)) / 2)</span><br><span> #else</span><br><span style="color: hsl(0, 100%, 40%);">-# define CACHE_ROM_SIZE OPTIMAL_CACHE_ROM_SIZE</span><br><span style="color: hsl(120, 100%, 40%);">+# define CAR_CACHE_ROM_SIZE OPTIMAL_CACHE_ROM_SIZE</span><br><span> #endif</span><br><span style="color: hsl(0, 100%, 40%);">-#if ((CACHE_ROM_SIZE & (CACHE_ROM_SIZE-1)) != 0)</span><br><span style="color: hsl(0, 100%, 40%);">-# error "CACHE_ROM_SIZE is not a power of 2, _POW2_MASK needs refinement."</span><br><span style="color: hsl(120, 100%, 40%);">+#if ((CAR_CACHE_ROM_SIZE & (CAR_CACHE_ROM_SIZE-1)) != 0)</span><br><span style="color: hsl(120, 100%, 40%);">+# error "CAR CACHE_ROM_SIZE is not a power of 2, _POW2_MASK needs refinement."</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Last but not least, most (if not all) chipsets have MMIO</span><br><span style="color: hsl(120, 100%, 40%);">+   between 0xfe000000 and 0xff000000, so limit to 16MiB. */</span><br><span style="color: hsl(120, 100%, 40%);">+#if 16 * MiB < CAR_CACHE_ROM_SIZE</span><br><span style="color: hsl(120, 100%, 40%);">+# define CACHE_ROM_SIZE (16 * MiB)</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span style="color: hsl(120, 100%, 40%);">+# define CACHE_ROM_SIZE CAR_CACHE_ROM_SIZE</span><br><span> #endif</span><br><span> </span><br><span> #define CACHE_ROM_BASE FROM_TOP(CACHE_ROM_SIZE)</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/26567">change 26567</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/26567"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5dfa2744190a34c56c86e108a8c50dca9d428268 </div>
<div style="display:none"> Gerrit-Change-Number: 26567 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>