Commit Graph

43222 Commits

Author SHA1 Message Date
Sugnan Prabhu S 061a93f93d mb/google/brya: Add variant specific soc chip config update
This patch adds support for variant specific soc chip config update
function.

Change-Id: Ic3a3ae0b409433e6dfa102c5e7a6322d4f78f730
Signed-off-by: Sugnan Prabhu S <sugnan.prabhu.s@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56411
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2021-07-21 16:22:59 +00:00
James Chao 430f0b4455 mb/google/octopus/variants/ampton: Resume from suspend on critical battery
This patch makes Ampton EC wake up AP from s0ix when the state of
charge drops to 2%.

Demonstrated as follows:

1. Boot Ampton.
2. Run powerd_dbus_suspend.
3. On EC, run battfake 2.
4. System resumes.

BUG=b:189540432
BRANCH=Octopus
TEST=Verified on Ampton.

Change-Id: I98d8e6ea185e8782ad675d4668678b341ca5d350
Signed-off-by: James Chao <james_chao@asus.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56341
Reviewed-by: Marco Chen <marcochen@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 16:22:43 +00:00
Yu-Ping Wu 0f88f6ff92 tests/Makefile.inc: Correct dependency file suffix
The dependency file, generated by

 $(HOSTCC) ... -MMD -MT $@ -c $< -o $@.orig

is determined by replacing the suffix of "$@.orig" with ".d", resulting
in "$@.d" (which is *.o.d). The file name was accidentally changed in
CB:55360. Now explicitly specify the path by the "-MF" option.

BUG=none
TEST=make unit-tests; find build/tests/ -name "*.d"
BRANCH=none

Change-Id: I01f77ebaaae78dd9e69394a49e524f1013857195
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56444
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
2021-07-21 16:22:21 +00:00
Malik_Hsu 6e85862a74 mb/google/brya/variants/primus: add dram part id
This change adds mem_parts_uesd.txt that contains the new
memory parts used by primus and Makefile.inc generated by
gen_part_id.go using mem_parts_used.txt.

BUG=b:193813079

Signed-off-by: Malik_Hsu <malik_hsu@wistron.corp-partner.google.com>
Change-Id: I6aa37114f3a164a4f3c35dfc9b43e1106b825bff
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56366
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
2021-07-21 16:21:24 +00:00
Philip Chen 1158f712dc mb/google/herobrine: Retrieve SKU ID from EC
BUG=b:186264627
BRANCH=none
TEST=build herobrine

Signed-off-by: Philip Chen <philipchen@google.com>
Change-Id: Id3faf7af64c0129ec646a01085adc43b561225d2
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56354
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shelley Chen <shchen@google.com>
2021-07-21 16:21:01 +00:00
Ravi Kumar Bokka a8e9dbae65 sc7180: Renaming the GPIO macro in QSPI and I2C driver
As part of GPIO driver cleanup across qcom chipsets,
GPIO_OUTPUT_ENABLE has been renamed to GPIO_OUTPUT.

BUG=b:182963902
TEST=Validated on qualcomm sc7180 development board

Signed-off-by: Rajesh Patil <rajpat@codeaurora.org>
Change-Id: I51eedc722a91c5ea8e009fb8468a60667d374b49
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56194
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shelley Chen <shchen@google.com>
2021-07-21 16:13:54 +00:00
Taniya Das ec4cc8b2ac soc/qualcomm/common/gpio: Define a macro for the gpio offset
Defining a macro for the gpio offset instead of a constant value.

BUG=b:182963902
TEST=Validated on qualcomm sc7280 development board

