Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
soc/amd/picasso: Add bootblock
The original plan for Picasso was to always combine features of bootblock with its romstage due to its unique way of coming out of reset. The arch and cpu implementations for RESET_VECTOR_IN_RAM are simplified now, allowing the option of running a more traditional bootblock, albeit in system DRAM.
Create a new early.c file to contain the initial steps required, regardless of whether the first stage is bootblock or eventually romstage. Add bootblock files containing functions that lib/bootblock expects. Modify Makefile.inc to automatically determine the BIOS image's base and size.
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S A src/soc/amd/picasso/early.c A src/soc/amd/picasso/include/soc/early.h 6 files changed, 258 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/1
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig index 56c7da7..cbee93d 100644 --- a/src/soc/amd/picasso/Kconfig +++ b/src/soc/amd/picasso/Kconfig @@ -26,6 +26,7 @@ select ARCH_VERSTAGE_X86_32 select ARCH_ROMSTAGE_X86_32 select ARCH_RAMSTAGE_X86_32 + select RESET_VECTOR_IN_RAM select X86_AMD_FIXED_MTRRS select X86_AMD_INIT_SIPI select ACPI_AMD_HARDWARE_SLEEP_VALUES @@ -55,10 +56,6 @@ select SSE2 select RTC
-config HAVE_BOOTBLOCK - bool - default n - config PRERAM_CBMEM_CONSOLE_SIZE hex default 0x1600 @@ -213,6 +210,28 @@
menu "PSP Configuration Options"
+config X86_RESET_VECTOR + hex + default 0x807fff0 + +config C_ENV_BOOTBLOCK_SIZE + hex + default 0x80000 + +config EARLYRAM_BSP_STACK_SIZE + hex + default 0x800 + help + The amount of stack allocated to the bootstrap core before ramstage. + +config RAM_RESET_VECTOR_STAGE_BSS_SIZE + hex + depends on RESET_VECTOR_IN_RAM + default 0x50000 + help + A common region of DRAM is allocated for use as .bss for all + pre-ramstage stages. + config AMDFW_OUTSIDE_CBFS bool "The AMD firmware is outside CBFS" default n diff --git a/src/soc/amd/picasso/Makefile.inc b/src/soc/amd/picasso/Makefile.inc index 76a4d70..b0cce26 100644 --- a/src/soc/amd/picasso/Makefile.inc +++ b/src/soc/amd/picasso/Makefile.inc @@ -37,8 +37,19 @@ subdirs-y += ../../../cpu/x86/pae subdirs-y += ../../../cpu/x86/smm
+bootblock-y += bootblock/pre_c.S +bootblock-y += bootblock/bootblock.c +bootblock-y += early.c +bootblock-y += southbridge.c +bootblock-y += i2c.c +bootblock-$(CONFIG_PICASSO_UART) += uart.c +bootblock-y += tsc_freq.c +bootblock-y += gpio.c +bootblock-y += smi_util.c + romstage-y += i2c.c romstage-y += romstage.c +romstage-y += early.c romstage-y += gpio.c romstage-y += pmutil.c romstage-y += reset.c @@ -56,12 +67,6 @@ verstage-$(CONFIG_PICASSO_UART) += uart.c verstage-y += tsc_freq.c
-postcar-y += monotonic_timer.c -postcar-$(CONFIG_PICASSO_UART) += uart.c -postcar-y += memmap.c -postcar-$(CONFIG_VBOOT_MEASURED_BOOT) += i2c.c -postcar-y += tsc_freq.c - ramstage-y += i2c.c ramstage-y += chip.c ramstage-y += cpu.c @@ -204,8 +209,15 @@
# type = 0x62 PSP_BIOSBIN_FILE=$(obj)/amd_biospsp.img -PSP_BIOSBIN_DEST=$(CONFIG_ROMSTAGE_ADDR) -PSP_BIOSBIN_SIZE=$(CONFIG_RAM_RESET_VECTOR_STAGE_SIZE) +PSP_ELF_FILE=$(obj)/cbfs/fallback/bootblock.elf +PSP_BIOSBIN_SIZE=$(CONFIG_C_ENV_BOOTBLOCK_SIZE) +PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE))) + +## INTERM=$(shell printf "%x" $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10)) +## $(warning INTERM: $(INTERM)) + +## $(warning PSP_BIOSBIN_DEST: $(CONFIG_X86_RESET_VECTOR) $(INTERM): $(PSP_BIOSBIN_DEST)) +## #$(shell printf "%d" $(CONFIG_STACK_SIZE))
# type = 0x63 PSP_APOBNV_BASE=$(CONFIG_PSP_APOB_NV_ADDRESS) @@ -287,6 +299,12 @@ OPT_PSP_UCODE_FILE3=$(call add_opt_prefix, $(PSP_UCODE_FILE3), --instance 2 --ucode) OPT_MP2CFG_FILE=$(call add_opt_prefix, $(PSP_MP2CFG_FILE), --mp2-config)
+$(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS) + rm -f $@ + @printf " AMDCOMPRS $(subst $(obj)/,,$(@))\n" + $(AMDCOMPRESS) --infile $(PSP_ELF_FILE) --outfile $@ --compress \ + --maxsize $(PSP_BIOSBIN_SIZE) + $(obj)/amdfw.rom: $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)) \ $(call strip_quotes, $(PUBSIGNEDKEY_FILE)) \ $(call strip_quotes, $(PSPBTLDR_FILE)) \ @@ -391,13 +409,6 @@ --location $(shell printf "0x%x" $(PICASSO_FWM_POSITION)) \ --output $@
-USE_BIOS_FILE=$(obj)/cbfs/fallback/romstage.elf -$(PSP_BIOSBIN_FILE): $(obj)/cbfs/fallback/romstage.elf $(AMDCOMPRESS) - rm -f $@ - @printf " AMDCOMPRS $(subst $(obj)/,,$(@))\n" - $(AMDCOMPRESS) --infile $(USE_BIOS_FILE) --outfile $@ --compress \ - --maxsize $(PSP_BIOSBIN_SIZE) - ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y) PHONY+=add_amdfw INTERMEDIATE+=add_amdfw diff --git a/src/soc/amd/picasso/bootblock/bootblock.c b/src/soc/amd/picasso/bootblock/bootblock.c new file mode 100644 index 0000000..e448e1b --- /dev/null +++ b/src/soc/amd/picasso/bootblock/bootblock.c @@ -0,0 +1,35 @@ +/* + * This file is part of the coreboot project. + * + * 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. + */ + +#include <stdint.h> +#include <bootblock_common.h> +#include <soc/early.h> +#include <timestamp.h> + +asmlinkage void bootblock_c_entry(uint64_t base_timestamp) +{ + amd_initmmio(); + set_caching(); + + bootblock_main_with_basetime(base_timestamp); +} + +void bootblock_soc_early_init(void) +{ + soc_pre_console_init(); +} + +void bootblock_soc_init(void) +{ + soc_post_console_init(); +} diff --git a/src/soc/amd/picasso/bootblock/pre_c.S b/src/soc/amd/picasso/bootblock/pre_c.S new file mode 100644 index 0000000..ccff7e6 --- /dev/null +++ b/src/soc/amd/picasso/bootblock/pre_c.S @@ -0,0 +1,45 @@ +/* + * This file is part of the coreboot project. + * + * 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. + */ + +#include <cpu/x86/post_code.h> + +/* + * on entry: + * mm0: BIST (ignored) + * mm2_mm1: timestamp at bootblock_protected_mode_entry + */ + +.global bootblock_pre_c_entry +bootblock_pre_c_entry: + post_code(0xa0) + + movl $_eearlyram_stack, %esp + + /* Align the stack and keep aligned for call to bootblock_c_entry() */ + and $0xfffffff0, %esp + sub $8, %esp + + movd %mm2, %eax + pushl %eax /* tsc[63:32] */ + movd %mm1, %eax + pushl %eax /* tsc[31:0] */ + + post_code(0xa2) + + call bootblock_c_entry + /* Never reached */ + +.halt_forever: + post_code(POST_DEAD_CODE) + hlt + jmp .halt_forever diff --git a/src/soc/amd/picasso/early.c b/src/soc/amd/picasso/early.c new file mode 100644 index 0000000..7b03a62 --- /dev/null +++ b/src/soc/amd/picasso/early.c @@ -0,0 +1,99 @@ +/* + * This file is part of the coreboot project. + * + * 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. + */ + +#include <stdint.h> +#include <cpu/x86/cache.h> +#include <cpu/x86/msr.h> +#include <cpu/amd/msr.h> +#include <cpu/x86/mtrr.h> +#include <cpu/amd/mtrr.h> +#include <console/console.h> +#include <soc/early.h> +#include <soc/southbridge.h> + +void amd_initmmio(void) +{ + msr_t mmconf; + + mmconf.hi = 0; + mmconf.lo = CONFIG_MMCONF_BASE_ADDRESS | MMIO_RANGE_EN + | fms(CONFIG_MMCONF_BUS_NUMBER) << MMIO_BUS_RANGE_SHIFT; + wrmsr(MMIO_CONF_BASE, mmconf); +} + +static const unsigned int fixed_mtrrs[] = { + MTRR_FIX_64K_00000, + MTRR_FIX_16K_80000, + MTRR_FIX_16K_A0000, + MTRR_FIX_4K_C0000, + MTRR_FIX_4K_C8000, + MTRR_FIX_4K_D0000, + MTRR_FIX_4K_D8000, + MTRR_FIX_4K_E0000, + MTRR_FIX_4K_E8000, + MTRR_FIX_4K_F0000, + MTRR_FIX_4K_F8000, +}; + +void set_caching(void) +{ + msr_t deftype, syscfg, rwmem; + int mtrr; + int i; + + syscfg = rdmsr(SYSCFG_MSR); + syscfg.lo |= SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn + | SYSCFG_MSR_MtrrVarDramEn; + wrmsr(SYSCFG_MSR, syscfg); + + /* Write all as MTRR_READ_MEM | MTRR_WRITE_MEM to send cycles to DRAM */ + rwmem.hi = rwmem.lo = 0x18181818; + for (i = 0 ; i < ARRAY_SIZE(fixed_mtrrs) ; i++) + wrmsr(fixed_mtrrs[i], rwmem); + + syscfg.lo &= ~(SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn); + wrmsr(SYSCFG_MSR, syscfg); + + deftype = rdmsr(MTRR_DEF_TYPE_MSR); + deftype.lo &= ~MTRR_DEF_TYPE_MASK; + deftype.lo |= MTRR_DEF_TYPE_EN | MTRR_DEF_TYPE_FIX_EN | MTRR_TYPE_UNCACHEABLE; + wrmsr(MTRR_DEF_TYPE_MSR, deftype); + + mtrr = get_free_var_mtrr(); + if (mtrr < 0) + return; + set_var_mtrr(mtrr, FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT); + + mtrr = get_free_var_mtrr(); + if (mtrr < 0) + return; + set_var_mtrr(mtrr, RESET_VECTOR_STAGE_BASE, RESET_VECTOR_STAGE_SIZE, + MTRR_TYPE_WRBACK); + + enable_cache(); +} + +void soc_pre_console_init(void) +{ + sb_reset_i2c_slaves(); + fch_pre_init(); +} + +void soc_post_console_init(void) +{ + u32 val = cpuid_eax(1); + printk(BIOS_DEBUG, "Family_Model: %08x\n", val); + + fch_early_init(); + i2c_soc_early_init(); +} diff --git a/src/soc/amd/picasso/include/soc/early.h b/src/soc/amd/picasso/include/soc/early.h new file mode 100644 index 0000000..8eb2645 --- /dev/null +++ b/src/soc/amd/picasso/include/soc/early.h @@ -0,0 +1,30 @@ +/* + * This file is part of the coreboot project. + * + * 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. + */ + +#ifndef __PICASSO_EARLY_H__ +#define __PICASSO_EARLY_H__ + +#define RESET_VECTOR_STAGE_TOP (CONFIG_X86_RESET_VECTOR + 0x10) +#define RESET_VECTOR_STAGE_SIZE CONFIG_C_ENV_BOOTBLOCK_SIZE +#define RESET_VECTOR_STAGE_BASE (RESET_VECTOR_STAGE_TOP - RESET_VECTOR_STAGE_SIZE) + +#if (RESET_VECTOR_STAGE_BASE & (RESET_VECTOR_STAGE_SIZE - 1)) +#error "Adjust reset vector and program size for better MTRR coverage" +#endif + +void amd_initmmio(void); +void set_caching(void); +void soc_pre_console_init(void); +void soc_post_console_init(void); + +#endif /* __PICASSO_EARLY_H__ */
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
(2 comments)
Because of the separation with util/cbfstool/amdcompress, there is a bunch of redundant parameters passed on commandline, while the information could be derived from ELF headers. IMHO, once we have created the final ELF it should be forbidden to reference the Kconfigs that were used inside the linker scripts.
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE))) I believe we would want to avoid new references to C_ENV_BOOTBLOCK_SIZE and take the actual uncompressed progsz from ELF headers.
As for the reference to X86_RESET_VECTOR, I had a look at some (leaked to me via virtual directory listing) datasheets and it is more powerful in expression than it needs to be since hardware is wired at IP=fff0. You would avoid the reference and calculation here if you had made amdfwtool parse the ELF (and optionally compress too).
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 301: $(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS) I am looking at CB:33401 where util/cbfstool/amdcompress.c was introduced and I am not so happy about it. AFAICS it has nothing to do with CBFS and the feature it implements should have been incorporated inside util/amdfwtool instead.
Marshall Dawson has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
(3 comments)
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
I believe we would want to avoid new references to C_ENV_BOOTBLOCK_SIZE and take the actual uncompre […]
Re. amdfwtool, the comment at CB:33759 picasso/Makefile.inc#211 applies here too. Re. "hardware is wired at IP=fff0", yeah I'd suspect that's true but it certainly matches the documented behavior. However, that's not my goal here. The benefit to using C_ENV_BOOTBLOCK_SIZE and X86_RESET_VECTOR+0x10-n is to have those base/size values later when I need to reserve that RAM. An alternative _might_ be to parse the PSP table instead, but I prefer not to do that work until vboot is completely implemented and functioning.
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 219: ## #$(shell printf "%d" $(CONFIG_STACK_SIZE)) whoops
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 301: $(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS)
I am looking at CB:33401 where util/cbfstool/amdcompress. […]
Ack
It had started out in a brand new amd utility. I don't recall the reasoning, now, behind the request to put it in cbfstool. I'm not opposed to moving it to amdfwtool but we still have the challenge of how to put the biosbin outside of amdfw.rom (as mentioned elsewhere).
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 301: $(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS)
Ack […]
IMHO it should just be forbidden for PSP directory to keep pointers outside amdfw.rom.
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
Patrick, Aaron, Nico: Can you share your opinions on my comments in patch set 4, wrt. using Kconfig symbols as commandline parameters vs. deriving necessary data from ELF headers. And in general, about the placement of amdcompress under util/cbfstool and not integrating it with amdfwtool. Thanks.
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
Patch Set 4:
Patrick, Aaron, Nico: Can you share your opinions on my comments in patch set 4, wrt. using Kconfig symbols as commandline parameters vs. deriving necessary data from ELF headers. And in general, about the placement of amdcompress under util/cbfstool and not integrating it with amdfwtool. Thanks.
It was my understanding that Marshall is updating the patchset further. As for amdfwtool amdcompress I'm not familiar with the requirements currently. However, the compression requirements are orthogonal to just building the bootblock correctly. If the bootblock is linked correctly I would expect we could pull symbols out for driving utilities. However, we should be aware that we would need to mark this memory (where bootblock resides) as reserved. Typically we do that through cbmem and ensuring these programs live in cbmem. However, bootblock wouldn't have cbmem up yet so we need to ensure the use memory is reserved (both bootblock and romstage) in order to handle everything correctly for s3 transit.
Marshall Dawson has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
Patch Set 4:
Patch Set 4:
Patrick, Aaron, Nico: Can you share your opinions on my comments in patch set 4, wrt. using Kconfig symbols as commandline parameters vs. deriving necessary data from ELF headers. And in general, about the placement of amdcompress under util/cbfstool and not integrating it with amdfwtool. Thanks.
It was my understanding that Marshall is updating the patchset further. As for amdfwtool amdcompress I'm not familiar with the requirements currently. However, the compression requirements are orthogonal to just building the bootblock correctly. If the bootblock is linked correctly I would expect we could pull symbols out for driving utilities. However, we should be aware that we would need to mark this memory (where bootblock resides) as reserved. Typically we do that through cbmem and ensuring these programs live in cbmem. However, bootblock wouldn't have cbmem up yet so we need to ensure the use memory is reserved (both bootblock and romstage) in order to handle everything correctly for s3 transit.
Correct, I have patches in the works nearly ready to push. However, I have been explicitly requested by multiple parties to hold that work and complete some other tasks first. I apologize for the delay. In the interim, please don't read too much into the state of these early patches which were designed to accommodate 2 different boot options, i.e. one for bootblock followed by romstage, and another combining the two. The new version will be significantly cleaner.
I really prefer deferring the decision on moving the compression into amdfwtool, and harvesting elf information for auto-generating the pointer's base and size. As mentioned in the makefile PS4 l.213, decisions made as vboot is developed could refined may require alterations to any work done in now amdfwtool.
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock ......................................................................
Patch Set 4:
Patch Set 4:
Patch Set 4:
Patch Set 4:
Patrick, Aaron, Nico: Can you share your opinions on my comments in patch set 4, wrt. using Kconfig symbols as commandline parameters vs. deriving necessary data from ELF headers. And in general, about the placement of amdcompress under util/cbfstool and not integrating it with amdfwtool. Thanks.
It was my understanding that Marshall is updating the patchset further. As for amdfwtool amdcompress I'm not familiar with the requirements currently. However, the compression requirements are orthogonal to just building the bootblock correctly. If the bootblock is linked correctly I would expect we could pull symbols out for driving utilities. However, we should be aware that we would need to mark this memory (where bootblock resides) as reserved. Typically we do that through cbmem and ensuring these programs live in cbmem. However, bootblock wouldn't have cbmem up yet so we need to ensure the use memory is reserved (both bootblock and romstage) in order to handle everything correctly for s3 transit.
Correct, I have patches in the works nearly ready to push. However, I have been explicitly requested by multiple parties to hold that work and complete some other tasks first. I apologize for the delay. In the interim, please don't read too much into the state of these early patches which were designed to accommodate 2 different boot options, i.e. one for bootblock followed by romstage, and another combining the two. The new version will be significantly cleaner.
I really prefer deferring the decision on moving the compression into amdfwtool, and harvesting elf information for auto-generating the pointer's base and size. As mentioned in the makefile PS4 l.213, decisions made as vboot is developed could refined may require alterations to any work done in now amdfwtool.
Sounds good to me. I can proceed with bootblock size optimisations, just that amd/picasso will continue to use the static size in the makefiles. In the long run, I am not sure if amd/picasso needs Kconfig C_ENV_BOOTBLOCK_SIZE but we'll figure it out later.
Hello Aaron Durbin, build bot (Jenkins), Nico Huber, Raul Rangel, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/37490
to look at the new patch set (#5).
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Remove postcar support completely from Makefile.inc. Make Makefile.inc calculate the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool.
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 127 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/5
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 5:
Patch Set 4:
Patch Set 4:
Patrick, Aaron, Nico: Can you share your opinions on my comments in patch set 4, wrt. using Kconfig symbols as commandline parameters vs. deriving necessary data from ELF headers. And in general, about the placement of amdcompress under util/cbfstool and not integrating it with amdfwtool. Thanks.
It was my understanding that Marshall is updating the patchset further. As for amdfwtool amdcompress I'm not familiar with the requirements currently. However, the compression requirements are orthogonal to just building the bootblock correctly. If the bootblock is linked correctly I would expect we could pull symbols out for driving utilities. However, we should be aware that we would need to mark this memory (where bootblock resides) as reserved. Typically we do that through cbmem and ensuring these programs live in cbmem. However, bootblock wouldn't have cbmem up yet so we need to ensure the use memory is reserved (both bootblock and romstage) in order to handle everything correctly for s3 transit.
My review was not about runtime operation at all, but complaints about the introduced redundancy, where values that are already present in ELF headers are regenerated in Makefile.inc from the Kconfig variables.
Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
Re. amdfwtool, the comment at CB:33759 picasso/Makefile.inc#211 applies here too. Re. […]
Marshall, can you file a bug to look at parsing the PSP table, and we can follow up on it after vboot is done?
Maybe add a TODO here?
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 219: ## #$(shell printf "%d" $(CONFIG_STACK_SIZE))
whoops
Done?
Felix Held has uploaded a new patch set (#7) to the change originally created by Marshall Dawson. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Remove postcar support completely from Makefile.inc. Make Makefile.inc calculate the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool.
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 107 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/7
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 7:
(2 comments)
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
Marshall, can you file a bug to look at parsing the PSP table, and we can follow up on it after vboo […]
not sure what to do about this right now. is it ok when i close this issue for now?
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 219: ## #$(shell printf "%d" $(CONFIG_STACK_SIZE))
Done?
Done
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 7:
(6 comments)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig... PS7, Line 225: 0x807fff0 Is this architectural?
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... PS7, Line 44: bootblock-y += smi_util.c What's this?
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 14: static void amd_initmmio(void) If this is only about PCI config space, please name it accordingly.
Um, wait... isn't this the same as enable_pci_mmconf()?
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 34: sb_reset_i2c_slaves(); How is this expected to make a difference for consoles? Why is this done before and in fch_pre_init()?
Also, I've peeked into it. It seems it might keep pins floating for a moment if they are actually used as GPO instead of I2C for a board. That is, if AMD allows such designs. Where is that documented?
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 41: Family_Model In its encoded form, it's usually called cpuid signature. You can decode it with get_fms().
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 44: i2c_soc_early_init(); I'm new to AMD. Is there any system behind these sb_, fch_, soc_ prefixes?
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 7:
(4 comments)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig... PS7, Line 225: 0x807fff0
Is this architectural?
the last 16 bits are architectural; have to look into the first 16 bits, but my guess would be that they are not architectural
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... PS7, Line 44: bootblock-y += smi_util.c
What's this?
some functions in there are used by the gpio setup function. will look into this as this indeed smells a bit weird to me
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 14: static void amd_initmmio(void)
If this is only about PCI config space, please name it accordingly. […]
it is; good catch. removed it and as expected mandolin still boots. will marks as resolved when i've pushed the new version of this patch
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 44: i2c_soc_early_init();
I'm new to AMD. […]
I'm also rather new to AMD. will look into that
Felix Held has uploaded a new patch set (#8) to the change originally created by Marshall Dawson. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Remove postcar support completely from Makefile.inc. Make Makefile.inc calculate the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool.
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 96 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/8
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 14: static void amd_initmmio(void)
it is; good catch. removed it and as expected mandolin still boots. […]
Done
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 8:
(2 comments)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig... PS7, Line 225: 0x807fff0
the last 16 bits are architectural; have to look into the first 16 bits, but my guess would be that […]
I'm wondering if this needs to be kept in sync with hardware or software (e.g. PSP firmware).
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... PS7, Line 44: bootblock-y += smi_util.c
some functions in there are used by the gpio setup function. […]
There is also SCI configuration in there which makes a bit more sense, however I couldn't find the exact path that leads there. Also wondering what exactly is needed in the bootblock, on some Intel platforms we do GPIO configuration much later, in the ramstage.
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 9:
(6 comments)
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... PS9, Line 207: 0x10 Why the magic number?
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 34: sb_reset_i2c_slaves();
How is this expected to make a difference for consoles? Why is this done […]
+1. I think we can remove this here. fch_pre_init will take care of it.
We do want the pins to float: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/th...
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 41: Family_Model
In its encoded form, it's usually called cpuid signature. You can decode […]
This was the same format that was followed on stoney: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/th...
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 44: i2c_soc_early_init();
I'm also rather new to AMD. […]
I think sb_ and fch_ are synonyms. As for why i2c has _soc_ in the name, I don't know. The I2C block is under the FCH.
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... PS9, Line 7: cpu/amd/msr.h Maybe just arch/cpu.h?
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... PS9, Line 8: #include <cpu/x86/mtrr.h> Is this one used?
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 9:
(2 comments)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 34: sb_reset_i2c_slaves();
We do want the pins to float:
If they are used for I2C, yes. But I see no documentation that states that it will always be the case and neither mainboard configuration taken into account (in case it isn't).
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 44: i2c_soc_early_init();
I think sb_ and fch_ are synonyms. As for why i2c has _soc_ in the name, I don't know. […]
Well, SoC includes the FCH... so that's technically not wrong.
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 9:
(4 comments)
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig... PS9, Line 221: menu "PSP Configuration Options" Bootblock parameters are not PSP configuraion options.
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig... PS9, Line 235: config AMDFW_OUTSIDE_CBFS off-topic
https://ticket.coreboot.org/issues/224
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
not sure what to do about this right now. […]
"The benefit to using C_ENV_BOOTBLOCK_SIZE and X86_RESET_VECTOR+0x10-n is to have those base/size values later when I need to reserve that RAM."
Can I review that part somewhere? They were not used in CB:38702 that deals with these RAM reservations. I do not understand how parsing PSP table would come to play.
I can see you abandoned CB:33759, but my question there (and below), if it will be allowed for you to have PSP table point outside amdfw.rom is still open and relevant. I am not saying it is forbidden but someone else might since it is sort of crossing two filesystems (CBFS and PSP layout) with some absolute (or relative) addressing.
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... PS9, Line 207: 0x10
Why the magic number?
I've raised questions some questions in patchset #4 and the solution seems to be to mention possible future work on this area in the commit message. It is 0x10 because vector ends with 0xfff0, int-align might be more correct.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 34: sb_reset_i2c_slaves();
We do want the pins to float: […]
Ok, these pins are indeed very I2C specific. Even in GPIO mode, they cannot be configured to drive a 1, so that makes them useless for any design with a floating output.
You can ignore my floating pin concerns.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 11:
(6 comments)
https://review.coreboot.org/c/coreboot/+/37490/11//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/37490/11//COMMIT_MSG@16 PS11, Line 16: Remove postcar support : completely from Makefile.inc. This is not really true for the change anymore.
https://review.coreboot.org/c/coreboot/+/37490/11//COMMIT_MSG@21 PS11, Line 21: Can you please add appropriate BUG= to commit message?
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 208: $(obj)/cbfs/fallback $(objcbfs)
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 208: bootblock.elf Don't you really want to just use bootblock.bin here?
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 209: $(CONFIG_C_ENV_BOOTBLOCK_SIZE) I believe you can just use file-size bootblock.bin here?
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... PS11, Line 24: pre_init( These are named in a weird way. bootblock_soc_early_init() calls function with *_pre_init() and bootblock_soc_init() calls functions with *_early_init(). I understand these were not added in this CL. But just noting the naming inconsistency.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 11:
(12 comments)
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Kconfig... PS7, Line 225: 0x807fff0
I'm wondering if this needs to be kept in sync with hardware or software (e.g. PSP firmware).
No, you can basically select any location in DRAM. Information about this is passed into BIOS directory table.
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig... PS9, Line 221: menu "PSP Configuration Options"
Bootblock parameters are not PSP configuraion options.
Felix - this is not yet addressed.
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
not sure what to do about this right now. is it ok when i close this issue for now?
Felix - can you please raise a bug to capture the points raised by Kyosti and Marshall here? And update commit message to indicate that this will be followed up with updates referencing the bug?
"The benefit to using C_ENV_BOOTBLOCK_SIZE and X86_RESET_VECTOR+0x10-n is to have those base/size values later when I need to reserve that RAM."
I don't think that is correct or required. I believe this is primarily being done for S3. Let's take that up separately as part of S3 implementation.
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... PS7, Line 44: bootblock-y += smi_util.c
There is also SCI configuration in there which makes a bit more sense, however […]
Felix - did you check if all these files are required?
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... PS9, Line 207: 0x10
I've raised questions some questions in patchset #4 and the solution seems to be to mention possible […]
Felix - can you please address this?
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 34: sb_reset_i2c_slaves();
Ok, these pins are indeed very I2C specific. Even in GPIO mode, they […]
Done
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 41: Family_Model
This was the same format that was followed on stoney: https://source.chromium. […]
Let's keep this as Family Model for now for consistency. If there is a change required, it can be done as follow-up.
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 44: i2c_soc_early_init();
Well, SoC includes the FCH... so that's technically not wrong.
This seems consistent with what stoneyridge did. If there is clean up required, let's do that as follow-up.
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... PS9, Line 7: cpu/amd/msr.h
Maybe just arch/cpu. […]
Not yet addressed?
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... PS9, Line 8: #include <cpu/x86/mtrr.h>
Is this one used?
Doesn't look like this is used.
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... PS11, Line 6: #include <console/console.h> This is not required.
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... PS11, Line 9: #include <timestamp.h> Not required.
Raul Rangel has uploaded a new patch set (#12) to the change originally created by Marshall Dawson. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Make Makefile.inc calculates the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool. See b/154957411.
BUG=b:147042464
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 96 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/12
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 12:
(15 comments)
PTAL
https://review.coreboot.org/c/coreboot/+/37490/11//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/37490/11//COMMIT_MSG@16 PS11, Line 16: Remove postcar support : completely from Makefile.inc.
This is not really true for the change anymore.
Done
https://review.coreboot.org/c/coreboot/+/37490/11//COMMIT_MSG@21 PS11, Line 21:
Can you please add appropriate BUG= to commit message?
Done
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Kconfig... PS9, Line 221: menu "PSP Configuration Options"
Felix - this is not yet addressed.
Done
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/4/src/soc/amd/picasso/Makefil... PS4, Line 213: PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
not sure what to do about this right now. is it ok when i close this issue for now? […]
Filed b/154957411 and added a comment.
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/Makefil... PS7, Line 44: bootblock-y += smi_util.c
Felix - did you check if all these files are required?
Yes, it's required as part of gpio_banks/gpio.c: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/th...
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/Makefil... PS9, Line 207: 0x10
Felix - can you please address this?
Done
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 208: bootblock.elf
Don't you really want to just use bootblock. […]
Let's leave the elf so we can extract the size later. b/154957411
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 208: $(obj)/cbfs/fallback
$(objcbfs)
Done
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 209: $(CONFIG_C_ENV_BOOTBLOCK_SIZE)
I believe you can just use file-size bootblock. […]
Yeah, but the file doesn't exist at the point this runs. Let's wait for b/154957411 to refactor this code.
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 41: Family_Model
Let's keep this as Family Model for now for consistency. […]
Ack
https://review.coreboot.org/c/coreboot/+/37490/7/src/soc/amd/picasso/bootblo... PS7, Line 44: i2c_soc_early_init();
This seems consistent with what stoneyridge did. […]
Ack
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... PS9, Line 7: cpu/amd/msr.h
Not yet addressed?
Removed for now
https://review.coreboot.org/c/coreboot/+/37490/9/src/soc/amd/picasso/bootblo... PS9, Line 8: #include <cpu/x86/mtrr.h>
Doesn't look like this is used.
Done
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... PS11, Line 6: #include <console/console.h>
This is not required.
We use a printk
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... PS11, Line 9: #include <timestamp.h>
Not required.
Done
Eric Peers has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 12:
(3 comments)
https://review.coreboot.org/c/coreboot/+/37490/12//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/37490/12//COMMIT_MSG@12 PS12, Line 12: All Picasso designs will now use a bootblock as their first stage. there is a missing sentence before this as to why we flipped back to using bootblock from hybrid romstage.
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/Makefi... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/Makefi... PS12, Line 186: # TODO(b/154957411): Refactor amdfwtool to extract the address and size from I set a due date of 5/15, and assigned.
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/bootbl... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/bootbl... PS12, Line 27: printk(BIOS_DEBUG, "Family_Model: %08x\n", val); follow-on for later - can we identify the SOC and print? I think this is in our private branch but would be useful so print which processor we actually are on.
Raul Rangel has uploaded a new patch set (#13) to the change originally created by Marshall Dawson. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage. The reason being that it requires less invasive changes than using a hybrid romstage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Make Makefile.inc calculates the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool. See b/154957411.
BUG=b:147042464
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 96 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/13
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 13:
(3 comments)
https://review.coreboot.org/c/coreboot/+/37490/12//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/37490/12//COMMIT_MSG@12 PS12, Line 12: All Picasso designs will now use a bootblock as their first stage.
there is a missing sentence before this as to why we flipped back to using bootblock from hybrid rom […]
Done
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/Makefi... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/Makefi... PS12, Line 186: # TODO(b/154957411): Refactor amdfwtool to extract the address and size from
I set a due date of 5/15, and assigned.
Ack
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/bootbl... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/12/src/soc/amd/picasso/bootbl... PS12, Line 27: printk(BIOS_DEBUG, "Family_Model: %08x\n", val);
follow-on for later - can we identify the SOC and print? I think this is in our private branch but w […]
That can be added once we port over the soc_utils
Eric Peers has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 13: Code-Review+1
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 13: Code-Review+2
(4 comments)
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 224: 0x10000 This is the same as the default value in src/arch/x86/Kconfig. Do you still need this here?
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... File src/soc/amd/picasso/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 208: bootblock.elf
Let's leave the elf so we can extract the size later. […]
Sounds good.
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/Makefi... PS11, Line 209: $(CONFIG_C_ENV_BOOTBLOCK_SIZE)
Yeah, but the file doesn't exist at the point this runs. […]
Sounds good.
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... File src/soc/amd/picasso/bootblock/bootblock.c:
https://review.coreboot.org/c/coreboot/+/37490/11/src/soc/amd/picasso/bootbl... PS11, Line 6: #include <console/console.h>
We use a printk
That's right.
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 48: config HAVE_BOOTBLOCK It's a bit hard (or impossible) to me to look at picasso board build results currently.
Removing this keeps a copy of (uncompressed) bootblock.bin at the end of coreboot.rom file? You do not want it there?
Marshall Dawson has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 48: config HAVE_BOOTBLOCK
It's a bit hard (or impossible) to me to look at picasso board build results currently. […]
IIRC this feature simply writes FFs into a smaller bootblock image which is still included. For Picasso, we still require the full bootblock.elf so we cannot use CONFIG_HAVE_BOOTBLOCK=n. The better approach for Picasso would be to remove the bootblock stage from cbfs. Should we wait for Furquan's id changes first (CB:40377)?
Raul Rangel has uploaded a new patch set (#14) to the change originally created by Marshall Dawson. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage. The reason being that it requires less invasive changes than using a hybrid romstage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Make Makefile.inc calculates the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool. See b/154957411.
BUG=b:147042464, b:153675909
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 92 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/37490/14
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 14:
(2 comments)
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 48: config HAVE_BOOTBLOCK
IIRC this feature simply writes FFs into a smaller bootblock image which is still included. […]
Removing this just means we no longer create an empty bootblock.bin: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/th...
We can save all the moving and refactoring for later. For now I just want to get enough of this merged so anyone can start building and testing without having to juggle a huge patch train.
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 224: 0x10000
This is the same as the default value in src/arch/x86/Kconfig. […]
Nope. Removed.
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 48: config HAVE_BOOTBLOCK
Removing this just means we no longer create an empty bootblock.bin: https://source.chromium. […]
Right, instead of an empty bootblock.bin you now get full-featured non-XIP bootblock.elf at end of coreboot.rom, with RESET_VECTOR_IN_RAM=y.
Logically, the parent commit (implement RESET_VECTOR_IN_RAM) should be the implementation for a non-XIP bootblock. The non-XIP bootblock at end of coreboot.rom is simply no longer valid there, it is not linked to execute from MMIO/SPI flash memory and also contains sections that must be writable.
It's probably a two or three liner patch to fix it in the parent, but go ahead and file a bug on it instead with the parent commit.
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 15:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... File src/soc/amd/picasso/Kconfig:
https://review.coreboot.org/c/coreboot/+/37490/13/src/soc/amd/picasso/Kconfi... PS13, Line 48: config HAVE_BOOTBLOCK
Right, instead of an empty bootblock.bin you now get full-featured non-XIP bootblock. […]
Removed bootblock from cbfs in the parent commit:
$ cbfstool /tmp/coreboot/trembyle-upstream/coreboot.rom print FMAP REGION: COREBOOT Name Offset Type Size Comp cbfs master header 0x0 cbfs header 32 none fallback/romstage 0x80 stage 82148 none fallback/ramstage 0x141c0 stage 90638 none config 0x2a440 raw 1524 none revision 0x2aa80 raw 696 none spd.bin 0x2ad80 spd 1024 none (empty) 0x2b1c0 null 3544 none fspm.bin 0x2bfc0 fsp 720896 none (empty) 0xdc000 null 3992 none fsps.bin 0xdcfc0 fsp 327680 none pci1002,15d8.rom 0x12d000 optionrom 54272 none fallback/dsdt.aml 0x13a480 raw 10995 none (empty) 0x13cfc0 null 1499096 none apu/amdfw 0x2aafc0 raw 1219584 none (empty) 0x3d4c00 null 746456 none
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
Patch Set 16: Code-Review+2
Aaron Durbin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/37490 )
Change subject: soc/amd/picasso: Add bootblock support ......................................................................
soc/amd/picasso: Add bootblock support
The original plan for Picasso was to combine the features of bootblock with romstage due to its unique way of coming out of reset. Early in development, all bootblock support was removed from the directory. All Picasso designs will now use a bootblock as their first stage. The reason being that it requires less invasive changes than using a hybrid romstage.
Add a basic bootblock back to the directory, and compatible with the design of lib/bootblock.c. The files support RESET_VECTOR_IN_RAM and add appropriate settings in Kconfig. Make Makefile.inc calculates the size and base of bootblock from known parameters. * Future work may attempt to streamline this further, in conjunction with changes in amdfwtool. See b/154957411.
BUG=b:147042464, b:153675909
Change-Id: I1d0784025f2b39f140b16f37726d4a7f36df6c6c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com Signed-off-by: Felix Held felix-coreboot@felixheld.de Reviewed-on: https://review.coreboot.org/c/coreboot/+/37490 Reviewed-by: Furquan Shaikh furquan@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/amd/picasso/Kconfig M src/soc/amd/picasso/Makefile.inc A src/soc/amd/picasso/bootblock/bootblock.c A src/soc/amd/picasso/bootblock/pre_c.S 4 files changed, 92 insertions(+), 15 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig index 3113b27..afa18bc 100644 --- a/src/soc/amd/picasso/Kconfig +++ b/src/soc/amd/picasso/Kconfig @@ -14,6 +14,7 @@ select ARCH_VERSTAGE_X86_32 select ARCH_ROMSTAGE_X86_32 select ARCH_RAMSTAGE_X86_32 + select RESET_VECTOR_IN_RAM select X86_AMD_FIXED_MTRRS select X86_AMD_INIT_SIPI select ACPI_AMD_HARDWARE_SLEEP_VALUES @@ -46,10 +47,6 @@ select SSE2 select RTC
-config HAVE_BOOTBLOCK - bool - default n - config AMD_FP5 def_bool y if !AMD_FT5 help @@ -219,6 +216,14 @@ return to S0. Otherwise the system will remain in S5 once power is restored.
+config X86_RESET_VECTOR + hex + default 0x807fff0 + +config EARLYRAM_BSP_STACK_SIZE + hex + default 0x800 + menu "PSP Configuration Options"
config AMDFW_OUTSIDE_CBFS diff --git a/src/soc/amd/picasso/Makefile.inc b/src/soc/amd/picasso/Makefile.inc index d31e518..b04e1e9 100644 --- a/src/soc/amd/picasso/Makefile.inc +++ b/src/soc/amd/picasso/Makefile.inc @@ -11,6 +11,15 @@ subdirs-y += ../../../cpu/x86/pae subdirs-y += ../../../cpu/x86/smm
+bootblock-y += bootblock/pre_c.S +bootblock-y += bootblock/bootblock.c +bootblock-y += southbridge.c +bootblock-y += i2c.c +bootblock-$(CONFIG_PICASSO_UART) += uart.c +bootblock-y += tsc_freq.c +bootblock-y += gpio.c +bootblock-y += smi_util.c + romstage-y += i2c.c romstage-y += romstage.c romstage-y += gpio.c @@ -29,12 +38,6 @@ verstage-$(CONFIG_PICASSO_UART) += uart.c verstage-y += tsc_freq.c
-postcar-y += monotonic_timer.c -postcar-$(CONFIG_PICASSO_UART) += uart.c -postcar-y += memmap.c -postcar-$(CONFIG_VBOOT_MEASURED_BOOT) += i2c.c -postcar-y += tsc_freq.c - ramstage-y += i2c.c ramstage-y += chip.c ramstage-y += cpu.c @@ -179,8 +182,12 @@
# type = 0x62 PSP_BIOSBIN_FILE=$(obj)/amd_biospsp.img -PSP_BIOSBIN_DEST=$(CONFIG_ROMSTAGE_ADDR) -PSP_BIOSBIN_SIZE=$(CONFIG_RAM_RESET_VECTOR_STAGE_SIZE) +PSP_ELF_FILE=$(objcbfs)/bootblock.elf +# TODO(b/154957411): Refactor amdfwtool to extract the address and size from +# the elf file. +PSP_BIOSBIN_SIZE=$(CONFIG_C_ENV_BOOTBLOCK_SIZE) +# This address must match the BOOTBLOCK logic in arch/x86/memlayout.ld. +PSP_BIOSBIN_DEST=$(shell printf "%x" $(call int-subtract, $(call int-add, $(CONFIG_X86_RESET_VECTOR) 0x10) $(PSP_BIOSBIN_SIZE)))
# type = 0x63 ifeq ($(CONFIG_HAVE_ACPI_RESUME),y) @@ -368,11 +375,10 @@ --location $(shell printf "0x%x" $(PICASSO_FWM_POSITION)) \ --output $@
-USE_BIOS_FILE=$(obj)/cbfs/fallback/romstage.elf -$(PSP_BIOSBIN_FILE): $(obj)/cbfs/fallback/romstage.elf $(AMDCOMPRESS) +$(PSP_BIOSBIN_FILE): $(PSP_ELF_FILE) $(AMDCOMPRESS) rm -f $@ @printf " AMDCOMPRS $(subst $(obj)/,,$(@))\n" - $(AMDCOMPRESS) --infile $(USE_BIOS_FILE) --outfile $@ --compress \ + $(AMDCOMPRESS) --infile $(PSP_ELF_FILE) --outfile $@ --compress \ --maxsize $(PSP_BIOSBIN_SIZE)
ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y) diff --git a/src/soc/amd/picasso/bootblock/bootblock.c b/src/soc/amd/picasso/bootblock/bootblock.c new file mode 100644 index 0000000..8ae4db3 --- /dev/null +++ b/src/soc/amd/picasso/bootblock/bootblock.c @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* This file is part of the coreboot project. */ + +#include <stdint.h> +#include <bootblock_common.h> +#include <console/console.h> +#include <soc/southbridge.h> +#include <soc/i2c.h> +#include <amdblocks/amd_pci_mmconf.h> + +asmlinkage void bootblock_c_entry(uint64_t base_timestamp) +{ + enable_pci_mmconf(); + + bootblock_main_with_basetime(base_timestamp); +} + +void bootblock_soc_early_init(void) +{ + sb_reset_i2c_slaves(); + fch_pre_init(); +} + +void bootblock_soc_init(void) +{ + u32 val = cpuid_eax(1); + printk(BIOS_DEBUG, "Family_Model: %08x\n", val); + + fch_early_init(); + i2c_soc_early_init(); +} diff --git a/src/soc/amd/picasso/bootblock/pre_c.S b/src/soc/amd/picasso/bootblock/pre_c.S new file mode 100644 index 0000000..c478ef8 --- /dev/null +++ b/src/soc/amd/picasso/bootblock/pre_c.S @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* This file is part of the coreboot project. */ + +#include <cpu/x86/post_code.h> + +/* + * on entry: + * mm0: BIST (ignored) + * mm2_mm1: timestamp at bootblock_protected_mode_entry + */ + +.global bootblock_pre_c_entry +bootblock_pre_c_entry: + post_code(0xa0) + + movl $_eearlyram_stack, %esp + + /* Align the stack and keep aligned for call to bootblock_c_entry() */ + and $0xfffffff0, %esp + sub $8, %esp + + movd %mm2, %eax + pushl %eax /* tsc[63:32] */ + movd %mm1, %eax + pushl %eax /* tsc[31:0] */ + + post_code(0xa2) + + call bootblock_c_entry + /* Never reached */ + +.halt_forever: + post_code(POST_DEAD_CODE) + hlt + jmp .halt_forever