the following patch was just integrated into master:
commit ce11393d9cc806781f9385d9edb7fffafefbf331
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Sun Dec 22 20:42:58 2013 +0200
AMD K8: Socket implies K8_REV_F_SUPPORT
K8_REV_F_SUPPORT is already set by all affected sockets, (AM2, F, S1G1).
Change-Id: If42a4178263d90a4e195fae0c78943ac9eda1ad6
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
See http://review.coreboot.org/4557 for details.
-gerrit
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/4565
-gerrit
commit 7677cbea3ece69e1679a48c4cb5335674a0c2cb1
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Sun Dec 22 21:30:21 2013 -0500
cpu/allwinner/a10: Refactor and document pinmux API
Include a function to multiplex more than one pin at a time. This
is useful for peripherals that have the same function number for
all their pins.
Since we now have two functions for muxing pins, also document
them.
Change-Id: I53997cc3a2586e3cf749cd672f69fb427659c67f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/cpu/allwinner/a10/gpio.h | 3 +-
src/cpu/allwinner/a10/pinmux.c | 51 +++++++++++++++++++++++++-
src/mainboard/cubietech/cubieboard/bootblock.c | 7 ++--
3 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/src/cpu/allwinner/a10/gpio.h b/src/cpu/allwinner/a10/gpio.h
index f285451..709f74b 100644
--- a/src/cpu/allwinner/a10/gpio.h
+++ b/src/cpu/allwinner/a10/gpio.h
@@ -46,6 +46,7 @@ struct a10_gpio {
u32 sdr_pad_pul;
} __attribute__ ((packed));
-void gpio_set_func(u8 port, u8 pin, u8 pad_func);
+void gpio_set_pin_func(u8 port, u8 pin, u8 pad_func);
+void gpio_set_multipin_func(u8 port, u32 pin_mask, u8 pad_func);
#endif /* __CPU_ALLWINNER_A10_PINMUX_H */
diff --git a/src/cpu/allwinner/a10/pinmux.c b/src/cpu/allwinner/a10/pinmux.c
index 083f7ec..bd70102 100644
--- a/src/cpu/allwinner/a10/pinmux.c
+++ b/src/cpu/allwinner/a10/pinmux.c
@@ -11,7 +11,14 @@
static struct a10_gpio *gpio = (void *)GPIO_BASE;
-void gpio_set_func(u8 port, u8 pin, u8 pad_func)
+/**
+ * \brief Set the pad function of a single pin
+ *
+ * @param[in] port GPIO port of the pin (GPA -> GPS)
+ * @param[in] pin the pin number in the given port (1 -> 31)
+ * @param[in] pad_func The peripheral function to which to connect this pin
+ */
+void gpio_set_pin_func(u8 port, u8 pin, u8 pad_func)
{
u8 reg, bit;
u32 reg32;
@@ -28,3 +35,45 @@ void gpio_set_func(u8 port, u8 pin, u8 pad_func)
reg32 |= (pad_func & 0xf) << bit;
write32(reg32, &gpio->port[port].cfg[reg]);
}
+
+/**
+ * \brief Set the pad function of a group of pins
+ *
+ * Multiplex a group of pins to the same pad function. This is useful for
+ * peripherals that use the same function number for several pins. This function
+ * allows those pins to be set with a single call.
+ *
+ * Example:
+ * gpio_set_multipin_func(GPB, (1 << 23) | (1 << 22), 2);
+ *
+ * @param[in] port GPIO port of the pin (GPA -> GPS)
+ * @param[in] pin_mask 32-bit mask indicating which pins to re-multiplex. For
+ * each set bit, the corresponding pin will be multiplexed.
+ * @param[in] pad_func The peripheral function to which to connect the pins
+ */
+void gpio_set_multipin_func(u8 port, u32 pin_mask, u8 pad_func)
+{
+ int j;
+ u8 reg, bit;
+ u32 reg32, mask_offset;
+
+ if ((port > GPS))
+ return;
+
+ for (reg = 0; reg < 4; reg++) {
+ mask_offset = 8 * reg;
+ /* Don't run the inner loop if we're not touching any pins */
+ if (!(pin_mask & (0xff << mask_offset)))
+ continue;
+
+ reg32 = read32(&gpio->port[port].cfg[reg]);
+ for (j = 0; j < 8; j++) {
+ if (!(pin_mask & (1 << (j + mask_offset))))
+ continue;
+ bit = j * 4;
+ reg32 &= ~(0xf << bit);
+ reg32 |= (pad_func & 0xf) << bit;
+ }
+ write32(reg32, &gpio->port[port].cfg[reg]);
+ }
+}
diff --git a/src/mainboard/cubietech/cubieboard/bootblock.c b/src/mainboard/cubietech/cubieboard/bootblock.c
index 6e8b751..a91391c 100644
--- a/src/mainboard/cubietech/cubieboard/bootblock.c
+++ b/src/mainboard/cubietech/cubieboard/bootblock.c
@@ -18,8 +18,8 @@
| AHB_DIV_1 \
| AXI_DIV_1
-#define GPB22_UART0_TX_FUNC 2
-#define GPB23_UART0_RX_FUNC 2
+#define GPB_UART0_FUNC 2
+#define GPB_UART0_PINS ((1 << 22) | (1 << 23))
static void cubieboard_set_sys_clock(void)
{
@@ -57,8 +57,7 @@ static void cubieboard_setup_clocks(void)
static void cubieboard_setup_gpios(void)
{
/* Mux UART pins */
- gpio_set_func(GPB, 22, GPB22_UART0_TX_FUNC);
- gpio_set_func(GPB, 23, GPB23_UART0_RX_FUNC);
+ gpio_set_multipin_func(GPB, GPB_UART0_PINS, GPB_UART0_FUNC);
}
static void cubieboard_enable_uart(void)
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/4579
-gerrit
commit 843f7e9e2d7246638b6f4f577fede101e9f89faf
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Dec 27 16:13:04 2013 -0500
lib/cbfs: Copy stage header to stack before decompressing stage
On SoCs with limited amount of SRAM, we have to cache the romstage in
the same memory block in which it will be used. The header of the
stage is within this cached region, and risks being overwritten by
cbfs_decompress() when called from cbfs_load_stage(). In order to
ensure that the header does not get overwritten, copy it to the stack
and use the information in the stack.
This is especially useful in the bootblock on lower-end ARM SoCs,
which do not have enough SRAM to hold the bootblock, stack, romstage
and the CBFS cache.
Change-Id: Ibb7f769645b02377745d568fe539919f83da8d68
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/lib/cbfs.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 1f44695..bfed6a4 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -256,36 +256,44 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name)
void * cbfs_load_stage(struct cbfs_media *media, const char *name)
{
- struct cbfs_stage *stage = (struct cbfs_stage *)
+ struct cbfs_stage stage;
+ struct cbfs_stage *mm_stage = (struct cbfs_stage *)
cbfs_get_file_content(media, name, CBFS_TYPE_STAGE);
/* this is a mess. There is no ntohll. */
/* for now, assume compatible byte order until we solve this. */
uint32_t entry;
uint32_t final_size;
- if (stage == NULL)
+ if (mm_stage == NULL)
return (void *) -1;
+ /* Copy the stage header to the stack. On ARM SoCs, the memory region
+ * returned by cbfs_get_file_content() may be in the CBFS cache, and if
+ * the stage is to be copied to the same region, the header can be
+ * overwritten by cbfs_decompress().
+ */
+ memcpy(&stage, mm_stage, sizeof(stage));
+
LOG("loading stage %s @ 0x%x (%d bytes), entry @ 0x%llx\n",
name,
- (uint32_t) stage->load, stage->memlen,
- stage->entry);
+ (uint32_t) stage.load, stage.memlen,
+ stage.entry);
- final_size = cbfs_decompress(stage->compression,
- ((unsigned char *) stage) +
+ final_size = cbfs_decompress(stage.compression,
+ ((unsigned char *) mm_stage) +
sizeof(struct cbfs_stage),
- (void *) (uint32_t) stage->load,
- stage->len);
+ (void *) (uint32_t) stage.load,
+ stage.len);
if (!final_size)
return (void *) -1;
/* Stages rely the below clearing so that the bss is initialized. */
- memset((void *)((uintptr_t)stage->load + final_size), 0,
- stage->memlen - final_size);
+ memset((void *)((uintptr_t)stage.load + final_size), 0,
+ stage.memlen - final_size);
DEBUG("stage loaded.\n");
- entry = stage->entry;
+ entry = stage.entry;
// entry = ntohll(stage->entry);
return (void *) entry;
the following patch was just integrated into master:
commit 045fa4586515f2fe0c58460d219a3ecb5af21bdd
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Dec 27 15:21:58 2013 +0100
via: Write »access« without »m« at end
The comment was copied around so fix all occurrences using the following
command.
$ git grep -l accessm | xargs sed -i 's/accessm/access/g'
Change-Id: I46e117c126c0f851cd5e95cf9e42a77ca5f80996
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
See http://review.coreboot.org/4577 for details.
-gerrit
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4578
-gerrit
commit 0cedf048f2b5de9b6f243d0d49c29f35078c9267
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Dec 27 14:14:44 2013 +0100
Revert "amd/car/post_cache_as_ram: Switch stack in assembly rather than in C"
This reverts commit a6c29fe6841ad5e03ddb35803943bed3bc83dfd2 [1].
Testing that change with the Asus M2V-MX SE, resume from suspend to
RAM (S3) hangs at `Clearing initial memory region:`.
[…]
Mem running !
Ram4
v_esp=000cff18
IN TEST WAKEUP
400IN TEST WAKEUP
400CBMEM region 7dee0000-7dffffff (cbmem_reinit)
IN TEST WAKEUP
400Will copy coreboot region to: 7deec000
Copying data from cache to RAM -- switching to use RAM as stack... Done
Disabling cache as ram now
Clearing initial memory region:
Reverting the commit, resume still fails but goes past the above message
until jumping to the image.
[…]
Mem running !
Ram4
v_esp=000cff18
testx = 5a5a5a5a
IN TEST WAKEUP
400IN TEST WAKEUP
400CBMEM region 7dee0000-7dffffff (cbmem_reinit)
Copying data from cache to RAM -- switching to use RAM as stack... Done
testx = 5a5a5a5a
Disabling cache as ram now
Clearing initial memory region: Done
Loading image.
CBFS: CBFS_HEADER_ROM_ADDRESS: 0xfffffb90/0x400000
CBFS: CBFS location: 0x0~0x3ffbb0, align: 64
CBFS: Looking for 'fallback/coreboot_ram' starting from 0x0.
CBFS: - load entry 0x0 file name (16 bytes)...
CBFS: (unmatched file @0x0: cmos_layout.bin)
CBFS: - load entry 0x800 file name (32 bytes)...
CBFS: (unmatched file @0x800: fallback/romstage)
CBFS: - load entry 0xea00 file name (32 bytes)...
CBFS: Found file (offset=0xea38, len=61691).
CBFS: loading stage fallback/coreboot_ram @ 0x100000 (503872 bytes),
entry @ 0x100000
CBFS: stage loaded.
Jumping to image.
Therefore revert this change for now until a better tested patch is
available.
[1] http://review.coreboot.org/4286
Change-Id: I10f6f1b2c7bbcb501990cd023aafe6e87eab7586
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/cpu/amd/car/cache_as_ram.inc | 12 ------------
src/cpu/amd/car/post_cache_as_ram.c | 25 +++++++++++++++----------
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/src/cpu/amd/car/cache_as_ram.inc b/src/cpu/amd/car/cache_as_ram.inc
index 8f0abce..7070cf9 100644
--- a/src/cpu/amd/car/cache_as_ram.inc
+++ b/src/cpu/amd/car/cache_as_ram.inc
@@ -414,22 +414,10 @@ CAR_FAM10_ap_out:
pushl %ebx /* Init detected. */
pushl %eax /* BIST */
call cache_as_ram_main
-
/* We will not go back. */
post_code(0xaf) /* Should never see this POST code. */
- .globl cache_as_ram_switch_stack
-
-cache_as_ram_switch_stack:
- /* Return address. */
- popl %eax
- /* Resume memory. */
- popl %eax
- subl $(( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) )), %esp
- pushl %eax
- call cache_as_ram_new_stack
-
all_mtrr_msrs:
/* fixed MTRR MSRs */
.long MTRRfix64K_00000_MSR
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c
index 3fe496e..eca7673 100644
--- a/src/cpu/amd/car/post_cache_as_ram.c
+++ b/src/cpu/amd/car/post_cache_as_ram.c
@@ -75,11 +75,11 @@ static void vErrata343(void)
#endif
}
-void cache_as_ram_switch_stack(void *resume_backup_memory);
-
static void post_cache_as_ram(void)
{
- void *resume_backup_memory = NULL;
+#if CONFIG_HAVE_ACPI_RESUME
+ void *resume_backup_memory;
+#endif
#if 1
{
/* Check value of esp to verify if we have enough room for stack in Cache as RAM */
@@ -92,6 +92,9 @@ static void post_cache_as_ram(void)
}
#endif
+ unsigned testx = 0x5a5a5a5a;
+ print_debug_pcar("testx = ", testx);
+
/* copy data from cache as ram to
ram need to set CONFIG_RAMTOP to 2M and use var mtrr instead.
*/
@@ -109,19 +112,21 @@ static void post_cache_as_ram(void)
vErrata343();
memcopy((void *)((CONFIG_RAMTOP)-CONFIG_DCACHE_RAM_SIZE), (void *)CONFIG_DCACHE_RAM_BASE, CONFIG_DCACHE_RAM_SIZE); //inline
- cache_as_ram_switch_stack(resume_backup_memory);
-}
-void
-cache_as_ram_new_stack (void *resume_backup_memory);
+ __asm__ volatile (
+ /* set new esp */ /* before CONFIG_RAMBASE */
+ "subl %0, %%esp\n\t"
+ ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) )
+ /* discard all registers (eax is used for %0), so gcc redoes everything
+ after the stack is moved */
+ : "cc", "memory", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp"
+ );
-void
-cache_as_ram_new_stack (void *resume_backup_memory __attribute__ ((unused)))
-{
/* We can put data to stack again */
/* only global variable sysinfo in cache need to be offset */
print_debug("Done\n");
+ print_debug_pcar("testx = ", testx);
print_debug("Disabling cache as ram now \n");
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4578
-gerrit
commit f617dbe623e38b68a615a3727542675386ea61e8
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Dec 27 14:14:44 2013 +0100
Revert "amd/car/post_cache_as_ram: Switch stack in assembly rather than in C"
This reverts commit a6c29fe6841ad5e03ddb35803943bed3bc83dfd2 [1].
Testing that change with the Asus M2V-MX SE, resume from suspend to
RAM (S3) hangs at `Clearing initial memory region:`.
[…]
Mem running !
Ram4
v_esp=000cff28
IN TEST WAKEUP
400CBMEM TOC is at: 7dee0000
CBMEM TOC 0-size: 7e001000
Re-Initializing CBMEM area to 0x7dee0000
Will copy coreboot region to: 7deec000
Copying data from cache to RAM -- switching to use RAM as stack... Done
Disabling cache as ram now
Clearing initial memory region:
Reverting the commit, resume still fails but goes past the above message
until jumping to the image.
[…]
Mem running !
Ram4
v_esp=000cff18
testx = 5a5a5a5a
IN TEST WAKEUP
400IN TEST WAKEUP
400CBMEM region 7dee0000-7dffffff (cbmem_reinit)
Copying data from cache to RAM -- switching to use RAM as stack... Done
testx = 5a5a5a5a
Disabling cache as ram now
Clearing initial memory region: Done
Loading image.
CBFS: CBFS_HEADER_ROM_ADDRESS: 0xfffffb90/0x400000
CBFS: CBFS location: 0x0~0x3ffbb0, align: 64
CBFS: Looking for 'fallback/coreboot_ram' starting from 0x0.
CBFS: - load entry 0x0 file name (16 bytes)...
CBFS: (unmatched file @0x0: cmos_layout.bin)
CBFS: - load entry 0x800 file name (32 bytes)...
CBFS: (unmatched file @0x800: fallback/romstage)
CBFS: - load entry 0xea00 file name (32 bytes)...
CBFS: Found file (offset=0xea38, len=61691).
CBFS: loading stage fallback/coreboot_ram @ 0x100000 (503872 bytes),
entry @ 0x100000
CBFS: stage loaded.
Jumping to image.
Therefore revert this change for now until a better tested patch is
available.
[1] http://review.coreboot.org/4286
Change-Id: I10f6f1b2c7bbcb501990cd023aafe6e87eab7586
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/cpu/amd/car/cache_as_ram.inc | 12 ------------
src/cpu/amd/car/post_cache_as_ram.c | 25 +++++++++++++++----------
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/src/cpu/amd/car/cache_as_ram.inc b/src/cpu/amd/car/cache_as_ram.inc
index 8f0abce..7070cf9 100644
--- a/src/cpu/amd/car/cache_as_ram.inc
+++ b/src/cpu/amd/car/cache_as_ram.inc
@@ -414,22 +414,10 @@ CAR_FAM10_ap_out:
pushl %ebx /* Init detected. */
pushl %eax /* BIST */
call cache_as_ram_main
-
/* We will not go back. */
post_code(0xaf) /* Should never see this POST code. */
- .globl cache_as_ram_switch_stack
-
-cache_as_ram_switch_stack:
- /* Return address. */
- popl %eax
- /* Resume memory. */
- popl %eax
- subl $(( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) )), %esp
- pushl %eax
- call cache_as_ram_new_stack
-
all_mtrr_msrs:
/* fixed MTRR MSRs */
.long MTRRfix64K_00000_MSR
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c
index 3fe496e..eca7673 100644
--- a/src/cpu/amd/car/post_cache_as_ram.c
+++ b/src/cpu/amd/car/post_cache_as_ram.c
@@ -75,11 +75,11 @@ static void vErrata343(void)
#endif
}
-void cache_as_ram_switch_stack(void *resume_backup_memory);
-
static void post_cache_as_ram(void)
{
- void *resume_backup_memory = NULL;
+#if CONFIG_HAVE_ACPI_RESUME
+ void *resume_backup_memory;
+#endif
#if 1
{
/* Check value of esp to verify if we have enough room for stack in Cache as RAM */
@@ -92,6 +92,9 @@ static void post_cache_as_ram(void)
}
#endif
+ unsigned testx = 0x5a5a5a5a;
+ print_debug_pcar("testx = ", testx);
+
/* copy data from cache as ram to
ram need to set CONFIG_RAMTOP to 2M and use var mtrr instead.
*/
@@ -109,19 +112,21 @@ static void post_cache_as_ram(void)
vErrata343();
memcopy((void *)((CONFIG_RAMTOP)-CONFIG_DCACHE_RAM_SIZE), (void *)CONFIG_DCACHE_RAM_BASE, CONFIG_DCACHE_RAM_SIZE); //inline
- cache_as_ram_switch_stack(resume_backup_memory);
-}
-void
-cache_as_ram_new_stack (void *resume_backup_memory);
+ __asm__ volatile (
+ /* set new esp */ /* before CONFIG_RAMBASE */
+ "subl %0, %%esp\n\t"
+ ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) )
+ /* discard all registers (eax is used for %0), so gcc redoes everything
+ after the stack is moved */
+ : "cc", "memory", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp"
+ );
-void
-cache_as_ram_new_stack (void *resume_backup_memory __attribute__ ((unused)))
-{
/* We can put data to stack again */
/* only global variable sysinfo in cache need to be offset */
print_debug("Done\n");
+ print_debug_pcar("testx = ", testx);
print_debug("Disabling cache as ram now \n");