Signed-off-by: Taniya Das <tdas@codeaurora.org>
Change-Id: Iefdde8f8331cf1df2e88a2c8915aefb4fa091d65
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55948
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shelley Chen <shchen@google.com>
2021-07-21 16:08:36 +00:00
Rex-BC Chen cc80a9ac8e mb/google/cherry: add mt6360 support for MT8195
For new MT8195 devices we will control mt6360 via EC,
so we have to add ec function of controlling MT6360 and
add CONFIG to separate them.

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: Ic2228f5b45173f0905ea66a3a1f00ec820e0f855
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56446
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2021-07-21 15:55:53 +00:00
Rex-BC Chen fdde4cd153 mb/google/cherry: initialize SD card reader using regulator interface
TEST=boot kernel from sd card pass on Cherry board.

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: Ic20a2f3f053130ded202cf5ec861450f0f18eed0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56437
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 15:51:17 +00:00
Lean Sheng Tan 3ba59dc891 mb/intel/ehlcrb: Update FIVR configs
This patch sets the optimized FIVR configs for ehlcrb customized
based on the performance measurements to achieve the better power
savings in sleep states.
- Enable the external V1p05, Vnn, VnnSx rails in S0i3, S3, S4, S5
  states.
- Update the supported voltage states.
- Update max supported current, voltage transition time and RFI
  spread spectrum.

Signed-off-by: Lean Sheng Tan <lean.sheng.tan@intel.com>
Change-Id: I1e30ff6d84bfe078fcce0f968fce6aaab7fd575b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55981
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 15:49:09 +00:00
Rex-BC Chen 5055d88f40 mb/google/cherry: add mt6360 ids for regulator.c
Add MTK_REGULATOR_VCC and MTK_REGULATOR_VCCQ for regulator.c.

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: Iedb1036da3c87106157c51cc46b52545faba102c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56436
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 15:47:29 +00:00
Rex-BC Chen 86c50e11ce soc/mediatek/mt8195: modify mt6360 interface
With the new definition of mt6360_regulator_id,
merge the MT6360 LDO and PMIC interfaces into one.

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I7ccc32cb0a9481d5f55349c152267a44fe09d20a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56435
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2021-07-21 15:46:53 +00:00
Rex-BC Chen cd67657dea soc/mediatek/mt8195: redefine mt6360_regulator_id
On MT8195 platforms with BC1.2, we have to use EC to control
MT6360 so the mt6360_regulator_id is redefined to match the
numbers defined in EC driver.

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I9437edb9776442759ce04c31d315c3760078ffb3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56434
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 15:46:09 +00:00
Anil Kumar 881df06124 mb/intel/adlrvp: Enable I2S audio codecs on ADL-M RVP
- Add configurability using FW_CONFIG field in CBI, to
enable/disable I2S codec support for MAX98373 codecs
- AUDIO=ADL_MAX98373_ALC5682I_I2S: enable max98373 codec
using expansion board

Bug=None
Test=With CBI FW_CONFIG set to 0x100, check I2S audio output
on expansion card

Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
Change-Id: If2649647e58c5f30e2b539d534adf2a4e68f4fda
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52221
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 15:43:16 +00:00
Tim Wawrzynczak 19a2b84944 Revert "mb/google/brya: Enable south XHCI ports 1 and 2"
This reverts commit f7f715dff3.

Reason for revert: FSP 2207.01 uses the UsbTcPortEn UPD for TCSS XHCI enable

BUG=b:184324979
TEST=boot brya, all 3 USB Type-C ports still enumerate devices

Change-Id: I82bae21d185247bc0f3580fd6f92abb8eece6732
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56132
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.corp-partner.google.com>
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-21 14:13:15 +00:00
Raul E Rangel ad5307e46c device/pci_rom: Make ON_DEVICE_ROM_LOAD condition truthy
Truthy conditions are easier to reason about.

BUG=none
TEST=Boot guybrush

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I229c3e90f5122d6191b28f9b4b6de79ac2fcb627
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56401
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
2021-07-20 16:52:35 +00:00
Raul E Rangel 69cb69f35f device/pci_rom: Convert #if to C code
No reason to use the preprocessor for this.

BUG=none
TEST=build guybrush

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I920dfa2d27c2eb27e8bc50c615ccd13601610fd7
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56400
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
2021-07-20 16:51:50 +00:00
Raul E Rangel a736f48088 lib/cbfs,device/pci_rom: Move cbfs_boot_map_optionrom and modernize
These methods are oprom specific. Move them out of CBFS. I also deleted
the tohex methods and replaced them with snprintf.

