Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2688
-gerrit
commit 501fcc6192792fc85aaed40598c05612f127f3df
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Dec 19 17:15:43 2012 -0600
haswell: reserve default SMRAM space
Currently the OS is free to use the memory located at the default
SMRAM space because it is not marked reserved in the e820. This can
lead to memory corruption on S3 resume because SMM setup doesn't save
this range before using it to relocate SMRAM.
Resulting tables:
coreboot memory table:
0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
1. 0000000000001000-000000000002ffff: RAM
2. 0000000000030000-000000000003ffff: RESERVED
3. 0000000000040000-000000000009ffff: RAM
4. 00000000000a0000-00000000000fffff: RESERVED
5. 0000000000100000-0000000000efffff: RAM
6. 0000000000f00000-0000000000ffffff: RESERVED
7. 0000000001000000-00000000acebffff: RAM
8. 00000000acec0000-00000000acffffff: CONFIGURATION TABLES
9. 00000000ad000000-00000000af9fffff: RESERVED
10. 00000000f0000000-00000000f3ffffff: RESERVED
11. 00000000fed10000-00000000fed19fff: RESERVED
12. 00000000fed84000-00000000fed84fff: RESERVED
13. 0000000100000000-000000018f5fffff: RAM
e820 map has 13 items:
0: 0000000000000000 - 0000000000030000 = 1 RAM
1: 0000000000030000 - 0000000000040000 = 2 RESERVED
2: 0000000000040000 - 000000000009f400 = 1 RAM
3: 000000000009f400 - 00000000000a0000 = 2 RESERVED
4: 00000000000f0000 - 0000000000100000 = 2 RESERVED
5: 0000000000100000 - 0000000000f00000 = 1 RAM
6: 0000000000f00000 - 0000000001000000 = 2 RESERVED
7: 0000000001000000 - 00000000acec0000 = 1 RAM
8: 00000000acec0000 - 00000000afa00000 = 2 RESERVED
9: 00000000f0000000 - 00000000f4000000 = 2 RESERVED
10: 00000000fed10000 - 00000000fed1a000 = 2 RESERVED
11: 00000000fed84000 - 00000000fed85000 = 2 RESERVED
12: 0000000100000000 - 000000018f600000 = 1 RAM
Booted and checked e820 as well as coreboot table information.
Change-Id: Ie4985c748b591bf8c0d6a2b59549b698c9ad6cfe
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/cpu/x86/smm.h | 3 +++
src/northbridge/intel/haswell/northbridge.c | 40 ++++++++++++++++++++++++-----
2 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index 00a8c7a..698ddaf 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -24,6 +24,9 @@
#ifndef CPU_X86_SMM_H
#define CPU_X86_SMM_H
+#define SMM_DEFAULT_BASE 0x30000
+#define SMM_DEFAULT_SIZE 0x10000
+
/* used only by C programs so far */
#define SMM_BASE 0xa0000
diff --git a/src/northbridge/intel/haswell/northbridge.c b/src/northbridge/intel/haswell/northbridge.c
index e97ef55..7059e2c 100644
--- a/src/northbridge/intel/haswell/northbridge.c
+++ b/src/northbridge/intel/haswell/northbridge.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <cpu/cpu.h>
+#include <cpu/x86/smm.h>
#include <boot/tables.h>
#include <cbmem.h>
#include "chip.h"
@@ -333,29 +334,54 @@ static void mc_add_dram_resources(device_t dev)
mc_report_map_entries(dev, &mc_values[0]);
/*
- * There are 4 host memory ranges that should be added:
- * - 0 -> 0xa0000 : cacheable
+ * These are the host memory ranges that should be added:
+ * - 0 -> SMM_DEFAULT_BASE : cacheable
+ * - SMM_DEFAULT_BASE -> SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE :
+ * cacheable and reserved
+ * - SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE -> 0xa0000 : cacheable
* - 0xc0000 -> TSEG : cacheable
* - TESG -> TOLUD: not cacheable with standard MTRRs and reserved
* - 4GiB -> TOUUD: cacheable
*
+ * The default SMRAM space is reserved so that the range doesn't
+ * have to be saved during S3 Resume. Once marked reserved the OS
+ * cannot use the memory. This is a bit of an odd place to reserve
+ * the region, but the CPU devices don't have dev_ops->read_resources()
+ * called on them.
+ *
* The range 0xa0000 -> 0xc0000 does not have any resources
* associated with it to handle legacy VGA memory. If this range
* is not omitted the mtrr code will setup the area as cacheable
* causing VGA access to not work.
*
+ * It should be noted that cacheable entry types need to be added in
+ * order. The reason is that the current MTRR code assumes this and
+ * falls over itself if it isn't.
+ *
* The resource index starts low and should not meet or exceed
- * PCI_BASE_ADDRESS_0. In this case there are only 3 entries so there
- * are no conflicts in the index space.
+ * PCI_BASE_ADDRESS_0.
*/
index = 0;
- /* 0 - > 0xa0000 */
+ /* 0 - > SMM_DEFAULT_BASE */
base_k = 0;
- size_k = 0xa0000 >> 10;
+ size_k = SMM_DEFAULT_BASE >> 10;
+ ram_resource(dev, index++, base_k, size_k);
+
+ /* SMM_DEFAULT_BASE -> SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE */
+ resource = new_resource(dev, index++);
+ resource->base = SMM_DEFAULT_BASE;
+ resource->size = SMM_DEFAULT_SIZE;
+ resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
+ IORESOURCE_CACHEABLE | IORESOURCE_STORED |
+ IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
+
+ /* SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE -> 0xa0000 */
+ base_k = (SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE) >> 10;
+ size_k = (0xa0000 >> 10) - base_k;
ram_resource(dev, index++, base_k, size_k);
- /* 0xa0000 -> TSEG */
+ /* 0xc0000 -> TSEG */
base_k = 0xc0000 >> 10;
size_k = (unsigned long)(mc_values[TSEG_REG] >> 10) - base_k;
ram_resource(dev, index++, base_k, size_k);
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2685
-gerrit
commit 63ea12810584e94927a38b86c289d3c64f81a4bd
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Dec 14 16:54:34 2012 -0600
cbfstool: Add file alignment for add operations
Some CBFS files have alignment requirements because of
how that data is used at runtime. For example, microcode updates
need to be 16 byte aligned. Therefore, an alignment option is
needed. Instead of adding another option for data alignment the
-b (base address) option is utilizied to provide the alignment.
If a base address is supplied for a file and the address <= 1024
the address is treated as an alignment requirement. The data is
then aligned accordingly.
Since this alignment requirement is not carried through into picking
the final location it is possible that a large alignment requirement
may add unnecessary padding between the header and the data.
Change-Id: I84075f2cf90794b0a97f0d0e5dbf7633925c21aa
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
util/cbfstool/common.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index aa98696..3c8dca5 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -632,17 +632,31 @@ void *create_cbfs_file(const char *filename, void *data, uint32_t * datasize,
{
uint32_t filename_len = ALIGN(strlen(filename) + 1, 16);
uint32_t headersize = sizeof(struct cbfs_file) + filename_len;
- if ((location != 0) && (*location != 0)) {
- uint32_t offset = *location % align;
- /* If offset >= (headersize % align), we can stuff the header into the offset.
- Otherwise the header has to be aligned itself, and put before the offset data */
- if (offset >= (headersize % align)) {
- offset -= (headersize % align);
+
+ if (location != NULL && *location != 0) {
+ /*
+ * A location of less than or equal 1024 is considered the data
+ * alignement. The location is then zero'd out so that cbfs
+ * can place it where ever it finds.
+ */
+ if (*location <= 1024) {
+ uint32_t data_start = (headersize + align - 1) % align;
+ uint32_t alignment = *location;
+ if ((data_start % alignment) != 0)
+ headersize += (data_start % alignment);
+ *location = 0;
} else {
- offset += align - (headersize % align);
+ uint32_t offset = *location % align;
+ /* If offset >= (headersize % align), we can stuff the header into the offset.
+ Otherwise the header has to be aligned itself, and put before the offset data */
+ if (offset >= (headersize % align)) {
+ offset -= (headersize % align);
+ } else {
+ offset += align - (headersize % align);
+ }
+ headersize += offset;
+ *location -= headersize;
}
- headersize += offset;
- *location -= headersize;
}
void *newdata = malloc(*datasize + headersize);
if (!newdata) {
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2683
-gerrit
commit 1427523f2c1e7f87c3ca7ae193254513ae3c2144
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Wed Dec 19 13:17:06 2012 -0800
lynxpoint: Move a bit of generic RCBA into early_pch
Rather than have to repeat this bit in every mainboard.
Also, remove the reset of the RTC power status from here.
We had done this in TOT for current platforms but did not
carry it back to emeraldlake2 where this branched from.
If we clear the status here then we don't get an event
logged later which can be important for the devices that
do not have a CMOS battery.
Change-Id: Ia7131e9d9e7cf86228a285df652a96bcabf05260
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/mainboard/intel/baskingridge/romstage.c | 5 -----
src/southbridge/intel/lynxpoint/early_pch.c | 20 +++++++++++++-------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/mainboard/intel/baskingridge/romstage.c b/src/mainboard/intel/baskingridge/romstage.c
index 9561456..d47fbf1 100644
--- a/src/mainboard/intel/baskingridge/romstage.c
+++ b/src/mainboard/intel/baskingridge/romstage.c
@@ -79,11 +79,6 @@ const struct rcba_config_instruction rcba_config[] = {
/* Disable unused devices (board specific) */
RCBA_RMW_REG_32(FD, ~0, PCH_DISABLE_ALWAYS),
- /* Enable IOAPIC (generic) */
- RCBA_SET_REG_16(OIC, 0x0100),
- /* PCH BWG says to read back the IOAPIC enable register */
- RCBA_READ_REG_16(OIC),
-
RCBA_END_CONFIG,
};
diff --git a/src/southbridge/intel/lynxpoint/early_pch.c b/src/southbridge/intel/lynxpoint/early_pch.c
index 9757d8a..c87da27 100644
--- a/src/southbridge/intel/lynxpoint/early_pch.c
+++ b/src/southbridge/intel/lynxpoint/early_pch.c
@@ -31,6 +31,15 @@
#include "gpio.h"
#endif
+const struct rcba_config_instruction pch_early_config[] = {
+ /* Enable IOAPIC */
+ RCBA_SET_REG_16(OIC, 0x0100),
+ /* PCH BWG says to read back the IOAPIC enable register */
+ RCBA_READ_REG_16(OIC),
+
+ RCBA_END_CONFIG,
+};
+
static void pch_enable_bars(void)
{
/* Setting up Southbridge. In the northbridge code. */
@@ -48,17 +57,10 @@ static void pch_enable_bars(void)
static void pch_generic_setup(void)
{
- u8 reg8;
-
printk(BIOS_DEBUG, "Disabling Watchdog reboot...");
RCBA32(GCS) = RCBA32(GCS) | (1 << 5); /* No reset */
outw((1 << 11), DEFAULT_PMBASE | 0x60 | 0x08); /* halt timer */
printk(BIOS_DEBUG, " done.\n");
-
- // reset rtc power status
- reg8 = pci_read_config8(PCH_LPC_DEV, GEN_PMCON_3);
- reg8 &= ~(1 << 2);
- pci_write_config8(PCH_LPC_DEV, GEN_PMCON_3, reg8);
}
static int sleep_type_s3(void)
@@ -158,6 +160,10 @@ int early_pch_init(const void *gpio_map,
/* Enable SMBus for reading SPDs. */
enable_smbus();
+ /* Early PCH RCBA settings */
+ pch_config_rcba(pch_early_config);
+
+ /* Mainboard RCBA settings */
pch_config_rcba(rcba_config);
wake_from_s3 = sleep_type_s3();