Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1386
-gerrit
commit f6e19b99e7d4ec6d082670cbfa1e40bd68303e38
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue Jul 31 20:52:47 2012 +0300
Add infrastructure to distribute MSRs across CPUs on init
Some MSRs need to be replicated from one CPU to another.
As the first step handle TOP_MEM and TOP_MEM2 for AMD CPUs.
There is no need to regenerate MTRR setup from the registered memory
resources separately for each CPU, doing it once and saving a copy
in a table should do it. Also writing of MTRR MSRs to CPUs should be
synchronized, reading from a table should simplify that process.
The created table can be moved to cbmem to use it on S2/S3 resumes.
Change-Id: I9bf0c47f825f7174b5108a32fba56e9fec5bb62b
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/cpu/x86/mtrr/Makefile.inc | 1 +
src/cpu/x86/mtrr/msr.c | 51 +++++++++++++++++++++++++++++++++++++++++
src/include/cpu/x86/msr.h | 7 +++++
3 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/src/cpu/x86/mtrr/Makefile.inc b/src/cpu/x86/mtrr/Makefile.inc
index cecb826..65a53d3 100644
--- a/src/cpu/x86/mtrr/Makefile.inc
+++ b/src/cpu/x86/mtrr/Makefile.inc
@@ -1 +1,2 @@
ramstage-y += mtrr.c
+ramstage-y += msr.c
diff --git a/src/cpu/x86/mtrr/msr.c b/src/cpu/x86/mtrr/msr.c
new file mode 100644
index 0000000..b79c75e
--- /dev/null
+++ b/src/cpu/x86/mtrr/msr.c
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 Kyösti Mälkki <kyosti.malkki(a)gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <cpu/x86/msr.h>
+
+/* Storage for MSRs that need to be replicated over
+ * all CPUs after power-on and S2/S3 resumes.
+ */
+static struct msr_non_volatile_struct {
+ uint64_t tolm; /* Top of low RAM < 4GB. */
+ uint64_t tom; /* Top of RAM. */
+
+#if 0
+ msrinit_t mtrr[MAX_MTRRS]; /* TODO */
+#endif
+} msr_non_volatile;
+
+void msr_nv_setup_ramtop(uint64_t tolm, uint64_t tom)
+{
+ msr_non_volatile.tolm = tolm;
+ msr_non_volatile.tom = tom;
+}
+
+uint64_t msr_nv_get_tolm(void)
+{
+ return msr_non_volatile.tolm;
+}
+
+uint64_t msr_nv_get_tom(void)
+{
+ return msr_non_volatile.tom;
+}
+
diff --git a/src/include/cpu/x86/msr.h b/src/include/cpu/x86/msr.h
index 40926df..17d105d 100644
--- a/src/include/cpu/x86/msr.h
+++ b/src/include/cpu/x86/msr.h
@@ -17,6 +17,8 @@ static void wrmsr(unsigned long index, msr_t msr)
#else
+#include <stdint.h>
+
typedef struct msr_struct
{
unsigned lo;
@@ -59,6 +61,11 @@ static inline __attribute__((always_inline)) void wrmsr(unsigned index, msr_t ms
);
}
+/* Utility functions for non-volatile copy of MSRs. */
+void msr_nv_setup_ramtop(uint64_t tolm, uint64_t tom);
+uint64_t msr_nv_get_tolm(void);
+uint64_t msr_nv_get_tom(void);
+
#endif /* __ROMCC__ */
#endif /* CPU_X86_MSR_H */
the following patch was just integrated into master:
commit c33f6d04c9b8c67891002f26038933f00ba8c2fd
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Sun Jul 29 10:34:59 2012 +0300
AMD and GFXUMA : drop redundant use of lb_add_memory_range()
See commit 505414a6cfb2aeef455b5144e4b96fc27f19eb39.
Change-Id: Icc04af9726ae54141581aecc84c40e8aac54591d
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Build-Tested: build bot (Jenkins) at Sun Jul 29 10:22:58 2012, giving +1
Reviewed-By: Anton Kochkov <anton.kochkov(a)gmail.com> at Wed Aug 1 11:54:09 2012, giving +2
See http://review.coreboot.org/1378 for details.
-gerrit
the following patch was just integrated into master:
commit b161e5614ce6660b14a10d39d9a673715b88160c
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Jul 18 14:38:54 2012 +0300
Intel and GFXUMA: drop redundant use of lb_add_memory_range()
Use of uma_resource() in northbridge code created a memory
resource marked as reserved. Such resources are removed
from system memory in write_coreboot_table().
Change-Id: I14bfd560140d8d30ec156562f23072bfae747bde
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Build-Tested: build bot (Jenkins) at Fri Jul 27 15:20:11 2012, giving +1
Reviewed-By: Anton Kochkov <anton.kochkov(a)gmail.com> at Wed Aug 1 11:52:53 2012, giving +2
See http://review.coreboot.org/1238 for details.
-gerrit
the following patch was just integrated into master:
commit b0ab0b5948d3452f12b071f6105add111a5c9d03
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Fri Jul 27 13:12:03 2012 +0300
Intel Sandybridge and UMA: use mmio_resource()
With SandyBridge northbridge code, uma_memory_size was reset to
zero before variable MTRRs were set. This means MTRR setup routine
did not previously create a un-cacheable hole for uma.
Keep the behaviour that way, mmio_resource() has a prerequisuite that
the new region does not overlap with any cacheable ram_resource().
The result is not optimal setup in the number of used MTRRs, but
continue with this approach until MTRR algorithm is improved.
Change-Id: I63c8df19ad6b6350d46a3eca3055abf684b8b114
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Build-Tested: build bot (Jenkins) at Sun Jul 29 08:02:08 2012, giving +1
Reviewed-By: Anton Kochkov <anton.kochkov(a)gmail.com> at Wed Aug 1 10:58:44 2012, giving +2
See http://review.coreboot.org/1373 for details.
-gerrit
the following patch was just integrated into master:
commit 15fa0edd877b491a807340d018369f303aee0722
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Thu Jul 26 23:51:20 2012 +0300
Intel Sandybridge: add reserved memory as resources
Reserved memory resources will get removed from memory table at
the end of write_coreboot_table(),
Change-Id: I02711b4be4f25054bd3361295d8d4dc996b2eb3e
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Build-Tested: build bot (Jenkins) at Sun Jul 29 08:17:27 2012, giving +1
Reviewed-By: Anton Kochkov <anton.kochkov(a)gmail.com> at Wed Aug 1 10:57:17 2012, giving +2
See http://review.coreboot.org/1372 for details.
-gerrit
Zheng Bao (zheng.bao(a)amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1265
-gerrit
commit 2785a0c0c64b140a1e0a57ca060b7b4d193a91e5
Author: zbao <fishbaozi(a)gmail.com>
Date: Wed Aug 1 18:23:49 2012 +0800
AMD F15tn northbridge: Remove the misleading 0x100 from the limitk.
I dont known if missed something, but why an extra 0x100 was added to limit?
My board would get the wrong memory table entry 7f000000-7fffffff as RAM, which
is higher than TOM.
coreboot memory table:
0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
1. 0000000000001000-000000000009ffff: RAM
2. 00000000000c0000-000000005e13efff: RAM
3. 000000005e13f000-000000005effffff: CONFIGURATION TABLES
4. 000000005f000000-000000007effffff: RESERVED
5. 000000007f000000-000000007fffffff: RAM
6. 00000000a0000000-00000000afffffff: RESERVED
Ronald G. Minnich:
I think someone who wrote the code was trying to round up the
next 0x100 boundary and did it incorrectly.
Here is code that would do it correctly:
limitk = ((resource_t)((d.mask + 0x00000ff) & 0x1fffff00)) << 9 ;
Zheng:
Plus 0xFF is correct, but the d.mask take bit 0 as enable it.
This bit should be clear when we try to calculate the limitk.
Change-Id: I3848ed5f23001e5bd61a19833650fe13df26eef3
Signed-off-by: Zheng Bao <zheng.bao(a)amd.com>
Signed-off-by: zbao <fishbaozi(a)gmail.com>
---
src/northbridge/amd/agesa/family15tn/northbridge.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c
index 12aab33..85de812 100644
--- a/src/northbridge/amd/agesa/family15tn/northbridge.c
+++ b/src/northbridge/amd/agesa/family15tn/northbridge.c
@@ -790,7 +790,7 @@ static void domain_set_resources(device_t dev)
if (!(d.mask & 1)) continue;
basek = ((resource_t)(d.base & 0x1fffff00)) << 9; // could overflow, we may lost 6 bit here
- limitk = ((resource_t)((d.mask + 0x00000100) & 0x1fffff00)) << 9 ;
+ limitk = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9 ;
sizek = limitk - basek;
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1386
-gerrit
commit c539aeba4a570f209667255f1fd68c48bc46e12a
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue Jul 31 20:52:47 2012 +0300
Add infrastructure to distribute MSRs across CPUs on init
Some MSRs need to be replicated from one CPU to another.
As the first step handle TOP_MEM and TOP_MEM2 for AMD CPUs.
There is no need to regenerate MTRR setup from the registered memory
resources separately for each CPU, doing it once and saving a copy
in a table should do it. Also writing of MTRR MSRs to CPUs should be
synchronized, reading from a table should simplify that process.
The created table can be moved to cbmem to use it on S2/S3 resumes.
Change-Id: I9bf0c47f825f7174b5108a32fba56e9fec5bb62b
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/cpu/x86/mtrr/Makefile.inc | 1 +
src/cpu/x86/mtrr/msr.c | 51 +++++++++++++++++++++++++++++++++++++++++
src/include/cpu/x86/msr.h | 7 +++++
3 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/src/cpu/x86/mtrr/Makefile.inc b/src/cpu/x86/mtrr/Makefile.inc
index cecb826..65a53d3 100644
--- a/src/cpu/x86/mtrr/Makefile.inc
+++ b/src/cpu/x86/mtrr/Makefile.inc
@@ -1 +1,2 @@
ramstage-y += mtrr.c
+ramstage-y += msr.c
diff --git a/src/cpu/x86/mtrr/msr.c b/src/cpu/x86/mtrr/msr.c
new file mode 100644
index 0000000..b79c75e
--- /dev/null
+++ b/src/cpu/x86/mtrr/msr.c
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 Kyösti Mälkki <kyosti.malkki(a)gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <cpu/x86/msr.h>
+
+/* Storage for MSRs that need to be replicated over
+ * all CPUs after power-on and S2/S3 resumes.
+ */
+static struct msr_non_volatile_struct {
+ uint64_t tolm; /* Top of low RAM < 4GB. */
+ uint64_t tom; /* Top of RAM. */
+
+#if 0
+ msrinit_t mtrr[MAX_MTRRS]; /* TODO */
+#endif
+} msr_non_volatile;
+
+void msr_nv_setup_ramtop(uint64_t tolm, uint64_t tom)
+{
+ msr_non_volatile.tolm = tolm;
+ msr_non_volatile.tom = tom;
+}
+
+uint64_t msr_nv_get_tolm(void)
+{
+ return msr_non_volatile.tolm;
+}
+
+uint64_t msr_nv_get_tom(void)
+{
+ return msr_non_volatile.tom;
+}
+
diff --git a/src/include/cpu/x86/msr.h b/src/include/cpu/x86/msr.h
index 40926df..17d105d 100644
--- a/src/include/cpu/x86/msr.h
+++ b/src/include/cpu/x86/msr.h
@@ -17,6 +17,8 @@ static void wrmsr(unsigned long index, msr_t msr)
#else
+#include <stdint.h>
+
typedef struct msr_struct
{
unsigned lo;
@@ -59,6 +61,11 @@ static inline __attribute__((always_inline)) void wrmsr(unsigned index, msr_t ms
);
}
+/* Utility functions for non-volatile copy of MSRs. */
+void msr_nv_setup_ramtop(uint64_t tolm, uint64_t tom);
+uint64_t msr_nv_get_tolm(void);
+uint64_t msr_nv_get_tom(void);
+
#endif /* __ROMCC__ */
#endif /* CPU_X86_MSR_H */