BUG=b:179699789
TEST=Boot guybrush and see oprom still loads

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I03791f19c93fabfe62d9ecd4f9b4fad0e6a6146e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56393
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2021-07-20 16:51:25 +00:00
Jakub Czapiga 21863e33c8 tests/Makefile.inc: Add missing KCONFIG_SPITCONFIG trailing slash
New version of kconfig requires trailing slash at the end of
KCONFIG_SPLITCONFIG to indicate that it is a directory path.

Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Change-Id: I1a11eca21c4aa5a6260006c4ba2cb419eca8a802
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56337
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-07-20 16:07:15 +00:00
Varshit B Pandya 339f0e7e14 soc/intel/alderlake: Add support for I2C6 and I2C7
As per the EDS revision 1.3 add support for I2C6 and I2C7.

Signed-off-by: Varshit B Pandya <varshit.b.pandya@intel.com>
Change-Id: Id918d55e48b91993af9de8381995917aef55edc9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55996
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Maulik V Vaghela <maulik.v.vaghela@intel.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-20 13:35:10 +00:00
Felix Held aefcab7ff6 soc/amd/picasso/makefile: order source files alphabetically
Change-Id: I6eb0881ab05730b094caef2a9258c4d4d827195b
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56427
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
2021-07-20 13:33:37 +00:00
Felix Held d3a03140dd soc/amd/cezanne/makefile: order source files alphabetically
Change-Id: I4726ba4f19807adf872aaf04764cc19492febd59
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56426
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
2021-07-20 13:33:28 +00:00
Werner Zeh 0a44e8f8a1 mb/siemens/mc_ehl: Move SPD data to variant directory
Since the variants can have different memory move the SPD related
content to the variant directory.

Change-Id: I38aa5e7514437bfcc61c38d64f0ba6f19350810d
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56036
Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-20 08:25:56 +00:00
FrankChu e0758cb4f2 mb/google/volteer/variants/collis: Fix pen ejection event
Modify PENH device GPIO GPP_E17 for pen ejection event.

BUG=b:192511670,b:193093749
BRANCH=firmware-volteer-13672.B
TEST=test pen insert and remove by evtest , SW_PEN_INSERT value 1 when insert pen to pen slot. SW_PEN_INSERT value 0 when remove pen from pen slot.

Signed-off-by: FrankChu <frank_chu@pegatron.corp-partner.google.com>
Change-Id: Ida5e5b35464471a7896cef392e178a3d2c0ea1aa
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56331
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Zhuohao Lee <zhuohao@google.com>
2021-07-20 08:25:42 +00:00
Kevin Chang c775abba98 grunt/treeya: add Realtek ALC5682 codec support
Replace audio codec from DA7219 to Realtek ALC5682.
Add Realtek ALC5682 support.

BUG=b:185972050
BRANCH=master
TEST=check on treeya system ALC5682 audio codec is working normally.

Signed-off-by: Kevin Chang <kevin.chang@lcfc.corp-partner.google.com>
Change-Id: I49c673fd944b2c2a79c4283eee941a16596ba7fa
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56100
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
2021-07-19 21:55:23 +00:00
Subrata Banik 75f927601e mb/{google, intel}: Make use of `cpu/intel/cpu_ids.h'
Remove inclusion of mp_init.h for getting CPUIDs and use dedicated
cpu_ids.h file in SoC directory.

Change-Id: I411f4f2c237a9e2d39038ee30f2957698ee053bd
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56412
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
2021-07-19 18:25:42 +00:00
Raul E Rangel 21c70b1d0b soc/amd/{cezanne,picasso}: Escape PSP_VERSTAGE_FILE default
If we don't escape the $ then the actual $(obj) path will be written
into the .config file. With this change `$(obj)` is written into the
.config file. The Makefile then does:

    PSP_VERSTAGE_FILE=$(call strip_quotes,$(CONFIG_PSP_VERSTAGE_FILE))

Since this is a recursive assignment the $(obj) will be expanded at that
point.

This change makes it easier to compare full .config files.

BUG=none
TEST=Build ezkinil

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ic961df148d3f22585f3441d75c3f2454329c678a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56395
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kangheui Won <khwon@chromium.org>
2021-07-19 18:22:40 +00:00
Raul E Rangel 73193cf7b7 soc/amd/{common,cezanne}: Implement HAVE_PAYLOAD_PRELOAD_CACHE
This change allows preloading the payload.

BUG=b:179699789
TEST=Boot guybrush and see payload read/decompress drop by 20 ms. We
now spend 7ms decompression from RAM. By switching to LZ4 we drop that
to 500us.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I3ec78e628f24f2ba0c9fcf2a9e3bde64687eec44
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56053
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
2021-07-19 14:58:53 +00:00
Paul Menzel f72568cad3 payloads: FILO: Hook up autoboot options
FILO allows to configure a line to autoboot. Hook this up into
coreboot’s build system.

TEST=Configure coreboot for QEMU i440fx with FILO as payload and
configure:

    CONFIG_FILO_MASTER=y
    CONFIG_FILO_USE_AUTOBOOT=y
    CONFIG_FILO_AUTOBOOT_FILE="hda1:/vmlinuz root=/dev/sda1 console=tty0 console=ttyS0,115200 initrd=hda1:/initrd.img"
    CONFIG_FILO_AUTOBOOT_DELAY=5

Boot Debian image with:

    qemu-system-x86_64 -bios /dev/shm/coreboot/build/coreboot.rom -L /dev/shm -enable-kvm -smp cpus=2 -m 1G -hda /dev/shm/debian-32.img -serial stdio -net nic -net user,hostfwd=tcp::22222-:22

Change-Id: Id167e9a144bf466da87469108002672b299b702a
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56213
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-07-19 09:20:52 +00:00
Lean Sheng Tan 750200020a soc/intel/common: Rename kconfig PMC_EPOC
Rename PMC_EPOC to SOC_INTEL_COMMON_BLOCK_PMC_EPOC to maintain
common naming convention.

Signed-off-by: Lean Sheng Tan <lean.sheng.tan@intel.com>
Change-Id: If8a264007bbb85a44bbdfa72115eb687c32ec36e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55982
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-07-19 06:33:18 +00:00
Raul E Rangel 67798cfd80 lib/prog_loaders: Add payload_preload
This method will allow the SoC code to start loading the payload before
it is required.

BUG=b:177909625
TEST=Boot guybrush and see read/decompress drop by 23 ms.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ifa8f30a0f4f931ece803c2e8e022e4d33d3fe581
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56051
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
2021-07-19 02:42:43 +00:00
Raul E Rangel 61f44127f0 soc/amd/cezanne: Start loading APOB asynchronously
This enables COOP_MULTITASKING (i.e., multiple stacks single CPU). This
will allow the APOB to start loading while FSP-S executes.

BUG=b:179699789
TEST=Boot guybrush and verify APOB read timestamp has dropped from 10ms
to a few uS.

Starting APOB preload
APOB thread running
spi_dma_readat_dma: start: dest: 0xcb7aa640, offset: 0x0, size: 65536
 took 0 us to acquire mutex
start_spi_dma_transaction: dest: 0xcb7aa640, offset: 0x0, remaining: 65536

<ramstage doing work>

spi_dma_readat_dma: end: dest: 0xcb7aa640, offset: 0x0, size: 65536, remaining: 0

<more work..>

waiting for thread
 took 0 us
APOB valid copy is already in flash

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I4b5c1ef4cad571d1cbca33b1aff017a3cedc1bea
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56234
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:17:30 +00:00
Raul E Rangel fca58334c8 soc/amd/common/apob: Add support for asynchronously reading APOB_NV
This CL adds a method that can start the processes of reading the APOB
from SPI. It does require more RAM in ramstage since we no longer mmap
the buffer in the happy path. This will allow us to reduce our
boot time by ~10ms. The SoC code will need to be updated to call
start_apob_cache_read at a point where it makes sense.

BUG=b:179699789
TEST=With this and the patches above I can see a 10 ms reduction in
boot time on guybrush.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I930d58b76eb4558bc4f48ed928c4d6538fefb1e5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56232
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:17:17 +00:00
Raul E Rangel ce63dc4daa soc/amd/common/apob: Switch to using fmap_locate_area_as_rdev
Using fmap_locate_area is discouraged.

BUG=b:179699789
TEST=Boot guybrush and verify APOB got updated, then reboot and verify
APOB was valid.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I7f58eace8adb4b7ddaf9047d9b8153405d3941a1
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56390
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:17:05 +00:00
Raul E Rangel 5dd7602d20 lib/thread: Move thread_run and thread_run_until outside of #if guard
This will cause a linker error if these methods are used outside
ramstage.

BUG=b:179699789
TEST=compile guybrush w/ and w/o COOP_MULTITASKING

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: If9983fca939c8a15fa570481bfe016a388458830
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56352
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:16:48 +00:00
Raul E Rangel dfa8229d03 lib/hardwaremain: Drop boot_state_current_{block,unblock}()
There are no more callers.

BUG=b:179699789
TEST=Compile guybrush

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I522f17c0e450641c0a60496ba07800da7e39889c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56389
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:16:26 +00:00
Raul E Rangel 4aec58dce7 lib/thread: Make thread_run not block the current state
If a thread wants to block a state transition it can use
thread_run_until. Otherwise just let the thread run. `thread_join` can
be used to block on the thread. Boot states are also a ramstage concept.
If we want to use this API in any other stage, we need a way of starting
a thread without talking about stages.

BUG=b:179699789
TEST=verify thread_run no longer blocks the current state

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I3e5b0aed70385ddcd23ffcf7b063f8ccb547fc05
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56351
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:16:13 +00:00
Raul E Rangel cc01da50b7 lib/thread: Add thread_handle
The thread_handle can be used to wait for a thread to exit. I also added
a return value to the thread function that will be stored on the handle
after it completes. This makes it easy for the callers to check if the
thread completed successfully or had an error. The thread_join
method uses the handle to block until the thread completes.

BUG=b:179699789
TEST=See thread_handle state update and see error code set correctly.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ie6f64d0c5a5acad4431a605f0b0b5100dc5358ff
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56229
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:15:45 +00:00
Raul E Rangel 3af732ada0 soc/amd/common/block/lpc/spi_dma: Yield after completing transaction
There is no telling when the next udelay will be, so explicitly call
`thread_yield()` after completing a transaction. This will allow any
pending transactions to immediately start.

BUG=b:179699789
TEST=Verify new transaction is enqueued right after another.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I9c1272bde46c3e0c15305b76c2ea7a6dde5ed0b0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56321
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:15:27 +00:00
Raul E Rangel 6f3c9018c6 soc/amd/common/block/lpc/spi_dma: Use mutex to protect DMA registers
Once we enable COOP_MULTITASKING, we need to guarantee that we don't
have multiple threads trying to access the DMA hardware.

BUG=b:179699789
TEST=Boot guybrush with APOB patches.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ibb8e31c95d6722521425772f4210af45626c8e09
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56231
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:15:15 +00:00
Raul E Rangel b29f9d471b lib/thread: Add mutex
We need a way to protect shared resources. Since we are using
cooperative multitasking the mutex implementation is pretty trivial.

BUG=b:179699789
TEST=Verify thread lock and unlock.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ife1ac95ec064ebcdd00fcaacec37a06ac52885ff
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56230
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:14:10 +00:00
Raul E Rangel a98d302fe9 x86/smp/spinlock: Disable thread coop when taking spinlock
Switching threads while holding a spinlock can lead to a deadlock. This
happens if you have two thread trying to print to the serial console
because the uart code uses udelay.

BUG=b:179699789
TEST=Boot guybrush and no longer see a deadlock when printing to
console from a second thread.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I1b929070b7f175965d4f37be693462fef26be052
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56320
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
2021-07-18 15:14:00 +00:00
Raul E Rangel 9ba36abdc5 lib/thread: Rename thread_cooperate and thread_prevent_coop
Renaming them to thread_coop_disable()/thread_coop_enable() makes them
sound like a pair.

BUG=b:179699789
TEST=Boot guybrush to OS

Suggested-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I1d70c18965f53e733e871ca03107270612efa4fc
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56357
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:13:50 +00:00
Raul E Rangel be60a0ddb0 lib/thread: Allow nesting thread_cooperate and thread_prevent_coop
This change allows nesting critical sections, and frees the caller from
having to keep track of whether the thread has coop enabled.


BUG=b:179699789
TEST=Boot guybrush with SPI DMA

Suggested-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I325ab6181b17c5c084ca1e2c181b4df235020557
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56350
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:13:27 +00:00
Raul E Rangel b95369c914 lib/thread: Clean up initialization sequence
idle_thread_init was actually configuring the BSP thread at the end.
We can instead do this in threads_initialize. This now lets us set
initialized after the idle thread has been set up.

BUG=b:179699789
TEST=Boot guybrush to OS

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I7f1d6afac3b0622612565b37c61fbd2cd2481552
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56356
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 15:13:00 +00:00
Raul E Rangel d5dca21a95 lib/thread: Add thread_yield helper method
This helper method is just a shorthand for
`thread_yield_microseconds(0)`. I think it makes it clear that we want
to yield a thread without delaying.

BUG=b:179699789
TEST=build test

Suggested-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Id8b60c35b183cff6871d7ba70b36eb33b136c735
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56349
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-18 00:25:29 +00:00
Raul E Rangel d373d5d92f soc/amd/common/block/lpc/spi_dma: Implement SPI DMA functionality
This change will make it so the standard rdev readat call will use the
SPI DMA controller if the alignment is correct, and the transfer size is
larger than 64 bytes.

There is a magic bit that needs to be set for the SPI DMA controller to
function correctly. This is only available in RN/CZN+.

BUG=b:179699789
TEST=Boot guybrush to OS. This reduces loading verstage by 40ms,
verifying RW by 500us and loading romstage by 500 us.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I0be555956581fd82bbe1482d8afa8828c61aaa01
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56228
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
2021-07-18 00:24:09 +00:00
Felix Held e6dd5dc4ea soc/amd/common/block/graphics: add GPU PCI ID for Barcelo
Also rename the existing PCI_DEVICE_ID_ATI_FAM19H_MODEL51H_GPU
definition to PCI_DEVICE_ID_ATI_FAM19H_MODEL51H_GPU_CEZANNE to clarify
that that is the one for Cezanne.

BUG=b:193888172

Change-Id: I1c5446c1517f2e0cd708d3275b08d2bce4be0ea8
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56396
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Matt Papageorge <matthewpapa07@gmail.com>
Reviewed-by: Nikolai Vyssotski <nikolai.vyssotski@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-17 21:33:17 +00:00
Felix Held d5b51beb79 soc/amd/cezanne/graphics: add VBIOS ID remapping for Barcelo
Barcelo uses the same VBIOS image as Cezanne, but uses a different PCI
ID, so we need to implement map_oprom_vendev for the SoC.

BUG=b:193888172

Change-Id: I2eed43705f497245bd953659844b3fb461aa0b3b
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56392
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Nikolai Vyssotski <nikolai.vyssotski@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-07-17 21:32:59 +00:00
Meera Ravindranath 81d367feee soc/intel/alderlake: Select INTEL_GMA_OPREGION_2_1
Alder Lake supports IGD Opregion version 2.1.

BUG=b:190019970
BRANCH=None

Signed-off-by: Meera Ravindranath <meera.ravindranath@intel.com>
Change-Id: I95a6f3df185003a4e38faa920f867ace0b97ab2b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56156
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-07-17 13:48:12 +00:00