the following patch was just integrated into master:
commit 6f29a19297583b8b4f02208e8965be668fdf58df
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sat Jan 11 03:42:09 2014 +0100
ec/lenovo/h8: Remove wlan_enable and wwan_enable from device tree.
wwan_enable was never used.
wlan_enable isn't something for device tree but for CMOS config if at all.
Change-Id: I765d9d6f0b73b7dc5a57c0c630a53b4b7a0b48cb
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
See http://review.coreboot.org/4651 for details.
-gerrit
the following patch was just integrated into master:
commit 8f2448018fb5ed850e06cc7d5dff9aa616405053
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Mon Nov 18 11:57:45 2013 +0100
arch/x86/acpi/globutil.asl: Make control method `S2BF` serialized
This changes eliminates a warning from the ASL compiler.
Change-Id: I502cca731b6b4cd3e17c57fc191f1eed10a5a1fe
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
See http://review.coreboot.org/4093 for details.
-gerrit
Rudolf Marek (r.marek(a)assembler.cz) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4671
-gerrit
commit b108141c09961aa35ccb2a266856a20bb583a447
Author: Rudolf Marek <r.marek(a)assembler.cz>
Date: Sun Jan 12 00:23:30 2014 +0100
AGESA f15tn: Fix GPP ports resume
The AGESA resumes the GPP ports in the romstage using FchInitResetGpp(),
which does FchGppPortInitS3Phase() for S3 resume. The PreInitGppLink()
looks into CMOS to figure out what ports to just force to Gen1 or
Gen2 PCIe. Then boot continues and in the ramstage the rest of GPP
init is executed. There is a problem that nobody sets properly the
PortDetected flags in the S3 path. As the consequence FchGppDynamicPowerSaving()
thinks the GPP port is not enabled and shut downs it.
The best fix would be also to remove the CMOS dependency which
might be some left over, because AGESA does not use CMOS much for
anything else. There could be also some way how to pass the GPP state
structure from romstage to ramstage possibly via hudson/resume.c
but I don't know how to do that. Similar problem is that the "late"
stage of init again "forgets" the PortDetected state.
This fix fixes the resume issue on Asus F2A85-M. With this patch applied
both GPP ports (used as PCIe x1 and internal ethernet) are working again
after resume.
Change-Id: Idaf609043abb09441c6790504d66d23e0637588f
Signed-off-by: Rudolf Marek <r.marek(a)assembler.cz>
---
src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c | 16 ++++++++++++++++
src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c | 5 ++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c
index e4db032..678ddaa 100644
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c
+++ b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c
@@ -65,10 +65,26 @@ FchInitEnvGpp (
{
FCH_DATA_BLOCK *LocalCfgPtr;
AMD_CONFIG_PARAMS *StdHeader;
+ UINT8 GppS3Data;
+ UINT8 PortId;
LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr;
StdHeader = LocalCfgPtr->StdHeader;
+ /*
+ * The romstage will force link, but re-read the GPP params from CMOS,
+ * otherwise the late init will powerdown all ports including
+ * those which were just taken out of S3
+ */
+ if (ReadFchSleepType (StdHeader) == ACPI_SLPTYP_S3) {
+ ReadMem ( ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, &GppS3Data);
+ for ( PortId = 0; PortId < MAX_GPP_PORTS; PortId++ ) {
+ if ( GppS3Data & (1 << (PortId + 4))) {
+ LocalCfgPtr->Gpp.PortCfg[PortId].PortDetected = TRUE;
+ }
+ }
+ }
+
if ( !LocalCfgPtr->Gpp.NewGppAlgorithm) {
ProgramFchGppInitReset (&LocalCfgPtr->Gpp, StdHeader);
FchStall (5000, StdHeader);
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c
index d4c9fe9..4c77358 100644
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c
+++ b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppLate.c
@@ -281,6 +281,9 @@ FchInitLateGpp (
RwAlink (0x310 | (UINT32) (ABCFG << 29), 0xFFFFFFFF, BIT7, StdHeader);
RwAlink (FCH_RCINDXC_REGC0, 0xFFFFFFFF, BIT9, StdHeader);
}
- RwMem (ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, 0, GppS3Data);
+
+ if (ReadFchSleepType (StdHeader) != ACPI_SLPTYP_S3) {
+ RwMem (ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, 0, GppS3Data);
+ }
}
Rudolf Marek (r.marek(a)assembler.cz) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4671
-gerrit
commit 2b850eaf03649bef12dbe8098bf0382a34058739
Author: Rudolf Marek <r.marek(a)assembler.cz>
Date: Sun Jan 12 00:23:30 2014 +0100
AGESA f15tn: Fix GPP ports resume
The AGESA resumes the GPP ports in the romstage using FchInitResetGpp(),
which does FchGppPortInitS3Phase() for S3 resume. The PreInitGppLink()
looks into CMOS to figure out what ports to just force to Gen1 or
Gen2 PCIe. Then boot continues and in the ramstage the rest of GPP
init is executed. There is a problem that nobody sets properly the
PortDetected flags in the S3 path. As the consequence FchGppDynamicPowerSaving()
thinks the GPP port is not enabled and shut downs it.
The best fix would be also to remove the CMOS dependency which
might be some left over, because AGESA does not use CMOS much for
anything else. There could be also some way how to pass the GPP state
structure from romstage to ramstage possibly via hudson/resume.c
but I don't know how to do that.
This fix fixes the resume issue on Asus F2A85-M. With this patch applied
both GPP ports (used as PCIe x1 and internal ethernet) are working again
after resume.
Change-Id: Idaf609043abb09441c6790504d66d23e0637588f
Signed-off-by: Rudolf Marek <r.marek(a)assembler.cz>
---
src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c
index e4db032..678ddaa 100644
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c
+++ b/src/vendorcode/amd/agesa/f15tn/Proc/Fch/Pcie/GppEnv.c
@@ -65,10 +65,26 @@ FchInitEnvGpp (
{
FCH_DATA_BLOCK *LocalCfgPtr;
AMD_CONFIG_PARAMS *StdHeader;
+ UINT8 GppS3Data;
+ UINT8 PortId;
LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr;
StdHeader = LocalCfgPtr->StdHeader;
+ /*
+ * The romstage will force link, but re-read the GPP params from CMOS,
+ * otherwise the late init will powerdown all ports including
+ * those which were just taken out of S3
+ */
+ if (ReadFchSleepType (StdHeader) == ACPI_SLPTYP_S3) {
+ ReadMem ( ACPI_MMIO_BASE + CMOS_RAM_BASE + 0x0D, AccessWidth8, &GppS3Data);
+ for ( PortId = 0; PortId < MAX_GPP_PORTS; PortId++ ) {
+ if ( GppS3Data & (1 << (PortId + 4))) {
+ LocalCfgPtr->Gpp.PortCfg[PortId].PortDetected = TRUE;
+ }
+ }
+ }
+
if ( !LocalCfgPtr->Gpp.NewGppAlgorithm) {
ProgramFchGppInitReset (&LocalCfgPtr->Gpp, StdHeader);
FchStall (5000, StdHeader);
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4656
-gerrit
commit 89cd903714b61684236d48833988aab8de036baf
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Jan 10 23:06:03 2014 -0600
cpu/allwinner/a10: Provide utility to make a bootable image
Up until now, we relied on mksunxiboot to prepend the header which
makes coreboot.rom bootable on Allwinner SoCs. If that tool was not
present, the build silently failed.
Integrate this tool into our util/ package, so that we do not have to
rely on mksunxiboot being in PATH.
Our version of mksunxiboot also eliminates some limitations of the
original tool, so we no longer have to use 'dd' to limit the file
size.
Change-Id: Id5a4b1e2a3cb00cd1d6c70e6cbc3cfd8587e8a24
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/cpu/allwinner/a10/Makefile.inc | 29 ++--
util/arm_boot_tools/mksunxiboot/mksunxiboot.c | 196 ++++++++++++++++++++++++++
2 files changed, 215 insertions(+), 10 deletions(-)
diff --git a/src/cpu/allwinner/a10/Makefile.inc b/src/cpu/allwinner/a10/Makefile.inc
index 03bc612..1b720bf 100644
--- a/src/cpu/allwinner/a10/Makefile.inc
+++ b/src/cpu/allwinner/a10/Makefile.inc
@@ -30,16 +30,25 @@ get_bootblock_size= \
sed 's/[^0-9 ]//g')) \
$(shell echo $$(($(word 2, $(strip $(bb_s))))))
+# This tool is used to prepend a header to coreboot.rom to trick the SoC into
+# loading out bootblock
+#
+MKSUNXIBOOT:=$(objutil)/mksunxiboot
+$(MKSUNXIBOOT): $(top)/util/arm_boot_tools/mksunxiboot/mksunxiboot.c
+ @printf " HOSTCC $(subst $(obj)/,,$(@))\n"
+ $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+
# The boot ROM in the SoC will start loading code if a special BOOT0 header is
# found (at an offset of 8KiB in either NAND or SD), and the checksum is
-# correct. This header is normally added by the 'mxsunxiboot' tool. The boot ROM
-# will load at most 24KiB of data to SRAM, so limit the file size accordingly.
-# The BOOT0 header takes 32 bytes, so limit our file to 24KiB - 32 bytes.
-# FIXME: Figure out how to safely integrate in coreboot.rom.
-# FIXME: The file passed to mksunxiboot should only include the bootblock due
-# to size limitations.
-$(obj)/BOOT0: $(obj)/coreboot.rom
+# correct. This header is added by the 'mxsunxiboot' tool, which is provided
+# under util/arm_boot_tools/mksunxiboot. The boot ROM will load at most 24KiB of
+# data to SRAM. The BOOT0 header takes 32 bytes, so bootblock is limited to
+# 24KiB - 32 bytes.
+# TODO: make mksunxiboot take the bootblock size as a parameter
+# TODO: print an error if bootblock is too large (maybe place ROMSTAGE at the
+# exact offset needed to collide with the bootblock)
+# FIXME: A10 loads 24KiB. According to Oliver other chips load a little more
+#
+$(obj)/BOOT0: $(obj)/coreboot.rom $(MKSUNXIBOOT)
@printf " BOOT0 $(subst $(obj)/,,$(^))\n"
- touch $@
- dd if=$^ of=$^.tmp bs=24544 count=1
- -mksunxiboot $^.tmp $@
+ $(MKSUNXIBOOT) $(word 1, $^) $@
diff --git a/util/arm_boot_tools/mksunxiboot/mksunxiboot.c b/util/arm_boot_tools/mksunxiboot/mksunxiboot.c
new file mode 100644
index 0000000..af8450c
--- /dev/null
+++ b/util/arm_boot_tools/mksunxiboot/mksunxiboot.c
@@ -0,0 +1,196 @@
+/*
+ * A simple tool to generate bootable image for sunxi platform.
+ *
+ * Copyright (C) 2007-2011 Allwinner Technology Co., Ltd.
+ * Tom Cubie <tangliang(a)allwinnertech.com>
+ * Copyright (C) 2014 Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
+ * Subject to the GNU GPL v2, or (at your option) any later version.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+
+/* boot head definition from sun4i boot code */
+struct boot_file_head {
+ uint32_t jump_instruction; /* one intruction jumping to real code */
+ uint8_t magic[8]; /* ="eGON.BT0" or "eGON.BT1", not C-style str */
+ uint32_t check_sum; /* generated by PC */
+ uint32_t length; /* generated by PC */
+ /* We use a simplified header, only filling in what is needed by the
+ * boot ROM. To be compatible with Allwinner tools the larger header
+ * below should be used, followed by a custom header if desired. */
+ uint8_t pad[12]; /* align to 32 bytes */
+};
+
+static const char *BOOT0_MAGIC = "eGON.BT0";
+static const uint32_t STAMP_VALUE = 0x5F0A6C39;
+static const int HEADER_SIZE = 32;
+/* Checksum at most 24 KiB */
+#define SRAM_LOAD_MAX_SIZE ((24 << 10) - sizeof(struct boot_file_head))
+static const int BLOCK_SIZE = 512;
+
+inline static uint32_t le32_to_h(const void *src)
+{
+ const uint8_t *b = src;
+ return ((b[3] << 24) | (b[2] << 16) | (b[1] << 8) | (b[0] << 0));
+}
+
+inline static void h_to_le32(uint32_t val32, void *dest)
+{
+ uint8_t *b = dest;
+ b[0] = (val32 >> 0) & 0xff;
+ b[1] = (val32 >> 8) & 0xff;
+ b[2] = (val32 >> 16) & 0xff;
+ b[3] = (val32 >> 24) & 0xff;
+};
+
+static void serialize_header(void *dest, const struct boot_file_head *hdr)
+{
+ /* Unused fields are zero */
+ memset(dest, 0, HEADER_SIZE);
+
+ h_to_le32(hdr->jump_instruction, dest + 0);
+ memcpy(dest + 4, BOOT0_MAGIC, 8);
+ h_to_le32(hdr->check_sum, dest + 12);
+ h_to_le32(hdr->length, dest + 16);
+}
+
+/* Check sum function from sun4i boot code */
+static int fill_check_sum(struct boot_file_head *hdr, const void *boot_code)
+{
+ size_t i;
+ uint8_t raw_hdr[HEADER_SIZE];
+ uint32_t chksum;
+
+ if ((hdr->length & 0x3) != 0) {
+ fprintf(stderr, "BUG! Load size is not 4-byte aligned\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Fill in checksum seed */
+ hdr->check_sum = STAMP_VALUE;
+
+ chksum = 0;
+ /* Checksum the header */
+ serialize_header(raw_hdr, hdr);
+ for (i = 0; i < HEADER_SIZE; i += 4)
+ chksum += le32_to_h(raw_hdr + i);
+
+ /* Checksum the boot code */
+ for (i = 0; i < hdr->length - HEADER_SIZE; i += 4)
+ chksum += le32_to_h(boot_code + i);
+
+ /* write back check sum */
+ hdr->check_sum = chksum;
+
+ return EXIT_SUCCESS;
+}
+
+static uint32_t align(uint32_t size, uint32_t alignment)
+{
+ return ((size + alignment - 1) / alignment) * alignment;
+}
+
+static void fill_header(struct boot_file_head *hdr, size_t load_size)
+{
+ /* B instruction */
+ hdr->jump_instruction = 0xEA000000;
+ /* Jump to the first instr after the header */
+ hdr->jump_instruction |= (sizeof(*hdr) / sizeof(uint32_t) - 2);
+ /* No '0' termination in magic string */
+ memcpy(&hdr->magic, BOOT0_MAGIC, 8);
+
+ hdr->length = align(load_size + sizeof(hdr), BLOCK_SIZE);
+}
+
+static long int fsize(FILE *file)
+{
+ long int size;
+
+ fseek(file, 0L, SEEK_END);
+ size = ftell(file);
+ fseek(file, 0L, SEEK_SET);
+ return size;
+}
+
+int main(int argc, char *argv[])
+{
+ FILE *fd_in, *fd_out;
+ struct boot_file_head hdr;
+ long int file_size, load_size;
+ void *file_data;
+ uint8_t raw_hdr[HEADER_SIZE];
+ int count;
+
+ /*
+ * TODO: We could take an additional argument to see how much of the
+ * file to checksum. This way, the build system can tell us how large
+ * the bootblock is, so we can tell the BROM to load only the bootblock.
+ */
+ if (argc < 2) {
+ printf("\tThis program makes an input bin file to sun4i "
+ "bootable image.\n"
+ "\tUsage: %s input_file out_putfile\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ fd_in = fopen(argv[1], "r");
+ if (!fd_in) {
+ fprintf(stderr, "Cannot open input %s", argv[1]);
+ return EXIT_FAILURE;
+ }
+
+ /* Get input file size */
+ file_size = fsize(fd_in);
+ if ((file_data = malloc(file_size)) == NULL) {
+ fprintf(stderr, "Cannot allocate memory\n");
+ return EXIT_FAILURE;
+ }
+
+ printf("File size: 0x%x\n", file_size);
+ if (fread(file_data, file_size, 1, fd_in) != 1) {
+ fprintf(stderr, "Cannot read %s: %s\n", argv[1],
+ strerror(errno));
+ return EXIT_FAILURE;
+ }
+
+ load_size = align(file_size, sizeof(uint32_t));
+
+ if (load_size > SRAM_LOAD_MAX_SIZE)
+ load_size = SRAM_LOAD_MAX_SIZE;
+
+ printf("Load size: 0x%x\n", load_size);
+
+ fd_out = fopen(argv[2], "w");
+ if (!fd_out) {
+ fprintf(stderr, "Cannot open output %s\n", argv[2]);
+ return EXIT_FAILURE;
+ }
+
+ /* Fill the header */
+ fill_header(&hdr, load_size);
+ fill_check_sum(&hdr, file_data);
+
+ /* Now write the header */
+ serialize_header(raw_hdr, &hdr);
+ if (fwrite(raw_hdr, HEADER_SIZE, 1, fd_out) != 1) {
+ fprintf(stderr, "Cannot write header to %s: %s\n", argv[1],
+ strerror(errno));
+ return EXIT_FAILURE;
+ }
+
+ /* And finally, the boot code */
+ if (fwrite(file_data, file_size, 1, fd_out) != 1) {
+ fprintf(stderr, "Cannot write to %s: %s\n", argv[1],
+ strerror(errno));
+ return EXIT_FAILURE;
+ }
+
+ fclose(fd_in);
+ fclose(fd_out);
+
+ return EXIT_SUCCESS;
+}
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/4667
-gerrit
commit a7edcccf66cc79bd2417637653e94cef011a3d74
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Jan 6 17:18:58 2014 +0200
lenovo/x201: Really do EARLY_CBMEM_INIT
The board was missing cbmem_initialize() call in romstage. Selecting
EARLY_CBMEM_INIT implies this is done in romstage.
Change-Id: I9ec93f89fe4cbb9e729532be36db601b6e62bca6
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/mainboard/lenovo/x201/romstage.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c
index 8022d7b..18645ac 100644
--- a/src/mainboard/lenovo/x201/romstage.c
+++ b/src/mainboard/lenovo/x201/romstage.c
@@ -230,6 +230,7 @@ static inline u16 read_acpi16(u32 addr)
void main(unsigned long bist)
{
u32 reg32;
+ int cbmem_initted;
int s3resume = 0;
timestamp_init(rdtsc ());
@@ -329,11 +330,14 @@ void main(unsigned long bist)
reg32 = inl(DEFAULT_PMBASE + 0x04);
outl(reg32 & ~(7 << 10), DEFAULT_PMBASE + 0x04);
}
+
+ cbmem_initted = !cbmem_initialize();
+
#if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so
* this is not a resume. In that case we just create the cbmem toc.
*/
- if (s3resume && cbmem_reinit()) {
+ if (s3resume && cbmem_initted) {
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption