Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/82685?usp=email )
Change subject: soc/intel/meteorlake: Hook up PchHdaAudioLinkHdaEnable to devicetree
......................................................................
soc/intel/meteorlake: Hook up PchHdaAudioLinkHdaEnable to devicetree
The comment that the PchHdaAudioLink UPDs only configure GPIOs is
incorrect. Setting this to 1 is needed to enable HDA audio link.
Same exact situation as with Alder Lake in CL 71715.
Change-Id: Iecbe106ae18b5a8b53c04a5335a4e4c4ae27c7a0
Signed-off-by: Michał Kopeć <michal.kopec(a)3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82685
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Tim Crawford <tcrawford(a)system76.com>
---
M src/soc/intel/meteorlake/chip.h
M src/soc/intel/meteorlake/romstage/fsp_params.c
2 files changed, 2 insertions(+), 7 deletions(-)
Approvals:
Tim Crawford: Looks good to me, approved
build bot (Jenkins): Verified
diff --git a/src/soc/intel/meteorlake/chip.h b/src/soc/intel/meteorlake/chip.h
index 0c76b7c..7168369 100644
--- a/src/soc/intel/meteorlake/chip.h
+++ b/src/soc/intel/meteorlake/chip.h
@@ -247,6 +247,7 @@
uint16_t sata_ports_dito_val[8];
/* Audio related */
+ uint8_t pch_hda_audio_link_hda_enable;
uint8_t pch_hda_dsp_enable;
bool pch_hda_sdi_enable[MAX_HD_AUDIO_SDI_LINKS];
diff --git a/src/soc/intel/meteorlake/romstage/fsp_params.c b/src/soc/intel/meteorlake/romstage/fsp_params.c
index 0f44d65..ec0bb8d 100644
--- a/src/soc/intel/meteorlake/romstage/fsp_params.c
+++ b/src/soc/intel/meteorlake/romstage/fsp_params.c
@@ -288,17 +288,11 @@
m_cfg->PchHdaIDispLinkTmode = config->pch_hda_idisp_link_tmode;
m_cfg->PchHdaIDispLinkFrequency = config->pch_hda_idisp_link_frequency;
m_cfg->PchHdaIDispCodecDisconnect = !config->pch_hda_idisp_codec_enable;
+ m_cfg->PchHdaAudioLinkHdaEnable = config->pch_hda_audio_link_hda_enable;
for (int i = 0; i < MAX_HD_AUDIO_SDI_LINKS; i++)
m_cfg->PchHdaSdiEnable[i] = config->pch_hda_sdi_enable[i];
- /*
- * All the PchHdaAudioLink{Hda|Dmic|Ssp|Sndw}Enable UPDs are used by FSP only to
- * configure GPIO pads for audio. Mainboard is expected to perform all GPIO
- * configuration in coreboot and hence these UPDs are set to 0 to skip FSP GPIO
- * configuration for audio pads.
- */
- m_cfg->PchHdaAudioLinkHdaEnable = 0;
memset(m_cfg->PchHdaAudioLinkDmicEnable, 0, sizeof(m_cfg->PchHdaAudioLinkDmicEnable));
memset(m_cfg->PchHdaAudioLinkSspEnable, 0, sizeof(m_cfg->PchHdaAudioLinkSspEnable));
memset(m_cfg->PchHdaAudioLinkSndwEnable, 0, sizeof(m_cfg->PchHdaAudioLinkSndwEnable));
--
To view, visit https://review.coreboot.org/c/coreboot/+/82685?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iecbe106ae18b5a8b53c04a5335a4e4c4ae27c7a0
Gerrit-Change-Number: 82685
Gerrit-PatchSet: 2
Gerrit-Owner: Michał Kopeć <michal.kopec(a)3mdeb.com>
Gerrit-Reviewer: Dinesh Gehlot <digehlot(a)google.com>
Gerrit-Reviewer: Eran Mitrani <mitrani(a)google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Jakub Czapiga <czapiga(a)google.com>
Gerrit-Reviewer: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Reviewer: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Tarun <tstuli(a)gmail.com>
Gerrit-Reviewer: Tim Crawford <tcrawford(a)system76.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Attention is currently required from: Alexander Couzens, Maciej Pijanowski, Paul Menzel.
Angel Pons has posted comments on this change by Maciej Pijanowski. ( https://review.coreboot.org/c/coreboot/+/80609?usp=email )
Change subject: mb/lenovo: Add ThinkCentre M920q (Cannon Lake)
......................................................................
Patch Set 7:
(2 comments)
File src/mainboard/lenovo/m920q/devicetree.cb:
https://review.coreboot.org/c/coreboot/+/80609/comment/0f6fa08d_f37118c1?us… :
PS7, Line 53: [0] = 1,
For M920Q M.2 SATA:
```suggestion
[0] = 1,
[4] = 1,
```
File src/mainboard/lenovo/m920q/gpio.c:
https://review.coreboot.org/c/coreboot/+/80609/comment/4309297f_30eb51cf?us… :
PS7, Line 6: /* Pad configuration was generated automatically using intelp2m utility */
Please tell intelp2m to generate the pretty macros (it's a command-line argument)
--
To view, visit https://review.coreboot.org/c/coreboot/+/80609?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iea1dc5745c0ecf687fa18b793f0aab4b0855d6d4
Gerrit-Change-Number: 80609
Gerrit-PatchSet: 7
Gerrit-Owner: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-Reviewer: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Michał Kopeć <michal.kopec(a)3mdeb.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Felix Singer <service+coreboot-gerrit(a)felixsinger.de>
Gerrit-CC: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Attention: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Mon, 03 Jun 2024 16:28:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Angel Pons, Benjamin Doron, Dinesh Gehlot, Kane Chen, Kapil Porwal, Karthik Ramasubramanian, Nick Vaccaro, Paul Menzel, Sowmya Aralguppe.
Subrata Banik has posted comments on this change by Sowmya Aralguppe. ( https://review.coreboot.org/c/coreboot/+/82136?usp=email )
Change subject: mb/google/brox: Fix CPU crashlog device MMIO memory access
......................................................................
Patch Set 10:
(1 comment)
File src/soc/intel/alderlake/crashlog.c:
https://review.coreboot.org/c/coreboot/+/82136/comment/b89b6aef_4a0f3908?us… :
PS10, Line 205: &
> > > What if the address is below 4G (the high dword is zero, but the low dword is non-zero)? Is this a valid value?
> >
> > do you mean above 4G? where MSB is non-zero and LSB is zero ?
>
> I mean MSB is zero and LSB is non-zero, but the scenario you suggested is also a problem with this check.
>
> This is how I would implement the check:
>
> ```suggestion
> if (!dw1 && !dw0) {
> ```
i agree with you.
--
To view, visit https://review.coreboot.org/c/coreboot/+/82136?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I262254ee8d0eb91efcb3e748d121e13c31e66251
Gerrit-Change-Number: 82136
Gerrit-PatchSet: 10
Gerrit-Owner: Sowmya Aralguppe <sowmya.aralguppe(a)intel.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Benjamin Doron <benjamin.doron00(a)gmail.com>
Gerrit-Reviewer: Dinesh Gehlot <digehlot(a)google.com>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.corp-partner.google.com>
Gerrit-Reviewer: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Reviewer: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Ashish Kumar Mishra <ashish.k.mishra(a)intel.com>
Gerrit-CC: Krishna P Bhat D <krishna.p.bhat.d(a)intel.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Ronak Kanabar <ronak.kanabar(a)intel.com>
Gerrit-Attention: Sowmya Aralguppe <sowmya.aralguppe(a)intel.com>
Gerrit-Attention: Kane Chen <kane.chen(a)intel.corp-partner.google.com>
Gerrit-Attention: Benjamin Doron <benjamin.doron00(a)gmail.com>
Gerrit-Attention: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Dinesh Gehlot <digehlot(a)google.com>
Gerrit-Attention: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-Comment-Date: Mon, 03 Jun 2024 16:19:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sowmya Aralguppe <sowmya.aralguppe(a)intel.com>
Comment-In-Reply-To: Subrata Banik <subratabanik(a)google.com>
Comment-In-Reply-To: Kapil Porwal <kapilporwal(a)google.com>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Attention is currently required from: Alexander Couzens, Maciej Pijanowski, Paul Menzel.
Angel Pons has posted comments on this change by Maciej Pijanowski. ( https://review.coreboot.org/c/coreboot/+/80609?usp=email )
Change subject: mb/lenovo: Add ThinkCentre M920q (Cannon Lake)
......................................................................
Patch Set 7:
(1 comment)
File src/mainboard/lenovo/m920q/devicetree.cb:
https://review.coreboot.org/c/coreboot/+/80609/comment/9b0247b6_6d502631?us… :
PS7, Line 57:
: # not populated on M920q. Appears to be populated on M920x
: # variant but it was not tested in any way so far.
:
: device ref pcie_rp21 on # M.2 SSD #1
: register "PcieRpSlotImplemented[20]" = "1"
: register "PcieRpEnable[20]" = "1"
: register "PcieClkSrcUsage[4]" = "20"
: register "PcieClkSrcClkReq[4]" = "4"
: end
:
: device ref pcie_rp9 on # WLAN
: register "PcieRpSlotImplemented[8]" = "1"
: register "PcieRpEnable[5]" = "1"
: register "PcieClkSrcUsage[3]" = "5"
: register "PcieClkSrcClkReq[3]" = "3"
: end
I'm not sure where this info comes from, but it doesn't match the schematics I have. Also, WLAN (`device ref pcie_rp9`) is enabling PCIe RP #6, which is wrong...
```suggestion
device ref pcie_rp6 on # WLAN
register "PcieRpEnable[5]" = "1"
register "PcieRpSlotImplemented[5]" = "1"
register "PcieClkSrcUsage[3]" = "5"
register "PcieClkSrcClkReq[3]" = "3"
end
device ref pcie_rp9 on # PCIe x4
register "PcieRpEnable[8]" = "1"
register "PcieRpSlotImplemented[8]" = "1"
register "PcieClkSrcUsage[2]" = "8"
register "PcieClkSrcClkReq[2]" = "2"
end
device ref pcie_rp17 on # M.2 SSD #2
register "PcieRpEnable[16]" = "1"
register "PcieRpSlotImplemented[16]" = "1"
register "PcieClkSrcUsage[10]" = "16"
register "PcieClkSrcClkReq[10]" = "10"
end
device ref pcie_rp21 on # M.2 SSD #1
register "PcieRpEnable[20]" = "1"
register "PcieRpSlotImplemented[20]" = "1"
register "PcieClkSrcUsage[4]" = "20"
register "PcieClkSrcClkReq[4]" = "4"
end
```
--
To view, visit https://review.coreboot.org/c/coreboot/+/80609?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iea1dc5745c0ecf687fa18b793f0aab4b0855d6d4
Gerrit-Change-Number: 80609
Gerrit-PatchSet: 7
Gerrit-Owner: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-Reviewer: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Michał Kopeć <michal.kopec(a)3mdeb.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Felix Singer <service+coreboot-gerrit(a)felixsinger.de>
Gerrit-CC: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Attention: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Mon, 03 Jun 2024 16:05:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Eric Lai, Jian Tong, Kun Liu, Paul Menzel, Shelley Chen, Wentao Qin.
Karthik Ramasubramanian has posted comments on this change by Jian Tong. ( https://review.coreboot.org/c/coreboot/+/82573?usp=email )
The change is no longer submittable: All-Comments-Resolved is unsatisfied now.
Change subject: mb/google/brox/var/lotso: Update gpio setting
......................................................................
Patch Set 16:
(1 comment)
File src/mainboard/google/brox/variants/lotso/gpio.c:
https://review.coreboot.org/c/coreboot/+/82573/comment/60e0dad6_78c99cda?us… :
PS16, Line 37: LOCK_CONFIG
Should we use the LOCK variant only from RO such that RW cannot overwrite the pad config? If so then here we are using it from RW. Or is the intentions to lock the config such that OS cannot overwrite it?
--
To view, visit https://review.coreboot.org/c/coreboot/+/82573?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I13485cc7ccd8b15352f5e21ad9336aa2b3d35749
Gerrit-Change-Number: 82573
Gerrit-PatchSet: 16
Gerrit-Owner: Jian Tong <tongjian(a)huaqin.corp-partner.google.com>
Gerrit-Reviewer: Eric Lai <ericllai(a)google.com>
Gerrit-Reviewer: Kun Liu <liukun11(a)huaqin.corp-partner.google.com>
Gerrit-Reviewer: Shelley Chen <shchen(a)google.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Wentao Qin <qinwentao(a)huaqin.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Dengwu Yu <yudengwu(a)huaqin.corp-partner.google.com>
Gerrit-CC: Elyes Haouas <ehaouas(a)noos.fr>
Gerrit-CC: Jinfang Mao <maojinfang(a)huaqin.corp-partner.google.com>
Gerrit-CC: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Shelley Chen <shchen(a)google.com>
Gerrit-Attention: Eric Lai <ericllai(a)google.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Jian Tong <tongjian(a)huaqin.corp-partner.google.com>
Gerrit-Attention: Kun Liu <liukun11(a)huaqin.corp-partner.google.com>
Gerrit-Attention: Wentao Qin <qinwentao(a)huaqin.corp-partner.google.com>
Gerrit-Comment-Date: Mon, 03 Jun 2024 15:53:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: Alexander Couzens, Maciej Pijanowski, Paul Menzel.
Angel Pons has posted comments on this change by Maciej Pijanowski. ( https://review.coreboot.org/c/coreboot/+/80609?usp=email )
Change subject: mb/lenovo: Add ThinkCentre M920q (Cannon Lake)
......................................................................
Patch Set 7:
(1 comment)
File src/mainboard/lenovo/m920q/romstage.c:
https://review.coreboot.org/c/coreboot/+/80609/comment/55899454_dcf4d2e6?us… :
PS7, Line 19: .spd_spec = {.spd_smbus_address = 0xa2}
I think this DIMM slot may not be functional. How about:
```suggestion
.spd_spec = {.spd_smbus_address = 0xa4}
```
--
To view, visit https://review.coreboot.org/c/coreboot/+/80609?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iea1dc5745c0ecf687fa18b793f0aab4b0855d6d4
Gerrit-Change-Number: 80609
Gerrit-PatchSet: 7
Gerrit-Owner: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-Reviewer: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Michał Kopeć <michal.kopec(a)3mdeb.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Felix Singer <service+coreboot-gerrit(a)felixsinger.de>
Gerrit-CC: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Attention: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Mon, 03 Jun 2024 15:40:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Lean Sheng Tan has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80322?usp=email )
Change subject: device_tree: Add function to get top of memory from a FDT blob
......................................................................
device_tree: Add function to get top of memory from a FDT blob
coreboot needs to figure out top of memory to place CBMEM data. On some
non-x86 QEMU virtual machines, this is achieved by probing the RAM space
to find where the VM starts discarding data since it's not backed by
actual RAM. This behaviour seems to have changed on the QEMU side since
then, VMs using the "virt" model have started raising exceptions/errors
instead of silently discarding data (likely [1] for example) which has
previously broken coreboot on these emulation boards.
The qemu-aarch64 and qemu-riscv mainboards are intended for the "virt"
models and had this issue, which were mostly fixed by using exception
handlers in the RAM detection process [2][3]. But on 32-bit RISC-V we
fail to initialize CBMEM if we have 2048 MiB or more of RAM, and on
64-bit RISC-V we had to limit probing to 16383 MiB because it can run
into MMIO regions otherwise.
The qemu-armv7 mainboard code is intended for the "vexpress-a9" model VM
which doesn't appear to suffer from this issue. Still, the issue can be
observed on the ARMv7 "virt" model via a port based on qemu-aarch64.
QEMU docs for ARM and RISC-V "virt" models [4][5] recommend reading the
device tree blob it provides for device information (incl. RAM size).
Implement functions that parse the device tree blob to find described
memory regions and calculate the top of memory in order to use it in
mainboard code as an alternative to probing RAM space. ARM64 code
initializes CBMEM in romstage where malloc isn't available, so take care
to do parsing without unflattening the blob and make the code available
in romstage as well.
[1] https://lore.kernel.org/qemu-devel/1504626814-23124-1-git-send-email-peter.…
[2] https://review.coreboot.org/c/coreboot/+/34774
[3] https://review.coreboot.org/c/coreboot/+/36486
[4] https://qemu-project.gitlab.io/qemu/system/arm/virt.html
[5] https://qemu-project.gitlab.io/qemu/system/riscv/virt.html
Change-Id: I8bef09bc1bc4e324ebeaa37f78d67d3aa315f52c
Signed-off-by: Alper Nebi Yasak <alpernebiyasak(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80322
Reviewed-by: Maximilian Brune <maximilian.brune(a)9elements.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
M src/include/device_tree.h
M src/lib/Makefile.mk
M src/lib/device_tree.c
3 files changed, 102 insertions(+), 1 deletion(-)
Approvals:
Julius Werner: Looks good to me, approved
build bot (Jenkins): Verified
Maximilian Brune: Looks good to me, approved
diff --git a/src/include/device_tree.h b/src/include/device_tree.h
index 6d2d656..bb522bf 100644
--- a/src/include/device_tree.h
+++ b/src/include/device_tree.h
@@ -129,6 +129,12 @@
*/
int fdt_next_node_name(const void *blob, uint32_t node_offset, const char **name);
+ /* Read memory regions from a flat device-tree. */
+size_t fdt_read_memory_regions(const void *blob, struct device_tree_region regions[],
+ size_t regions_count);
+ /* Find top of memory from a flat device-tree. */
+uint64_t fdt_get_memory_top(const void *blob);
+
/* Read a flattened device tree into a hierarchical structure which refers to
the contents of the flattened tree in place. Modifying the flat tree
invalidates the unflattened one. */
diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk
index e22fd08..59e2116 100644
--- a/src/lib/Makefile.mk
+++ b/src/lib/Makefile.mk
@@ -160,10 +160,12 @@
ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
ramstage-y += b64_decode.c
ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c
-ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c
ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
+romstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
+ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
+
romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index 4f5cc07..5087d39 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -12,9 +12,12 @@
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
+#include <limits.h>
#define FDT_PATH_MAX_DEPTH 10 // should be a good enough upper bound
#define FDT_PATH_MAX_LEN 128 // should be a good enough upper bound
+#define FDT_MAX_MEMORY_NODES 4 // should be a good enough upper bound
+#define FDT_MAX_MEMORY_REGIONS 16 // should be a good enough upper bound
/*
* Functions for picking apart flattened trees.
@@ -504,6 +507,96 @@
}
/*
+ * fdt_read_memory_regions finds memory ranges from a flat device-tree
+ *
+ * @params blob address of FDT
+ * @params regions all regions that are read inside the reg property of
+ * memory nodes are saved inside this array
+ * @params regions_count maximum number of entries that can be saved inside
+ * the regions array.
+ *
+ * Returns: Either 0 on error or returns the number of regions put into the regions array.
+ */
+size_t fdt_read_memory_regions(const void *blob,
+ struct device_tree_region regions[],
+ size_t regions_count)
+{
+ u32 node, root, addrcp, sizecp;
+ u32 nodes[FDT_MAX_MEMORY_NODES] = {0};
+ size_t region_idx = 0;
+ size_t node_count = 0;
+
+ if (!fdt_is_valid(blob))
+ return 0;
+
+ node = fdt_find_node_by_path(blob, "/memory", &addrcp, &sizecp);
+ if (node) {
+ region_idx += fdt_read_reg_prop(blob, node, addrcp, sizecp,
+ regions, regions_count);
+ if (region_idx >= regions_count) {
+ printk(BIOS_WARNING, "FDT: Too many memory regions\n");
+ goto out;
+ }
+ }
+
+ root = fdt_find_node_by_path(blob, "/", &addrcp, &sizecp);
+ node_count = fdt_find_subnodes_by_prefix(blob, root, "memory@",
+ &addrcp, &sizecp, nodes,
+ FDT_MAX_MEMORY_NODES);
+ if (node_count >= FDT_MAX_MEMORY_NODES) {
+ printk(BIOS_WARNING, "FDT: Too many memory nodes\n");
+ /* Can still reading the regions for those we got */
+ }
+
+ for (size_t i = 0; i < MIN(node_count, FDT_MAX_MEMORY_NODES); i++) {
+ region_idx += fdt_read_reg_prop(blob, nodes[i], addrcp, sizecp,
+ ®ions[region_idx],
+ regions_count - region_idx);
+ if (region_idx >= regions_count) {
+ printk(BIOS_WARNING, "FDT: Too many memory regions\n");
+ goto out;
+ }
+ }
+
+out:
+ for (size_t i = 0; i < MIN(region_idx, regions_count); i++) {
+ printk(BIOS_DEBUG, "FDT: Memory region [%#llx - %#llx]\n",
+ regions[i].addr, regions[i].addr + regions[i].size);
+ }
+
+ return region_idx;
+}
+
+/*
+ * fdt_get_memory_top finds top of memory from a flat device-tree
+ *
+ * @params blob address of FDT
+ *
+ * Returns: Either 0 on error or returns the maximum memory address
+ */
+uint64_t fdt_get_memory_top(const void *blob)
+{
+ struct device_tree_region regions[FDT_MAX_MEMORY_REGIONS] = {0};
+ uint64_t top = 0;
+ uint64_t total = 0;
+ size_t count;
+
+ if (!fdt_is_valid(blob))
+ return 0;
+
+ count = fdt_read_memory_regions(blob, regions, FDT_MAX_MEMORY_REGIONS);
+ for (size_t i = 0; i < MIN(count, FDT_MAX_MEMORY_REGIONS); i++) {
+ top = MAX(top, regions[i].addr + regions[i].size);
+ total += regions[i].size;
+ }
+
+ printk(BIOS_DEBUG, "FDT: Found %u MiB of RAM\n",
+ (uint32_t)(total / MiB));
+
+ return top;
+}
+
+/*
* Functions to turn a flattened tree into an unflattened one.
*/
--
To view, visit https://review.coreboot.org/c/coreboot/+/80322?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I8bef09bc1bc4e324ebeaa37f78d67d3aa315f52c
Gerrit-Change-Number: 80322
Gerrit-PatchSet: 8
Gerrit-Owner: Alper Nebi Yasak <alpernebiyasak(a)gmail.com>
Gerrit-Reviewer: Jakub Czapiga <czapiga(a)google.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan(a)9elements.com>
Gerrit-Reviewer: Maximilian Brune <maximilian.brune(a)9elements.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Yidi Lin <yidilin(a)google.com>
Attention is currently required from: Benjamin Doron, Dinesh Gehlot, Kane Chen, Kapil Porwal, Karthik Ramasubramanian, Nick Vaccaro, Paul Menzel, Sowmya Aralguppe, Subrata Banik.
Angel Pons has posted comments on this change by Sowmya Aralguppe. ( https://review.coreboot.org/c/coreboot/+/82136?usp=email )
Change subject: mb/google/brox: Fix CPU crashlog device MMIO memory access
......................................................................
Patch Set 10:
(1 comment)
File src/soc/intel/alderlake/crashlog.c:
https://review.coreboot.org/c/coreboot/+/82136/comment/1796536c_5c998d6b?us… :
PS10, Line 205: &
> > What if the address is below 4G (the high dword is zero, but the low dword is non-zero)? Is this a valid value?
>
> do you mean above 4G? where MSB is non-zero and LSB is zero ?
I mean MSB is zero and LSB is non-zero, but the scenario you suggested is also a problem with this check.
This is how I would implement the check:
```suggestion
if (!dw1 && !dw0) {
```
--
To view, visit https://review.coreboot.org/c/coreboot/+/82136?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I262254ee8d0eb91efcb3e748d121e13c31e66251
Gerrit-Change-Number: 82136
Gerrit-PatchSet: 10
Gerrit-Owner: Sowmya Aralguppe <sowmya.aralguppe(a)intel.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Benjamin Doron <benjamin.doron00(a)gmail.com>
Gerrit-Reviewer: Dinesh Gehlot <digehlot(a)google.com>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.corp-partner.google.com>
Gerrit-Reviewer: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Reviewer: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Ashish Kumar Mishra <ashish.k.mishra(a)intel.com>
Gerrit-CC: Krishna P Bhat D <krishna.p.bhat.d(a)intel.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Ronak Kanabar <ronak.kanabar(a)intel.com>
Gerrit-Attention: Sowmya Aralguppe <sowmya.aralguppe(a)intel.com>
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Kane Chen <kane.chen(a)intel.corp-partner.google.com>
Gerrit-Attention: Benjamin Doron <benjamin.doron00(a)gmail.com>
Gerrit-Attention: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Dinesh Gehlot <digehlot(a)google.com>
Gerrit-Attention: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Attention: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-Comment-Date: Mon, 03 Jun 2024 15:15:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sowmya Aralguppe <sowmya.aralguppe(a)intel.com>
Comment-In-Reply-To: Subrata Banik <subratabanik(a)google.com>
Comment-In-Reply-To: Kapil Porwal <kapilporwal(a)google.com>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>