From 73c741bbf9a80b1b78940eeb96a8dc7075230e5d Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 5 Feb 2025 20:16:00 +0000 Subject: [PATCH 0001/3886] mb/starlabs/starbook/adl: Disconnect the WLAN Sleep GPIO The schematics show this pin isn't connected, so disconnect it. Change-Id: Ib21048fa0972231410b7e8f7829a9eeac1d065c7 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86286 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/adl/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/adl/gpio.c b/src/mainboard/starlabs/starbook/variants/adl/gpio.c index 77be325ebf..e1ecddc7b4 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl/gpio.c @@ -37,7 +37,7 @@ const struct pad_config gpio_table[] = { /* GPD8: Suspend Clock */ PAD_CFG_NF(GPD8, NONE, DEEP, NF1), /* GPD9: Wireless LAN Sleep */ - PAD_CFG_NF(GPD9, NONE, DEEP, NF1), + PAD_NC(GPD9, NONE), /* GPD10: Sleep S5 */ PAD_NC(GPD10, NONE), /* GPD11: LAN PHY Enable */ From 66d7d922e1ee7bf7ac30079db4396c8a5e6d5f41 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 5 Feb 2025 20:17:03 +0000 Subject: [PATCH 0002/3886] mb/starlabs/starbook/adl: Change the HPD to DEEP reset DEEP proves more reliable on Linux with USB-C displays. Change-Id: I04e243c6409af64fef0996b474aa448ce32b2da9 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86287 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/starbook/variants/adl/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/adl/gpio.c b/src/mainboard/starlabs/starbook/variants/adl/gpio.c index e1ecddc7b4..0d15429184 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl/gpio.c @@ -75,7 +75,7 @@ const struct pad_config gpio_table[] = { /* A18: DDI B DP HPD */ PAD_CFG_NF(GPP_A18, NONE, DEEP, NF1), /* A19: TCP0 HPD */ - PAD_CFG_NF(GPP_A19, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A19, NONE, DEEP, NF1), /* A20: Test Point 44 */ PAD_NC(GPP_A20, NONE), /* A21: Fingerprint Reader Interrupt */ From 78c9f0e96d8173f691cbf2580afb0d8e85d223ba Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 5 Feb 2025 20:17:54 +0000 Subject: [PATCH 0003/3886] mb/starlabs/starbook/adl: Remove OverCurrent config The schematics show that these are not connected, so disconnect the GPIOs and set the ports to OC_SKIP. Change-Id: I9e2b087b348fbae12edaf085fb61776277514c93 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86288 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/adl/devicetree.cb | 6 +++--- src/mainboard/starlabs/starbook/variants/adl/gpio.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb b/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb index 341ea4075b..217c375148 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb @@ -39,12 +39,12 @@ chip soc/intel/alderlake device ref gna on end device ref xhci on # Motherboard USB 3.0 Type-C - register "usb2_ports[0]" = "USB2_PORT_MID(OC5)" - register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC3)" + register "usb2_ports[0]" = "USB2_PORT_MID(OC_SKIP)" + register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Motherboard USB 3.0 Type-A register "usb2_ports[2]" = "USB2_PORT_MID(OC_SKIP)" - register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC5)" + register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Daughterboard USB 3.0 Type-A register "usb2_ports[6]" = "USB2_PORT_MID(OC0)" diff --git a/src/mainboard/starlabs/starbook/variants/adl/gpio.c b/src/mainboard/starlabs/starbook/variants/adl/gpio.c index 0d15429184..0e71085278 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl/gpio.c @@ -69,7 +69,7 @@ const struct pad_config gpio_table[] = { /* A15: Test Point 52 */ PAD_NC(GPP_A15, NONE), /* A16: USB OverCurrent 3 */ - PAD_CFG_NF(GPP_A16, NONE, DEEP, NF1), + PAD_NC(GPP_A16, NONE), /* A17: Not Connected */ PAD_NC(GPP_A17, NONE), /* A18: DDI B DP HPD */ @@ -257,7 +257,7 @@ const struct pad_config gpio_table[] = { /* E8: DRAM Sleep */ PAD_CFG_NF(GPP_E8, NONE, DEEP, NF1), /* E9: USB OverCurrent 0 */ - PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), + PAD_NC(GPP_E9, NONE), /* E10: PWD Amplifier Input */ PAD_NC(GPP_E10, NONE), /* E11: TPM IRQ */ From fa3fd6871aeece48257eac3c085f0132fd49d720 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 5 Feb 2025 20:19:21 +0000 Subject: [PATCH 0004/3886] mb/starlabs/starbook/adl: Change soft strap GPIO to DEEP reset This has no noticable affect apart from being more consistant with other boards. Change-Id: Ia2d9284a7dfd29f47356860d6085c7aa5b94adb4 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86289 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/starbook/variants/adl/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/adl/gpio.c b/src/mainboard/starlabs/starbook/variants/adl/gpio.c index 0e71085278..fb3d64d593 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl/gpio.c @@ -310,7 +310,7 @@ const struct pad_config gpio_table[] = { /* F9: EC Sleep S0 */ PAD_NC(GPP_F9, NONE), /* F10: Weak Internal PD 20K */ - PAD_CFG_GPO(GPP_F10, 0, PLTRST), + PAD_CFG_GPO(GPP_F10, 0, DEEP), /* F11: TPM ID */ PAD_NC(GPP_F11, NONE), /* F12: Not Connected */ From f56b8b49e80d8c2625eca27d0b3b146a28da7179 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Fri, 31 Jan 2025 11:28:20 -0600 Subject: [PATCH 0005/3886] drivers/intel/gma: Fix alignment of extended VBT in opregion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Intel's reference implementation in Slimbootloader pads the area allocated for the extended VBT to the nearest 512-byte boundary, which strongly suggests that the Windows driver expects the same. TEST=build/boot Linux 6.9, Win11 on starlabs/starlite_adl, verify VBT read properly by OS. Change-Id: Ib3784eea6eb929ffec9672fc123b833c11c057e8 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86275 Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) --- src/drivers/intel/gma/opregion.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c index f97d37350a..92665e0552 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -287,7 +287,7 @@ static inline bool uses_relative_vbt_addr(opregion_header_t *header) * values correctly for the opregion. */ static void opregion_add_ext_vbt(igd_opregion_t *opregion, uint8_t *ext_vbt, - optionrom_vbt_t *vbt) + optionrom_vbt_t *vbt, size_t ext_vbt_size) { opregion_header_t *header = &opregion->header; /* Copy VBT into extended VBT region (at offset 8 KiB) */ @@ -301,7 +301,7 @@ static void opregion_add_ext_vbt(igd_opregion_t *opregion, uint8_t *ext_vbt, else opregion->mailbox3.rvda = (uintptr_t)ext_vbt; - opregion->mailbox3.rvds = vbt->hdr_vbt_size; + opregion->mailbox3.rvds = ext_vbt_size; } /* Initialize IGD OpRegion, called from ACPI code and OS drivers */ @@ -311,6 +311,7 @@ enum cb_err intel_gma_init_igd_opregion(void) struct region_device rdev; optionrom_vbt_t *vbt = NULL; size_t opregion_size = sizeof(igd_opregion_t); + size_t ext_vbt_size; if (acpi_is_wakeup_s3()) return intel_gma_restore_opregion(); @@ -331,7 +332,9 @@ enum cb_err intel_gma_init_igd_opregion(void) } /* Add the space for the extended VBT header even if it's not used */ - opregion_size += vbt->hdr_vbt_size; + /* Align the VBT to nearest 512 byte boundary */ + ext_vbt_size = ALIGN_UP(vbt->hdr_vbt_size, 512); + opregion_size += ext_vbt_size; opregion = cbmem_add(CBMEM_ID_IGD_OPREGION, opregion_size); if (!opregion) { @@ -353,7 +356,7 @@ enum cb_err intel_gma_init_igd_opregion(void) if (is_ext_vbt_required(opregion, vbt)) { /* Place extended VBT just after opregion */ uint8_t *ext_vbt = (uint8_t *)opregion + sizeof(*opregion); - opregion_add_ext_vbt(opregion, ext_vbt, vbt); + opregion_add_ext_vbt(opregion, ext_vbt, vbt, ext_vbt_size); } else { /* Raw VBT size which can fit in gvd1 */ memcpy(opregion->vbt.gvd1, vbt, vbt->hdr_vbt_size); From 857a92ef4b8655db23fdb3d8e728436eb2bc88c6 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 4 Feb 2025 10:32:58 -0600 Subject: [PATCH 0006/3886] drivers/intel/gma: Don't advertise support for opregion mailbox #2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IGD mailbox #2, Software SCI Interface, is not supported by coreboot currently, as it requires supporting the Get BIOS Data (GBDA) and System BIOS Callbacks (SBCB) interfaces. Since coreboot doesn't support these, don't advertise mailbox #2 support. This eliminates an error with the Linux display drivers: "SWSCI request timed out" TEST=build/boot Linux 6.9, Win11 on starlabs/starlite_adl Change-Id: I8efcf9c5d384b6e0ce159d65cb1497c2e2e47f42 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86276 Reviewed-by: Sean Rhodes Tested-by: build bot (Jenkins) Reviewed-by: Jérémy Compostella --- src/drivers/intel/gma/opregion.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/drivers/intel/gma/opregion.h b/src/drivers/intel/gma/opregion.h index 7b6a85db52..2de9213743 100644 --- a/src/drivers/intel/gma/opregion.h +++ b/src/drivers/intel/gma/opregion.h @@ -41,8 +41,7 @@ typedef struct { #define IGD_MBOX4 (1 << 3) #define IGD_MBOX5 (1 << 4) -#define MAILBOXES_MOBILE (IGD_MBOX1 | IGD_MBOX2 | IGD_MBOX3 | \ - IGD_MBOX4 | IGD_MBOX5) +#define MAILBOXES_MOBILE (IGD_MBOX1 | IGD_MBOX3 | IGD_MBOX4 | IGD_MBOX5) #define MAILBOXES_DESKTOP (IGD_MBOX2 | IGD_MBOX4) #define SBIOS_VERSION_SIZE 32 From 4526bc68df27313697027f8f8a05421f2e475cff Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 4 Feb 2025 13:39:26 -0600 Subject: [PATCH 0007/3886] drivers/intel/gma: Drop unused MAILBOXES_DESKTOP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MAILBOXES_DESKTOP is unused, and the IGD opregion spec makes no distinction in the mailboxes supported between desktop and mobile platforms. Rename MAILBOXES_MOBILE to IGD_MAILBOXES for consistency with other mailbox variables and clean up the comment. Change-Id: Ia06fe75702887aa6953bf17bd4bc14af4038bec5 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86279 Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) --- src/drivers/intel/gma/opregion.c | 4 ++-- src/drivers/intel/gma/opregion.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c index 92665e0552..4f5f802a4e 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -367,8 +367,8 @@ enum cb_err intel_gma_init_igd_opregion(void) /* 8kb */ opregion->header.size = sizeof(igd_opregion_t) / 1024; - // FIXME We just assume we're mobile for now - opregion->header.mailboxes = MAILBOXES_MOBILE; + // Supported mailboxes + opregion->header.mailboxes = IGD_MAILBOXES; // TODO Initialize Mailbox 1 opregion->mailbox1.clid = 1; diff --git a/src/drivers/intel/gma/opregion.h b/src/drivers/intel/gma/opregion.h index 2de9213743..77fccf8e54 100644 --- a/src/drivers/intel/gma/opregion.h +++ b/src/drivers/intel/gma/opregion.h @@ -41,8 +41,7 @@ typedef struct { #define IGD_MBOX4 (1 << 3) #define IGD_MBOX5 (1 << 4) -#define MAILBOXES_MOBILE (IGD_MBOX1 | IGD_MBOX3 | IGD_MBOX4 | IGD_MBOX5) -#define MAILBOXES_DESKTOP (IGD_MBOX2 | IGD_MBOX4) +#define IGD_MAILBOXES (IGD_MBOX1 | IGD_MBOX3 | IGD_MBOX4 | IGD_MBOX5) #define SBIOS_VERSION_SIZE 32 From d5ad4ce36c2a247e31f48a046ae976276e9bab07 Mon Sep 17 00:00:00 2001 From: Bora Guvendik Date: Tue, 4 Feb 2025 09:50:44 -0800 Subject: [PATCH 0008/3886] soc/intel/pantherlake: Add ability to set SaGv work points MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hook up SaGv work point UPDs. BUG=none TEST=Boot to OS. Signed-off-by: Bora Guvendik Change-Id: Ie38d007edc293727066f2bc9f67037e6fbe77aa5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86277 Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/soc/intel/pantherlake/chip.h | 8 ++++++++ src/soc/intel/pantherlake/romstage/fsp_params.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/soc/intel/pantherlake/chip.h b/src/soc/intel/pantherlake/chip.h index e879fadb60..cd91e31dd0 100644 --- a/src/soc/intel/pantherlake/chip.h +++ b/src/soc/intel/pantherlake/chip.h @@ -42,6 +42,14 @@ struct ibecc_config { uint16_t region_mask[MAX_IBECC_REGIONS]; }; +/* SaGv gears */ +enum soc_intel_pantherlake_sagv_gears { + GEAR_AUTO = 0, + GEAR_1 = 1, + GEAR_2 = 2, + GEAR_4 = 4, +}; + enum soc_intel_pantherlake_power_limits { PTL_U_1_CORE, PTL_H_1_CORE, diff --git a/src/soc/intel/pantherlake/romstage/fsp_params.c b/src/soc/intel/pantherlake/romstage/fsp_params.c index 5b968918b2..0c17d020c3 100644 --- a/src/soc/intel/pantherlake/romstage/fsp_params.c +++ b/src/soc/intel/pantherlake/romstage/fsp_params.c @@ -73,6 +73,11 @@ static void fill_fspm_mrc_params(FSP_M_CONFIG *m_cfg, m_cfg->SaGvWpMask = config->sagv_wp_bitmap; else m_cfg->SaGvWpMask = SAGV_POINTS_0_1_2_3; + + for (size_t i = 0; i < HOB_MAX_SAGV_POINTS; i++) { + m_cfg->SaGvFreq[i] = config->sagv_freq_mhz[i]; + m_cfg->SaGvGear[i] = config->sagv_gear[i]; + } } if (config->max_dram_speed_mts) From d0f895a5484f06f6e27716022eb03a0ef54471e9 Mon Sep 17 00:00:00 2001 From: Bora Guvendik Date: Tue, 4 Feb 2025 08:05:07 -0800 Subject: [PATCH 0009/3886] mb/google/fatcat: Set frequency and gears for SaGv work points Update sagv gears and frequency values as per recommendation from power and performance team. BUG=none TEST=Boot to OS. Signed-off-by: Bora Guvendik Change-Id: I315fcac387680df9312880120b7e6d33bded38e0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86274 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- .../fatcat/variants/baseboard/fatcat/devicetree.cb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb b/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb index 342c534b7b..c217a159e1 100644 --- a/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb +++ b/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb @@ -33,6 +33,18 @@ chip soc/intel/pantherlake # Enable SAGv register "sagv" = "SAGV_ENABLED" + register "sagv_freq_mhz[0]" = "2400" + register "sagv_gear[0]" = "GEAR_4" + + register "sagv_freq_mhz[1]" = "3200" + register "sagv_gear[1]" = "GEAR_4" + + register "sagv_freq_mhz[2]" = "6000" + register "sagv_gear[2]" = "GEAR_4" + + register "sagv_freq_mhz[3]" = "6400" + register "sagv_gear[3]" = "GEAR_4" + # Enable s0ix register "s0ix_enable" = "true" From e75cc637cee589e3da2c78f67d133cffe1175d26 Mon Sep 17 00:00:00 2001 From: Amanda Huang Date: Thu, 6 Feb 2025 02:44:03 +0800 Subject: [PATCH 0010/3886] mb/google/fatcat/var/francka: Decrease trace length of USB-A phy to short To resolve the issue of not being able to boot from USB on Francka, the USB PHY settings need to be modified. BUG=b:394206896 TEST=Build and test Type-A port function works fine Change-Id: I140b8a2047768d3aeb0d5919aad998bd9dcd099f Signed-off-by: Amanda Huang Reviewed-on: https://review.coreboot.org/c/coreboot/+/86285 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Ian Feng --- src/mainboard/google/fatcat/variants/francka/overridetree.cb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/francka/overridetree.cb b/src/mainboard/google/fatcat/variants/francka/overridetree.cb index 9d2dd2f0bf..dc76b85639 100644 --- a/src/mainboard/google/fatcat/variants/francka/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/francka/overridetree.cb @@ -28,9 +28,9 @@ chip soc/intel/pantherlake register "max_dram_speed_mts" = "7467" - register "usb2_ports[1]" = "USB2_PORT_MID(OC0)" # Type-A Port A0 + register "usb2_ports[1]" = "USB2_PORT_SHORT(OC0)" # Type-A Port A0 register "usb2_ports[3]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C0 - register "usb2_ports[4]" = "USB2_PORT_MID(OC0)" # Type-A Port A1 + register "usb2_ports[4]" = "USB2_PORT_SHORT(OC0)" # Type-A Port A1 register "usb2_ports[5]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C1 register "usb2_ports[6]" = "USB2_PORT_MID(OC_SKIP)" # USB HUB (USB2 Camera) register "usb2_ports[7]" = "USB2_PORT_MID(OC_SKIP)" # CNVi BT or discrete BT From 21f0df3c1ab1fa174dcd3d6c66f00047ba9e7e66 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 6 Feb 2025 20:37:49 +0000 Subject: [PATCH 0011/3886] mb/starlabs/starbook/mtl: Correct DIMM Speed Size The DDR5 modules have a speed size of 1024 bytes, not 512. Update Kconfig to reflect this. Change-Id: Ic7b691104ff8b0061a485f01709a2f53046cc94a Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86306 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/starlabs/starbook/Kconfig b/src/mainboard/starlabs/starbook/Kconfig index b7e1c63b46..1565f88290 100644 --- a/src/mainboard/starlabs/starbook/Kconfig +++ b/src/mainboard/starlabs/starbook/Kconfig @@ -139,6 +139,7 @@ config DEVICETREE default "variants/\$(CONFIG_VARIANT_DIR)/devicetree.cb" config DIMM_SPD_SIZE + default 1024 if BOARD_STARLABS_STARBOOK_MTL default 512 config DRIVER_TPM_SPI_CHIP From 4ef7804bc4ec957dff23390e85ae931b66ee4c30 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 6 Feb 2025 20:39:03 +0000 Subject: [PATCH 0012/3886] mb/starlabs/starbook/mtl: Add rcomp configuration Add rcomp configuration values taken from the AMI CRB. This fixes failed memory training for certain memory modules. Change-Id: If7a29bbd015d45eac178480ba6cae42912e25195 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86307 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/mtl/romstage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c index 14b2664cbd..26a4e5eb3c 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c @@ -13,6 +13,10 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) .UserBd = BOARD_TYPE_MOBILE, .ddr_config = { .dq_pins_interleaved = false, + }, + .rcomp = { + .resistor = 100, + .targets = {70, 30, 25, 25, 25}, } }; From 6e7b44f4f3ada7f365c34edf522eb5f2346fc25d Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 6 Feb 2025 19:52:53 +0000 Subject: [PATCH 0013/3886] ec/starlabs/merlin: Add an option to disable the fan Add an option alongside the three existing curves to just turn off the fan. Change-Id: I39f6599056fe0116abbd7e2eb4084f77a7c395d3 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86304 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/ec/starlabs/merlin/ec.h | 1 + src/ec/starlabs/merlin/ite.c | 5 +++-- src/mainboard/starlabs/starbook/cfr.c | 1 + src/mainboard/starlabs/starfighter/cfr.c | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ec/starlabs/merlin/ec.h b/src/ec/starlabs/merlin/ec.h index d5e1788e79..82572bde73 100644 --- a/src/ec/starlabs/merlin/ec.h +++ b/src/ec/starlabs/merlin/ec.h @@ -79,6 +79,7 @@ #define FAN_NORMAL 0x00 #define FAN_AGGRESSIVE 0xbb #define FAN_QUIET 0xaa +#define FAN_DISABLED 0xcc /* Fn Lock State */ #define UNLOCKED 0x00 diff --git a/src/ec/starlabs/merlin/ite.c b/src/ec/starlabs/merlin/ite.c index 1dd83a8c83..6eaa3e9915 100644 --- a/src/ec/starlabs/merlin/ite.c +++ b/src/ec/starlabs/merlin/ite.c @@ -175,14 +175,15 @@ static void merlin_init(struct device *dev) * * Setting: fan_mode * - * Values: Quiet, Normal, Aggressive + * Values: Disabled, Quiet, Normal, Aggressive * Default: Normal * */ const uint8_t fan_mode[] = { FAN_NORMAL, FAN_AGGRESSIVE, - FAN_QUIET + FAN_QUIET, + FAN_DISABLED }; if (CONFIG(EC_STARLABS_FAN)) diff --git a/src/mainboard/starlabs/starbook/cfr.c b/src/mainboard/starlabs/starbook/cfr.c index 82488fe660..9b47f48345 100644 --- a/src/mainboard/starlabs/starbook/cfr.c +++ b/src/mainboard/starlabs/starbook/cfr.c @@ -69,6 +69,7 @@ static const struct sm_object fan_mode = SM_DECLARE_ENUM({ { "Normal", 0 }, { "Aggressive", 1 }, { "Quiet", 2 }, + { "Disabled", 3 }, SM_ENUM_VALUE_END }, }); diff --git a/src/mainboard/starlabs/starfighter/cfr.c b/src/mainboard/starlabs/starfighter/cfr.c index 6802b751a3..7c8a123062 100644 --- a/src/mainboard/starlabs/starfighter/cfr.c +++ b/src/mainboard/starlabs/starfighter/cfr.c @@ -62,6 +62,7 @@ static const struct sm_object fan_mode = SM_DECLARE_ENUM({ { "Normal", 0 }, { "Aggressive", 1 }, { "Quiet", 2 }, + { "Disabled", 3 }, SM_ENUM_VALUE_END }, }); From 0f3589b3d7f166060f2d87b21f5d748abed741cd Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 6 Feb 2025 20:16:58 +0000 Subject: [PATCH 0014/3886] ec/starlabs/merlin: Add an option to disabled the lid switch Previously, the lid switch could be set to not wake the system. Add another option to ignore the switch entirely. Change-Id: I1dd666a44b332ffbbef4420799eeffd746fd1664 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86305 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/starbook/cfr.c | 7 ++++--- src/mainboard/starlabs/starfighter/cfr.c | 7 ++++--- src/mainboard/starlabs/starlite_adl/cfr.c | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mainboard/starlabs/starbook/cfr.c b/src/mainboard/starlabs/starbook/cfr.c index 9b47f48345..bf0e4b0bcf 100644 --- a/src/mainboard/starlabs/starbook/cfr.c +++ b/src/mainboard/starlabs/starbook/cfr.c @@ -126,11 +126,12 @@ static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ static const struct sm_object lid_switch = SM_DECLARE_ENUM({ .opt_name = "lid_switch", .ui_name = "Lid Switch", - .ui_helptext = "Enable or disable the lid switch.", + .ui_helptext = "Configure what opening or closing the lid will do.", .default_value = 0, .values = (const struct sm_enum_value[]) { - { "Enabled", 0 }, - { "Disabled", 1 }, + { "Normal", 0 }, + { "Sleep Only", 1 }, + { "Disabled", 2 }, SM_ENUM_VALUE_END }, }); #endif diff --git a/src/mainboard/starlabs/starfighter/cfr.c b/src/mainboard/starlabs/starfighter/cfr.c index 7c8a123062..f310f86a64 100644 --- a/src/mainboard/starlabs/starfighter/cfr.c +++ b/src/mainboard/starlabs/starfighter/cfr.c @@ -108,11 +108,12 @@ static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ static const struct sm_object lid_switch = SM_DECLARE_ENUM({ .opt_name = "lid_switch", .ui_name = "Lid Switch", - .ui_helptext = "Enable or disable the lid switch.", + .ui_helptext = "Configure what opening or closing the lid will do.", .default_value = 0, .values = (const struct sm_enum_value[]) { - { "Enabled", 0 }, - { "Disabled", 1 }, + { "Normal", 0 }, + { "Sleep Only", 1 }, + { "Disabled", 2 }, SM_ENUM_VALUE_END }, }); #endif diff --git a/src/mainboard/starlabs/starlite_adl/cfr.c b/src/mainboard/starlabs/starlite_adl/cfr.c index 58a09a3d7c..a8e44fa11c 100644 --- a/src/mainboard/starlabs/starlite_adl/cfr.c +++ b/src/mainboard/starlabs/starlite_adl/cfr.c @@ -73,11 +73,12 @@ static const struct sm_object gna = SM_DECLARE_BOOL({ static const struct sm_object lid_switch = SM_DECLARE_ENUM({ .opt_name = "lid_switch", .ui_name = "Lid Switch", - .ui_helptext = "Enable or disable the lid switch.", + .ui_helptext = "Configure what opening or closing the lid will do.", .default_value = 0, .values = (const struct sm_enum_value[]) { - { "Enabled", 0 }, - { "Disabled", 1 }, + { "Normal", 0 }, + { "Sleep Only", 1 }, + { "Disabled", 2 }, SM_ENUM_VALUE_END }, }); #endif From 9f6a871414d2e8e6b9444a6707c8de67c3396142 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Wed, 5 Feb 2025 16:12:30 +0800 Subject: [PATCH 0015/3886] mb/google/rauru: Support the panel with a load switch control The Rauru follower device goes `load switch` path to ensure the discharge timing meets the panel power-off sequence. Refactor panel.c to support this hardware change. Remove PANEL from fw_config since this is a board-specific change. BRANCH=rauru BUG=b:339580836 TEST=verify firmware screen on Navi Change-Id: I57dcaa2a0b5af94fe3fa3eaf04e9f3159c51d144 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86282 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/mainboard/google/rauru/devicetree.cb | 7 ------- src/mainboard/google/rauru/panel.c | 14 +++++++------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/mainboard/google/rauru/devicetree.cb b/src/mainboard/google/rauru/devicetree.cb index 55cc91c307..1705dbeb9b 100644 --- a/src/mainboard/google/rauru/devicetree.cb +++ b/src/mainboard/google/rauru/devicetree.cb @@ -8,13 +8,6 @@ fw_config end end -fw_config - field PANEL 18 21 - option DEFAULT 0 - option OLED 1 - end -end - chip soc/mediatek/mt8196 device cpu_cluster 0 on end diff --git a/src/mainboard/google/rauru/panel.c b/src/mainboard/google/rauru/panel.c index 8564f4ca04..37e4001159 100644 --- a/src/mainboard/google/rauru/panel.c +++ b/src/mainboard/google/rauru/panel.c @@ -27,23 +27,23 @@ static struct panel_description panel = { .orientation = LB_FB_ORIENTATION_NORMAL, }; -static void power_on_oled_panel(void) +static void power_on_load_switch(void) { gpio_output(GPIO_EN_PP3300_EDP_X, 1); gpio_set_mode(GPIO_EDP_HPD_1V8, GPIO_FUNC(EINT13, EDP_TX_HPD)); } -static struct panel_description oled_panel = { +static struct panel_description edp_panel = { .configure_backlight = configure_backlight, - .power_on = power_on_oled_panel, + .power_on = power_on_load_switch, .disp_path = DISP_PATH_EDP, .orientation = LB_FB_ORIENTATION_NORMAL, }; struct panel_description *get_active_panel(void) { - if (fw_config_probe(FW_CONFIG(PANEL, OLED))) { - return &oled_panel; - } - return &panel; + if (CONFIG(BOARD_GOOGLE_RAURU)) + return &panel; + + return &edp_panel; } From 57fbd9c92c0f39039d86806189bddde873eaed1f Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Thu, 6 Feb 2025 16:21:26 +0800 Subject: [PATCH 0016/3886] mb/google/rauru: Pull HPD pin up Pull HPD (Hot Plug Detect) pin up in order to detect the panel. BRANCH=rauru BUG=b:376357839 TEST=Verify FW screen on Navi and Hylia Change-Id: Ie11ceabad0b9872729125936d90b93b5d6d7cea6 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86294 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/mainboard/google/rauru/panel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/rauru/panel.c b/src/mainboard/google/rauru/panel.c index 37e4001159..92d2f30cf1 100644 --- a/src/mainboard/google/rauru/panel.c +++ b/src/mainboard/google/rauru/panel.c @@ -31,6 +31,7 @@ static void power_on_load_switch(void) { gpio_output(GPIO_EN_PP3300_EDP_X, 1); gpio_set_mode(GPIO_EDP_HPD_1V8, GPIO_FUNC(EINT13, EDP_TX_HPD)); + gpio_set_pull(GPIO_EDP_HPD_1V8, GPIO_PULL_ENABLE, GPIO_PULL_UP); } static struct panel_description edp_panel = { From 8deb8e94ad7d5ebcc0631c5b39d4941d41ea9715 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Thu, 6 Feb 2025 18:12:34 +0800 Subject: [PATCH 0017/3886] soc/mediatek/mt8196: Correct assert conditions Correct the assert conditions in dptx_hal_setswing_preemphasis() and dptx_hal_phy_set_swing_preemphasis(). BRANCH=rauru BUG=b:376357839 TEST=Verify FW screen with a 4 lanes panel on Hylia Change-Id: I8830b05c976ea2ba987de6333b93e2394d3403ba Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86302 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/mt8196/dptx_hal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/mt8196/dptx_hal.c b/src/soc/mediatek/mt8196/dptx_hal.c index 168d62bc32..e6078aea88 100644 --- a/src/soc/mediatek/mt8196/dptx_hal.c +++ b/src/soc/mediatek/mt8196/dptx_hal.c @@ -87,7 +87,7 @@ bool dptx_hal_hpd_high(struct mtk_dp *mtk_dp) bool dptx_hal_setswing_preemphasis(struct mtk_dp *mtk_dp, int lane_num, u8 swing_value, u8 preemphasis) { - assert(lane_num < DPTX_LANE_MAX); + assert(lane_num <= DPTX_LANE_MAX); for (int i = 0; i < lane_num; ++i) { mtk_dp_phy_mask(mtk_dp, driving_offset[i], @@ -348,7 +348,7 @@ void dptx_hal_set_txlane(struct mtk_dp *mtk_dp, u8 value) void dptx_hal_phy_set_swing_preemphasis(struct mtk_dp *mtk_dp, u8 lane_count, u8 *swing_val, u8 *preemphasis) { - assert(lane_count < DPTX_LANE_MAX); + assert(lane_count <= DPTX_LANE_MAX); for (int i = 0; i < lane_count; ++i) { mtk_dp_phy_mask(mtk_dp, driving_offset[i], From fa703f7b94723ea75a0632ade9c3083620d31544 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 3 Feb 2025 03:17:22 +0100 Subject: [PATCH 0018/3886] intel/acpi: Put BSP as the first entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux complains in dmesg as a firmware bug that BSP is not the first entry. NetBSD hangs and OpenBSD panics early on boot. With this patch I was able to boot NetBSD and OpenBSD on darp10-b when loaded in GRUB. Note: vanilla bootloaders for NetBSD and OpenBSD still result in an apparent hang for an unknown reason. Change-Id: I520a2e080c9f07a5866729ae2283990d20c0d691 Signed-off-by: Vladimir Serbinenko Reviewed-on: https://review.coreboot.org/c/coreboot/+/86247 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes Reviewed-by: Jérémy Compostella --- src/soc/intel/common/block/acpi/cpu_hybrid.c | 41 ++++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/soc/intel/common/block/acpi/cpu_hybrid.c b/src/soc/intel/common/block/acpi/cpu_hybrid.c index ee4777ae69..0e7ec53ea6 100644 --- a/src/soc/intel/common/block/acpi/cpu_hybrid.c +++ b/src/soc/intel/common/block/acpi/cpu_hybrid.c @@ -18,8 +18,8 @@ struct cpu_apic_info_type { /* * Ordered APIC IDs based on core type. - * Array begins with Performance Cores' APIC IDs, - * then followed by Efficeint Cores's APIC IDs. + * Array begins with BSP, then come all Performance Cores' APIC IDs, + * then followed by Efficient Cores's APIC IDs. */ int32_t apic_ids[CONFIG_MAX_CPUS]; @@ -27,11 +27,15 @@ struct cpu_apic_info_type { uint16_t total_cpu_cnt; /* - * Total Performance core count. This will be used - * to identify the start of Efficient Cores's + * This will be used to identify the start of Efficient Cores's * APIC ID list */ - uint16_t perf_cpu_cnt; + uint16_t eff_cores_start; + + /* + * Set to true if bsp is a performance core + */ + bool is_bsp_perf; }; static struct cpu_apic_info_type cpu_apic_info; @@ -48,12 +52,25 @@ static void acpi_set_hybrid_cpu_apicid_order(void *unused) int32_t eff_apic_ids[CONFIG_MAX_CPUS] = {0}; extern struct cpu_info cpu_infos[]; uint32_t i, j = 0; + u32 bsp_lapicid = lapicid(); + + /* As per spec first comes BSP. + See 5.2.12.1 MADT Processor Local APIC / SAPIC Structure Entry Order + " platform firmware should list the boot processor as the first + processor entry in the MADT. " + */ + cpu_apic_info.apic_ids[0] = bsp_lapicid; for (i = 0; i < ARRAY_SIZE(cpu_apic_info.apic_ids); i++) { if (!cpu_infos[i].cpu) continue; + if (cpu_infos[i].cpu->path.apic.apic_id == bsp_lapicid) { + cpu_apic_info.is_bsp_perf = + cpu_infos[i].cpu->path.apic.core_type == CPU_TYPE_PERF; + continue; + } if (cpu_infos[i].cpu->path.apic.core_type == CPU_TYPE_PERF) - cpu_apic_info.apic_ids[perf_core_cnt++] = + cpu_apic_info.apic_ids[1 + perf_core_cnt++] = cpu_infos[i].cpu->path.apic.apic_id; else eff_apic_ids[eff_core_cnt++] = @@ -61,18 +78,18 @@ static void acpi_set_hybrid_cpu_apicid_order(void *unused) } if (perf_core_cnt > 1) - bubblesort(cpu_apic_info.apic_ids, perf_core_cnt, NUM_ASCENDING); + bubblesort(cpu_apic_info.apic_ids + 1, perf_core_cnt, NUM_ASCENDING); - for (i = perf_core_cnt; j < eff_core_cnt; i++, j++) + for (i = perf_core_cnt + 1; j < eff_core_cnt; i++, j++) cpu_apic_info.apic_ids[i] = eff_apic_ids[j]; if (eff_core_cnt > 1) - bubblesort(&cpu_apic_info.apic_ids[perf_core_cnt], eff_core_cnt, NUM_ASCENDING); + bubblesort(&cpu_apic_info.apic_ids[perf_core_cnt + 1], eff_core_cnt, NUM_ASCENDING); /* Populate total core count */ - cpu_apic_info.total_cpu_cnt = perf_core_cnt + eff_core_cnt; + cpu_apic_info.total_cpu_cnt = perf_core_cnt + eff_core_cnt + 1; - cpu_apic_info.perf_cpu_cnt = perf_core_cnt; + cpu_apic_info.eff_cores_start = perf_core_cnt + 1; } static unsigned long acpi_create_madt_lapics_hybrid(unsigned long current) @@ -132,7 +149,7 @@ static void acpigen_cppc_update_nominal_freq_perf(const char *pkg_path, s32 core acpi_get_cpu_nomi_perf(&eff_core_nom_perf, &perf_core_nom_perf); - if (core_id < cpu_apic_info.perf_cpu_cnt) + if (core_id == 0 ? cpu_apic_info.is_bsp_perf : (core_id < cpu_apic_info.eff_cores_start)) acpigen_set_package_element_int(pkg_path, CPPC_NOM_PERF_IDX, perf_core_nom_perf); else acpigen_set_package_element_int(pkg_path, CPPC_NOM_PERF_IDX, From 4a2135d21eda950fd072e218cc071eba580d5b8a Mon Sep 17 00:00:00 2001 From: John Su Date: Mon, 3 Feb 2025 23:25:25 +0800 Subject: [PATCH 0019/3886] mb/google/trulo/var/uldrenite: Add fw_config probe for Cellular Use fw_config to probe Cellular. BUG=b:392040004 BRANCH=firmware-trulo-15217.771.B TEST=emerge-nissa coreboot chromeos-bootimage Change-Id: Ib664f543c6012b44a0a604d0943416519d92a057 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86255 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Dtrain Hsu --- .../brya/variants/uldrenite/overridetree.cb | 17 ++++++++++++++--- .../google/brya/variants/uldrenite/variant.c | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb index 3c067505fe..862968efd4 100644 --- a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb +++ b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb @@ -1,4 +1,8 @@ fw_config + field DB_CELLULAR 1 2 + option CELLULAR_ABSENT 0 + option CELLULAR_RW350R 1 + end field TOUCHSCREEN 4 4 option TOUCHSCREEN_UNKNOWN 0 option TOUCHSCREEN_NONE 1 @@ -278,7 +282,9 @@ chip soc/intel/alderlake chip drivers/usb/acpi register "desc" = ""USB2 WWAN"" register "type" = "UPC_TYPE_INTERNAL" - device ref usb2_port5 on end + device ref usb2_port5 on + probe DB_CELLULAR CELLULAR_RW350R + end end chip drivers/usb/acpi register "desc" = ""USB2 User Facing Camera"" @@ -459,7 +465,9 @@ chip soc/intel/alderlake register "srcclk_pin" = "2" register "ext_pm_support" = "ACPI_PCIE_RP_EMIT_ALL" register "skip_on_off_support" = "true" - device generic 0 alias rp2_rtd3 on end + device generic 0 alias rp2_rtd3 on + probe DB_CELLULAR CELLULAR_RW350R + end end chip drivers/wwan/fm register "fcpo_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_H23)" @@ -468,8 +476,11 @@ chip soc/intel/alderlake register "wake_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E16)" register "add_acpi_dma_property" = "true" use rp2_rtd3 as rtd3dev - device generic 0 alias rp2_wwan on end + device generic 0 alias rp2_wwan on + probe DB_CELLULAR CELLULAR_RW350R + end end + probe DB_CELLULAR CELLULAR_RW350R end # PCIE2 WWAN card device ref shared_sram on end device ref heci1 on end diff --git a/src/mainboard/google/brya/variants/uldrenite/variant.c b/src/mainboard/google/brya/variants/uldrenite/variant.c index 96b22918f6..f5bbaf6924 100644 --- a/src/mainboard/google/brya/variants/uldrenite/variant.c +++ b/src/mainboard/google/brya/variants/uldrenite/variant.c @@ -37,6 +37,17 @@ static const struct pad_config touchscreen_disable_pads[] = { PAD_NC(GPP_E17, NONE), }; +static const struct pad_config lte_disable_pads[] = { + /* A8 : WWAN_RF_DISABLE_ODL */ + PAD_NC(GPP_A8, NONE), + /* F12 : WWAN_RST_L */ + PAD_NC_LOCK(GPP_F12, NONE, LOCK_CONFIG), + /* F13 : PLTRST_WWAN# */ + PAD_NC(GPP_F13, NONE), + /* H23 : WWAN_EN */ + PAD_NC(GPP_H23, NONE), +}; + void fw_config_gpio_padbased_override(struct pad_config *padbased_table) { if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_NONE))) { @@ -44,10 +55,17 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table) gpio_padbased_override(padbased_table, touchscreen_disable_pads, ARRAY_SIZE(touchscreen_disable_pads)); } + if (fw_config_probe(FW_CONFIG(DB_CELLULAR, CELLULAR_ABSENT))) { + printk(BIOS_INFO, "Disable Cellular GPIO pins.\n"); + gpio_padbased_override(padbased_table, lte_disable_pads, + ARRAY_SIZE(lte_disable_pads)); + } } void variant_init(void) { + if (fw_config_probe(FW_CONFIG(DB_CELLULAR, CELLULAR_ABSENT))) + return; /* * RW350R power on seuqence: * De-assert WWAN_EN -> 20ms -> de-assert WWAN_RST -> 30ms -> From 99cfad508a49993beb4826097cce9d772c778c92 Mon Sep 17 00:00:00 2001 From: Filip Brozovic Date: Tue, 21 Jan 2025 11:59:11 +0100 Subject: [PATCH 0020/3886] CFR: Add version field to root struct Add a version field to the CFR root struct so parsers can check compatibility when parsing structs. Change-Id: Ifcb950f1bdedc0ab925f3841befb7e7001c0f7f4 Signed-off-by: Filip Brozovic Reviewed-on: https://review.coreboot.org/c/coreboot/+/86080 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Angel Pons --- src/commonlib/include/commonlib/cfr.h | 2 ++ src/commonlib/include/commonlib/coreboot_tables.h | 1 + src/drivers/option/cfr.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/commonlib/include/commonlib/cfr.h b/src/commonlib/include/commonlib/cfr.h index cc8431a2db..5d8b37bf56 100644 --- a/src/commonlib/include/commonlib/cfr.h +++ b/src/commonlib/include/commonlib/cfr.h @@ -49,6 +49,8 @@ * */ +#define CFR_VERSION 0x00000000 + enum cfr_tags { CFR_TAG_OPTION_FORM = 1, CFR_TAG_ENUM_VALUE = 2, diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index def48b7797..78dbe8ef4c 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -602,6 +602,7 @@ struct lb_efi_fw_info { struct lb_cfr { uint32_t tag; uint32_t size; + uint32_t version; uint32_t checksum; /* Checksum of the variable payload. */ /* struct lb_cfr_option_form forms[] */ }; diff --git a/src/drivers/option/cfr.c b/src/drivers/option/cfr.c index e833d7bdba..15c4fd9b4e 100644 --- a/src/drivers/option/cfr.c +++ b/src/drivers/option/cfr.c @@ -307,6 +307,7 @@ void cfr_write_setup_menu(struct lb_cfr *cfr_root, struct sm_obj_form *sm_root[] cfr_root->tag = LB_TAG_CFR_ROOT; cfr_root->size = sizeof(*cfr_root); + cfr_root->version = CFR_VERSION; current += cfr_root->size; while (sm_root && sm_root[i]) From 17cc750e8bf9ac979756942f3e104febef6dc364 Mon Sep 17 00:00:00 2001 From: Filip Brozovic Date: Tue, 14 Jan 2025 22:42:41 +0100 Subject: [PATCH 0021/3886] CFR: add dependencies based on specific option values Implements a way for CFR options to depend on another option being set to one or more specific values. This is achieved by writing a list of values as a varbinary struct. Change-Id: Iaf7965551490969052eb27c207fa524470d4dd6a Signed-off-by: Filip Brozovic Reviewed-on: https://review.coreboot.org/c/coreboot/+/85987 Reviewed-by: Angel Pons Reviewed-by: Matt DeVillier Reviewed-by: Sean Rhodes Tested-by: build bot (Jenkins) --- Documentation/drivers/cfr_internal.md | 36 ++++++++++++- src/commonlib/include/commonlib/cfr.h | 8 ++- src/drivers/option/cfr.c | 78 ++++++++++++++++++++------- src/drivers/option/cfr_frontend.h | 24 ++++++--- 4 files changed, 117 insertions(+), 29 deletions(-) diff --git a/Documentation/drivers/cfr_internal.md b/Documentation/drivers/cfr_internal.md index 95fef66eee..b2355d7b62 100644 --- a/Documentation/drivers/cfr_internal.md +++ b/Documentation/drivers/cfr_internal.md @@ -50,8 +50,9 @@ static const struct sm_object serial_number = SM_DECLARE_VARCHAR({ The CFR options can have a dependency that must be evaluated at runtime by the OS/payload that parses the CFR record and displays the UI. -By using the `WITH_DEP()` macro you can specify another numberic option that -is checked to hide the current option. +By using the `WITH_DEP()` macro you can specify another numeric option that +is checked to hide the current option. The `WITH_DEP_VALUES()` macro allows +specifying one or more values that cause the dependent option to be displayed. **Example:** Declares a dependency from `sata_disable_port0` to `sata_enable`. The option `sata_disable_port0` will be hidden as long as "sata_enable" is 0. @@ -76,6 +77,37 @@ static struct sm_object sata_disable_port0 = SM_DECLARE_BOOL({ }, WITH_DEP(&sata_enable)); ``` +**Example:** Declares a dependency from `com1_termination` to `com1_mode`. +The option `com1_termination` will only be shown if `com1_mode` is set to RS-485. + +``` +#define COM_MODE_DISABLED 3 +#define COM_MODE_RS232 0 +#define COM_MODE_RS485 1 + +static struct sm_object com1_mode = SM_DECLARE_ENUM({ + .flags = CFR_OPTFLAG_RUNTIME, + .opt_name = "com1_mode", + .ui_name = "COM1 Mode", + .ui_helptext = NULL, + .default_value = 1, + .values = (const struct sm_enum_value[]) { + { "Disabled", COM_MODE_DISABLED }, + { "RS-232", COM_MODE_RS232 }, + { "RS-485", COM_MODE_RS485 }, + SM_ENUM_VALUE_END }, +}); + +static struct sm_object com1_termination = SM_DECLARE_BOOL({ + .flags = CFR_OPTFLAG_RUNTIME, + .opt_name = "com1_termination", + .ui_name = "Enable COM1 termination resistors", + .ui_helptext = NULL, + .default_value = false, +}, WITH_DEP_VALUES(&com1_mode, COM_MODE_RS485)); + +``` + ### Providing mainboard custom options A mainboard that uses CFR can provide a list of custom options diff --git a/src/commonlib/include/commonlib/cfr.h b/src/commonlib/include/commonlib/cfr.h index 5d8b37bf56..570ce3c2d1 100644 --- a/src/commonlib/include/commonlib/cfr.h +++ b/src/commonlib/include/commonlib/cfr.h @@ -63,6 +63,7 @@ enum cfr_tags { CFR_TAG_VARCHAR_UI_HELPTEXT = 9, CFR_TAG_VARCHAR_DEF_VALUE = 10, CFR_TAG_OPTION_COMMENT = 11, + CFR_TAG_DEP_VALUES = 12, }; /* @@ -104,7 +105,8 @@ enum cfr_option_flags { struct __packed lb_cfr_varbinary { uint32_t tag; /* * CFR_TAG_VARCHAR_OPT_NAME, CFR_TAG_VARCHAR_UI_NAME, - * CFR_TAG_VARCHAR_UI_HELPTEXT or CFR_TAG_VARCHAR_DEF_VALUE + * CFR_TAG_VARCHAR_UI_HELPTEXT, CFR_TAG_VARCHAR_DEF_VALUE + * or CFR_TAG_DEP_VALUES */ uint32_t size; /* Length of the entire structure */ uint32_t data_length; /* Length of data, including NULL terminator for strings */ @@ -136,6 +138,7 @@ struct __packed lb_cfr_numeric_option { * struct lb_cfr_varbinary opt_name * struct lb_cfr_varbinary ui_name * struct lb_cfr_varbinary ui_helptext (Optional) + * struct lb_cfr_varbinary dependency_values (Optional) * struct lb_cfr_enum_value enum_values[] */ }; @@ -153,6 +156,7 @@ struct __packed lb_cfr_varchar_option { * struct lb_cfr_varbinary opt_name * struct lb_cfr_varbinary ui_name * struct lb_cfr_varbinary ui_helptext (Optional) + * struct lb_cfr_varbinary dependency_values (Optional) */ }; @@ -172,6 +176,7 @@ struct __packed lb_cfr_option_comment { /* * struct lb_cfr_varbinary ui_name * struct lb_cfr_varbinary ui_helptext (Optional) + * struct lb_cfr_varbinary dependency_values (Optional) */ }; @@ -186,6 +191,7 @@ struct __packed lb_cfr_option_form { uint32_t flags; /* enum cfr_option_flags */ /* * struct lb_cfr_varbinary ui_name + * struct lb_cfr_varbinary dependency_values (Optional) * struct lb_cfr_varchar_option options[] */ }; diff --git a/src/drivers/option/cfr.c b/src/drivers/option/cfr.c index 15c4fd9b4e..c439ed9546 100644 --- a/src/drivers/option/cfr.c +++ b/src/drivers/option/cfr.c @@ -69,6 +69,25 @@ static uint32_t sm_write_ui_helptext(char *current, const char *string) return write_cfr_varchar(current, string, CFR_TAG_VARCHAR_UI_HELPTEXT); } +static uint32_t sm_write_dep_values(char *current, + const uint32_t *dep_values, const uint32_t num_dep_values) +{ + /* Dependency values are optional */ + if (!dep_values || !num_dep_values) + return 0; + + struct lb_cfr_varbinary *cfr_values = (struct lb_cfr_varbinary *)current; + cfr_values->tag = CFR_TAG_DEP_VALUES; + cfr_values->data_length = sizeof(*dep_values) * num_dep_values; + char *data = current + sizeof(*cfr_values); + memcpy(data, dep_values, cfr_values->data_length); + + /* Make sure that every TAG/SIZE field is always aligned to LB_ENTRY_ALIGN */ + cfr_values->size = ALIGN_UP(sizeof(*cfr_values) + cfr_values->data_length, LB_ENTRY_ALIGN); + + return cfr_values->size; +} + static uint32_t sm_write_enum_value(char *current, const struct sm_enum_value *e) { struct lb_cfr_enum_value *enum_val = (struct lb_cfr_enum_value *)current; @@ -86,7 +105,7 @@ static uint32_t sm_write_enum_value(char *current, const struct sm_enum_value *e static uint32_t write_numeric_option(char *current, uint32_t tag, const uint64_t object_id, const char *opt_name, const char *ui_name, const char *ui_helptext, uint32_t flags, uint32_t default_value, const struct sm_enum_value *values, - const uint64_t dep_id) + const uint64_t dep_id, const uint32_t *dep_values, const uint32_t num_dep_values) { struct lb_cfr_numeric_option *option = (struct lb_cfr_numeric_option *)current; size_t len; @@ -110,6 +129,7 @@ static uint32_t write_numeric_option(char *current, uint32_t tag, const uint64_t return 0; current += len; current += sm_write_ui_helptext(current, ui_helptext); + current += sm_write_dep_values(current, dep_values, num_dep_values); if (option->tag == CFR_TAG_OPTION_ENUM && values) { for (const struct sm_enum_value *e = values; e->ui_name; e++) { @@ -122,35 +142,41 @@ static uint32_t write_numeric_option(char *current, uint32_t tag, const uint64_t } static uint32_t sm_write_opt_enum(char *current, const struct sm_obj_enum *sm_enum, - const uint64_t object_id, const uint64_t dep_id) + const uint64_t object_id, const uint64_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { return write_numeric_option(current, CFR_TAG_OPTION_ENUM, object_id, sm_enum->opt_name, sm_enum->ui_name, sm_enum->ui_helptext, sm_enum->flags, sm_enum->default_value, sm_enum->values, - dep_id); + dep_id, dep_values, num_dep_values); } static uint32_t sm_write_opt_number(char *current, const struct sm_obj_number *sm_number, - const uint64_t object_id, const uint64_t dep_id) + const uint64_t object_id, const uint64_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { return write_numeric_option(current, CFR_TAG_OPTION_NUMBER, object_id, sm_number->opt_name, sm_number->ui_name, sm_number->ui_helptext, - sm_number->flags, sm_number->default_value, NULL, dep_id); + sm_number->flags, sm_number->default_value, NULL, dep_id, + dep_values, num_dep_values); } static uint32_t sm_write_opt_bool(char *current, const struct sm_obj_bool *sm_bool, - const uint64_t object_id, const uint64_t dep_id) + const uint64_t object_id, const uint64_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { return write_numeric_option(current, CFR_TAG_OPTION_BOOL, object_id, sm_bool->opt_name, sm_bool->ui_name, sm_bool->ui_helptext, - sm_bool->flags, sm_bool->default_value, NULL, dep_id); + sm_bool->flags, sm_bool->default_value, NULL, dep_id, + dep_values, num_dep_values); } static uint32_t sm_write_opt_varchar(char *current, const struct sm_obj_varchar *sm_varchar, - const uint64_t object_id, const uint64_t dep_id) + const uint64_t object_id, const uint64_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { struct lb_cfr_varchar_option *option = (struct lb_cfr_varchar_option *)current; @@ -175,13 +201,15 @@ static uint32_t sm_write_opt_varchar(char *current, const struct sm_obj_varchar return 0; current += len; current += sm_write_ui_helptext(current, sm_varchar->ui_helptext); + current += sm_write_dep_values(current, dep_values, num_dep_values); option->size = cfr_record_size((char *)option, current); return option->size; } static uint32_t sm_write_opt_comment(char *current, const struct sm_obj_comment *sm_comment, - const uint32_t object_id, const uint32_t dep_id) + const uint32_t object_id, const uint32_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { struct lb_cfr_option_comment *comment = (struct lb_cfr_option_comment *)current; size_t len; @@ -200,6 +228,7 @@ static uint32_t sm_write_opt_comment(char *current, const struct sm_obj_comment return 0; current += len; current += sm_write_ui_helptext(current, sm_comment->ui_helptext); + current += sm_write_dep_values(current, dep_values, num_dep_values); comment->size = cfr_record_size((char *)comment, current); return comment->size; @@ -215,7 +244,8 @@ static uint64_t sm_gen_obj_id(void *ptr) static uint32_t sm_write_object(char *current, const struct sm_object *sm_obj); static uint32_t sm_write_form(char *current, struct sm_obj_form *sm_form, - const uint64_t object_id, const uint64_t dep_id) + const uint64_t object_id, const uint64_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { struct lb_cfr_option_form *form = (struct lb_cfr_option_form *)current; size_t len; @@ -234,6 +264,7 @@ static uint32_t sm_write_form(char *current, struct sm_obj_form *sm_form, if (!len) return 0; current += len; + current += sm_write_dep_values(current, dep_values, num_dep_values); while (sm_form->obj_list[i]) current += sm_write_object(current, sm_form->obj_list[i++]); @@ -245,6 +276,8 @@ static uint32_t sm_write_form(char *current, struct sm_obj_form *sm_form, static uint32_t sm_write_object(char *current, const struct sm_object *sm_obj) { uint64_t dep_id, obj_id; + const uint32_t *dep_values; + uint32_t num_dep_values; struct sm_object sm_obj_copy; assert(sm_obj); @@ -253,10 +286,14 @@ static uint32_t sm_write_object(char *current, const struct sm_object *sm_obj) /* Set dependency ID */ dep_id = 0; + dep_values = NULL; + num_dep_values = 0; if (sm_obj->dep) { - assert(sm_obj->dep->kind == SM_OBJ_BOOL); - if (sm_obj->dep->kind == SM_OBJ_BOOL) + if (sm_obj->dep->kind == SM_OBJ_BOOL || sm_obj->dep->kind == SM_OBJ_ENUM) { dep_id = sm_gen_obj_id((void *)sm_obj->dep); + dep_values = sm_obj->dep_values; + num_dep_values = sm_obj->num_dep_values; + } } /* Invoke callback to update fields */ @@ -273,21 +310,22 @@ static uint32_t sm_write_object(char *current, const struct sm_object *sm_obj) return 0; case SM_OBJ_ENUM: return sm_write_opt_enum(current, &sm_obj->sm_enum, obj_id, - dep_id); + dep_id, dep_values, num_dep_values); case SM_OBJ_NUMBER: return sm_write_opt_number(current, &sm_obj->sm_number, obj_id, - dep_id); + dep_id, dep_values, num_dep_values); case SM_OBJ_BOOL: return sm_write_opt_bool(current, &sm_obj->sm_bool, obj_id, - dep_id); + dep_id, dep_values, num_dep_values); case SM_OBJ_VARCHAR: return sm_write_opt_varchar(current, &sm_obj->sm_varchar, obj_id, - dep_id); + dep_id, dep_values, num_dep_values); case SM_OBJ_COMMENT: return sm_write_opt_comment(current, &sm_obj->sm_comment, obj_id, - dep_id); + dep_id, dep_values, num_dep_values); case SM_OBJ_FORM: - return sm_write_form(current, (struct sm_obj_form *)&sm_obj->sm_form, obj_id, dep_id); + return sm_write_form(current, (struct sm_obj_form *)&sm_obj->sm_form, obj_id, + dep_id, dep_values, num_dep_values); default: BUG(); printk(BIOS_ERR, "Unknown setup menu object kind %u, ignoring\n", sm_obj->kind); @@ -311,13 +349,13 @@ void cfr_write_setup_menu(struct lb_cfr *cfr_root, struct sm_obj_form *sm_root[] current += cfr_root->size; while (sm_root && sm_root[i]) - current += sm_write_form(current, sm_root[i++], 0, 0); + current += sm_write_form(current, sm_root[i++], 0, 0, NULL, 0); /* * Add generic forms. */ for (obj = &_cfr_forms[0]; obj != &_ecfr_forms[0]; obj++) - current += sm_write_form(current, obj, 0, 0); + current += sm_write_form(current, obj, 0, 0, NULL, 0); cfr_root->size = cfr_record_size((char *)cfr_root, current); diff --git a/src/drivers/option/cfr_frontend.h b/src/drivers/option/cfr_frontend.h index 2161853f01..21c18e779f 100644 --- a/src/drivers/option/cfr_frontend.h +++ b/src/drivers/option/cfr_frontend.h @@ -75,6 +75,8 @@ enum sm_object_kind { struct sm_object { enum sm_object_kind kind; const struct sm_object *dep; + const uint32_t *dep_values; + const uint32_t num_dep_values; void (*ctor)(const struct sm_object *obj, struct sm_object *new); /* Called on object creation */ union { struct sm_obj_enum sm_enum; @@ -87,21 +89,31 @@ struct sm_object { }; /* sm_object helpers with type checking */ -#define SM_DECLARE_ENUM(...) { .kind = SM_OBJ_ENUM, .dep = NULL, \ +#define SM_DECLARE_ENUM(...) { .kind = SM_OBJ_ENUM, .dep = NULL, \ + .dep_values = NULL, .num_dep_values = 0, \ .ctor = NULL, .sm_enum = __VA_ARGS__ } -#define SM_DECLARE_NUMBER(...) { .kind = SM_OBJ_NUMBER, .dep = NULL, \ +#define SM_DECLARE_NUMBER(...) { .kind = SM_OBJ_NUMBER, .dep = NULL, \ + .dep_values = NULL, .num_dep_values = 0, \ .ctor = NULL, .sm_number = __VA_ARGS__ } -#define SM_DECLARE_BOOL(...) { .kind = SM_OBJ_BOOL, .dep = NULL, \ +#define SM_DECLARE_BOOL(...) { .kind = SM_OBJ_BOOL, .dep = NULL, \ + .dep_values = NULL, .num_dep_values = 0, \ .ctor = NULL, .sm_bool = __VA_ARGS__ } -#define SM_DECLARE_VARCHAR(...) { .kind = SM_OBJ_VARCHAR, .dep = NULL, \ +#define SM_DECLARE_VARCHAR(...) { .kind = SM_OBJ_VARCHAR, .dep = NULL, \ + .dep_values = NULL, .num_dep_values = 0, \ .ctor = NULL, .sm_varchar = __VA_ARGS__ } -#define SM_DECLARE_COMMENT(...) { .kind = SM_OBJ_COMMENT, .dep = NULL, \ +#define SM_DECLARE_COMMENT(...) { .kind = SM_OBJ_COMMENT, .dep = NULL, \ + .dep_values = NULL, .num_dep_values = 0, \ .ctor = NULL, .sm_comment = __VA_ARGS__ } -#define SM_DECLARE_FORM(...) { .kind = SM_OBJ_FORM, .dep = NULL, \ +#define SM_DECLARE_FORM(...) { .kind = SM_OBJ_FORM, .dep = NULL, \ + .dep_values = NULL, .num_dep_values = 0, \ .ctor = NULL, .sm_form = __VA_ARGS__ } #define WITH_CALLBACK(c) .ctor = (c) #define WITH_DEP(d) .dep = (d) +#define WITH_DEP_VALUES(d, ...) \ + .dep = (d), \ + .dep_values = ((const uint32_t[]) { __VA_ARGS__ }), \ + .num_dep_values = sizeof((uint32_t[]) { __VA_ARGS__ }) / sizeof(uint32_t) void cfr_write_setup_menu(struct lb_cfr *cfr_root, struct sm_obj_form *sm_root[]); From 3a6481aeb2fb7547afd7b2795a5479e24afbd4e6 Mon Sep 17 00:00:00 2001 From: Filip Brozovic Date: Tue, 21 Jan 2025 12:02:10 +0100 Subject: [PATCH 0022/3886] CFR: Add min/max/step values and hex display flag for number options This commit adds support for minimum/maximum limit values as well as step sizes for CFR number options. Additionally, add a new flag that specifies the option should be displayed in hexadecimal notation instead of decimal. Change-Id: I2e70f1430fb1911f1ad974832f8abfe76f928ac3 Signed-off-by: Filip Brozovic Reviewed-on: https://review.coreboot.org/c/coreboot/+/86039 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/commonlib/include/commonlib/cfr.h | 14 ++++++++++++++ src/drivers/option/cfr.c | 18 ++++++++++++------ src/drivers/option/cfr_frontend.h | 4 ++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/commonlib/include/commonlib/cfr.h b/src/commonlib/include/commonlib/cfr.h index 570ce3c2d1..af68269e29 100644 --- a/src/commonlib/include/commonlib/cfr.h +++ b/src/commonlib/include/commonlib/cfr.h @@ -121,6 +121,15 @@ struct __packed lb_cfr_enum_value { */ }; +/* + * The optional flags describe how a numeric option is to be displayed. + * CFR_NUM_OPT_DISPFLAG_HEX: + * Displays a NUMBER option in hexadecimal instead of decimal notation. + */ +enum cfr_numeric_option_display_flags { + CFR_NUM_OPT_DISPFLAG_HEX = 1 << 0, +}; + /* Supports multiple option types: ENUM, NUMBER, BOOL */ struct __packed lb_cfr_numeric_option { uint32_t tag; /* @@ -134,6 +143,11 @@ struct __packed lb_cfr_numeric_option { */ uint32_t flags; /* enum cfr_option_flags */ uint32_t default_value; + uint32_t min; + uint32_t max; + uint32_t step; + uint32_t display_flags; /* enum cfr_numeric_option_display_flags */ + /* * struct lb_cfr_varbinary opt_name * struct lb_cfr_varbinary ui_name diff --git a/src/drivers/option/cfr.c b/src/drivers/option/cfr.c index c439ed9546..26bdd55f4d 100644 --- a/src/drivers/option/cfr.c +++ b/src/drivers/option/cfr.c @@ -104,8 +104,9 @@ static uint32_t sm_write_enum_value(char *current, const struct sm_enum_value *e static uint32_t write_numeric_option(char *current, uint32_t tag, const uint64_t object_id, const char *opt_name, const char *ui_name, const char *ui_helptext, - uint32_t flags, uint32_t default_value, const struct sm_enum_value *values, - const uint64_t dep_id, const uint32_t *dep_values, const uint32_t num_dep_values) + uint32_t flags, uint32_t default_value, uint32_t min, uint32_t max, uint32_t step, + uint32_t display_flags, const struct sm_enum_value *values, const uint64_t dep_id, + const uint32_t *dep_values, const uint32_t num_dep_values) { struct lb_cfr_numeric_option *option = (struct lb_cfr_numeric_option *)current; size_t len; @@ -117,6 +118,10 @@ static uint32_t write_numeric_option(char *current, uint32_t tag, const uint64_t if (option->flags & (CFR_OPTFLAG_INACTIVE | CFR_OPTFLAG_VOLATILE)) option->flags |= CFR_OPTFLAG_READONLY; option->default_value = default_value; + option->min = (min <= max) ? min : 0; + option->max = (min == 0 && max == 0) ? UINT32_MAX : max; + option->step = step; + option->display_flags = display_flags; option->size = sizeof(*option); current += option->size; @@ -148,7 +153,7 @@ static uint32_t sm_write_opt_enum(char *current, const struct sm_obj_enum *sm_en { return write_numeric_option(current, CFR_TAG_OPTION_ENUM, object_id, sm_enum->opt_name, sm_enum->ui_name, sm_enum->ui_helptext, - sm_enum->flags, sm_enum->default_value, sm_enum->values, + sm_enum->flags, sm_enum->default_value, 0, 0, 0, 0, sm_enum->values, dep_id, dep_values, num_dep_values); } @@ -159,8 +164,9 @@ static uint32_t sm_write_opt_number(char *current, const struct sm_obj_number *s { return write_numeric_option(current, CFR_TAG_OPTION_NUMBER, object_id, sm_number->opt_name, sm_number->ui_name, sm_number->ui_helptext, - sm_number->flags, sm_number->default_value, NULL, dep_id, - dep_values, num_dep_values); + sm_number->flags, sm_number->default_value, sm_number->min, sm_number->max, + sm_number->step, sm_number->display_flags, NULL, dep_id, dep_values, + num_dep_values); } static uint32_t sm_write_opt_bool(char *current, const struct sm_obj_bool *sm_bool, @@ -170,7 +176,7 @@ static uint32_t sm_write_opt_bool(char *current, const struct sm_obj_bool *sm_bo { return write_numeric_option(current, CFR_TAG_OPTION_BOOL, object_id, sm_bool->opt_name, sm_bool->ui_name, sm_bool->ui_helptext, - sm_bool->flags, sm_bool->default_value, NULL, dep_id, + sm_bool->flags, sm_bool->default_value, 0, 0, 0, 0, NULL, dep_id, dep_values, num_dep_values); } diff --git a/src/drivers/option/cfr_frontend.h b/src/drivers/option/cfr_frontend.h index 21c18e779f..17332bdca4 100644 --- a/src/drivers/option/cfr_frontend.h +++ b/src/drivers/option/cfr_frontend.h @@ -30,6 +30,10 @@ struct sm_obj_number { const char *ui_name; const char *ui_helptext; uint32_t default_value; + uint32_t min; + uint32_t max; + uint32_t step; + uint32_t display_flags; /* enum cfr_numeric_option_display_flags */ }; struct sm_obj_bool { From a7755bb35f7929de806ee3adf730f8c1d8de744e Mon Sep 17 00:00:00 2001 From: Yunlong Jia Date: Thu, 6 Feb 2025 10:25:14 +0000 Subject: [PATCH 0023/3886] mb/google/nissa/var/gothrax: Add 2 Hynix parts to RAM ID table Add the support RAM parts for gothrax. Here is the ram part number list: DRAM Part Name ID to assign MT62F512M32D2DR-031 WT:B 0 (0000) H58G56AK6BX069 1 (0001) K3LKBKB0BM-MGCP 2 (0010) H9JCNNNBK3MLYR-N6E 0 (0000) H9JCNNNCP3MLYR-N6E 3 (0011) BUG=b:394756067 BRANCH=None TEST=emerge-nissa coreboot Change-Id: I9945ef9f8b9f5de8aedc34e4bc41c29a702be819 Signed-off-by: Yunlong Jia Reviewed-on: https://review.coreboot.org/c/coreboot/+/86296 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/variants/gothrax/memory/Makefile.mk | 3 ++- .../google/brya/variants/gothrax/memory/dram_id.generated.txt | 2 ++ .../google/brya/variants/gothrax/memory/mem_parts_used.txt | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/variants/gothrax/memory/Makefile.mk b/src/mainboard/google/brya/variants/gothrax/memory/Makefile.mk index d3c1f68a7f..96e2023b84 100644 --- a/src/mainboard/google/brya/variants/gothrax/memory/Makefile.mk +++ b/src/mainboard/google/brya/variants/gothrax/memory/Makefile.mk @@ -4,6 +4,7 @@ # ./util/spd_tools/bin/part_id_gen ADL lp5 src/mainboard/google/brya/variants/gothrax/memory src/mainboard/google/brya/variants/gothrax/memory/mem_parts_used.txt SPD_SOURCES = -SPD_SOURCES += spd/lp5/set-0/spd-1.hex # ID = 0(0b0000) Parts = MT62F512M32D2DR-031 WT:B +SPD_SOURCES += spd/lp5/set-0/spd-1.hex # ID = 0(0b0000) Parts = MT62F512M32D2DR-031 WT:B, H9JCNNNBK3MLYR-N6E SPD_SOURCES += spd/lp5/set-0/spd-3.hex # ID = 1(0b0001) Parts = H58G56AK6BX069 SPD_SOURCES += spd/lp5/set-0/spd-3.hex # ID = 2(0b0010) Parts = K3LKBKB0BM-MGCP +SPD_SOURCES += spd/lp5/set-0/spd-2.hex # ID = 3(0b0011) Parts = H9JCNNNCP3MLYR-N6E diff --git a/src/mainboard/google/brya/variants/gothrax/memory/dram_id.generated.txt b/src/mainboard/google/brya/variants/gothrax/memory/dram_id.generated.txt index 7db6e24407..ee10ecfe49 100644 --- a/src/mainboard/google/brya/variants/gothrax/memory/dram_id.generated.txt +++ b/src/mainboard/google/brya/variants/gothrax/memory/dram_id.generated.txt @@ -7,3 +7,5 @@ DRAM Part Name ID to assign MT62F512M32D2DR-031 WT:B 0 (0000) H58G56AK6BX069 1 (0001) K3LKBKB0BM-MGCP 2 (0010) +H9JCNNNBK3MLYR-N6E 0 (0000) +H9JCNNNCP3MLYR-N6E 3 (0011) diff --git a/src/mainboard/google/brya/variants/gothrax/memory/mem_parts_used.txt b/src/mainboard/google/brya/variants/gothrax/memory/mem_parts_used.txt index f38995e01b..5d050345ae 100644 --- a/src/mainboard/google/brya/variants/gothrax/memory/mem_parts_used.txt +++ b/src/mainboard/google/brya/variants/gothrax/memory/mem_parts_used.txt @@ -13,3 +13,5 @@ MT62F512M32D2DR-031 WT:B, H58G56AK6BX069,*1 K3LKBKB0BM-MGCP, +H9JCNNNBK3MLYR-N6E, +H9JCNNNCP3MLYR-N6E, From 1b2c7c588d39d334942ee9baebe702e5a311c9aa Mon Sep 17 00:00:00 2001 From: jamie_chen Date: Thu, 6 Feb 2025 10:12:10 +0800 Subject: [PATCH 0024/3886] mb/google/trulo/var/uldrenite: Add WIFI SAR table Add WIFI SAR table for uldrenite. BUG=b:384453900 BRANCH=firmware-trulo-15217.771.B TEST=emerge-nissa coreboot chromeos-bootimage Change-Id: Ieb7f7ba54aaa6bdf1a19e59e57eb46cfafd655fe Signed-off-by: jamie_chen Reviewed-on: https://review.coreboot.org/c/coreboot/+/86291 Reviewed-by: Jayvik Desai Reviewed-by: Dtrain Hsu Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/mainboard/google/brya/Kconfig | 1 + src/mainboard/google/brya/variants/uldrenite/variant.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index dfa571e6ce..58b8922448 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -638,6 +638,7 @@ config BOARD_GOOGLE_ULDREN config BOARD_GOOGLE_ULDRENITE select BOARD_GOOGLE_BASEBOARD_TRULO select BOARD_ROMSIZE_KB_32768 + select CHROMEOS_WIFI_SAR if CHROMEOS select SOC_INTEL_TCSS_USE_PDC_PMC_USBC_MUX_CONFIGURATION select HAVE_PCIE_WWAN select HAVE_WWAN_POWER_SEQUENCE diff --git a/src/mainboard/google/brya/variants/uldrenite/variant.c b/src/mainboard/google/brya/variants/uldrenite/variant.c index f5bbaf6924..41ab7b8c14 100644 --- a/src/mainboard/google/brya/variants/uldrenite/variant.c +++ b/src/mainboard/google/brya/variants/uldrenite/variant.c @@ -5,10 +5,16 @@ #include #include #include +#include #define RW350R_RST_DELAY_MS 20 #define RW350R_PERST_DELAY_MS 30 +const char *get_wifi_sar_cbfs_filename(void) +{ + return "wifi_sar_0.hex"; +} + static const struct pad_config rw350r_en_pad[] = { /* H23 : LTE_PWR_OFF_EN */ PAD_CFG_GPO(GPP_H23, 1, DEEP), From e914a551a232a22310ad479ccc56e007c99a2f74 Mon Sep 17 00:00:00 2001 From: Ian Feng Date: Tue, 4 Feb 2025 14:47:59 +0800 Subject: [PATCH 0025/3886] mb/google/fatcat/var/francka: Enable CNVi wifi core Enable CNVi wifi core for francka. BUG=b:391772114 TEST=Build and boot to OS in francka. lspci: 00:14.3 Network controller: Intel Corporation Device e440 Change-Id: I80c38882aab801dedb05355774e5b930a8528fed Signed-off-by: Ian Feng Reviewed-on: https://review.coreboot.org/c/coreboot/+/86262 Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai Reviewed-by: Subrata Banik --- src/mainboard/google/fatcat/variants/francka/overridetree.cb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainboard/google/fatcat/variants/francka/overridetree.cb b/src/mainboard/google/fatcat/variants/francka/overridetree.cb index dc76b85639..58ced1aa07 100644 --- a/src/mainboard/google/fatcat/variants/francka/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/francka/overridetree.cb @@ -53,6 +53,9 @@ chip soc/intel/pantherlake # TCSS USB3 register "tcss_aux_ori" = "1" + # Enable CNVi WiFi + register "cnvi_wifi_core" = "true" + register "serial_io_i2c_mode" = "{ [PchSerialIoIndexI2C0] = PchSerialIoPci, [PchSerialIoIndexI2C1] = PchSerialIoPci, From 16bd8b206535e279a4e7b89ca99fdc2c6420946d Mon Sep 17 00:00:00 2001 From: David Wu Date: Tue, 4 Feb 2025 19:44:10 +0800 Subject: [PATCH 0026/3886] mb/google/nissa/var/riven: Add fw_config probe for all wifi Add fw_config probe to enable all wifi for factory use. BUG=None TEST=emerge-nissa coreboot chromeos-bootimage Change-Id: Ic7326266fd8d69cb76257b01c1d9083a2e30a2b3 Signed-off-by: David Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86266 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai --- src/mainboard/google/brya/variants/riven/overridetree.cb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mainboard/google/brya/variants/riven/overridetree.cb b/src/mainboard/google/brya/variants/riven/overridetree.cb index 359c4275df..9e5fa3cd2e 100644 --- a/src/mainboard/google/brya/variants/riven/overridetree.cb +++ b/src/mainboard/google/brya/variants/riven/overridetree.cb @@ -21,6 +21,9 @@ fw_config option WFC_MIPI_OVTI5675 1 option WFC_MIPI_OVTI8856 2 end + field ALL_WIFI 19 19 + option WIFI_ENABLE 1 + end end chip soc/intel/alderlake @@ -230,6 +233,7 @@ chip soc/intel/alderlake register "enable_cnvi_ddr_rfim" = "true" device generic 0 on probe WIFI_TYPE WIFI_CNVI + probe ALL_WIFI WIFI_ENABLE end end end @@ -482,6 +486,7 @@ chip soc/intel/alderlake end device ref pcie_rp4 on probe WIFI_TYPE WIFI_PCIE + probe ALL_WIFI WIFI_ENABLE # Enable wlan PCIe 4 using clk 2 register "pch_pcie_rp[PCH_RP(4)]" = "{ .clk_src = 2, @@ -495,6 +500,7 @@ chip soc/intel/alderlake use usb2_port8 as bluetooth_companion device pci 00.0 on probe WIFI_TYPE WIFI_PCIE + probe ALL_WIFI WIFI_ENABLE end end chip soc/intel/common/block/pcie/rtd3 @@ -503,6 +509,7 @@ chip soc/intel/alderlake register "srcclk_pin" = "2" device generic 0 on probe WIFI_TYPE WIFI_PCIE + probe ALL_WIFI WIFI_ENABLE end end end @@ -624,6 +631,7 @@ chip soc/intel/alderlake "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" device ref usb2_port8 on probe WIFI_TYPE WIFI_PCIE + probe ALL_WIFI WIFI_ENABLE end end chip drivers/usb/acpi @@ -633,6 +641,7 @@ chip soc/intel/alderlake "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" device ref usb2_port10 on probe WIFI_TYPE WIFI_CNVI + probe ALL_WIFI WIFI_ENABLE end end chip drivers/usb/acpi From 656f26ee3c3797dd058ddec7994f4f5696ad5149 Mon Sep 17 00:00:00 2001 From: Brandon Weeks Date: Mon, 3 Feb 2025 16:17:37 -0800 Subject: [PATCH 0027/3886] soc/intel/alderlake: Add missing min sleep state for SMBUS device Fixes: Unknown min d_state for PCI: 00:1f.4 Change-Id: I8050c8d574ea5908d5ad3f1e5a034257fabb72c5 Signed-off-by: Brandon Weeks Reviewed-on: https://review.coreboot.org/c/coreboot/+/86259 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/soc/intel/alderlake/acpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/soc/intel/alderlake/acpi.c b/src/soc/intel/alderlake/acpi.c index 463112fb6a..4c5a515142 100644 --- a/src/soc/intel/alderlake/acpi.c +++ b/src/soc/intel/alderlake/acpi.c @@ -217,6 +217,7 @@ static struct min_sleep_state min_pci_sleep_states[] = { { PCH_DEVFN_ESPI, ACPI_DEVICE_SLEEP_D0 }, { PCH_DEVFN_PMC, ACPI_DEVICE_SLEEP_D0 }, { PCH_DEVFN_HDA, ACPI_DEVICE_SLEEP_D0 }, + { PCH_DEVFN_SMBUS, ACPI_DEVICE_SLEEP_D0 }, { PCH_DEVFN_SPI, ACPI_DEVICE_SLEEP_D3 }, { PCH_DEVFN_GBE, ACPI_DEVICE_SLEEP_D3 }, }; From bbe8a63e346b4dfb70ed1d93dad21d4f213d9f12 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 6 Feb 2025 10:51:01 +0530 Subject: [PATCH 0028/3886] mainboard/google/fatcat: Set TCC offset This commit sets the TCC offset for the Fatcat baseboard variant. A value of 10 was chosen, resulting in a TCC trip point of 100C (Tjmax of 110C - offset of 10C). This allows for thermal throttling to begin at a more appropriate temperature. Fatcat variants can override the TCC offset as per platform requirements between power and/or performance. TEST=Able to build and boot to CrOS. Change-Id: I2a57fd3b06378f4e62872ffeb116a65561100e33 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86292 Reviewed-by: Jamie Ryu Tested-by: build bot (Jenkins) Reviewed-by: Dinesh Gehlot --- .../google/fatcat/variants/baseboard/fatcat/devicetree.cb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb b/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb index c217a159e1..b09f9e324b 100644 --- a/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb +++ b/src/mainboard/google/fatcat/variants/baseboard/fatcat/devicetree.cb @@ -51,6 +51,9 @@ chip soc/intel/pantherlake # DPTF enable register "dptf_enable" = "true" + # Setting TCC of 100C = Tj max (110) - TCC_Offset (10) + register "tcc_offset" = "10" + # Disable C1 C-state auto-demotion register "disable_c1_state_auto_demotion" = "true" # Disable PKGC-state auto-demotion From 259306a296ed9d8ccc87214eb930ffd15f23640e Mon Sep 17 00:00:00 2001 From: Jarried Lin Date: Fri, 7 Feb 2025 15:36:31 +0800 Subject: [PATCH 0029/3886] mb/google/rauru: Deassert PCIe PERST# earlier in romstage Reorder the PCIe reset before mtk_dram_init to overlap the de-assert time with the DRAM initialization process. This change helps to optimize the initialization sequence and reduce overall boot time. BRANCH=rauru TEST=Build pass BUG=b:391333055 Change-Id: I24b254ff3a3cbe6d9a60a8e6afea2c621e0a07e2 Signed-off-by: Jarried Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86311 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin --- src/mainboard/google/rauru/romstage.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mainboard/google/rauru/romstage.c b/src/mainboard/google/rauru/romstage.c index 7860dfd092..584af61d0f 100644 --- a/src/mainboard/google/rauru/romstage.c +++ b/src/mainboard/google/rauru/romstage.c @@ -47,11 +47,10 @@ void platform_romstage_main(void) clk_buf_init(); if (CONFIG(RTC)) rtc_boot(); + if (CONFIG(PCI)) + mtk_pcie_deassert_perst(); mtk_dram_init(); modem_power_down(); dvfs_init(); thermal_init(); - - if (CONFIG(PCI)) - mtk_pcie_deassert_perst(); } From 5ff1ce69635097080edecce7b0b6cfe557e8046c Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Fri, 7 Feb 2025 19:55:16 +0000 Subject: [PATCH 0030/3886] ec/starlabs/merlin: Remove unused name objects These are not referenced anywhere, so remove them. Change-Id: Ieb66099dcb9e13b26e6a7a752584537c060c8c18 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86317 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/ec/starlabs/merlin/acpi/ec.asl | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/ec/starlabs/merlin/acpi/ec.asl b/src/ec/starlabs/merlin/acpi/ec.asl index 8fa16c5d05..35604840cb 100644 --- a/src/ec/starlabs/merlin/acpi/ec.asl +++ b/src/ec/starlabs/merlin/acpi/ec.asl @@ -11,30 +11,6 @@ Scope (\_SB.PCI0.LPCB) Name (_GPE, CONFIG_EC_GPE_SCI) Name (ECAV, 0x00) Name (ECTK, 0x01) - Name (B2ST, 0x00) - Name (CFAN, 0x00) - Name (CMDR, 0x00) - Name (DOCK, 0x00) - Name (PLMX, 0x00) - Name (PECH, 0x00) - Name (PECL, 0x00) - Name (PENV, 0x00) - Name (PINV, 0x00) - Name (PPSH, 0x00) - Name (PPSL, 0x00) - Name (PSTP, 0x00) - Name (RPWR, 0x00) - Name (VPWR, 0x00) - Name (WTMS, 0x00) - Name (AWT2, 0x00) - Name (AWT1, 0x00) - Name (AWT0, 0x00) - Name (DLED, 0x00) - Name (SPT2, 0x00) - Name (PB10, 0x00) - Name (IWCW, 0x00) - Name (IWCR, 0x00) - Name (PVOL, 0x00) Mutex (ECMT, 0x00) Name (BFFR, ResourceTemplate() From bf4da5f27276a8ab86ae24a0bd939c12cdcf7aa4 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 6 Feb 2025 20:41:30 +0000 Subject: [PATCH 0031/3886] mb/starlabs/starbook/mtl: Enable Early Command Training Enable Early Command Training. Test=build and boot `starbook/mtl`, verify no issues in FSP debug log and enter/ exit s3. Change-Id: I18d94537ec662e11ef09065569e1695403490012 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86308 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/starbook/variants/mtl/romstage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c index 26a4e5eb3c..d938badb5a 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c @@ -9,7 +9,7 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) { const struct mb_cfg mem_config = { .type = MEM_TYPE_DDR5, - .ect = false, + .ect = true, .UserBd = BOARD_TYPE_MOBILE, .ddr_config = { .dq_pins_interleaved = false, From ceaed25bf1800dff0432f26e06f2eee15b67ceab Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 6 Feb 2025 21:08:34 +0000 Subject: [PATCH 0032/3886] mb/starlabs/starbook/mtl: Change the user board type Change the board type to ULX as seen in the AMI CRB. This fixes failed memory training for certain memory modules. Change-Id: I951387fcfc0be8fb931b4c5ac0b5f022e057b371 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86310 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/mtl/romstage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c index d938badb5a..7d9b9ae4fd 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c @@ -10,7 +10,7 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) const struct mb_cfg mem_config = { .type = MEM_TYPE_DDR5, .ect = true, - .UserBd = BOARD_TYPE_MOBILE, + .UserBd = BOARD_TYPE_ULT_ULX, .ddr_config = { .dq_pins_interleaved = false, }, From 1ac3bee7d67aa28a20aa59cfbd3cd0298e6669a7 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Fri, 7 Feb 2025 09:38:19 +0000 Subject: [PATCH 0033/3886] ec/starlabs/merlin: Only include virtual button driver for detachables Including the Virtual Button Driver made laptops report as a detachable in tablet mode. Adjust how it's included, so they report as laptops. Change-Id: Idc2076c400524744836e2f52124ccb8502622b04 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86315 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/ec/starlabs/merlin/acpi/dock.asl | 2 -- src/ec/starlabs/merlin/acpi/ec.asl | 2 ++ src/ec/starlabs/merlin/acpi/hid.asl | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ec/starlabs/merlin/acpi/dock.asl b/src/ec/starlabs/merlin/acpi/dock.asl index 8d648bc8b9..dd234f160b 100644 --- a/src/ec/starlabs/merlin/acpi/dock.asl +++ b/src/ec/starlabs/merlin/acpi/dock.asl @@ -31,12 +31,10 @@ Device (VBTN) Method (VGBS, 0) { -#if CONFIG(SYSTEM_TYPE_DETACHABLE) If (!GRXS (GPP_F15)) { Return (0x40) } -#endif Return (0x00) } } diff --git a/src/ec/starlabs/merlin/acpi/ec.asl b/src/ec/starlabs/merlin/acpi/ec.asl index 35604840cb..f3fdb07334 100644 --- a/src/ec/starlabs/merlin/acpi/ec.asl +++ b/src/ec/starlabs/merlin/acpi/ec.asl @@ -117,7 +117,9 @@ Scope (\_SB.PCI0.LPCB) #include "events.asl" #endif #include "lid.asl" +#if CONFIG(SYSTEM_TYPE_DETACHABLE) #include "dock.asl" +#endif Method (_REG, 2, NotSerialized) { diff --git a/src/ec/starlabs/merlin/acpi/hid.asl b/src/ec/starlabs/merlin/acpi/hid.asl index f3bfff611e..a63723916e 100644 --- a/src/ec/starlabs/merlin/acpi/hid.asl +++ b/src/ec/starlabs/merlin/acpi/hid.asl @@ -366,7 +366,11 @@ Device (HIDD) // HID Device // Case (0x08) { +#if CONFIG(SYSTEM_TYPE_DETACHABLE) Return (\_SB.PCI0.LPCB.EC.VBTN.VGBS()) +#else + Return (0x00) +#endif } // // Function 9 H2BC. Button implemented state. From d958b270a25cff3d9dabf2721646198e72219ccf Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 6 Feb 2025 21:04:09 -0600 Subject: [PATCH 0034/3886] mb/starlabs/starbook_mtl: Fix USB port assignments/descriptions Fix USB port assignments/descriptions to match actual topology. TEST=build/boot Win11 on starlabs/starbook_mtl. Verify ports match assignmented in devicetree using USBTreeview. Change-Id: Ifb5ac4cf95c8f10706404479dea48ba20a90e286 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86320 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes --- .../starbook/variants/mtl/devicetree.cb | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/devicetree.cb b/src/mainboard/starlabs/starbook/variants/mtl/devicetree.cb index a1384388a1..d9d8deea38 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/mtl/devicetree.cb @@ -33,33 +33,33 @@ chip soc/intel/meteorlake device ref tcss_xhci on chip drivers/usb/acpi device ref tcss_root_hub on - chip drivers/usb/acpi - register "desc" = ""Front USB Type-C"" - register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" - register "group" = "ACPI_PLD_GROUP(0, 0)" - device ref tcss_usb3_port1 on end - end chip drivers/usb/acpi register "desc" = ""Back USB Type-C"" register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(0, 0)" + device ref tcss_usb3_port0 on end + end + chip drivers/usb/acpi + register "desc" = ""Front USB Type-C"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "group" = "ACPI_PLD_GROUP(0, 1)" - device ref tcss_usb3_port2 on end + device ref tcss_usb3_port1 on end end end end end device ref gna on end device ref xhci on - # Motherboard USB 3.0 Type-C Front 9557 mil + # Motherboard USB 3.0 Type-C Back 7893 mil register "usb2_ports[0]" = "USB2_PORT_TYPE_C(OC_SKIP)" register "tcss_ports[0]" = "TCSS_PORT_DEFAULT(OC_SKIP)" - # Motherboard USB 3.0 Type-C Back 7893 mil - register "usb2_ports[1]" = "USB2_PORT_TYPE_C(OC_SKIP)" + # Motherboard USB 3.0 Type-C Front 9557 mil + register "usb2_ports[2]" = "USB2_PORT_TYPE_C(OC_SKIP)" register "tcss_ports[1]" = "TCSS_PORT_DEFAULT(OC_SKIP)" # Motherboard USB 3.0 Type-A 8916 mil - register "usb2_ports[2]" = "USB2_PORT_MID(OC_SKIP)" + register "usb2_ports[1]" = "USB2_PORT_MID(OC_SKIP)" register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Daughterboard USB 3.0 Type-A 2229 mil @@ -78,22 +78,22 @@ chip soc/intel/meteorlake chip drivers/usb/acpi device ref xhci_root_hub on chip drivers/usb/acpi - register "desc" = ""Front USB Type-C"" + register "desc" = ""Back USB Type-C"" register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "group" = "ACPI_PLD_GROUP(0, 0)" device ref usb2_port1 on end end chip drivers/usb/acpi - register "desc" = ""Back USB Type-C"" + register "desc" = ""Front USB Type-C"" register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "group" = "ACPI_PLD_GROUP(0, 1)" - device ref usb2_port2 on end + device ref usb2_port3 on end end chip drivers/usb/acpi register "desc" = ""Left USB Type-A"" register "type" = "UPC_TYPE_USB3_A" register "group" = "ACPI_PLD_GROUP(0, 2)" - device ref usb2_port3 on end + device ref usb2_port2 on end end chip drivers/usb/acpi register "desc" = ""Left USB Type-A"" @@ -102,13 +102,13 @@ chip soc/intel/meteorlake device ref usb3_port1 on end end chip drivers/usb/acpi - register "desc" = ""Right USB Type-A"" + register "desc" = ""Right Rear USB Type-A"" register "type" = "UPC_TYPE_USB3_A" register "group" = "ACPI_PLD_GROUP(0, 3)" device ref usb2_port7 on end end chip drivers/usb/acpi - register "desc" = ""Right USB Type-A"" + register "desc" = ""Right Rear USB Type-A"" register "type" = "UPC_TYPE_USB3_A" register "group" = "ACPI_PLD_GROUP(0, 3)" device ref usb3_port2 on end @@ -120,8 +120,8 @@ chip soc/intel/meteorlake device ref usb2_port5 on end end chip drivers/usb/acpi - register "desc" = ""MicroSD Card Reader"" - register "type" = "UPC_TYPE_INTERNAL" + register "desc" = ""USB 2.0 Hub"" + register "type" = "UPC_TYPE_HUB" register "group" = "ACPI_PLD_GROUP(0, 5)" device ref usb2_port8 on end end @@ -236,12 +236,12 @@ chip soc/intel/meteorlake device generic 0 on chip drivers/intel/pmc_mux/conn use usb2_port1 as usb2_port - use tcss_usb3_port1 as usb3_port + use tcss_usb3_port0 as usb3_port device generic 0 alias conn0 on end end chip drivers/intel/pmc_mux/conn - use usb2_port2 as usb2_port - use tcss_usb3_port2 as usb3_port + use usb2_port3 as usb2_port + use tcss_usb3_port1 as usb3_port device generic 1 alias conn1 on end end end From 04ccbbc4640ad59ab17ca7494ebf3ea042a8ff0e Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Sat, 8 Feb 2025 12:17:59 +0800 Subject: [PATCH 0035/3886] soc/mediatek/common: Measure mtk_fsp_load_and_run() execution time Measure mtk_fsp_load_and_run() execution time. This info helps AP boot time analysis. The logs show as below. [INFO ] mtk_fsp_load_and_run: run fallback/mtk_fsp_romstage at phase 0x30 in 0 msecs [INFO ] mtk_fsp_load_and_run: run fallback/mtk_fsp_ramstage at phase 0x50 in 41 msecs BUG=none BRANCH=rauru TEST=cbmem -1|grep "mtk_fsp_load_and_run" Change-Id: I61706952bef4590c5bfd09707a08a4f1a25fbda2 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86325 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/common/mtk_fsp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/common/mtk_fsp.c b/src/soc/mediatek/common/mtk_fsp.c index bc1b5d5f08..073a0798cc 100644 --- a/src/soc/mediatek/common/mtk_fsp.c +++ b/src/soc/mediatek/common/mtk_fsp.c @@ -3,6 +3,7 @@ #include #include #include +#include #define MAX_PARAM_ENTRIES 32 #define FSP_INTF_SIZE (sizeof(struct mtk_fsp_intf) + \ @@ -82,7 +83,9 @@ static const char *mtk_fsp_file(void) enum cb_err mtk_fsp_load_and_run(void) { struct prog fsp = PROG_INIT(PROG_REFCODE, mtk_fsp_file()); + struct stopwatch sw; + stopwatch_init(&sw); if (cbfs_prog_stage_load(&fsp)) { printk(BIOS_ERR, "%s: CBFS load program failed\n", __func__); return CB_ERR; @@ -101,8 +104,8 @@ enum cb_err mtk_fsp_load_and_run(void) return CB_ERR; } - printk(BIOS_INFO, "%s: run %s at phase %#x done\n", - __func__, mtk_fsp_file(), intf->phase); + printk(BIOS_INFO, "%s: run %s at phase %#x in %lld msecs\n", + __func__, mtk_fsp_file(), intf->phase, stopwatch_duration_msecs(&sw)); return CB_SUCCESS; } From cd414d9d619d7cca9d456c542fa61513444fcad8 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 6 Feb 2025 21:00:10 -0600 Subject: [PATCH 0036/3886] soc/intel/meteorlake: Add missing USB port definitions The TCSS_XHCI controller has a single USB2 port followed by 4 USB3 ports; the XHCI controller has 12 USB2 ports followed by 2 USB3 ports. The topology was queried from the root hub on each controller and returned via the descriptor. Add the 2 missing USB2 ports to the XHCI controller and the one to the TSS_XHCI controller. TEST=build/boot Win11, Linux 6.x on starlabs/starbook_mtl. Change-Id: I5dc97f150ff064d55e7969f10c1cea8ba72d6bfb Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86319 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes --- src/soc/intel/meteorlake/chipset.cb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/soc/intel/meteorlake/chipset.cb b/src/soc/intel/meteorlake/chipset.cb index 9087dd8adb..7b26670ff8 100644 --- a/src/soc/intel/meteorlake/chipset.cb +++ b/src/soc/intel/meteorlake/chipset.cb @@ -69,6 +69,9 @@ chip soc/intel/meteorlake chip drivers/usb/acpi register "type" = "UPC_TYPE_HUB" device usb 0.0 alias tcss_root_hub off + chip drivers/usb/acpi + device usb 2.0 alias tcss_usb2_port1 off end + end chip drivers/usb/acpi device usb 3.0 alias tcss_usb3_port0 off end end @@ -131,6 +134,12 @@ chip soc/intel/meteorlake chip drivers/usb/acpi device usb 2.9 alias usb2_port10 off end end + chip drivers/usb/acpi + device usb 2.a alias usb2_port11 off end + end + chip drivers/usb/acpi + device usb 2.b alias usb2_port12 off end + end chip drivers/usb/acpi device usb 3.0 alias usb3_port1 off end end From 6d0e35b68d872171175caef5f1272408407c8c46 Mon Sep 17 00:00:00 2001 From: Alicja Michalska Date: Wed, 22 Jan 2025 01:13:14 +0100 Subject: [PATCH 0037/3886] mb/erying/tgl: Drop specifying which timers to use With 8254 timer enabled, system would hang while entering s0ix state. If we build coreboot with both timers =N, system enters s0ix state (although it doesn't cut the power to the platform) and can be woken up by pressing the key on the keyboard. Since there's less potential for data loss in case of accidental suspend, I think it makes sense to do it this way. Change-Id: If6e0ac1d289447c292a49111251d321c951078e2 Signed-off-by: Alicja Michalska Reviewed-on: https://review.coreboot.org/c/coreboot/+/86093 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/erying/tgl/Kconfig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mainboard/erying/tgl/Kconfig b/src/mainboard/erying/tgl/Kconfig index 01e5dd98aa..e8a2a1fd72 100644 --- a/src/mainboard/erying/tgl/Kconfig +++ b/src/mainboard/erying/tgl/Kconfig @@ -30,12 +30,6 @@ config MAINBOARD_PART_NUMBER config CBFS_SIZE default 0xA00000 -config USE_PM_ACPI_TIMER - default n - -config USE_LEGACY_8254_TIMER - default y - config PCIEXP_ASPM default n From 17c94b65c8dfe99d1f3bbd6eccd917cd8bc50002 Mon Sep 17 00:00:00 2001 From: Hualin Wei Date: Sat, 8 Feb 2025 09:41:17 +0800 Subject: [PATCH 0038/3886] mb/google/nissa/var/pujjoniru: Tune I2C_5 parameters 1. Modify the I2C frequency of the touchpad to below 400 KHz to meet the spec. 2. Modify the Thd dat of DATA between 0.3 us and 0.9 us to meet the spec. Before: I2C5 - 407KHz Thd - 0.06us After: I2C5 - 387Khz Thd - 0.34us BUG=b:391796230,b:391788680 TEST=Check that the wave form meets the spec. Change-Id: I3c8c8d3b78236247ca7be810ac152085f615a6ef Signed-off-by: Hualin Wei Reviewed-on: https://review.coreboot.org/c/coreboot/+/86324 Reviewed-by: Eric Lai Reviewed-by: Qinghong Zeng Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- .../google/brya/variants/pujjoniru/overridetree.cb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb b/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb index 02ab63358e..11098ac4ed 100644 --- a/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb +++ b/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb @@ -82,9 +82,9 @@ chip soc/intel/alderlake .speed = I2C_SPEED_FAST, .speed_config[0] = { .speed = I2C_SPEED_FAST, - .scl_lcnt = 152, - .scl_hcnt = 79, - .sda_hold = 7, + .scl_lcnt = 150, + .scl_hcnt = 85, + .sda_hold = 35, } }, }" From 976a28bcfa81868faaf6d51145f24aecb7a5cc3c Mon Sep 17 00:00:00 2001 From: Jayvik Desai Date: Fri, 7 Feb 2025 14:52:48 +0530 Subject: [PATCH 0039/3886] soc/intel/ptl: Disable FSP_UGOP_EARLY_SIGN_OF_LIFE for pantherlake This patch disables eSOL Kconfig until the feature is ready in PTL FSP-uGOP binary. TEST=Able to build and boot google/fatcat to OS. Change-Id: I99dd516816995b6cdfdcec618c06c7dbe061718a Signed-off-by: Jayvik Desai Reviewed-on: https://review.coreboot.org/c/coreboot/+/86314 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/soc/intel/pantherlake/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/soc/intel/pantherlake/Kconfig b/src/soc/intel/pantherlake/Kconfig index dde401bfb5..53260208bf 100644 --- a/src/soc/intel/pantherlake/Kconfig +++ b/src/soc/intel/pantherlake/Kconfig @@ -17,7 +17,6 @@ config SOC_INTEL_PANTHERLAKE_BASE select FAST_SPI_SUPPORTS_EXT_BIOS_WINDOW select FSP_COMPRESS_FSP_S_LZ4 select FSP_M_XIP - select FSP_UGOP_EARLY_SIGN_OF_LIFE select FSP_USES_CB_DEBUG_EVENT_HANDLER select FSPS_HAS_ARCH_UPD select GENERIC_GPIO_LIB From d25a73d9a7ce25ec9b7a7652385c6b11033a3e8f Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 30 Jan 2025 09:20:53 +0000 Subject: [PATCH 0040/3886] util/cbfstool/eventlog: Add low battery event type This commit adds a new event type, `ELOG_TYPE_LOW_BATTERY_INDICATOR`, to the event log. This event is logged when the system boots due to a low battery condition. It includes the reason for the shutdown, currently only supporting "Power Off". BUG=b:339673254 TEST=Able to capture the eventlog for low battery boot event. ``` > elogtool list 9 | 2025-02-03 09:44:19+0530 | Low Battery Boot | Power Off ``` Change-Id: I5cc5e5f540657c7dfd174a4928e697a272da813a Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86223 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Dinesh Gehlot Reviewed-by: Karthik Ramasubramanian --- src/commonlib/bsd/include/commonlib/bsd/elog.h | 3 +++ util/cbfstool/eventlog.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/commonlib/bsd/include/commonlib/bsd/elog.h b/src/commonlib/bsd/include/commonlib/bsd/elog.h index f7dc4a1ac0..01f97f6957 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/elog.h +++ b/src/commonlib/bsd/include/commonlib/bsd/elog.h @@ -389,6 +389,9 @@ struct elog_event_extended_event { #define ELOG_FW_POST_RAM_CSE_SYNC 0x1 #define ELOG_FW_CSE_SYNC_AT_PAYLOAD 0x2 +#define ELOG_TYPE_LOW_BATTERY_INDICATOR 0xbe +#define ELOG_FW_ISSUE_SHUTDOWN 0x0 + /* Only the 7-LSB are used for size */ #define ELOG_MAX_EVENT_SIZE 0x7F diff --git a/util/cbfstool/eventlog.c b/util/cbfstool/eventlog.c index 4746670513..2312b75f8b 100644 --- a/util/cbfstool/eventlog.c +++ b/util/cbfstool/eventlog.c @@ -170,6 +170,7 @@ static void eventlog_print_type(const struct event_header *event) {ELOG_TYPE_PSR_DATA_LOST, "PSR data lost"}, {ELOG_TYPE_FW_SPLASH_SCREEN, "Firmware Splash Screen"}, {ELOG_TYPE_FW_CSE_SYNC, "Firmware CSE sync"}, + {ELOG_TYPE_LOW_BATTERY_INDICATOR, "Low Battery boot"}, {ELOG_TYPE_EOL, "End of log"}, }; @@ -491,6 +492,11 @@ static int eventlog_print_data(const struct event_header *event) {0, NULL}, }; + static const struct valstr low_battery_status[] = { + {ELOG_FW_ISSUE_SHUTDOWN, "Power Off"}, + {0, NULL}, + }; + size_t elog_type_to_min_size[] = { [ELOG_TYPE_LOG_CLEAR] = sizeof(uint16_t), [ELOG_TYPE_BOOT] = sizeof(uint32_t), @@ -513,6 +519,7 @@ static int eventlog_print_data(const struct event_header *event) [ELOG_TYPE_PSR_DATA_BACKUP] = sizeof(uint8_t), [ELOG_TYPE_FW_SPLASH_SCREEN] = sizeof(uint8_t), [ELOG_TYPE_FW_CSE_SYNC] = sizeof(uint8_t), + [ELOG_TYPE_LOW_BATTERY_INDICATOR] = sizeof(uint8_t), [0xff] = 0, }; @@ -684,6 +691,11 @@ static int eventlog_print_data(const struct event_header *event) eventlog_printf("%s", val2str(*cse_event, cse_sync_path_types)); break; } + case ELOG_TYPE_LOW_BATTERY_INDICATOR: { + const uint8_t *low_battery_event = event_get_data(event); + eventlog_printf("%s", val2str(*low_battery_event, low_battery_status)); + break; + } default: break; } From 597dba2e344a317d8a335c00a98f3229d803c2b7 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Sun, 9 Feb 2025 07:51:57 +0100 Subject: [PATCH 0041/3886] drivers/asmedia/asm1061: Align = only with tabs and not spaces The `.devices` line only had once space before the =, as the tab boundary is directly after the s of devices. The lines above had once space after the last tab, so the equal sign is closer to the left side. As the whole file aligns the equal sign, replace the space by a tab, and do *not* go the route of not aligning the equal signs. Change-Id: Ic49dc56263cafce3cfe40bb3ed7036fa25300f9f Signed-off-by: Paul Menzel Reviewed-on: https://review.coreboot.org/c/coreboot/+/86335 Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas --- src/drivers/asmedia/asm1061.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/asmedia/asm1061.c b/src/drivers/asmedia/asm1061.c index 6d2edaa94e..29d2704f45 100644 --- a/src/drivers/asmedia/asm1061.c +++ b/src/drivers/asmedia/asm1061.c @@ -42,7 +42,7 @@ static const unsigned short pci_device_ids[] = { }; static const struct pci_driver asmedia_asm1061 __pci_driver = { - .ops = &asm1061_ops, - .vendor = 0x1b21, - .devices = pci_device_ids, + .ops = &asm1061_ops, + .vendor = 0x1b21, + .devices = pci_device_ids, }; From a810b2762db5c8c07cd2689560411ce2a7ad665f Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Sat, 8 Feb 2025 19:42:34 +0000 Subject: [PATCH 0042/3886] mb/starlabs/*: Use a safe configurations for DRAM Sleep GPIO The configuration used was copied from other boards in the tree, NF1/NF2. However, no Intel documents says that GPP_E8 has a native function. As it remains unclear if the other boards in the tree are misconfiugured, or the documents are incorrect, revert to a safe configuration for the GPIO. Change-Id: I49b8faa7f8712ad0ead22b7ccbfa6deca6046368 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86332 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c | 2 +- src/mainboard/starlabs/starbook/variants/adl/gpio.c | 2 +- src/mainboard/starlabs/starbook/variants/adl_n/gpio.c | 2 +- src/mainboard/starlabs/starbook/variants/rpl/gpio.c | 2 +- src/mainboard/starlabs/starfighter/variants/rpl/gpio.c | 2 +- src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c index f17e3ae5b8..8ec1666014 100644 --- a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c +++ b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c @@ -256,7 +256,7 @@ const struct pad_config gpio_table[] = { /* E7: Embedded Controller SMI */ PAD_NC(GPP_E7, NONE), /* E8: DRAM Sleep */ - PAD_NC(GPP_E8, NONE), + PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), /* E10: Not Connected */ diff --git a/src/mainboard/starlabs/starbook/variants/adl/gpio.c b/src/mainboard/starlabs/starbook/variants/adl/gpio.c index fb3d64d593..2ab629f291 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl/gpio.c @@ -255,7 +255,7 @@ const struct pad_config gpio_table[] = { /* E7: Embedded Controller SMI */ PAD_NC(GPP_E7, NONE), /* E8: DRAM Sleep */ - PAD_CFG_NF(GPP_E8, NONE, DEEP, NF1), + PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ PAD_NC(GPP_E9, NONE), /* E10: PWD Amplifier Input */ diff --git a/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c b/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c index b59ad9dcd0..835d8f6251 100644 --- a/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c @@ -255,7 +255,7 @@ const struct pad_config gpio_table[] = { /* E7: Embedded Controller SMI */ PAD_NC(GPP_E7, NONE), /* E8: DRAM Sleep */ - PAD_CFG_NF(GPP_E8, NONE, DEEP, NF2), + PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), /* E10: PWD Amplifier Input */ diff --git a/src/mainboard/starlabs/starbook/variants/rpl/gpio.c b/src/mainboard/starlabs/starbook/variants/rpl/gpio.c index e8c2550268..5e3cd0006a 100644 --- a/src/mainboard/starlabs/starbook/variants/rpl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/rpl/gpio.c @@ -255,7 +255,7 @@ const struct pad_config gpio_table[] = { /* E7: Embedded Controller SMI */ PAD_NC(GPP_E7, NONE), /* E8: DRAM Sleep */ - PAD_CFG_NF(GPP_E8, NONE, DEEP, NF1), + PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), /* E10: PWD Amplifier Input */ diff --git a/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c b/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c index 18c5651fdb..a69b210a30 100644 --- a/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c +++ b/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c @@ -260,7 +260,7 @@ const struct pad_config gpio_table[] = { /* E7: Embedded Controller SMI */ PAD_NC(GPP_E7, NONE), /* E8: DRAM Sleep */ - PAD_CFG_NF(GPP_E8, NONE, DEEP, NF1), + PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), /* E10: Not Connected */ diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c b/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c index 4ca0ca5948..edde160dec 100644 --- a/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c +++ b/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c @@ -254,7 +254,7 @@ const struct pad_config gpio_table[] = { /* E7: Embedded Controller SMI */ PAD_NC(GPP_E7, NONE), /* E8: DRAM Sleep */ - PAD_CFG_NF(GPP_E8, NONE, DEEP, NF2), + PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ PAD_NC(GPP_E9, NONE), /* E10: PWD Amplifier Input */ From 39fc3587dddc47770a1f93b614b6d7b881a5532b Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 10 Feb 2025 09:55:09 +0530 Subject: [PATCH 0043/3886] mb/google/fatcat: Add power limits for additional PTL-H variants This commit adds power limit configurations for additional variants of the Intel PTL-H platform found on Fatcat. Specifically, it adds entries for PCI Device IDs 2, 3, and 4. These configurations define the PL1, PL2, and PL4 power limits, as well as the associated CPU TDP and power limits index. The PL4 values are currently placeholders and marked for future fine-tuning. BUG=b:395130929 TEST=Able to boot google/fatcat with 65W USB-C PD charger. Change-Id: I86befb07f39a5e292365ea40ea08d0f93f38a7a6 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86339 Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) Reviewed-by: Caveh Jalali --- .../variants/baseboard/fatcat/ramstage.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c b/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c index 4b9cfd2747..969cd4a7c0 100644 --- a/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c +++ b/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c @@ -18,6 +18,36 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { .pl2_max_power = 50000, .pl4_power = 50000 /* TODO: needs fine tuning */ }, + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_2, + .cpu_tdp = 25, + .power_limits_index = PTL_H_1_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 50000 /* TODO: needs fine tuning */ + }, + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_3, + .cpu_tdp = 25, + .power_limits_index = PTL_H_2_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 50000 /* TODO: needs fine tuning */ + }, + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_4, + .cpu_tdp = 25, + .power_limits_index = PTL_H_2_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 50000 /* TODO: needs fine tuning */ + }, }; void baseboard_devtree_update(void) From b994bbdd28923a12bd7ea2e3a83e37534a779b87 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 10 Feb 2025 16:22:31 +0000 Subject: [PATCH 0044/3886] mb/starlabs/starbook/adl_n: Disconnect unused GPIOs These are not connected, so configure them as such. Change-Id: I5dfeb5c1503ca85baf3641f1f5803519ec517b81 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86347 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/adl_n/gpio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c b/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c index 835d8f6251..e61c9a0d2e 100644 --- a/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c @@ -37,7 +37,7 @@ const struct pad_config gpio_table[] = { /* GPD8: Suspend Clock */ PAD_CFG_NF(GPD8, NONE, DEEP, NF1), /* GPD9: Wireless LAN Sleep */ - PAD_CFG_NF(GPD9, NONE, DEEP, NF1), + PAD_NC(GPD9, NONE), /* GPD10: Sleep S5 */ PAD_NC(GPD10, NONE), /* GPD11: LAN PHY Enable */ @@ -60,8 +60,8 @@ const struct pad_config gpio_table[] = { /* A10: ESPI Reset */ /* A11: Not Connected */ PAD_NC(GPP_A11, NONE), - /* A12: PCH M.2 SSD PEDET */ - PAD_CFG_NF(GPP_A12, NONE, DEEP, NF1), + /* A12: Not Connected */ + PAD_NC(GPP_A12, NONE), /* A13: BlueTooth RF Kill */ PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), /* A14: Test Point 45 */ @@ -69,7 +69,7 @@ const struct pad_config gpio_table[] = { /* A15: Test Point 52 */ PAD_NC(GPP_A15, NONE), /* A16: USB OverCurrent 3 */ - PAD_CFG_NF(GPP_A16, NONE, DEEP, NF1), + PAD_NC(GPP_A16, NONE), /* A17: Not Connected */ PAD_NC(GPP_A17, NONE), /* A18: DDI B DP HPD */ @@ -257,7 +257,7 @@ const struct pad_config gpio_table[] = { /* E8: DRAM Sleep */ PAD_CFG_GPO(GPP_E8, 1, DEEP), /* E9: USB OverCurrent 0 */ - PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), + PAD_NC(GPP_E9, NONE), /* E10: PWD Amplifier Input */ PAD_NC(GPP_E10, NONE), /* E11: TPM IRQ */ From 7d7802088a96690372f54d449ce90f9aaf9b107f Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 10 Feb 2025 14:35:37 +0000 Subject: [PATCH 0045/3886] mb/starlabs/*: Correct PAD ownership Commit `57aca97a2c6e524b442c80d67b033a813bf10e8e` correctly changed the reset types of GPIOs used in ACPI, but incorrectly set the pads to GPIO mode, rather than ACPI mode. This patch corrects that. Change-Id: I7207d4d00e810c15d071eca0bea83796989e3735 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86344 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- .../starlabs/byte_adl/variants/mk_ii/gpio.c | 10 +++++----- src/mainboard/starlabs/starbook/variants/adl/gpio.c | 10 +++++----- .../starlabs/starbook/variants/adl_n/gpio.c | 10 +++++----- src/mainboard/starlabs/starbook/variants/cml/gpio.c | 4 ++-- src/mainboard/starlabs/starbook/variants/mtl/gpio.c | 10 +++++----- src/mainboard/starlabs/starbook/variants/rpl/gpio.c | 10 +++++----- src/mainboard/starlabs/starbook/variants/tgl/gpio.c | 6 +++--- .../starlabs/starfighter/variants/rpl/gpio.c | 12 ++++++------ .../starlabs/starlite_adl/variants/mk_v/gpio.c | 12 ++++++------ 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c index 8ec1666014..6981b85fc0 100644 --- a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c +++ b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c @@ -63,7 +63,7 @@ const struct pad_config gpio_table[] = { /* A12: PCH M.2 SSD PEDET */ PAD_CFG_NF(GPP_A12, NONE, DEEP, NF1), /* A13: BlueTooth RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_A13, 1, DEEP), /* A14: Type C VBUS OverCurrent */ PAD_CFG_NF(GPP_A14, NONE, DEEP, NF1), /* A15: Test Point 3 */ @@ -229,7 +229,7 @@ const struct pad_config gpio_table[] = { /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: PCH M.2 SSD Power Enable */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D16, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D16, 1, DEEP), /* D17: Not Connected */ PAD_NC(GPP_D17, NONE), /* D18: Not Connected */ @@ -244,7 +244,7 @@ const struct pad_config gpio_table[] = { /* E2: Not Connected */ PAD_NC(GPP_E2, NONE), /* E3: WiFi RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E3, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_E3, 1, DEEP), /* E4: Test Point 7 */ PAD_NC(GPP_E4, NONE), /* E5: Not Connected */ @@ -340,7 +340,7 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_F23, NONE), /* H0: PCH M.2 SSD Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H0, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H0, 1, PLTRST), /* H1: BFX Strap 2 Bit 3 Weak Internal PD 20K */ PAD_CFG_GPO(GPP_H1, 0, DEEP), /* H2: Wireless LAN Reset */ @@ -452,7 +452,7 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_R7, NONE), /* BT_EN */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_VGPIO_0, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_VGPIO_0, 1, DEEP), /* CNVi BT UART0 */ PAD_NC(GPP_VGPIO_6, NONE), diff --git a/src/mainboard/starlabs/starbook/variants/adl/gpio.c b/src/mainboard/starlabs/starbook/variants/adl/gpio.c index 2ab629f291..4cc9888040 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl/gpio.c @@ -63,7 +63,7 @@ const struct pad_config gpio_table[] = { /* A12: PCH M.2 SSD PEDET */ PAD_CFG_NF(GPP_A12, NONE, DEEP, NF1), /* A13: BlueTooth RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_A13, 1, DEEP), /* A14: Test Point 45 */ PAD_NC(GPP_A14, NONE), /* A15: Test Point 52 */ @@ -228,7 +228,7 @@ const struct pad_config gpio_table[] = { /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: PCH M.2 SSD Power Enable */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D16, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D16, 1, DEEP), /* D17: Not used Fingerprint ID */ PAD_NC(GPP_D17, NONE), /* D18: Not Connected */ @@ -243,7 +243,7 @@ const struct pad_config gpio_table[] = { /* E2: Not Connected */ PAD_NC(GPP_E2, NONE), /* E3: WiFi RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E3, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_E3, 1, DEEP), /* E4: Test Point 14 */ PAD_NC(GPP_E4, NONE), /* E5: Not Connected */ @@ -339,11 +339,11 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_F23, NONE), /* H0: PCH M.2 SSD Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H0, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H0, 1, PLTRST), /* H1: BFX Strap 2 Bit 3 Weak Internal PD 20K */ PAD_CFG_GPO(GPP_H1, 0, DEEP), /* H2: Wireless LAN Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H2, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H2, 1, PLTRST), /* H3: Not Connected */ PAD_NC(GPP_H3, NONE), /* H4: I2C 0 SDA Touchpad */ diff --git a/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c b/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c index e61c9a0d2e..3c5c7d0b97 100644 --- a/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/adl_n/gpio.c @@ -63,7 +63,7 @@ const struct pad_config gpio_table[] = { /* A12: Not Connected */ PAD_NC(GPP_A12, NONE), /* A13: BlueTooth RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_A13, 1, DEEP), /* A14: Test Point 45 */ PAD_NC(GPP_A14, NONE), /* A15: Test Point 52 */ @@ -228,7 +228,7 @@ const struct pad_config gpio_table[] = { /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: PCH M.2 SSD Power Enable */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D16, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D16, 1, DEEP), /* D17: Not used Fingerprint ID */ PAD_NC(GPP_D17, NONE), /* D18: Not Connected */ @@ -243,7 +243,7 @@ const struct pad_config gpio_table[] = { /* E2: Not Connected */ PAD_NC(GPP_E2, NONE), /* E3: WiFi RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E3, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_E3, 1, DEEP), /* E4: Test Point 14 */ PAD_NC(GPP_E4, NONE), /* E5: Not Connected */ @@ -339,11 +339,11 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_F23, NONE), /* H0: PCH M.2 SSD Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H0, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H0, 1, PLTRST), /* H1: BFX Strap 2 Bit 3 Weak Internal PD 20K */ PAD_CFG_GPO(GPP_H1, 0, DEEP), /* H2: Wireless LAN Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H2, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H2, 1, PLTRST), /* H3: Not Connected */ PAD_NC(GPP_H3, NONE), /* H4: I2C 0 SDA Touchpad */ diff --git a/src/mainboard/starlabs/starbook/variants/cml/gpio.c b/src/mainboard/starlabs/starbook/variants/cml/gpio.c index 2baac30998..e29cd8199b 100644 --- a/src/mainboard/starlabs/starbook/variants/cml/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/cml/gpio.c @@ -116,7 +116,7 @@ const struct pad_config gpio_table[] = { /* B3: CLICK_PAD_INT_R_N */ PAD_CFG_GPI_APIC_LOW(GPP_B3, NONE, PLTRST), /* B4: BT_RF_KILL_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_B4, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_B4, 1, DEEP), /* B5: WLAN_CLKREQ# */ PAD_CFG_NF(GPP_B5, NONE, DEEP, NF1), /* B6: CLKREQ1_SSD_N */ @@ -161,7 +161,7 @@ const struct pad_config gpio_table[] = { /* C1: SMB_DATA */ PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1), /* C2: WIFI_RF_KILL_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_C2, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_C2, 1, DEEP), /* C3: Not Connected */ PAD_NC(GPP_C3, NONE), /* C4: Not Connected */ diff --git a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c index 02f1db7484..e64baa3a9a 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c @@ -249,14 +249,14 @@ const struct pad_config gpio_table[] = { * End: GPP_H23 */ /* H00: M.2_PCH_SSD_RESET_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H00, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H00, 1, PLTRST), /* H01: FLASH RECOVERY * HIGH: ENABLED * LOW: DISABLED * WEAK INTERNAL PD 20K */ PAD_NC(GPP_H01, NONE), /* H02: WLAN_RST_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H02, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H02, 1, PLTRST), /* H03: */ PAD_NC(GPP_H03, NONE), /* H04: */ @@ -266,7 +266,7 @@ const struct pad_config gpio_table[] = { /* H06: */ PAD_NC(GPP_H06, NONE), /* H07: M.2_CPU_SSD_PWREN */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H07, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_H07, 1, DEEP), /* H08: */ PAD_NC(GPP_H08, NONE), /* H09: */ @@ -432,9 +432,9 @@ const struct pad_config gpio_table[] = { /* B17: */ PAD_NC(GPP_B17, NONE), /* B18: BT_RF_KILL_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_B18, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_B18, 1, DEEP), /* B19: WIFI_RF_KILL_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_B19, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_B19, 1, DEEP), /* B20: */ PAD_NC(GPP_B20, NONE), /* B21: */ diff --git a/src/mainboard/starlabs/starbook/variants/rpl/gpio.c b/src/mainboard/starlabs/starbook/variants/rpl/gpio.c index 5e3cd0006a..542aa32b71 100644 --- a/src/mainboard/starlabs/starbook/variants/rpl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/rpl/gpio.c @@ -63,7 +63,7 @@ const struct pad_config gpio_table[] = { /* A12: PCH M.2 SSD PEDET */ PAD_NC(GPP_A12, NONE), /* A13: BlueTooth RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_A13, 1, DEEP), /* A14: Test Point 45 */ PAD_NC(GPP_A14, NONE), /* A15: Test Point 52 */ @@ -224,7 +224,7 @@ const struct pad_config gpio_table[] = { /* D13: Wireless LAN Wake */ PAD_NC(GPP_D13, NONE), /* D14: CPU M.2 SSD Power Enable */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D14, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D14, 1, DEEP), /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: PCH M.2 SSD Power Enable */ @@ -243,9 +243,9 @@ const struct pad_config gpio_table[] = { /* E2: Not Connected */ PAD_NC(GPP_E2, NONE), /* E3: WiFi RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E3, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_E3, 1, DEEP), /* E4: Retimer Force Power */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E4, 0, DEEP, NONE), + PAD_CFG_GPO(GPP_E4, 0, DEEP), /* E5: Not Connected */ PAD_NC(GPP_E5, NONE), /* E6: JTAG ODT No internal PD @@ -330,7 +330,7 @@ const struct pad_config gpio_table[] = { /* F19: Not Connected */ PAD_NC(GPP_F19, NONE), /* F20: CPU M.2 SSD Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_F20, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_F20, 1, PLTRST), /* F21: GPPC_F21 */ PAD_NC(GPP_F21, NONE), /* F22: Not Connected */ diff --git a/src/mainboard/starlabs/starbook/variants/tgl/gpio.c b/src/mainboard/starlabs/starbook/variants/tgl/gpio.c index f1350c5b8e..2526f7fa68 100644 --- a/src/mainboard/starlabs/starbook/variants/tgl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/tgl/gpio.c @@ -66,7 +66,7 @@ const struct pad_config gpio_table[] = { /* A10: WLAN_PCM_IN */ PAD_NC(GPP_A10, NONE), /* A11: M2_CPU_SSD_RST_N */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A11, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_A11, 1, PLTRST), /* A12: SATAGP_1 */ PAD_CFG_NF(GPP_A12, UP_20K, DEEP, NF1), /* A13: Not Connected */ @@ -90,7 +90,7 @@ const struct pad_config gpio_table[] = { /* A22: Not Connected */ PAD_NC(GPP_A22, NONE), /* A23: TC_RETIMER_FORCE_PWR */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A23, 0, DEEP, NONE), + PAD_CFG_GPO(GPP_A23, 0, DEEP), /* B0: CORE_VID_0 */ PAD_CFG_NF(GPP_B0, NONE, DEEP, NF1), @@ -219,7 +219,7 @@ const struct pad_config gpio_table[] = { /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: CPU_SSD_PWREN */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D16, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D16, 1, DEEP), /* D17: Not Connected */ PAD_NC(GPP_D17, NONE), /* D18: Not Connected */ diff --git a/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c b/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c index a69b210a30..bfd06741d1 100644 --- a/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c +++ b/src/mainboard/starlabs/starfighter/variants/rpl/gpio.c @@ -72,7 +72,7 @@ const struct pad_config gpio_table[] = { /* A12: PCH M.2 SSD PEDET */ PAD_CFG_NF(GPP_A12, NONE, DEEP, NF1), /* A13: BlueTooth RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_A13, 1, DEEP), /* A14: Test Point 45 */ PAD_NC(GPP_A14, NONE), /* A15: Test Point 52 */ @@ -229,7 +229,7 @@ const struct pad_config gpio_table[] = { /* D13: Wireless LAN Wake */ PAD_NC(GPP_D13, NONE), /* D14: CPU M.2 SSD Power Enable */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D14, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D14, 1, DEEP), /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: PCH M.2 SSD Power Enable */ @@ -248,9 +248,9 @@ const struct pad_config gpio_table[] = { /* E2: Not Connected */ PAD_NC(GPP_E2, NONE), /* E3: WiFi RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E3, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_E3, 1, DEEP), /* E4: Retimer Force Power */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E4, 0, DEEP, NONE), + PAD_CFG_GPO(GPP_E4, 0, DEEP), /* E5: Not Connected */ PAD_NC(GPP_E5, NONE), /* E6: JTAG ODT No internal PD @@ -327,7 +327,7 @@ const struct pad_config gpio_table[] = { /* F19: Not Connected */ PAD_NC(GPP_F19, NONE), /* F20: CPU M.2 SSD Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_F20, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_F20, 1, PLTRST), /* F21: GPPC_F21 */ PAD_NC(GPP_F21, NONE), /* F22: Not Connected */ @@ -340,7 +340,7 @@ const struct pad_config gpio_table[] = { /* H1: BFX Strap 2 Bit 3 Weak Internal PD 20K */ PAD_CFG_GPO(GPP_H1, 0, DEEP), /* H2: Wireless LAN Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H2, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H2, 1, PLTRST), /* H3: Not Connected */ PAD_NC(GPP_H3, NONE), /* H4: I2C 0 SDA Touchpad */ diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c b/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c index edde160dec..f7a9737aa3 100644 --- a/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c +++ b/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c @@ -63,7 +63,7 @@ const struct pad_config gpio_table[] = { /* A12: Not Connected */ PAD_NC(GPP_A12, NONE), /* A13: BlueTooth RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_A13, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_A13, 1, DEEP), /* A14: Camera Power Enable */ PAD_NC(GPP_A14, NONE), /* A15: Camera Reset */ @@ -227,7 +227,7 @@ const struct pad_config gpio_table[] = { /* D15: Not Connected */ PAD_NC(GPP_D15, NONE), /* D16: PCH M.2 SSD Power Enable */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_D16, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_D16, 1, DEEP), /* D17: Not used Fingerprint ID */ PAD_NC(GPP_D17, NONE), /* D18: Bluetooth Wake */ @@ -242,7 +242,7 @@ const struct pad_config gpio_table[] = { /* E2: Not Connected */ PAD_NC(GPP_E2, NONE), /* E3: WiFi RF Kill */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_E3, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_E3, 1, DEEP), /* E4: P Offset */ PAD_NC(GPP_E4, NONE), /* E5: P Out */ @@ -323,7 +323,7 @@ const struct pad_config gpio_table[] = { /* F16: Not Connected */ PAD_NC(GPP_F16, NONE), /* F17: Touch Panel Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_F17, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_F17, 1, PLTRST), /* F18: Touch Panel Interrupt */ PAD_CFG_GPI_APIC(GPP_F18, NONE, PLTRST, LEVEL, INVERT), /* F19: Not Connected */ @@ -338,7 +338,7 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_F23, NONE), /* H0: PCH M.2 SSD Reset */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_H0, 1, PLTRST, NONE), + PAD_CFG_GPO(GPP_H0, 1, PLTRST), /* H1: BFX Strap 2 Bit 3 Weak Internal PD 20K */ PAD_CFG_GPO(GPP_H1, 0, DEEP), /* H2: Wireless LAN Reset */ @@ -450,7 +450,7 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_R7, NONE), /* BT_EN */ - PAD_CFG_GPO_GPIO_DRIVER(GPP_VGPIO_0, 1, DEEP, NONE), + PAD_CFG_GPO(GPP_VGPIO_0, 1, DEEP), /* CNVi BT UART0 */ PAD_NC(GPP_VGPIO_6, NONE), From 0c72983da26389460f26b4181e27de5c9ab49e45 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Fri, 7 Feb 2025 16:39:03 -0600 Subject: [PATCH 0046/3886] ec/starlabs/merlin: Only include lid switch ACPI when needed Desktop devices don't need and shouldn't define a lid switch. TEST=build/boot starlabs/byte,starlite_adl Change-Id: Iecf3e2558e244cc0bec301a505c0bc86684954aa Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86322 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes --- src/ec/starlabs/merlin/acpi/ec.asl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ec/starlabs/merlin/acpi/ec.asl b/src/ec/starlabs/merlin/acpi/ec.asl index f3fdb07334..ae5092772f 100644 --- a/src/ec/starlabs/merlin/acpi/ec.asl +++ b/src/ec/starlabs/merlin/acpi/ec.asl @@ -112,11 +112,11 @@ Scope (\_SB.PCI0.LPCB) #include "ac.asl" #if CONFIG(SYSTEM_TYPE_LAPTOP) || CONFIG(SYSTEM_TYPE_DETACHABLE) #include "battery.asl" + #include "lid.asl" #endif #if !CONFIG(EC_STARLABS_MERLIN) #include "events.asl" #endif - #include "lid.asl" #if CONFIG(SYSTEM_TYPE_DETACHABLE) #include "dock.asl" #endif From 46e9d5a3989e25c558ec1cf9868fd05e1e0d0cb3 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Fri, 10 Jan 2025 10:57:59 -0600 Subject: [PATCH 0047/3886] mb/starlabs/starlite_adl: Increase display brightness at POST Adjust the POST brightness level in the VBT from 50 to 150 (max 255). Change-Id: I1704a3479c38510b29427d582ee14c740401cd38 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86345 Reviewed-by: Sean Rhodes Tested-by: build bot (Jenkins) --- .../starlite_adl/variants/mk_v/data.vbt | Bin 9216 -> 9216 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/data.vbt b/src/mainboard/starlabs/starlite_adl/variants/mk_v/data.vbt index cbd4a5ae19445168ea76f731d248f15d89164774..a985a4b18a819d4122a5aecef554467f36113e3f 100644 GIT binary patch delta 41 xcmZqhXz-XI#ca)BFgcM?c%#8&KE`R2FYswkzR$-qS(smAvOK@UW^4YVA^-{641NFr delta 46 zcmZqhXz-XI#oWVSFgcM?c%#8&K1QR-7x=U%-{<4uWMg1p0Aa~V{N|gj`HzYK052^I Ay8r+H From 773a405b7b5cdd828a0cebc0a420a7756c75dc24 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Fri, 7 Feb 2025 12:24:33 -0600 Subject: [PATCH 0048/3886] {ec,mb}/starlabs: Consolidate EC-related CFR options in ec directory Move all of the EC-related CFR options into a header in the ec directory, so it can be reused across multiple boards. TEST=build/boot starlabs/starbook_mtl,starlite_adl and verify CFR options work properly. Change-Id: I831559184de917b32e4993e8e34ffbc7b7e883e4 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86318 Reviewed-by: Sean Rhodes Tested-by: build bot (Jenkins) --- src/ec/starlabs/merlin/cfr.h | 114 ++++++++++++++++++++++ src/mainboard/starlabs/lite/cfr.c | 23 +---- src/mainboard/starlabs/starbook/cfr.c | 77 +-------------- src/mainboard/starlabs/starfighter/cfr.c | 77 +-------------- src/mainboard/starlabs/starlite_adl/cfr.c | 54 +--------- 5 files changed, 118 insertions(+), 227 deletions(-) create mode 100644 src/ec/starlabs/merlin/cfr.h diff --git a/src/ec/starlabs/merlin/cfr.h b/src/ec/starlabs/merlin/cfr.h new file mode 100644 index 0000000000..b56e7d2e52 --- /dev/null +++ b/src/ec/starlabs/merlin/cfr.h @@ -0,0 +1,114 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * CFR enums and structs which are used to control EC settings. + */ + +#include +#include "ec.h" + +/* + * Keyboard Backlight Timeout + */ +static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ + .opt_name = "kbl_timeout", + .ui_name = "Keyboard Backlight Timeout", + .ui_helptext = "Set the amount of time before the keyboard backlight turns off" + " when un-used", + .default_value = 0, + .values = (struct sm_enum_value[]) { + { "30 seconds", 0 }, + { "1 minute", 1 }, + { "3 minutes", 2 }, + { "5 minutes", 3 }, + { "Never", 4 }, + SM_ENUM_VALUE_END }, +}); + + +/* + * Function-Control Swap + */ +static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ + .opt_name = "fn_ctrl_swap", + .ui_name = "Fn Ctrl Reverse", + .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", + .default_value = false, +}); + +/* + * Maximum Battery Charge Level + */ +static const struct sm_object max_charge = SM_DECLARE_ENUM({ + .opt_name = "max_charge", + .ui_name = "Maximum Charge Level", + .ui_helptext = "Set the maximum level the battery will charge to.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "100%", 0 }, + { "80%", 1 }, + { "60%", 2 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Fan Mode + */ +static const struct sm_object fan_mode = SM_DECLARE_ENUM({ + .opt_name = "fan_mode", + .ui_name = "Fan Mode", + .ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Normal", 0 }, + { "Aggressive", 1 }, + { "Quiet", 2 }, + { "Disabled", 3 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Charging Speed + */ +static const struct sm_object charging_speed = SM_DECLARE_ENUM({ + .opt_name = "charging_speed", + .ui_name = "Charging Speed", + .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" + " will increase heat and battery wear.", + .default_value = 1, + .values = (const struct sm_enum_value[]) { + { "1.0C", 0 }, + { "0.5C", 1 }, + { "0.2C", 2 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Lid Switch + */ +static const struct sm_object lid_switch = SM_DECLARE_ENUM({ + .opt_name = "lid_switch", + .ui_name = "Lid Switch", + .ui_helptext = "Configure what opening or closing the lid will do.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Normal", 0 }, + { "Sleep Only", 1 }, + { "Disabled", 2 }, + SM_ENUM_VALUE_END }, +}); + +/* + * Power LED Brightness + */ +static const struct sm_object power_led = SM_DECLARE_ENUM({ + .opt_name = "power_led", + .ui_name = "Power LED Brightness", + .ui_helptext = "Control the maximum brightness of the power LED", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Normal", 0 }, + { "Reduced", 1 }, + SM_ENUM_VALUE_END, + }, +}); diff --git a/src/mainboard/starlabs/lite/cfr.c b/src/mainboard/starlabs/lite/cfr.c index e0d22e6b69..251f55c339 100644 --- a/src/mainboard/starlabs/lite/cfr.c +++ b/src/mainboard/starlabs/lite/cfr.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -54,28 +55,6 @@ static const struct sm_object fast_charge = SM_DECLARE_BOOL({ }); #endif -static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ - .opt_name = "fn_ctrl_swap", - .ui_name = "Fn Ctrl Reverse", - .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", - .default_value = false, -}); - -static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ - .opt_name = "kbl_timeout", - .ui_name = "Keyboard Backlight Timeout", - .ui_helptext = "Set the amount of time before the keyboard backlight turns off" - " when un-used", - .default_value = 0, - .values = (struct sm_enum_value[]) { - { "30 seconds", 0 }, - { "1 minute", 1 }, - { "3 minutes", 2 }, - { "5 minutes", 3 }, - { "Never", 4 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object power_on_after_fail = SM_DECLARE_BOOL({ .opt_name = "power_on_after_fail", .ui_name = "Power on after failure", diff --git a/src/mainboard/starlabs/starbook/cfr.c b/src/mainboard/starlabs/starbook/cfr.c index bf0e4b0bcf..1e08ba1c12 100644 --- a/src/mainboard/starlabs/starbook/cfr.c +++ b/src/mainboard/starlabs/starbook/cfr.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -27,21 +28,6 @@ static const struct sm_object card_reader = SM_DECLARE_BOOL({ .default_value = true, }); -#if CONFIG(EC_STARLABS_CHARGING_SPEED) -static const struct sm_object charging_speed = SM_DECLARE_ENUM({ - .opt_name = "charging_speed", - .ui_name = "Charging Speed", - .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" - " will increase heat and battery wear.", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "1.0C", 0 }, - { "0.5C", 1 }, - { "0.2C", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - static const struct sm_object debug_level = SM_DECLARE_ENUM({ .opt_name = "debug_level", .ui_name = "Debug Level", @@ -60,19 +46,6 @@ static const struct sm_object debug_level = SM_DECLARE_ENUM({ SM_ENUM_VALUE_END }, }); -static const struct sm_object fan_mode = SM_DECLARE_ENUM({ - .opt_name = "fan_mode", - .ui_name = "Fan Mode", - .ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Aggressive", 1 }, - { "Quiet", 2 }, - { "Disabled", 3 }, - SM_ENUM_VALUE_END }, -}); - #if CONFIG(BOARD_STARLABS_STARBOOK_ADL) || CONFIG(BOARD_STARLABS_STARBOOK_RPL) static const struct sm_object fingerprint_reader = SM_DECLARE_BOOL({ .opt_name = "fingerprint_reader", @@ -82,13 +55,6 @@ static const struct sm_object fingerprint_reader = SM_DECLARE_BOOL({ }); #endif -static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ - .opt_name = "fn_ctrl_swap", - .ui_name = "Fn Ctrl Reverse", - .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", - .default_value = false, -}); - #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE) static const struct sm_object gna = SM_DECLARE_BOOL({ .opt_name = "gna", @@ -107,47 +73,6 @@ static const struct sm_object hyper_threading = SM_DECLARE_BOOL({ }); #endif -static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ - .opt_name = "kbl_timeout", - .ui_name = "Keyboard Backlight Timeout", - .ui_helptext = "Set the amount of time before the keyboard backlight turns off" - " when un-used", - .default_value = 0, - .values = (struct sm_enum_value[]) { - { "30 seconds", 0 }, - { "1 minute", 1 }, - { "3 minutes", 2 }, - { "5 minutes", 3 }, - { "Never", 4 }, - SM_ENUM_VALUE_END }, -}); - -#if CONFIG(EC_STARLABS_LID_SWITCH) -static const struct sm_object lid_switch = SM_DECLARE_ENUM({ - .opt_name = "lid_switch", - .ui_name = "Lid Switch", - .ui_helptext = "Configure what opening or closing the lid will do.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Sleep Only", 1 }, - { "Disabled", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - -static const struct sm_object max_charge = SM_DECLARE_ENUM({ - .opt_name = "max_charge", - .ui_name = "Maximum Charge Level", - .ui_helptext = "Set the maximum level the battery will charge to.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "100%", 0 }, - { "80%", 1 }, - { "60%", 2 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object me_state = SM_DECLARE_ENUM({ .opt_name = "me_state", .ui_name = "Intel Management Engine", diff --git a/src/mainboard/starlabs/starfighter/cfr.c b/src/mainboard/starlabs/starfighter/cfr.c index f310f86a64..7e040cce31 100644 --- a/src/mainboard/starlabs/starfighter/cfr.c +++ b/src/mainboard/starlabs/starfighter/cfr.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -20,21 +21,6 @@ static const struct sm_object boot_option = SM_DECLARE_ENUM({ SM_ENUM_VALUE_END }, }); -#if CONFIG(EC_STARLABS_CHARGING_SPEED) -static const struct sm_object charging_speed = SM_DECLARE_ENUM({ - .opt_name = "charging_speed", - .ui_name = "Charging Speed", - .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" - " will increase heat and battery wear.", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "1.0C", 0 }, - { "0.5C", 1 }, - { "0.2C", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - static const struct sm_object debug_level = SM_DECLARE_ENUM({ .opt_name = "debug_level", .ui_name = "Debug Level", @@ -53,26 +39,6 @@ static const struct sm_object debug_level = SM_DECLARE_ENUM({ SM_ENUM_VALUE_END }, }); -static const struct sm_object fan_mode = SM_DECLARE_ENUM({ - .opt_name = "fan_mode", - .ui_name = "Fan Mode", - .ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Aggressive", 1 }, - { "Quiet", 2 }, - { "Disabled", 3 }, - SM_ENUM_VALUE_END }, -}); - -static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({ - .opt_name = "fn_ctrl_swap", - .ui_name = "Fn Ctrl Reverse", - .ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys", - .default_value = false, -}); - #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE) static const struct sm_object gna = SM_DECLARE_BOOL({ .opt_name = "gna", @@ -89,47 +55,6 @@ static const struct sm_object hyper_threading = SM_DECLARE_BOOL({ .default_value = true, }); -static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({ - .opt_name = "kbl_timeout", - .ui_name = "Keyboard Backlight Timeout", - .ui_helptext = "Set the amount of time before the keyboard backlight turns off" - " when un-used", - .default_value = 0, - .values = (struct sm_enum_value[]) { - { "30 seconds", 0 }, - { "1 minute", 1 }, - { "3 minutes", 2 }, - { "5 minutes", 3 }, - { "Never", 4 }, - SM_ENUM_VALUE_END }, -}); - -#if CONFIG(EC_STARLABS_LID_SWITCH) -static const struct sm_object lid_switch = SM_DECLARE_ENUM({ - .opt_name = "lid_switch", - .ui_name = "Lid Switch", - .ui_helptext = "Configure what opening or closing the lid will do.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Sleep Only", 1 }, - { "Disabled", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - -static const struct sm_object max_charge = SM_DECLARE_ENUM({ - .opt_name = "max_charge", - .ui_name = "Maximum Charge Level", - .ui_helptext = "Set the maximum level the battery will charge to.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "100%", 0 }, - { "80%", 1 }, - { "60%", 2 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object me_state = SM_DECLARE_ENUM({ .opt_name = "me_state", .ui_name = "Intel Management Engine", diff --git a/src/mainboard/starlabs/starlite_adl/cfr.c b/src/mainboard/starlabs/starlite_adl/cfr.c index a8e44fa11c..a00a7a7f4a 100644 --- a/src/mainboard/starlabs/starlite_adl/cfr.c +++ b/src/mainboard/starlabs/starlite_adl/cfr.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -27,21 +28,6 @@ static const struct sm_object boot_option = SM_DECLARE_ENUM({ SM_ENUM_VALUE_END }, }); -#if CONFIG(EC_STARLABS_CHARGING_SPEED) -static const struct sm_object charging_speed = SM_DECLARE_ENUM({ - .opt_name = "charging_speed", - .ui_name = "Charging Speed", - .ui_helptext = "Set the maximum speed to charge the battery. Charging faster" - " will increase heat and battery wear.", - .default_value = 1, - .values = (const struct sm_enum_value[]) { - { "1.0C", 0 }, - { "0.5C", 1 }, - { "0.2C", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - static const struct sm_object debug_level = SM_DECLARE_ENUM({ .opt_name = "debug_level", .ui_name = "Debug Level", @@ -69,32 +55,6 @@ static const struct sm_object gna = SM_DECLARE_BOOL({ }); #endif -#if CONFIG(EC_STARLABS_LID_SWITCH) -static const struct sm_object lid_switch = SM_DECLARE_ENUM({ - .opt_name = "lid_switch", - .ui_name = "Lid Switch", - .ui_helptext = "Configure what opening or closing the lid will do.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Sleep Only", 1 }, - { "Disabled", 2 }, - SM_ENUM_VALUE_END }, -}); -#endif - -static const struct sm_object max_charge = SM_DECLARE_ENUM({ - .opt_name = "max_charge", - .ui_name = "Maximum Charge Level", - .ui_helptext = "Set the maximum level the battery will charge to.", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "100%", 0 }, - { "80%", 1 }, - { "60%", 2 }, - SM_ENUM_VALUE_END }, -}); - static const struct sm_object me_state = SM_DECLARE_ENUM({ .opt_name = "me_state", .ui_name = "Intel Management Engine", @@ -194,18 +154,6 @@ static const struct sm_object pciexp_l1ss = SM_DECLARE_ENUM({ }); #endif -static const struct sm_object power_led = SM_DECLARE_ENUM({ - .opt_name = "power_led", - .ui_name = "Power LED Brightness", - .ui_helptext = "Control the maximum brightness of the power LED", - .default_value = 0, - .values = (const struct sm_enum_value[]) { - { "Normal", 0 }, - { "Reduced", 1 }, - SM_ENUM_VALUE_END, - }, -}); - static const struct sm_object reboot_counter = SM_DECLARE_NUMBER({ .opt_name = "reboot_counter", .ui_name = "Reboot Counter", From 8d87fd7d320bab05540edef90f0ada0bc2385f87 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 6 Feb 2025 09:19:09 +0100 Subject: [PATCH 0049/3886] soc/amd: Document VBIOS handling The code flow isn't that obvious in the beginning. You pass an address of the VBIOS to FSP, but don't load any VBIOS until BS_DEV_RESOURCES phase. Add comments to document what is done and when. This will help to improve the code in the next step. Change-Id: I643bc9088306d99cc0fbb79648809e16b068fb33 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86298 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/soc/amd/cezanne/fsp_s_params.c | 5 +++++ src/soc/amd/common/block/graphics/graphics.c | 16 +++++++++++++--- src/soc/amd/glinda/fsp_s_params.c | 5 +++++ src/soc/amd/mendocino/fsp_s_params.c | 5 +++++ src/soc/amd/phoenix/fsp_s_params.c | 5 +++++ src/soc/amd/picasso/fsp_s_params.c | 5 +++++ 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/soc/amd/cezanne/fsp_s_params.c b/src/soc/amd/cezanne/fsp_s_params.c index 60f3942802..b9770f3ef5 100644 --- a/src/soc/amd/cezanne/fsp_s_params.c +++ b/src/soc/amd/cezanne/fsp_s_params.c @@ -8,6 +8,11 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; } diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index ea7308a850..77420aebaa 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -147,9 +147,13 @@ static const char *graphics_acpi_name(const struct device *dev) } /* - * Even though AMD does not need VBT we still need to implement the - * vbt_get() function to not break the build with GOP driver enabled - * (see fsps_return_value_handler() in fsp2_0/silicon_init.c + * On AMD platforms the VBT is called ATOMBIOS and is always part of the + * VGA Option ROM. As part of the FSP GOP init the ATOMBIOS tables are + * updated in place. Thus the VBIOS must be loaded into RAM before FSP GOP + * runs. The address of the VBIOS must be passed to FSP-S using UPDs, but + * loading of the VBIOS can be delayed until before FSP AFTER_PCI_ENUM + * notify is called. FSP expects a pointer to the PCI option rom instead + * a pointer to the ATOMBIOS table directly. */ void *vbt_get(void) { @@ -165,6 +169,7 @@ static void graphics_set_resources(struct device *const dev) if (!CONFIG(RUN_FSP_GOP)) return; + /* Load the VBIOS before FSP AFTER_PCI_ENUM notify is called. */ timestamp_add_now(TS_OPROM_INITIALIZE); if (CONFIG(USE_SELECTIVE_GOP_INIT) && vbios_cache_is_valid() && !display_init_required()) { @@ -172,6 +177,11 @@ static void graphics_set_resources(struct device *const dev) timestamp_add_now(TS_OPROM_COPY_END); return; } + + /* + * VBIOS cache was not used, so load it from CBFS and let FSP GOP + * initialize the ATOMBIOS tables. + */ rom = pci_rom_probe(dev); if (rom == NULL) { printk(BIOS_ERR, "%s: Unable to find ROM for %s\n", diff --git a/src/soc/amd/glinda/fsp_s_params.c b/src/soc/amd/glinda/fsp_s_params.c index 597f7a9ea3..e03795792d 100644 --- a/src/soc/amd/glinda/fsp_s_params.c +++ b/src/soc/amd/glinda/fsp_s_params.c @@ -10,6 +10,11 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; } diff --git a/src/soc/amd/mendocino/fsp_s_params.c b/src/soc/amd/mendocino/fsp_s_params.c index 50923e9af7..5c37334f5a 100644 --- a/src/soc/amd/mendocino/fsp_s_params.c +++ b/src/soc/amd/mendocino/fsp_s_params.c @@ -20,6 +20,11 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) printk(BIOS_SPEW, "%s: using VBIOS cache; skipping GOP driver.\n", __func__); return; } + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ printk(BIOS_SPEW, "%s: not using VBIOS cache; running GOP driver.\n", __func__); scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; } diff --git a/src/soc/amd/phoenix/fsp_s_params.c b/src/soc/amd/phoenix/fsp_s_params.c index 46c8e76d94..883cde0f89 100644 --- a/src/soc/amd/phoenix/fsp_s_params.c +++ b/src/soc/amd/phoenix/fsp_s_params.c @@ -10,6 +10,11 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; } diff --git a/src/soc/amd/picasso/fsp_s_params.c b/src/soc/amd/picasso/fsp_s_params.c index 9f491d6516..d4cfa276c1 100644 --- a/src/soc/amd/picasso/fsp_s_params.c +++ b/src/soc/amd/picasso/fsp_s_params.c @@ -185,6 +185,11 @@ static void fsp_edp_tuning_upds(FSP_S_CONFIG *scfg, static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer_addr = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; } From 9c5496ecb06b12b6ea1cd0e9c8ca266bab381565 Mon Sep 17 00:00:00 2001 From: Lu Tang Date: Fri, 7 Feb 2025 14:10:53 +0800 Subject: [PATCH 0050/3886] soc/mediatek/mt8196: Set the driving strength of SPMI-P to maximum To fix the SPMI-P glitch, the driving strength of SPMI-P needs to be set to a maximum value of 16mA. Additionally, a hardware solution of external pull-down is also required. BRANCH=rauru TEST=Build passed and booted successfully. The platform remained idle for approximately 20 hours without hang. BUG=b:383634290 Signed-off-by: Lu Tang Change-Id: I131fd04c0313c7ed64bbd123f61d9a6849c8def4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86341 Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8196/pmif_spmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/soc/mediatek/mt8196/pmif_spmi.c b/src/soc/mediatek/mt8196/pmif_spmi.c index c4a984f5a6..cb78249662 100644 --- a/src/soc/mediatek/mt8196/pmif_spmi.c +++ b/src/soc/mediatek/mt8196/pmif_spmi.c @@ -165,9 +165,9 @@ void pmif_spmi_iocfg(void) /* SPMI_M 10mA */ gpio_set_driving(GPIO(SPMI_M_SCL), GPIO_DRV_10_MA); gpio_set_driving(GPIO(SPMI_M_SDA), GPIO_DRV_10_MA); - /* SPMI_P 14mA */ - gpio_set_driving(GPIO(SPMI_P_SCL), GPIO_DRV_14_MA); - gpio_set_driving(GPIO(SPMI_P_SDA), GPIO_DRV_14_MA); + /* SPMI_P 16mA */ + gpio_set_driving(GPIO(SPMI_P_SCL), GPIO_DRV_16_MA); + gpio_set_driving(GPIO(SPMI_P_SDA), GPIO_DRV_16_MA); /* SPMI-P set Pull-Down mode */ gpio_set_pull(GPIO(SPMI_P_SCL), GPIO_PULL_ENABLE, GPIO_PULL_DOWN); gpio_set_pull(GPIO(SPMI_P_SDA), GPIO_PULL_ENABLE, GPIO_PULL_DOWN); From 93cef8791b0e58112957e3f5b533bae565c1b83e Mon Sep 17 00:00:00 2001 From: Guangjie Song Date: Tue, 14 Jan 2025 15:01:58 +0800 Subject: [PATCH 0051/3886] soc/mediatek/mt8196: Correct MMinfra vote register Correct MMinfra vote register to fix MMinfra power off failure during suspend. BRANCH=rauru BUG=b:377628718 TEST=Bootup OK and Suspend/Resume OK, with MMinfra kernel/vcp patch, mminfra can be turned off to reduce power consumption by 50mW. Signed-off-by: Guangjie Song Change-Id: I7c23c3c53c68b0de85d8b6189b685de7f8398e8b Reviewed-on: https://review.coreboot.org/c/coreboot/+/86342 Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8196/mtcmos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/mt8196/mtcmos.c b/src/soc/mediatek/mt8196/mtcmos.c index 367e74b464..e274be8639 100644 --- a/src/soc/mediatek/mt8196/mtcmos.c +++ b/src/soc/mediatek/mt8196/mtcmos.c @@ -42,8 +42,8 @@ #define MMVOTE_MTCMOS_1_CLR ((void *)(MMVOTE_BASE + 0x0224)) #define MMVOTE_MTCMOS_1_DONE ((void *)(MMVOTE_BASE + 0x142C)) #define MMVOTE_MTCMOS_1_PM_ACK ((void *)(MMVOTE_BASE + 0x5518)) -#define MMINFRA_MTCMOS_1_SET ((void *)(MMVOTE_BASE + 0x43220)) -#define MMINFRA_MTCMOS_1_CLR ((void *)(MMVOTE_BASE + 0x43224)) +#define MMINFRA_MTCMOS_1_SET ((void *)(MMVOTE_BASE + 0x20220)) +#define MMINFRA_MTCMOS_1_CLR ((void *)(MMVOTE_BASE + 0x20224)) #define DISP_VDISP_AO_CONFIG_CG 0x3E800108 #define DISP_DPC_DISP0_MTCMOS_CFG 0x3E8F0500 From d5a3f9998fd904c90c33c6cd33c52a0c21fa707f Mon Sep 17 00:00:00 2001 From: Ivy Jian Date: Mon, 3 Feb 2025 13:39:14 +0800 Subject: [PATCH 0052/3886] mb/google/nissa/var/dirks: Add initial override devicetree Add initial override devicetree for dirks based on the latest schematic (0W4_TWL_A_MB_0120.pdf). - Add eMMC DLL tuning value (copy from riven) - Configure I2C buses - Configure USB ports - Configure audio codec - Configure WIFI6(CNVi) and WIFI7(PCIe) Note : There will be a separate CL to configure the implementation of repurposing the TCSS port to USB Type-A after FSP support is added. BUG=b:389391653 TEST=none. Change-Id: Ic0b80e3121d94ede771ecc30cf0c66a67b9a41d0 Signed-off-by: Ivy Jian Reviewed-on: https://review.coreboot.org/c/coreboot/+/86250 Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Eric Lai --- .../brya/variants/dirks/overridetree.cb | 347 +++++++++++++++++- 1 file changed, 345 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/dirks/overridetree.cb b/src/mainboard/google/brya/variants/dirks/overridetree.cb index 4f2c04a57a..bc1c1867bb 100644 --- a/src/mainboard/google/brya/variants/dirks/overridetree.cb +++ b/src/mainboard/google/brya/variants/dirks/overridetree.cb @@ -1,6 +1,349 @@ chip soc/intel/alderlake - device domain 0 on - end + register "sagv" = "SaGv_Enabled" + # EMMC Tx CMD Delay + # Refer to EDS-Vol2-42.3.7. + # [14:8] steps of delay for DDR mode, each 125ps, range: 0 - 39. + # [6:0] steps of delay for SDR mode, each 125ps, range: 0 - 39. + register "common_soc_config.emmc_dll.emmc_tx_cmd_cntl" = "0x505" + + # EMMC TX DATA Delay 1 + # Refer to EDS-Vol2-42.3.8. + # [14:8] steps of delay for HS400, each 125ps, range: 0 - 78. + # [6:0] steps of delay for SDR104/HS200, each 125ps, range: 0 - 79. + register "common_soc_config.emmc_dll.emmc_tx_data_cntl1" = "0x909" + + # EMMC TX DATA Delay 2 + # Refer to EDS-Vol2-42.3.9. + # [30:24] steps of delay for SDR50, each 125ps, range: 0 - 79. + # [22:16] steps of delay for DDR50, each 125ps, range: 0 - 78. + # [14:8] steps of delay for SDR25/HS50, each 125ps, range: 0 -79. + # [6:0] steps of delay for SDR12, each 125ps. Range: 0 - 79. + register "common_soc_config.emmc_dll.emmc_tx_data_cntl2" = "0x1C2A2828" + + # EMMC RX CMD/DATA Delay 1 + # Refer to EDS-Vol2-42.3.10. + # [30:24] steps of delay for SDR50, each 125ps, range: 0 - 119. + # [22:16] steps of delay for DDR50, each 125ps, range: 0 - 78. + # [14:8] steps of delay for SDR25/HS50, each 125ps, range: 0 - 119. + # [6:0] steps of delay for SDR12, each 125ps, range: 0 - 119. + register "common_soc_config.emmc_dll.emmc_rx_cmd_data_cntl1" = "0x1C1B4F1B" + + # EMMC RX CMD/DATA Delay 2 + # Refer to EDS-Vol2-42.3.12. + # [17:16] stands for Rx Clock before Output Buffer, + # 00: Rx clock after output buffer, + # 01: Rx clock before output buffer, + # 10: Automatic selection based on working mode. + # 11: Reserved + # [14:8] steps of delay for Auto Tuning Mode, each 125ps, range: 0 - 39. + # [6:0] steps of delay for HS200, each 125ps, range: 0 - 79. + register "common_soc_config.emmc_dll.emmc_rx_cmd_data_cntl2" = "0x10023" + + # EMMC Rx Strobe Delay + # Refer to EDS-Vol2-42.3.11. + # [14:8] Rx Strobe Delay DLL 1(HS400 Mode), each 125ps, range: 0 - 39. + # [6:0] Rx Strobe Delay DLL 2(HS400 Mode), each 125ps, range: 0 - 39. + register "common_soc_config.emmc_dll.emmc_rx_strobe_cntl" = "0x11515" + + # SOC Aux orientation override: + # This is a bitfield that corresponds to up to 4 TCSS ports. + # Bits (0,1) allocated for TCSS Port1 configuration and Bits (2,3)for TCSS Port2. + # TcssAuxOri = 0101b + # Bit0,Bit2 set to "1" indicates no retimer on USBC Ports + # Bit1,Bit3 set to "0" indicates Aux lines are not swapped on the + # motherboard to USBC connector + register "tcss_aux_ori" = "0x1" + + register "typec_aux_bias_pads[0]" = "{.pad_auxp_dc = GPP_A21, .pad_auxn_dc = GPP_A22}" + + register "usb2_ports[0]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C0 + register "usb2_ports[1]" = "USB2_PORT_MID(OC0)" # USB2_A0 + register "usb2_ports[2]" = "USB2_PORT_MID(OC1)" # USB2_A1 + register "usb2_ports[3]" = "USB2_PORT_MID(OC2)" # USB2_A2 + register "usb2_ports[4]" = "USB2_PORT_MID(OC3)" # USB2_A3 + register "usb2_ports[5]" = "USB2_PORT_MID(OC_SKIP)" # USB2_A4 + register "usb2_ports[7]" = "USB2_PORT_MID(OC_SKIP)" # Bluetooth port for PCIe WLAN + register "usb2_ports[9]" = "USB2_PORT_MID(OC_SKIP)" # Bluetooth port for CNVi WLAN + + register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB3/2 Type A port A1 + register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB3/2 Type A port A2 + register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB3/2 Type A port A3 + register "usb3_ports[3]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB3/2 Type A port A4 + + register "tcss_ports[0]" = "TCSS_PORT_DEFAULT(OC_SKIP)" # USB3_C0 + register "tcss_ports[1]" = "TCSS_PORT_DEFAULT(OC_SKIP)" # USB3/2 Type A port A0 + + register "serial_io_i2c_mode" = "{ + [PchSerialIoIndexI2C0] = PchSerialIoPci, + [PchSerialIoIndexI2C1] = PchSerialIoDisabled, + [PchSerialIoIndexI2C2] = PchSerialIoDisabled, + [PchSerialIoIndexI2C3] = PchSerialIoPci, + [PchSerialIoIndexI2C4] = PchSerialIoDisabled, + [PchSerialIoIndexI2C5] = PchSerialIoDisabled, + }" + + # Enable the Cnvi BT Audio Offload + register "cnvi_bt_audio_offload" = "1" + + # Intel Common SoC Config + #+-------------------+---------------------------+ + #| Field | Value | + #+-------------------+---------------------------+ + #| I2C0 | TPM. Early init is | + #| | required to set up a BAR | + #| | for TPM communication | + #| I2C3 | Audio | + #+-------------------+---------------------------+ + register "common_soc_config" = "{ + .i2c[0] = { + .early_init = 1, + .speed = I2C_SPEED_FAST_PLUS, + .speed_config[0] = { + .speed = I2C_SPEED_FAST_PLUS, + .scl_lcnt = 55, + .scl_hcnt = 30, + .sda_hold = 7, + } + }, + .i2c[3] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 158, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + }" + + device domain 0 on + device ref dtt on + chip drivers/intel/dptf + ## sensor information + register "options.tsr[0].desc" = ""Memory"" + register "options.tsr[1].desc" = ""Charger"" + register "options.tsr[2].desc" = ""Ambient"" + + # TODO: below values are initial reference values only + ## Passive Policy + register "policies.passive" = "{ + [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 75, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 75, 5000), + [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 75, 5000), + }" + + ## Critical Policy + register "policies.critical" = "{ + [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), + [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 85, SHUTDOWN), + }" + + register "controls.power_limits" = "{ + .pl1 = { + .min_power = 5500, + .max_power = 6000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 28 * MSECS_PER_SEC, + .granularity = 200 + }, + .pl2 = { + .min_power = 25000, + .max_power = 25000, + .time_window_min = 1, + .time_window_max = 1, + .granularity = 1000 + } + }" + + ## Charger Performance Control (Control, mA) + register "controls.charger_perf" = "{ + [0] = { 255, 1700 }, + [1] = { 24, 1500 }, + [2] = { 16, 1000 }, + [3] = { 8, 500 } + }" + + device generic 0 on end + end + end + device ref cnvi_wifi on + chip drivers/wifi/generic + register "enable_cnvi_ddr_rfim" = "true" + device generic 0 on end + end + end + device ref i2c3 on + chip drivers/i2c/generic + register "hid" = ""RTL5682"" + register "name" = ""RT58"" + register "desc" = ""Headset Codec"" + register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A23)" + # Set the jd_src to RT5668_JD1 for jack detection + register "property_count" = "1" + register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER" + register "property_list[0].name" = ""realtek,jd-src"" + register "property_list[0].integer" = "1" + device i2c 1a on end + end + end + device ref hda on + chip drivers/sof + register "jack_tplg" = "rt5682" + device generic 0 on end + end + end + device ref pcie_rp11 on + # Enable wlan PCIe 11 using clk 2 + register "pch_pcie_rp[PCH_RP(10)]" = "{ + .clk_src = 2, + .clk_req = 2, + .flags = PCIE_RP_LTR | PCIE_RP_AER, + }" + chip drivers/wifi/generic + register "wake" = "GPE0_DW1_03" + register "add_acpi_dma_property" = "true" + use usb2_port8 as bluetooth_companion + device pci 00.0 on end + end + chip soc/intel/common/block/pcie/rtd3 + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B11)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_H20)" + register "srcclk_pin" = "2" + device generic 0 on end + end + end + device ref emmc on end + device ref pch_espi on + chip ec/google/chromeec + use conn0 as mux_conn[0] + device pnp 0c09.0 on end + end + end + device ref pmc hidden + chip drivers/intel/pmc_mux + device generic 0 on + chip drivers/intel/pmc_mux/conn + use usb2_port1 as usb2_port + use tcss_usb3_port1 as usb3_port + device generic 0 alias conn0 on end + end + end + end + end + device ref tcss_xhci on + chip drivers/usb/acpi + device ref tcss_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C0"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(BACK, RIGHT, ACPI_PLD_GROUP(2, 1))" + device ref tcss_usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A0"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, RIGHT, ACPI_PLD_GROUP(1, 1))" + device ref tcss_usb3_port2 on end + end + end + end + end + device ref xhci on + chip drivers/usb/acpi + device ref xhci_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C0"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(BACK, RIGHT, ACPI_PLD_GROUP(2, 1))" + device ref usb2_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A0"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, RIGHT, ACPI_PLD_GROUP(1, 1))" + device ref usb2_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A1"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, LEFT, ACPI_PLD_GROUP(2, 3))" + device ref usb2_port3 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A2"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, CENTER, ACPI_PLD_GROUP(1, 2))" + device ref usb2_port4 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A3"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, LEFT, ACPI_PLD_GROUP(1, 3))" + device ref usb2_port5 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A4"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, CENTER, ACPI_PLD_GROUP(2, 2))" + device ref usb2_port6 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + register "reset_gpio" = + "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" + device ref usb2_port8 on end + end + chip drivers/usb/acpi + register "desc" = ""CNVI Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + register "reset_gpio" = + "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" + device ref usb2_port10 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A1"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, LEFT, ACPI_PLD_GROUP(2, 3))" + device ref usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A2"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, CENTER, ACPI_PLD_GROUP(1, 2))" + device ref usb3_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A3"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, LEFT, ACPI_PLD_GROUP(1, 3))" + device ref usb3_port3 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A4"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, CENTER, ACPI_PLD_GROUP(2, 2))" + device ref usb3_port4 on end + end + end + end + end + end end From ba3af158aa2462e261ebcf67d0d11fd56323a8d4 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Thu, 23 Jan 2025 16:48:22 -0800 Subject: [PATCH 0053/3886] libpayload: Unify selfboot() implementations selfboot() doesn't really need to be architecture dependent. All architectures are essentially doing the same thing with a normal function call, only x86_32 needs an extra attribute. arm64 and x86 also previously haven't been passing the coreboot table pointer, even though they should. This patch fixes that. Change-Id: If14040e38d968b5eea31cd6cd25efb1845a7b081 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/c/coreboot/+/86142 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- payloads/libpayload/arch/arm/Makefile.mk | 1 - payloads/libpayload/arch/arm64/Makefile.mk | 1 - payloads/libpayload/arch/arm64/selfboot.c | 34 ------------------- payloads/libpayload/arch/x86/Makefile.mk | 2 +- payloads/libpayload/arch/x86/selfboot.c | 34 ------------------- payloads/libpayload/libc/Makefile.mk | 1 + .../libpayload/{arch/arm => libc}/selfboot.c | 13 ++++--- 7 files changed, 8 insertions(+), 78 deletions(-) delete mode 100644 payloads/libpayload/arch/arm64/selfboot.c delete mode 100644 payloads/libpayload/arch/x86/selfboot.c rename payloads/libpayload/{arch/arm => libc}/selfboot.c (89%) diff --git a/payloads/libpayload/arch/arm/Makefile.mk b/payloads/libpayload/arch/arm/Makefile.mk index 47c271b993..3308135515 100644 --- a/payloads/libpayload/arch/arm/Makefile.mk +++ b/payloads/libpayload/arch/arm/Makefile.mk @@ -39,7 +39,6 @@ libc-y += timer.c coreboot.c util.S libc-y += virtual.c libc-y += exception_asm.S exception.c libc-y += cache.c cpu.S -libc-y += selfboot.c # Will fall back to default_memXXX() in libc/memory.c if GPL not allowed. libc-$(CONFIG_LP_GPL) += memcpy.S memset.S memmove.S diff --git a/payloads/libpayload/arch/arm64/Makefile.mk b/payloads/libpayload/arch/arm64/Makefile.mk index d6cc51efdf..a4fda1dfe6 100644 --- a/payloads/libpayload/arch/arm64/Makefile.mk +++ b/payloads/libpayload/arch/arm64/Makefile.mk @@ -36,7 +36,6 @@ libc-y += virtual.c libc-y += memcpy.S memset.S memmove.S libc-y += exception_asm.S exception.c libc-y += cache.c cpu.S -libc-y += selfboot.c libc-y += mmu.c libgdb-y += gdb.c diff --git a/payloads/libpayload/arch/arm64/selfboot.c b/payloads/libpayload/arch/arm64/selfboot.c deleted file mode 100644 index 5c3e4459e9..0000000000 --- a/payloads/libpayload/arch/arm64/selfboot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -void selfboot(void *entry) -{ - void (*entry_func)(void) = entry; - entry_func(); -} diff --git a/payloads/libpayload/arch/x86/Makefile.mk b/payloads/libpayload/arch/x86/Makefile.mk index 35e69cbe4d..b2aaacce44 100644 --- a/payloads/libpayload/arch/x86/Makefile.mk +++ b/payloads/libpayload/arch/x86/Makefile.mk @@ -40,7 +40,7 @@ libc-$(CONFIG_LP_ARCH_X86_64) += pt.S libc-y += main.c sysinfo.c libc-y += timer.c coreboot.c util.S libc-y += virtual.c -libc-y += selfboot.c cache.c +libc-y += cache.c libc-y += exception.c libc-y += delay.c libc-$(CONFIG_LP_ARCH_X86_32) += exec.c diff --git a/payloads/libpayload/arch/x86/selfboot.c b/payloads/libpayload/arch/x86/selfboot.c deleted file mode 100644 index 5c3e4459e9..0000000000 --- a/payloads/libpayload/arch/x86/selfboot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -void selfboot(void *entry) -{ - void (*entry_func)(void) = entry; - entry_func(); -} diff --git a/payloads/libpayload/libc/Makefile.mk b/payloads/libpayload/libc/Makefile.mk index 3d070ebe5b..063118a925 100644 --- a/payloads/libpayload/libc/Makefile.mk +++ b/payloads/libpayload/libc/Makefile.mk @@ -38,6 +38,7 @@ libc-$(CONFIG_LP_LIBC) += hexdump.c libc-$(CONFIG_LP_LIBC) += coreboot.c libc-$(CONFIG_LP_LIBC) += fmap.c libc-$(CONFIG_LP_LIBC) += fpmath.c +libc-$(CONFIG_LP_LIBC) += selfboot.c ifeq ($(CONFIG_LP_VBOOT_LIB),y) libc-$(CONFIG_LP_LIBC) += lp_vboot.c diff --git a/payloads/libpayload/arch/arm/selfboot.c b/payloads/libpayload/libc/selfboot.c similarity index 89% rename from payloads/libpayload/arch/arm/selfboot.c rename to payloads/libpayload/libc/selfboot.c index 70cc79e08f..3e226b472c 100644 --- a/payloads/libpayload/arch/arm/selfboot.c +++ b/payloads/libpayload/libc/selfboot.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 Google Inc. + * Copyright 2025 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,10 +31,9 @@ extern void *cb_header_ptr; void selfboot(void *entry) { - __asm__ __volatile__( - "mov r0, %[cb_header_ptr]\n" - "bx %[entry]\n" - :: [cb_header_ptr]"r"(cb_header_ptr), [entry]"r"(entry) - : "r0" - ); +#if CONFIG(LP_ARCH_X86_32) + __attribute__((__regparm__(0))) +#endif + void (*entry_func)(void *arg) = entry; + entry_func(cb_header_ptr); } From 8fad6b043c7e7e17af72040134c96717f4af67ea Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Tue, 11 Feb 2025 14:48:21 +0000 Subject: [PATCH 0054/3886] Update blobs submodule to upstream main Updating from commit id 14f8fcc1b426: 2024-11-28 05:07:49 +0000 - (soc/mediatek/mt8196: Update SSPM firmware to v2.0) to commit id a0726508b86d: 2025-02-06 17:31:46 +0800 - (soc/mediatek/mt8196: Update SSPM firmware to v4.0) This brings in 10 new commits: a0726508b86d soc/mediatek/mt8196: Update SSPM firmware to v4.0 efe57af33c41 soc/mediatek/mt8196: Add mtk_fsp_ramstage version v1.0 ec3eb123e329 soc/mediatek/mt8196: Update SSPM firmware to v3.0 f7428ce40d6a soc/mediatek/mt8186: Update SSPM firmware from v2.0.1 to v2.0.2 4b3be4b01f10 soc/mediatek/mt8196: Add mtk_fsp_romstage version v1.0 11da5595c96c soc/mediatek/mt8196: Add PI_IMG firmware v1.0 491c2f791901 soc/mediatek/mt8196: Update MCUPM firmware to v1.1 316468e7befd soc/mediatek/mt8196: Add GPUEB firmware v1.0 288ebf18db56 soc/mediatek/mt8196: Add SPM firmware v1.0 7130fc0c8eba soc/mediatek/mt8196: Update DRAM blob to 0.4.0 Change-Id: Ic0e99e28c9705c769042a29fbf86e44af9ba7e68 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86365 Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) --- 3rdparty/blobs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/blobs b/3rdparty/blobs index 14f8fcc1b4..a0726508b8 160000 --- a/3rdparty/blobs +++ b/3rdparty/blobs @@ -1 +1 @@ -Subproject commit 14f8fcc1b426cb0884a21a9b715da6e0c1c7f434 +Subproject commit a0726508b86dafe490ff9908274eff408298b15d From 71824342dfbbe36b908c19667f68048e6ac00193 Mon Sep 17 00:00:00 2001 From: John Su Date: Sun, 9 Feb 2025 23:41:29 +0800 Subject: [PATCH 0055/3886] mb/google/trulo/var/uldrenite: Add fw_config probe for USB-C ports Use fw_config to probe USB-C ports. BUG=b:392040004 BRANCH=firmware-trulo-15217.771.B TEST=emerge-nissa coreboot chromeos-bootimage Change-Id: Ic0161e8b85c5a2afe6ec8473497d21a5737f4f70 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86338 Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- .../google/brya/variants/uldrenite/overridetree.cb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb index 862968efd4..285db4aa96 100644 --- a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb +++ b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb @@ -7,6 +7,10 @@ fw_config option TOUCHSCREEN_UNKNOWN 0 option TOUCHSCREEN_NONE 1 end + field MB_TYPEC 7 7 + option MB_C_TWO 0 + option MB_C_ONE 1 + end end chip soc/intel/alderlake @@ -250,7 +254,9 @@ chip soc/intel/alderlake register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "use_custom_pld" = "true" register "custom_pld" = "ACPI_PLD_TYPE_C(LEFT, RIGHT, ACPI_PLD_GROUP(2, 1))" - device ref tcss_usb3_port2 on end + device ref tcss_usb3_port2 on + probe MB_TYPEC MB_C_TWO + end end end end @@ -270,7 +276,9 @@ chip soc/intel/alderlake register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "use_custom_pld" = "true" register "custom_pld" = "ACPI_PLD_TYPE_C(LEFT, LEFT, ACPI_PLD_GROUP(2, 1))" - device ref usb2_port2 on end + device ref usb2_port2 on + probe MB_TYPEC MB_C_TWO + end end chip drivers/usb/acpi register "desc" = ""USB2 Type-A Port A0 (MLB)"" From c0506ad1e09fd17f0cc5a2a7ebb457eff230f024 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Tue, 11 Feb 2025 16:07:02 +0800 Subject: [PATCH 0056/3886] soc/mediatek/mt8196: Require mtk_fsp_*.elf to exist As MT8196 won't be able to boot up without mtk_fsp_romstage.elf and mtk_fsp_ramstage.elf, ensure their presence in build time. Change-Id: I668319ae1f63818e324002e7ae4d888479edb9cf Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86355 Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/soc/mediatek/mt8196/Makefile.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/soc/mediatek/mt8196/Makefile.mk b/src/soc/mediatek/mt8196/Makefile.mk index 4dd2d2d8f9..85b670afb3 100644 --- a/src/soc/mediatek/mt8196/Makefile.mk +++ b/src/soc/mediatek/mt8196/Makefile.mk @@ -125,17 +125,13 @@ FSP_ROMSTAGE_CBFS := $(CONFIG_CBFS_PREFIX)/mtk_fsp_romstage $(FSP_ROMSTAGE_CBFS)-file := $(MT8196_BLOB_DIR)/mtk_fsp_romstage.elf $(FSP_ROMSTAGE_CBFS)-type := stage $(FSP_ROMSTAGE_CBFS)-compression := $(CBFS_PRERAM_COMPRESS_FLAG) -ifneq ($(wildcard $($(FSP_ROMSTAGE_CBFS)-file)),) cbfs-files-y += $(FSP_ROMSTAGE_CBFS) -endif FSP_RAMSTAGE_CBFS := $(CONFIG_CBFS_PREFIX)/mtk_fsp_ramstage $(FSP_RAMSTAGE_CBFS)-file := $(MT8196_BLOB_DIR)/mtk_fsp_ramstage.elf $(FSP_RAMSTAGE_CBFS)-type := stage $(FSP_RAMSTAGE_CBFS)-compression := $(CBFS_COMPRESS_FLAG) -ifneq ($(wildcard $($(FSP_RAMSTAGE_CBFS)-file)),) cbfs-files-y += $(FSP_RAMSTAGE_CBFS) -endif $(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin ./util/mtkheader/gen-bl-img.py mt8196 sf $< $@ From 5e14f1f5251b771dd17a0779475a03791750ff35 Mon Sep 17 00:00:00 2001 From: Guangjie Song Date: Mon, 13 Jan 2025 20:08:23 +0800 Subject: [PATCH 0057/3886] soc/mediatek/mt8196: Remove tvdpll3 disable/enable The tvdpll3 cannot be disabled during suspend because of the enable operation, so we remove the enable operation. Hardware can now automatically enable and disable tvdpll3 based on the clock demand of its downstream. BRANCH=rauru BUG=b:377628718 TEST=Bootup OK, Suspend/Resume OK and FW screen shown OK, with MMinfra kernel/vcp patch, mminfra can be turned off to reduce power consumption. Signed-off-by: Guangjie Song Change-Id: Ib9c72a1602c1f76dc94cca5c4a61a542a853560b Reviewed-on: https://review.coreboot.org/c/coreboot/+/86343 Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8196/pll.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/soc/mediatek/mt8196/pll.c b/src/soc/mediatek/mt8196/pll.c index 59a9b0943f..2007197003 100644 --- a/src/soc/mediatek/mt8196/pll.c +++ b/src/soc/mediatek/mt8196/pll.c @@ -1572,11 +1572,7 @@ void mt_pll_set_tvd_pll1_freq(u32 freq) { const struct pll *pll = &plls[CLK_APMIXED2_TVDPLL3]; - clrbits32(pll->reg, MT8196_PLL_EN); pll_set_rate(pll, freq); - setbits32(pll->reg, MT8196_PLL_EN); - - udelay(PLL_EN_DELAY); } void mt_pll_edp_mux_set_sel(u32 sel) From d669736841dc9813fef6780ba833d5cff6ac7605 Mon Sep 17 00:00:00 2001 From: Shunxi Zhang Date: Mon, 10 Feb 2025 16:47:28 +0800 Subject: [PATCH 0058/3886] soc/mediatek/mt8196: Fix RTC recovery by disabling external XTAL Configure PMIC register 0x50c bit0 which decides whether to use external xtal. This bit of mt6685 should be set to 1, to disable external xtal. BRANCH=rauru BUG=b:395485005 TEST=emerge-rauru coreboot chromeos-bootimage, remove battery and charger, then insert battery and charge, RTC boots normally. Signed-off-by: Shunxi Zhang Change-Id: Iea44f13af030f24c02993dd43a35a9d8b4f72179 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86353 Reviewed-by: Shunxi Zhang Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin --- src/soc/mediatek/mt8196/mt6685_rtc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/soc/mediatek/mt8196/mt6685_rtc.c b/src/soc/mediatek/mt8196/mt6685_rtc.c index 4564a3144a..4e63f10664 100644 --- a/src/soc/mediatek/mt8196/mt6685_rtc.c +++ b/src/soc/mediatek/mt8196/mt6685_rtc.c @@ -345,6 +345,10 @@ static void rtc_recovery_flow(void) { printk(BIOS_INFO, "%s: enter\n", __func__); + config_interface(SCK_TOP_XTAL_SEL_ADDR, 1, SCK_TOP_XTAL_SEL_MASK, + SCK_TOP_XTAL_SEL_SHIFT); + udelay(100); + if (!retry(RECOVERY_RETRY_COUNT, rtc_frequency_meter_check() && rtc_init_after_recovery())) { From 825ad863b5d972dd26c759309664fdaa260381d1 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 10 Feb 2025 09:56:40 +0530 Subject: [PATCH 0059/3886] mb/google/fatcat: Use TDP macros for CPU TDP values This commit replaces the hardcoded 25 values for CPU TDP with the TDP_25W macro. Change-Id: I45cf507fe5300466519aafb0b920c8ae1d62ace0 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86340 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- .../google/fatcat/variants/baseboard/fatcat/ramstage.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c b/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c index 969cd4a7c0..a808c90f00 100644 --- a/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c +++ b/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c @@ -10,7 +10,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { { .mch_id = PCI_DID_INTEL_PTL_H_ID_1, - .cpu_tdp = 25, + .cpu_tdp = TDP_25W, .power_limits_index = PTL_H_1_CORE, .pl1_min_power = 10000, .pl1_max_power = 25000, @@ -20,7 +20,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { }, { .mch_id = PCI_DID_INTEL_PTL_H_ID_2, - .cpu_tdp = 25, + .cpu_tdp = TDP_25W, .power_limits_index = PTL_H_1_CORE, .pl1_min_power = 10000, .pl1_max_power = 25000, @@ -30,7 +30,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { }, { .mch_id = PCI_DID_INTEL_PTL_H_ID_3, - .cpu_tdp = 25, + .cpu_tdp = TDP_25W, .power_limits_index = PTL_H_2_CORE, .pl1_min_power = 10000, .pl1_max_power = 25000, @@ -40,7 +40,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { }, { .mch_id = PCI_DID_INTEL_PTL_H_ID_4, - .cpu_tdp = 25, + .cpu_tdp = TDP_25W, .power_limits_index = PTL_H_2_CORE, .pl1_min_power = 10000, .pl1_max_power = 25000, From 46f38d05d6c5d6dc3314723f8aef363707197bd5 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sun, 9 Feb 2025 07:53:42 +0000 Subject: [PATCH 0060/3886] ec/google/chromeec: Implement early power off This commit implements the `google_chromeec_do_early_poweroff` function for the Chrome EC. This allows the system to power off before memory initialization by triggering an EC reset with EC_REBOOT_COLD_AP_OFF. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: Ia53469feb2a020b38a5414728159b09c86c7e32d Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86337 Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) Reviewed-by: Caveh Jalali --- src/ec/google/chromeec/ec.c | 7 +++++++ src/ec/google/chromeec/ec.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 2e8961f5f2..cc581ffb7b 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1669,3 +1670,9 @@ bool google_chromeec_is_battery_present(void) return false; } + +void google_chromeec_do_early_poweroff(void) +{ + google_chromeec_reboot(EC_REBOOT_COLD_AP_OFF, 0); + halt(); +} diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index b11b7a834a..08d4f2771d 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -471,6 +471,14 @@ bool google_chromeec_is_below_critical_threshold(void); */ bool google_chromeec_is_battery_present(void); +/* + * Performs early power off. + * + * This function handles the necessary steps to initiate an early power off + * sequence. + */ +void google_chromeec_do_early_poweroff(void); + /** * Determine if the UCSI stack is currently active. * From a89c4624bdd2f212262ef79c092ba17a918fac7c Mon Sep 17 00:00:00 2001 From: John Su Date: Tue, 11 Feb 2025 17:53:20 +0800 Subject: [PATCH 0061/3886] mb/trulo/var/uldrenite: Remove GPP_E13 from being used as RAM ID3 Remove GPP_E13 from being used as RAM ID3. Planned to be used as a strap pin to disable memory channels for x32 memory configuration. BUG=b:379311559 BRANCH=firmware-trulo-15217.771.B TEST=emerge-nissa coreboot chromeos-bootimage Change-Id: I418f84255959452d5a63612ab703ec11d81f2e33 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86362 Reviewed-by: Dtrain Hsu Reviewed-by: Subrata Banik Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/variants/uldrenite/gpio.c | 4 ++-- src/mainboard/google/brya/variants/uldrenite/memory.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/gpio.c b/src/mainboard/google/brya/variants/uldrenite/gpio.c index 4b900fbbec..13bc2169e1 100644 --- a/src/mainboard/google/brya/variants/uldrenite/gpio.c +++ b/src/mainboard/google/brya/variants/uldrenite/gpio.c @@ -184,8 +184,8 @@ static const struct pad_config gpio_table[] = { PAD_NC_LOCK(GPP_E11, NONE, LOCK_CONFIG), /* E12 : THC0_SPI1_IO1 ==> RAM_ID2 */ PAD_CFG_GPI_LOCK(GPP_E12, NONE, LOCK_CONFIG), - /* E13 : NC ==> RAM_ID3 */ - PAD_CFG_GPI_LOCK(GPP_E13, NONE, LOCK_CONFIG), + /* E13 : NC */ + PAD_NC_LOCK(GPP_E13, NONE, LOCK_CONFIG), /* E14 : DDSP_HPDA ==> EDP_HPD */ PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), /* E15 : NC */ diff --git a/src/mainboard/google/brya/variants/uldrenite/memory.c b/src/mainboard/google/brya/variants/uldrenite/memory.c index 03e97a1906..9ade7c2013 100644 --- a/src/mainboard/google/brya/variants/uldrenite/memory.c +++ b/src/mainboard/google/brya/variants/uldrenite/memory.c @@ -81,13 +81,11 @@ int variant_memory_sku(void) * GPIO_MEM_CONFIG_0 GPP_E2 * GPIO_MEM_CONFIG_1 GPP_E1 * GPIO_MEM_CONFIG_2 GPP_E12 - * GPIO_MEM_CONFIG_3 GPP_E13 */ gpio_t spd_gpios[] = { GPP_E2, GPP_E1, - GPP_E12, - GPP_E13 + GPP_E12 }; return gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios)); From b6c02d660c1293eddc88017a9ee360e55280ff9f Mon Sep 17 00:00:00 2001 From: John Su Date: Tue, 11 Feb 2025 18:13:30 +0800 Subject: [PATCH 0062/3886] mb/trulo/var/uldrenite: Support x32 memory configuration Use the GPP_E13 level to determine whether x32 memory configuration is supported. BUG=b:379311559 BRANCH=firmware-trulo-15217.771.B TEST=emerge-nissa coreboot chromeos-bootimage Change-Id: Idd3534bba0379a7bb06f8fbbeb9469e938e5a629 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86364 Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: Dtrain Hsu Reviewed-by: Subrata Banik --- src/mainboard/google/brya/Kconfig | 1 + .../google/brya/variants/uldrenite/gpio.c | 6 ++++-- .../google/brya/variants/uldrenite/memory.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 58b8922448..8d09f2e562 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -644,6 +644,7 @@ config BOARD_GOOGLE_ULDRENITE select HAVE_WWAN_POWER_SEQUENCE select DRIVERS_WWAN_FM350GL select SOC_INTEL_COMMON_BLOCK_HDA_VERB + select ENFORCE_MEM_CHANNEL_DISABLE config BOARD_GOOGLE_VELL select BOARD_GOOGLE_BASEBOARD_BRYA diff --git a/src/mainboard/google/brya/variants/uldrenite/gpio.c b/src/mainboard/google/brya/variants/uldrenite/gpio.c index 13bc2169e1..f926e3ac47 100644 --- a/src/mainboard/google/brya/variants/uldrenite/gpio.c +++ b/src/mainboard/google/brya/variants/uldrenite/gpio.c @@ -184,8 +184,8 @@ static const struct pad_config gpio_table[] = { PAD_NC_LOCK(GPP_E11, NONE, LOCK_CONFIG), /* E12 : THC0_SPI1_IO1 ==> RAM_ID2 */ PAD_CFG_GPI_LOCK(GPP_E12, NONE, LOCK_CONFIG), - /* E13 : NC */ - PAD_NC_LOCK(GPP_E13, NONE, LOCK_CONFIG), + /* E13 : NC ==> GPP_E13_STRAP */ + PAD_CFG_GPI_LOCK(GPP_E13, NONE, LOCK_CONFIG), /* E14 : DDSP_HPDA ==> EDP_HPD */ PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), /* E15 : NC */ @@ -418,6 +418,8 @@ static const struct pad_config early_gpio_table[] = { PAD_CFG_GPI_APIC(GPP_A17, NONE, PLTRST, LEVEL, INVERT), /* E3 : PROC_GP0 ==> SOC_WP_OD */ PAD_CFG_GPI_GPIO_DRIVER(GPP_E3, NONE, DEEP), + /* E13 : NC ==> GPP_E13_STRAP */ + PAD_CFG_GPI_LOCK(GPP_E13, NONE, LOCK_CONFIG), /* F12 : NC ==> WWAN_RST_L */ PAD_CFG_GPO(GPP_F12, 0, DEEP), /* F13 : NC ==> PLTRST_WWAN# */ diff --git a/src/mainboard/google/brya/variants/uldrenite/memory.c b/src/mainboard/google/brya/variants/uldrenite/memory.c index 9ade7c2013..372355a05c 100644 --- a/src/mainboard/google/brya/variants/uldrenite/memory.c +++ b/src/mainboard/google/brya/variants/uldrenite/memory.c @@ -3,6 +3,7 @@ #include #include #include +#include static const struct mb_cfg variant_memcfg = { .type = MEM_TYPE_LP5X, @@ -109,3 +110,16 @@ void variant_get_spd_info(struct mem_spd *spd_info) spd_info->topo = MEM_TOPO_MEMORY_DOWN; spd_info->cbfs_index = variant_memory_sku(); } + +uint8_t mb_get_channel_disable_mask(void) +{ + /* + * GPP_E13 High -> One RAM Chip + * GPP_E13 Low -> Two RAM Chip + */ + if (gpio_get(GPP_E13)) { + /* Disable all other channels except first two on each controller */ + return (BIT(2) | BIT(3)); + } + return 0; +} From f21969acb25b0587ded2a859c31c539fe65a12e4 Mon Sep 17 00:00:00 2001 From: Lu Tang Date: Tue, 11 Feb 2025 17:36:52 +0800 Subject: [PATCH 0063/3886] soc/mediatek/mt8196: Set MT6316 deglitch time from 2ns to 4ns To fix the SPMI-P glitch, set the mt6316 deglitch time from 2ns to 4ns. Additionally, a hardware solution of SPMI damping to 0 ohm is needed. BRANCH=rauru TEST=Build passed and booted successfully. 10 platforms have passed CPU stress tests over multiple iterations. BUG=b:386438329 Signed-off-by: Lu Tang Change-Id: I77bd50cc6c25d6dcded57d9d65d92a0dd19c3c86 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86371 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu Reviewed-by: Knox Chiou Reviewed-by: Yidi Lin --- src/soc/mediatek/common/include/soc/mt6316.h | 1 + src/soc/mediatek/common/mt6316.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/soc/mediatek/common/include/soc/mt6316.h b/src/soc/mediatek/common/include/soc/mt6316.h index 920cb34af9..ce955f94e3 100644 --- a/src/soc/mediatek/common/include/soc/mt6316.h +++ b/src/soc/mediatek/common/include/soc/mt6316.h @@ -29,6 +29,7 @@ enum { MT6316_PMIC_TEST_CON9 = 0x222, MT6316_PMIC_PLT_DIG_WPK = 0x3B1, MT6316_PMIC_PLT_DIG_WPK_H = 0x3B2, + MT6316_PMIC_SPMI_RSV1 = 0x43A, MT6316_BUCK_TOP_ELR0 = 0x1448, MT6316_BUCK_TOP_ELR1 = 0x1449, MT6316_BUCK_TOP_ELR2 = 0x144A, diff --git a/src/soc/mediatek/common/mt6316.c b/src/soc/mediatek/common/mt6316.c index 89c8c83cb0..9ed5d29c21 100644 --- a/src/soc/mediatek/common/mt6316.c +++ b/src/soc/mediatek/common/mt6316.c @@ -169,6 +169,14 @@ static void mt6316_set_all_test_con9(void) mt6316_write8(mt6316_slave_id[i], MT6316_PMIC_TEST_CON9, 0x20); } +static void mt6316_set_all_deglitch(void) +{ + /* Set deglitch time from 2ns to 4ns */ + for (int i = 0; i < ARRAY_SIZE(mt6316_slave_id); i++) + mt6316_write_field(mt6316_slave_id[i], + MT6316_PMIC_SPMI_RSV1, 0x0A, 0xFF, 0); +} + static void init_pmif_arb(void) { if (pmif_arb) @@ -196,4 +204,5 @@ void mt6316_init(void) mt6316_init_setting(); mt6316_set_all_test_con9(); + mt6316_set_all_deglitch(); } From 15df34c16d7e6e48f7038530fa24f60295baa81a Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 27 Jan 2025 17:04:14 +0100 Subject: [PATCH 0064/3886] mb/amd/birman_plus: Add SMMSTORE to FMAP Add the SMMSTORE region to the default FMAP to allow building for EDK2 as payload. TEST: Still boots on AMD/Birman+ Change-Id: I661fcc55bf30aa6f1f3cc8a57e6d0eaf2fed4621 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86177 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- src/mainboard/amd/birman_plus/board_glinda.fmd | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/amd/birman_plus/board_glinda.fmd b/src/mainboard/amd/birman_plus/board_glinda.fmd index 756709044e..17673b5156 100644 --- a/src/mainboard/amd/birman_plus/board_glinda.fmd +++ b/src/mainboard/amd/birman_plus/board_glinda.fmd @@ -3,6 +3,7 @@ FLASH@0xFF000000 16M { EC_SIG 4K FMAP 4K COREBOOT(CBFS) + SMMSTORE(PRESERVE) 256K EC_BODY@15872K 256K RW_MRC_CACHE 120K } From 03b5a4160adc9de57ea78605838e715e8287a09c Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 28 Jan 2025 09:17:24 +0100 Subject: [PATCH 0065/3886] mb/amd/birman_plus: Use actual flash size of 64 MiB instead of 16 MiB Birman+ has a 64MiB flash chip. Update the mainboards Kconfig comment and fix the FMD to generate a 64MiB ROM. Until now only the first 16MiB are being used. TEST: Still boots on AMD/Birman+ Change-Id: I72e3dcb0c3a308c3b0fd981b56cc7c1ef60095cc Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86179 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- src/mainboard/amd/birman_plus/Kconfig | 2 +- src/mainboard/amd/birman_plus/board_glinda.fmd | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mainboard/amd/birman_plus/Kconfig b/src/mainboard/amd/birman_plus/Kconfig index 02f3f23c68..9794383360 100644 --- a/src/mainboard/amd/birman_plus/Kconfig +++ b/src/mainboard/amd/birman_plus/Kconfig @@ -2,7 +2,7 @@ config BOARD_AMD_BIRMANPLUS_COMMON def_bool n - select BOARD_ROMSIZE_KB_16384 # Birman actually has a 32MiB ROM + select BOARD_ROMSIZE_KB_16384 # Birman+ actually has a 64MiB ROM select EC_ACPI select SOC_AMD_COMMON_BLOCK_USE_ESPI if !SOC_AMD_COMMON_BLOCK_SIMNOW_BUILD select DRIVERS_PCIE_RTD3_DEVICE diff --git a/src/mainboard/amd/birman_plus/board_glinda.fmd b/src/mainboard/amd/birman_plus/board_glinda.fmd index 17673b5156..b9465768be 100644 --- a/src/mainboard/amd/birman_plus/board_glinda.fmd +++ b/src/mainboard/amd/birman_plus/board_glinda.fmd @@ -1,5 +1,5 @@ -FLASH@0xFF000000 16M { - BIOS { +FLASH 64M { + BIOS 16M { EC_SIG 4K FMAP 4K COREBOOT(CBFS) From 74efa4e3968ceeeea58602e9de3d34e1df5dae1d Mon Sep 17 00:00:00 2001 From: Jarried Lin Date: Thu, 13 Feb 2025 13:32:03 +0800 Subject: [PATCH 0066/3886] mb/google/rauru: Correct GPIO name for BEEP_ON Rename GPIO_BEEP_ON_OD to GPIO_BEEP_ON to match the schematics. BRANCH=rauru TEST=Build pass BUG=b:317009620 Change-Id: Ica48ed4f4e2cd6a159203ba1f8c17ac371a08f87 Signed-off-by: Jarried Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86391 Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel --- src/mainboard/google/rauru/chromeos.c | 4 ++-- src/mainboard/google/rauru/gpio.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mainboard/google/rauru/chromeos.c b/src/mainboard/google/rauru/chromeos.c index 6a8431fc6d..b7844b7afb 100644 --- a/src/mainboard/google/rauru/chromeos.c +++ b/src/mainboard/google/rauru/chromeos.c @@ -14,7 +14,7 @@ void setup_chromeos_gpios(void) gpio_input(GPIO_SD_CD_AP_ODL); gpio_output(GPIO_AP_EC_WARM_RST_REQ, 0); gpio_output(GPIO_AP_FP_FW_UP_STRAP, 0); - gpio_output(GPIO_BEEP_ON_OD, 0); + gpio_output(GPIO_BEEP_ON, 0); gpio_output(GPIO_EN_PWR_FP, 0); gpio_output(GPIO_EN_SPKR, 0); gpio_output(GPIO_FP_RST_1V8_S3_L, 0); @@ -39,7 +39,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) struct lb_gpio nau8318_gpios[] = { {GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "speaker enable"}, - {GPIO_BEEP_ON_OD.id, ACTIVE_HIGH, -1, "beep enable"}, + {GPIO_BEEP_ON.id, ACTIVE_HIGH, -1, "beep enable"}, }; struct lb_gpio smartamp_gpios[] = { diff --git a/src/mainboard/google/rauru/gpio.h b/src/mainboard/google/rauru/gpio.h index f35135c484..fd15463a7a 100644 --- a/src/mainboard/google/rauru/gpio.h +++ b/src/mainboard/google/rauru/gpio.h @@ -5,7 +5,7 @@ #include -#define GPIO_BEEP_ON_OD GPIO(PERIPHERAL_EN1) +#define GPIO_BEEP_ON GPIO(PERIPHERAL_EN1) #define GPIO_EN_SPKR GPIO(PERIPHERAL_EN0) #define GPIO_SD_CD_AP_ODL GPIO(EINT11) #define GPIO_GSC_AP_INT_ODL GPIO(EINT18) From 93b70934bc97cae82dbbe37577c57154e2f61f4c Mon Sep 17 00:00:00 2001 From: Wenzhen Yu Date: Wed, 12 Feb 2025 17:37:44 +0800 Subject: [PATCH 0067/3886] mb/google/rauru: Notify EC that AP is in S0 GPIO_AP_SUSPEND_L is supposed to be high in S0, and low in S3. EC uses this pin to determine the AP power state. This pin should be set as early as possible in bootblock. BRANCH=rauru TEST=Build pass, reboot pass, suspend/resume pass. BUG=b:395737458 Signed-off-by: Wenzhen Yu Change-Id: I6ea56208256bb6f11fb6b0adf7627403963295bc Reviewed-on: https://review.coreboot.org/c/coreboot/+/86381 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/mainboard/google/rauru/chromeos.c | 1 + src/mainboard/google/rauru/gpio.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mainboard/google/rauru/chromeos.c b/src/mainboard/google/rauru/chromeos.c index b7844b7afb..5196fbe87a 100644 --- a/src/mainboard/google/rauru/chromeos.c +++ b/src/mainboard/google/rauru/chromeos.c @@ -19,6 +19,7 @@ void setup_chromeos_gpios(void) gpio_output(GPIO_EN_SPKR, 0); gpio_output(GPIO_FP_RST_1V8_S3_L, 0); gpio_output(GPIO_XHCI_INIT_DONE, 0); + gpio_output(GPIO_AP_SUSPEND_L, 1); } void fill_lb_gpios(struct lb_gpios *gpios) diff --git a/src/mainboard/google/rauru/gpio.h b/src/mainboard/google/rauru/gpio.h index fd15463a7a..bdbfc2b6ef 100644 --- a/src/mainboard/google/rauru/gpio.h +++ b/src/mainboard/google/rauru/gpio.h @@ -14,6 +14,7 @@ #define GPIO_AP_EC_WARM_RST_REQ GPIO(EINT29) #define GPIO_FP_RST_1V8_S3_L GPIO(EINT26) #define GPIO_AP_FP_FW_UP_STRAP GPIO(EINT27) +#define GPIO_AP_SUSPEND_L GPIO(EINT38) #define GPIO_EN_PWR_FP GPIO(PERIPHERAL_EN3) #define GPIO_BL_PWM_1V8 GPIO(DISP_PWM) From f48b4d16ca39ce24a94106cdef6abe869495b735 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Thu, 13 Feb 2025 15:50:28 +0800 Subject: [PATCH 0068/3886] mb/google/rauru: Set up open-drain ChromeOS pins Set open-drain GPIOs for ChromeOS as input and bias-disable mode. After applying this patch, the voltage of these pins will become the expected value 1.8V (previously 1.0V), preventing wrong judgement of low/high. BUG=b:396106564 TEST=emerge-rauru coreboot BRANCH=rauru Change-Id: I76c7931a56540a395eaf934125bded7fede84992 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86398 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Yidi Lin --- src/mainboard/google/rauru/chromeos.c | 32 +++++++++++++++++++++++++-- src/mainboard/google/rauru/gpio.h | 32 ++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/src/mainboard/google/rauru/chromeos.c b/src/mainboard/google/rauru/chromeos.c index 5196fbe87a..33316393ac 100644 --- a/src/mainboard/google/rauru/chromeos.c +++ b/src/mainboard/google/rauru/chromeos.c @@ -9,9 +9,37 @@ void setup_chromeos_gpios(void) { - gpio_input(GPIO_EC_AP_INT_ODL); - gpio_input(GPIO_GSC_AP_INT_ODL); + /* Set up open-drain pins */ + gpio_input(GPIO_RSVD_GPI0); + gpio_input(GPIO_EC_AP_DSI_HPD_OD); + gpio_input(GPIO_RSVD_GPI2); + gpio_input(GPIO_AP_WP_ODL); + gpio_input(GPIO_ALS_INT_SCP_ODL); + gpio_input(GPIO_LID_ACCEL_INT_SCP_L); + gpio_input(GPIO_IMU_INT_SCP_L); + gpio_input(GPIO_TCHSCR_INT_1V8_ODL); + gpio_input(GPIO_TCHPAD_INT_ODL); + gpio_input(GPIO_SPKR_INT_ODL); + gpio_input(GPIO_HP_INT_ODL); gpio_input(GPIO_SD_CD_AP_ODL); + gpio_input(GPIO_FP_AP_INT_1V8_S3_ODL); + gpio_input(GPIO_EDP_HPD_1V8); + gpio_input(GPIO_SAR_INT_ODL); + gpio_input(GPIO_RSVD_GPI15); + gpio_input(GPIO_RSVD_GPI16); + gpio_input(GPIO_RSVD_GPI17); + gpio_input(GPIO_GSC_AP_INT_ODL); + gpio_input(GPIO_EC_AP_INT_ODL); + gpio_input(GPIO_RSVD_GPI20); + gpio_input(GPIO_RSVD_GPI21); + gpio_input(GPIO_RSVD_GPI22); + gpio_input(GPIO_EC_AP_DP_HPD_OD); + gpio_input(GPIO_PCIE_SSD_WAKE_OBFF_1V8_ODL); + gpio_input(GPIO_PCIE_SSD_CLKREQ_1V8_ODL); + gpio_input(GPIO_PCIE_WLAN_WAKE_OBFF_1V2_ODL); + gpio_input(GPIO_PCIE_WLAN_CLKREQ_1V2_ODL); + + /* Set up GPIOs */ gpio_output(GPIO_AP_EC_WARM_RST_REQ, 0); gpio_output(GPIO_AP_FP_FW_UP_STRAP, 0); gpio_output(GPIO_BEEP_ON, 0); diff --git a/src/mainboard/google/rauru/gpio.h b/src/mainboard/google/rauru/gpio.h index bdbfc2b6ef..ed7ec89123 100644 --- a/src/mainboard/google/rauru/gpio.h +++ b/src/mainboard/google/rauru/gpio.h @@ -5,11 +5,37 @@ #include +#define GPIO_RSVD_GPI0 GPIO(EINT0) +#define GPIO_EC_AP_DSI_HPD_OD GPIO(EINT1) +#define GPIO_RSVD_GPI2 GPIO(EINT2) +#define GPIO_AP_WP_ODL GPIO(EINT3) +#define GPIO_ALS_INT_SCP_ODL GPIO(EINT4) +#define GPIO_LID_ACCEL_INT_SCP_L GPIO(EINT5) +#define GPIO_IMU_INT_SCP_L GPIO(EINT6) +#define GPIO_TCHSCR_INT_1V8_ODL GPIO(EINT7) +#define GPIO_TCHPAD_INT_ODL GPIO(EINT8) +#define GPIO_SPKR_INT_ODL GPIO(EINT9) +#define GPIO_HP_INT_ODL GPIO(EINT10) +#define GPIO_SD_CD_AP_ODL GPIO(EINT11) +#define GPIO_FP_AP_INT_1V8_S3_ODL GPIO(EINT12) +#define GPIO_EDP_HPD_1V8 GPIO(EINT13) +#define GPIO_SAR_INT_ODL GPIO(EINT14) +#define GPIO_RSVD_GPI15 GPIO(EINT15) +#define GPIO_RSVD_GPI16 GPIO(EINT16) +#define GPIO_RSVD_GPI17 GPIO(EINT17) +#define GPIO_GSC_AP_INT_ODL GPIO(EINT18) +#define GPIO_EC_AP_INT_ODL GPIO(EINT19) +#define GPIO_RSVD_GPI20 GPIO(EINT20) +#define GPIO_RSVD_GPI21 GPIO(EINT21) +#define GPIO_RSVD_GPI22 GPIO(EINT22) +#define GPIO_EC_AP_DP_HPD_OD GPIO(EINT32) +#define GPIO_PCIE_SSD_WAKE_OBFF_1V8_ODL GPIO(BPI_D_BUS0) +#define GPIO_PCIE_SSD_CLKREQ_1V8_ODL GPIO(BPI_D_BUS2) +#define GPIO_PCIE_WLAN_WAKE_OBFF_1V2_ODL GPIO(PCIE0_WAKEN) +#define GPIO_PCIE_WLAN_CLKREQ_1V2_ODL GPIO(PCIE0_CLKREQN) + #define GPIO_BEEP_ON GPIO(PERIPHERAL_EN1) #define GPIO_EN_SPKR GPIO(PERIPHERAL_EN0) -#define GPIO_SD_CD_AP_ODL GPIO(EINT11) -#define GPIO_GSC_AP_INT_ODL GPIO(EINT18) -#define GPIO_EC_AP_INT_ODL GPIO(EINT19) #define GPIO_XHCI_INIT_DONE GPIO(EINT28) #define GPIO_AP_EC_WARM_RST_REQ GPIO(EINT29) #define GPIO_FP_RST_1V8_S3_L GPIO(EINT26) From 7da6c68eed14fb84af2f93e3fa5dc3bef602cb82 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 6 Feb 2025 09:34:20 +0100 Subject: [PATCH 0069/3886] soc/amd/common/block/graphics: Use vbt_get() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement vbt_get() on AMD and return the VBIOS location. This allows to drop the hardcoded addresses used in various places and return an address in DRAM that is reserved for FSP use. TEST: amd/birman+ still gets passed the correct VBIOS address. Change-Id: I92d76fc4df88fbce792b9d7c912c6799617704a0 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86299 Reviewed-by: Jérémy Compostella Reviewed-by: Felix Held Tested-by: build bot (Jenkins) Reviewed-by: Ana Carolina Cabral --- src/drivers/intel/fsp2_0/silicon_init.c | 5 ++++ src/soc/amd/cezanne/fsp_s_params.c | 3 ++- src/soc/amd/common/block/graphics/graphics.c | 24 +++++++------------ .../amd/common/block/include/amdblocks/vbt.h | 22 +++++++++++++++++ src/soc/amd/glinda/fsp_s_params.c | 3 ++- src/soc/amd/mendocino/fsp_s_params.c | 3 ++- src/soc/amd/phoenix/fsp_s_params.c | 3 ++- src/soc/amd/picasso/fsp_s_params.c | 3 ++- 8 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 src/soc/amd/common/block/include/amdblocks/vbt.h diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c index 1caf00ff73..fdac9f5b85 100644 --- a/src/drivers/intel/fsp2_0/silicon_init.c +++ b/src/drivers/intel/fsp2_0/silicon_init.c @@ -14,7 +14,12 @@ #include #include #include +#if CONFIG(SOC_AMD_COMMON) +#include +#endif +#if CONFIG(SOC_INTEL_COMMON) #include +#endif #include #include #include diff --git a/src/soc/amd/cezanne/fsp_s_params.c b/src/soc/amd/cezanne/fsp_s_params.c index b9770f3ef5..391461e2f7 100644 --- a/src/soc/amd/cezanne/fsp_s_params.c +++ b/src/soc/amd/cezanne/fsp_s_params.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -13,7 +14,7 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) * part of FSP GOP init. We can delay loading of the VBIOS until * before FSP notify AFTER_PCI_ENUM. */ - scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; + scfg->vbios_buffer = (uintptr_t)vbt_get(); } void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index 77420aebaa..f80484da8f 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -12,7 +13,6 @@ #include #include #include -#include #include static bool vbios_loaded_from_cache = false; @@ -146,17 +146,11 @@ static const char *graphics_acpi_name(const struct device *dev) return "IGFX"; } -/* - * On AMD platforms the VBT is called ATOMBIOS and is always part of the - * VGA Option ROM. As part of the FSP GOP init the ATOMBIOS tables are - * updated in place. Thus the VBIOS must be loaded into RAM before FSP GOP - * runs. The address of the VBIOS must be passed to FSP-S using UPDs, but - * loading of the VBIOS can be delayed until before FSP AFTER_PCI_ENUM - * notify is called. FSP expects a pointer to the PCI option rom instead - * a pointer to the ATOMBIOS table directly. - */ void *vbt_get(void) { + if (CONFIG(RUN_FSP_GOP)) + return (void *)(uintptr_t)PCI_VGA_RAM_IMAGE_START; + return NULL; } @@ -259,12 +253,12 @@ static void write_vbios_cache_to_fmap(void *unused) } /* copy from PCI_VGA_RAM_IMAGE_START to rdev */ - if (rdev_writeat(&rw_vbios_cache, (void *)PCI_VGA_RAM_IMAGE_START, 0, + if (rdev_writeat(&rw_vbios_cache, vbt_get(), 0, VBIOS_CACHE_FMAP_SIZE) != VBIOS_CACHE_FMAP_SIZE) printk(BIOS_ERR, "Failed to save vbios data to flash; rdev_writeat() failed.\n"); - /* copy modified vbios data from PCI_VGA_RAM_IMAGE_START to buffer before hashing */ - memcpy(vbios_data, (void *)PCI_VGA_RAM_IMAGE_START, VBIOS_CACHE_FMAP_SIZE); + /* copy modified vbios data to buffer before hashing */ + memcpy(vbios_data, vbt_get(), VBIOS_CACHE_FMAP_SIZE); /* save data hash to TPM NVRAM for validation on subsequent boots */ vbios_cache_update_hash(vbios_data, VBIOS_CACHE_FMAP_SIZE); @@ -279,8 +273,8 @@ static void write_vbios_cache_to_fmap(void *unused) */ void vbios_load_from_cache(void) { - /* copy cached vbios data from buffer to PCI_VGA_RAM_IMAGE_START */ - memcpy((void *)PCI_VGA_RAM_IMAGE_START, vbios_data, VBIOS_CACHE_FMAP_SIZE); + /* copy cached vbios data from buffer to address used by FSP */ + memcpy(vbt_get(), vbios_data, VBIOS_CACHE_FMAP_SIZE); /* mark cache as used so we know not to write it later */ vbios_loaded_from_cache = true; diff --git a/src/soc/amd/common/block/include/amdblocks/vbt.h b/src/soc/amd/common/block/include/amdblocks/vbt.h new file mode 100644 index 0000000000..05fc5e3433 --- /dev/null +++ b/src/soc/amd/common/block/include/amdblocks/vbt.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _AMD_BLOCK_VBT_H_ +#define _AMD_BLOCK_VBT_H_ + +/* + * On AMD platforms the VBT is called ATOMBIOS and is always part of the + * VGA Option ROM. As part of the FSP GOP init the ATOMBIOS tables are + * updated in place. Thus the VBIOS must be loaded into RAM before FSP GOP + * runs. The address of the VBIOS must be passed to FSP-S using UPDs, but + * loading of the VBIOS can be delayed until before FSP AFTER_PCI_ENUM + * notify is called. FSP expects a pointer to the PCI Option Rom instead of + * a pointer to the ATOMBIOS table directly. + * + * Returns a pointer to the VGA Option ROM in DRAM after checking + * prerequisites for Pre OS Graphics initialization. When returning + * non NULL the Option ROM might not be loaded at this address yet, + * but is guaranteed to be present at end of BS_DEV_RESOURCES phase. + */ +void *vbt_get(void); + +#endif diff --git a/src/soc/amd/glinda/fsp_s_params.c b/src/soc/amd/glinda/fsp_s_params.c index e03795792d..980eea8367 100644 --- a/src/soc/amd/glinda/fsp_s_params.c +++ b/src/soc/amd/glinda/fsp_s_params.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,7 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) * part of FSP GOP init. We can delay loading of the VBIOS until * before FSP notify AFTER_PCI_ENUM. */ - scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; + scfg->vbios_buffer = (uintptr_t)vbt_get(); } void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) diff --git a/src/soc/amd/mendocino/fsp_s_params.c b/src/soc/amd/mendocino/fsp_s_params.c index 5c37334f5a..5393eba911 100644 --- a/src/soc/amd/mendocino/fsp_s_params.c +++ b/src/soc/amd/mendocino/fsp_s_params.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,7 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) * before FSP notify AFTER_PCI_ENUM. */ printk(BIOS_SPEW, "%s: not using VBIOS cache; running GOP driver.\n", __func__); - scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; + scfg->vbios_buffer = (uintptr_t)vbt_get(); } void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) diff --git a/src/soc/amd/phoenix/fsp_s_params.c b/src/soc/amd/phoenix/fsp_s_params.c index 883cde0f89..9ce09f807f 100644 --- a/src/soc/amd/phoenix/fsp_s_params.c +++ b/src/soc/amd/phoenix/fsp_s_params.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,7 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) * part of FSP GOP init. We can delay loading of the VBIOS until * before FSP notify AFTER_PCI_ENUM. */ - scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; + scfg->vbios_buffer = (uintptr_t)vbt_get(); } void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) diff --git a/src/soc/amd/picasso/fsp_s_params.c b/src/soc/amd/picasso/fsp_s_params.c index d4cfa276c1..fd6f81767d 100644 --- a/src/soc/amd/picasso/fsp_s_params.c +++ b/src/soc/amd/picasso/fsp_s_params.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -190,7 +191,7 @@ static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) * part of FSP GOP init. We can delay loading of the VBIOS until * before FSP notify AFTER_PCI_ENUM. */ - scfg->vbios_buffer_addr = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; + scfg->vbios_buffer_addr = (uintptr_t)vbt_get(); } void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) From 33f6375ca534747a50a6ca0f3958acbf6df50f44 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 6 Feb 2025 11:21:08 +0100 Subject: [PATCH 0070/3886] soc/amd/common/block/graphics: Support non VGA IGDs On glinda the IGD is no longer VGA compatible. It doesn't advertise itself as a VGA compatible devices and doesn't decode the legacy VGA ranges 0x3C0-0x3CF, 0x3D4. Introduce a new Kconfig and select it where necessary to keep existing behaviour on older SoC while fixing FSP GOP init on glinda. The VBIOS will get loaded into the D-segment instead the C-segment, which is typically used by VGA. TEST: FSP GOP on amd/birman+ is able to find the VBIOS. amdgpu driver still doesn't work as the VFCT table isn't generated on amd/glinda. Change-Id: I6ab28aab74f3169d45d7d852a37ddfcfc75b7c88 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86300 Reviewed-by: Felix Held Reviewed-by: Ana Carolina Cabral Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/graphics/Kconfig | 8 ++++++++ src/soc/amd/common/block/graphics/graphics.c | 9 ++++++--- src/soc/amd/glinda/Kconfig | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/soc/amd/common/block/graphics/Kconfig b/src/soc/amd/common/block/graphics/Kconfig index 3b2eaed565..b7401fbcdf 100644 --- a/src/soc/amd/common/block/graphics/Kconfig +++ b/src/soc/amd/common/block/graphics/Kconfig @@ -35,3 +35,11 @@ config SOC_AMD_COMMON_BLOCK_GRAPHICS_ACP help Select this option to provide Audio CoProcessor ACPI device for pre-Ryzen APUs for use by custom Windows drivers. + +config SOC_AMD_COMMON_BLOCK_GRAPHICS_NO_VGA + bool + depends on SOC_AMD_COMMON_BLOCK_GRAPHICS + help + Select this option when the IGD is not VGA compatible. On newer platforms the IGD + advertises itself as a Display device, but not as a VGA Display controller. + The IGD does not decode the legacy I/O ranges 0x3C0-0x3CF, 0x3D4. diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index f80484da8f..369fd85192 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -148,10 +148,13 @@ static const char *graphics_acpi_name(const struct device *dev) void *vbt_get(void) { - if (CONFIG(RUN_FSP_GOP)) - return (void *)(uintptr_t)PCI_VGA_RAM_IMAGE_START; + if (!CONFIG(RUN_FSP_GOP)) + return NULL; - return NULL; + if (CONFIG(SOC_AMD_COMMON_BLOCK_GRAPHICS_NO_VGA)) + return (void *)(uintptr_t)PCI_RAM_IMAGE_START; + + return (void *)(uintptr_t)PCI_VGA_RAM_IMAGE_START; } static void graphics_set_resources(struct device *const dev) diff --git a/src/soc/amd/glinda/Kconfig b/src/soc/amd/glinda/Kconfig index aa8c85e3e5..39fb785691 100644 --- a/src/soc/amd/glinda/Kconfig +++ b/src/soc/amd/glinda/Kconfig @@ -47,7 +47,8 @@ config SOC_AMD_GLINDA select SOC_AMD_COMMON_BLOCK_DATA_FABRIC_MULTI_PCI_SEGMENT select SOC_AMD_COMMON_BLOCK_ESPI_EXTENDED_DECODE_RANGES # TODO: Check if this is still correct select SOC_AMD_COMMON_BLOCK_GPP_CLK - select SOC_AMD_COMMON_BLOCK_GRAPHICS # TODO: Check if this is still correct + select SOC_AMD_COMMON_BLOCK_GRAPHICS + select SOC_AMD_COMMON_BLOCK_GRAPHICS_NO_VGA select SOC_AMD_COMMON_BLOCK_HAS_ESPI # TODO: Check if this is still correct select SOC_AMD_COMMON_BLOCK_HAS_ESPI_ALERT_ENABLE # TODO: Check if this is still correct select SOC_AMD_COMMON_BLOCK_I2C # TODO: Check if this is still correct From 935a423f26d390e5003ed15781d4bfbf76ce0501 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 11 Feb 2025 15:24:20 +0100 Subject: [PATCH 0071/3886] device/pci_rom: Use correct endian conversion The Option ROM contains lots of 16bit values that are being used, thus use the 16bit endianness conversion function over the 32bit variant to avoid confusion. TEST: Still works on amd/birman+. Change-Id: I571be97a930ad018e1d1316117cefe5bd1c68f9b Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86383 Reviewed-by: Felix Held Reviewed-by: Andy Ebrahiem Tested-by: build bot (Jenkins) --- src/device/pci_rom.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index d60720eb49..7e19646d52 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -93,16 +93,16 @@ struct rom_header *pci_rom_probe(const struct device *dev) printk(BIOS_SPEW, "PCI expansion ROM, signature 0x%04x, INIT size 0x%04x, data ptr 0x%04x\n", - le32_to_cpu(rom_header->signature), - rom_header->size * 512, le32_to_cpu(rom_header->data)); + le16_to_cpu(rom_header->signature), + rom_header->size * 512, le16_to_cpu(rom_header->data)); - if (le32_to_cpu(rom_header->signature) != PCI_ROM_HDR) { + if (le16_to_cpu(rom_header->signature) != PCI_ROM_HDR) { printk(BIOS_ERR, "Incorrect expansion ROM header signature %04x\n", - le32_to_cpu(rom_header->signature)); + le16_to_cpu(rom_header->signature)); return NULL; } - rom_data = (((void *)rom_header) + le32_to_cpu(rom_header->data)); + rom_data = (((void *)rom_header) + le16_to_cpu(rom_header->data)); printk(BIOS_SPEW, "PCI ROM image, vendor ID %04x, device ID %04x,\n", rom_data->vendor, rom_data->device); @@ -144,9 +144,9 @@ struct rom_header *pci_rom_load(struct device *dev, + image_size); rom_data = (struct pci_data *)((void *)rom_header - + le32_to_cpu(rom_header->data)); + + le16_to_cpu(rom_header->data)); - image_size = le32_to_cpu(rom_data->ilen) * 512; + image_size = le16_to_cpu(rom_data->ilen) * 512; } while ((rom_data->type != 0) && (rom_data->indicator != 0)); // make sure we got x86 version if (rom_data->type != 0) From 5f5aa79cca8190001f4b4ce14dd7805ad047b68f Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 11 Feb 2025 16:08:55 +0100 Subject: [PATCH 0072/3886] device/pci_rom: Move VBIOS checksum fix Move the VBIOS checksum code into the soc/amd folder, as it's specific to AMD's FSP. The code now fixes the VBIOS in place instead only fixing it for the VFCT table. TEST: VBIOS has correct checksum after loading in BS_DEV_RESOURCES. VBIOS checksum is invalid entering graphics_dev_init(). VBIOS checksum is correct leaving graphics_dev_init(). Change-Id: I63aaaefaf01ea456e2ed39cd0891e552a7fb5135 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86384 Reviewed-by: Ana Carolina Cabral Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/device/pci_rom.c | 9 --------- src/soc/amd/common/fsp/fsp_graphics.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 7e19646d52..0fe94dbb56 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -242,15 +242,6 @@ ati_rom_acpi_fill_vfct(const struct device *device, acpi_vfct_t *vfct_struct, vfct_struct->VBIOSImageOffset = (size_t)header - (size_t)vfct_struct; - /* Calculate and set checksum for VBIOS data if FSP GOP driver used, - Since GOP driver modifies ATOMBIOS tables at end of VBIOS */ - if (CONFIG(RUN_FSP_GOP)) { - /* Clear existing checksum before recalculating */ - header->VbiosContent[VFCT_VBIOS_CHECKSUM_OFFSET] = 0; - header->VbiosContent[VFCT_VBIOS_CHECKSUM_OFFSET] = - acpi_checksum(header->VbiosContent, header->ImageLength); - } - current += header->ImageLength; return current; } diff --git a/src/soc/amd/common/fsp/fsp_graphics.c b/src/soc/amd/common/fsp/fsp_graphics.c index 3e082e66ac..776711bd69 100644 --- a/src/soc/amd/common/fsp/fsp_graphics.c +++ b/src/soc/amd/common/fsp/fsp_graphics.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include #include #include #include @@ -15,4 +16,23 @@ void fsp_graphics_init(struct device *const dev) else printk(BIOS_ERR, "%s: Unable to find resource for %s\n", __func__, dev_path(dev)); + + /* + * Calculate and set checksum for VBIOS data if FSP GOP driver used, + * Since GOP driver modifies ATOMBIOS tables at end of BS_DEV_RESOURCES. + * While Linux does not verify the checksum the Windows kernel driver does. + */ + struct rom_header *vbios = (struct rom_header *)vbt_get(); + if (!vbios || !vbios->size) { + printk(BIOS_ERR, "%s: No VGA BIOS loaded for %s\n", + __func__, dev_path(dev)); + return; + } + + uint8_t *data = (uint8_t *)vbios; + + /* Clear existing checksum before recalculating */ + data[VFCT_VBIOS_CHECKSUM_OFFSET] = 0; + data[VFCT_VBIOS_CHECKSUM_OFFSET] = + acpi_checksum(data, vbios->size * 512); } From 8a0d68d8047e7f46351899c959e2015bbb7ff09f Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Mon, 23 Sep 2024 11:14:57 +0800 Subject: [PATCH 0073/3886] amdfwtool: Set entry address mode based on current table header The address field of each PSP or BIOS entry defines the location of the entry. For the family newer than Cezanne, the upper 2 bits define the address mode. In table header, the address mode of the table is set. They have the same definition. Address Mode 0: Physical Address Address Mode 1: Relative Address to entire BIOS image Address Mode 2: Relative Address to PSP/BIOS directory Address Mode 3: Relative Address to slot N In common case, the address mode of entry should be the same as its table. In spec, it says, "attribute is ignored if the directory address mode is not 2 or 3", In the old code, if the header defines address mode as relative BIOS(1), the entry address mode is not set. That meets the spec. PSP doesn't use, but amdfwtool can use it to record the address mode and transfer it to table. That can reduce the code complexity. Identidal binary test passes on platforms which are not based on Cezanne, V2000A, Genoa. Booting test passes on Majolica/Cezanne. Change-Id: I156b315d350d9e7217afc7442ca80277bb7f9095 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/84530 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- util/amdfwtool/amdfwtool.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 7f17b71361..42d13d8aa8 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -382,10 +382,15 @@ amd_bios_entry amd_bios_table[] = { #define BUFF_TO_RUN_MODE(ctx, ptr, mode) RUN_OFFSET_MODE((ctx), ((char *)(ptr) - (ctx).rom), \ (ctx).address_mode < (mode) ? (ctx).address_mode : (mode)) #define BUFF_ROOM(ctx) ((ctx).rom_size - (ctx).current) -/* Only set the address mode in entry if the table is mode 2. */ +/* AMD PSP Spec: Only set the address mode in entry if the table is mode 2 or 3. */ +/* For address mode 3, it is not be used in any SOC family yet. + For address mode 1, we can use it to store and transfer the address mode. + It can reduce the complexity. */ #define SET_ADDR_MODE(table, mode) \ - ((table)->header.additional_info_fields.address_mode == \ - AMD_ADDR_REL_TAB ? (mode) : 0) + ((table)->header.additional_info_fields.address_mode == AMD_ADDR_REL_TAB || \ + (table)->header.additional_info_fields.address_mode == AMD_ADDR_REL_BIOS || \ + (table)->header.additional_info_fields.address_mode == AMD_ADDR_REL_SLOT \ + ? (mode) : 0) #define SET_ADDR_MODE_BY_TABLE(table) \ SET_ADDR_MODE((table), (table)->header.additional_info_fields.address_mode) From 94e9663f33d00d1043d9d733d081a86da44ecec7 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Mon, 23 Sep 2024 15:52:09 +0200 Subject: [PATCH 0074/3886] mb/amd/birman_plus: Update devicetree The devicetree was still a copy of a previous mainboard. This patch updates the devicetree for the birman_plus mainboard. Birman plus is an AMD reference board. sources: - document #58168 Rev 1.01 "Birman+ User Guide" - birman+ schematic Change-Id: I1cc2e4c8f722048b24d84cf782855ae7a8d64c42 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/84500 Tested-by: build bot (Jenkins) Reviewed-by: Ana Carolina Cabral Reviewed-by: Felix Held --- src/mainboard/amd/birman_plus/Kconfig | 1 + .../amd/birman_plus/devicetree_glinda.cb | 54 ++++++++++++++----- 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/mainboard/amd/birman_plus/Kconfig b/src/mainboard/amd/birman_plus/Kconfig index 9794383360..91e39bf260 100644 --- a/src/mainboard/amd/birman_plus/Kconfig +++ b/src/mainboard/amd/birman_plus/Kconfig @@ -6,6 +6,7 @@ config BOARD_AMD_BIRMANPLUS_COMMON select EC_ACPI select SOC_AMD_COMMON_BLOCK_USE_ESPI if !SOC_AMD_COMMON_BLOCK_SIMNOW_BUILD select DRIVERS_PCIE_RTD3_DEVICE + select DRIVERS_I2C_GENERIC select MAINBOARD_HAS_CHROMEOS select PCIEXP_ASPM select PCIEXP_CLK_PM diff --git a/src/mainboard/amd/birman_plus/devicetree_glinda.cb b/src/mainboard/amd/birman_plus/devicetree_glinda.cb index 5a7fd00c2a..07642aa557 100644 --- a/src/mainboard/amd/birman_plus/devicetree_glinda.cb +++ b/src/mainboard/amd/birman_plus/devicetree_glinda.cb @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -# TODO: Update for birmanplus - chip soc/amd/glinda register "common_config.espi_config" = "{ .std_io_decode_bitmap = ESPI_DECODE_IO_0x80_EN | ESPI_DECODE_IO_0X2E_0X2F_EN | ESPI_DECODE_IO_0X60_0X64_EN, @@ -178,20 +176,40 @@ chip soc/amd/glinda .ComboPhyStaticConfig[2] = USB_COMBO_PHY_MODE_USB_C, }" - register "gpp_clk_config[0]" = "GPP_CLK_REQ" - register "gpp_clk_config[1]" = "GPP_CLK_REQ" - register "gpp_clk_config[2]" = "GPP_CLK_OFF" - register "gpp_clk_config[3]" = "GPP_CLK_REQ" + register "gpp_clk_config[0]" = "GPP_CLK_REQ" # MXM + register "gpp_clk_config[1]" = "GPP_CLK_REQ" # NVMe SSD1 + register "gpp_clk_config[2]" = "GPP_CLK_REQ" # NVMe SSD0 + register "gpp_clk_config[3]" = "GPP_CLK_REQ" # WLAN + register "gpp_clk_config[4]" = "GPP_CLK_REQ" # WWAN + register "gpp_clk_config[5]" = "GPP_CLK_REQ" # SD + register "gpp_clk_config[6]" = "GPP_CLK_REQ" # GBE device domain 0 on device ref iommu on end - device ref gpp_bridge_2_1 on end # GBE - device ref gpp_bridge_2_2 on end # WIFI - device ref gpp_bridge_2_3 on end # NVMe SSD + device ref gpp_bridge_2_1 on end # NVME SSD0 + device ref gpp_bridge_2_2 on end # SD + device ref gpp_bridge_2_3 on end # WLAN + device ref gpp_bridge_2_4 on end # GBE + device ref gpp_bridge_2_5 on end # WWAN + device ref gpp_bridge_3_1 on end # PCIe x4/x8 (ENABLE_SSD1_BIRMANPLUS) + device ref gpp_bridge_3_2 on end # NVME SSD1 (ENABLE_SSD1_BIRMANPLUS) + device ref gpp_bridge_a on # Internal GPP Bridge 0 to Bus A device ref gfx on end # Internal GPU (GFX) device ref gfx_hda on end # Display HD Audio Controller (GFXAZ) device ref crypto on end # Crypto Coprocessor + device ref xhci_1 on # USB 3.1 (USB1) + chip drivers/usb/acpi + device ref xhci_1_root_hub on + chip drivers/usb/acpi + device ref usb3_port7 on end + end + chip drivers/usb/acpi + device ref usb2_port7 on end + end + end + end + end device ref acp on end # Audio Processor (ACP) end device ref gpp_bridge_c on # Internal GPP Bridge 2 to Bus C @@ -216,9 +234,13 @@ chip soc/amd/glinda chip drivers/usb/acpi device ref usb2_port5 on end end + chip drivers/usb/acpi + device ref usb2_port6 on end + end end end end + device ref usb4_xhci_0 on chip drivers/usb/acpi device ref usb4_xhci_0_root_hub on @@ -232,7 +254,6 @@ chip soc/amd/glinda end end device ref usb4_xhci_1 on - ops xhci_pci_ops chip drivers/usb/acpi register "type" = "UPC_TYPE_HUB" device ref usb4_xhci_1_root_hub on @@ -250,8 +271,17 @@ chip soc/amd/glinda device ref i2c_0 on end device ref i2c_1 on end - device ref i2c_2 on end + device ref i2c_2 on + chip drivers/i2c/generic + register "hid" = "ACPI_DT_NAMESPACE_HID" + register "desc" = ""TMP420 3 channel temperature sensor"" + register "uid" = "1" + register "compat_string" = ""ti,tmp432"" + device i2c 4d on end + end + end device ref i2c_3 on end device ref uart_0 on end # UART0 - + device ref uart_2 on end # UART2 + device ref uart_4 on end # UART4 end From 6d61022b8f5517ae1f17ff10d858f4f3c6f1700c Mon Sep 17 00:00:00 2001 From: Kenneth Chan Date: Thu, 13 Feb 2025 15:34:06 +0800 Subject: [PATCH 0075/3886] mb/google/rex/var/kanix: Update LAN clock request setting According to the EVT's circuit(kanix_250116.pdf) change, update LAN clock request to GPP_C11. BUG=b:386025819 BRANCH=firmware-rex-15709.B TEST=emerge-rex coreboot chromeos-bootimage; test LAN function on kanix Change-Id: I5d27585717897203d6ac81ca47551be5771918c3 Signed-off-by: Kenneth Chan Reviewed-on: https://review.coreboot.org/c/coreboot/+/86397 Reviewed-by: Subrata Banik Reviewed-by: Ren Kuo Tested-by: build bot (Jenkins) --- src/mainboard/google/rex/variants/kanix/gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/rex/variants/kanix/gpio.c b/src/mainboard/google/rex/variants/kanix/gpio.c index 401a0834ca..4b757a1ae5 100644 --- a/src/mainboard/google/rex/variants/kanix/gpio.c +++ b/src/mainboard/google/rex/variants/kanix/gpio.c @@ -117,8 +117,8 @@ static const struct pad_config gpio_table[] = { PAD_NC(GPP_C09, NONE), /* GPP_C10 : net NC is not present in the given design */ PAD_NC(GPP_C10, NONE), - /* GPP_C11 : Not Connected */ - PAD_NC(GPP_C11, NONE), + /* GPP_C11 : [] ==> LAN_CLKREQ_ODL */ + PAD_CFG_NF(GPP_C11, NONE, DEEP, NF1), /* GPP_C12 : NC pad. */ PAD_NC(GPP_C12, NONE), /* GPP_C13 : Not connected */ @@ -174,8 +174,8 @@ static const struct pad_config gpio_table[] = { PAD_CFG_NF(GPP_D16, NONE, DEEP, NF2), /* GPP_D17 : [] ==> I2S_SOC_RX_HP_TX */ PAD_CFG_NF(GPP_D17, NONE, DEEP, NF2), - /* GPP_D18 : [] ==> LAN_CLKREQ_ODL */ - PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), + /* GPP_D18 : Not Connected */ + PAD_NC(GPP_D18, NONE), /* GPP_D19 : [] ==> EC_SOC_REC_SWITCH_ODL */ PAD_CFG_GPI_LOCK(GPP_D19, NONE, LOCK_CONFIG), /* GPP_D20 : [] ==> SSD_CLKREQ_ODL */ From d6eff7060a58d7317518d4f9f201ec639940b61a Mon Sep 17 00:00:00 2001 From: David Wu Date: Thu, 13 Feb 2025 14:04:41 +0800 Subject: [PATCH 0076/3886] mb/google/nissa/var/craask: Modify eMMC DLL tuning value Craask cannot boot into OS from 2nd source eMMC. Update eMMC DLL tuning value to improve initialization reliability BUG=b:375497774 TEST=Cold reboot stress test over 2500 cycles Change-Id: I415beb84ac09f8c3e80c3df12bc323a06baf812d Signed-off-by: David Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86395 Reviewed-by: Simon Yang Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/variants/craask/overridetree.cb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/variants/craask/overridetree.cb b/src/mainboard/google/brya/variants/craask/overridetree.cb index 069deb33db..ee8a63dd18 100644 --- a/src/mainboard/google/brya/variants/craask/overridetree.cb +++ b/src/mainboard/google/brya/variants/craask/overridetree.cb @@ -70,7 +70,7 @@ chip soc/intel/alderlake # [22:16] steps of delay for DDR50, each 125ps, range: 0 - 78. # [14:8] steps of delay for SDR25/HS50, each 125ps, range: 0 - 119. # [6:0] steps of delay for SDR12, each 125ps, range: 0 - 119. - register "common_soc_config.emmc_dll.emmc_rx_cmd_data_cntl1" = "0x1C1B4F3C" + register "common_soc_config.emmc_dll.emmc_rx_cmd_data_cntl1" = "0x1C1B4F1B" # EMMC RX CMD/DATA Delay 2 # Refer to EDS-Vol2-42.3.12. From b7d144a41c0721f457c1ad88ea2ad860a7b34e84 Mon Sep 17 00:00:00 2001 From: Nicholas Sudsgaard Date: Fri, 28 Jun 2024 12:50:25 +0000 Subject: [PATCH 0077/3886] Documentation/mainboard/lenovo: Add ThinkCentre M710s Change-Id: I90311257a28bd463712c4d43f8b83baa745509cc Signed-off-by: Nicholas Sudsgaard Reviewed-on: https://review.coreboot.org/c/coreboot/+/80411 Reviewed-by: Matt DeVillier Reviewed-by: Alicja Michalska Tested-by: build bot (Jenkins) --- Documentation/mainboard/index.md | 1 + .../mainboard/lenovo/thinkcentre_m710s.md | 81 ++++++++++++++++++ .../lenovo/thinkcentre_m710s_spi_location.jpg | Bin 0 -> 84413 bytes 3 files changed, 82 insertions(+) create mode 100644 Documentation/mainboard/lenovo/thinkcentre_m710s.md create mode 100644 Documentation/mainboard/lenovo/thinkcentre_m710s_spi_location.jpg diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md index f9f904877b..518c02a994 100644 --- a/Documentation/mainboard/index.md +++ b/Documentation/mainboard/index.md @@ -184,6 +184,7 @@ mAL-10 Mainboard codenames Hardware Maintenance Manual of ThinkPads R60 +ThinkCentre M710s T4xx common X2xx common M920 Tiny diff --git a/Documentation/mainboard/lenovo/thinkcentre_m710s.md b/Documentation/mainboard/lenovo/thinkcentre_m710s.md new file mode 100644 index 0000000000..0f9adffba8 --- /dev/null +++ b/Documentation/mainboard/lenovo/thinkcentre_m710s.md @@ -0,0 +1,81 @@ +# Lenovo ThinkCentre M710s + +This page provides technical documentation on [Lenovo ThinkCentre M710s]. + +## Flash chip + +```{eval-rst} ++----------+-------------+ +| Type | Value | ++==========+=============+ +| Socketed | yes | ++----------+-------------+ +| Model | W25Q64JV-.Q | ++----------+-------------+ +| Size | 8MiB | ++----------+-------------+ +| Package | SOIC-8 | ++----------+-------------+ +``` + +The flash chip is divided into the following regions. + + 00000000:00000fff fd + 00200000:007fffff bios + 00003000:001fffff me + 00001000:00002fff gbe + +## Flashing + +The flash chip cannot be flashed internally when running vendor firmware, and must +be flashed externally using a programmer of your choice. + +Steps on how to open the chassis and get access to the mainboard are described +in the [hardware maintenance manual]. Follow the steps shown from +"[Removing the computer cover]" until step 1 of "[Replacing the storage drive]". + +The SPI flash should be easy to identify and the location is shown in the image +below. See the [datasheet] and [flashing firmware tutorial] for more information. + +![](thinkcentre_m710s_spi_location.jpg) + +## Status + +### Working + * Ubuntu 22.04.1 (Linux 6.5.0) using payloads: + * SeaBIOS + * MrChromebox's EDK 2 fork + * Tianocore's EDK 2 + * Internal flashing (from coreboot) + * PEG (PCIe Graphics) + * PCIe + * SATA + * M.2 SSD + * M.2 WLAN (+ Bluetooth) + * LAN + * USB + * Memory card reader + * CPU fan + * VGA + * Display ports + * Audio (output) + * COM1 + * TPM + +### Not working + * Super I/O not well supported (there may be some minor issues) + * Power button LED + * ME cleaner + +### Untested + * Audio (input) + * COM2 header + * LPT header + * PS/2 keyboard and mouse + +[Lenovo ThinkCentre M710s]: https://www.lenovo.com/us/en/p/desktops/thinkcentre/m-series-sff/thinkcentre-m710s/11tc1md710s +[hardware maintenance manual]: https://download.lenovo.com/pccbbs/thinkcentre_pdf/m710s_ug_hmm_en.pdf +[Removing the computer cover]: https://download.lenovo.com/pccbbs/thinkcentre_pdf/m710s_ug_hmm_en.pdf#page=28 +[Replacing the storage drive]: https://download.lenovo.com/pccbbs/thinkcentre_pdf/m710s_ug_hmm_en.pdf#page=31 +[datasheet]: https://www.winbond.com/hq/product/code-storage-flash-memory/serial-nor-flash/?__locale=en&partNo=W25Q64JV +[flashing firmware tutorial]: ../../tutorial/flashing_firmware/index.md diff --git a/Documentation/mainboard/lenovo/thinkcentre_m710s_spi_location.jpg b/Documentation/mainboard/lenovo/thinkcentre_m710s_spi_location.jpg new file mode 100644 index 0000000000000000000000000000000000000000..024c5b7c0a50c243ccbcf3bb2f63b382422aa847 GIT binary patch literal 84413 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

FDd)tQG5f5ISe*iS@b0#0vM1>1cB$#GU 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 literal 0 HcmV?d00001 From c63a1988847aafa3ee2a38fb166b00777269aaa0 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 24 Apr 2024 21:23:57 +0300 Subject: [PATCH 0078/3886] drivers/qemu/bochs: Use arch-independent data port The QEMU Bochs display driver uses 0x1CF as its VBE DISPI data port, but this is only present on x86. Instead, use the port at 0x1D0 [1] which is available on both x86 and non-x86 architectures. The data port is also calculated inline based on the VBE DISPI index port while reading and writing, update those expressions as well. [1] https://web.archive.org/web/20240404032816/https://www.qemu.org/docs/master/specs/standard-vga.html#io-ports-used Change-Id: I899beb742d42c26f3e57023f05ff459094fce5f1 Signed-off-by: Alper Nebi Yasak Reviewed-on: https://review.coreboot.org/c/coreboot/+/82061 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- src/drivers/emulation/qemu/bochs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/emulation/qemu/bochs.c b/src/drivers/emulation/qemu/bochs.c index 2e0526fa8f..70d17cb716 100644 --- a/src/drivers/emulation/qemu/bochs.c +++ b/src/drivers/emulation/qemu/bochs.c @@ -14,7 +14,7 @@ /* VGA init. We use the Bochs VESA VBE extensions */ #define VBE_DISPI_IOPORT_INDEX 0x01CE -#define VBE_DISPI_IOPORT_DATA 0x01CF +#define VBE_DISPI_IOPORT_DATA 0x01D0 #define VBE_DISPI_INDEX_ID 0x0 #define VBE_DISPI_INDEX_XRES 0x1 @@ -46,7 +46,7 @@ static void bochs_write(struct resource *res, int index, int val) { if (res->flags & IORESOURCE_IO) { outw(index, res->base); - outw(val, res->base + 1); + outw(val, res->base + 2); } else { write16(res2mmio(res, 0x500 + index * 2, 0), val); } @@ -56,7 +56,7 @@ static int bochs_read(struct resource *res, int index) { if (res->flags & IORESOURCE_IO) { outw(index, res->base); - return inw(res->base + 1); + return inw(res->base + 2); } else { return read16(res2mmio(res, 0x500 + index * 2, 0)); } From a132aba3995d2d47732afc9cb34961a3f96e65a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20B=C3=BCchler?= Date: Sun, 7 Jan 2024 12:39:53 +0100 Subject: [PATCH 0079/3886] board_status/getrevision.sh: Ignore non-annotated tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Local tags (e.g. to keep track of builds) should not be used to describe a board status report. This has happened in some cases, e.g. [1]. According to the Git 2.41.0 manual for git-describe, the '--tagged' parameter is a way to also use any "lightweight (non-annotated) tag" in addition to annotated tags, which are always used even without this parameter. All coreboot release tags seem to be annotated, so this option should be safe to drop. [1] https://review.coreboot.org/plugins/gitiles/board-status/+/b8c47429bad5afc5cd7f798cad3dece9790a1f83 Signed-off-by: Michael Büchler Change-Id: I54b302415e569a3385559cc85323ce34462042ad Reviewed-on: https://review.coreboot.org/c/coreboot/+/79837 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- util/board_status/getrevision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/board_status/getrevision.sh b/util/board_status/getrevision.sh index ced20fc451..a982f8d815 100755 --- a/util/board_status/getrevision.sh +++ b/util/board_status/getrevision.sh @@ -112,7 +112,7 @@ tagged_revision() { local r if git_is_file_tracked "$1" ; then - r=$(git describe --tags --dirty) + r=$(git describe --dirty) else return ${EXIT_FAILURE} fi From a614e3c50f706af1e897cf20440e48de144148bb Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Fri, 2 Jul 2021 07:34:54 +0200 Subject: [PATCH 0080/3886] Documentation: Improve x86_64 * Move x86_64 documentation to dedicated page * Update with better description of current implementation * Update TODOs Change-Id: Ia5ba51be629a8c878aad64d3297176457cf8e855 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/79160 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- Documentation/arch/x86/index.md | 88 +------------------------ Documentation/arch/x86/x86_64.md | 109 +++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 87 deletions(-) create mode 100644 Documentation/arch/x86/x86_64.md diff --git a/Documentation/arch/x86/index.md b/Documentation/arch/x86/index.md index f2597ac9ce..1c5edb32ab 100644 --- a/Documentation/arch/x86/index.md +++ b/Documentation/arch/x86/index.md @@ -6,91 +6,5 @@ This section contains documentation about coreboot on x86 architecture. :maxdepth: 1 x86 PAE support +x86_64 support ``` - -## State of x86_64 support -Some SOCs now support 64bit mode. Search for HAVE_X86_64_SUPPORT in Kconfig. - -In order to add support for x86_64 the following assumptions were made: -* The CPU supports long mode -* All memory returned by malloc must be below 4GiB in physical memory -* All code that is to be run must be below 4GiB in physical memory -* The high dword of pointers is always zero -* The reference implementation is qemu -* x86 payloads are loaded below 4GiB in physical memory and are jumped - to in *protected mode* - -## Assumptions for all stages using the reference implementation -* 0-4GiB are identity mapped using 2MiB-pages as WB -* Memory above 4GiB isn't accessible -* page tables reside in memory mapped ROM -* A stage can install new page tables in RAM - -## Page tables -A `pagetables` cbfs file is generated based on an assembly file. - -To generate the static page tables it must know the physical address where to -place the file. - -The page tables contains the following structure: -* PML4E pointing to PDPE -* PDPE with *$n* entries each pointing to PDE -* *$n* PDEs with 512 entries each - -At the moment *$n* is 4, which results in identity mapping the lower 4 GiB. - -## Basic x86_64 support -Basic support for x86_64 has been implemented for QEMU mainboard target. - -## Reference implementation -The reference implementation is -```{toctree} -:maxdepth: 1 - -QEMU i440fx <../../mainboard/emulation/qemu-i440fx.md> -QEMU Q35 <../../mainboard/emulation/qemu-q35.md> -``` - -## TODO -* Identity map memory above 4GiB in ramstage - -## Future work - -1. Fine grained page tables for SMM: - * Must not have execute and write permissions for the same page. - * Must allow only that TSEG pages can be marked executable -2. Support 64bit PCI BARs above 4GiB -3. Place and run code above 4GiB - -## Porting other boards -* Fix compilation errors -* Test how well CAR works with x86_64 and paging -* Improve mode switches - -## Known problems on real hardware - -Running VGA rom directly fails. Yabel works fine though. - -## Known bugs on KVM enabled qemu - -The `x86_64` reference code runs fine in qemu soft-cpu, but has serious issues -when using KVM mode on some machines. The workaround is to *not* place -page-tables in ROM, as done in -[CB:49228](https://review.coreboot.org/c/coreboot/+/49228). - -Here's a list of known issues: - -* After entering long mode, the FPU doesn't work anymore, including accessing - MMX registers. It works fine before entering long mode. It works fine when - switching back to protected mode. Other registers, like SSE registers, are - working fine. -* Reading from virtual memory, when the page tables are stored in ROM, causes - the MMU to abort the "page table walking" mechanism when the lower address - bits of the virtual address to be translated have a specific pattern. - Instead of loading the correct physical page, the one containing the - page tables in ROM will be loaded and used, which breaks code and data as - the page table doesn't contain the expected data. This in turn leads to - undefined behaviour whenever the 'wrong' address is being read. -* Disabling paging in compatibility mode crashes the CPU. -* Returning from long mode to compatibility mode crashes the CPU. -* Entering long mode crashes on AMD host platforms. diff --git a/Documentation/arch/x86/x86_64.md b/Documentation/arch/x86/x86_64.md new file mode 100644 index 0000000000..b9aebd013c --- /dev/null +++ b/Documentation/arch/x86/x86_64.md @@ -0,0 +1,109 @@ +# x86_64 architecture documentation + +This section documents coreboot's x86_64 support. When enabled, +every coreboot stage is built for x86_64, contrary to UEFI's implementation +that only runs some stages in x86_64. +On UEFI the PEI phase, which is x86_32, brings up DRAM and installs +page tables for the x86_64 DXE and BDS phases. + +## Toolchain requirements for x86_64 support +* The compiler must support generating code for the *large memory model* + (-mcmodel=large). It's supported since GCC 4.4. + + Page tables can be used to provide security benefits, such as by marking + memory as non-executable or removing it entirely. This could be useful + for SMM to mark regular DRAM as NX. + + The large memory model causes the compiler to emit 64bit addressing + instructions, which increases code size. In theory, this is roughly + made up for by the faster execution of the x86_64 code. + +* All x86 coreboot stages and payloads must be loaded below 4GiB in + physical memory. When jumping to the payload coreboot will drop from + long mode back to protected mode to keep compatibility with these payloads. + +## Comparison to UEFI +On UEFI the SEC and PEI phases (similar to coreboot's bootblock and romstage) +are run in x86_32 mode. The following (guessed) reasons are likely: +* There's no need for x86_64 as memory hasn't been trained yet. The whole 4GiB + address space, including CAR, memory mapped SPI flash and PCI BARs, are + accessible in x86_32. +* When the EFI specification was written compilers did not support + *large memory model*, required in CAR when using a 1:1 page mapping +* Code is 20% bigger in x86_64 due to *large memory model* where pointers and + function calls always use 8 byte addressing. However flash size was very + limited, compared to today's flash chips, when the EFI spec was written. + +## Current software constraints for x86_64 support +The following constraints are coreboot limitations as it was intended to run in +protected mode only. The code still assumes 32bit pointers in some places and thus: +* The high dword of pointers must always be zero. +* All memory returned by malloc must be below 4GiB in physical memory. +* All code that is to be run must be below 4GiB in physical memory. +* CBMEM must reside below 4GiB in physical memory. + +Any software within coreboot must not access memory resources above 4GiB until +end of BS_DEV_RESOURCES in ramstage. Only at that point the full memory map is +known and identity mapped. + +## Supported boards +On the supported boards you can enable x86_64 compilation by setting the +Kconfig `USE_X86_64_SUPPORT`. This config option is enabled if the SOC/CPU +selects `HAVE_X86_64_SUPPORT`. + +## Protected mode wrappers +On some platforms binary blobs are run to initialize parts of the hardware. +When these binary blobs have been compiled for x86_32, then coreboot must +switch to protected mode in order to call and run the blobs. Once the invoked +blobs finish running, coreboot needs to switch back to long mode. + +Since every BLOB is different a SoC must be enabled to support x86_64 mode +by providing the correct wrapper around the x86_32 BLOBs. + +## TODO +* Support more platforms +* Fix running VGA Option ROMs +* Fix running MRC.bin (Sandy Bridge / Haswell boards) +* Identity map memory above 4GiB in ramstage +* Fine grained page tables for SMM: + * Must not have execute and write permissions for the same page. + * Must only allow TSEG pages to be marked as executable. + * Must reside in SMRAM. + * Must be placed together with SMM rmodule. +* Support 64bit PCI BARs above 4GiB +* Jump to compatible payloads in long mode + +## Porting other boards +* Fix compilation errors +* Test how well CAR works with x86_64 and paging +* Improve mode switches +* Test libgfxinit / VGA Option ROMs / FSP + +## Known bugs on real hardware + +According to Intel x86_64 mode hasn't been validated in CAR environments. +However, coreboot developers working on x86_64 support have tried this on +various Intel platforms, and so far haven't found any issues with CAR when +running in x86_64 mode. + +## Known bugs on KVM enabled QEMU + +The `x86_64` reference code runs fine in QEMU's soft-cpu, but has serious issues +when using KVM mode on some machines. This is due to various mechanisms trying +to accelerate the code execution. + +Known issues in QEMU: +* After entering long mode, the FPU doesn't work anymore, including accessing + MMX registers. It works fine before entering long mode. It works fine when + switching back to protected mode. Other registers, like SSE registers, are + working fine. +* Reading from virtual memory, when the page tables are stored in ROM, causes + the MMU to abort the "page table walking" mechanism when the lower address + bits of the virtual address to be translated have a specific pattern. + Instead of loading the correct physical page, the one containing the + page tables in ROM will be loaded and used, which breaks code and data as + the page table doesn't contain the expected data. This in turn leads to + undefined behaviour whenever the 'wrong' address is being read. +* Disabling paging in compatibility mode crashes the CPU. +* Returning from long mode to compatibility mode crashes the CPU. +* Entering long mode crashes on AMD host platforms. From 7073ec43b0d82e0713260cb2952cfb70786ca1c5 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Fri, 9 Aug 2024 13:45:57 +0200 Subject: [PATCH 0081/3886] arch/riscv: Add common FDT build Currently all platforms on RISC-V require a FDT. The inclusion of the FDT is currently done in the platform Makefiles. In order to factor out some common code this patch adds the inclusion in the architecture Makefile. The FDT must be aligned to 8 byte according to device tree spec. It avoids misaligned access. Signed-off-by: Maximilian Brune Change-Id: I3b304a89646fe84c98e9f199f315bebb156de16c Reviewed-on: https://review.coreboot.org/c/coreboot/+/83848 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/arch/riscv/Kconfig | 15 +++++++++++++++ src/arch/riscv/Makefile.mk | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig index b7fc0cab01..8fa7854ea2 100644 --- a/src/arch/riscv/Kconfig +++ b/src/arch/riscv/Kconfig @@ -144,4 +144,19 @@ config RISCV_GET_HART_COUNT_AT_RUNTIME SOC/Mainboards select this option in case the number of harts is not known at build time. In this case the SOC must have a scheme in place to discover all harts. +config RISCV_DTS + bool + default n + help + This option is selected by mainboards that include a devicetree + source file (not to be confused with the coreboot devicetree.cb files). + The devicetree will be preprocessed and compiled into a FDT (flattened devicetree). + Said FDT will be put into a CBFS file for use in runtime. + +config RISCV_DTS_FILE + string + depends on RISCV_DTS + help + Path to the devicetree source file in .dts format. + endif # if ARCH_RISCV diff --git a/src/arch/riscv/Makefile.mk b/src/arch/riscv/Makefile.mk index bda392adb4..3efd8959cc 100644 --- a/src/arch/riscv/Makefile.mk +++ b/src/arch/riscv/Makefile.mk @@ -67,6 +67,29 @@ all-y += \ $(top)/src/lib/memset.c all-$(CONFIG_RISCV_USE_ARCH_TIMER) += arch_timer.c +## FDT (Flattened Devicetree) inclusion + +ifeq ($(CONFIG_RISCV_DTS),y) + +# at some point dtc may be compiled by our toolchain +DTC ?= dtc +CPPFLAGS_dts += -nostdinc -P -x assembler-with-cpp -I src/arch/riscv/include + +$(obj)/preprocessed.dts: $(call strip_quotes, $(CONFIG_RISCV_DTS_FILE)) + $(CPP_riscv) $(CPPFLAGS_dts) -o $@ $< + +$(obj)/dtb: $(obj)/preprocessed.dts + $(DTC) -I dts -O dtb -o $@ $< + +# This may be optimized in the future by letting cbfstool parse our FDT into a unflattened +# devicetree blob in build time, so that we only need to flatten it in runtime instead of +# unflatten and flatten it in runtime. +cbfs-files-y += DTB +DTB-file := $(obj)/dtb +DTB-type := raw +DTB-align := 8 # according to spec device trees needs to be 8 byte aligned + +endif # CONFIG_RISCV_DTS ################################################################################ ## bootblock From 94d4707649718687e2a59e6ecc6361ba6a64587b Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Fri, 9 Aug 2024 13:50:50 +0200 Subject: [PATCH 0082/3886] util/riscv: Add starfive Image building tool Add the tooling necessary to build an Image that can be found and started by ROM code of the JH7110 SOC. source: https://github.com/starfive-tech/Tools Signed-off-by: Maximilian Brune Change-Id: Iab16c1e1f15f24e85c0ef1a3e838d024e1e49286 Reviewed-on: https://review.coreboot.org/c/coreboot/+/83849 Reviewed-by: Matt DeVillier Reviewed-by: Alicja Michalska Tested-by: build bot (Jenkins) --- util/lint/lint-extended-015-final-newlines | 3 +- util/lint/lint-stable-009-old-licenses | 1 + .../riscv/starfive-jh7110-spl-tool/.gitignore | 10 + util/riscv/starfive-jh7110-spl-tool/LICENSE | 365 ++++++++++++++++++ util/riscv/starfive-jh7110-spl-tool/Makefile | 16 + util/riscv/starfive-jh7110-spl-tool/README.md | 54 +++ util/riscv/starfive-jh7110-spl-tool/crc32.c | 35 ++ .../riscv/starfive-jh7110-spl-tool/spl_tool.c | 244 ++++++++++++ 8 files changed, 727 insertions(+), 1 deletion(-) create mode 100644 util/riscv/starfive-jh7110-spl-tool/.gitignore create mode 100644 util/riscv/starfive-jh7110-spl-tool/LICENSE create mode 100644 util/riscv/starfive-jh7110-spl-tool/Makefile create mode 100644 util/riscv/starfive-jh7110-spl-tool/README.md create mode 100644 util/riscv/starfive-jh7110-spl-tool/crc32.c create mode 100644 util/riscv/starfive-jh7110-spl-tool/spl_tool.c diff --git a/util/lint/lint-extended-015-final-newlines b/util/lint/lint-extended-015-final-newlines index 18ca75b7e6..7324213034 100755 --- a/util/lint/lint-extended-015-final-newlines +++ b/util/lint/lint-extended-015-final-newlines @@ -24,7 +24,8 @@ build/\|\ \.git/\|\ coreboot-builds/\|\ util/nvidia/cbootimage/\|\ -^util/goswid/vendor" +^util/goswid/vendor\|\ +^util/riscv/starfive-jh7110-spl-tool" EXCLUDED_FILES='\.gif$\|\.jpg$\|\.cksum$\|\.bin$\|\.vbt$\|\.hex$\|\.ico$\|\.o$\|\.bz2$\|\.xz$\|^.tmpconfig\|\.pyc$\|_shipped$\|sha256$\|\.png$\|\.patch$\|\.apcb$' HAVE_FILE=$(command -v file 1>/dev/null 2>&1; echo $?) diff --git a/util/lint/lint-stable-009-old-licenses b/util/lint/lint-stable-009-old-licenses index 45c01c73a6..202a1a9b5e 100755 --- a/util/lint/lint-stable-009-old-licenses +++ b/util/lint/lint-stable-009-old-licenses @@ -31,6 +31,7 @@ _shipped$|\ ^util/lint/lint-000-license-headers|\ ^util/lint/lint-stable-009-old-licenses|\ ^util/nvidia/cbootimage|\ +^util/riscv/starfive-jh7110-spl-tool|\ ^3rdparty|\ __pycache__|\ ^payloads/external\ diff --git a/util/riscv/starfive-jh7110-spl-tool/.gitignore b/util/riscv/starfive-jh7110-spl-tool/.gitignore new file mode 100644 index 0000000000..26c88884ee --- /dev/null +++ b/util/riscv/starfive-jh7110-spl-tool/.gitignore @@ -0,0 +1,10 @@ +_* +*.swp +*.o +*.out +*.key +*.diff +*.patch +*.out +tags +spl_tool diff --git a/util/riscv/starfive-jh7110-spl-tool/LICENSE b/util/riscv/starfive-jh7110-spl-tool/LICENSE new file mode 100644 index 0000000000..36cc8c3b75 --- /dev/null +++ b/util/riscv/starfive-jh7110-spl-tool/LICENSE @@ -0,0 +1,365 @@ +================================================================ + * Copyright 2018-2023 Shanghai StarFive Technology Co., Ltd. +================================================================ + +spl_tool license: + +Valid-License-Identifier: GPL-2.0 +Valid-License-Identifier: GPL-2.0-only +Valid-License-Identifier: GPL-2.0+ +Valid-License-Identifier: GPL-2.0-or-later +SPDX-URL: https://spdx.org/licenses/GPL-2.0.html +Usage-Guide: + To use this license in source code, put one of the following SPDX + tag/value pairs into a comment according to the placement + guidelines in the licensing rules documentation. + For 'GNU General Public License (GPL) version 2 only' use: + SPDX-License-Identifier: GPL-2.0 + or + SPDX-License-Identifier: GPL-2.0-only + For 'GNU General Public License (GPL) version 2 or any later version' use: + SPDX-License-Identifier: GPL-2.0+ + or + SPDX-License-Identifier: GPL-2.0-or-later +License-Text: + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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; either version 2 of the License, or + (at your option) any later version. + + 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/util/riscv/starfive-jh7110-spl-tool/Makefile b/util/riscv/starfive-jh7110-spl-tool/Makefile new file mode 100644 index 0000000000..c6b4d9b8c0 --- /dev/null +++ b/util/riscv/starfive-jh7110-spl-tool/Makefile @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0+ +override CFLAGS=-Wall -Wno-unused-result -Wno-format-truncation -O2 + +SRCS = $(wildcard *.c) +OBJS = $(SRCS:.c=.o) + +all: spl_tool + +%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< + +spl_tool: $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ + +clean: + rm -f *.o spl_tool diff --git a/util/riscv/starfive-jh7110-spl-tool/README.md b/util/riscv/starfive-jh7110-spl-tool/README.md new file mode 100644 index 0000000000..e9f61e7dda --- /dev/null +++ b/util/riscv/starfive-jh7110-spl-tool/README.md @@ -0,0 +1,54 @@ +## DESCRIPTION + +spl_tool is a jh7110 signature tool used to generate spl header information and generate u-boot-spl.bin.normal.out. + +spl_tool can also fix the issue of emmc booting. + +## Prerequisites + +Install required additional packages: + +```bash +$ sudo apt-get install gcc make git +``` + +## Build + +just run `make` + +```bash +$ make +``` + +## Run + +usage + +```bash +$ ./spl_tool -h + + StarFive spl tool + +usage: +-c, --creat-splhdr creat spl hdr +-i, --fix-imghdr fixed img hdr for emmc boot. +-a, --spl-bak-addr set backup SPL addr(default: 0x200000) +-v, --version set version (default: 0x01010101) +-f, --file input file name(spl/img) +-h, --help show this information +``` + +Generate uboot-spl.bin.normal.out + +```bash +$./spl_tool -c -f $(Uboot_PATH)/spl/u-boot-spl.bin +ubsplhdr.sofs:0x240, ubsplhdr.bofs:0x200000, ubsplhdr.vers:0x1010101 name:$(Uboot_PATH)/spl/u-boot-spl.bin +SPL written to $(Uboot_PATH)/spl/u-boot-spl.bin.normal.out successfully. +``` + +Fix the emmc boot issue + +```bash +$ ./spl_tool -i -f sdcard.img +IMG sdcard.img fixed hdr successfully. +``` \ No newline at end of file diff --git a/util/riscv/starfive-jh7110-spl-tool/crc32.c b/util/riscv/starfive-jh7110-spl-tool/crc32.c new file mode 100644 index 0000000000..1394f97c9f --- /dev/null +++ b/util/riscv/starfive-jh7110-spl-tool/crc32.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include + +static uint32_t crc32_reverse(uint32_t x) +{ + x = ((x & 0x55555555) << 1) | ((x >> 1) & 0x55555555); + x = ((x & 0x33333333) << 2) | ((x >> 2) & 0x33333333); + x = ((x & 0x0F0F0F0F) << 4) | ((x >> 4) & 0x0F0F0F0F); + x = (x << 24) | ((x & 0xFF00) << 8) | ((x >> 8) & 0xFF00) | (x >> 24); + return x; +} + +uint32_t crc32(uint32_t iv, uint32_t sv, const void *data, size_t n) +{ + const unsigned char *ptr; + unsigned x; + uint32_t byte, crc; + + crc = iv; + ptr = data; + while (n--) { + byte = *ptr++; + byte = crc32_reverse(byte); + for (x = 0; x < 8; x++, byte <<= 1) crc = ((crc ^ byte) & 0x80000000U) ? (crc << 1) ^ sv : (crc << 1); + } + + return crc; +} + +uint32_t crc32_final(uint32_t iv) +{ + return crc32_reverse(iv ^ ~0U); +} diff --git a/util/riscv/starfive-jh7110-spl-tool/spl_tool.c b/util/riscv/starfive-jh7110-spl-tool/spl_tool.c new file mode 100644 index 0000000000..039e520dea --- /dev/null +++ b/util/riscv/starfive-jh7110-spl-tool/spl_tool.c @@ -0,0 +1,244 @@ +// SPDX-License-Identifier: GPL-2.0+ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NOSIZE ((size_t)-1) + +extern uint32_t crc32(uint32_t iv, uint32_t sv, const void *data, size_t n); +extern uint32_t crc32_final(uint32_t iv); + +/* all uint32_t ends up little endian in output header */ +struct __attribute__((__packed__)) ubootsplhdr { + uint32_t sofs; /* offset of spl header: 64+256+256 = 0x240 */ + uint32_t bofs; /* SBL_BAK_OFFSET: Offset of backup SBL from Flash info start (from input_sbl_normal.cfg) */ + uint8_t zro2[636]; + uint32_t vers; /* version: shall be 0x01010101 + * (from https://doc-en.rvspace.org/VisionFive2/SWTRM/VisionFive2_SW_TRM/create_spl.html) */ + uint32_t fsiz; /* u-boot-spl.bin size in bytes */ + uint32_t res1; /* Offset from HDR to SPL_IMAGE, 0x400 (00 04 00 00) currently */ + uint32_t crcs; /* CRC32 of u-boot-spl.bin */ + uint8_t zro3[364]; +}; + +struct hdr_conf_t { + const char name[PATH_MAX]; + uint32_t vers; + uint32_t bofs; + bool creat_hdr_flag; + bool fixed_img_hdr_flag; +}; + +static struct ubootsplhdr ubsplhdr; +static struct ubootsplhdr imghdr; +static struct hdr_conf_t g_hdr_conf; + +static char ubootspl[181072-sizeof(struct ubootsplhdr)+1]; +static char outpath[PATH_MAX]; + +#define DEFVERSID 0x01010101 +#define DEFBACKUP 0x200000U +#define CRCFAILED 0x5A5A5A5A + +static void xerror(int errnoval, const char *s) +{ + if (errnoval) perror(s); + else fprintf(stderr, "%s\n", s); + exit(2); +} + +static void usage(void) +{ + const char help[] = { + "\n StarFive spl tool\n\n" + "usage:\n" + "-c, --creat-splhdr creat spl hdr\n" + "-i, --fix-imghdr fixed img hdr for emmc boot.\n" + "-a, --spl-bak-addr set backup SPL addr(default: 0x200000)\n" + "-v, --version set version (default: 0x01010101)\n" + "-f, --file input file name(spl/img)\n" + "-h, --help show this information\n" + }; + puts(help); +} + +static int parse_args(int argc, char **argv) +{ + uint32_t v; + + enum { + OPTION_CREAD_HDR = 1, + OPTION_FIXED_HDR, + OPTION_SBL_BAK_OFFSET, + OPTION_VERSION, + OPTION_FILENAME, + OPTION_HELP, + }; + + static struct option long_options[] = + { + {"creat-splhdr" , no_argument, NULL, OPTION_CREAD_HDR}, + {"fix-imghdr" , no_argument, NULL, OPTION_FIXED_HDR}, + {"spl-bak-addr" , required_argument, NULL, OPTION_SBL_BAK_OFFSET}, + {"version", required_argument, NULL, OPTION_VERSION}, + {"file", required_argument, NULL, OPTION_FILENAME}, + {"help", no_argument, NULL, OPTION_HELP}, + {0, 0, 0, 0} + }; + + while (1) + { + /* getopt_long stores the option index here. */ + int option_index = 0; + + int c = getopt_long(argc, argv, "cio:v:f:h", long_options, &option_index); + + /* Detect the end of the options. */ + if (c == -1) + break; + + switch (c) { + case 0: + /* If this option set a flag, do nothing else now. */ + if (long_options[option_index].flag != 0) + break; + + case 'c': + case OPTION_CREAD_HDR: + g_hdr_conf.creat_hdr_flag = true; + g_hdr_conf.fixed_img_hdr_flag = false; + break; + + case 'i': + case OPTION_FIXED_HDR: + g_hdr_conf.fixed_img_hdr_flag = true; + g_hdr_conf.creat_hdr_flag = false; + break; + + case 'a': + case OPTION_SBL_BAK_OFFSET: + v = (uint32_t)strtoul(optarg, NULL, 16); + v = htole32(v); + g_hdr_conf.bofs = v; + break; + + case 'v': + case OPTION_VERSION: + v = (uint32_t)strtoul(optarg, NULL, 16); + v = htole32(v); + g_hdr_conf.vers = v; + break; + + case 'f': + case OPTION_FILENAME: + strcpy((char*)g_hdr_conf.name, optarg); + break; + + case 'h': + case OPTION_HELP: + usage(); + break; + + default: + usage(); + break; + } + } + return 0; +} + +int spl_creat_hdr(struct hdr_conf_t *conf) +{ + int fd; + uint32_t v; + size_t sz; + + if (!conf->creat_hdr_flag) + return 0; + + ubsplhdr.sofs = htole32(0x240U); + ubsplhdr.res1 = htole32(0x400U); + ubsplhdr.bofs = conf->bofs ? conf->bofs : htole32(DEFBACKUP); + ubsplhdr.vers = conf->vers ? conf->vers : htole32(DEFVERSID); + + printf("ubsplhdr.sofs:%#x, ubsplhdr.bofs:%#x, ubsplhdr.vers:%#x name:%s\n", + ubsplhdr.sofs, ubsplhdr.bofs, ubsplhdr.vers, conf->name); + + fd = open(conf->name, O_RDONLY); + if (fd == -1) xerror(errno, conf->name); + + sz = (size_t)read(fd, ubootspl, sizeof(ubootspl)); + if (sz == NOSIZE) xerror(errno, conf->name); + if (sz >= (sizeof(ubootspl))) + xerror(0, "File too large! Please rebuild your SPL with -Os. Maximum allowed size is 180048 bytes."); + v = htole32((uint32_t)sz); + ubsplhdr.fsiz = v; + + close(fd); + snprintf(outpath, sizeof(outpath), "%s.normal.out", conf->name); + fd = creat(outpath, 0666); + if (fd == -1) xerror(errno, outpath); + + v = crc32(~0U, 0x04c11db7U, ubootspl, sz); + v = crc32_final(v); + v = htole32(v); + ubsplhdr.crcs = v; + + write(fd, &ubsplhdr, sizeof(struct ubootsplhdr)); + write(fd, ubootspl, sz); + + close(fd); + + printf("SPL written to %s successfully.\n", outpath); + + return 0; +} + +int img_fixed_hdr(struct hdr_conf_t *conf) +{ + int fd; + size_t sz; + + if (!conf->fixed_img_hdr_flag) + return 0; + + fd = open(conf->name, O_RDWR); + if (fd == -1) xerror(errno, conf->name); + + sz = (size_t)read(fd, &imghdr, sizeof(imghdr)); + if (sz == NOSIZE) xerror(errno, conf->name); + + /* When starting with emmc, bootrom will read 0x0 instead of partition 0. (Known issues). + Read GPT PMBR+Header, then write the backup address at 0x4, and write the wrong CRC + check value at 0x290, so that bootrom CRC check fails and jump to the backup address + to load the real spl. */ + + imghdr.bofs = conf->bofs ? conf->bofs : htole32(DEFBACKUP); + imghdr.crcs = htole32(CRCFAILED); + + lseek(fd, 0x0, SEEK_SET); + write(fd, &imghdr, sizeof(imghdr)); + close(fd); + + printf("IMG %s fixed hdr successfully.\n", conf->name); + + return 0; +} + +int main(int argc, char **argv) +{ + parse_args(argc, argv); + spl_creat_hdr(&g_hdr_conf); + img_fixed_hdr(&g_hdr_conf); +} From 7c31377bf9e1fe7cffecf0e8c08bf7ab03a0e887 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Sun, 29 Sep 2024 13:27:33 +0200 Subject: [PATCH 0083/3886] util/lint/lint-000-license-headers: Add license This adds the "GPL-2.0 OR MIT" license combination. It is used in subsequent patches that adds source files originally from the linux kernel. OR operator: https://web.archive.org/web/20240730192545/https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/#d42-disjunctive-or-operator Signed-off-by: Maximilian Brune Change-Id: I07c508aa6134b063801de36199af9a312a7d6bed Reviewed-on: https://review.coreboot.org/c/coreboot/+/84584 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Alicja Michalska --- util/lint/lint-000-license-headers | 1 + 1 file changed, 1 insertion(+) diff --git a/util/lint/lint-000-license-headers b/util/lint/lint-000-license-headers index 44657d27c9..bff8bb48d0 100755 --- a/util/lint/lint-000-license-headers +++ b/util/lint/lint-000-license-headers @@ -121,6 +121,7 @@ check_for_license 'HPND-sell-variant' check_for_license 'ISC' check_for_license 'MIT' check_for_license 'X11' +check_for_license 'GPL-2.0 OR MIT' # This is 4 clause ("with advertising") but the University of Berkeley # declared that 4th clause void, see From 4e8943801b4a4ceed376070387fb90066eabc29d Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Mon, 13 Jan 2025 18:00:15 +0100 Subject: [PATCH 0084/3886] payloads/external/Makefile.mk: Update linuxboot warning Only print the warning if Linuxboot payload is actually selected, because we don't care otherwise. Signed-off-by: Maximilian Brune Change-Id: I5008d685c52c1d4e0d7eba44c964c51a2a6f99c3 Reviewed-on: https://review.coreboot.org/c/coreboot/+/85957 Reviewed-by: Ana Carolina Cabral Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Alicja Michalska --- payloads/external/Makefile.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/payloads/external/Makefile.mk b/payloads/external/Makefile.mk index 299f1eee0b..c279121493 100644 --- a/payloads/external/Makefile.mk +++ b/payloads/external/Makefile.mk @@ -396,7 +396,10 @@ ifeq ($(CONFIG_LINUXBOOT_CROSS_COMPILE_PATH),"") CONFIG_LINUXBOOT_CROSS_COMPILE_PATH=$(CROSS_COMPILE_$(LINUXBOOT_CROSS_COMPILE_ARCH-y)) endif # CONFIG_LINUXBOOT_CROSS_COMPILE_PATH else # CONFIG_LINUXBOOT_CROSS_COMPILE +ifeq ($(CONFIG_PAYLOAD_LINUXBOOT),y) + # only print warning when Linuxboot payload is actually selected $(warning "Using host toolchain to build Linuxboot") +endif # CONFIG_PAYLOAD_LINUXBOOT endif # CONFIG_LINUXBOOT_CROSS_COMPILE .PHONY: linuxboot payloads/external/LinuxBoot/build/Image payloads/external/LinuxBoot/build/initramfs linuxboot: From 4ab0e333ad88151815190f97d0f789bbb0b8fd7f Mon Sep 17 00:00:00 2001 From: Ivy Jian Date: Tue, 11 Feb 2025 15:59:25 +0800 Subject: [PATCH 0085/3886] mb/google/nissa/var/dirks: Update GPIO table Configure buzzer to GPP_D2 based on schematic change. BUG=b:389391653 TEST=emerge-nissa coreboot Change-Id: Iefc6aefeae0a3a05ba04fb2718c6c3a3058de5f8 Signed-off-by: Ivy Jian Reviewed-on: https://review.coreboot.org/c/coreboot/+/86351 Reviewed-by: Eric Lai Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/variants/dirks/gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/dirks/gpio.c b/src/mainboard/google/brya/variants/dirks/gpio.c index 94eaff5691..209ca047dc 100644 --- a/src/mainboard/google/brya/variants/dirks/gpio.c +++ b/src/mainboard/google/brya/variants/dirks/gpio.c @@ -19,8 +19,6 @@ static const struct pad_config override_gpio_table[] = { /* B4 : LAN_PERST_L */ PAD_CFG_GPO(GPP_B4, 1, PLTRST), - /* B14 : SPKR ==> PWM_PP3300_BUZZER */ - PAD_CFG_GPO_LOCK(GPP_B14, 0, LOCK_CONFIG), /* B16 : I2C5_SDA ==> NC */ PAD_NC(GPP_B16, NONE), /* B17 : I2C5_SCL ==> NC */ @@ -37,6 +35,8 @@ static const struct pad_config override_gpio_table[] = { /* C7 : SML1DATA ==> NC */ PAD_NC(GPP_C7, NONE), + /* D2 : PWM_PP3300_BUZZER */ + PAD_CFG_GPO(GPP_D2, 0, DEEP), /* D3 : ISH_GP3 ==> NC */ PAD_NC(GPP_D3, NONE), /* D6 : SRCCLKREQ1# ==> NC */ From c60991870ec167483b566b78f2163c00df18b63c Mon Sep 17 00:00:00 2001 From: Ivy Jian Date: Tue, 11 Feb 2025 15:53:29 +0800 Subject: [PATCH 0086/3886] mb/google/nissa/var/dirks: Use a separate ec.h for dirks Dirks are chromebox, so they need different settings in ec.h. Add a new dirks baseboard ec.h and use it for dirks.Remove everything related to: - Lid - Battery - Built-in keyboard - AC connect/disconnect - Mode changes BUG=b:389391653 TEST=emerge-nissa coreboot Change-Id: I8089a2aff3032a4271212765f65881a09f42c1ae Signed-off-by: Ivy Jian Reviewed-on: https://review.coreboot.org/c/coreboot/+/86354 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- .../nissa/include/baseboard/dirks/ec.h | 44 +++++++++++++++++++ .../brya/variants/dirks/include/variant/ec.h | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/mainboard/google/brya/variants/baseboard/nissa/include/baseboard/dirks/ec.h diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/include/baseboard/dirks/ec.h b/src/mainboard/google/brya/variants/baseboard/nissa/include/baseboard/dirks/ec.h new file mode 100644 index 0000000000..d9697d7c3c --- /dev/null +++ b/src/mainboard/google/brya/variants/baseboard/nissa/include/baseboard/dirks/ec.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __BASEBOARD_EC_H__ +#define __BASEBOARD_EC_H__ + +#include +#include +#include + +#define MAINBOARD_EC_SCI_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_MKBP) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX)) +#define MAINBOARD_EC_SMI_EVENTS 0 +/* EC can wake from S5 with power button */ +#define MAINBOARD_EC_S5_WAKE_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON)) +/* EC can wake from S3 with power button */ +#define MAINBOARD_EC_S3_WAKE_EVENTS (MAINBOARD_EC_S5_WAKE_EVENTS) +#define MAINBOARD_EC_S0IX_WAKE_EVENTS \ + (MAINBOARD_EC_S3_WAKE_EVENTS |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_HANG_DETECT)) +/* Log EC wake events plus EC shutdown events */ +#define MAINBOARD_EC_LOG_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_PANIC)) +/* + * ACPI related definitions for ASL code. + */ +/* Enable cros_ec_keyb device */ +#define EC_ENABLE_MKBP_DEVICE +#define EC_ENABLE_WAKE_PIN GPE_EC_WAKE +/* Enable EC backed PD MCU device in ACPI */ +#define EC_ENABLE_PD_MCU_DEVICE +#define SIO_EC_MEMMAP_ENABLE /* EC Memory Map Resources */ +#define SIO_EC_HOST_ENABLE /* EC Host Interface Resources */ + +#define EC_ENABLE_SYNC_IRQ /* Enable tight timestamp support */ + +#endif /* __BASEBOARD_EC_H__ */ diff --git a/src/mainboard/google/brya/variants/dirks/include/variant/ec.h b/src/mainboard/google/brya/variants/dirks/include/variant/ec.h index 7a2a6ff8b7..469e75c834 100644 --- a/src/mainboard/google/brya/variants/dirks/include/variant/ec.h +++ b/src/mainboard/google/brya/variants/dirks/include/variant/ec.h @@ -3,6 +3,6 @@ #ifndef __VARIANT_EC_H__ #define __VARIANT_EC_H__ -#include +#include #endif From fc9a192d3433eba1e8b191b0f2b1795cc9123fad Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Sat, 4 Jan 2025 22:19:01 +0100 Subject: [PATCH 0087/3886] mb/emulation/spike-riscv/uart.c: Update UART address Spike Simulator commit 191634d2854d implemented a ns16550 serial device which puts the base address at 0x10000000. Tested: Start Spike Simulator and see that coreboot prints onto the UART. Signed-off-by: Maximilian Brune Change-Id: I0e3db9d8b141c733bf609f906018096e3594ce83 Reviewed-on: https://review.coreboot.org/c/coreboot/+/85852 Reviewed-by: Nicholas Chin Tested-by: build bot (Jenkins) --- src/mainboard/emulation/spike-riscv/uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/emulation/spike-riscv/uart.c b/src/mainboard/emulation/spike-riscv/uart.c index 4ea2466878..e93594c560 100644 --- a/src/mainboard/emulation/spike-riscv/uart.c +++ b/src/mainboard/emulation/spike-riscv/uart.c @@ -5,5 +5,5 @@ uintptr_t uart_platform_base(unsigned int idx) { - return (uintptr_t)0x02100000; + return (uintptr_t)0x10000000; } From ff353fe88de03c9b22d2bf3aa01fae00ac06090c Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 13 Feb 2025 10:09:32 +0530 Subject: [PATCH 0088/3886] mb/google/fatcat: Increase PL4 power limits for PTL-H variants Increase PL4 power limit values for all Intel PTL-H variants on Fatcat from 50000 to 65000 to ensure successful boot and adequate performance with 45W and 65W USB-C adapters. This prevents system bottlenecks when using lower-wattage power supplies. BUG=b:395130929 TEST=Verified successful boot with 45W and 65W USB-C travel adapters, as well as 96W/106W USB-C adapters. Change-Id: I6073e748e9f8c7317f0ad9a1193699e34703bdba Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86388 Reviewed-by: Eric Lai Reviewed-by: Caveh Jalali Tested-by: build bot (Jenkins) --- .../google/fatcat/variants/baseboard/fatcat/ramstage.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c b/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c index a808c90f00..030b587579 100644 --- a/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c +++ b/src/mainboard/google/fatcat/variants/baseboard/fatcat/ramstage.c @@ -16,7 +16,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { .pl1_max_power = 25000, .pl2_min_power = 50000, .pl2_max_power = 50000, - .pl4_power = 50000 /* TODO: needs fine tuning */ + .pl4_power = 65000 }, { .mch_id = PCI_DID_INTEL_PTL_H_ID_2, @@ -26,7 +26,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { .pl1_max_power = 25000, .pl2_min_power = 50000, .pl2_max_power = 50000, - .pl4_power = 50000 /* TODO: needs fine tuning */ + .pl4_power = 65000 }, { .mch_id = PCI_DID_INTEL_PTL_H_ID_3, @@ -36,7 +36,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { .pl1_max_power = 25000, .pl2_min_power = 50000, .pl2_max_power = 50000, - .pl4_power = 50000 /* TODO: needs fine tuning */ + .pl4_power = 65000 }, { .mch_id = PCI_DID_INTEL_PTL_H_ID_4, @@ -46,7 +46,7 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = { .pl1_max_power = 25000, .pl2_min_power = 50000, .pl2_max_power = 50000, - .pl4_power = 50000 /* TODO: needs fine tuning */ + .pl4_power = 65000 }, }; From 121ab8e2013f448419ec5192e73b9036a922b692 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 5 Feb 2025 09:32:28 +0000 Subject: [PATCH 0089/3886] lib: Refactor ux_locales_get_text API This patch refactors the `ux_locales_get_text` API to handle fallback text (English) internally, rather than relying on the caller. It introduces message IDs for lookups, enabling the API to locate both the UX locale name and fallback text based on the ID. With this patch, `ux_locales_get_text` API locates UX locales message based on message ID. `ux_locales_get_text` retrieves fallback text message depending upon the message ID if UX locales is not available. This centralizes fallback handling and simplifies adding future messages without per-SoC duplication. BUG=b:339673254 TEST=Built and booted google/brox. Verified eSOL display. Change-Id: I4952802396265b9ee8d164d6e43a7f2b3599d6c0 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86283 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner --- src/include/ux_locales.h | 9 +- src/lib/ux_locales.c | 37 ++++++-- src/soc/intel/alderlake/romstage/ux.c | 10 +- .../intel/meteorlake/romstage/fsp_params.c | 9 +- tests/lib/ux_locales-test.c | 95 +++++++++---------- 5 files changed, 85 insertions(+), 75 deletions(-) diff --git a/src/include/ux_locales.h b/src/include/ux_locales.h index 1affd925d1..e8710839b0 100644 --- a/src/include/ux_locales.h +++ b/src/include/ux_locales.h @@ -5,14 +5,19 @@ #include +enum ux_locale_msg { + UX_LOCALE_MSG_MEMORY_TRAINING, + UX_LOCALE_MSG_NUM, +}; + /* Unmap the preram_locales if it has been mapped. No-op otherwise. */ void ux_locales_unmap(void); /* - * Get the localized text for a given string name. + * Get the localized text for a given message ID as per `enum ux_locale_msg`. * This function will try to read the language ID from vboot API, and search the * corresponding translation from CBFS preram_locales. */ -const char *ux_locales_get_text(const char *name); +const char *ux_locales_get_text(enum ux_locale_msg msg_id); #endif // _UX_LOCALES_H_ diff --git a/src/lib/ux_locales.c b/src/lib/ux_locales.c index b389548955..b9f153772e 100644 --- a/src/lib/ux_locales.c +++ b/src/lib/ux_locales.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include @@ -20,6 +21,18 @@ #define DELIM_STR 0x00 #define DELIM_NAME 0x01 +/* Mapping of different default UX local message based on message ID */ +static const struct { + const char *ux_locale_name; + const char *ux_locale_fallback_text; +} ux_locale_msg_list[] = { + [UX_LOCALE_MSG_MEMORY_TRAINING] = { + "memory_training_desc", + "Your device is finishing an update. This may take 1-2 minutes.\n" + "Please do not turn off your device." + }, +}; + /* * Devices which support early vga have the capability to show localized text in * Code Page 437 encoding. (see src/drivers/pc80/vga/vga_font_8x16.c) @@ -113,18 +126,28 @@ static size_t search_for_id(const char *data, size_t offset, size_t size, return search_for(data, offset, size, int_to_str, DELIM_STR); } -const char *ux_locales_get_text(const char *name) +const char *ux_locales_get_text(enum ux_locale_msg msg_id) { const char *data; size_t size, offset, name_offset, next_name_offset, next; uint32_t lang_id = 0; /* default language English (0) */ unsigned char version; + const char *name; + const char *fallback_text; + + if (msg_id >= UX_LOCALE_MSG_NUM) { + printk(BIOS_ERR, "%s: Unknown message id = %d.\n", __func__, msg_id); + return "Trying to display an unknown message?"; + } + + name = ux_locale_msg_list[msg_id].ux_locale_name; + fallback_text = ux_locale_msg_list[msg_id].ux_locale_fallback_text; data = locales_get_map(&size, false); if (!data || size == 0) { printk(BIOS_ERR, "%s: %s not found.\n", __func__, PRERAM_LOCALES_NAME); - return NULL; + return fallback_text; } if (CONFIG(VBOOT)) { @@ -146,14 +169,14 @@ const char *ux_locales_get_text(const char *name) if (version != PRERAM_LOCALES_VERSION_BYTE) { printk(BIOS_ERR, "%s: The version %u is not the expected one %u\n", __func__, version, PRERAM_LOCALES_VERSION_BYTE); - return NULL; + return fallback_text; } /* Search for name. Skip the version byte. */ offset = search_for_name(data, 1, size, name); if (offset >= size) { printk(BIOS_ERR, "%s: Name %s not found.\n", __func__, name); - return NULL; + return fallback_text; } name_offset = offset; @@ -171,21 +194,21 @@ const char *ux_locales_get_text(const char *name) offset = search_for_id(data, name_offset, next_name_offset, 0); if (offset >= next_name_offset) { printk(BIOS_ERR, "%s: Neither %d nor 0 found.\n", __func__, lang_id); - return NULL; + return fallback_text; } } /* Move to the corresponding localized_string. */ offset = move_next(data, offset, next_name_offset, DELIM_STR); if (offset >= next_name_offset) - return NULL; + return fallback_text; /* Validity check that the returned string must be NULL terminated. */ next = move_next(data, offset, next_name_offset, DELIM_STR) - 1; if (next >= next_name_offset || data[next] != '\0') { printk(BIOS_ERR, "%s: %s is not NULL terminated.\n", __func__, PRERAM_LOCALES_NAME); - return NULL; + return fallback_text; } return data + offset; diff --git a/src/soc/intel/alderlake/romstage/ux.c b/src/soc/intel/alderlake/romstage/ux.c index 0fb73c188d..d0961c51ec 100644 --- a/src/soc/intel/alderlake/romstage/ux.c +++ b/src/soc/intel/alderlake/romstage/ux.c @@ -8,8 +8,6 @@ #include "ux.h" -#define UX_MEMORY_TRAINING_DESC "memory_training_desc" - bool ux_inform_user_of_update_operation(const char *name) { timestamp_add_now(TS_ESOL_START); @@ -22,12 +20,8 @@ bool ux_inform_user_of_update_operation(const char *name) printk(BIOS_INFO, "Informing user on-display of %s.\n", name); - const char *text = ux_locales_get_text(UX_MEMORY_TRAINING_DESC); - /* No localized text found; fallback to built-in English. */ - if (!text) - text = "Your device is finishing an update. " - "This may take 1-2 minutes.\n" - "Please do not turn off your device."; + const char *text = ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); + vga_write_text(VGA_TEXT_CENTER, VGA_TEXT_HORIZONTAL_MIDDLE, (const unsigned char *)text); ux_locales_unmap(); diff --git a/src/soc/intel/meteorlake/romstage/fsp_params.c b/src/soc/intel/meteorlake/romstage/fsp_params.c index 82706ed3bf..dd9d2b54c6 100644 --- a/src/soc/intel/meteorlake/romstage/fsp_params.c +++ b/src/soc/intel/meteorlake/romstage/fsp_params.c @@ -436,8 +436,6 @@ static void soc_memory_init_params(FSP_M_CONFIG *m_cfg, fill_fspm_params[i](m_cfg, config); } -#define UX_MEMORY_TRAINING_DESC "memory_training_desc" - #define VGA_INIT_CONTROL_ENABLE BIT(0) /* Tear down legacy VGA mode before exiting FSP-M. */ #define VGA_INIT_CONTROL_TEAR_DOWN BIT(1) @@ -465,12 +463,7 @@ static void fill_fspm_sign_of_life(FSP_M_CONFIG *m_cfg, if (!vga_init_control) return; - const char *text = ux_locales_get_text(UX_MEMORY_TRAINING_DESC); - /* No localized text found; fallback to built-in English. */ - if (!text) - text = "Your device is finishing an update. " - "This may take 1-2 minutes.\n" - "Please do not turn off your device."; + const char *text = ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); vbt = cbfs_map("vbt.bin", &vbt_size); if (!vbt) { diff --git a/tests/lib/ux_locales-test.c b/tests/lib/ux_locales-test.c index 5fe18e773c..63f2f56318 100644 --- a/tests/lib/ux_locales-test.c +++ b/tests/lib/ux_locales-test.c @@ -7,22 +7,14 @@ #include #include -#define DATA_DEFAULT \ - ( \ - "\x01" /* Version. */ \ - "name_1\x00" /* name_1, langs = [0, 2, 30]. */ \ - "0\x00translation_1_0\x00" \ - "2\x00translation_1_2\x00" \ - "30\x00translation_1_30\x00" \ - "\x01" \ - "name_15\x00" /* name_15, langs = [4, 25, 60]. */ \ - "4\x00translation_15_4\x00" \ - "25\x00translation_15_25\x00" \ - "60\x00translation_15_60\x00" \ - "\x01" \ - "name_20\x00" /* name_20, langs = [8]. */ \ - "8\x00translation_20_8\x00" \ - "\x01" \ +#define DATA_DEFAULT \ + ( \ + "\x01" /* Version. */ \ + "memory_training_desc\x00" /* memory_training_desc, langs = [0, 2, 30]. */ \ + "0\x00memory_training_desc_0\x00" \ + "2\x00memory_training_desc_2\x00" \ + "30\x00memory_training_desc_30\x00" \ + "\x01" \ ) const unsigned char data_default[] = DATA_DEFAULT; @@ -73,7 +65,7 @@ struct vb2_context *vboot_get_context(void) /* Test states for test_ux_locales_get_text with valid CBFS data. */ struct ux_locales_test_state { - const char *name; + enum ux_locale_msg msg_id; uint32_t lang_id; const char *expect; }; @@ -116,9 +108,12 @@ static void test_ux_locales_get_text(void **state) struct ux_locales_test_state *s = *state; const char *ret; - will_return(_cbfs_alloc, true); - will_return(vb2api_get_locale_id, s->lang_id); - ret = ux_locales_get_text(s->name); + if (s->msg_id < UX_LOCALE_MSG_NUM) { + will_return(_cbfs_alloc, true); + will_return(vb2api_get_locale_id, s->lang_id); + } + + ret = ux_locales_get_text(s->msg_id); if (s->expect) { assert_non_null(ret); assert_string_equal(ret, s->expect); @@ -131,14 +126,18 @@ static void test_ux_locales_bad_cbfs(void **state) { will_return(_cbfs_alloc, false); will_return_maybe(vb2api_get_locale_id, 0); - assert_null(ux_locales_get_text("name_1")); + assert_string_equal(ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING), + "Your device is finishing an update. This may take 1-2 minutes.\n" + "Please do not turn off your device."); } static void test_ux_locales_bad_version(void **state) { will_return(_cbfs_alloc, true); will_return(vb2api_get_locale_id, 0); - assert_null(ux_locales_get_text("name_1")); + assert_string_equal(ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING), + "Your device is finishing an update. This may take 1-2 minutes.\n" + "Please do not turn off your device."); } static void test_ux_locales_two_calls(void **state) @@ -148,26 +147,26 @@ static void test_ux_locales_two_calls(void **state) /* We do not need to ensure that we cached the cbfs region. */ will_return_always(_cbfs_alloc, true); - /* Call #1: read (15, 60). */ - will_return(vb2api_get_locale_id, 60); - ret = ux_locales_get_text("name_15"); + /* Call #1: read (1, 30). */ + will_return(vb2api_get_locale_id, 30); + ret = ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); assert_non_null(ret); - assert_string_equal(ret, "translation_15_60"); + assert_string_equal(ret, "memory_training_desc_30"); /* Call #2: read (1, 0). */ will_return(vb2api_get_locale_id, 0); - ret = ux_locales_get_text("name_1"); + ret = ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); assert_non_null(ret); - assert_string_equal(ret, "translation_1_0"); + assert_string_equal(ret, "memory_training_desc_0"); } static void test_ux_locales_null_terminated(void **state) { will_return_always(_cbfs_alloc, true); - will_return_always(vb2api_get_locale_id, 8); + will_return_always(vb2api_get_locale_id, 30); /* Verify the access to the very last text. */ - assert_non_null(ux_locales_get_text("name_20")); + assert_non_null(ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING)); /* Modify the last 2 bytes from "\x00\x01" to "XX" and unmap, */ data.raw[data.size - 1] = 'X'; @@ -175,24 +174,27 @@ static void test_ux_locales_null_terminated(void **state) ux_locales_unmap(); /* The last few characters are now changed so that the data is not NULL terminated. - This will prevent us from accessing the last text. */ - assert_null(ux_locales_get_text("name_20")); + This will prevent us from accessing the last text therefore, make use of fallback + text message */ + assert_string_equal(ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING), + "Your device is finishing an update. This may take 1-2 minutes.\n" + "Please do not turn off your device."); } /* - * This macro helps test ux_locales_get_text with `_name` and `_lang_id`. + * This macro helps test ux_locales_get_text with `_msg_id` and `_lang_id`. * If `_expect` is NULL, then the function should not find anything. * Otherwise, the function should find the corresponding expect value. */ -#define UX_LOCALES_GET_TEXT_TEST(_name, _lang_id, _expect) \ +#define UX_LOCALES_GET_TEXT_TEST(_msg_id, _lang_id, _expect) \ ((struct CMUnitTest) { \ - .name = "test_ux_locales_get_text(name=" _name ", lang_id=" #_lang_id \ + .name = "test_ux_locales_get_text(msg_id=" #_msg_id ", lang_id=" #_lang_id \ ", expect=" #_expect ")", \ .test_func = test_ux_locales_get_text, \ .setup_func = setup_default, \ .teardown_func = teardown_unmap, \ .initial_state = &(struct ux_locales_test_state) { \ - .name = _name, \ + .msg_id = _msg_id, \ .lang_id = _lang_id, \ .expect = _expect, \ }, \ @@ -202,21 +204,14 @@ int main(void) { const struct CMUnitTest tests[] = { /* Get text successfully. */ - UX_LOCALES_GET_TEXT_TEST("name_1", 0, "translation_1_0"), - /* Get text with name and id both in the middle. */ - UX_LOCALES_GET_TEXT_TEST("name_15", 25, "translation_15_25"), - /* Ensure we check the whole string of 'name'. - ('name_2' is the prefix of 'name_20') */ - UX_LOCALES_GET_TEXT_TEST("name_2", 3, NULL), - /* Ensure we check the whole string of 'lang_id'. - (id:'2' is the prefix of id:'25' in 'name_15') */ - UX_LOCALES_GET_TEXT_TEST("name_15", 2, NULL), - /* Ensure we will fallback to 0. */ - UX_LOCALES_GET_TEXT_TEST("name_1", 7, "translation_1_0"), - /* Do not search for locale id with unmatched name. */ - UX_LOCALES_GET_TEXT_TEST("name_15", 8, NULL), + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 0, "memory_training_desc_0"), + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 2, "memory_training_desc_2"), + /* Check the whole string of lang_id. */ + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 3, "memory_training_desc_0"), /* Validity check of lang_id > 100. We will fallback to 0. */ - UX_LOCALES_GET_TEXT_TEST("name_1", 100, "translation_1_0"), + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 100, "memory_training_desc_0"), + /* Ensure we show fallback message if `msg_id >= UX_LOCALE_MSG_NUM` */ + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_NUM, 0, "Trying to display an unknown message?"), /* cbfs not found. */ cmocka_unit_test_setup_teardown(test_ux_locales_bad_cbfs, setup_default, teardown_unmap), From cf6f4920995ac2424065daa102023d870e0af496 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 5 Feb 2025 09:52:18 +0000 Subject: [PATCH 0090/3886] soc/intel/alderlake: Use helper for UX messages This commit introduces `ux_inform_user_of_operation` to reduce code duplication when displaying UX messages. `ux_inform_user_of_update_operation` now calls this helper, passing the message ID. This allows easier addition of other UX messages. BUG=b:339673254 TEST=Built and booted google/brox. Verified display eSOL. Change-Id: Ib31f7633e7b3f84122419e4ce39e2b5044cb9a96 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86278 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/soc/intel/alderlake/romstage/ux.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/soc/intel/alderlake/romstage/ux.c b/src/soc/intel/alderlake/romstage/ux.c index d0961c51ec..4e647275ce 100644 --- a/src/soc/intel/alderlake/romstage/ux.c +++ b/src/soc/intel/alderlake/romstage/ux.c @@ -8,19 +8,18 @@ #include "ux.h" -bool ux_inform_user_of_update_operation(const char *name) +static bool ux_inform_user_of_operation(const char *name, enum ux_locale_msg id) { timestamp_add_now(TS_ESOL_START); - if (!CONFIG(CHROMEOS_ENABLE_ESOL) || - !early_graphics_init()) { + if (!CONFIG(CHROMEOS_ENABLE_ESOL) || !early_graphics_init()) { timestamp_add_now(TS_ESOL_END); return false; } printk(BIOS_INFO, "Informing user on-display of %s.\n", name); - const char *text = ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); + const char *text = ux_locales_get_text(id); vga_write_text(VGA_TEXT_CENTER, VGA_TEXT_HORIZONTAL_MIDDLE, (const unsigned char *)text); @@ -28,3 +27,8 @@ bool ux_inform_user_of_update_operation(const char *name) timestamp_add_now(TS_ESOL_END); return true; } + +bool ux_inform_user_of_update_operation(const char *name) +{ + return ux_inform_user_of_operation(name, UX_LOCALE_MSG_MEMORY_TRAINING); +} From f8381b902398bddf81a980e8e690523a18b063c5 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 7 Feb 2025 07:42:01 +0000 Subject: [PATCH 0091/3886] lib: Add low battery UX locale message This commit adds a new UX locale message to display a warning when the battery is critically low. The message informs the user about the low battery and indicates that the system is shutting down. This change ensures that users are notified before the system unexpectedly shuts down due to low battery. BUG=b:339673254 TEST=Built and booted google/brox. Change-Id: I75c7a0d4d439901098c7f17a1dc90355307116ac Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86284 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner --- src/include/ux_locales.h | 1 + src/lib/ux_locales.c | 4 ++++ tests/lib/ux_locales-test.c | 16 +++++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/include/ux_locales.h b/src/include/ux_locales.h index e8710839b0..35c56b7c4d 100644 --- a/src/include/ux_locales.h +++ b/src/include/ux_locales.h @@ -7,6 +7,7 @@ enum ux_locale_msg { UX_LOCALE_MSG_MEMORY_TRAINING, + UX_LOCALE_MSG_LOW_BATTERY, UX_LOCALE_MSG_NUM, }; diff --git a/src/lib/ux_locales.c b/src/lib/ux_locales.c index b9f153772e..528a5ae178 100644 --- a/src/lib/ux_locales.c +++ b/src/lib/ux_locales.c @@ -31,6 +31,10 @@ static const struct { "Your device is finishing an update. This may take 1-2 minutes.\n" "Please do not turn off your device." }, + [UX_LOCALE_MSG_LOW_BATTERY] = { + "low_battery_desc", + "Battery low. Shutting down." + }, }; /* diff --git a/tests/lib/ux_locales-test.c b/tests/lib/ux_locales-test.c index 63f2f56318..4edac5c9d2 100644 --- a/tests/lib/ux_locales-test.c +++ b/tests/lib/ux_locales-test.c @@ -15,6 +15,9 @@ "2\x00memory_training_desc_2\x00" \ "30\x00memory_training_desc_30\x00" \ "\x01" \ + "low_battery_desc\x00" /* low_battery_desc, langs = [8]. */ \ + "8\x00low_battery_desc_8\x00" \ + "\x01" \ ) const unsigned char data_default[] = DATA_DEFAULT; @@ -163,10 +166,10 @@ static void test_ux_locales_two_calls(void **state) static void test_ux_locales_null_terminated(void **state) { will_return_always(_cbfs_alloc, true); - will_return_always(vb2api_get_locale_id, 30); + will_return_always(vb2api_get_locale_id, 8); /* Verify the access to the very last text. */ - assert_non_null(ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING)); + assert_non_null(ux_locales_get_text(UX_LOCALE_MSG_LOW_BATTERY)); /* Modify the last 2 bytes from "\x00\x01" to "XX" and unmap, */ data.raw[data.size - 1] = 'X'; @@ -176,9 +179,8 @@ static void test_ux_locales_null_terminated(void **state) /* The last few characters are now changed so that the data is not NULL terminated. This will prevent us from accessing the last text therefore, make use of fallback text message */ - assert_string_equal(ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING), - "Your device is finishing an update. This may take 1-2 minutes.\n" - "Please do not turn off your device."); + assert_string_equal(ux_locales_get_text(UX_LOCALE_MSG_LOW_BATTERY), + "Battery low. Shutting down."); } /* @@ -206,12 +208,16 @@ int main(void) /* Get text successfully. */ UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 0, "memory_training_desc_0"), UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 2, "memory_training_desc_2"), + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_LOW_BATTERY, 8, "low_battery_desc_8"), /* Check the whole string of lang_id. */ UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 3, "memory_training_desc_0"), /* Validity check of lang_id > 100. We will fallback to 0. */ UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_MEMORY_TRAINING, 100, "memory_training_desc_0"), /* Ensure we show fallback message if `msg_id >= UX_LOCALE_MSG_NUM` */ UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_NUM, 0, "Trying to display an unknown message?"), + /* Do not search for locale id with unmatched name. */ + UX_LOCALES_GET_TEXT_TEST(UX_LOCALE_MSG_LOW_BATTERY, 4, + "Battery low. Shutting down."), /* cbfs not found. */ cmocka_unit_test_setup_teardown(test_ux_locales_bad_cbfs, setup_default, teardown_unmap), From e5949cfef846f969c7631c2661230a14cb424b0a Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 30 Jan 2025 09:49:48 +0000 Subject: [PATCH 0092/3886] soc/intel/alderlake: Display low battery message on screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a function ux_inform_user_of_poweroff_operation to display a message on the screen when the system is powering off due to critically low battery. The message is centered on the screen and displays a localized string "Battery critically low. Shutting down.". If no localized string is found, a default English message is displayed. This implementation relies on CHROMEOS_ENABLE_ESOL Kconfig which is used to render text message for early sign-of-life. BUG=b:339673254 TEST=Able to capture the eventlog for low battery boot event. Change-Id: I3b24d2c89ade8cc62b7e47c487d52d47b7f3376d Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86224 Reviewed-by: Karthik Ramasubramanian Reviewed-by: Jérémy Compostella Reviewed-by: Julius Werner Reviewed-by: Dinesh Gehlot Tested-by: build bot (Jenkins) --- src/soc/intel/alderlake/romstage/ux.c | 5 +++++ src/soc/intel/alderlake/romstage/ux.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/soc/intel/alderlake/romstage/ux.c b/src/soc/intel/alderlake/romstage/ux.c index 4e647275ce..03e6acdaa5 100644 --- a/src/soc/intel/alderlake/romstage/ux.c +++ b/src/soc/intel/alderlake/romstage/ux.c @@ -32,3 +32,8 @@ bool ux_inform_user_of_update_operation(const char *name) { return ux_inform_user_of_operation(name, UX_LOCALE_MSG_MEMORY_TRAINING); } + +bool ux_inform_user_of_poweroff_operation(const char *name) +{ + return ux_inform_user_of_operation(name, UX_LOCALE_MSG_LOW_BATTERY); +} diff --git a/src/soc/intel/alderlake/romstage/ux.h b/src/soc/intel/alderlake/romstage/ux.h index 14c10e7ffd..c556c63df1 100644 --- a/src/soc/intel/alderlake/romstage/ux.h +++ b/src/soc/intel/alderlake/romstage/ux.h @@ -4,5 +4,6 @@ #define _SOC_INTEL_ALDERLAKE_ROMSTAGE_UX_H_ bool ux_inform_user_of_update_operation(const char *name); +bool ux_inform_user_of_poweroff_operation(const char *name); #endif /* _SOC_INTEL_ALDERLAKE_ROMSTAGE_UX_H_ */ From ae0adb7c160180652f2234cc631ffb5d88bdb428 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 14 Feb 2025 09:37:09 +0000 Subject: [PATCH 0093/3886] lib: Introduce early power off support Kconfig option This commit introduces the `HAVE_EARLY_POWEROFF_SUPPORT` Kconfig option and the `platform_do_early_poweroff()` API. The Kconfig option enables platform-specific early power off support, which is often required on Intel platforms. The corresponding API allows platforms to implement the necessary hardware operations for early power off, typically before memory initialization. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: I05b9882e100825a4fb733163a65f820c8c943361 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86417 Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- src/include/reset.h | 15 +++++++++++++++ src/lib/Kconfig | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/include/reset.h b/src/include/reset.h index 95fe0660ad..a5d5aecf4f 100644 --- a/src/include/reset.h +++ b/src/include/reset.h @@ -41,4 +41,19 @@ __noreturn void board_reset(void); */ void do_board_reset(void); +/* + * Performs platform-specific actions for early power off. + * + * This function handles the necessary steps to initiate an early power off + * sequence. This might involve configuring specific hardware registers, + * sending commands to power management controllers, or performing other + * platform-specific operations. It is crucial that this + * function is implemented correctly to ensure a clean and controlled shutdown. + * + * Note: Issuing power off early before memory initialization is not supported use case on + * Intel chipset, therefore, it might need a special platform specific handing + * to power-off the platform early. + */ +void platform_do_early_poweroff(void); + #endif diff --git a/src/lib/Kconfig b/src/lib/Kconfig index 2c1a93cff1..ad706261b8 100644 --- a/src/lib/Kconfig +++ b/src/lib/Kconfig @@ -159,3 +159,19 @@ config PROBE_RAM config HAVE_CUSTOM_BMP_LOGO def_bool n depends on BMP_LOGO + +config HAVE_EARLY_POWEROFF_SUPPORT + bool + help + Enable platform-specific early power off support. + + This option should be selected if the platform requires special handling + to power off the system before memory initialization. This is often + necessary on Intel platforms, as directly powering off before memory + initialization is typically not supported by the chipset. + + Selecting this option indicates that the platform implements the + `platform_do_early_poweroff()` function, which performs the + necessary hardware operations to initiate an early power off sequence. + This might involve configuring hardware registers, sending commands to + power management controllers, or other platform-specific operations. From 0fe338c88b06d70c5f7e64efcabf1991068daf98 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 14 Feb 2025 09:42:22 +0000 Subject: [PATCH 0094/3886] soc/intel/cmn/pmc: Add support for early power off This commit adds support for early power off on Intel platforms along with existing PMC based implementation to support power off at later stage (like ramstage). A new function, `platform_do_early_poweroff`, is added to the pmclib to handle platform-specific early power off procedures. This function is called before memory initialization (in romstage or earlier). Note: While Intel chipsets do not support power off before silicon initialization, this change leverages Chrome EC APIs to enable power off in romstage for low-battery boot on ChromeOS devices. Power off failures in ramstage prior to FSP-S are outside the scope of this change. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: I39f516640b3f75ab4c6a09826922289c0533f79b Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86336 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner --- src/soc/intel/common/block/pmc/pmclib.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index 8c48e8873f..64b9bb997c 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -615,7 +616,8 @@ void vboot_platform_prepare_reboot(void) pmc_write_pm1_control(pm1_cnt); } -void poweroff(void) +/* Helper function to perform poweroff operation using PMC chipset register. */ +static void pmc_control_poweroff(void) { pmc_enable_pm1_control(SLP_EN | (SLP_TYP_S5 << SLP_TYP_SHIFT)); @@ -628,6 +630,19 @@ void poweroff(void) halt(); } +void poweroff(void) +{ + if (!ENV_ROMSTAGE_OR_BEFORE) { + pmc_control_poweroff(); + } else if (CONFIG(HAVE_EARLY_POWEROFF_SUPPORT)) { + platform_do_early_poweroff(); + } else { + printk(BIOS_EMERG, "This platform cannot be powered off until the silicon" + " initialization is complete, hanging!\n"); + halt(); + } +} + void pmc_gpe_init(void) { uint32_t gpio_cfg = 0; From c8fc650c5b7c9319be9082ca0d61fc6c96a3095a Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 14 Feb 2025 09:49:51 +0000 Subject: [PATCH 0095/3886] ec/google/chromeec: Implement early power off support This commit renames the `google_chromeec_do_early_poweroff()` function to `platform_do_early_poweroff()`, aligning it with the API that adds early power off support using the Chrome EC. It selects the `HAVE_EARLY_POWEROFF_SUPPORT` Kconfig option for platform to perform early power off procedures. Change-Id: I0c634d69de36fe8bdb6a61c121e321d3626ac3ff Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86379 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/ec/google/chromeec/Kconfig | 1 + src/ec/google/chromeec/ec.c | 9 ++++++++- src/ec/google/chromeec/ec.h | 8 -------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig index a39ac8e81d..851ebb9352 100644 --- a/src/ec/google/chromeec/Kconfig +++ b/src/ec/google/chromeec/Kconfig @@ -3,6 +3,7 @@ config EC_GOOGLE_CHROMEEC bool select EC_SUPPORTS_DPTF_TEVT + select HAVE_EARLY_POWEROFF_SUPPORT help Google's Chrome EC diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index cc581ffb7b..5844071a1e 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1671,7 +1672,13 @@ bool google_chromeec_is_battery_present(void) return false; } -void google_chromeec_do_early_poweroff(void) +/* + * Performs early power off. + * + * This function handles the necessary steps to initiate an early power off + * sequence. + */ +void platform_do_early_poweroff(void) { google_chromeec_reboot(EC_REBOOT_COLD_AP_OFF, 0); halt(); diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 08d4f2771d..b11b7a834a 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -471,14 +471,6 @@ bool google_chromeec_is_below_critical_threshold(void); */ bool google_chromeec_is_battery_present(void); -/* - * Performs early power off. - * - * This function handles the necessary steps to initiate an early power off - * sequence. - */ -void google_chromeec_do_early_poweroff(void); - /** * Determine if the UCSI stack is currently active. * From 801d0a1491c48bfb56e91214bec9eb8d21646193 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 11 Feb 2025 14:53:39 +0000 Subject: [PATCH 0096/3886] lib: Centralize logo.bmp inclusion in lib/Makefile.mk This commit moves the logo.bmp inclusion logic from `src/drivers/intel/fsp2_0/Makefile.mk` to `src/lib/Makefile.mk`. This change centralizes the logo inclusion logic within the `lib` directory, aligning it with the location of `bmp_logo.c` and making it independent of the FSP 2.0 driver. Change-Id: I16ed1cf29b839c25b6ea1c2f10faf3d99dd707c9 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86367 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner --- src/drivers/intel/fsp2_0/Makefile.mk | 12 ------------ src/lib/Makefile.mk | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/drivers/intel/fsp2_0/Makefile.mk b/src/drivers/intel/fsp2_0/Makefile.mk index 4cb24ffb56..18a62e3b57 100644 --- a/src/drivers/intel/fsp2_0/Makefile.mk +++ b/src/drivers/intel/fsp2_0/Makefile.mk @@ -126,18 +126,6 @@ $(obj)/Fsp_2_S.fd: $(call strip_quotes,$(CONFIG_FSP_FD_PATH_2)) $(obj)/Fsp_M.fd true endif -# Add logo to the cbfs image -ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) -cbfs-files-$(CONFIG_BMP_LOGO) += logo.bmp -logo.bmp-file := $(call strip_quotes,$(CONFIG_FSP2_0_LOGO_FILE_NAME)) -logo.bmp-type := raw -ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZMA),y) -logo.bmp-compression := LZMA -else ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZ4),y) -logo.bmp-compression := LZ4 -endif -endif - ifneq ($(call strip_quotes,$(CONFIG_FSP_HEADER_PATH)),) CPPFLAGS_common+=-I$(CONFIG_FSP_HEADER_PATH) endif diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 40df2b8f56..292f5d2889 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -420,3 +420,15 @@ header_pointer-position := -4 header_pointer-type := "cbfs header" romstage-y += ux_locales.c + +# Add logo to the cbfs image +ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) +cbfs-files-$(CONFIG_BMP_LOGO) += logo.bmp +logo.bmp-file := $(call strip_quotes,$(CONFIG_FSP2_0_LOGO_FILE_NAME)) +logo.bmp-type := raw +ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZMA),y) +logo.bmp-compression := LZMA +else ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZ4),y) +logo.bmp-compression := LZ4 +endif +endif From 40b9e5569668a813ff32ef2ee547315f8208439d Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 11 Feb 2025 15:05:55 +0000 Subject: [PATCH 0097/3886] lib: Refactor logo.bmp inclusion with helper macro This commit refactors the logo.bmp inclusion logic to use a helper macro, `add_bmp_logo_file_to_cbfs`. This centralizes the logic for adding BMP logo files to the CBFS image and improves code readability. Change-Id: I135c1f2af02064b72bc1f747336ac98ffdb20842 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86368 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/lib/Makefile.mk | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 292f5d2889..93e76d4af3 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -422,13 +422,21 @@ header_pointer-type := "cbfs header" romstage-y += ux_locales.c # Add logo to the cbfs image -ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) -cbfs-files-$(CONFIG_BMP_LOGO) += logo.bmp -logo.bmp-file := $(call strip_quotes,$(CONFIG_FSP2_0_LOGO_FILE_NAME)) -logo.bmp-type := raw +BMP_LOGO_COMPRESS_FLAG := $(CBFS_COMPRESS_FLAG) ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZMA),y) -logo.bmp-compression := LZMA + BMP_LOGO_COMPRESS_FLAG := LZMA else ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZ4),y) -logo.bmp-compression := LZ4 + BMP_LOGO_COMPRESS_FLAG := LZ4 endif + +define add_bmp_logo_file_to_cbfs +cbfs-files-$$($(1)) += $(2) +$(2)-file := $$(call strip_quotes,$$($(3))) +$(2)-type := raw +$(2)-compression := $$(BMP_LOGO_COMPRESS_FLAG) +endef + +ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) +$(eval $(call add_bmp_logo_file_to_cbfs,CONFIG_BMP_LOGO, logo.bmp,\ + CONFIG_FSP2_0_LOGO_FILE_NAME)) endif From 1c8a058c08e14af06579d2a7c9a9ae093038a48d Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 11 Feb 2025 15:16:31 +0000 Subject: [PATCH 0098/3886] drivers/intel/fsp2_0: Add low battery indicator screen This commit adds low battery indicator bitmap into CBFS. This screen is displayed when the system detects a critically low battery condition. The screen displays a logo and can be configured with a custom path. An option to display an early low battery indicator in text mode is also included. This early indicator can defer the firmware update. This feature is controlled by the PLATFORM_HAS_LOW_BATTERY_INDICATOR Kconfig option. BUG=b:339673254 TEST=Able to see low-battery user notification in text mode before memory init. Verified low-battery boot event listed in the eventlog. Change-Id: I711c53455639b449fe85903139bbc06cdab08d09 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86225 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Karthik Ramasubramanian --- src/drivers/intel/fsp2_0/Kconfig | 49 ++++++++++++++++++++++++++++++++ src/lib/Makefile.mk | 3 ++ 2 files changed, 52 insertions(+) diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index c5c485bad2..42551503ff 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -522,4 +522,53 @@ config BUILDING_WITH_DEBUG_FSP Enable this option if you are using a debug build of the FSP (Firmware Support Package) in your project. +config PLATFORM_HAS_LOW_BATTERY_INDICATOR + bool "Display low battery indicator" + depends on BMP_LOGO + help + If enabled, this option displays a low battery indicator screen. This screen can be + used to warn the user that the battery is low and that they should plug in the device. + + This option requires that the system have a display and that the BMP_LOGO option is + enabled. + +config PLATFORM_LOW_BATTERY_SHUTDOWN_DELAY_SEC + int + default 5 + depends on PLATFORM_HAS_LOW_BATTERY_INDICATOR + help + Delay, in seconds, before system shutdown due to low battery. + This delay allows the user to observe the low-battery indicator. + The default value of 5 seconds aligns with standard user experience (UX) practices. + Platforms may override this value based on specific product requirements. + +config HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR + bool + depends on FSP_UGOP_EARLY_SIGN_OF_LIFE || MAINBOARD_HAS_EARLY_LIBGFXINIT + help + Enable low-battery indicator support in eSOL. + + This option should be selected if the eSOL feature (using either libgfxinit or FSP uGOP) + supports displaying a low-battery indicator. + + Platforms selecting `MAINBOARD_HAS_EARLY_LIBGFXINIT` can default enable this option. + + For platforms using FSP uGOP, this option should only be enabled if uGOP has implemented + the necessary low-battery handling. This allows platforms to control low-battery + indicator support based on uGOP readiness. + +config PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR + bool "Display low battery indicator in romstage" + depends on PLATFORM_HAS_LOW_BATTERY_INDICATOR && HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR + help + If enabled, this option displays a low battery indicator during romstage (before memory + is available) in text mode in the firmware and defer the firmware update. This screen + can be used to warn the user that the battery is low and that they should plug in the + device. + +config PLATFORM_LOW_BATTERY_INDICATOR_LOGO_PATH + string "Path to low battery logo file" + depends on PLATFORM_HAS_LOW_BATTERY_INDICATOR + default "3rdparty/blobs/mainboard/\$(MAINBOARDDIR)/low_battery.bmp" + endif diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 93e76d4af3..5e1e81a5d0 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -440,3 +440,6 @@ ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) $(eval $(call add_bmp_logo_file_to_cbfs,CONFIG_BMP_LOGO, logo.bmp,\ CONFIG_FSP2_0_LOGO_FILE_NAME)) endif + +$(eval $(call add_bmp_logo_file_to_cbfs,CONFIG_PLATFORM_HAS_LOW_BATTERY_INDICATOR, \ + low_battery.bmp,CONFIG_PLATFORM_LOW_BATTERY_INDICATOR_LOGO_PATH)) From e5cc73cb9499adecbf8f8254f18ff44142c25397 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 11 Feb 2025 09:09:56 +0000 Subject: [PATCH 0099/3886] soc/intel/common: Add low battery shutdown function This commit adds a `do_low_battery_poweroff()` function to handle platform power off due to critically low battery levels. This provides a standardized way to handle low battery shutdowns across platforms. Additionally, the delay to the `do_low_battery_poweroff()` function, allowing time for the low battery indicator to be displayed before powering off. The delay is configurable through the `PLATFORM_LOW_BATTERY_SHUTDOWN_DELAY_SEC` Kconfig option. Finally, a low battery indicator event is logged using `elog` before the delay. This functionality (elog and delay) is enabled when the `PLATFORM_HAS_LOW_BATTERY_INDICATOR` Kconfig option is selected. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: I92e9003c70c2608770972f1a302f954ebdf17bc4 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86361 Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) --- src/soc/intel/common/reset.c | 12 ++++++++++++ src/soc/intel/common/reset.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/src/soc/intel/common/reset.c b/src/soc/intel/common/reset.c index c6c394bd44..3fefa57d30 100644 --- a/src/soc/intel/common/reset.c +++ b/src/soc/intel/common/reset.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include @@ -21,3 +23,13 @@ void do_board_reset(void) { full_reset(); } + +void do_low_battery_poweroff(void) +{ + if (CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR)) { + elog_add_event_byte(ELOG_TYPE_LOW_BATTERY_INDICATOR, ELOG_FW_ISSUE_SHUTDOWN); + delay(CONFIG_PLATFORM_LOW_BATTERY_SHUTDOWN_DELAY_SEC); + } + + poweroff(); +} diff --git a/src/soc/intel/common/reset.h b/src/soc/intel/common/reset.h index 658223c32a..8331853023 100644 --- a/src/soc/intel/common/reset.h +++ b/src/soc/intel/common/reset.h @@ -25,4 +25,11 @@ __noreturn void global_reset(void); */ efi_return_status_t fsp_get_pch_reset_status(void); +/* + * Issue power off due to low battery + * + * Call this function to power off the platform if the battery level is critically low. + */ +void do_low_battery_poweroff(void); + #endif /* _INTEL_COMMON_RESET_H_ */ From a518709e2583fb683ac9cc1d578e3b962ed089d4 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 5 Feb 2025 15:38:50 +0000 Subject: [PATCH 0100/3886] drivers/intel/fsp2_0: Add platform callback for critical shutdown This commit adds the `platform_is_low_battery_shutdown_needed` callback to the FSP API. This allows platforms to integrate low-battery handling logic directly into the FSP silicon initialization process. By checking for critical conditions (e.g., low battery) within this callback after FSP silicon initialization, the platform can initiate a controlled shutdown before proceeding with further boot stages, preventing abrupt shutdowns later in the boot process. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: I2d6677d70dea3d24f5a19d70608fd21229a271a0 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86226 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/drivers/intel/fsp2_0/include/fsp/api.h | 13 +++++++++++++ src/drivers/intel/fsp2_0/silicon_init.c | 3 +++ src/lib/bmp_logo.c | 9 ++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h index 971be0d207..28b24ce95f 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/api.h +++ b/src/drivers/intel/fsp2_0/include/fsp/api.h @@ -50,6 +50,19 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd); /* Callbacks for SoC/Mainboard specific overrides */ void platform_fsp_memory_multi_phase_init_cb(uint32_t phase_index); void platform_fsp_silicon_multi_phase_init_cb(uint32_t phase_index); +/* + * Platform specific callbacks for power-off handling. + * + * These callbacks allow the platform to determine if a power-off is + * necessary due to various reasons, such as low battery detection. + * + * Additionally, API to perform platform specific power-off + */ +#if CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR) +bool platform_is_low_battery_shutdown_needed(void); +#else +static inline bool platform_is_low_battery_shutdown_needed(void) { return false; } +#endif /* Check if MultiPhase Si Init is enabled */ bool fsp_is_multi_phase_init_enabled(void); /* diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c index fdac9f5b85..f3472420bc 100644 --- a/src/drivers/intel/fsp2_0/silicon_init.c +++ b/src/drivers/intel/fsp2_0/silicon_init.c @@ -259,6 +259,9 @@ void fsp_silicon_init(void) fsps_load(); do_silicon_init(&fsps_hdr); + if (platform_is_low_battery_shutdown_needed()) + do_low_battery_poweroff(); + if (CONFIG(CACHE_MRC_SETTINGS) && CONFIG(FSP_NVS_DATA_POST_SILICON_INIT)) save_memory_training_data(); diff --git a/src/lib/bmp_logo.c b/src/lib/bmp_logo.c index becb605645..5a5adaafb5 100644 --- a/src/lib/bmp_logo.c +++ b/src/lib/bmp_logo.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,7 @@ const char *bmp_logo_filename(void) void *bmp_load_logo(size_t *logo_size) { void *logo_buffer; + const char *logo_name; /* CBMEM is locked for S3 resume path. */ if (acpi_is_wakeup_s3()) @@ -32,7 +34,12 @@ void *bmp_load_logo(size_t *logo_size) if (!logo_buffer) return NULL; - *logo_size = cbfs_load(bmp_logo_filename(), logo_buffer, 1 * MiB); + if (platform_is_low_battery_shutdown_needed()) + logo_name = "low_battery.bmp"; + else + logo_name = bmp_logo_filename(); + + *logo_size = cbfs_load(logo_name, logo_buffer, 1 * MiB); if (*logo_size == 0) return NULL; From 1a58ae5e09137853e1356ad421f58baddd94adac Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 6 Feb 2025 12:17:08 +0000 Subject: [PATCH 0101/3886] vc/google/chromeos: Implement platform callback for critical shutdown This commit implements `platform_is_low_battery_shutdown_needed` and callback for ChromeOS. - platform_is_low_battery_shutdown_needed: API to check if low battery shutdown is needed. BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown. Change-Id: I119f80a45c045a6095cae98f179c755a2e948e9c Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86228 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner --- src/vendorcode/google/chromeos/Makefile.mk | 3 ++ src/vendorcode/google/chromeos/battery.c | 34 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/vendorcode/google/chromeos/battery.c diff --git a/src/vendorcode/google/chromeos/Makefile.mk b/src/vendorcode/google/chromeos/Makefile.mk index 67b50f6bdd..6eb010e8eb 100644 --- a/src/vendorcode/google/chromeos/Makefile.mk +++ b/src/vendorcode/google/chromeos/Makefile.mk @@ -19,7 +19,10 @@ verstage-y += watchdog.c romstage-y += watchdog.c ramstage-y += watchdog.c +romstage-$(CONFIG_PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) += battery.c romstage-$(CONFIG_CHROMEOS_DRAM_PART_NUMBER_IN_CBI) += dram_part_num_override.c + +ramstage-$(CONFIG_PLATFORM_HAS_LOW_BATTERY_INDICATOR) += battery.c ramstage-$(CONFIG_CHROMEOS_FW_SPLASH_SCREEN) += splash.c # Add logo to the cbfs image diff --git a/src/vendorcode/google/chromeos/battery.c b/src/vendorcode/google/chromeos/battery.c new file mode 100644 index 0000000000..febc4dcc02 --- /dev/null +++ b/src/vendorcode/google/chromeos/battery.c @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* + * Check if low battery shutdown is needed + * + * This function checks if the system needs to shut down due to a critically low + * battery level. It performs the following actions: + * + * 1. If Chrome EC is not supported, returns false (no shutdown needed). + * 2. Uses static variables to cache the result and avoid repeated checks. + * 3. If the battery level has not been checked yet: + * - Queries the Chrome EC to determine if the battery is below the critical threshold. + * - If the battery is below the threshold, sets the result to true. + * 4. Returns the cached result. + */ +bool platform_is_low_battery_shutdown_needed(void) +{ + if (!CONFIG(EC_GOOGLE_CHROMEEC)) + return false; + + static bool result = false; + static bool checked = false; + + if (!checked) { + if (google_chromeec_is_below_critical_threshold()) + result = true; + checked = true; + } + + return result; +} From 80801e7f694b263fc8faca207e3af1aad3523bc4 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 6 Feb 2025 12:58:05 +0000 Subject: [PATCH 0102/3886] soc/intel/alderlake: Handle critical low battery early in romstage This commit implements early handling of critical low battery conditions in the romstage for Alder Lake platforms. A message is displayed to the user via ux_inform_user_of_poweroff_operation. A short delay is introduced to allow the user to see the message. A low battery event is logged. The system is shut down via the Chrome EC. This early handling prevents the system from proceeding with boot (while performing firmware update) if the battery is critically low and ensures a clean shutdown. This is particularly important for ChromeOS devices. BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown. Change-Id: Ib4be86ed17818ee05b7bec0337a90f80017183c2 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86227 Reviewed-by: Julius Werner Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) --- src/soc/intel/alderlake/romstage/fsp_params.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/soc/intel/alderlake/romstage/fsp_params.c b/src/soc/intel/alderlake/romstage/fsp_params.c index 4a03b7438f..71791ae90b 100644 --- a/src/soc/intel/alderlake/romstage/fsp_params.c +++ b/src/soc/intel/alderlake/romstage/fsp_params.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -427,6 +429,28 @@ static void fill_fspm_sign_of_life(FSP_M_CONFIG *m_cfg, * user with an on-screen text message. */ if (!arch_upd->NvsBufferPtr) { + /* + * Low Battery Check During Firmware Update (Chrome OS specific): + * - If `PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR` is enabled AND the + * system is in firmware update mode (If valid MRC cache data is not found, + * it means that the system needs to perform), it checks if the battery level is + * critically low. + * - This is because memory training, which can take a significant amount of + * time, might cause an abrupt shutdown due to low battery, interrupting the + * firmware update process and potentially leaving the system in an unstable + * state. + * - To prevent this, if the battery is critically low, the system is powered + * off to allow it to charge. This ensures that the firmware update process + * can complete without interruption. + * - Since a functional GFX mode display may not be ready at this stage, VGA + * mode is used to display a text message informing the user about the + * shutdown. + */ + if (CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) && + platform_is_low_battery_shutdown_needed()) { + ux_inform_user_of_poweroff_operation("low-battery shutdown"); + do_low_battery_poweroff(); + } esol_required = true; name = "memory training"; elog_add_event_byte(ELOG_TYPE_FW_EARLY_SOL, ELOG_FW_EARLY_SOL_MRC); From 72947a131fef10b69ebd406006c0188a25acc32b Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 14 Feb 2025 11:36:12 +0000 Subject: [PATCH 0103/3886] soc/intel/alderlake: Enable low-battery indicator support This patch enables the `HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR` Kconfig option for Alder Lake SoC platform that has support for CHROMEOS_ENABLE_ESOL. This allows the eSOL feature (depending upon CHROMEOS_ENABLE_ESOL) to display a low-battery indicator. BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown. Change-Id: I8b49a487ca80a2aeeb8b4d8e4c2259217e854444 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86316 Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/soc/intel/alderlake/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/soc/intel/alderlake/Kconfig b/src/soc/intel/alderlake/Kconfig index 4f374eba64..fc94695f18 100644 --- a/src/soc/intel/alderlake/Kconfig +++ b/src/soc/intel/alderlake/Kconfig @@ -22,6 +22,7 @@ config SOC_INTEL_ALDERLAKE select FSPS_HAS_ARCH_UPD select GENERIC_GPIO_LIB select HAVE_DEBUG_RAM_SETUP + select HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR if CHROMEOS_ENABLE_ESOL select HAVE_FSP_GOP select HAVE_HYPERTHREADING select INTEL_DESCRIPTOR_MODE_CAPABLE From 5aebeb4056faf13faf9e384ec87c07fb19f03ae7 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Tue, 4 Feb 2025 15:42:45 +0100 Subject: [PATCH 0104/3886] soc/amd/glinda/chipset.cb: Enable gpp_bridge_[a/b/c] by default Since FSP doesn't support disabling bridges and has no UPDs for that, they must be enabled in DT to make sure they are properly initialized during PCI enumeration as expected by the payload (EDK2 for example). It might be OK to have them set to off when all devices behind the bridge are also off and FSP disables those secondary devices. In general something that cannot be hidden/shut off shouldn't be marked as such, as later stages (payload/OS) might find it active, but unconfigured. Change-Id: Id28a29481f9a1bc570e47a9cb75613d3621b0d44 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/86270 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) --- src/soc/amd/glinda/chipset.cb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/soc/amd/glinda/chipset.cb b/src/soc/amd/glinda/chipset.cb index f328797ec2..a76be1ad31 100644 --- a/src/soc/amd/glinda/chipset.cb +++ b/src/soc/amd/glinda/chipset.cb @@ -32,7 +32,7 @@ chip soc/amd/glinda device pci 03.6 alias gpp_bridge_3_6 off ops amd_external_pcie_gpp_ops end device pci 08.0 on end # Dummy device function, do not disable - device pci 08.1 alias gpp_bridge_a off # Internal GPP Bridge 0 to Bus A + device pci 08.1 alias gpp_bridge_a on # Internal GPP Bridge 0 to Bus A ops amd_internal_pcie_gpp_ops device pci 0.0 alias gfx off ops amd_graphics_ops end # Internal GPU (GFX) device pci 0.1 alias gfx_hda off end # Display HD Audio Controller (GFXAZ) @@ -56,13 +56,13 @@ chip soc/amd/glinda device pci 0.7 alias mp2 off end # Sensor Fusion Hub (MP2) end - device pci 08.2 alias gpp_bridge_b off # Internal GPP Bridge 1 to Bus B + device pci 08.2 alias gpp_bridge_b on # Internal GPP Bridge 1 to Bus B ops amd_internal_pcie_gpp_ops device pci 0.0 on end # dummy, do not disable device pci 0.1 alias npu off end # Neural Processing Unit (NPU) end - device pci 08.3 alias gpp_bridge_c off # Internal GPP Bridge 2 to Bus C + device pci 08.3 alias gpp_bridge_c on # Internal GPP Bridge 2 to Bus C ops amd_internal_pcie_gpp_ops device pci 0.0 alias xhci_0 off From 3d07c761f7621ada5a875f2ac46b19de1e0981be Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Tue, 4 Feb 2025 15:48:54 +0100 Subject: [PATCH 0105/3886] soc/amd/phoenix/chipset_*: Enable gpp_bridge_[a/b/c] by default Since FSP doesn't support disabling bridges and has no UPDs for that, they must be enabled in DT to make sure they are properly initialized during PCI enumeration as expected by the payload (EDK2 for example). It might be OK to have them set to off when all devices behind the bridge are also off and FSP disables those secondary devices. In general something that cannot be hidden/shut off shouldn't be marked as such, as later stages (payload/OS) might find it active, but unconfigured. Change-Id: Ic226fd93b431467c7fa3a53140102ff4fd327f40 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/86271 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) --- src/mainboard/google/myst/variants/baseboard/devicetree.cb | 1 + src/soc/amd/phoenix/chipset_fsp.cb | 6 +++--- src/soc/amd/phoenix/chipset_opensil.cb | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mainboard/google/myst/variants/baseboard/devicetree.cb b/src/mainboard/google/myst/variants/baseboard/devicetree.cb index 97994c7885..55a14c077b 100644 --- a/src/mainboard/google/myst/variants/baseboard/devicetree.cb +++ b/src/mainboard/google/myst/variants/baseboard/devicetree.cb @@ -310,6 +310,7 @@ chip soc/amd/phoenix device ref acp on end # Audio Processor (ACP) device ref mp2 on end # Sensor Fusion Hub (MP2) end + device ref gpp_bridge_b off end # Internal GPP Bridge 1 to Bus B device ref gpp_bridge_c on # Internal GPP Bridge 2 to Bus C device ref usb4_xhci_0 on chip drivers/usb/acpi diff --git a/src/soc/amd/phoenix/chipset_fsp.cb b/src/soc/amd/phoenix/chipset_fsp.cb index 2d1e17080a..d461ac5d49 100644 --- a/src/soc/amd/phoenix/chipset_fsp.cb +++ b/src/soc/amd/phoenix/chipset_fsp.cb @@ -30,7 +30,7 @@ chip soc/amd/phoenix device pci 04.1 alias usb4_pcie_bridge_1 off end device pci 08.0 on end # Dummy device function, do not disable - device pci 08.1 alias gpp_bridge_a off # Internal GPP Bridge 0 to Bus A + device pci 08.1 alias gpp_bridge_a on # Internal GPP Bridge 0 to Bus A ops amd_internal_pcie_gpp_ops device pci 0.0 alias gfx off ops amd_graphics_ops end # Internal GPU (GFX) device pci 0.1 alias gfx_hda off end # Display HD Audio Controller (GFXAZ) @@ -82,13 +82,13 @@ chip soc/amd/phoenix device pci 0.6 alias hda off end # Audio Processor HD Audio Controller (main AZ) device pci 0.7 alias mp2 off end # Sensor Fusion Hub (MP2) end - device pci 08.2 alias gpp_bridge_b off # Internal GPP Bridge 1 to Bus B + device pci 08.2 alias gpp_bridge_b on # Internal GPP Bridge 1 to Bus B ops amd_internal_pcie_gpp_ops device pci 0.0 on end # dummy, do not disable device pci 0.1 alias ipu off end end - device pci 08.3 alias gpp_bridge_c off # Internal GPP Bridge 2 to Bus C + device pci 08.3 alias gpp_bridge_c on # Internal GPP Bridge 2 to Bus C ops amd_internal_pcie_gpp_ops device pci 0.0 on end # dummy, do not disable device pci 0.3 alias usb4_xhci_0 off diff --git a/src/soc/amd/phoenix/chipset_opensil.cb b/src/soc/amd/phoenix/chipset_opensil.cb index 42f36bcc34..fd1563b670 100644 --- a/src/soc/amd/phoenix/chipset_opensil.cb +++ b/src/soc/amd/phoenix/chipset_opensil.cb @@ -50,7 +50,7 @@ chip soc/amd/phoenix device pci 04.1 alias usb4_pcie_bridge_1 off end device pci 08.0 on end # Dummy device function, do not disable - device pci 08.1 alias gpp_bridge_a off # Internal GPP Bridge 0 to Bus A + device pci 08.1 alias gpp_bridge_a on # Internal GPP Bridge 0 to Bus A ops amd_internal_pcie_gpp_ops device pci 0.0 alias gfx off ops amd_graphics_ops end # Internal GPU (GFX) device pci 0.1 alias gfx_hda off end # Display HD Audio Controller (GFXAZ) @@ -102,13 +102,13 @@ chip soc/amd/phoenix device pci 0.6 alias hda off end # Audio Processor HD Audio Controller (main AZ) device pci 0.7 alias mp2 off end # Sensor Fusion Hub (MP2) end - device pci 08.2 alias gpp_bridge_b off # Internal GPP Bridge 1 to Bus B + device pci 08.2 alias gpp_bridge_b on # Internal GPP Bridge 1 to Bus B ops amd_internal_pcie_gpp_ops device pci 0.0 on end # dummy, do not disable device pci 0.1 alias ipu off end end - device pci 08.3 alias gpp_bridge_c off # Internal GPP Bridge 2 to Bus C + device pci 08.3 alias gpp_bridge_c on # Internal GPP Bridge 2 to Bus C ops amd_internal_pcie_gpp_ops device pci 0.0 on end # dummy, do not disable device pci 0.3 alias usb4_xhci_0 off From 72401fc03924866e63264a228125aaa1f09cccaa Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Tue, 4 Feb 2025 15:56:22 +0100 Subject: [PATCH 0106/3886] soc/amd/mendocino/chipset_*: Enable gpp_bridge_[a/b/c] by default Since FSP doesn't support disabling bridges and has no UPDs for that, they must be enabled in DT to make sure they are properly initialized during PCI enumeration as expected by the payload (EDK2 for example). It might be OK to have them set to off when all devices behind the bridge are also off and FSP disables those secondary devices. In general something that cannot be hidden/shut off shouldn't be marked as such, as later stages (payload/OS) might find it active, but unconfigured. Change-Id: Ife30f73495d44c98717e147602de10f5a6a89358 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/86273 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/soc/amd/mendocino/chipset_mendocino.cb | 4 ++-- src/soc/amd/mendocino/chipset_rembrandt.cb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/soc/amd/mendocino/chipset_mendocino.cb b/src/soc/amd/mendocino/chipset_mendocino.cb index 6ee1e63f18..3458caed06 100644 --- a/src/soc/amd/mendocino/chipset_mendocino.cb +++ b/src/soc/amd/mendocino/chipset_mendocino.cb @@ -16,7 +16,7 @@ chip soc/amd/mendocino device pci 02.4 alias gpp_bridge_3 hidden ops amd_external_pcie_gpp_ops end device pci 08.0 on end # Dummy device function, do not disable - device pci 08.1 alias gpp_bridge_a off # Internal GPP Bridge 0 to Bus A + device pci 08.1 alias gpp_bridge_a on # Internal GPP Bridge 0 to Bus A ops amd_internal_pcie_gpp_ops device pci 0.0 alias gfx off ops amd_graphics_ops end # Internal GPU (GFX) device pci 0.1 alias gfx_hda off end # Display HD Audio Controller (GFXAZ) @@ -65,7 +65,7 @@ chip soc/amd/mendocino device pci 0.6 alias hda off end # Audio Processor HD Audio Controller (main AZ) device pci 0.7 alias mp2 off end # Sensor Fusion Hub (MP2) end - device pci 08.3 alias gpp_bridge_c off # Internal GPP Bridge 2 to Bus C + device pci 08.3 alias gpp_bridge_c on # Internal GPP Bridge 2 to Bus C ops amd_internal_pcie_gpp_ops device pci 0.0 alias xhci_2 off end # Might also be a dummy device with different PCI DID # When using this as XHCI2, the mainboard devicetree needs to add ops xhci_pci_ops diff --git a/src/soc/amd/mendocino/chipset_rembrandt.cb b/src/soc/amd/mendocino/chipset_rembrandt.cb index ef3bfa9a56..aef0a8978b 100644 --- a/src/soc/amd/mendocino/chipset_rembrandt.cb +++ b/src/soc/amd/mendocino/chipset_rembrandt.cb @@ -18,7 +18,7 @@ chip soc/amd/mendocino device pci 02.6 alias gpp_bridge_5 hidden ops amd_external_pcie_gpp_ops end device pci 08.0 on end # Dummy device function, do not disable - device pci 08.1 alias gpp_bridge_a off # Internal GPP Bridge 0 to Bus A + device pci 08.1 alias gpp_bridge_a on # Internal GPP Bridge 0 to Bus A ops amd_internal_pcie_gpp_ops device pci 0.0 alias gfx off ops amd_graphics_ops end # Internal GPU (GFX) device pci 0.1 alias gfx_hda off end # Display HD Audio Controller (GFXAZ) @@ -67,8 +67,8 @@ chip soc/amd/mendocino device pci 0.6 alias hda off end # Audio Processor HD Audio Controller (main AZ) device pci 0.7 alias mp2 off end # Sensor Fusion Hub (MP2) end - device pci 08.2 alias gpp_bridge_b off ops amd_internal_pcie_gpp_ops end # Internal GPP Bridge 1 to Bus B - device pci 08.3 alias gpp_bridge_c off # Internal GPP Bridge 2 to Bus C + device pci 08.2 alias gpp_bridge_b on ops amd_internal_pcie_gpp_ops end # Internal GPP Bridge 1 to Bus B + device pci 08.3 alias gpp_bridge_c on # Internal GPP Bridge 2 to Bus C ops amd_internal_pcie_gpp_ops device pci 0.0 alias xhci_2 off end # Might also be a dummy device with different PCI DID # When using this as XHCI2, the mainboard devicetree needs to add ops xhci_pci_ops From 9cbde37fc3b1c2ffe77f988a7952a56cddfebfe6 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Fri, 14 Feb 2025 15:05:01 +0100 Subject: [PATCH 0107/3886] soc/amd/glinda: Fix pci int defs commit 540d605f4849 ("soc/amd/glinda: Update pci int defs") forgot to update the offset after adding GEventSmi and GEventSci. source: PPR #57254 Rev 1.59 Table 137 Change-Id: I702f16e681d57c5e44f91c805a9aeb71eb160bd3 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/86421 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/soc/amd/glinda/acpi/pci_int_defs.asl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/soc/amd/glinda/acpi/pci_int_defs.asl b/src/soc/amd/glinda/acpi/pci_int_defs.asl index 61ecd449b4..53ced22723 100644 --- a/src/soc/amd/glinda/acpi/pci_int_defs.asl +++ b/src/soc/amd/glinda/acpi/pci_int_defs.asl @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* TODO: Update for Glinda */ - /* PCI IRQ mapping registers, C00h-C01h. */ OperationRegion(PRQM, SystemIO, 0x00000c00, 0x00000002) Field(PRQM, ByteAcc, NoLock, Preserve) { @@ -51,7 +49,7 @@ IndexField(PRQI, PRQD, ByteAcc, NoLock, Preserve) { IORG, 0x00000008, /* Index 0x86: INTG */ IORH, 0x00000008, /* Index 0x87: INTH */ - Offset (0xE2), + Offset (0xE0), IGSC, 0x00000008, /* Index 0xE0: GEventSci */ IGSM, 0x00000008, /* Index 0xE1: GEventSmi */ IGPI, 0x00000008, /* Index 0xE2: GPIO */ From 5688932d255723410bea91addc46e2d6b415619e Mon Sep 17 00:00:00 2001 From: Ian Feng Date: Fri, 14 Feb 2025 13:54:57 +0800 Subject: [PATCH 0108/3886] mb/google/fatcat/var/francka: Configure the finger print pins Configure correct finger print pins, And change power sequence. FP_PWR_EN - GPP_H03 FP_RST_OD - GPP_H17 FPMCU_INT - GPP_D17 FPMCU_FW_UPDATE - GPP_F20 BUG=b:393985006 TEST=Boot to OS in francka and fingerprint function work well. Change-Id: I0d9b1d042da1bd81d0f3a32140247948cdab983c Signed-off-by: Ian Feng Reviewed-on: https://review.coreboot.org/c/coreboot/+/86413 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- .../google/fatcat/variants/francka/gpio.c | 20 +++++++++---------- .../fatcat/variants/francka/overridetree.cb | 14 +++++++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/francka/gpio.c b/src/mainboard/google/fatcat/variants/francka/gpio.c index 88191224de..6265b1667d 100644 --- a/src/mainboard/google/fatcat/variants/francka/gpio.c +++ b/src/mainboard/google/fatcat/variants/francka/gpio.c @@ -186,7 +186,7 @@ static const struct pad_config gpio_table[] = { /* GPP_D16: HDA_RST# */ PAD_NC(GPP_D16, NONE), /* GPP_D17: FPMCU_INT# */ - PAD_CFG_GPI_INT(GPP_D17, NONE, PLTRST, LEVEL), + PAD_CFG_GPI_IRQ_WAKE(GPP_D17, NONE, PWROK, LEVEL, INVERT), /* GPP_D18: CLKREQ_PCIE#6 */ PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), /* GPP_D19: SOC_SD_RST# */ @@ -286,16 +286,16 @@ static const struct pad_config gpio_table[] = { PAD_NC(GPP_F14, NONE), /* GPP_F15: Not used */ PAD_NC(GPP_F15, NONE), - /* GPP_F16: SOC_THC_1_RST# */ - PAD_CFG_GPO(GPP_F16, 0, DEEP), + /* GPP_F16: Not used */ + PAD_NC(GPP_F16, NONE), /* GPP_F17: SOC_THC_1_CS# */ PAD_CFG_NF(GPP_F17, NONE, DEEP, NF5), - /* GPP_F18: SOC_THC_1_INT# */ - PAD_CFG_GPI_APIC(GPP_F18, NONE, PWROK, LEVEL, INVERT), + /* GPP_F18: Not used */ + PAD_NC(GPP_F18, NONE), /* GPP_F19: Not used */ PAD_NC(GPP_F19, NONE), /* GPP_F20: AP_FP_FW_UP_STRAP */ - PAD_CFG_GPO(GPP_F20, 1, DEEP), + PAD_CFG_GPO_LOCK(GPP_F20, 0, LOCK_CONFIG), /* GPP_F22: Not used */ PAD_NC(GPP_F22, NONE), /* GPP_F23: SLP_S0#_GATE */ @@ -308,7 +308,7 @@ static const struct pad_config gpio_table[] = { /* GPP_H02: Not used */ PAD_NC(GPP_H02, NONE), /* GPP_H03: EN_PWR_FP */ - PAD_CFG_GPO(GPP_H03, 0, DEEP), + PAD_CFG_GPO(GPP_H03, 1, DEEP), /* GPP_H04: COEX1 */ PAD_CFG_NF(GPP_H04, NONE, DEEP, NF2), /* GPP_H05: COEX2 */ @@ -334,7 +334,7 @@ static const struct pad_config gpio_table[] = { /* GPP_H16: SOC_AUDIO_STRAP */ PAD_CFG_GPI(GPP_H16, NONE, DEEP), /* GPP_H17: FP_RST_1V8_OD# */ - PAD_CFG_GPO(GPP_H17, 1, DEEP), + PAD_CFG_GPO_LOCK(GPP_H17, 1, LOCK_CONFIG), /* GPP_H19: Not used*/ PAD_NC(GPP_H19, NONE), /* GPP_H20: Not used */ @@ -420,10 +420,10 @@ static const struct pad_config romstage_gpio_table[] = { PAD_CFG_NF(GPP_C00, NONE, DEEP, NF1), /* GPP_C01: SOC_SMBDATA */ PAD_CFG_NF(GPP_C01, NONE, DEEP, NF1), - /* GPP_F16: SOC_THC_1_RST# */ - PAD_CFG_GPO(GPP_F16, 0, DEEP), /* GPP_H03: EN_PWR_FP */ PAD_CFG_GPO(GPP_H03, 0, DEEP), + /* GPP_H17: FP_RST_1V8_OD# */ + PAD_CFG_GPO(GPP_H17, 0, DEEP), }; const struct pad_config *variant_gpio_table(size_t *num) diff --git a/src/mainboard/google/fatcat/variants/francka/overridetree.cb b/src/mainboard/google/fatcat/variants/francka/overridetree.cb index 58ced1aa07..580e96fb3a 100644 --- a/src/mainboard/google/fatcat/variants/francka/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/francka/overridetree.cb @@ -62,6 +62,12 @@ chip soc/intel/pantherlake [PchSerialIoIndexI2C4] = PchSerialIoPci, }" + register "serial_io_gspi_mode" = "{ + [PchSerialIoIndexGSPI0] = PchSerialIoDisabled, + [PchSerialIoIndexGSPI1] = PchSerialIoPci, + [PchSerialIoIndexGSPI0A] = PchSerialIoDisabled, + }" + # Intel Common SoC Config #+-------------------+---------------------------+ #| Field | Value | @@ -292,13 +298,13 @@ chip soc/intel/pantherlake register "hid" = "ACPI_DT_NAMESPACE_HID" register "uid" = "1" register "compat_string" = ""google,cros-ec-spi"" - register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_F18_IRQ)" - register "wake" = "GPE0_DW2_15" + register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_D17_IRQ)" + register "wake" = "GPE0_DW1_17" register "has_power_resource" = "true" - register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F16)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_H17)" register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_H03)" register "enable_delay_ms" = "3" - device spi 0 hidden end + device spi 0 on end end # FPMCU end end From c1ad986f3a2f68ea33c338ab16496ef1ddc260f7 Mon Sep 17 00:00:00 2001 From: John Su Date: Fri, 14 Feb 2025 14:55:25 +0800 Subject: [PATCH 0109/3886] mb/trulo/var/uldrenite: Fix WWAN_RST pin Fix WWAN_RST pin due to previous incorrect configuration. BUG=b:395430920 TEST=emerge-nissa coreboot Change-Id: I6012a11e5c54e79e31b0cbfca657174274658368 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86415 Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: Dtrain Hsu Reviewed-by: Subrata Banik --- .../google/brya/variants/uldrenite/include/variant/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h b/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h index 25edb0c108..612ea2adbb 100644 --- a/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h +++ b/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h @@ -7,7 +7,7 @@ #define WWAN_FCPO GPP_H23 #define WWAN_RST GPP_F12 -#define WWAN_PERST GPP_H13 +#define WWAN_PERST GPP_F13 #define T1_OFF_MS 20 #define T2_OFF_MS 10 From 19bcc7653b542cc75c9f8d200927cdba2f03c1c5 Mon Sep 17 00:00:00 2001 From: John Su Date: Fri, 14 Feb 2025 16:08:01 +0800 Subject: [PATCH 0110/3886] mb/trulo/var/uldrenite: Remove GPP_B5 and B6 as ISH function It will cause suspend to fail to enter S0ix. After discussion with SOC and HW teams, remove GPP_B5 and B6 as ISH function and disable ISH on the devicetree. BUG=b:383696667, b:395005219 TEST=emerge-nissa coreboot Change-Id: Id3d26f1b604b889f4fdb6e45218f4118499c303e Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86416 Tested-by: build bot (Jenkins) Reviewed-by: Dtrain Hsu Reviewed-by: Subrata Banik --- src/mainboard/google/brya/variants/uldrenite/gpio.c | 8 ++++---- .../google/brya/variants/uldrenite/overridetree.cb | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/gpio.c b/src/mainboard/google/brya/variants/uldrenite/gpio.c index f926e3ac47..3e11b48d0a 100644 --- a/src/mainboard/google/brya/variants/uldrenite/gpio.c +++ b/src/mainboard/google/brya/variants/uldrenite/gpio.c @@ -61,10 +61,10 @@ static const struct pad_config gpio_table[] = { PAD_CFG_GPI_IRQ_WAKE(GPP_B3, NONE, PWROK, LEVEL, INVERT), /* B4 : PROC_GP3 ==> EN_PP3300_UCAM_X */ PAD_CFG_GPO_LOCK(GPP_B4, 1, LOCK_CONFIG), - /* B5 : GPP_B5 ==> ISH_I2C0_SCL */ - PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_B5, NONE, DEEP, NF1), - /* B6 : GPP_B6 ==> ISH_I2C0_SDA */ - PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_B6, NONE, DEEP, NF1), + /* B5 : GPP_B5 ==> NC */ + PAD_NC(GPP_B5, NONE), + /* B6 : GPP_B6 ==> NC */ + PAD_NC(GPP_B6, NONE), /* B7 : GPP_B7 ==> NC */ PAD_NC_LOCK(GPP_B7, NONE, LOCK_CONFIG), /* B8 : GPP_B8 ==> NC */ diff --git a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb index 285db4aa96..dd129d7b9e 100644 --- a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb +++ b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb @@ -490,6 +490,7 @@ chip soc/intel/alderlake end probe DB_CELLULAR CELLULAR_RW350R end # PCIE2 WWAN card + device ref ish off end device ref shared_sram on end device ref heci1 on end device ref pmc hidden end From 4aeaa453e32d97e8a732de75192be8f6c3e84ea8 Mon Sep 17 00:00:00 2001 From: Hualin Wei Date: Thu, 13 Feb 2025 19:37:56 +0800 Subject: [PATCH 0111/3886] mb/google/nissa/var/pujjoniru: Update DTT settings for thermal control update DTT settings for thermal control, according to b:395802079#comment2. BUG=b:395802079 TEST=emerge-nissa coreboot Change-Id: Ia32911488464af4e5070543e2ec630c339ab1925 Signed-off-by: Hualin Wei Reviewed-on: https://review.coreboot.org/c/coreboot/+/86404 Reviewed-by: Qinghong Zeng Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- .../brya/variants/pujjoniru/overridetree.cb | 154 +++++++++++------- 1 file changed, 96 insertions(+), 58 deletions(-) diff --git a/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb b/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb index 11098ac4ed..60d3117d05 100644 --- a/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb +++ b/src/mainboard/google/brya/variants/pujjoniru/overridetree.cb @@ -101,35 +101,79 @@ chip soc/intel/alderlake .tdp_pl4 = 78, }" + register "power_limits_config[ADL_N_081_15W_CORE]" = "{ + .tdp_pl1_override = 15, + .tdp_pl2_override = 25, + .tdp_pl4 = 114, + }" + device domain 0 on device ref dtt on chip drivers/intel/dptf ## sensor information - register "options.tsr[0].desc" = ""CPU_VR"" + register "options.tsr[0].desc" = ""5V"" register "options.tsr[1].desc" = ""CPU"" - register "options.tsr[2].desc" = ""Ambient"" + register "options.tsr[2].desc" = ""AMB"" register "options.tsr[3].desc" = ""Charger"" # TODO: below values are initial reference values only + ## Active Policy + register "policies.active" = "{ + [0] = { + .target = DPTF_TEMP_SENSOR_0, + .thresholds = { + TEMP_PCT(80, 90), + TEMP_PCT(75, 80), + TEMP_PCT(70, 70), + TEMP_PCT(60, 50), + } + }, + [1] = { + .target = DPTF_TEMP_SENSOR_1, + .thresholds = { + TEMP_PCT(51, 69), + TEMP_PCT(48, 57), + TEMP_PCT(44, 50), + TEMP_PCT(42, 45), + TEMP_PCT(40, 39), + } + }, + [2] = { + .target = DPTF_TEMP_SENSOR_2, + .thresholds = { + TEMP_PCT(75, 90), + TEMP_PCT(70, 80), + TEMP_PCT(65, 70), + TEMP_PCT(55, 50), + } + }, + [3] = { + .target = DPTF_TEMP_SENSOR_3, + .thresholds = { + TEMP_PCT(90, 90), + TEMP_PCT(85, 80), + TEMP_PCT(75, 70), + TEMP_PCT(70, 50), + } + } + }" + ## Passive Policy register "policies.passive" = "{ - [0] = DPTF_PASSIVE(CPU, CPU, 85, 6000), - [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 85, 6000), - [2] = DPTF_PASSIVE(CPU, TEMP_SENSOR_1, 85, 6000), - [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 85, 5000), - [4] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_3, 85, 6000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_1, 85, 4000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_3, 80, 5000), }" ## Critical Policy register "policies.critical" = "{ - [0] = DPTF_CRITICAL(TEMP_SENSOR_1, 90, SHUTDOWN), - [1] = DPTF_CRITICAL(TEMP_SENSOR_2, 90, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_1, 95, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_3, 95, SHUTDOWN), }" register "controls.power_limits" = "{ .pl1 = { .min_power = 6000, - .max_power = 6000, + .max_power = 9000, .time_window_min = 28 * MSECS_PER_SEC, .time_window_max = 32 * MSECS_PER_SEC, .granularity = 200 @@ -145,9 +189,9 @@ chip soc/intel/alderlake ## Charger Performance Control (Control, mA) register "controls.charger_perf" = "{ - [0] = { 255, 3000 }, - [1] = { 24, 1500 }, - [2] = { 16, 1000 }, + [0] = { 255, 4200 }, + [1] = { 48, 3000 }, + [2] = { 32, 2000 }, [3] = { 8, 500 } }" @@ -175,9 +219,9 @@ chip soc/intel/alderlake chip drivers/intel/dptf ## sensor information - register "options.tsr[0].desc" = ""CPU_VR"" + register "options.tsr[0].desc" = ""5V"" register "options.tsr[1].desc" = ""CPU"" - register "options.tsr[2].desc" = ""Ambient"" + register "options.tsr[2].desc" = ""AMB"" register "options.tsr[3].desc" = ""Charger"" # TODO: below values are initial reference values only @@ -186,70 +230,64 @@ chip soc/intel/alderlake [0] = { .target = DPTF_TEMP_SENSOR_0, .thresholds = { - TEMP_PCT(85, 90), - TEMP_PCT(54, 64), - TEMP_PCT(52, 52), - TEMP_PCT(50, 44), - TEMP_PCT(48, 38), - TEMP_PCT(45, 34), + TEMP_PCT(80, 90), + TEMP_PCT(75, 80), + TEMP_PCT(70, 70), + TEMP_PCT(65, 50), } }, [1] = { .target = DPTF_TEMP_SENSOR_1, .thresholds = { - TEMP_PCT(75, 90), - TEMP_PCT(70, 80), - TEMP_PCT(65, 70), - TEMP_PCT(60, 60), - TEMP_PCT(55, 50), - TEMP_PCT(50, 40), + TEMP_PCT(51, 69), + TEMP_PCT(48, 57), + TEMP_PCT(44, 50), + TEMP_PCT(42, 45), + TEMP_PCT(40, 39), } }, [2] = { .target = DPTF_TEMP_SENSOR_2, + .thresholds = { + TEMP_PCT(75, 90), + TEMP_PCT(70, 80), + TEMP_PCT(65, 70), + TEMP_PCT(55, 50), + } + }, + [3] = { + .target = DPTF_TEMP_SENSOR_3, .thresholds = { TEMP_PCT(90, 90), TEMP_PCT(85, 80), TEMP_PCT(75, 70), TEMP_PCT(70, 50), } - }, - [3] = { - .target = DPTF_TEMP_SENSOR_3, - .thresholds = { - TEMP_PCT(80, 90), - TEMP_PCT(75, 80), - TEMP_PCT(70, 70), - TEMP_PCT(65, 50), - } } }" ## Passive Policy register "policies.passive" = "{ - [0] = DPTF_PASSIVE(CPU, CPU, 85, 6000), - [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 85, 6000), - [2] = DPTF_PASSIVE(CPU, TEMP_SENSOR_1, 85, 6000), - [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 85, 6000), - [4] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_3, 85, 6000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_1, 85, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_3, 80, 5000), }" ## Critical Policy register "policies.critical" = "{ - [0] = DPTF_CRITICAL(TEMP_SENSOR_1, 90, SHUTDOWN), - [1] = DPTF_CRITICAL(TEMP_SENSOR_2, 90, SHUTDOWN), + [0] = DPTF_CRITICAL(TEMP_SENSOR_1, 95, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_3, 95, SHUTDOWN), }" register "controls.power_limits" = "{ .pl1 = { - .min_power = 15000, + .min_power = 12000, .max_power = 15000, .time_window_min = 28 * MSECS_PER_SEC, .time_window_max = 32 * MSECS_PER_SEC, .granularity = 200 }, .pl2 = { - .min_power = 35000, - .max_power = 35000, + .min_power = 25000, + .max_power = 25000, .time_window_min = 28 * MSECS_PER_SEC, .time_window_max = 32 * MSECS_PER_SEC, .granularity = 1000 @@ -258,23 +296,23 @@ chip soc/intel/alderlake ## Charger Performance Control (Control, mA) register "controls.charger_perf" = "{ - [0] = { 255, 3000 }, - [1] = { 24, 2000 }, - [2] = { 16, 1000 }, + [0] = { 255, 4200 }, + [1] = { 48, 3000 }, + [2] = { 32, 2000 }, [3] = { 8, 500 } }" ## Fan Performance Control (Percent, Speed, Noise, Power) register "controls.fan_perf" = "{ - [0] = { 100, 4000, 220, 1640, }, - [1] = { 90, 3700, 220, 1640, }, - [2] = { 80, 3500, 180, 1310, }, - [3] = { 70, 3300, 145, 1030, }, - [4] = { 60, 3100, 115, 765, }, - [5] = { 50, 2800, 90, 545, }, - [6] = { 40, 2500, 55, 365, }, - [7] = { 30, 2100, 30, 220, }, - [8] = { 20, 1500, 15, 120, }, + [0] = { 90, 4734, 220, 1640, }, + [1] = { 80, 4443, 180, 1310, }, + [2] = { 70, 4108, 145, 1030, }, + [3] = { 60, 3752, 115, 765, }, + [4] = { 50, 3352, 90, 545, }, + [5] = { 40, 2897, 55, 365, }, + [6] = { 30, 2363, 30, 220, }, + [7] = { 20, 1752, 15, 120, }, + [8] = { 10, 918, 10, 60, }, [9] = { 0, 0, 0, 50, } }" From ac6212805d471c20d91ba79ab0d71c79d9c62336 Mon Sep 17 00:00:00 2001 From: Ivy Jian Date: Thu, 13 Feb 2025 14:42:14 +0800 Subject: [PATCH 0112/3886] src/Kconfig: Add config SYSTEM_TYPE_BOX Add config SYSTEM_TYPE_BOX to allow proper system type selection for devices like chromebox, mac-mini etc. Change-Id: I887413cbc09fb0725b2ffd621fe10991b7dbcf6d Signed-off-by: Ivy Jian Reviewed-on: https://review.coreboot.org/c/coreboot/+/86396 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Eric Lai --- src/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Kconfig b/src/Kconfig index 320d6db32c..1d71840308 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -652,6 +652,13 @@ endmenu # load site-local kconfig to allow user specific defaults and overrides source "site-local/Kconfig" +config SYSTEM_TYPE_BOX + default n + bool + help + For devices like chromebox, mac-mini etc. These devices + without built-in display and operates on AC supply alone. + config SYSTEM_TYPE_LAPTOP default n bool From 6e3c56dcd011a61de4a4dc9ea46666305de8a7ef Mon Sep 17 00:00:00 2001 From: Ivy Jian Date: Thu, 13 Feb 2025 14:45:44 +0800 Subject: [PATCH 0113/3886] mb/google/brya/Kconfig: Select SYSTEM_TYPE_BOX for Dirks Dirks is a Chromebox device, so select SYSTEM_TYPE_BOX for it. Other nissa variants will continue to have SYSTEM_TYPE_LAPTOP selected. BUG=b:389391653 TEST=emerge-nissa coreboot check CONFIG_CSE_RESET_CLEAR_EC_AP_IDLE_FLAG=y check CONFIG_CR50_RESET_CLEAR_EC_AP_IDLE_FLAG=y Change-Id: Iabc9afdfdb07d4d6cb4d3fb4b43bfdc3cf2aa383 Signed-off-by: Ivy Jian Reviewed-on: https://review.coreboot.org/c/coreboot/+/86392 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Eric Lai --- src/mainboard/google/brya/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 8d09f2e562..213d49967c 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -97,7 +97,7 @@ config BOARD_GOOGLE_BASEBOARD_NISSA select SOC_INTEL_ALDERLAKE_PCH_N select SOC_INTEL_CSE_LITE_COMPRESS_ME_RW select SOC_INTEL_CSE_LITE_SYNC_IN_RAMSTAGE - select SYSTEM_TYPE_LAPTOP + select SYSTEM_TYPE_LAPTOP if !SYSTEM_TYPE_BOX select TPM_GOOGLE_TI50 select SOC_INTEL_COMMON_MMC_OVERRIDE @@ -223,6 +223,7 @@ config BOARD_GOOGLE_CROTA config BOARD_GOOGLE_DIRKS select BOARD_GOOGLE_BASEBOARD_NISSA select SOC_INTEL_TWINLAKE + select SYSTEM_TYPE_BOX config BOARD_GOOGLE_DOCHI select BOARD_GOOGLE_BASEBOARD_BRYA From 29054bc9c76d22c6fb0058bbe3dd5609dd07598e Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 13 Feb 2025 11:35:46 +0530 Subject: [PATCH 0114/3886] soc/intel/pantherlake: Skip exposing CPUJTAG at kernel This patch prevents exposing the CPU JTAG GPIO pads. These are internal GPIO pins used for debugging the SoC and should not be configurable from the kernel pinctrl driver. TEST=Able to build and boot google/fatat. Decompile ACPI table using iasl and ensure CPUJTAG entry not present. Change-Id: I4d920acb95275fbf72b83b822eddc41829511626 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86393 Tested-by: build bot (Jenkins) Reviewed-by: Dinesh Gehlot Reviewed-by: Jayvik Desai Reviewed-by: Eric Lai --- src/soc/intel/pantherlake/acpi/gpio.asl | 43 ++++--------------- .../pantherlake/include/soc/gpio_soc_defs.h | 1 - 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/src/soc/intel/pantherlake/acpi/gpio.asl b/src/soc/intel/pantherlake/acpi/gpio.asl index c16513b801..653f00b72b 100644 --- a/src/soc/intel/pantherlake/acpi/gpio.asl +++ b/src/soc/intel/pantherlake/acpi/gpio.asl @@ -27,10 +27,10 @@ Method (GADD, 1, NotSerialized) Local1 = Arg0 - COM1_GRP_PAD_START } /* GPIO Community 3 */ - If (Arg0 >= COM3_GRP_PAD_START && Arg0 <= COM3_GRP_PAD_END) + If (Arg0 >= GPP_H00 && Arg0 <= COM3_GRP_PAD_END) { Local0 = PID_GPIOCOM3 - Local1 = Arg0 - COM3_GRP_PAD_START + Local1 = Arg0 - GPP_H00 } /* GPIO Community 4 */ If (Arg0 >= COM4_GRP_PAD_START && Arg0 <= COM4_GRP_PAD_END) @@ -438,7 +438,7 @@ Device (GPI1) } } -/* GPIO Community 3: CPUJTAG, GPP_H, GPP_A, VGPIO3 */ +/* GPIO Community 3: GPP_H, GPP_A, VGPIO3 */ Device (GPI3) { Name (_HID, ACPI_GPIO_HID) @@ -471,7 +471,7 @@ Device (GPI3) Package (0x02) { "intc-gpio-group-count", - NUM_COM3_GROUPS + NUM_COM3_GROUPS - 1 /* Skip CPUJTAG */ }, Package (0x02) @@ -508,12 +508,6 @@ Device (GPI3) ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package (0x04) { - Package (0x02) - { - "intc-gpio-group-0-subproperties", - JTAG - }, - Package (0x02) { "intc-gpio-group-1-subproperties", @@ -533,31 +527,10 @@ Device (GPI3) } } }) - /* first bank/group in community 3: CPUJTAG */ - Name (JTAG, Package (0x02) - { - ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), - Package (0x03) - { - Package (0x02) - { - "intc-gpio-group-name", - GPP_CPUJTAG_NAME - }, - - Package (0x02) - { - "intc-gpio-pad-count", - NUM_GRP_CPUJTAG_PADS - }, - - Package (0x02) - { - "intc-gpio-group-offset", - GPP_CPUJTAG_START_OFFSET - } - } - }) + /* + * Don't expose first bank/group in community 3: CPUJTAG because + * CPUJTAG doesn't required to be controlled by kernel pinctrl driver. + */ /* 2nd bank/group in community 3: GPP_H */ Name (GPPH, Package (0x02) { diff --git a/src/soc/intel/pantherlake/include/soc/gpio_soc_defs.h b/src/soc/intel/pantherlake/include/soc/gpio_soc_defs.h index 0937d1e81f..69f2f7e4ac 100644 --- a/src/soc/intel/pantherlake/include/soc/gpio_soc_defs.h +++ b/src/soc/intel/pantherlake/include/soc/gpio_soc_defs.h @@ -37,7 +37,6 @@ #define GPP_C_NAME "GPP_C" #define GPP_F_NAME "GPP_F" #define GPP_E_NAME "GPP_E" -#define GPP_CPUJTAG_NAME "GPUJTAG" #define GPP_H_NAME "GPP_H" #define GPP_A_NAME "GPP_A" #define GPP_VGPIO3_NAME "vGPIO_3" From 145b174116e8a1eaac8add48090835248f3dd17d Mon Sep 17 00:00:00 2001 From: Riku Viitanen Date: Fri, 14 Feb 2025 01:02:11 +0200 Subject: [PATCH 0115/3886] mb/hp/snb_ivb_desktops/dt: Remove what matches defaults These are unnecessary because they are the same as the chipset devicetree defaults. Change-Id: Id26f09674457720ad56a19b6b0884b8012be9019 Signed-off-by: Riku Viitanen Reviewed-on: https://review.coreboot.org/c/coreboot/+/86412 Reviewed-by: Nicholas Chin Tested-by: build bot (Jenkins) --- .../hp/snb_ivb_desktops/devicetree.cb | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/mainboard/hp/snb_ivb_desktops/devicetree.cb b/src/mainboard/hp/snb_ivb_desktops/devicetree.cb index 6f3d28ea9b..a381c3b2a5 100644 --- a/src/mainboard/hp/snb_ivb_desktops/devicetree.cb +++ b/src/mainboard/hp/snb_ivb_desktops/devicetree.cb @@ -1,44 +1,27 @@ ## SPDX-License-Identifier: GPL-2.0-only chip northbridge/intel/sandybridge - register "gfx.use_spread_spectrum_clock" = "0" - register "gpu_dp_b_hotplug" = "0" - register "gpu_dp_c_hotplug" = "0" - register "gpu_dp_d_hotplug" = "0" # BTX mainboard: Reversed mapping register "spd_addresses" = "{0x53, 0x52, 0x51, 0x50}" device domain 0 on - device ref host_bridge on end device ref peg10 on end device ref igd on end - device ref peg60 off end chip southbridge/intel/bd82x6x # Intel Series 7 PCH - register "docking_supported" = "false" register "gen1_dec" = "0x00fc0601" register "gen2_dec" = "0x00fc0801" - register "pcie_hotplug_map" = "{ 0, 0, 0, 0, 0, 0, 0, 0 }" register "pcie_port_coalesce" = "true" register "sata_interface_speed_support" = "0x3" register "spi_lvscc" = "0x2005" register "spi_uvscc" = "0x2005" - device ref mei1 on end - device ref mei2 off end - device ref me_ide_r off end device ref me_kt on end device ref gbe on end device ref ehci2 on end device ref hda on end device ref pcie_rp1 on end - device ref pcie_rp2 off end - device ref pcie_rp3 off end - device ref pcie_rp4 off end device ref pcie_rp5 on end - device ref pcie_rp6 off end - device ref pcie_rp7 off end - device ref pcie_rp8 off end device ref ehci1 on end device ref pci_bridge on end device ref lpc on @@ -147,9 +130,6 @@ chip northbridge/intel/sandybridge end end device ref sata1 on end - device ref smbus on end - device ref sata2 off end - device ref thermal off end end end end From d1a5a345b4593adde9d04f8d8cba5cdbb1cdfc20 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Mon, 17 Feb 2025 08:20:24 +0000 Subject: [PATCH 0116/3886] Update arm-trusted-firmware submodule to upstream master Updating from commit id 15e5c6c91d48: 2024-12-05 16:00:37 +0100 - (Merge changes I00d2de7b,I5ec82646 into integration) to commit id 0c370e2d592b: 2025-02-04 18:14:07 +0100 - (Merge "feat(mt8196): add SMMU driver for PM" into integration) This brings in 414 new commits. Change-Id: I5cb4fab45fb82463f0ae3332e46995d30d123352 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86478 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- 3rdparty/arm-trusted-firmware | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/arm-trusted-firmware b/3rdparty/arm-trusted-firmware index 15e5c6c91d..0c370e2d59 160000 --- a/3rdparty/arm-trusted-firmware +++ b/3rdparty/arm-trusted-firmware @@ -1 +1 @@ -Subproject commit 15e5c6c91d483aa52908154cc80e48956e234232 +Subproject commit 0c370e2d592b96554ac6d5dca4242733ab14300f From f07b2f2091afbaa423bb6a47e2edf912f720abf4 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Mon, 17 Feb 2025 17:22:58 +0100 Subject: [PATCH 0117/3886] mb/google/kukui: Drop non-existent directory from subdir-y Change-Id: Ifafec925439375dc2c9237244eff24c7bbe56bd6 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/86486 Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu --- src/mainboard/google/kukui/Makefile.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mainboard/google/kukui/Makefile.mk b/src/mainboard/google/kukui/Makefile.mk index 7b0298d61e..e1df671d56 100644 --- a/src/mainboard/google/kukui/Makefile.mk +++ b/src/mainboard/google/kukui/Makefile.mk @@ -1,7 +1,6 @@ ## SPDX-License-Identifier: GPL-2.0-only subdirs-y += sdram_params/ -subdirs-y += panel_params/ bootblock-y += bootblock.c bootblock-y += reset.c From 31d583facacfe112aea609dd1b43e0e854d3eec4 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 14 Feb 2025 19:16:50 +0530 Subject: [PATCH 0118/3886] soc/intel/pantherlake: Enable Thunderbolt authentication This commit enables Thunderbolt authentication for Panther Lake by assigning `ioe_tcss_valid_tbt_auth` to the valid_tbt_auth field in `soc_tcss_ops`. For the SoC's integrated PD solution, AUX BIAS PAD programming is not required and has been removed. TEST=Verified all USB-C ports are functional. With this patch, \_SB.PCI0.TDM0._DSD exists in the SSDT, containing: ``` Scope (\_SB.PCI0.TDM0) { Name (_DSD, Package (0x04) // _DSD: Device-Specific Data { ToUUID ("c44d002f-69f9-4e7d-a904-a7baabdf43f7"), Package (0x01) { Package (0x02) { "IMR_VALID", One } }, ToUUID ("6c501103-c189-4296-ba72-9bf5a26ebe5d"), Package (0x01) { Package (0x02) { "WAKE_SUPPORTED", One } } } ``` Change-Id: I28eac7cfd6511d8680cdae4f830afa73ad201a17 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86420 Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai Reviewed-by: Dinesh Gehlot Reviewed-by: Kapil Porwal --- src/soc/intel/pantherlake/tcss.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/soc/intel/pantherlake/tcss.c b/src/soc/intel/pantherlake/tcss.c index 99cbdd2d67..c66a5c68ce 100644 --- a/src/soc/intel/pantherlake/tcss.c +++ b/src/soc/intel/pantherlake/tcss.c @@ -2,9 +2,15 @@ #include #include +#include const struct soc_tcss_ops tcss_ops = { -/* TODO: Implement AUX BIAS PAD Programming if required */ .configure_aux_bias_pads = NULL, - .valid_tbt_auth = NULL, + .valid_tbt_auth = ioe_tcss_valid_tbt_auth, }; + +bool ioe_tcss_valid_tbt_auth(void) +{ + const config_t *config = config_of_soc(); + return config->tbt_authentication; +} From cae4caaf8461cbaf6f2d80ca69d616f4c60805d8 Mon Sep 17 00:00:00 2001 From: Cliff Huang Date: Wed, 5 Feb 2025 15:19:35 -0800 Subject: [PATCH 0119/3886] soc/intel/pantherlake: Enable multiple ACPI devices for GPIO In the Panther Lake architecture, each GPIO community functions as a separate pin control entity. Therefore, when specifying a GPIO identifier, one should use the community-specific offset, not the number from the first pad within the GPIO series. This is achieved by selecting the Kconfig option SOC_INTEL_COMMON_BLOCK_GPIO_MULTI_ACPI_DEVICES within the Panther Lake SOC Kconfig file. The numbers within the _CRS GpioInt and GpIo objects in the SSDT should be offsets within the community. The GPIO identifier employed should correspond to the offset from the respective community. Let's take an example. In the fatcat board overridetree.cb, ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E19) points to GPIO Group E. The pad starts at 74. It is inside community 1, which starts at 48. The correct GPIO reference is (19 + 74) - 48 = 45, or 0x002D in hexadecimal. Here are two notable changes in the fatcat board SSDT introduced by this commit. - ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E19) "\\_SB.PCI0.GPI1", 0x00, ResourceConsumer, , ) { // Pin list - 0x0033 + 0x002D } }) Name (_DSD, Package (0x02) // _DSD: Device-Specific Data - ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A16) "\\_SB.PCI0.GPI3", 0x00, ResourceConsumer, , ) { // Pin list - 0x0050 + 0x003B } }) Name (_DSD, Package (0x02) // _DSD: Device-Specific Data This change is verified via S0ix in Google Fatcat board with touchscreen/touchpad attached as the wake source. BUG=none TEST=Check the number from CRS GpinInt and GpIo objects in the SSDT, and ensure that the GPIO number used matches the community offset. Configure touchscreen/touchpad in THC-i2c mode on factcat board and enter S0ix and check that it can be waked by touchscreen/touchpad. Signed-off-by: Cliff Huang Change-Id: Ic2ba67518fa173e13975478ccae5f8a1772ebf08 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86290 Tested-by: build bot (Jenkins) Reviewed-by: Bora Guvendik Reviewed-by: Subrata Banik --- src/soc/intel/pantherlake/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/soc/intel/pantherlake/Kconfig b/src/soc/intel/pantherlake/Kconfig index 53260208bf..df95e529e3 100644 --- a/src/soc/intel/pantherlake/Kconfig +++ b/src/soc/intel/pantherlake/Kconfig @@ -65,6 +65,7 @@ config SOC_INTEL_PANTHERLAKE_BASE select SOC_INTEL_COMMON_BLOCK_GPIO_DUAL_ROUTE_SUPPORT select SOC_INTEL_COMMON_BLOCK_GPIO_IOSTANDBY select SOC_INTEL_COMMON_BLOCK_GPIO_LOCK_USING_PCR + select SOC_INTEL_COMMON_BLOCK_GPIO_MULTI_ACPI_DEVICES select SOC_INTEL_COMMON_BLOCK_GPIO_PMODE_4BITS select SOC_INTEL_COMMON_BLOCK_GSPI_VERSION_2 select SOC_INTEL_COMMON_BLOCK_HDA From 6e6b5ed915ba6dd9bbc42aedf099e98672e8d220 Mon Sep 17 00:00:00 2001 From: Tyler Wang Date: Mon, 2 Dec 2024 20:02:43 +0800 Subject: [PATCH 0120/3886] mb/google/rex/var/kanix: Add Fn key scancode The Fn key on kanix emits the scancode 94 (0x5e). BUG=b:384580437 TEST=Build and test on kanix, the fn key works normally Change-Id: Ia693813dafe1bd35840dfb892827598a7ca9c88f Signed-off-by: Tyler Wang Reviewed-on: https://review.coreboot.org/c/coreboot/+/85438 Reviewed-by: Ren Kuo Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/mainboard/google/rex/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/rex/Kconfig b/src/mainboard/google/rex/Kconfig index 73f28f335f..8dcd5cc957 100644 --- a/src/mainboard/google/rex/Kconfig +++ b/src/mainboard/google/rex/Kconfig @@ -71,6 +71,7 @@ config BOARD_GOOGLE_MODEL_KANIX def_bool n select BOARD_GOOGLE_BASEBOARD_REX select DRIVERS_GENERIC_ALC1015 + select MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD select RT8168_GEN_ACPI_POWER_RESOURCE select RT8168_GET_MAC_FROM_VPD select RT8168_SET_LED_MODE From 6304435023d32331ac9922d1b7f18f7e6e2fe9f7 Mon Sep 17 00:00:00 2001 From: Alok Agarwal Date: Thu, 6 Feb 2025 15:53:01 +0530 Subject: [PATCH 0121/3886] vc/intel/fsp/ptl: Update header files from 2454_00 to 3015_00 Update header files for FSP for Panther Lake platform to version 3015_00, with the previous version being 2454_00. Changes include: - Updating UPD Offset in FspmUpd.h and FspsUpd.h - Adding Sign-of-Life related UPDs in FspmUpd.h - Adding VMD related UPDs in FspsUpd.h BUG=b:394189627 TEST=Able to build google/fatcat. Change-Id: I87176515d4bdd8906842fd7c2ade1e6acd339212 Signed-off-by: Alok Agarwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/86297 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai Reviewed-by: Bora Guvendik Reviewed-by: Kapil Porwal --- .../intel/fsp/fsp2_0/pantherlake/FspmUpd.h | 2207 +++++++++-------- .../intel/fsp/fsp2_0/pantherlake/FspsUpd.h | 511 ++-- 2 files changed, 1460 insertions(+), 1258 deletions(-) diff --git a/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspmUpd.h b/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspmUpd.h index 2c38f00c4b..82a790eec3 100644 --- a/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspmUpd.h +++ b/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspmUpd.h @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2024, Intel Corporation. All rights reserved.
+Copyright (c) 2025, Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -230,659 +230,191 @@ typedef struct { **/ UINT16 RcompTarget[5]; -/** Offset 0x011C - LowerBasicMemTestSize feature +/** Offset 0x011C - Dqs Map CPU to DRAM MC 0 CH 0 + Set Dqs mapping relationship between CPU and DRAM, Channel 0: board-dependent +**/ + UINT8 DqsMapCpu2DramMc0Ch0[2]; + +/** Offset 0x011E - Dqs Map CPU to DRAM MC 0 CH 1 + Set Dqs mapping relationship between CPU and DRAM, Channel 1: board-dependent +**/ + UINT8 DqsMapCpu2DramMc0Ch1[2]; + +/** Offset 0x0120 - Dqs Map CPU to DRAM MC 0 CH 2 + Set Dqs mapping relationship between CPU and DRAM, Channel 2: board-dependent +**/ + UINT8 DqsMapCpu2DramMc0Ch2[2]; + +/** Offset 0x0122 - Dqs Map CPU to DRAM MC 0 CH 3 + Set Dqs mapping relationship between CPU and DRAM, Channel 3: board-dependent +**/ + UINT8 DqsMapCpu2DramMc0Ch3[2]; + +/** Offset 0x0124 - Dqs Map CPU to DRAM MC 1 CH 0 + Set Dqs mapping relationship between CPU and DRAM, Channel 0: board-dependent +**/ + UINT8 DqsMapCpu2DramMc1Ch0[2]; + +/** Offset 0x0126 - Dqs Map CPU to DRAM MC 1 CH 1 + Set Dqs mapping relationship between CPU and DRAM, Channel 1: board-dependent +**/ + UINT8 DqsMapCpu2DramMc1Ch1[2]; + +/** Offset 0x0128 - Dqs Map CPU to DRAM MC 1 CH 2 + Set Dqs mapping relationship between CPU and DRAM, Channel 2: board-dependent +**/ + UINT8 DqsMapCpu2DramMc1Ch2[2]; + +/** Offset 0x012A - Dqs Map CPU to DRAM MC 1 CH 3 + Set Dqs mapping relationship between CPU and DRAM, Channel 3: board-dependent +**/ + UINT8 DqsMapCpu2DramMc1Ch3[2]; + +/** Offset 0x012C - Dq Map CPU to DRAM MC 0 CH 0 + Set Dq mapping relationship between CPU and DRAM, Channel 0: board-dependent +**/ + UINT8 DqMapCpu2DramMc0Ch0[16]; + +/** Offset 0x013C - Dq Map CPU to DRAM MC 0 CH 1 + Set Dq mapping relationship between CPU and DRAM, Channel 1: board-dependent +**/ + UINT8 DqMapCpu2DramMc0Ch1[16]; + +/** Offset 0x014C - Dq Map CPU to DRAM MC 0 CH 2 + Set Dq mapping relationship between CPU and DRAM, Channel 2: board-dependent +**/ + UINT8 DqMapCpu2DramMc0Ch2[16]; + +/** Offset 0x015C - Dq Map CPU to DRAM MC 0 CH 3 + Set Dq mapping relationship between CPU and DRAM, Channel 3: board-dependent +**/ + UINT8 DqMapCpu2DramMc0Ch3[16]; + +/** Offset 0x016C - Dq Map CPU to DRAM MC 1 CH 0 + Set Dq mapping relationship between CPU and DRAM, Channel 0: board-dependent +**/ + UINT8 DqMapCpu2DramMc1Ch0[16]; + +/** Offset 0x017C - Dq Map CPU to DRAM MC 1 CH 1 + Set Dq mapping relationship between CPU and DRAM, Channel 1: board-dependent +**/ + UINT8 DqMapCpu2DramMc1Ch1[16]; + +/** Offset 0x018C - Dq Map CPU to DRAM MC 1 CH 2 + Set Dq mapping relationship between CPU and DRAM, Channel 2: board-dependent +**/ + UINT8 DqMapCpu2DramMc1Ch2[16]; + +/** Offset 0x019C - Dq Map CPU to DRAM MC 1 CH 3 + Set Dq mapping relationship between CPU and DRAM, Channel 3: board-dependent +**/ + UINT8 DqMapCpu2DramMc1Ch3[16]; + +/** Offset 0x01AC - LowerBasicMemTestSize Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, shorter BasicMemTest (faster boot) $EN_DIS **/ UINT8 LowerBasicMemTestSize; -/** Offset 0x011D - Reserved +/** Offset 0x01AD - Reserved **/ UINT8 Reserved5[2]; -/** Offset 0x011F - CaVrefHigh feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS +/** Offset 0x01AF - CaVrefHigh + DDR5 CA Sweep High Vref Value for DDR5 OC **/ UINT8 CaVrefHigh; -/** Offset 0x0120 - CsVrefLow feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT8 CsVrefLow; - -/** Offset 0x0121 - CsVrefHigh feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT8 CsVrefHigh; - -/** Offset 0x0122 - CaVrefLow feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS +/** Offset 0x01B0 - CaVrefLow + DDR5 CA Sweep Low Vref Value for DDR5 OC **/ UINT8 CaVrefLow; -/** Offset 0x0123 - DFETap2StepSize feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS +/** Offset 0x01B1 - CsVrefHigh + DDR5 CS Sweep High Vref Value for DDR5 OC **/ - UINT8 DFETap2StepSize; + UINT8 CsVrefHigh; -/** Offset 0x0124 - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS +/** Offset 0x01B2 - CsVrefLow + DDR5 CS Sweep Low Vref Value for DDR5 OC **/ - UINT16 Vdd2Mv; + UINT8 CsVrefLow; -/** Offset 0x0126 - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tWTR_S; - -/** Offset 0x0128 - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tCCD_L; - -/** Offset 0x012A - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tWTR_L; - -/** Offset 0x012C - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tRRD_S; - -/** Offset 0x012E - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tRRD_L; - -/** Offset 0x0130 - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tRFC4; - -/** Offset 0x0132 - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tRFC2; - -/** Offset 0x0134 - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT16 tRFCpb; - -/** Offset 0x0136 - Reserved -**/ - UINT8 Reserved6[7]; - -/** Offset 0x013D - Vdd2Mv feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS -**/ - UINT8 LpMode; - -/** Offset 0x013E - LowerBasicMemTestSize feature - Reduce BasicMemTest size. 0: Disabled (default), regular BasicMemTest. 1: Enabled, - shorter BasicMemTest (faster boot) - $EN_DIS +/** Offset 0x01B3 - DIMM DFE Tap1 Step Size + DIMM DFE Tap1 Step Size for DDR5 OC **/ UINT8 DFETap1StepSize; -/** Offset 0x013F - Dqs Map CPU to DRAM MC 0 CH 0 - Set Dqs mapping relationship between CPU and DRAM, Channel 0: board-dependent +/** Offset 0x01B4 - DIMM DFE Tap2 Step Size + DIMM DFE Tap2 Step Size for DDR5 OC **/ - UINT8 DqsMapCpu2DramMc0Ch0[2]; + UINT8 DFETap2StepSize; -/** Offset 0x0141 - Dqs Map CPU to DRAM MC 0 CH 1 - Set Dqs mapping relationship between CPU and DRAM, Channel 1: board-dependent +/** Offset 0x01B5 - Reserved **/ - UINT8 DqsMapCpu2DramMc0Ch1[2]; + UINT8 Reserved6; -/** Offset 0x0143 - Dqs Map CPU to DRAM MC 0 CH 2 - Set Dqs mapping relationship between CPU and DRAM, Channel 2: board-dependent +/** Offset 0x01B6 - VDD2 override + VDD2 override for DDR5 OC; 0 - Auto **/ - UINT8 DqsMapCpu2DramMc0Ch2[2]; + UINT16 Vdd2Mv; -/** Offset 0x0145 - Dqs Map CPU to DRAM MC 0 CH 3 - Set Dqs mapping relationship between CPU and DRAM, Channel 3: board-dependent -**/ - UINT8 DqsMapCpu2DramMc0Ch3[2]; - -/** Offset 0x0147 - Dqs Map CPU to DRAM MC 1 CH 0 - Set Dqs mapping relationship between CPU and DRAM, Channel 0: board-dependent -**/ - UINT8 DqsMapCpu2DramMc1Ch0[2]; - -/** Offset 0x0149 - Dqs Map CPU to DRAM MC 1 CH 1 - Set Dqs mapping relationship between CPU and DRAM, Channel 1: board-dependent -**/ - UINT8 DqsMapCpu2DramMc1Ch1[2]; - -/** Offset 0x014B - Dqs Map CPU to DRAM MC 1 CH 2 - Set Dqs mapping relationship between CPU and DRAM, Channel 2: board-dependent -**/ - UINT8 DqsMapCpu2DramMc1Ch2[2]; - -/** Offset 0x014D - Dqs Map CPU to DRAM MC 1 CH 3 - Set Dqs mapping relationship between CPU and DRAM, Channel 3: board-dependent -**/ - UINT8 DqsMapCpu2DramMc1Ch3[2]; - -/** Offset 0x014F - Dq Map CPU to DRAM MC 0 CH 0 - Set Dq mapping relationship between CPU and DRAM, Channel 0: board-dependent -**/ - UINT8 DqMapCpu2DramMc0Ch0[16]; - -/** Offset 0x015F - Dq Map CPU to DRAM MC 0 CH 1 - Set Dq mapping relationship between CPU and DRAM, Channel 1: board-dependent -**/ - UINT8 DqMapCpu2DramMc0Ch1[16]; - -/** Offset 0x016F - Dq Map CPU to DRAM MC 0 CH 2 - Set Dq mapping relationship between CPU and DRAM, Channel 2: board-dependent -**/ - UINT8 DqMapCpu2DramMc0Ch2[16]; - -/** Offset 0x017F - Dq Map CPU to DRAM MC 0 CH 3 - Set Dq mapping relationship between CPU and DRAM, Channel 3: board-dependent -**/ - UINT8 DqMapCpu2DramMc0Ch3[16]; - -/** Offset 0x018F - Dq Map CPU to DRAM MC 1 CH 0 - Set Dq mapping relationship between CPU and DRAM, Channel 0: board-dependent -**/ - UINT8 DqMapCpu2DramMc1Ch0[16]; - -/** Offset 0x019F - Dq Map CPU to DRAM MC 1 CH 1 - Set Dq mapping relationship between CPU and DRAM, Channel 1: board-dependent -**/ - UINT8 DqMapCpu2DramMc1Ch1[16]; - -/** Offset 0x01AF - Dq Map CPU to DRAM MC 1 CH 2 - Set Dq mapping relationship between CPU and DRAM, Channel 2: board-dependent -**/ - UINT8 DqMapCpu2DramMc1Ch2[16]; - -/** Offset 0x01BF - Dq Map CPU to DRAM MC 1 CH 3 - Set Dq mapping relationship between CPU and DRAM, Channel 3: board-dependent -**/ - UINT8 DqMapCpu2DramMc1Ch3[16]; - -/** Offset 0x01CF - Reserved -**/ - UINT8 Reserved7[2]; - -/** Offset 0x01D1 - MRC OCSafeMode - OverClocking Safe Mode - 0:CMOS, 1:Break, 2:Force -**/ - UINT8 OCSafeMode; - -/** Offset 0x01D2 - Reserved -**/ - UINT8 Reserved8; - -/** Offset 0x01D3 - Dqs Pins Interleaved Setting - Indicates DqPinsInterleaved setting: board-dependent - $EN_DIS -**/ - UINT8 DqPinsInterleaved; - -/** Offset 0x01D4 - Reserved -**/ - UINT8 Reserved9[2]; - -/** Offset 0x01D6 - MRC Fast Boot - Enables/Disable the MRC fast path thru the MRC - $EN_DIS -**/ - UINT16 MrcFastBoot; - -/** Offset 0x01D8 - Rank Margin Tool per Task - This option enables the user to execute Rank Margin Tool per major training step - in the MRC. - $EN_DIS -**/ - UINT8 RmtPerTask; - -/** Offset 0x01D9 - Training Trace - This option enables the trained state tracing feature in MRC. This feature will - print out the key training parameters state across major training steps. - $EN_DIS -**/ - UINT8 TrainTrace; - -/** Offset 0x01DA - Probeless Trace - Probeless Trace: 0=Disabled, 1=Enable. Enabling Probeless Trace will reserve 128MB. - This also requires IED to be enabled. - $EN_DIS -**/ - UINT8 ProbelessTrace; - -/** Offset 0x01DB - Reserved -**/ - UINT8 Reserved10; - -/** Offset 0x01DC - DDR Frequency Limit - Maximum Memory Frequency Selections in Mhz. Options are 1067, 1333, 1600, 1867, - 2133, 2400, 2667, 2933 and 0 for Auto. - 1067:1067, 1333:1333, 1600:1600, 1867:1867, 2133:2133, 2400:2400, 2667:2667, 2933:2933, 0:Auto -**/ - UINT16 DdrFreqLimit; - -/** Offset 0x01DE - SAGV - System Agent dynamic frequency support. - 0:Disabled, 1:Enabled -**/ - UINT8 SaGv; - -/** Offset 0x01DF - SAGV WP Mask - System Agent dynamic frequency workpoints that memory will be training at the enabled - frequencies. - 0x3:Points0_1, 0x7:Points0_1_2, 0xF:AllPoints0_1_2_3 -**/ - UINT8 SaGvWpMask; - -/** Offset 0x01E0 - SAGV Gear Ratio - Gear Selection for SAGV points. 0 - Auto, 1-1 Gear 1, 2-Gear 2 -**/ - UINT8 SaGvGear[4]; - -/** Offset 0x01E4 - SAGV Frequency - SAGV Frequency per point in Mhz. 0 for Auto and a ratio of 133/100MHz: 1333/1300. -**/ - UINT16 SaGvFreq[4]; - -/** Offset 0x01EC - SAGV Disabled Gear Ratio - Gear Selection for SAGV Disabled. 0 - Auto, 1-1 Gear 1, 2-Gear 2 -**/ - UINT8 GearRatio; - -/** Offset 0x01ED - Rank Margin Tool - Enable/disable Rank Margin Tool. - $EN_DIS -**/ - UINT8 RMT; - -/** Offset 0x01EE - Controller 0 Channel 0 DIMM Control - Enable / Disable DIMMs on Controller 0 Channel 0 - $EN_DIS -**/ - UINT8 DisableMc0Ch0; - -/** Offset 0x01EF - Controller 0 Channel 1 DIMM Control - Enable / Disable DIMMs on Controller 0 Channel 1 - $EN_DIS -**/ - UINT8 DisableMc0Ch1; - -/** Offset 0x01F0 - Controller 0 Channel 2 DIMM Control - Enable / Disable DIMMs on Controller 0 Channel 2 - $EN_DIS -**/ - UINT8 DisableMc0Ch2; - -/** Offset 0x01F1 - Controller 0 Channel 3 DIMM Control - Enable / Disable DIMMs on Controller 0 Channel 3 - $EN_DIS -**/ - UINT8 DisableMc0Ch3; - -/** Offset 0x01F2 - Controller 1 Channel 0 DIMM Control - Enable / Disable DIMMs on Controller 1 Channel 0 - $EN_DIS -**/ - UINT8 DisableMc1Ch0; - -/** Offset 0x01F3 - Controller 1 Channel 1 DIMM Control - Enable / Disable DIMMs on Controller 1 Channel 1 - $EN_DIS -**/ - UINT8 DisableMc1Ch1; - -/** Offset 0x01F4 - Controller 1 Channel 2 DIMM Control - Enable / Disable DIMMs on Controller 1 Channel 2 - $EN_DIS -**/ - UINT8 DisableMc1Ch2; - -/** Offset 0x01F5 - Controller 1 Channel 3 DIMM Control - Enable / Disable DIMMs on Controller 1 Channel 3 - $EN_DIS -**/ - UINT8 DisableMc1Ch3; - -/** Offset 0x01F6 - Scrambler Support - This option enables data scrambling in memory. - $EN_DIS -**/ - UINT8 ScramblerSupport; - -/** Offset 0x01F7 - Reserved -**/ - UINT8 Reserved11[3]; - -/** Offset 0x01FA - Memory Ratio - Automatic or the frequency will equal ratio times reference clock. Set to Auto to - recalculate memory timings listed below. - 0:Auto, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14, 15:15 -**/ - UINT16 Ratio; - -/** Offset 0x01FC - tCL - CAS Latency, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected - == 1 (Custom Profile). -**/ - UINT16 tCL; - -/** Offset 0x01FE - tCWL - Min CAS Write Latency Delay Time, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected - == 1 (Custom Profile). -**/ - UINT16 tCWL; - -/** Offset 0x0200 - tFAW - Min Four Activate Window Delay Time, 0: AUTO, max: 65535. Only used if FspmUpd->FspmConfig.SpdProfileSelected - == 1 (Custom Profile). -**/ - UINT16 tFAW; - -/** Offset 0x0202 - SPD Profile Selected - Select DIMM timing profile. Options are 0=Default Profile, 1=Custom Profile, 2=XMP - Profile 1, 3=XMP Profile 2 - 0:Default Profile, 1:Custom Profile, 2:XMP Profile 1, 3:XMP Profile 2 -**/ - UINT8 SpdProfileSelected; - -/** Offset 0x0203 -**/ - UINT8 RXVREFPERBIT; - -/** Offset 0x0204 - Reserved -**/ - UINT8 Reserved12; - -/** Offset 0x0205 - Ch Hash Override - Select if Channel Hash setting values will be taken from input parameters or automatically - taken from POR values depending on DRAM type detected. NOTE: ONLY if Memory interleaved Mode - $EN_DIS -**/ - UINT8 ChHashOverride; - -/** Offset 0x0206 - Reserved -**/ - UINT8 Reserved13[2]; - -/** Offset 0x0208 - DQS Rise/Fall - Enables/Disable DQS Rise/Fall - $EN_DIS -**/ - UINT8 RDDQSODTT; - -/** Offset 0x0209 - Reserved -**/ - UINT8 Reserved14[2]; - -/** Offset 0x020B - Functional Duty Cycle Correction for DDR5 CLK - Enable/Disable Functional Duty Cycle Correction for DDR5 CLK - 0:Disable, 1:Enable -**/ - UINT8 FUNCDCCCLK; - -/** Offset 0x020C - Functional Duty Cycle Correction for DDR5 DQS - Enable/Disable Functional Duty Cycle Correction for DDR5 DQS - 0:Disable, 1:Enable -**/ - UINT8 FUNCDCCDQS; - -/** Offset 0x020D -**/ - UINT8 FUNCDCCWCK; - -/** Offset 0x020E - Duty Cycle Correction for LP5 DCA - Enable/Disable Duty Cycle Correction for LP5 DCA - $EN_DIS -**/ - UINT8 DCCLP5WCKDCA; - -/** Offset 0x020F - Reserved -**/ - UINT8 Reserved15; - -/** Offset 0x0210 - DQ/DQS Swizzle Training - Enable/Disable DQ/DQS Swizzle Training - $EN_DIS -**/ - UINT32 DQDQSSWZ; - -/** Offset 0x0214 - Reserved -**/ - UINT8 Reserved16[4]; - -/** Offset 0x0218 - Functional Duty Cycle Correction for Data DQ - Enable/Disable Functional Duty Cycle Correction for Data DQ - 0:Disable, 1:Enable -**/ - UINT8 FUNCDCCDQ; - -/** Offset 0x0219 - Reserved -**/ - UINT8 Reserved17[5]; - -/** Offset 0x021E - tRAS +/** Offset 0x01B8 - tRAS RAS Active Time, 0: AUTO, max: 65535. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT16 tRAS; -/** Offset 0x0220 - tRCD/tRP +/** Offset 0x01BA - tRCD/tRP RAS to CAS delay time and Row Precharge delay time, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT16 tRCDtRP; -/** Offset 0x0222 - Reserved -**/ - UINT8 Reserved18[2]; - -/** Offset 0x0224 - tREFI +/** Offset 0x01BC - tREFI Refresh Interval, 0: AUTO, max: 65535. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT32 tREFI; -/** Offset 0x0228 - Unmatched Rx Calibration - Enable/Disable Rx Unmatched Calibration - $EN_DIS +/** Offset 0x01C0 - tCL + CAS Latency, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected + == 1 (Custom Profile). **/ - UINT32 RXUNMATCHEDCAL; + UINT16 tCL; -/** Offset 0x022C - Hard Post Package Repair - Enables/Disable Hard Post Package Repair - $EN_DIS +/** Offset 0x01C2 - tCWL + Min CAS Write Latency Delay Time, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected + == 1 (Custom Profile). **/ - UINT32 PPR; + UINT16 tCWL; -/** Offset 0x0230 - Reserved +/** Offset 0x01C4 - tFAW + Min Four Activate Window Delay Time, 0: AUTO, max: 65535. Only used if FspmUpd->FspmConfig.SpdProfileSelected + == 1 (Custom Profile). **/ - UINT8 Reserved19; + UINT16 tFAW; -/** Offset 0x0231 - PPR Run Once - When Eanble, PPR will run only once and then is disabled at next training cycle - $EN_DIS -**/ - UINT8 PprRunOnce; - -/** Offset 0x0232 - PPR Run During Fastboot - When Eanble, PPR will run during fastboot - $EN_DIS -**/ - UINT8 PprRunAtFastboot; - -/** Offset 0x0233 - PPR Repair Type - PPR Repair Type: 0:Do not Repair (Default), 1:Soft Repair, 2:Hard Repair - 0:Do not Repair (Default), 1:Soft Repair, 2:Hard Repair -**/ - UINT8 PprRepairType; - -/** Offset 0x0234 - PPR Error Injection - When Eanble, PPR will inject bad rows during testing - $EN_DIS -**/ - UINT8 PprErrorInjection; - -/** Offset 0x0235 - PPR Repair Controller - PPR repair controller: User chooses to force repair specifc address -**/ - UINT8 PprRepairController; - -/** Offset 0x0236 - PPR Repair Channel - PPR repair Channel: User chooses to force repair specifc address -**/ - UINT8 PprRepairChannel; - -/** Offset 0x0237 - PPR Repair Dimm - PPR repair Dimm: User chooses to force repair specifc address -**/ - UINT8 PprRepairDimm; - -/** Offset 0x0238 - PPR Repair Rank - PPR repair Rank: User chooses to force repair specifc address -**/ - UINT8 PprRepairRank; - -/** Offset 0x0239 - Reserved -**/ - UINT8 Reserved20[3]; - -/** Offset 0x023C - PPR Repair Row - PPR repair Row: User chooses to force repair specifc address -**/ - UINT32 PprRepairRow; - -/** Offset 0x0240 - Reserved -**/ - UINT8 Reserved21[8]; - -/** Offset 0x0248 - PPR Repair BankGroup - PPR repair BankGroup: User chooses to force repair specifc address -**/ - UINT8 PprRepairBankGroup; - -/** Offset 0x0249 - Reserved -**/ - UINT8 Reserved22; - -/** Offset 0x024A - tCCD_L_WR - Number of tCK cycles for the channel DIMM's minimum Write-to-Write delay for same - bank groups -**/ - UINT16 tCCD_L_WR; - -/** Offset 0x024C - LVR Auto Trim - Enable/disable LVR Auto Trim - $EN_DIS -**/ - UINT32 LVRAUTOTRIM; - -/** Offset 0x0250 - Power Saving Meter Update - Enable/Disable Power Saving Meter Update - $EN_DIS -**/ - UINT32 PWRMETER; - -/** Offset 0x0254 - Compensation Optimization - Enable/Disable Compensation Optimization - $EN_DIS -**/ - UINT32 OPTIMIZECOMP; - -/** Offset 0x0258 - Write DQ/DQS Retraining - Enable/Disable Write DQ/DQS Retraining - $EN_DIS -**/ - UINT32 WRTRETRAIN; - -/** Offset 0x025C - Pre-Training Comp Calibration - Enable/Disable Pre-Training Comp Calibration - $EN_DIS -**/ - UINT32 DDRPRECOMP; - -/** Offset 0x0260 - Reserved -**/ - UINT8 Reserved23[12]; - -/** Offset 0x026C - RDDQODTT - Enable/disable Read DQ ODT Training - $EN_DIS -**/ - UINT32 RDDQODTT; - -/** Offset 0x0270 - RDCTLET - Enable/disable Read CTLE Training - $EN_DIS -**/ - UINT32 RDCTLET; - -/** Offset 0x0274 - RxVref Pre EMPHASIS Training - Enable/Disable Pre EMPHASIS Training - $EN_DIS -**/ - UINT8 EMPHASIS; - -/** Offset 0x0275 - Reserved -**/ - UINT8 Reserved24; - -/** Offset 0x0276 - tRFC +/** Offset 0x01C6 - tRFC Min Refresh Recovery Delay Time, 0: AUTO, max: 65535. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT16 tRFC; -/** Offset 0x0278 - tRRD +/** Offset 0x01C8 - tRRD Min Row Active to Row Active Delay Time, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT16 tRRD; -/** Offset 0x027A - tRTP +/** Offset 0x01CA - tRTP Min Internal Read to Precharge Command Delay Time, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT16 tRTP; -/** Offset 0x027C - tWR +/** Offset 0x01CC - tWR Min Write Recovery Time, 0: AUTO, legal values: 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 30, 34, 40. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). 0:Auto, 5:5, 6:6, 7:7, 8:8, 10:10, 12:12, 14:14, 16:16, 18:18, 20:20, 24:24, 30:30, @@ -890,522 +422,943 @@ typedef struct { **/ UINT16 tWR; -/** Offset 0x027E - tWTR +/** Offset 0x01CE - tWTR Min Internal Write to Read Command Delay Time, 0: AUTO, max: 255. Only used if FspmUpd->FspmConfig.SpdProfileSelected == 1 (Custom Profile). **/ UINT16 tWTR; -/** Offset 0x0280 - NMode +/** Offset 0x01D0 - tWTR_S + tWTR_S value for OC Custom Profile, 0 - Auto +**/ + UINT16 tWTR_S; + +/** Offset 0x01D2 - tWTR_L + tWTR_L value for OC Custom Profile, 0 - Auto +**/ + UINT16 tWTR_L; + +/** Offset 0x01D4 - tCCD_L + tCCD_L value for OC Custom Profile, 0 - Auto +**/ + UINT16 tCCD_L; + +/** Offset 0x01D6 - tRRD_S + tRRD_S value for OC Custom Profile, 0 - Auto +**/ + UINT16 tRRD_S; + +/** Offset 0x01D8 - tRRD_L + tRRD_L value for OC Custom Profile, 0 - Auto +**/ + UINT16 tRRD_L; + +/** Offset 0x01DA - tRFC4 + tRFC4 value for OC Custom Profile, 0 - Auto +**/ + UINT16 tRFC4; + +/** Offset 0x01DC - tRFC2 + tRFC2 value for OC Custom Profile, 0 - Auto +**/ + UINT16 tRFC2; + +/** Offset 0x01DE - tRFCpb + tRFCpb value for OC Custom Profile, 0 - Auto +**/ + UINT16 tRFCpb; + +/** Offset 0x01E0 - tCCD_L_WR + Number of tCK cycles for the channel DIMM's minimum Write-to-Write delay for same + bank groups, for OC Custom Profile, 0 - Auto +**/ + UINT16 tCCD_L_WR; + +/** Offset 0x01E2 - Reserved +**/ + UINT8 Reserved7[2]; + +/** Offset 0x01E4 - LPMode Support + Bit[0]: Enable Lpmode0p5 (Idle_enable), Bit[1]: Enable Lpmode2 (Powerdown_enable), + Bit[2]: Enable Lpmode3 (Selfrefresh_enable) +**/ + UINT8 LpMode; + +/** Offset 0x01E5 - Reserved +**/ + UINT8 Reserved8[2]; + +/** Offset 0x01E7 - MRC OCSafeMode + OverClocking Safe Mode for tCL + $EN_DIS +**/ + UINT8 OCSafeMode; + +/** Offset 0x01E8 - Reserved +**/ + UINT8 Reserved9; + +/** Offset 0x01E9 - Dqs Pins Interleaved Setting + Indicates DqPinsInterleaved setting: board-dependent + $EN_DIS +**/ + UINT8 DqPinsInterleaved; + +/** Offset 0x01EA - Smram Mask + The SMM Regions AB-SEG and/or H-SEG reserved + 0: Neither, 1:AB-SEG, 2:H-SEG, 3: Both +**/ + UINT8 SmramMask; + +/** Offset 0x01EB - MRC Fast Boot + Enables/Disable the MRC fast path thru the MRC + $EN_DIS +**/ + UINT8 MrcFastBoot; + +/** Offset 0x01EC - Rank Margin Tool per Task + This option enables the user to execute Rank Margin Tool per major training step + in the MRC. + $EN_DIS +**/ + UINT8 RmtPerTask; + +/** Offset 0x01ED - Training Trace + This option enables the trained state tracing feature in MRC. This feature will + print out the key training parameters state across major training steps. + $EN_DIS +**/ + UINT8 TrainTrace; + +/** Offset 0x01EE - Probeless Trace + Probeless Trace: 0=Disabled, 1=Enable. Enabling Probeless Trace will reserve 128MB. + This also requires IED to be enabled. + $EN_DIS +**/ + UINT8 ProbelessTrace; + +/** Offset 0x01EF - Reserved +**/ + UINT8 Reserved10; + +/** Offset 0x01F0 - DDR Frequency Limit + Maximum Memory Frequency Selections in Mhz. Options are 1067, 1333, 1600, 1867, + 2133, 2400, 2667, 2933 and 0 for Auto. + 1067:1067, 1333:1333, 1600:1600, 1867:1867, 2133:2133, 2400:2400, 2667:2667, 2933:2933, 0:Auto +**/ + UINT16 DdrFreqLimit; + +/** Offset 0x01F2 - SAGV + System Agent dynamic frequency support. + 0:Disabled, 1:Enabled +**/ + UINT8 SaGv; + +/** Offset 0x01F3 - SAGV WP Mask + System Agent dynamic frequency workpoints that memory will be training at the enabled + frequencies. + 0x3:Points0_1, 0x7:Points0_1_2, 0xF:AllPoints0_1_2_3 +**/ + UINT8 SaGvWpMask; + +/** Offset 0x01F4 - SAGV Gear Ratio + Gear Selection for SAGV points. 0 - Auto, 1-1 Gear 1, 2-Gear 2 +**/ + UINT8 SaGvGear[4]; + +/** Offset 0x01F8 - SAGV Frequency + SAGV Frequency per point in Mhz. 0 for Auto and a ratio of 133/100MHz: 1333/1300. +**/ + UINT16 SaGvFreq[4]; + +/** Offset 0x0200 - SAGV Disabled Gear Ratio + Gear Selection for SAGV Disabled. 0 - Auto, 1-1 Gear 1, 2-Gear 2 +**/ + UINT8 GearRatio; + +/** Offset 0x0201 - Rank Margin Tool + Enable/disable Rank Margin Tool. + $EN_DIS +**/ + UINT8 RMT; + +/** Offset 0x0202 - Controller 0 Channel 0 DIMM Control + Enable / Disable DIMMs on Controller 0 Channel 0 + $EN_DIS +**/ + UINT8 DisableMc0Ch0; + +/** Offset 0x0203 - Controller 0 Channel 1 DIMM Control + Enable / Disable DIMMs on Controller 0 Channel 1 + $EN_DIS +**/ + UINT8 DisableMc0Ch1; + +/** Offset 0x0204 - Controller 0 Channel 2 DIMM Control + Enable / Disable DIMMs on Controller 0 Channel 2 + $EN_DIS +**/ + UINT8 DisableMc0Ch2; + +/** Offset 0x0205 - Controller 0 Channel 3 DIMM Control + Enable / Disable DIMMs on Controller 0 Channel 3 + $EN_DIS +**/ + UINT8 DisableMc0Ch3; + +/** Offset 0x0206 - Controller 1 Channel 0 DIMM Control + Enable / Disable DIMMs on Controller 1 Channel 0 + $EN_DIS +**/ + UINT8 DisableMc1Ch0; + +/** Offset 0x0207 - Controller 1 Channel 1 DIMM Control + Enable / Disable DIMMs on Controller 1 Channel 1 + $EN_DIS +**/ + UINT8 DisableMc1Ch1; + +/** Offset 0x0208 - Controller 1 Channel 2 DIMM Control + Enable / Disable DIMMs on Controller 1 Channel 2 + $EN_DIS +**/ + UINT8 DisableMc1Ch2; + +/** Offset 0x0209 - Controller 1 Channel 3 DIMM Control + Enable / Disable DIMMs on Controller 1 Channel 3 + $EN_DIS +**/ + UINT8 DisableMc1Ch3; + +/** Offset 0x020A - Scrambler Support + This option enables data scrambling in memory. + $EN_DIS +**/ + UINT8 ScramblerSupport; + +/** Offset 0x020B - Reserved +**/ + UINT8 Reserved11; + +/** Offset 0x020C - Memory Voltage + DRAM voltage (Vdd) (supply voltage for input buffers and core logic of the DRAM + chips) in millivolts. 0=Platform Default (no override), 1200=1.2V, 1350=1.35V etc. + 0:Default, 1200:1.20 Volts, 1250:1.25 Volts, 1300:1.30 Volts, 1350:1.35 Volts, 1400:1.40 + Volts, 1450:1.45 Volts, 1500:1.50 Volts, 1550:1.55 Volts, 1600:1.60 Volts, 1650:1.65 Volts +**/ + UINT16 VddVoltage; + +/** Offset 0x020E - Memory Ratio + Automatic or the frequency will equal ratio times reference clock. Set to Auto to + recalculate memory timings listed below. + 0:Auto, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14, 15:15 +**/ + UINT16 Ratio; + +/** Offset 0x0210 - SPD Profile Selected + Select DIMM timing profile. Options are 0=Default Profile, 1=Custom Profile, 2=XMP + Profile 1, 3=XMP Profile 2 + 0:Default Profile, 1:Custom Profile, 2:XMP Profile 1, 3:XMP Profile 2 +**/ + UINT8 SpdProfileSelected; + +/** Offset 0x0211 +**/ + UINT8 RXVREFPERBIT; + +/** Offset 0x0212 - Reserved +**/ + UINT8 Reserved12; + +/** Offset 0x0213 - Ch Hash Override + Select if Channel Hash setting values will be taken from input parameters or automatically + taken from POR values depending on DRAM type detected. NOTE: ONLY if Memory interleaved Mode + $EN_DIS +**/ + UINT8 ChHashOverride; + +/** Offset 0x0214 - Reserved +**/ + UINT8 Reserved13[2]; + +/** Offset 0x0216 - DQS Rise/Fall + Enables/Disable DQS Rise/Fall + $EN_DIS +**/ + UINT8 RDDQSODTT; + +/** Offset 0x0217 - Reserved +**/ + UINT8 Reserved14[2]; + +/** Offset 0x0219 - Functional Duty Cycle Correction for DDR5 CLK + Enable/Disable Functional Duty Cycle Correction for DDR5 CLK + 0:Disable, 1:Enable +**/ + UINT8 FUNCDCCCLK; + +/** Offset 0x021A - Functional Duty Cycle Correction for DDR5 DQS + Enable/Disable Functional Duty Cycle Correction for DDR5 DQS + 0:Disable, 1:Enable +**/ + UINT8 FUNCDCCDQS; + +/** Offset 0x021B +**/ + UINT8 FUNCDCCWCK; + +/** Offset 0x021C - Duty Cycle Correction for LP5 DCA + Enable/Disable Duty Cycle Correction for LP5 DCA + $EN_DIS +**/ + UINT8 DCCLP5WCKDCA; + +/** Offset 0x021D - DQ/DQS Swizzle Training + Enable/Disable DQ/DQS Swizzle Training + $EN_DIS +**/ + UINT8 DQDQSSWZ; + +/** Offset 0x021E - Reserved +**/ + UINT8 Reserved15; + +/** Offset 0x021F - Functional Duty Cycle Correction for Data DQ + Enable/Disable Functional Duty Cycle Correction for Data DQ + 0:Disable, 1:Enable +**/ + UINT8 FUNCDCCDQ; + +/** Offset 0x0220 - Reserved +**/ + UINT8 Reserved16[5]; + +/** Offset 0x0225 - Unmatched Rx Calibration + Enable/Disable Rx Unmatched Calibration + $EN_DIS +**/ + UINT8 RXUNMATCHEDCAL; + +/** Offset 0x0226 - Hard Post Package Repair + Enables/Disable Hard Post Package Repair + $EN_DIS +**/ + UINT8 PPR; + +/** Offset 0x0227 - Reserved +**/ + UINT8 Reserved17; + +/** Offset 0x0228 - PPR Run Once + When Eanble, PPR will run only once and then is disabled at next training cycle + $EN_DIS +**/ + UINT8 PprRunOnce; + +/** Offset 0x0229 - PPR Run During Fastboot + When Eanble, PPR will run during fastboot + $EN_DIS +**/ + UINT8 PprRunAtFastboot; + +/** Offset 0x022A - PPR Repair Type + PPR Repair Type: 0:Do not Repair (Default), 1:Soft Repair, 2:Hard Repair + 0:Do not Repair (Default), 1:Soft Repair, 2:Hard Repair +**/ + UINT8 PprRepairType; + +/** Offset 0x022B - PPR Error Injection + When Eanble, PPR will inject bad rows during testing + $EN_DIS +**/ + UINT8 PprErrorInjection; + +/** Offset 0x022C - PPR Repair Controller + PPR repair controller: User chooses to force repair specifc address +**/ + UINT8 PprRepairController; + +/** Offset 0x022D - PPR Repair Channel + PPR repair Channel: User chooses to force repair specifc address +**/ + UINT8 PprRepairChannel; + +/** Offset 0x022E - PPR Repair Dimm + PPR repair Dimm: User chooses to force repair specifc address +**/ + UINT8 PprRepairDimm; + +/** Offset 0x022F - PPR Repair Rank + PPR repair Rank: User chooses to force repair specifc address +**/ + UINT8 PprRepairRank; + +/** Offset 0x0230 - PPR Repair Row + PPR repair Row: User chooses to force repair specifc address +**/ + UINT32 PprRepairRow; + +/** Offset 0x0234 - Reserved +**/ + UINT8 Reserved18[8]; + +/** Offset 0x023C - PPR Repair BankGroup + PPR repair BankGroup: User chooses to force repair specifc address +**/ + UINT8 PprRepairBankGroup; + +/** Offset 0x023D - LVR Auto Trim + Enable/disable LVR Auto Trim + $EN_DIS +**/ + UINT8 LVRAUTOTRIM; + +/** Offset 0x023E - Compensation Optimization + Enable/Disable Compensation Optimization + $EN_DIS +**/ + UINT8 OPTIMIZECOMP; + +/** Offset 0x023F - Write DQ/DQS Retraining + Enable/Disable Write DQ/DQS Retraining + $EN_DIS +**/ + UINT8 WRTRETRAIN; + +/** Offset 0x0240 - Reserved +**/ + UINT8 Reserved19[3]; + +/** Offset 0x0243 - RDDQODTT + Enable/disable Read DQ ODT Training + $EN_DIS +**/ + UINT8 RDDQODTT; + +/** Offset 0x0244 - RDCTLET + Enable/disable Read CTLE Training + $EN_DIS +**/ + UINT8 RDCTLET; + +/** Offset 0x0245 - RxVref Pre EMPHASIS Training + Enable/Disable Pre EMPHASIS Training + $EN_DIS +**/ + UINT8 EMPHASIS; + +/** Offset 0x0246 - RX DQS VOC Centring Training + Enable/Disable RX DQS VOC Centring Training + $EN_DIS +**/ + UINT8 RXDQSVOCC; + +/** Offset 0x0247 - NMode System command rate, range 0-2, 0 means auto, 1 = 1N, 2 = 2N **/ UINT8 NModeSupport; -/** Offset 0x0281 - LPDDR ODT RttWr +/** Offset 0x0248 - LPDDR ODT RttWr Initial RttWr for LP4/5 in Ohms. 0x0 - Auto **/ UINT8 LpddrRttWr; -/** Offset 0x0282 - Retrain on Fast flow Failure +/** Offset 0x0249 - Retrain on Fast flow Failure Restart MRC in Cold mode if SW MemTest fails during Fast flow. $EN_DIS **/ UINT8 RetrainOnFastFail; -/** Offset 0x0283 - LPDDR ODT RttCa +/** Offset 0x024A - LPDDR ODT RttCa Initial RttCa for LP4/5 in Ohms. 0x0 - Auto **/ UINT8 LpddrRttCa; -/** Offset 0x0284 - DIMM DFE Training +/** Offset 0x024B - DIMM DFE Training Enable/Disable DIMM DFE Training $EN_DIS **/ UINT8 WRTDIMMDFE; -/** Offset 0x0285 - DDR5 ODT Timing Config +/** Offset 0x024C - DDR5 ODT Timing Config Enable/Disable DDR5 ODT TIMING CONFIG $EN_DIS **/ UINT8 DDR5ODTTIMING; -/** Offset 0x0286 - HobBufferSize +/** Offset 0x024D - HobBufferSize Size to set HOB Buffer. 0:Default, 1: 1 Byte, 2: 1 KB, 3: Max value(assuming 63KB total HOB size). 0:Default, 1: 1 Byte, 2: 1 KB, 3: Max value **/ UINT8 HobBufferSize; -/** Offset 0x0287 - Early Command Training +/** Offset 0x024E - Early Command Training Enables/Disable Early Command Training $EN_DIS **/ UINT8 ECT; -/** Offset 0x0288 - SenseAmp Offset Training +/** Offset 0x024F - SenseAmp Offset Training Enables/Disable SenseAmp Offset Training $EN_DIS **/ UINT8 SOT; -/** Offset 0x0289 - Early ReadMPR Timing Centering 2D +/** Offset 0x0250 - Early ReadMPR Timing Centering 2D Enables/Disable Early ReadMPR Timing Centering 2D $EN_DIS **/ UINT8 ERDMPRTC2D; -/** Offset 0x028A - Read MPR Training +/** Offset 0x0251 - Read MPR Training Enables/Disable Read MPR Training $EN_DIS **/ UINT8 RDMPRT; -/** Offset 0x028B - Receive Enable Training +/** Offset 0x0252 - Receive Enable Training Enables/Disable Receive Enable Training $EN_DIS **/ UINT8 RCVET; -/** Offset 0x028C - Jedec Write Leveling +/** Offset 0x0253 - Jedec Write Leveling Enables/Disable Jedec Write Leveling $EN_DIS **/ UINT8 JWRL; -/** Offset 0x028D - Early Write Time Centering 2D +/** Offset 0x0254 - Early Write Time Centering 2D Enables/Disable Early Write Time Centering 2D $EN_DIS **/ UINT8 EWRTC2D; -/** Offset 0x028E - Early Read Time Centering 2D +/** Offset 0x0255 - Early Read Time Centering 2D Enables/Disable Early Read Time Centering 2D $EN_DIS **/ UINT8 ERDTC2D; -/** Offset 0x028F - Unmatched Write Time Centering 1D +/** Offset 0x0256 - Unmatched Write Time Centering 1D Enable/Disable Unmatched Write Time Centering 1D $EN_DIS **/ UINT8 UNMATCHEDWRTC1D; -/** Offset 0x0290 - Write Timing Centering 1D +/** Offset 0x0257 - Write Timing Centering 1D Enables/Disable Write Timing Centering 1D $EN_DIS **/ UINT8 WRTC1D; -/** Offset 0x0291 - Write Voltage Centering 1D +/** Offset 0x0258 - Write Voltage Centering 1D Enables/Disable Write Voltage Centering 1D $EN_DIS **/ UINT8 WRVC1D; -/** Offset 0x0292 - Read Timing Centering 1D +/** Offset 0x0259 - Read Timing Centering 1D Enables/Disable Read Timing Centering 1D $EN_DIS **/ UINT8 RDTC1D; -/** Offset 0x0293 - Dimm ODT Training +/** Offset 0x025A - Dimm ODT Training Enables/Disable Dimm ODT Training $EN_DIS **/ UINT8 DIMMODTT; -/** Offset 0x0294 - DIMM RON Training +/** Offset 0x025B - DIMM RON Training Enables/Disable DIMM RON Training $EN_DIS **/ UINT8 DIMMRONT; -/** Offset 0x0295 - Write Drive Strength/Equalization 2D +/** Offset 0x025C - Write Drive Strength/Equalization 2D Enables/Disable Write Drive Strength/Equalization 2D $EN_DIS **/ UINT8 WRDSEQT; -/** Offset 0x0296 - Read Equalization Training +/** Offset 0x025D - Read Equalization Training Enables/Disable Read Equalization Training $EN_DIS **/ UINT8 RDEQT; -/** Offset 0x0297 - Write Timing Centering 2D +/** Offset 0x025E - Write Timing Centering 2D Enables/Disable Write Timing Centering 2D $EN_DIS **/ UINT8 WRTC2D; -/** Offset 0x0298 - Read Timing Centering 2D +/** Offset 0x025F - Read Timing Centering 2D Enables/Disable Read Timing Centering 2D $EN_DIS **/ UINT8 RDTC2D; -/** Offset 0x0299 - Write Voltage Centering 2D +/** Offset 0x0260 - Write Voltage Centering 2D Enables/Disable Write Voltage Centering 2D $EN_DIS **/ UINT8 WRVC2D; -/** Offset 0x029A - Read Voltage Centering 2D +/** Offset 0x0261 - Read Voltage Centering 2D Enables/Disable Read Voltage Centering 2D $EN_DIS **/ UINT8 RDVC2D; -/** Offset 0x029B - Command Voltage Centering +/** Offset 0x0262 - Command Voltage Centering Enables/Disable Command Voltage Centering $EN_DIS **/ UINT8 CMDVC; -/** Offset 0x029C - Late Command Training +/** Offset 0x0263 - Late Command Training Enables/Disable Late Command Training $EN_DIS **/ UINT8 LCT; -/** Offset 0x029D - Round Trip Latency Training +/** Offset 0x0264 - Round Trip Latency Training Enables/Disable Round Trip Latency Training $EN_DIS **/ UINT8 RTL; -/** Offset 0x029E - Turn Around Timing Training +/** Offset 0x0265 - Turn Around Timing Training Enables/Disable Turn Around Timing Training $EN_DIS **/ UINT8 TAT; -/** Offset 0x029F - Reserved +/** Offset 0x0266 - Reserved **/ - UINT8 Reserved25; + UINT8 Reserved20; -/** Offset 0x02A0 - DIMM SPD Alias Test +/** Offset 0x0267 - DIMM SPD Alias Test Enables/Disable DIMM SPD Alias Test $EN_DIS **/ UINT8 ALIASCHK; -/** Offset 0x02A1 - Receive Enable Centering 1D +/** Offset 0x0268 - Receive Enable Centering 1D Enables/Disable Receive Enable Centering 1D $EN_DIS **/ UINT8 RCVENC1D; -/** Offset 0x02A2 - Retrain Margin Check +/** Offset 0x0269 - Retrain Margin Check Enables/Disable Retrain Margin Check $EN_DIS **/ UINT8 RMC; -/** Offset 0x02A3 - ECC Support +/** Offset 0x026A - ECC Support Enables/Disable ECC Support $EN_DIS **/ UINT8 EccSupport; -/** Offset 0x02A4 - Reserved +/** Offset 0x026B - Reserved **/ - UINT8 Reserved26[2]; + UINT8 Reserved21[2]; -/** Offset 0x02A6 - Ibecc +/** Offset 0x026D - Ibecc In-Band ECC Support $EN_DIS **/ UINT8 Ibecc; -/** Offset 0x02A7 - IbeccParity +/** Offset 0x026E - IbeccParity In-Band ECC Parity Control $EN_DIS **/ UINT8 IbeccParity; -/** Offset 0x02A8 - Reserved +/** Offset 0x026F - Reserved **/ - UINT8 Reserved27[4]; + UINT8 Reserved22; -/** Offset 0x02AC - IbeccOperationMode +/** Offset 0x0270 - IbeccOperationMode In-Band ECC Operation Mode 0:Protect base on address range, 1: Non-protected, 2: All protected **/ UINT8 IbeccOperationMode; -/** Offset 0x02AD - IbeccProtectedRegionEnable +/** Offset 0x0271 - IbeccProtectedRegionEnable In-Band ECC Protected Region Enable $EN_DIS **/ UINT8 IbeccProtectedRegionEnable[8]; -/** Offset 0x02B5 - Reserved +/** Offset 0x0279 - Reserved **/ - UINT8 Reserved28; + UINT8 Reserved23; -/** Offset 0x02B6 - IbeccProtectedRegionBases +/** Offset 0x027A - IbeccProtectedRegionBases IBECC Protected Region Bases per IBECC instance **/ UINT16 IbeccProtectedRegionBase[8]; -/** Offset 0x02C6 - IbeccProtectedRegionMasks +/** Offset 0x028A - IbeccProtectedRegionMasks IBECC Protected Region Masks **/ UINT16 IbeccProtectedRegionMask[8]; -/** Offset 0x02D6 - Memory Remap +/** Offset 0x029A - Memory Remap Enables/Disable Memory Remap $EN_DIS **/ UINT8 RemapEnable; -/** Offset 0x02D7 - Reserved -**/ - UINT8 Reserved29; - -/** Offset 0x02D8 - Rank Interleave support +/** Offset 0x029B - Rank Interleave support Enables/Disable Rank Interleave support. NOTE: RI and HORI can not be enabled at the same time. $EN_DIS **/ - UINT32 RankInterleave; + UINT8 RankInterleave; -/** Offset 0x02DC - Enhanced Interleave support +/** Offset 0x029C - Enhanced Interleave support Enables/Disable Enhanced Interleave support $EN_DIS **/ - UINT32 EnhancedInterleave; + UINT8 EnhancedInterleave; -/** Offset 0x02E0 - Ch Hash Support +/** Offset 0x029D - Ch Hash Support Enable/Disable Channel Hash Support. NOTE: ONLY if Memory interleaved Mode $EN_DIS **/ - UINT32 ChHashEnable; + UINT8 ChHashEnable; -/** Offset 0x02E4 - DDR PowerDown and idle counter +/** Offset 0x029E - DDR PowerDown and idle counter Enables/Disable DDR PowerDown and idle counter(For LPDDR Only) $EN_DIS **/ - UINT32 EnablePwrDn; + UINT8 EnablePwrDn; -/** Offset 0x02E8 - DDR PowerDown and idle counter +/** Offset 0x029F - DDR PowerDown and idle counter Enables/Disable DDR PowerDown and idle counter(For LPDDR Only) $EN_DIS **/ UINT8 EnablePwrDnLpddr; -/** Offset 0x02E9 - Reserved -**/ - UINT8 Reserved30[3]; - -/** Offset 0x02EC - SelfRefresh Enable +/** Offset 0x02A0 - SelfRefresh Enable Enables/Disable SelfRefresh Enable $EN_DIS **/ - UINT32 SrefCfgEna; + UINT8 SrefCfgEna; -/** Offset 0x02F0 - Throttler CKEMin Defeature +/** Offset 0x02A1 - Throttler CKEMin Defeature Enables/Disable Throttler CKEMin Defeature(For LPDDR Only) $EN_DIS **/ UINT8 ThrtCkeMinDefeatLpddr; -/** Offset 0x02F1 - Reserved -**/ - UINT8 Reserved31[3]; - -/** Offset 0x02F4 - Throttler CKEMin Defeature +/** Offset 0x02A2 - Throttler CKEMin Defeature Enables/Disable Throttler CKEMin Defeature $EN_DIS **/ - UINT32 ThrtCkeMinDefeat; + UINT8 ThrtCkeMinDefeat; -/** Offset 0x02F8 - Exit On Failure (MRC) +/** Offset 0x02A3 - Exit On Failure (MRC) Enables/Disable Exit On Failure (MRC) $EN_DIS **/ UINT8 ExitOnFailure; -/** Offset 0x02F9 - Reserved +/** Offset 0x02A4 - Reserved **/ - UINT8 Reserved32[2]; + UINT8 Reserved24[2]; -/** Offset 0x02FB - Read Voltage Centering 1D +/** Offset 0x02A6 - Read Voltage Centering 1D Enable/Disable Read Voltage Centering 1D $EN_DIS **/ UINT8 RDVC1D; -/** Offset 0x02FC - TxDqTCO Comp Training +/** Offset 0x02A7 - TxDqTCO Comp Training Enable/Disable TxDqTCO Comp Training $EN_DIS **/ UINT8 TXTCO; -/** Offset 0x02FD - ClkTCO Comp Training +/** Offset 0x02A8 - ClkTCO Comp Training Enable/Disable ClkTCO Comp Training $EN_DIS **/ UINT8 CLKTCO; -/** Offset 0x02FE - CMD Slew Rate Training +/** Offset 0x02A9 - CMD Slew Rate Training Enable/Disable CMD Slew Rate Training $EN_DIS **/ UINT8 CMDSR; -/** Offset 0x02FF - CMD Drive Strength and Tx Equalization +/** Offset 0x02AA - CMD Drive Strength and Tx Equalization Enable/Disable CMD Drive Strength and Tx Equalization $EN_DIS **/ UINT8 CMDDSEQ; -/** Offset 0x0300 - DIMM CA ODT Training +/** Offset 0x02AB - DIMM CA ODT Training Enable/Disable DIMM CA ODT Training $EN_DIS **/ UINT8 DIMMODTCA; -/** Offset 0x0301 - Read Vref Decap Training* +/** Offset 0x02AC - Read Vref Decap Training* Enable/Disable Read Vref Decap Training* $EN_DIS **/ UINT8 RDVREFDC; -/** Offset 0x0302 - Vddq Training - Enable/Disable Vddq Training - $EN_DIS -**/ - UINT8 VDDQT; - -/** Offset 0x0303 - Rank Margin Tool Per Bit +/** Offset 0x02AD - Rank Margin Tool Per Bit Enable/Disable Rank Margin Tool Per Bit $EN_DIS **/ UINT8 RMTBIT; -/** Offset 0x0304 - Ref PI Calibration +/** Offset 0x02AE - Ref PI Calibration Enable/Disable Ref PI Calibration $EN_DIS **/ UINT8 REFPI; -/** Offset 0x0305 - VccClk FF Offset Correction +/** Offset 0x02AF - VccClk FF Offset Correction Enable/Disable VccClk FF Offset Correction 0:Disable, 1:Enable **/ UINT8 VCCCLKFF; -/** Offset 0x0306 - Reserved -**/ - UINT8 Reserved33[2]; - -/** Offset 0x0308 - Data PI Linearity Calibration +/** Offset 0x02B0 - Data PI Linearity Calibration Enable/Disable {Data PI Linearity Calibration $EN_DIS **/ - UINT32 DATAPILIN; + UINT8 DATAPILIN; -/** Offset 0x030C - Ddr5 Rx Cross-Talk Cancellation +/** Offset 0x02B1 - Ddr5 Rx Cross-Talk Cancellation Enable/Disable {Ddr5 Rx Cross-Talk Cancellation $EN_DIS **/ UINT8 DDR5XTALK; -/** Offset 0x030D - Retrain On Working Channel +/** Offset 0x02B2 - Retrain On Working Channel Enables/Disable Retrain On Working Channel feature $EN_DIS **/ UINT8 RetrainToWorkingChannel; -/** Offset 0x030E - Reserved +/** Offset 0x02B3 - Row Press + Enables/Disable Row Press feature + $EN_DIS **/ - UINT8 Reserved34; + UINT8 RowPressEn; -/** Offset 0x030F - Select if ZQ pin is shared between Rank0 and Rank1 in DDR4 DDP - ESelect if ZQ pin is shared between Rank0 and Rank1 in DDR4 DDP +/** Offset 0x02B4 - Reserved +**/ + UINT8 Reserved25; + +/** Offset 0x02B5 - DDR5 MR7 WICA support + Enable if DDR5 DRAM Device supports MR7 WICA 0.5 tCK offset alignment $EN_DIS **/ UINT8 IsDdr5MR7WicaSupported; -/** Offset 0x0310 - Ch Hash Interleaved Bit +/** Offset 0x02B6 - Ch Hash Interleaved Bit Select the BIT to be used for Channel Interleaved mode. NOTE: BIT7 will interlave the channels at a 2 cacheline granularity, BIT8 at 4 and BIT9 at 8. Default is BIT8 0:BIT6, 1:BIT7, 2:BIT8, 3:BIT9, 4:BIT10, 5:BIT11, 6:BIT12, 7:BIT13 **/ UINT8 ChHashInterleaveBit; -/** Offset 0x0311 - Reserved +/** Offset 0x02B7 - Reserved **/ - UINT8 Reserved35; + UINT8 Reserved26; -/** Offset 0x0312 - Ch Hash Mask +/** Offset 0x02B8 - Ch Hash Mask Set the BIT(s) to be included in the XOR function. NOTE BIT mask corresponds to BITS [19:6] Default is 0x30CC **/ UINT16 ChHashMask; -/** Offset 0x0314 - Reserved +/** Offset 0x02BA - Reserved **/ - UINT8 Reserved36[2]; + UINT8 Reserved27; -/** Offset 0x0316 - Throttler CKEMin Timer +/** Offset 0x02BB - Throttler CKEMin Timer Timer value for CKEMin, range[255;0]. Req'd min of SC_ROUND_T + BYTE_LENGTH (4). Dfault is 0x00 **/ UINT8 ThrtCkeMinTmr; -/** Offset 0x0317 - Allow Opp Ref Below Write Threhold +/** Offset 0x02BC - Allow Opp Ref Below Write Threhold Allow opportunistic refreshes while we don't exit power down. $EN_DIS **/ UINT8 AllowOppRefBelowWriteThrehold; -/** Offset 0x0318 - Write Threshold +/** Offset 0x02BD - Write Threshold Number of writes that can be accumulated while CKE is low before CKE is asserted. **/ UINT8 WriteThreshold; -/** Offset 0x0319 - MC_REFRESH_RATE +/** Offset 0x02BE - MC_REFRESH_RATE Type of Refresh Rate used to prevent Row Hammer. Default is NORMAL Refresh 0:NORMAL Refresh, 1:1x Refresh, 2:2x Refresh, 3:4x Refresh **/ UINT8 McRefreshRate; -/** Offset 0x031A - Refresh Watermarks +/** Offset 0x02BF - Refresh Watermarks Refresh Watermarks: 0-Low, 1-High (default) 0:Set Refresh Watermarks to Low, 1:Set Refresh Watermarks to High (Default) **/ UINT8 RefreshWm; -/** Offset 0x031B - Reserved +/** Offset 0x02C0 - User Manual Threshold + Disabled: Predefined threshold will be used.\n + Enabled: User Input will be used. + $EN_DIS **/ - UINT8 Reserved37[2]; + UINT8 UserThresholdEnable; -/** Offset 0x031D - Power Down Mode +/** Offset 0x02C1 - User Manual Budget + Disabled: Configuration of memories will defined the Budget value.\n + Enabled: User Input will be used. + $EN_DIS +**/ + UINT8 UserBudgetEnable; + +/** Offset 0x02C2 - Power Down Mode This option controls command bus tristating during idle periods 0x0:No Power Down, 0x1:APD, 0x6:PPD DLL OFF, 0xFF:Auto **/ UINT8 PowerDownMode; -/** Offset 0x031E - Pwr Down Idle Timer +/** Offset 0x02C3 - Pwr Down Idle Timer The minimum value should = to the worst case Roundtrip delay + Burst_Length. 0 means AUTO: 64 for ULX/ULT, 128 for DT/Halo **/ UINT8 PwdwnIdleCounter; -/** Offset 0x031F - Page Close Idle Timeout +/** Offset 0x02C4 - Page Close Idle Timeout This option controls Page Close Idle Timeout 0:Enabled, 1:Disabled **/ UINT8 DisPgCloseIdleTimeout; -/** Offset 0x0320 - Reserved +/** Offset 0x02C5 - Bitmask of ranks that have CA bus terminated + LPDDR5: Bitmask of ranks that have CA bus terminated. 0x01=Default, Rank0 is + terminating and Rank1 is non-terminating **/ - UINT8 Reserved38; + UINT8 CmdRanksTerminated; -/** Offset 0x0321 - MRC Safe Mode Override +/** Offset 0x02C6 - MRC Safe Mode Override SafeModeOverride[0] Enable DdrSafeMode override, SafeModeOverride[1] Enable McSafeMode override, SafeModeOverride[2] Enable MrcSafeMode override, SafeModeOverride[3] Enable Training Algorithm (TrainingEnables) safe mode override, SafeModeOverride[4] @@ -1413,18 +1366,18 @@ typedef struct { **/ UINT8 SafeModeOverride; -/** Offset 0x0322 - Reserved +/** Offset 0x02C7 - Reserved **/ - UINT8 Reserved39[2]; + UINT8 Reserved28[5]; -/** Offset 0x0324 - DDR Phy Safe Mode Support +/** Offset 0x02CC - DDR Phy Safe Mode Support DdrSafeMode[0]: Basic PM Features, DdrSafeMode[1]: Spine Gating, DdrSafeMode[2]: Advanced DCC, DdrSafeMode[3]: R2R Training, DdrSafeMode[4]: Transformer Mode, DdrSafeMode[5]: PLL Operation, DdrSafeMode[6]: Safe ODT **/ UINT32 DdrSafeMode; -/** Offset 0x0328 - Mc Safe Mode Support +/** Offset 0x02D0 - Mc Safe Mode Support McSafeMode[0]: Clk Gate / BGF, McSafeMode[1]: CKE Pdwn, McSafeMode[2]: Tristate, McSafeMode[3]: PHY Power States / Clock Spine, McSafeMode[4]: Same Rank TA, McSafeMode[5]: Different Rank TA, McSafeMode[6]: MR4_Period / ZQCAL_Period McSafeMode[7]: LP5 @@ -1433,349 +1386,360 @@ typedef struct { **/ UINT8 McSafeMode; -/** Offset 0x0329 - Ask MRC to clear memory content +/** Offset 0x02D1 - Ask MRC to clear memory content Ask MRC to clear memory content 0: Do not Clear Memory; 1: Clear Memory. $EN_DIS **/ UINT8 CleanMemory; -/** Offset 0x032A - Reserved +/** Offset 0x02D2 - Reserved **/ - UINT8 Reserved40[8]; + UINT8 Reserved29[8]; -/** Offset 0x0332 - RMTLoopCount +/** Offset 0x02DA - RMTLoopCount Specifies the Loop Count to be used during Rank Margin Tool Testing. 0 - AUTO **/ UINT8 RMTLoopCount; -/** Offset 0x0333 - DdrOneDpc +/** Offset 0x02DB - DdrOneDpc DDR 1DPC performance feature for 2R DIMMs. Can be enabled on DIMM0 or DIMM1 only, or on both (default) 0: Disabled, 1: Enabled on DIMM0 only, 2: Enabled on DIMM1 only, 3: Enabled **/ UINT8 DdrOneDpc; -/** Offset 0x0334 - Vddq Voltage Override +/** Offset 0x02DC - Vddq Voltage Override # is multiple of 1mV where 0 means Auto. **/ UINT16 VddqVoltageOverride; -/** Offset 0x0336 - VccIog Voltage Override +/** Offset 0x02DE - VccIog Voltage Override # is multiple of 1mV where 0 means Auto. **/ UINT16 VccIogVoltageOverride; -/** Offset 0x0338 - VccClk Voltage Override +/** Offset 0x02E0 - VccClk Voltage Override # is multiple of 1mV where 0 means Auto. **/ UINT16 VccClkVoltageOverride; -/** Offset 0x033A - ThrtCkeMinTmrLpddr +/** Offset 0x02E2 - ThrtCkeMinTmrLpddr Throttler CKE min timer for LPDDR: 0=Minimal, 0xFF=Maximum, 0x00=Default **/ UINT8 ThrtCkeMinTmrLpddr; -/** Offset 0x033B - Reserved +/** Offset 0x02E3 - Reserved **/ - UINT8 Reserved41; + UINT8 Reserved30; -/** Offset 0x033C - Margin limit check L2 +/** Offset 0x02E4 - Margin limit check L2 Margin limit check L2 threshold: 100=Default **/ UINT16 MarginLimitL2; -/** Offset 0x033E - Extended Bank Hashing +/** Offset 0x02E6 - Extended Bank Hashing Eanble/Disable ExtendedBankHashing $EN_DIS **/ UINT8 ExtendedBankHashing; -/** Offset 0x033F - Reserved +/** Offset 0x02E7 - Reserved **/ - UINT8 Reserved42; + UINT8 Reserved31; -/** Offset 0x0340 - Command Pins Mapping +/** Offset 0x02E8 - LP5 Command Pins Mapping BitMask where bits [3:0] are Controller 0 Channel [3:0] and bits [7:4] are Controller 1 Channel [3:0]. 0 = CCC pin mapping is Ascending, 1 = CCC pin mapping is Descending. **/ UINT8 Lp5CccConfig; -/** Offset 0x0341 - Command Pins Mirrored +/** Offset 0x02E9 - Command Pins Mirrored BitMask where bits [3:0] are Controller 0 Channel [3:0] and bits [7:4] are Controller 1 Channel [3:0]. 0 = No Command Mirror and 1 = Command Mirror. **/ UINT8 CmdMirror; -/** Offset 0x0342 - Time Measure +/** Offset 0x02EA - Time Measure Time Measure: 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 MrcTimeMeasure; -/** Offset 0x0343 - Reserved +/** Offset 0x02EB - Reserved **/ - UINT8 Reserved43[8]; + UINT8 Reserved32[66]; -/** Offset 0x034B - Board Type +/** Offset 0x032D - Board Type MrcBoardType, Options are 0=Mobile/Mobile Halo, 1=Desktop/DT Halo, 5=ULT/ULX/Mobile Halo, 7=UP Server 0:Mobile/Mobile Halo, 1:Desktop/DT Halo, 5:ULT/ULX/Mobile Halo, 7:UP Server **/ UINT8 UserBd; -/** Offset 0x034C - Spd Address Table +/** Offset 0x032E - Spd Address Table Specify SPD Address table for CH0D0/CH0D1/CH1D0&CH1D1. MemorySpdPtr will be used if SPD Address is 00 **/ UINT8 SpdAddressTable[16]; -/** Offset 0x035C - Enable/Disable MRC TXT dependency +/** Offset 0x033E - Enable/Disable MRC TXT dependency When enabled MRC execution will wait for TXT initialization to be done first. Disabled(0x0)(Default): MRC will not wait for TXT initialization, Enabled(0x1): MRC will wait for TXT initialization $EN_DIS **/ UINT8 TxtImplemented; -/** Offset 0x035D - Reserved +/** Offset 0x033F - Reserved **/ - UINT8 Reserved44; + UINT8 Reserved33; -/** Offset 0x035E - Skip external display device scanning +/** Offset 0x0340 - Skip external display device scanning Enable: Do not scan for external display device, Disable (Default): Scan external display devices $EN_DIS **/ UINT8 SkipExtGfxScan; -/** Offset 0x035F - Generate BIOS Data ACPI Table +/** Offset 0x0341 - Generate BIOS Data ACPI Table Enable: Generate BDAT for MRC RMT or SA PCIe data. Disable (Default): Do not generate it $EN_DIS **/ UINT8 BdatEnable; -/** Offset 0x0360 - BdatTestType +/** Offset 0x0342 - BdatTestType Indicates the type of Memory Training data to populate into the BDAT ACPI table. 0:RMT per Rank, 1:RMT per Bit, 2:Margin2D **/ UINT8 BdatTestType; -/** Offset 0x0361 - Enable PCH HSIO PCIE Rx Set Ctle +/** Offset 0x0343 - Enable PCH HSIO PCIE Rx Set Ctle Enable PCH PCIe Gen 3 Set CTLE Value. **/ UINT8 PchPcieHsioRxSetCtleEnable[28]; -/** Offset 0x037D - PCH HSIO PCIE Rx Set Ctle Value +/** Offset 0x035F - PCH HSIO PCIE Rx Set Ctle Value PCH PCIe Gen 3 Set CTLE Value. **/ UINT8 PchPcieHsioRxSetCtle[28]; -/** Offset 0x0399 - Enble PCH HSIO PCIE TX Gen 1 Downscale Amplitude Adjustment value override +/** Offset 0x037B - Enble PCH HSIO PCIE TX Gen 1 Downscale Amplitude Adjustment value override 0: Disable; 1: Enable. **/ UINT8 PchPcieHsioTxGen1DownscaleAmpEnable[28]; -/** Offset 0x03B5 - PCH HSIO PCIE Gen 2 TX Output Downscale Amplitude Adjustment value +/** Offset 0x0397 - PCH HSIO PCIE Gen 2 TX Output Downscale Amplitude Adjustment value PCH PCIe Gen 2 TX Output Downscale Amplitude Adjustment value. **/ UINT8 PchPcieHsioTxGen1DownscaleAmp[28]; -/** Offset 0x03D1 - Enable PCH HSIO PCIE TX Gen 2 Downscale Amplitude Adjustment value override +/** Offset 0x03B3 - Enable PCH HSIO PCIE TX Gen 2 Downscale Amplitude Adjustment value override 0: Disable; 1: Enable. **/ UINT8 PchPcieHsioTxGen2DownscaleAmpEnable[28]; -/** Offset 0x03ED - PCH HSIO PCIE Gen 2 TX Output Downscale Amplitude Adjustment value +/** Offset 0x03CF - PCH HSIO PCIE Gen 2 TX Output Downscale Amplitude Adjustment value PCH PCIe Gen 2 TX Output Downscale Amplitude Adjustment value. **/ UINT8 PchPcieHsioTxGen2DownscaleAmp[28]; -/** Offset 0x0409 - Enable PCH HSIO PCIE TX Gen 3 Downscale Amplitude Adjustment value override +/** Offset 0x03EB - Enable PCH HSIO PCIE TX Gen 3 Downscale Amplitude Adjustment value override 0: Disable; 1: Enable. **/ UINT8 PchPcieHsioTxGen3DownscaleAmpEnable[28]; -/** Offset 0x0425 - PCH HSIO PCIE Gen 3 TX Output Downscale Amplitude Adjustment value +/** Offset 0x0407 - PCH HSIO PCIE Gen 3 TX Output Downscale Amplitude Adjustment value PCH PCIe Gen 3 TX Output Downscale Amplitude Adjustment value. **/ UINT8 PchPcieHsioTxGen3DownscaleAmp[28]; -/** Offset 0x0441 - Enable PCH HSIO PCIE Gen 1 TX Output De-Emphasis Adjustment Setting value override +/** Offset 0x0423 - Enable PCH HSIO PCIE Gen 1 TX Output De-Emphasis Adjustment Setting value override 0: Disable; 1: Enable. **/ UINT8 PchPcieHsioTxGen1DeEmphEnable[28]; -/** Offset 0x045D - PCH HSIO PCIE Gen 1 TX Output De-Emphasis Adjustment value +/** Offset 0x043F - PCH HSIO PCIE Gen 1 TX Output De-Emphasis Adjustment value PCH PCIe Gen 1 TX Output De-Emphasis Adjustment Setting. **/ UINT8 PchPcieHsioTxGen1DeEmph[28]; -/** Offset 0x0479 - Enable PCH HSIO PCIE Gen 2 TX Output -3.5dB De-Emphasis Adjustment Setting value override +/** Offset 0x045B - Enable PCH HSIO PCIE Gen 2 TX Output -3.5dB De-Emphasis Adjustment Setting value override 0: Disable; 1: Enable. **/ UINT8 PchPcieHsioTxGen2DeEmph3p5Enable[28]; -/** Offset 0x0495 - PCH HSIO PCIE Gen 2 TX Output -3.5dB De-Emphasis Adjustment value +/** Offset 0x0477 - PCH HSIO PCIE Gen 2 TX Output -3.5dB De-Emphasis Adjustment value PCH PCIe Gen 2 TX Output -3.5dB De-Emphasis Adjustment Setting. **/ UINT8 PchPcieHsioTxGen2DeEmph3p5[28]; -/** Offset 0x04B1 - Enable PCH HSIO PCIE Gen 2 TX Output -6.0dB De-Emphasis Adjustment Setting value override +/** Offset 0x0493 - Enable PCH HSIO PCIE Gen 2 TX Output -6.0dB De-Emphasis Adjustment Setting value override 0: Disable; 1: Enable. **/ UINT8 PchPcieHsioTxGen2DeEmph6p0Enable[28]; -/** Offset 0x04CD - PCH HSIO PCIE Gen 2 TX Output -6.0dB De-Emphasis Adjustment value +/** Offset 0x04AF - PCH HSIO PCIE Gen 2 TX Output -6.0dB De-Emphasis Adjustment value PCH PCIe Gen 2 TX Output -6.0dB De-Emphasis Adjustment Setting. **/ UINT8 PchPcieHsioTxGen2DeEmph6p0[28]; -/** Offset 0x04E9 - HD Audio DMIC Link Clock Select +/** Offset 0x04CB - HD Audio DMIC Link Clock Select Determines DMIC Clock Source. 0: Both, 1: ClkA, 2: ClkB 0: Both, 1: ClkA, 2: ClkB **/ UINT8 PchHdaAudioLinkDmicClockSelect[2]; -/** Offset 0x04EB - Enable Intel HD Audio (Azalia) +/** Offset 0x04CD - Enable Intel HD Audio (Azalia) 0: Disable, 1: Enable (Default) Azalia controller $EN_DIS **/ UINT8 PchHdaEnable; -/** Offset 0x04EC - Universal Audio Architecture compliance for DSP enabled system +/** Offset 0x04CE - Universal Audio Architecture compliance for DSP enabled system 0: Not-UAA Compliant (Intel SST driver supported only), 1: UAA Compliant (HDA Inbox driver or SST driver supported). $EN_DIS **/ UINT8 PchHdaDspUaaCompliance; -/** Offset 0x04ED - Enable HD Audio Link +/** Offset 0x04CF - Enable HD Audio Link Enable/disable HD Audio Link. Muxed with SSP0/SSP1/SNDW1. $EN_DIS **/ UINT8 PchHdaAudioLinkHdaEnable; -/** Offset 0x04EE - Enable HDA SDI lanes +/** Offset 0x04D0 - Enable HDA SDI lanes Enable/disable HDA SDI lanes. **/ UINT8 PchHdaSdiEnable[2]; -/** Offset 0x04F0 - Enable HD Audio DMIC_N Link +/** Offset 0x04D2 - Enable HD Audio DMIC_N Link Enable/disable HD Audio DMIC1 link. Muxed with SNDW3. **/ UINT8 PchHdaAudioLinkDmicEnable[2]; -/** Offset 0x04F2 - Reserved -**/ - UINT8 Reserved45[2]; - -/** Offset 0x04F4 - DMIC ClkA Pin Muxing (N - DMIC number) +/** Offset 0x04D4 - DMIC ClkA Pin Muxing (N - DMIC number) Determines DMIC ClkA Pin muxing. See GPIO_*_MUXING_DMIC_CLKA_* **/ UINT32 PchHdaAudioLinkDmicClkAPinMux[2]; -/** Offset 0x04FC - Enable HD Audio DSP +/** Offset 0x04DC - Enable HD Audio DSP Enable/disable HD Audio DSP feature. $EN_DIS **/ UINT8 PchHdaDspEnable; -/** Offset 0x04FD - Reserved +/** Offset 0x04DD - Reserved **/ - UINT8 Reserved46[3]; + UINT8 Reserved34[3]; -/** Offset 0x0500 - DMIC Data Pin Muxing +/** Offset 0x04E0 - DMIC Data Pin Muxing Determines DMIC Data Pin muxing. See GPIO_*_MUXING_DMIC_DATA_* **/ UINT32 PchHdaAudioLinkDmicDataPinMux[2]; -/** Offset 0x0508 - Enable HD Audio SSP0 Link +/** Offset 0x04E8 - Enable HD Audio SSP0 Link Enable/disable HD Audio SSP_N/I2S link. Muxed with HDA. N-number 0-5 **/ UINT8 PchHdaAudioLinkSspEnable[7]; -/** Offset 0x050F - Reserved +/** Offset 0x04EF - Reserved **/ - UINT8 Reserved47[117]; + UINT8 Reserved35[117]; -/** Offset 0x0584 - Enable HD Audio SoundWire#N Link +/** Offset 0x0564 - Enable HD Audio SoundWire#N Link Enable/disable HD Audio SNDW#N link. Muxed with HDA. **/ UINT8 PchHdaAudioLinkSndwEnable[5]; -/** Offset 0x0589 - iDisp-Link Frequency +/** Offset 0x0569 - iDisp-Link Frequency iDisp-Link Freq (PCH_HDAUDIO_LINK_FREQUENCY enum): 4: 96MHz, 3: 48MHz. 4: 96MHz, 3: 48MHz **/ UINT8 PchHdaIDispLinkFrequency; -/** Offset 0x058A - iDisp-Link T-mode +/** Offset 0x056A - iDisp-Link T-mode iDisp-Link T-Mode (PCH_HDAUDIO_IDISP_TMODE enum): 0: 2T, 2: 4T, 3: 8T, 4: 16T 0: 2T, 2: 4T, 3: 8T, 4: 16T **/ UINT8 PchHdaIDispLinkTmode; -/** Offset 0x058B - Reserved +/** Offset 0x056B - Reserved **/ - UINT8 Reserved48[45]; + UINT8 Reserved36[45]; -/** Offset 0x05B8 - iDisplay Audio Codec disconnection +/** Offset 0x0598 - iDisplay Audio Codec disconnection 0: Not disconnected, enumerable, 1: Disconnected SDI, not enumerable. $EN_DIS **/ UINT8 PchHdaIDispCodecDisconnect; -/** Offset 0x05B9 - Reserved +/** Offset 0x0599 - Reserved **/ - UINT8 Reserved49[5]; + UINT8 Reserved37[5]; -/** Offset 0x05BE - HDA Power/Clock Gating (PGD/CGD) +/** Offset 0x059E - HDA Power/Clock Gating (PGD/CGD) Enable/Disable HD Audio Power and Clock Gating(POR: Enable). 0: PLATFORM_POR, 1: FORCE_ENABLE, 2: FORCE_DISABLE. 0: POR, 1: Force Enable, 2: Force Disable **/ UINT8 PchHdaTestPowerClockGating; -/** Offset 0x05BF - Reserved +/** Offset 0x059F - Reserved **/ - UINT8 Reserved50[7]; + UINT8 Reserved38; -/** Offset 0x05C6 - Usage type for ClkSrc +/** Offset 0x05A0 - Audio Sub System IDs + Set default Audio Sub System IDs. If its set to 0 then value from Strap is used. +**/ + UINT32 PchHdaSubSystemIds; + +/** Offset 0x05A4 - Reserved +**/ + UINT8 Reserved39; + +/** Offset 0x05A5 - PCH LPC Enhance the port 8xh decoding + Original LPC only decodes one byte of port 80h. + $EN_DIS +**/ + UINT8 PchLpcEnhancePort8xhDecoding; + +/** Offset 0x05A6 - Usage type for ClkSrc 0-23: PCH rootport, 0x70:LAN, 0x80: unspecified but in use (free running), 0xFF: not used **/ UINT8 PcieClkSrcUsage[18]; -/** Offset 0x05D8 - ClkReq-to-ClkSrc mapping +/** Offset 0x05B8 - ClkReq-to-ClkSrc mapping Number of ClkReq signal assigned to ClkSrc **/ UINT8 PcieClkSrcClkReq[18]; -/** Offset 0x05EA - Reserved +/** Offset 0x05CA - Reserved **/ - UINT8 Reserved51[46]; + UINT8 Reserved40[46]; -/** Offset 0x0618 - Enable PCIE RP Mask +/** Offset 0x05F8 - Enable PCIE RP Mask Enable/disable PCIE Root Ports. 0: disable, 1: enable. One bit for each port, bit0 for port1, bit1 for port2, and so on. **/ UINT32 PcieRpEnableMask; -/** Offset 0x061C - Debug Interfaces +/** Offset 0x05FC - Debug Interfaces Debug Interfaces. BIT0-RAM, BIT1-UART, BIT3-USB3, BIT4-Serial IO, BIT5-TraceHub, BIT2 - Not used. **/ UINT8 PcdDebugInterfaceFlags; -/** Offset 0x061D - Reserved +/** Offset 0x05FD - Reserved **/ - UINT8 Reserved52[3]; + UINT8 Reserved41[3]; -/** Offset 0x0620 - Serial Io Uart Debug Mmio Base +/** Offset 0x0600 - Serial Io Uart Debug Mmio Base Select SerialIo Uart default MMIO resource in SEC/PEI phase when PcdLpssUartMode = SerialIoUartPci. **/ UINT32 SerialIoUartDebugMmioBase; -/** Offset 0x0624 - PcdSerialDebugLevel +/** Offset 0x0604 - PcdSerialDebugLevel Serial Debug Message Level. 0:Disable, 1:Error Only, 2:Error & Warnings, 3:Load, Error, Warnings & Info, 4:Load, Error, Warnings, Info & Event, 5:Load, Error, Warnings, Info & Verbose. @@ -1784,7 +1748,7 @@ typedef struct { **/ UINT8 PcdSerialDebugLevel; -/** Offset 0x0625 - SerialDebugMrcLevel +/** Offset 0x0605 - SerialDebugMrcLevel MRC Serial Debug Message Level. 0:Disable, 1:Error Only, 2:Error & Warnings, 3:Load, Error, Warnings & Info, 4:Load, Error, Warnings, Info & Event, 5:Load, Error, Warnings, Info & Verbose. @@ -1793,318 +1757,318 @@ typedef struct { **/ UINT8 SerialDebugMrcLevel; -/** Offset 0x0626 - Serial Io Uart Debug Controller Number +/** Offset 0x0606 - Serial Io Uart Debug Controller Number Select SerialIo Uart Controller for debug. Note: If UART0 is selected as CNVi BT Core interface, it cannot be used for debug purpose. 0:SerialIoUart0, 1:SerialIoUart1, 2:SerialIoUart2 **/ UINT8 SerialIoUartDebugControllerNumber; -/** Offset 0x0627 - Serial Io Uart Debug Parity +/** Offset 0x0607 - Serial Io Uart Debug Parity Set default Parity. 0: DefaultParity, 1: NoParity, 2: EvenParity, 3: OddParity **/ UINT8 SerialIoUartDebugParity; -/** Offset 0x0628 - Serial Io Uart Debug BaudRate +/** Offset 0x0608 - Serial Io Uart Debug BaudRate Set default BaudRate Supported from 0 - default to 6000000. Recommended values 9600, 19200, 57600, 115200, 460800, 921600, 1500000, 1843200, 3000000, 3686400, 6000000 **/ UINT32 SerialIoUartDebugBaudRate; -/** Offset 0x062C - Serial Io Uart Debug Stop Bits +/** Offset 0x060C - Serial Io Uart Debug Stop Bits Set default stop bits. 0: DefaultStopBits, 1: OneStopBit, 2: OneFiveStopBits, 3: TwoStopBits **/ UINT8 SerialIoUartDebugStopBits; -/** Offset 0x062D - Serial Io Uart Debug Data Bits +/** Offset 0x060D - Serial Io Uart Debug Data Bits Set default word length. 0: Default, 5,6,7,8 5:5BITS, 6:6BITS, 7:7BITS, 8:8BITS **/ UINT8 SerialIoUartDebugDataBits; -/** Offset 0x062E - IMGU CLKOUT Configuration +/** Offset 0x060E - IMGU CLKOUT Configuration The configuration of IMGU CLKOUT, 0: Disable;1: Enable. $EN_DIS **/ UINT8 ImguClkOutEn[6]; -/** Offset 0x0634 - Enable/Disable SA IPU +/** Offset 0x0614 - Enable/Disable SA IPU Enable(Default): Enable SA IPU, Disable: Disable SA IPU $EN_DIS **/ UINT8 SaIpuEnable; -/** Offset 0x0635 - Disable and Lock Watch Dog Register +/** Offset 0x0615 - Disable and Lock Watch Dog Register Set 1 to clear WDT status, then disable and lock WDT registers. $EN_DIS **/ UINT8 WdtDisableAndLock; -/** Offset 0x0636 - Reserved +/** Offset 0x0616 - Reserved **/ - UINT8 Reserved53[6]; + UINT8 Reserved42[2]; -/** Offset 0x063C - HECI Timeouts +/** Offset 0x0618 - HECI Timeouts 0: Disable, 1: Enable (Default) timeout check for HECI $EN_DIS **/ UINT8 HeciTimeouts; -/** Offset 0x063D - HECI2 Interface Communication +/** Offset 0x0619 - HECI2 Interface Communication Test, 0: disable, 1: enable, Adds or Removes HECI2 Device from PCI space. $EN_DIS **/ UINT8 HeciCommunication2; -/** Offset 0x063E - Check HECI message before send +/** Offset 0x061A - Check HECI message before send Test, 0: disable, 1: enable, Enable/Disable message check. $EN_DIS **/ UINT8 DisableMessageCheck; -/** Offset 0x063F - Force ME DID Init Status +/** Offset 0x061B - Force ME DID Init Status Test, 0: disable, 1: Success, 2: No Memory in Channels, 3: Memory Init Error, Set ME DID init stat value $EN_DIS **/ UINT8 DidInitStat; -/** Offset 0x0640 - Enable KT device +/** Offset 0x061C - Enable KT device Test, 0: POR, 1: enable, 2: disable, Enable or Disable KT device. $EN_DIS **/ UINT8 KtDeviceEnable; -/** Offset 0x0641 - CPU Replaced Polling Disable +/** Offset 0x061D - CPU Replaced Polling Disable Test, 0: disable, 1: enable, Setting this option disables CPU replacement polling loop $EN_DIS **/ UINT8 DisableCpuReplacedPolling; -/** Offset 0x0642 - Skip CPU replacement check +/** Offset 0x061E - Skip CPU replacement check Test, 0: disable, 1: enable, Setting this option to skip CPU replacement check $EN_DIS **/ UINT8 SkipCpuReplacementCheck; -/** Offset 0x0643 - Skip MBP HOB +/** Offset 0x061F - Skip MBP HOB Test, 0: disable, 1: enable, Enable/Disable sending MBP message and creating MBP Hob. $EN_DIS **/ UINT8 SkipMbpHob; -/** Offset 0x0644 - Reserved +/** Offset 0x0620 - Reserved **/ - UINT8 Reserved54[2]; + UINT8 Reserved43[2]; -/** Offset 0x0646 - ISA Serial Base selection +/** Offset 0x0622 - ISA Serial Base selection Select ISA Serial Base address. Default is 0x3F8. 0:0x3F8, 1:0x2F8 **/ UINT8 PcdIsaSerialUartBase; -/** Offset 0x0647 - PcdSerialDebugBaudRate +/** Offset 0x0623 - PcdSerialDebugBaudRate Baud Rate for Serial Debug Messages. 3:9600, 4:19200, 6:56700, 7:115200. 3:9600, 4:19200, 6:56700, 7:115200 **/ UINT8 PcdSerialDebugBaudRate; -/** Offset 0x0648 - Post Code Output Port +/** Offset 0x0624 - Post Code Output Port This option configures Post Code Output Port **/ UINT16 PostCodeOutputPort; -/** Offset 0x064A - Reserved +/** Offset 0x0626 - Reserved **/ - UINT8 Reserved55[26]; + UINT8 Reserved44[22]; -/** Offset 0x0664 - Enable SMBus +/** Offset 0x063C - Enable SMBus Enable/disable SMBus controller. $EN_DIS **/ UINT8 SmbusEnable; -/** Offset 0x0665 - Enable SMBus ARP support +/** Offset 0x063D - Enable SMBus ARP support Enable SMBus ARP support. $EN_DIS **/ UINT8 SmbusArpEnable; -/** Offset 0x0666 - Number of RsvdSmbusAddressTable. +/** Offset 0x063E - Number of RsvdSmbusAddressTable. The number of elements in the RsvdSmbusAddressTable. **/ UINT8 PchNumRsvdSmbusAddresses; -/** Offset 0x0667 - Reserved +/** Offset 0x063F - Reserved **/ - UINT8 Reserved56; + UINT8 Reserved45; -/** Offset 0x0668 - SMBUS Base Address +/** Offset 0x0640 - SMBUS Base Address SMBUS Base Address (IO space). **/ UINT16 PchSmbusIoBase; -/** Offset 0x066A - Enable SMBus Alert Pin +/** Offset 0x0642 - Enable SMBus Alert Pin Enable SMBus Alert Pin. $EN_DIS **/ UINT8 PchSmbAlertEnable; -/** Offset 0x066B - Reserved +/** Offset 0x0643 - Reserved **/ - UINT8 Reserved57[13]; + UINT8 Reserved46[13]; -/** Offset 0x0678 - Smbus dynamic power gating +/** Offset 0x0650 - Smbus dynamic power gating Disable or Enable Smbus dynamic power gating. $EN_DIS **/ UINT8 SmbusDynamicPowerGating; -/** Offset 0x0679 - SMBUS SPD Write Disable +/** Offset 0x0651 - SMBUS SPD Write Disable Set/Clear Smbus SPD Write Disable. 0: leave SPD Write Disable bit; 1: set SPD Write Disable bit. For security recommendations, SPD write disable bit must be set. $EN_DIS **/ UINT8 SmbusSpdWriteDisable; -/** Offset 0x067A - Enable/Disable SA OcSupport +/** Offset 0x0652 - Enable/Disable SA OcSupport Enable: Enable SA OcSupport, Disable(Default): Disable SA OcSupport $EN_DIS **/ UINT8 SaOcSupport; -/** Offset 0x067B - Reserved +/** Offset 0x0653 - Reserved **/ - UINT8 Reserved58[18]; + UINT8 Reserved47[18]; -/** Offset 0x068D - Over clocking support +/** Offset 0x0665 - Over clocking support Over clocking support; 0: Disable; 1: Enable $EN_DIS **/ UINT8 OcSupport; -/** Offset 0x068E - Reserved +/** Offset 0x0666 - Reserved **/ - UINT8 Reserved59; + UINT8 Reserved48; -/** Offset 0x068F - Realtime Memory Timing +/** Offset 0x0667 - Realtime Memory Timing 0(Default): Disabled, 1: Enabled. When enabled, it will allow the system to perform realtime memory timing changes after MRC_DONE. 0: Disabled, 1: Enabled **/ UINT8 RealtimeMemoryTiming; -/** Offset 0x0690 - core voltage override +/** Offset 0x0668 - core voltage override The core voltage override which is applied to the entire range of cpu core frequencies. Valid Range 0 to 2000 **/ UINT16 CoreVoltageOverride; -/** Offset 0x0692 - Core Turbo voltage Offset +/** Offset 0x066A - Core Turbo voltage Offset The voltage offset applied to the core while operating in turbo mode.Valid Range 0 to 1000 **/ UINT16 CoreVoltageOffset; -/** Offset 0x0694 - Core PLL voltage offset +/** Offset 0x066C - Core PLL voltage offset Core PLL voltage offset. 0: No offset. Range 0-15 **/ UINT8 CorePllVoltageOffset; -/** Offset 0x0695 - AVX2 Ratio Offset +/** Offset 0x066D - AVX2 Ratio Offset 0(Default)= No Offset. Range 0 - 31. Specifies number of bins to decrease AVX ratio vs. Core Ratio. Uses Mailbox MSR 0x150, cmd 0x1B. **/ UINT8 Avx2RatioOffset; -/** Offset 0x0696 - BCLK Adaptive Voltage Enable +/** Offset 0x066E - BCLK Adaptive Voltage Enable When enabled, the CPU V/F curves are aware of BCLK frequency when calculated. 0: Disable; 1: Enable $EN_DIS **/ UINT8 BclkAdaptiveVoltage; -/** Offset 0x0697 - Ring Downbin +/** Offset 0x066F - Ring Downbin Ring Downbin enable/disable. When enabled, CPU will ensure the ring ratio is always lower than the core ratio.0: Disable; 1: Enable. $EN_DIS **/ UINT8 RingDownBin; -/** Offset 0x0698 - Row Hammer pTRR LFSR0 Mask +/** Offset 0x0670 - Row Hammer pTRR LFSR0 Mask Row Hammer pTRR LFSR0 Mask, 1/2^(value) **/ UINT8 Lfsr0Mask; -/** Offset 0x0699 - Margin Limit Check +/** Offset 0x0671 - Margin Limit Check Margin Limit Check. Choose level of margin check 0:Disable, 1:L1, 2:L2, 3:Both **/ UINT8 MarginLimitCheck; -/** Offset 0x069A - Row Hammer pTRR LFSR1 Mask +/** Offset 0x0672 - Row Hammer pTRR LFSR1 Mask Row Hammer pTRR LFSR1 Mask, 1/2^(value) **/ UINT8 Lfsr1Mask; -/** Offset 0x069B - Reserved +/** Offset 0x0673 - Reserved **/ - UINT8 Reserved60[2]; + UINT8 Reserved49[2]; -/** Offset 0x069D - TjMax Offset +/** Offset 0x0675 - TjMax Offset TjMax offset.Specified value here is clipped by pCode (125 - TjMax Offset) to support TjMax in the range of 62 to 115 deg Celsius. Valid Range 10 - 63 **/ UINT8 TjMaxOffset; -/** Offset 0x069E - Reserved +/** Offset 0x0676 - Reserved **/ - UINT8 Reserved61[48]; + UINT8 Reserved50[48]; -/** Offset 0x06CE - Core VF Point Offset +/** Offset 0x06A6 - Core VF Point Offset Array used to specifies the Core Voltage Offset applied to the each selected VF Point. This voltage is specified in millivolts. **/ UINT16 CoreVfPointOffset[15]; -/** Offset 0x06EC - Core VF Point Offset Prefix +/** Offset 0x06C4 - Core VF Point Offset Prefix Sets the CoreVfPointOffset value as positive or negative for corresponding core VF Point; 0: Positive ; 1: Negative. 0:Positive, 1:Negative **/ UINT8 CoreVfPointOffsetPrefix[15]; -/** Offset 0x06FB - Core VF Point Ratio +/** Offset 0x06D3 - Core VF Point Ratio Array for the each selected Core VF Point to display the ration. **/ UINT8 CoreVfPointRatio[15]; -/** Offset 0x070A - Reserved +/** Offset 0x06E2 - Reserved **/ - UINT8 Reserved62[26]; + UINT8 Reserved51[26]; -/** Offset 0x0724 - Per Core Max Ratio override +/** Offset 0x06FC - Per Core Max Ratio override Enable or disable Per Core PState OC supported by writing OCMB 0x1D to program new favored core ratio to each Core. 0: Disable, 1: enable $EN_DIS **/ UINT8 PerCoreRatioOverride; -/** Offset 0x0725 - Reserved +/** Offset 0x06FD - Reserved **/ - UINT8 Reserved63[25]; + UINT8 Reserved52[25]; -/** Offset 0x073E - Per Core Current Max Ratio +/** Offset 0x0716 - Per Core Current Max Ratio Array for the Per Core Max Ratio **/ UINT8 PerCoreRatio[8]; -/** Offset 0x0746 - Reserved +/** Offset 0x071E - Reserved **/ - UINT8 Reserved64[8]; + UINT8 Reserved53[8]; -/** Offset 0x074E - Pvd Ratio Threshold for SOC/CPU die +/** Offset 0x0726 - Pvd Ratio Threshold for SOC/CPU die Array of Pvd Ratio Threshold for SOC/CPU die is the threshold value for input ratio (P0 to Pn) to select the multiplier so that the output is within the DCO frequency range. As per the die selected, this threshold is applied to SA and MC/CMI PLL @@ -2113,63 +2077,63 @@ typedef struct { **/ UINT8 PvdRatioThreshold; -/** Offset 0x074F - Reserved +/** Offset 0x0727 - Reserved **/ - UINT8 Reserved65[65]; + UINT8 Reserved54[65]; -/** Offset 0x0790 - CPU BCLK OC Frequency +/** Offset 0x0768 - CPU BCLK OC Frequency CPU BCLK OC Frequency in KHz units. 98000000Hz = 98MHz 0 - Auto. Range is 40Mhz-1000Mhz. **/ UINT32 CpuBclkOcFrequency; -/** Offset 0x0794 - Reserved +/** Offset 0x076C - Reserved **/ - UINT8 Reserved66[13]; + UINT8 Reserved55[13]; -/** Offset 0x07A1 - Avx2 Voltage Guardband Scaling Factor +/** Offset 0x0779 - Avx2 Voltage Guardband Scaling Factor AVX2 Voltage Guardband Scale factor applied to AVX2 workloads. Range is 0-200 in 1/100 units, where a value of 125 would apply a 1.25 scale factor. **/ UINT8 Avx2VoltageScaleFactor; -/** Offset 0x07A2 - Ring PLL voltage offset +/** Offset 0x077A - Ring PLL voltage offset Core PLL voltage offset. 0: No offset. Range 0-15 **/ UINT8 RingPllVoltageOffset; -/** Offset 0x07A3 - Reserved +/** Offset 0x077B - Reserved **/ - UINT8 Reserved67[5]; + UINT8 Reserved56[5]; -/** Offset 0x07A8 - Enable PCH ISH Controller +/** Offset 0x0780 - Enable PCH ISH Controller 0: Disable, 1: Enable (Default) ISH Controller $EN_DIS **/ UINT8 PchIshEnable; -/** Offset 0x07A9 - Reserved +/** Offset 0x0781 - Reserved **/ - UINT8 Reserved68; + UINT8 Reserved57; -/** Offset 0x07AA - BiosSize +/** Offset 0x0782 - BiosSize The size of the BIOS region of the IFWI. Used if FspmUpd->FspmConfig.BiosGuard != 0. If BiosGuard is enabled, MRC will increase the size of the DPR (DMA Protected Range) so that a BIOS Update Script can be stored in the DPR. **/ UINT16 BiosSize; -/** Offset 0x07AC - BiosGuard +/** Offset 0x0784 - BiosGuard Enable/Disable. 0: Disable, Enable/Disable BIOS Guard feature, 1: enable $EN_DIS **/ UINT8 BiosGuard; -/** Offset 0x07AD +/** Offset 0x0785 **/ UINT8 BiosGuardToolsInterface; -/** Offset 0x07AE - Txt +/** Offset 0x0786 - Txt Enables utilization of additional hardware capabilities provided by Intel (R) Trusted Execution Technology. Changes require a full power cycle to take effect. 0: Disable, 1: Enable @@ -2177,318 +2141,415 @@ typedef struct { **/ UINT8 Txt; -/** Offset 0x07AF - Skip Stop PBET Timer Enable/Disable +/** Offset 0x0787 - Skip Stop PBET Timer Enable/Disable Skip Stop PBET Timer; 0: Disable; 1: Enable $EN_DIS **/ UINT8 SkipStopPbet; -/** Offset 0x07B0 - Reserved +/** Offset 0x0788 - Reserved **/ - UINT8 Reserved69[38]; + UINT8 Reserved58[3]; -/** Offset 0x07D6 - BIST on Reset +/** Offset 0x078B - MKTME Key-Id Bits Override Enable + Configure Trust Domain Extension (TDX) to isolate VMs from Virtual-Machine Manager + (VMM)/hypervisor 0: Disable; 1: Enable. + $EN_DIS +**/ + UINT8 GenerateNewTmeKey; + +/** Offset 0x078C - Reserved +**/ + UINT8 Reserved59[4]; + +/** Offset 0x0790 - TME Exclude Base Address + TME Exclude Base Address. +**/ + UINT64 TmeExcludeBase; + +/** Offset 0x0798 - TME Exclude Size Value + TME Exclude Size Value. +**/ + UINT64 TmeExcludeSize; + +/** Offset 0x07A0 - Reserved +**/ + UINT8 Reserved60[14]; + +/** Offset 0x07AE - BIST on Reset Enable/Disable BIST (Built-In Self Test) on reset. 0: Disable; 1: Enable. $EN_DIS **/ UINT8 BistOnReset; -/** Offset 0x07D7 - Reserved +/** Offset 0x07AF - Reserved **/ - UINT8 Reserved70; + UINT8 Reserved61; -/** Offset 0x07D8 - Enable or Disable VMX +/** Offset 0x07B0 - Enable or Disable VMX Enable or Disable VMX, When enabled, a VMM can utilize the additional hardware capabilities provided by Vanderpool Technology. 0: Disable; 1: Enable. $EN_DIS **/ UINT8 VmxEnable; -/** Offset 0x07D9 - Processor Early Power On Configuration FCLK setting +/** Offset 0x07B1 - Processor Early Power On Configuration FCLK setting FCLK frequency can take values of 400MHz, 800MHz and 1GHz. 0: 800 MHz (ULT/ULX). 1: 1 GHz (DT/Halo). Not supported on ULT/ULX.- 2: 400 MHz. - 3: Reserved 0:800 MHz, 1: 1 GHz, 2: 400 MHz, 3: Reserved **/ UINT8 FClkFrequency; -/** Offset 0x07DA - Enable CPU CrashLog +/** Offset 0x07B2 - Enable CPU CrashLog Enable or Disable CPU CrashLog; 0: Disable; 1: Enable. $EN_DIS **/ UINT8 CpuCrashLogEnable; -/** Offset 0x07DB - Enable or Disable TME +/** Offset 0x07B3 - Enable or Disable TME Configure Total Memory Encryption (TME) to protect DRAM data from physical attacks. 0: Disable; 1: Enable. $EN_DIS **/ UINT8 TmeEnable; -/** Offset 0x07DC - CPU Run Control +/** Offset 0x07B4 - CPU Run Control Enable, Disable or Do not configure CPU Run Control; 0: Disable; 1: Enable ; 2: No Change 0:Disabled, 1:Enabled, 2:No Change **/ UINT8 DebugInterfaceEnable; -/** Offset 0x07DD - CPU Run Control Lock +/** Offset 0x07B5 - CPU Run Control Lock Lock or Unlock CPU Run Control; 0: Disable; 1: Enable. $EN_DIS **/ UINT8 DebugInterfaceLockEnable; -/** Offset 0x07DE - Enable CPU CrashLog GPRs dump +/** Offset 0x07B6 - Enable CPU CrashLog GPRs dump Enable or Disable CPU CrashLog GPRs dump; 0: Disable; 1: Enable; 2: Only disable Smm GPRs dump 0:Disabled, 1:Enabled, 2:Only Smm GPRs Disabled **/ UINT8 CrashLogGprs; -/** Offset 0x07DF - Over clocking Lock +/** Offset 0x07B7 - Over clocking Lock Lock Overclocking. 0: Disable; 1: Enable $EN_DIS **/ UINT8 OcLock; -/** Offset 0x07E0 - CPU ratio value +/** Offset 0x07B8 - CPU ratio value This value must be between Max Efficiency Ratio (LFM) and Maximum non-turbo ratio set by Hardware (HFM). Valid Range 0 to 63. **/ UINT8 CpuRatio; -/** Offset 0x07E1 - Number of active big cores +/** Offset 0x07B9 - Number of active big cores Number of P-cores to enable in each processor package. Note: Number of P-Cores and E-Cores are looked at together. When both are {0,0 0:Disable all big cores, 1:1, 2:2, 3:3, 0xFF:Active all big cores **/ UINT8 ActiveCoreCount; -/** Offset 0x07E2 - Reserved +/** Offset 0x07BA - Reserved **/ - UINT8 Reserved71[6]; + UINT8 Reserved62[6]; -/** Offset 0x07E8 - PrmrrSize +/** Offset 0x07C0 - PrmrrSize Enable/Disable. 0: Disable, define default value of PrmrrSize , 1: enable **/ UINT32 PrmrrSize; -/** Offset 0x07EC - Tseg Size +/** Offset 0x07C4 - Tseg Size Size of SMRAM memory reserved. 0x400000 for Release build and 0x1000000 for Debug build 0x0400000:4MB, 0x01000000:16MB **/ UINT32 TsegSize; -/** Offset 0x07F0 - SmmRelocationEnable Enable +/** Offset 0x07C8 - SmmRelocationEnable Enable Enable or Disable SmmRelocationEnable. 0: Disable, 1:Enable $EN_DIS **/ UINT8 SmmRelocationEnable; -/** Offset 0x07F1 - TCC Activation Offset +/** Offset 0x07C9 - TCC Activation Offset TCC Activation Offset. Offset from factory set TCC activation temperature at which the Thermal Control Circuit must be activated. TCC will be activated at TCC Activation Temperature, in volts. Default = 0h. **/ UINT8 TccActivationOffset; -/** Offset 0x07F2 - Reserved +/** Offset 0x07CA - Reserved **/ - UINT8 Reserved72[98]; + UINT8 Reserved63[98]; -/** Offset 0x0854 - SinitMemorySize +/** Offset 0x082C - SinitMemorySize Enable/Disable. 0: Disable, define default value of SinitMemorySize , 1: enable **/ UINT32 SinitMemorySize; -/** Offset 0x0858 - TxtDprMemoryBase +/** Offset 0x0830 - TxtDprMemoryBase Enable/Disable. 0: Disable, define default value of TxtDprMemoryBase , 1: enable **/ UINT64 TxtDprMemoryBase; -/** Offset 0x0860 - TxtHeapMemorySize +/** Offset 0x0838 - TxtHeapMemorySize Enable/Disable. 0: Disable, define default value of TxtHeapMemorySize , 1: enable **/ UINT32 TxtHeapMemorySize; -/** Offset 0x0864 - TxtDprMemorySize +/** Offset 0x083C - TxtDprMemorySize Reserve DPR memory size (0-255) MB. 0: Disable, define default value of TxtDprMemorySize , 1: enable **/ UINT32 TxtDprMemorySize; -/** Offset 0x0868 - TxtLcpPdBase +/** Offset 0x0840 - TxtLcpPdBase Enable/Disable. 0: Disable, define default value of TxtLcpPdBase , 1: enable **/ UINT64 TxtLcpPdBase; -/** Offset 0x0870 - TxtLcpPdSize +/** Offset 0x0848 - TxtLcpPdSize Enable/Disable. 0: Disable, define default value of TxtLcpPdSize , 1: enable **/ UINT64 TxtLcpPdSize; -/** Offset 0x0878 - BiosAcmBase +/** Offset 0x0850 - BiosAcmBase Enable/Disable. 0: Disable, define default value of BiosAcmBase , 1: enable **/ UINT64 BiosAcmBase; -/** Offset 0x0880 - BiosAcmSize +/** Offset 0x0858 - BiosAcmSize Enable/Disable. 0: Disable, define default value of BiosAcmSize , 1: enable **/ UINT32 BiosAcmSize; -/** Offset 0x0884 - ApStartupBase +/** Offset 0x085C - ApStartupBase Enable/Disable. 0: Disable, define default value of BiosAcmBase , 1: enable **/ UINT32 ApStartupBase; -/** Offset 0x0888 - TgaSize +/** Offset 0x0860 - TgaSize Enable/Disable. 0: Disable, define default value of TgaSize , 1: enable **/ UINT32 TgaSize; -/** Offset 0x088C - IsTPMPresence +/** Offset 0x0864 - IsTPMPresence IsTPMPresence default values **/ UINT8 IsTPMPresence; -/** Offset 0x088D - Reserved +/** Offset 0x0865 - Acoustic Noise Mitigation feature + Enabling this option will help mitigate acoustic noise on certain SKUs when the + CPU is in deeper C state. 0: Disabled; 1: Enabled + $EN_DIS **/ - UINT8 Reserved73[157]; + UINT8 AcousticNoiseMitigation; -/** Offset 0x092A - Thermal Design Current enable/disable +/** Offset 0x0866 - Reserved +**/ + UINT8 Reserved64[2]; + +/** Offset 0x0868 - Platform Power Pmax + PSYS PMax power, defined in 1/8 Watt increments. 0 - Auto Specified in 1/8 + Watt increments. Range 0-1024 Watts(0-8191). Value of 800 = 100W +**/ + UINT16 PsysPmax; + +/** Offset 0x086A - Reserved +**/ + UINT8 Reserved65[12]; + +/** Offset 0x0876 - AcLoadline + AC Loadline defined in 1/100 mOhms. A value of 100 = 1.00 mOhm, and 1255 = 12.55 + mOhm. Range is 0-6249 (0-62.49 mOhms). 0 = AUTO/HW default. [0] for IA, [1] for + GT, [2] for SA, [3] through [5] are Reserved. +**/ + UINT16 AcLoadline[6]; + +/** Offset 0x0882 - DcLoadline + DC Loadline defined in 1/100 mOhms. A value of 100 = 1.00 mOhm, and 1255 = 12.55 + mOhm. Range is 0-6249 (0-62.49 mOhms). 0 = AUTO/HW default. [0] for IA, [1] for + GT, [2] for SA, [3] through [5] are Reserved. +**/ + UINT16 DcLoadline[6]; + +/** Offset 0x088E - Reserved +**/ + UINT8 Reserved66[116]; + +/** Offset 0x0902 - Thermal Design Current enable/disable Thermal Design Current enable/disable; 0: Disable; 1: Enable. [0] for IA, [1] for GT, [2] for SA, [3] for atom, [4]-[5] are Reserved. **/ UINT8 TdcEnable[6]; -/** Offset 0x0930 - Reserved +/** Offset 0x0908 - Reserved **/ - UINT8 Reserved74[24]; + UINT8 Reserved67[6]; -/** Offset 0x0948 - Thermal Design Current time window +/** Offset 0x090E - Disable Fast Slew Rate for Deep Package C States for VR domains + This option needs to be configured to reduce acoustic noise during deeper C states. + False: Don't disable Fast ramp during deeper C states; True: Disable Fast ramp + during deeper C state. [0] for IA, [1] for GT, [2] for SA, [3] through [5] are + Reserved. 0: False; 1: True + $EN_DIS +**/ + UINT8 FastPkgCRampDisable[6]; + +/** Offset 0x0914 - Slew Rate configuration for Deep Package C States for VR domains + Set VR IA/GT/SA Slow Slew Rate for Deep Package C State ramp time; Slow slew rate + equals to Fast divided by number, the number is 2, 4, 8, 16 to slow down the slew + rate to help minimize acoustic noise; divide by 16 is disabled for GT/SA. 0: + Fast/2; 1: Fast/4; 2: Fast/8; 3: Fast/16; 0xFF: Ignore the configuration + 0: Fast/2, 1: Fast/4, 2: Fast/8, 3: Fast/16, 0xFF: Ignore the configuration +**/ + UINT8 SlowSlewRate[6]; + +/** Offset 0x091A - Reserved +**/ + UINT8 Reserved68[6]; + +/** Offset 0x0920 - Thermal Design Current time window Auto = 0 is default. Range is from 1ms to 448s. 0: Auto. [0] for IA, [1] for GT, [2] for SA, [3] for atom, [4]-[5] are Reserved. **/ UINT32 TdcTimeWindow[6]; -/** Offset 0x0960 - Reserved +/** Offset 0x0938 - Reserved **/ - UINT8 Reserved75[8]; + UINT8 Reserved69[8]; -/** Offset 0x0968 - DLVR RFI Enable +/** Offset 0x0940 - DLVR RFI Enable Enable/Disable DLVR RFI frequency hopping. 0: Disable; 1: Enable. $EN_DIS **/ UINT8 DlvrRfiEnable; -/** Offset 0x0969 - Reserved +/** Offset 0x0941 - Reserved **/ - UINT8 Reserved76[25]; + UINT8 Reserved70[13]; -/** Offset 0x0982 - Enable/Disable VR FastVmode. The VR will initiate reactive protection if Fast Vmode is enabled. +/** Offset 0x094E - VR Fast Vmode ICC Limit support + Voltage Regulator Fast Vmode ICC Limit. A value of 400 = 100A. A value of 0 corresponds + to feature disabled (no reactive protection). This value represents the current + threshold where the VR would initiate reactive protection if Fast Vmode is enabled. + The value is represented in 1/4 A increments. Range 0-2040. [0] for IA, [1] for + GT, [2] for SA, [3] through [5] are Reserved. +**/ + UINT16 IccLimit[6]; + +/** Offset 0x095A - Enable/Disable VR FastVmode. The VR will initiate reactive protection if Fast Vmode is enabled. Enable/Disable VR FastVmode; 0: Disable; 1: Enable.For all VR by domain 0: Disable, 1: Enable **/ UINT8 EnableFastVmode[6]; -/** Offset 0x0988 - Reserved +/** Offset 0x0960 - Enable/Disable CEP + Control for enabling/disabling CEP (Current Excursion Protection). 0: Disable; 1: Enable + 0: Disable, 1: Enable **/ - UINT8 Reserved77[26]; + UINT8 CepEnable[6]; -/** Offset 0x09A2 - PCH Port80 Route +/** Offset 0x0966 - Reserved +**/ + UINT8 Reserved71[28]; + +/** Offset 0x0982 - PCH Port80 Route Control where the Port 80h cycles are sent, 0: LPC; 1: PCI. $EN_DIS **/ UINT8 PchPort80Route; -/** Offset 0x09A3 - GPIO Override +/** Offset 0x0983 - GPIO Override Gpio Override Level - FSP will not configure any GPIOs and rely on GPIO setings before moved to FSP. Available configurations 0: Disable; 1: Level 1 - Skips GPIO configuration in PEI/FSPM/FSPT phase;2: Level 2 - Reserved for future use **/ UINT8 GpioOverride; -/** Offset 0x09A4 - Reserved +/** Offset 0x0984 - Reserved **/ - UINT8 Reserved78[4]; + UINT8 Reserved72[4]; -/** Offset 0x09A8 - PMR Size +/** Offset 0x0988 - PMR Size Size of PMR memory buffer. 0x400000 for normal boot and 0x200000 for S3 boot **/ UINT32 DmaBufferSize; -/** Offset 0x09AC - The policy for VTd driver behavior +/** Offset 0x098C - The policy for VTd driver behavior BIT0: Enable IOMMU during boot, BIT1: Enable IOMMU when transfer control to OS **/ UINT8 PreBootDmaMask; -/** Offset 0x09AD - State of DMA_CONTROL_GUARANTEE bit in the DMAR table +/** Offset 0x098D - State of DMA_CONTROL_GUARANTEE bit in the DMAR table 0=Disable/Clear, 1=Enable/Set $EN_DIS **/ UINT8 DmaControlGuarantee; -/** Offset 0x09AE - Disable VT-d +/** Offset 0x098E - Disable VT-d 0=Enable/FALSE(VT-d enabled), 1=Disable/TRUE (VT-d disabled) $EN_DIS **/ UINT8 VtdDisable; -/** Offset 0x09AF - Reserved +/** Offset 0x098F - Reserved **/ - UINT8 Reserved79; + UINT8 Reserved73; -/** Offset 0x09B0 - Base addresses for VT-d function MMIO access +/** Offset 0x0990 - Base addresses for VT-d function MMIO access Base addresses for VT-d MMIO access per VT-d engine **/ UINT32 VtdBaseAddress[9]; -/** Offset 0x09D4 - Reserved +/** Offset 0x09B4 - Reserved **/ - UINT8 Reserved80[20]; + UINT8 Reserved74[20]; -/** Offset 0x09E8 - MMIO Size +/** Offset 0x09C8 - MMIO Size Size of MMIO space reserved for devices. 0(Default)=Auto, non-Zero=size in MB **/ UINT16 MmioSize; -/** Offset 0x09EA - MMIO size adjustment for AUTO mode +/** Offset 0x09CA - MMIO size adjustment for AUTO mode Positive number means increasing MMIO size, Negative value means decreasing MMIO size: 0 (Default)=no change to AUTO mode MMIO size **/ UINT16 MmioSizeAdjustment; -/** Offset 0x09EC - Reserved +/** Offset 0x09CC - Reserved **/ - UINT8 Reserved81[36]; + UINT8 Reserved75[36]; -/** Offset 0x0A10 - Enable above 4GB MMIO resource support +/** Offset 0x09F0 - Enable above 4GB MMIO resource support Enable/disable above 4GB MMIO resource support $EN_DIS **/ UINT8 EnableAbove4GBMmio; -/** Offset 0x0A11 - Enable/Disable SA CRID +/** Offset 0x09F1 - Enable/Disable SA CRID Enable: SA CRID, Disable (Default): SA CRID $EN_DIS **/ UINT8 CridEnable; -/** Offset 0x0A12 - Reserved +/** Offset 0x09F2 - Reserved **/ - UINT8 Reserved82[10]; + UINT8 Reserved76[10]; -/** Offset 0x0A1C - Enable/Disable CrashLog Device +/** Offset 0x09FC - Enable/Disable CrashLog Device Enable or Disable CrashLog/Telemetry Device 0- Disable, 1- Enable $EN_DIS **/ UINT32 CpuCrashLogDevice; -/** Offset 0x0A20 - Reserved +/** Offset 0x0A00 - Reserved **/ - UINT8 Reserved83[20]; + UINT8 Reserved77[20]; -/** Offset 0x0A34 - Platform Debug Option +/** Offset 0x0A14 - Platform Debug Option Enabled Trace active: TraceHub is enabled and trace is active, blocks s0ix.\n \n Enabled Trace ready: TraceHub is enabled and allowed S0ix.\n @@ -2501,122 +2562,122 @@ typedef struct { **/ UINT8 PlatformDebugOption; -/** Offset 0x0A35 - Reserved +/** Offset 0x0A15 - Reserved **/ - UINT8 Reserved84[14]; + UINT8 Reserved78[14]; -/** Offset 0x0A43 - Program GPIOs for LFP on DDI port-A device +/** Offset 0x0A23 - Program GPIOs for LFP on DDI port-A device 0=Disabled,1(Default)=eDP, 2=MIPI DSI 0:Disabled, 1:eDP, 2:MIPI DSI **/ UINT8 DdiPortAConfig; -/** Offset 0x0A44 - Reserved +/** Offset 0x0A24 - Reserved **/ - UINT8 Reserved85[2]; + UINT8 Reserved79[2]; -/** Offset 0x0A46 - Program GPIOs for LFP on DDI port-B device +/** Offset 0x0A26 - Program GPIOs for LFP on DDI port-B device 0(Default)=Disabled,1=eDP, 2=MIPI DSI 0:Disabled, 1:eDP, 2:MIPI DSI **/ UINT8 DdiPortBConfig; -/** Offset 0x0A47 - Enable or disable HPD of DDI port A +/** Offset 0x0A27 - Enable or disable HPD of DDI port A 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPortAHpd; -/** Offset 0x0A48 - Enable or disable HPD of DDI port B +/** Offset 0x0A28 - Enable or disable HPD of DDI port B 0=Disable, 1(Default)=Enable $EN_DIS **/ UINT8 DdiPortBHpd; -/** Offset 0x0A49 - Enable or disable HPD of DDI port C +/** Offset 0x0A29 - Enable or disable HPD of DDI port C 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPortCHpd; -/** Offset 0x0A4A - Enable or disable HPD of DDI port 1 +/** Offset 0x0A2A - Enable or disable HPD of DDI port 1 0=Disable, 1(Default)=Enable $EN_DIS **/ UINT8 DdiPort1Hpd; -/** Offset 0x0A4B - Enable or disable HPD of DDI port 2 +/** Offset 0x0A2B - Enable or disable HPD of DDI port 2 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort2Hpd; -/** Offset 0x0A4C - Enable or disable HPD of DDI port 3 +/** Offset 0x0A2C - Enable or disable HPD of DDI port 3 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort3Hpd; -/** Offset 0x0A4D - Enable or disable HPD of DDI port 4 +/** Offset 0x0A2D - Enable or disable HPD of DDI port 4 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort4Hpd; -/** Offset 0x0A4E - Enable or disable DDC of DDI port A +/** Offset 0x0A2E - Enable or disable DDC of DDI port A 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPortADdc; -/** Offset 0x0A4F - Enable or disable DDC of DDI port B +/** Offset 0x0A2F - Enable or disable DDC of DDI port B 0=Disable, 1(Default)=Enable $EN_DIS **/ UINT8 DdiPortBDdc; -/** Offset 0x0A50 - Enable or disable DDC of DDI port C +/** Offset 0x0A30 - Enable or disable DDC of DDI port C 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPortCDdc; -/** Offset 0x0A51 - Enable DDC setting of DDI Port 1 +/** Offset 0x0A31 - Enable DDC setting of DDI Port 1 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort1Ddc; -/** Offset 0x0A52 - Enable DDC setting of DDI Port 2 +/** Offset 0x0A32 - Enable DDC setting of DDI Port 2 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort2Ddc; -/** Offset 0x0A53 - Enable DDC setting of DDI Port 3 +/** Offset 0x0A33 - Enable DDC setting of DDI Port 3 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort3Ddc; -/** Offset 0x0A54 - Enable DDC setting of DDI Port 4 +/** Offset 0x0A34 - Enable DDC setting of DDI Port 4 0(Default)=Disable, 1=Enable $EN_DIS **/ UINT8 DdiPort4Ddc; -/** Offset 0x0A55 - Reserved +/** Offset 0x0A35 - Reserved **/ - UINT8 Reserved86[3]; + UINT8 Reserved80[3]; -/** Offset 0x0A58 - Temporary MMIO address for GMADR +/** Offset 0x0A38 - Temporary MMIO address for GMADR The reference code will use this as Temporary MMIO address space to access GMADR Registers.Platform should provide conflict free Temporary MMIO Range: GmAdr to (GmAdr + 256MB). Default is (PciExpressBaseAddress - 256MB) to (PciExpressBaseAddress - 0x1) **/ UINT64 LMemBar; -/** Offset 0x0A60 - Temporary MMIO address for GTTMMADR +/** Offset 0x0A40 - Temporary MMIO address for GTTMMADR The reference code will use this as Temporary MMIO address space to access GTTMMADR Registers.Platform should provide conflict free Temporary MMIO Range: GttMmAdr to (GttMmAdr + 2MB MMIO + 6MB Reserved + GttSize). Default is (GmAdr - (2MB MMIO @@ -2624,104 +2685,164 @@ typedef struct { **/ UINT64 GttMmAdr; -/** Offset 0x0A68 - Reserved +/** Offset 0x0A48 - Reserved **/ - UINT8 Reserved87[2]; + UINT8 Reserved81[2]; -/** Offset 0x0A6A - Enable/Disable Memory Bandwidth Compression +/** Offset 0x0A4A - Enable/Disable Memory Bandwidth Compression 0=Disable, 1(Default)=Enable $EN_DIS **/ UINT8 MemoryBandwidthCompression; -/** Offset 0x0A6B - Panel Power Enable +/** Offset 0x0A4B - Panel Power Enable Control for enabling/disabling VDD force bit (Required only for early enabling of eDP panel). 0=Disable, 1(Default)=Enable $EN_DIS **/ UINT8 PanelPowerEnable; -/** Offset 0x0A6C - Selection of the primary display device +/** Offset 0x0A4C - Selection of the primary display device 3(Default)=AUTO, 0=IGFX, 4=Hybrid Graphics 3:AUTO, 0:IGFX, 4:HG **/ UINT8 PrimaryDisplay; -/** Offset 0x0A6D - TCSS USB HOST (xHCI) Enable +/** Offset 0x0A4D - Internal Graphics Data Stolen Memory GSM2 + Size of memory preallocated for internal graphics GSM2. + 0:2GB, 1:4GB, 2:6GB, 3:8GB, 4:10GB, 5:12GB, 6:14GB, 7:16GB, 8:18GB, 9:20GB, 10:22GB, + 11:24GB, 12:26GB, 13:28GB, 14:30GB, 15:32GB, 0xFF:No Allocation +**/ + UINT8 IGpuGsm2Size; + +/** Offset 0x0A4E - Reserved +**/ + UINT8 Reserved82[2]; + +/** Offset 0x0A50 - Intel Graphics VBT (Video BIOS Table) Size + Size of Internal Graphics VBT Image +**/ + UINT32 VbtSize; + +/** Offset 0x0A54 - Reserved +**/ + UINT8 Reserved83[4]; + +/** Offset 0x0A58 - Graphics Configuration Ptr + Points to VBT +**/ + UINT64 VbtPtr; + +/** Offset 0x0A60 - SOL Training Message Pointer + Points to SOL Message String +**/ + UINT64 VgaMessage; + +/** Offset 0x0A68 - Platform LID Status for LFP Displays. + LFP Display Lid Status (LID_STATUS enum): 0 (Default): LidClosed, 1: LidOpen. + 0: LidClosed, 1: LidOpen +**/ + UINT8 LidStatus; + +/** Offset 0x0A69 - Control SOL VGA Initialition sequence + Initialise SOL Init + 0x0: NO SOL VGA Init, 0x1: SOL VGA Init +**/ + UINT8 VgaInitControl; + +/** Offset 0x0A6A - TCSS USB HOST (xHCI) Enable Set TCSS XHCI. 0:Disabled 1:Enabled - Must be enabled if xDCI is enabled below $EN_DIS **/ UINT8 TcssXhciEn; -/** Offset 0x0A6E - Reserved +/** Offset 0x0A6B - Reserved **/ - UINT8 Reserved88[4]; + UINT8 Reserved84[4]; -/** Offset 0x0A72 - TCSS Type C Port 0 +/** Offset 0x0A6F - TCSS Type C Port 0 Set TCSS Type C Port 0 Type, Options are 0=DISABLE, 1=DP_ONLY, 2=NO_TBT, 3=NO_PCIE, 7=FULL_FUN 0:DISABLE, 1:DP_ONLY, 2:NO_TBT, 3: NO_PCIE, 7:FULL_FUN **/ UINT8 TcssPort0; -/** Offset 0x0A73 - TCSS Type C Port 1 +/** Offset 0x0A70 - TCSS Type C Port 1 Set TCSS Type C Port 1 Type, Options are 0=DISABLE, 1=DP_ONLY, 2=NO_TBT, 3=NO_PCIE, 7=FULL_FUN 0:DISABLE, 1:DP_ONLY, 2:NO_TBT, 3: NO_PCIE, 7:FULL_FUN **/ UINT8 TcssPort1; -/** Offset 0x0A74 - TCSS Type C Port 2 +/** Offset 0x0A71 - TCSS Type C Port 2 Set TCSS Type C Port 2 Type, Options are 0=DISABLE, 1=DP_ONLY, 2=NO_TBT, 3=NO_PCIE, 7=FULL_FUN 0:DISABLE, 1:DP_ONLY, 2:NO_TBT, 3: NO_PCIE, 7:FULL_FUN **/ UINT8 TcssPort2; -/** Offset 0x0A75 - TCSS Type C Port 3 +/** Offset 0x0A72 - TCSS Type C Port 3 Set TCSS Type C Port 3 Type, Options are 0=DISABLE, 1=DP_ONLY, 2=NO_TBT, 3=NO_PCIE, 7=FULL_FUN 0:DISABLE, 1:DP_ONLY, 2:NO_TBT, 3: NO_PCIE, 7:FULL_FUN **/ UINT8 TcssPort3; -/** Offset 0x0A76 - Reserved +/** Offset 0x0A73 - Reserved **/ - UINT8 Reserved89[2]; + UINT8 Reserved85; -/** Offset 0x0A78 - TypeC port GPIO setting +/** Offset 0x0A74 - TypeC port GPIO setting GPIO Pin number for Type C Aux orientation setting, use the GpioPad that is defined in GpioPinsXXX.h as argument.(XXX is platform name, Ex: Ptl = PantherLake) **/ UINT32 IomTypeCPortPadCfg[12]; -/** Offset 0x0AA8 - TCSS Aux Orientation Override Enable +/** Offset 0x0AA4 - TCSS Aux Orientation Override Enable Bits 0, 2, ... 10 control override enables, bits 1, 3, ... 11 control overrides **/ UINT16 TcssAuxOri; -/** Offset 0x0AAA - TCSS HSL Orientation Override Enable +/** Offset 0x0AA6 - TCSS HSL Orientation Override Enable Bits 0, 2, ... 10 control override enables, bits 1, 3, ... 11 control overrides **/ UINT16 TcssHslOri; -/** Offset 0x0AAC - CNVi DDR RFI Mitigation +/** Offset 0x0AA8 - CNVi DDR RFI Mitigation Enable/Disable DDR RFI Mitigation. Default is ENABLE. 0: DISABLE, 1: ENABLE $EN_DIS **/ UINT8 CnviDdrRfim; -/** Offset 0x0AAD - SOC Trace Hub Mode +/** Offset 0x0AA9 - SOC Trace Hub Mode Enable/Disable SOC TraceHub $EN_DIS **/ UINT8 SocTraceHubMode; -/** Offset 0x0AAE - Reserved +/** Offset 0x0AAA - SOC Trace Hub Memory Region 0 buffer Size + Select size of memory region 0 buffer. Memory allocated by BIOS only applies to + ITH tool running on the host. For ITH tool running on the target, choose None/OS, + memory shall be allocated by tool. User should be cautious to choose the amount + of memory. If chosen size is larger than half of system memory, setup will automatically + rollback to default value. + 0x00:1MB, 0x03:8MB, 0x06:64MB, 0x07:128MB, 0x08:256MB, 0x09:512MB, 0x0A:1GB, 0x0B:2GB, + 0x0C:4GB, 0x0D:8GB, 0x0E:0MB **/ - UINT8 Reserved90[4]; + UINT16 SocTraceHubMemReg0Size; -/** Offset 0x0AB2 - Internal Graphics Pre-allocated Memory +/** Offset 0x0AAC - SOC Trace Hub Memory Region 0 buffer Size + Select size of memory region 1 buffer. Memory allocated by BIOS only applies to + ITH tool running on the host. For ITH tool running on the target, choose None/OS, + memory shall be allocated by tool. User should be cautious to choose the amount + of memory. If chosen size is larger than half of system memory, setup will automatically + rollback to default value. + 0x00:1MB, 0x03:8MB, 0x06:64MB, 0x07:128MB, 0x08:256MB, 0x09:512MB, 0x0A:1GB, 0x0B:2GB, + 0x0C:4GB, 0x0D:8GB, 0x0E:0MB +**/ + UINT16 SocTraceHubMemReg1Size; + +/** Offset 0x0AAE - Internal Graphics Pre-allocated Memory Size of memory preallocated for internal graphics. 0x00:0MB, 0x01:32MB, 0x02:64MB, 0x03:96MB, 0x04:128MB, 0xF0:4MB, 0xF1:8MB, 0xF2:12MB, 0xF3:16MB, 0xF4:20MB, 0xF5:24MB, 0xF6:28MB, 0xF7:32MB, 0xF8:36MB, 0xF9:40MB, 0xFA:44MB, @@ -2729,175 +2850,175 @@ typedef struct { **/ UINT16 IgdDvmt50PreAlloc; -/** Offset 0x0AB4 - Internal Graphics +/** Offset 0x0AB0 - Internal Graphics Enable/disable internal graphics. $EN_DIS **/ UINT8 InternalGraphics; -/** Offset 0x0AB5 - Reserved +/** Offset 0x0AB1 - Reserved **/ - UINT8 Reserved91[7]; + UINT8 Reserved86[7]; -/** Offset 0x0ABC - DynamicMemoryBoost +/** Offset 0x0AB8 - DynamicMemoryBoost Enable/Disable Dynamic Memory Boost Feature. Only valid if SpdProfileSelected is an XMP Profile; otherwise ignored. 0=Disabled, 1=Enabled. $EN_DIS **/ UINT32 DynamicMemoryBoost; -/** Offset 0x0AC0 - RealtimeMemoryFrequency +/** Offset 0x0ABC - RealtimeMemoryFrequency Enable/Disable Realtime Memory Frequency feature. Only valid if SpdProfileSelected is an XMP Profile; otherwise ignored. 0=Disabled, 1=Enabled. $EN_DIS **/ UINT32 RealtimeMemoryFrequency; -/** Offset 0x0AC4 - Reserved +/** Offset 0x0AC0 - Reserved **/ - UINT8 Reserved92[9]; + UINT8 Reserved87[9]; -/** Offset 0x0ACD - Vref Offset +/** Offset 0x0AC9 - Vref Offset Offset to be applied to DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN.VrefOffset 0xFA:-6, 0xFB:-5, 0xFC:-4, 0xFD:-3, 0xFE:-2, 0xFF:-1, 0:0, 1:+1, 2:+2, 3:+3, 4:+4, 5:+5, 6:+6 **/ UINT8 VrefOffset; -/** Offset 0x0ACE - Reserved +/** Offset 0x0ACA - Reserved **/ - UINT8 Reserved93[2]; + UINT8 Reserved88[2]; -/** Offset 0x0AD0 - tRRSG Delta +/** Offset 0x0ACC - tRRSG Delta Delay between Read-to-Read commands in the same Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRRSG; -/** Offset 0x0AD1 - tRRDG Delta +/** Offset 0x0ACD - tRRDG Delta Delay between Read-to-Read commands in different Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRRDG; -/** Offset 0x0AD2 - tRRDR Delta +/** Offset 0x0ACE - tRRDR Delta Delay between Read-to-Read commands in different Ranks. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRRDR; -/** Offset 0x0AD3 - tRRDD Delta +/** Offset 0x0ACF - tRRDD Delta Delay between Read-to-Read commands in different DIMMs. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRRDD; -/** Offset 0x0AD4 - tWRSG Delta +/** Offset 0x0AD0 - tWRSG Delta Delay between Write-to-Read commands in the same Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWRSG; -/** Offset 0x0AD5 - tWRDG Delta +/** Offset 0x0AD1 - tWRDG Delta Delay between Write-to-Read commands in different Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWRDG; -/** Offset 0x0AD6 - tWRDR Delta +/** Offset 0x0AD2 - tWRDR Delta Delay between Write-to-Read commands in different Ranks. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWRDR; -/** Offset 0x0AD7 - tWRDD Delta +/** Offset 0x0AD3 - tWRDD Delta Delay between Write-to-Read commands in different DIMMs. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWRDD; -/** Offset 0x0AD8 - tWWSG Delta +/** Offset 0x0AD4 - tWWSG Delta Delay between Write-to-Write commands in the same Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWWSG; -/** Offset 0x0AD9 - tWWDG Delta +/** Offset 0x0AD5 - tWWDG Delta Delay between Write-to-Write commands in different Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWWDG; -/** Offset 0x0ADA - tWWDR Delta +/** Offset 0x0AD6 - tWWDR Delta Delay between Write-to-Write commands in different Ranks. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWWDR; -/** Offset 0x0ADB - tWWDD Delta +/** Offset 0x0AD7 - tWWDD Delta Delay between Write-to-Write commands in different DIMMs. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tWWDD; -/** Offset 0x0ADC - tRWSG Delta +/** Offset 0x0AD8 - tRWSG Delta Delay between Read-to-Write commands in the same Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRWSG; -/** Offset 0x0ADD - tRWDG Delta +/** Offset 0x0AD9 - tRWDG Delta Delay between Read-to-Write commands in different Bank Group. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRWDG; -/** Offset 0x0ADE - tRWDR Delta +/** Offset 0x0ADA - tRWDR Delta Delay between Read-to-Write commands in different Ranks. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRWDR; -/** Offset 0x0ADF - tRWDD Delta +/** Offset 0x0ADB - tRWDD Delta Delay between Read-to-Write commands in different DIMMs. 0 - Auto. Signed TAT delta is (Value - 128). Input value range of [1..255] will give a TAT delta range of [-127..127] **/ UINT8 tRWDD; -/** Offset 0x0AE0 - Reserved +/** Offset 0x0ADC - Reserved **/ - UINT8 Reserved94[13]; + UINT8 Reserved89[13]; -/** Offset 0x0AED - PPR ForceRepair +/** Offset 0x0AE9 - PPR ForceRepair When Eanble, PPR will force repair some rows many times (90) $EN_DIS **/ UINT8 PprForceRepair; -/** Offset 0x0AEE - PPR Repair Bank +/** Offset 0x0AEA - PPR Repair Bank PPR repair Bank: User chooses to force repair specifc address **/ UINT8 PprRepairBank; -/** Offset 0x0AEF - Reserved +/** Offset 0x0AEB - Reserved **/ - UINT8 Reserved95[33]; + UINT8 Reserved90[53]; } FSP_M_CONFIG; /** Fsp M UPD Configuration @@ -2916,11 +3037,11 @@ typedef struct { **/ FSP_M_CONFIG FspmConfig; -/** Offset 0x0B10 +/** Offset 0x0B20 **/ - UINT8 UnusedUpdSpace55[6]; + UINT8 UnusedUpdSpace0[6]; -/** Offset 0x0B16 +/** Offset 0x0B26 **/ UINT16 UpdTerminator; } FSPM_UPD; diff --git a/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspsUpd.h b/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspsUpd.h index 4617ec7fe4..a6dde65ef9 100644 --- a/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspsUpd.h +++ b/src/vendorcode/intel/fsp/fsp2_0/pantherlake/FspsUpd.h @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2024, Intel Corporation. All rights reserved.
+Copyright (c) 2025, Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -489,9 +489,14 @@ typedef struct { **/ UINT16 ITbtDmaLtr[2]; -/** Offset 0x0158 - Reserved +/** Offset 0x0158 - ITbt Usb4CmMode value + ITbt Usb4CmMode value. 0:Firmware CM, 1:Software CM **/ - UINT8 Reserved14[16]; + UINT8 Usb4CmMode; + +/** Offset 0x0159 - Reserved +**/ + UINT8 Reserved14[15]; /** Offset 0x0168 - IEH Mode Integrated Error Handler Mode, 0: Bypass, 1: Enable @@ -767,7 +772,16 @@ typedef struct { /** Offset 0x0259 - Reserved **/ - UINT8 Reserved17[27]; + UINT8 Reserved17[22]; + +/** Offset 0x026F - Enable PCH ISH I3C pins assigned + Set if ISH I3C native pins are to be enabled by BIOS. 0: Disable; 1: Enable. +**/ + UINT8 PchIshI3cEnable[2]; + +/** Offset 0x0271 - Reserved +**/ + UINT8 Reserved18[3]; /** Offset 0x0274 - Power button debounce configuration Debounce time for PWRBTN in microseconds. For values not supported by HW, they will @@ -822,9 +836,11 @@ typedef struct { **/ UINT8 PchPmWolEnableOverride; -/** Offset 0x027F - Reserved +/** Offset 0x027F - PCH Pm WoW lan Enable + Determine if WLAN wake from Sx, corresponds to the HOST_WLAN_PP_EN bit in the PWRM_CFG3 register. + $EN_DIS **/ - UINT8 Reserved18; + UINT8 PchPmWoWlanEnable; /** Offset 0x0280 - PCH Pm Slp S3 Min Assert SLP_S3 Minimum Assertion Width Policy. Default is PchSlpS350ms. @@ -1386,748 +1402,813 @@ typedef struct { **/ UINT8 PchSerialIoI2cPadsTermination[8]; -/** Offset 0x0F68 - Reserved +/** Offset 0x0F68 - I3C Device Mode + Selects I3c operation mode. Available modes: 0:SerialIoI3cDisabled, 1:SerialIoI3cPci, + 2:SerialIoI3cPhantom (only applicable to I3C1, controlls GPIO enabling) **/ - UINT8 Reserved30[148]; + UINT8 SerialIoI3cMode[3]; -/** Offset 0x0FFC - TypeC port GPIO setting +/** Offset 0x0F6B - Reserved +**/ + UINT8 Reserved30[48]; + +/** Offset 0x0F9B - Enable VMD controller + Enable/disable to VMD controller.0: Disable; 1: Enable(Default) + $EN_DIS +**/ + UINT8 VmdEnable; + +/** Offset 0x0F9C - Enable VMD Global Mapping + Enable/disable to VMD controller.0: Disable(Default); 1: Enable + $EN_DIS +**/ + UINT8 VmdGlobalMapping; + +/** Offset 0x0F9D - Map port under VMD + Map/UnMap port under VMD + $EN_DIS +**/ + UINT8 VmdPort[31]; + +/** Offset 0x0FBC - Reserved +**/ + UINT8 Reserved31[31]; + +/** Offset 0x0FDB - VMD Port Device + VMD Root port device number. +**/ + UINT8 VmdPortDev[31]; + +/** Offset 0x0FFA - VMD Port Func + VMD Root port function number. +**/ + UINT8 VmdPortFunc[31]; + +/** Offset 0x1019 - Reserved +**/ + UINT8 Reserved32[7]; + +/** Offset 0x1020 - VMD Variable + VMD Variable Pointer. +**/ + UINT64 VmdVariablePtr; + +/** Offset 0x1028 - Reserved +**/ + UINT8 Reserved33[4]; + +/** Offset 0x102C - Temporary MemBar1 address for VMD + VMD Variable Pointer. +**/ + UINT32 VmdMemBar1Base; + +/** Offset 0x1030 - Temporary MemBar2 address for VMD + VMD Variable Pointer. +**/ + UINT32 VmdMemBar2Base; + +/** Offset 0x1034 - Enable D3 Hot in TCSS + This policy will enable/disable D3 hot support in IOM + $EN_DIS +**/ + UINT8 D3HotEnable; + +/** Offset 0x1035 - Reserved +**/ + UINT8 Reserved34[3]; + +/** Offset 0x1038 - TypeC port GPIO setting GPIO Ping number for Type C Aux orientation setting, use the GpioPad that is defined in GpioPinsXXXH.h and GpioPinsXXXLp.h as argument.(XXX is platform name, Ex: Lnl = LunarLake) **/ UINT32 IomTypeCPortPadCfg[12]; -/** Offset 0x102C - CPU USB3 Port Over Current Pin +/** Offset 0x1068 - CPU USB3 Port Over Current Pin Describe the specific over current pin number of USBC Port N. **/ UINT8 CpuUsb3OverCurrentPin[10]; -/** Offset 0x1036 - Enable D3 Cold in TCSS +/** Offset 0x1072 - Enable D3 Cold in TCSS This policy will enable/disable D3 cold support in IOM $EN_DIS **/ UINT8 D3ColdEnable; -/** Offset 0x1037 - TC State in TCSS +/** Offset 0x1073 - TC State in TCSS This TC C-State Limit in IOM **/ UINT8 TcCstateLimit; -/** Offset 0x1038 - Reserved +/** Offset 0x1074 - Reserved **/ - UINT8 Reserved31[2]; + UINT8 Reserved35[2]; -/** Offset 0x103A - Enable/Disable PMC-PD Solution +/** Offset 0x1076 - Enable/Disable PMC-PD Solution This policy will enable/disable PMC-PD Solution vs EC-TCPC Solution $EN_DIS **/ UINT8 PmcPdEnable; -/** Offset 0x103B - Reserved +/** Offset 0x1077 - Reserved **/ - UINT8 Reserved32; + UINT8 Reserved36; -/** Offset 0x103C - TCSS Aux Orientation Override Enable +/** Offset 0x1078 - TCSS Aux Orientation Override Enable Bits 0, 2, ... 10 control override enables, bits 1, 3, ... 11 control overrides **/ UINT16 TcssAuxOri; -/** Offset 0x103E - TCSS HSL Orientation Override Enable +/** Offset 0x107A - TCSS HSL Orientation Override Enable Bits 0, 2, ... 10 control override enables, bits 1, 3, ... 11 control overrides **/ UINT16 TcssHslOri; -/** Offset 0x1040 - TCSS USB Port Enable +/** Offset 0x107C - TCSS USB Port Enable Bits 0, 1, ... max Type C port control enables **/ UINT8 UsbTcPortEn; -/** Offset 0x1041 - VCCST request for IOM +/** Offset 0x107D - VCCST request for IOM This policy will enable/disable VCCST and also decides if message would be replayed in S4/S5 $EN_DIS **/ UINT8 VccSt; -/** Offset 0x1042 - Enable/Disable PTM +/** Offset 0x107E - Enable/Disable PTM This policy will enable/disable Precision Time Measurement for TCSS PCIe Root Ports $EN_DIS **/ UINT8 PtmEnabled[4]; -/** Offset 0x1046 - PCIE RP Ltr Enable +/** Offset 0x1082 - PCIE RP Ltr Enable Latency Tolerance Reporting Mechanism. **/ UINT8 SaPcieItbtRpLtrEnable[4]; -/** Offset 0x104A - PCIE RP Snoop Latency Override Mode +/** Offset 0x1086 - PCIE RP Snoop Latency Override Mode Latency Tolerance Reporting, Snoop Latency Override Mode. **/ UINT8 SaPcieItbtRpSnoopLatencyOverrideMode[4]; -/** Offset 0x104E - PCIE RP Snoop Latency Override Multiplier +/** Offset 0x108A - PCIE RP Snoop Latency Override Multiplier Latency Tolerance Reporting, Snoop Latency Override Multiplier. **/ UINT8 SaPcieItbtRpSnoopLatencyOverrideMultiplier[4]; -/** Offset 0x1052 - PCIE RP Snoop Latency Override Value +/** Offset 0x108E - PCIE RP Snoop Latency Override Value Latency Tolerance Reporting, Snoop Latency Override Value. **/ UINT16 SaPcieItbtRpSnoopLatencyOverrideValue[4]; -/** Offset 0x105A - PCIE RP Non Snoop Latency Override Mode +/** Offset 0x1096 - PCIE RP Non Snoop Latency Override Mode Latency Tolerance Reporting, Non-Snoop Latency Override Mode. **/ UINT8 SaPcieItbtRpNonSnoopLatencyOverrideMode[4]; -/** Offset 0x105E - PCIE RP Non Snoop Latency Override Multiplier +/** Offset 0x109A - PCIE RP Non Snoop Latency Override Multiplier Latency Tolerance Reporting, Non-Snoop Latency Override Multiplier. **/ UINT8 SaPcieItbtRpNonSnoopLatencyOverrideMultiplier[4]; -/** Offset 0x1062 - PCIE RP Non Snoop Latency Override Value +/** Offset 0x109E - PCIE RP Non Snoop Latency Override Value Latency Tolerance Reporting, Non-Snoop Latency Override Value. **/ UINT16 SaPcieItbtRpNonSnoopLatencyOverrideValue[4]; -/** Offset 0x106A - Force LTR Override +/** Offset 0x10A6 - Force LTR Override Force LTR Override. **/ UINT8 SaPcieItbtRpForceLtrOverride[4]; -/** Offset 0x106E - PCIE RP Ltr Config Lock +/** Offset 0x10AA - PCIE RP Ltr Config Lock 0: Disable; 1: Enable. **/ UINT8 SaPcieItbtRpLtrConfigLock[4]; -/** Offset 0x1072 - Reserved +/** Offset 0x10AE - Reserved **/ - UINT8 Reserved33[4]; + UINT8 Reserved37[4]; -/** Offset 0x1076 - Touch Host Controller Assignment +/** Offset 0x10B2 - Touch Host Controller Assignment Assign THC 0x0:ThcAssignmentNone, 0x1:ThcAssignmentThc0, 0x2:ThcAssignmentThc1 **/ UINT8 ThcAssignment[2]; -/** Offset 0x1078 - Touch Host Controller Interrupt Pin Mux +/** Offset 0x10B4 - Touch Host Controller Interrupt Pin Mux Set THC Pin Muxing Value if signal can be enabled on multiple pads. Refer to GPIO_*_MUXING_THC_SPIx_INTB_* for possible values. **/ UINT8 ThcInterruptPinMuxing[8]; -/** Offset 0x1080 - Touch Host Controller Mode +/** Offset 0x10BC - Touch Host Controller Mode Switch between Intel THC protocol and Industry standard HID Over SPI protocol. 0x0:Thc, 0x1:Hid **/ UINT8 ThcMode[2]; -/** Offset 0x1082 - Touch Host Controller Wake On Touch +/** Offset 0x10BE - Touch Host Controller Wake On Touch Based on this setting vGPIO for given THC will be in native mode, and additional _CRS for wake will be exposed in ACPI **/ UINT8 ThcWakeOnTouch[2]; -/** Offset 0x1084 - Reserved +/** Offset 0x10C0 - Reserved **/ - UINT8 Reserved34[337]; + UINT8 Reserved38[337]; -/** Offset 0x11D5 - PCHHOT# pin +/** Offset 0x1211 - PCHHOT# pin Enable PCHHOT# pin assertion when temperature is higher than PchHotLevel. 0: disable, 1: enable $EN_DIS **/ UINT8 PchHotEnable; -/** Offset 0x11D6 - Thermal Throttling Custimized T0Level Value +/** Offset 0x1212 - Thermal Throttling Custimized T0Level Value Custimized T0Level value. **/ UINT16 PchT0Level; -/** Offset 0x11D8 - Thermal Throttling Custimized T1Level Value +/** Offset 0x1214 - Thermal Throttling Custimized T1Level Value Custimized T1Level value. **/ UINT16 PchT1Level; -/** Offset 0x11DA - Thermal Throttling Custimized T2Level Value +/** Offset 0x1216 - Thermal Throttling Custimized T2Level Value Custimized T2Level value. **/ UINT16 PchT2Level; -/** Offset 0x11DC - Enable The Thermal Throttle +/** Offset 0x1218 - Enable The Thermal Throttle Enable the thermal throttle function. $EN_DIS **/ UINT8 PchTTEnable; -/** Offset 0x11DD - PMSync State 13 +/** Offset 0x1219 - PMSync State 13 When set to 1 and the programmed GPIO pin is a 1, then PMSync state 13 will force at least T2 state. $EN_DIS **/ UINT8 PchTTState13Enable; -/** Offset 0x11DE - Thermal Throttle Lock +/** Offset 0x121A - Thermal Throttle Lock Thermal Throttle Lock. $EN_DIS **/ UINT8 PchTTLock; -/** Offset 0x11DF - Thermal Throttling Suggested Setting +/** Offset 0x121B - Thermal Throttling Suggested Setting Thermal Throttling Suggested Setting. $EN_DIS **/ UINT8 TTSuggestedSetting; -/** Offset 0x11E0 - Thermal Device Temperature +/** Offset 0x121C - Thermal Device Temperature Decides the temperature. **/ UINT16 PchTemperatureHotLevel; -/** Offset 0x11E2 +/** Offset 0x121E **/ UINT8 PchTsnEnable[4]; -/** Offset 0x11E6 - Enable TSN Multi-VC - Enable/disable Multi Virtual Channels(VC) in TSN. - $EN_DIS +/** Offset 0x1222 - Reserved **/ - UINT8 PchTsnMultiVcEnable; + UINT8 Reserved39[34]; -/** Offset 0x11E7 - Reserved -**/ - UINT8 Reserved35[33]; - -/** Offset 0x1208 - Enable USB2 ports +/** Offset 0x1244 - Enable USB2 ports Enable/disable per USB2 ports. One byte for each port, byte0 for port0, byte1 for port1, and so on. **/ UINT8 PortUsb20Enable[16]; -/** Offset 0x1218 - Enable USB3 ports +/** Offset 0x1254 - Enable USB3 ports Enable/disable per USB3 ports. One byte for each port, byte0 for port0, byte1 for port1, and so on. **/ UINT8 PortUsb30Enable[10]; -/** Offset 0x1222 - Enable xDCI controller +/** Offset 0x125E - Enable xDCI controller Enable/disable to xDCI controller. $EN_DIS **/ UINT8 XdciEnable; -/** Offset 0x1223 - USB PDO Programming +/** Offset 0x125F - USB PDO Programming Enable/disable PDO programming for USB in PEI phase. Disabling will allow for programming during later phase. 1: enable, 0: disable $EN_DIS **/ UINT8 UsbPdoProgramming; -/** Offset 0x1224 - Reserved +/** Offset 0x1260 - Reserved **/ - UINT8 Reserved36; + UINT8 Reserved40; -/** Offset 0x1225 - PCH USB OverCurrent mapping enable +/** Offset 0x1261 - PCH USB OverCurrent mapping enable 1: Will program USB OC pin mapping in xHCI controller memory, 0: Will clear OC pin mapping allow for NOA usage of OC pins $EN_DIS **/ UINT8 PchUsbOverCurrentEnable; -/** Offset 0x1226 - USB2 Port Over Current Pin +/** Offset 0x1262 - USB2 Port Over Current Pin Describe the specific over current pin number of USB 2.0 Port N. **/ UINT8 Usb2OverCurrentPin[16]; -/** Offset 0x1236 - USB3 Port Over Current Pin +/** Offset 0x1272 - USB3 Port Over Current Pin Describe the specific over current pin number of USB 3.0 Port N. **/ UINT8 Usb3OverCurrentPin[10]; -/** Offset 0x1240 - Enable xHCI LTR override +/** Offset 0x127C - Enable xHCI LTR override Enables override of recommended LTR values for xHCI $EN_DIS **/ UINT8 PchUsbLtrOverrideEnable; -/** Offset 0x1241 - Reserved +/** Offset 0x127D - Reserved **/ - UINT8 Reserved37[3]; + UINT8 Reserved41[3]; -/** Offset 0x1244 - xHCI High Idle Time LTR override +/** Offset 0x1280 - xHCI High Idle Time LTR override Value used for overriding LTR recommendation for xHCI High Idle Time LTR setting **/ UINT32 PchUsbLtrHighIdleTimeOverride; -/** Offset 0x1248 - xHCI Medium Idle Time LTR override +/** Offset 0x1284 - xHCI Medium Idle Time LTR override Value used for overriding LTR recommendation for xHCI Medium Idle Time LTR setting **/ UINT32 PchUsbLtrMediumIdleTimeOverride; -/** Offset 0x124C - xHCI Low Idle Time LTR override +/** Offset 0x1288 - xHCI Low Idle Time LTR override Value used for overriding LTR recommendation for xHCI Low Idle Time LTR setting **/ UINT32 PchUsbLtrLowIdleTimeOverride; -/** Offset 0x1250 - USB2 Port Reset Message Enable +/** Offset 0x128C - USB2 Port Reset Message Enable 0: Disable USB2 Port Reset Message; 1: Enable USB2 Port Reset Message; This must be enable for USB2 Port those are paired with CPU XHCI Port **/ UINT8 PortResetMessageEnable[16]; -/** Offset 0x1260 - PCH USB OverCurrent mapping lock enable +/** Offset 0x129C - PCH USB OverCurrent mapping lock enable If this policy option is enabled then BIOS will program OCCFDONE bit in xHCI meaning that OC mapping data will be consumed by xHCI and OC mapping registers will be locked. $EN_DIS **/ UINT8 PchXhciOcLock; -/** Offset 0x1261 - USB Per Port HS Preemphasis Bias +/** Offset 0x129D - USB Per Port HS Preemphasis Bias USB Per Port HS Preemphasis Bias. 000b-0mV, 001b-11.25mV, 010b-16.9mV, 011b-28.15mV, 100b-28.15mV, 101b-39.35mV, 110b-45mV, 111b-56.3mV. One byte for each port. **/ UINT8 Usb2PhyPetxiset[16]; -/** Offset 0x1271 - USB Per Port HS Transmitter Bias +/** Offset 0x12AD - USB Per Port HS Transmitter Bias USB Per Port HS Transmitter Bias. 000b-0mV, 001b-11.25mV, 010b-16.9mV, 011b-28.15mV, 100b-28.15mV, 101b-39.35mV, 110b-45mV, 111b-56.3mV, One byte for each port. **/ UINT8 Usb2PhyTxiset[16]; -/** Offset 0x1281 - USB Per Port HS Transmitter Emphasis +/** Offset 0x12BD - USB Per Port HS Transmitter Emphasis USB Per Port HS Transmitter Emphasis. 00b - Emphasis OFF, 01b - De-emphasis ON, 10b - Pre-emphasis ON, 11b - Pre-emphasis & De-emphasis ON. One byte for each port. **/ UINT8 Usb2PhyPredeemp[16]; -/** Offset 0x1291 - USB Per Port Half Bit Pre-emphasis +/** Offset 0x12CD - USB Per Port Half Bit Pre-emphasis USB Per Port Half Bit Pre-emphasis. 1b - half-bit pre-emphasis, 0b - full-bit pre-emphasis. One byte for each port. **/ UINT8 Usb2PhyPehalfbit[16]; -/** Offset 0x12A1 - Enable the write to USB 3.0 TX Output -3.5dB De-Emphasis Adjustment +/** Offset 0x12DD - Enable the write to USB 3.0 TX Output -3.5dB De-Emphasis Adjustment Enable the write to USB 3.0 TX Output -3.5dB De-Emphasis Adjustment. Each value in arrary can be between 0-1. One byte for each port. **/ UINT8 Usb3HsioTxDeEmphEnable[10]; -/** Offset 0x12AB - USB 3.0 TX Output -3.5dB De-Emphasis Adjustment Setting +/** Offset 0x12E7 - USB 3.0 TX Output -3.5dB De-Emphasis Adjustment Setting USB 3.0 TX Output -3.5dB De-Emphasis Adjustment Setting, HSIO_TX_DWORD5[21:16], Default = 29h (approximately -3.5dB De-Emphasis). One byte for each port. **/ UINT8 Usb3HsioTxDeEmph[10]; -/** Offset 0x12B5 - Enable the write to USB 3.0 TX Output Downscale Amplitude Adjustment +/** Offset 0x12F1 - Enable the write to USB 3.0 TX Output Downscale Amplitude Adjustment Enable the write to USB 3.0 TX Output Downscale Amplitude Adjustment, Each value in arrary can be between 0-1. One byte for each port. **/ UINT8 Usb3HsioTxDownscaleAmpEnable[10]; -/** Offset 0x12BF - USB 3.0 TX Output Downscale Amplitude Adjustment +/** Offset 0x12FB - USB 3.0 TX Output Downscale Amplitude Adjustment USB 3.0 TX Output Downscale Amplitude Adjustment, HSIO_TX_DWORD8[21:16], Default = 00h. One byte for each port. **/ UINT8 Usb3HsioTxDownscaleAmp[10]; -/** Offset 0x12C9 +/** Offset 0x1305 **/ UINT8 PchUsb3HsioCtrlAdaptOffsetCfgEnable[10]; -/** Offset 0x12D3 +/** Offset 0x130F **/ UINT8 PchUsb3HsioFilterSelNEnable[10]; -/** Offset 0x12DD +/** Offset 0x1319 **/ UINT8 PchUsb3HsioFilterSelPEnable[10]; -/** Offset 0x12E7 +/** Offset 0x1323 **/ UINT8 PchUsb3HsioOlfpsCfgPullUpDwnResEnable[10]; -/** Offset 0x12F1 +/** Offset 0x132D **/ UINT8 PchUsb3HsioCtrlAdaptOffsetCfg[10]; -/** Offset 0x12FB +/** Offset 0x1337 **/ UINT8 PchUsb3HsioOlfpsCfgPullUpDwnRes[10]; -/** Offset 0x1305 +/** Offset 0x1341 **/ UINT8 PchUsb3HsioFilterSelN[10]; -/** Offset 0x130F +/** Offset 0x134B **/ UINT8 PchUsb3HsioFilterSelP[10]; -/** Offset 0x1319 - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 3 +/** Offset 0x1355 - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 3 Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 3, Each value in array can be between 0-1. One byte for each port. **/ UINT8 Usb3HsioTxRate3UniqTranEnable[10]; -/** Offset 0x1323 - USB 3.0 TX Output Unique Transition Bit Scale for rate 3 +/** Offset 0x135F - USB 3.0 TX Output Unique Transition Bit Scale for rate 3 USB 3.0 TX Output Unique Transition Bit Scale for rate 3, HSIO_TX_DWORD9[6:0], Default = 4Ch. One byte for each port. **/ UINT8 Usb3HsioTxRate3UniqTran[10]; -/** Offset 0x132D - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 2 +/** Offset 0x1369 - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 2 Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 2, Each value in array can be between 0-1. One byte for each port. **/ UINT8 Usb3HsioTxRate2UniqTranEnable[10]; -/** Offset 0x1337 - USB 3.0 TX Output Unique Transition Bit Scale for rate 2 +/** Offset 0x1373 - USB 3.0 TX Output Unique Transition Bit Scale for rate 2 USB 3.0 TX Output Unique Transition Bit Scale for rate 2, HSIO_TX_DWORD9[14:8], Default = 4Ch. One byte for each port. **/ UINT8 Usb3HsioTxRate2UniqTran[10]; -/** Offset 0x1341 - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 1 +/** Offset 0x137D - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 1 Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 1, Each value in array can be between 0-1. One byte for each port. **/ UINT8 Usb3HsioTxRate1UniqTranEnable[10]; -/** Offset 0x134B - USB 3.0 TX Output Unique Transition Bit Scale for rate 1 +/** Offset 0x1387 - USB 3.0 TX Output Unique Transition Bit Scale for rate 1 USB 3.0 TX Output Unique Transition Bit Scale for rate 1, HSIO_TX_DWORD9[22:16], Default = 4Ch. One byte for each port. **/ UINT8 Usb3HsioTxRate1UniqTran[10]; -/** Offset 0x1355 - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 0 +/** Offset 0x1391 - Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 0 Enable the write to USB 3.0 TX Output Unique Transition Bit Mode for rate 0, Each value in array can be between 0-1. One byte for each port. **/ UINT8 Usb3HsioTxRate0UniqTranEnable[10]; -/** Offset 0x135F - USB 3.0 TX Output Unique Transition Bit Scale for rate 0 +/** Offset 0x139B - USB 3.0 TX Output Unique Transition Bit Scale for rate 0 USB 3.0 TX Output Unique Transition Bit Scale for rate 0, HSIO_TX_DWORD9[30:24], Default = 4Ch. One byte for each port. **/ UINT8 Usb3HsioTxRate0UniqTran[10]; -/** Offset 0x1369 - Reserved +/** Offset 0x13A5 - Reserved **/ - UINT8 Reserved38[4]; + UINT8 Reserved42[4]; -/** Offset 0x136D - Enable/Disable NPU Device +/** Offset 0x13A9 - Enable/Disable NPU Device Enable(Default): Enable NPU Device, Disable: Disable NPU Device $EN_DIS **/ UINT8 NpuEnable; -/** Offset 0x136E - Enable LAN +/** Offset 0x13AA - Enable LAN Enable/disable LAN controller. $EN_DIS **/ UINT8 PchLanEnable; -/** Offset 0x136F - Enable PCH Lan LTR capabilty of PCH internal LAN +/** Offset 0x13AB - Enable PCH Lan LTR capabilty of PCH internal LAN 0: Disable; 1: Enable. $EN_DIS **/ UINT8 PchLanLtrEnable; -/** Offset 0x1370 - Reserved +/** Offset 0x13AC - Reserved **/ - UINT8 Reserved39; + UINT8 Reserved43; -/** Offset 0x1371 - Skip Ssid Programming. +/** Offset 0x13AD - Skip Ssid Programming. When set to TRUE, silicon code will not do any SSID programming and platform code needs to handle that by itself properly. $EN_DIS **/ UINT8 SiSkipSsidProgramming; -/** Offset 0x1372 - Change Default SVID +/** Offset 0x13AE - Change Default SVID Change the default SVID used in FSP to programming internal devices. This is only valid when SkipSsidProgramming is FALSE. **/ UINT16 SiCustomizedSvid; -/** Offset 0x1374 - Change Default SSID +/** Offset 0x13B0 - Change Default SSID Change the default SSID used in FSP to programming internal devices. This is only valid when SkipSsidProgramming is FALSE. **/ UINT16 SiCustomizedSsid; -/** Offset 0x1376 - Reserved +/** Offset 0x13B2 - Reserved **/ - UINT8 Reserved40[2]; + UINT8 Reserved44[6]; -/** Offset 0x1378 - SVID SDID table Poniter. +/** Offset 0x13B8 - SVID SDID table Poniter. The address of the table of SVID SDID to customize each SVID SDID entry. This is only valid when SkipSsidProgramming is FALSE. **/ UINT64 SiSsidTablePtr; -/** Offset 0x1380 - Number of ssid table. +/** Offset 0x13C0 - Number of ssid table. SiNumberOfSsidTableEntry should match the table entries created in SiSsidTablePtr. This is only valid when SkipSsidProgramming is FALSE. **/ UINT16 SiNumberOfSsidTableEntry; -/** Offset 0x1382 - Reserved +/** Offset 0x13C2 - Reserved **/ - UINT8 Reserved41[10]; + UINT8 Reserved45[10]; -/** Offset 0x138C - LogoPixelHeight Address +/** Offset 0x13CC - LogoPixelHeight Address Address of LogoPixelHeight **/ UINT32 LogoPixelHeight; -/** Offset 0x1390 - LogoPixelWidth Address +/** Offset 0x13D0 - LogoPixelWidth Address Address of LogoPixelWidth **/ UINT32 LogoPixelWidth; -/** Offset 0x1394 - Reserved +/** Offset 0x13D4 - Reserved **/ - UINT8 Reserved42[4]; + UINT8 Reserved46[4]; -/** Offset 0x1398 - Blt Buffer Address +/** Offset 0x13D8 - Blt Buffer Address Address of Blt buffer **/ UINT64 BltBufferAddress; -/** Offset 0x13A0 - Graphics Configuration Ptr +/** Offset 0x13E0 - Graphics Configuration Ptr Points to VBT **/ UINT64 GraphicsConfigPtr; -/** Offset 0x13A8 - Enable/Disable SkipFspGop +/** Offset 0x13E8 - Enable/Disable SkipFspGop Enable: Skip FSP provided GOP driver, Disable(Default): Use FSP provided GOP driver $EN_DIS **/ UINT8 SkipFspGop; -/** Offset 0x13A9 - Reserved +/** Offset 0x13E9 - Reserved **/ - UINT8 Reserved43; + UINT8 Reserved47; -/** Offset 0x13AA - Enable/Disable IGFX RenderStandby +/** Offset 0x13EA - Enable/Disable IGFX RenderStandby Enable(Default): Enable IGFX RenderStandby, Disable: Disable IGFX RenderStandby $EN_DIS **/ UINT8 RenderStandby; -/** Offset 0x13AB - Reserved +/** Offset 0x13EB - Reserved **/ - UINT8 Reserved44[3]; + UINT8 Reserved48[3]; -/** Offset 0x13AE - Enable/Disable PavpEnable +/** Offset 0x13EE - Enable/Disable PavpEnable Enable(Default): Enable PavpEnable, Disable: Disable PavpEnable $EN_DIS **/ UINT8 PavpEnable; -/** Offset 0x13AF - Enable/Disable PeiGraphicsPeimInit +/** Offset 0x13EF - Enable/Disable PeiGraphicsPeimInit Enable(Default): FSP will initialize the framebuffer and provide it via EFI_PEI_GRAPHICS_INFO_HOB. Disable: FSP will NOT initialize the framebuffer. $EN_DIS **/ UINT8 PeiGraphicsPeimInit; -/** Offset 0x13B0 - Reserved +/** Offset 0x13F0 - Reserved **/ - UINT8 Reserved45[4]; + UINT8 Reserved49[4]; -/** Offset 0x13B4 - Intel Graphics VBT (Video BIOS Table) Size +/** Offset 0x13F4 - Intel Graphics VBT (Video BIOS Table) Size Size of Internal Graphics VBT Image **/ UINT32 VbtSize; -/** Offset 0x13B8 - Platform LID Status for LFP Displays. +/** Offset 0x13F8 - Platform LID Status for LFP Displays. LFP Display Lid Status (LID_STATUS enum): 0 (Default): LidClosed, 1: LidOpen. 0: LidClosed, 1: LidOpen **/ UINT8 LidStatus; -/** Offset 0x13B9 - Reserved +/** Offset 0x13F9 - Reserved **/ - UINT8 Reserved46[11]; + UINT8 Reserved50[11]; -/** Offset 0x13C4 - Address of PCH_DEVICE_INTERRUPT_CONFIG table. +/** Offset 0x1404 - Address of PCH_DEVICE_INTERRUPT_CONFIG table. The address of the table of PCH_DEVICE_INTERRUPT_CONFIG. **/ UINT32 DevIntConfigPtr; -/** Offset 0x13C8 - Number of DevIntConfig Entry +/** Offset 0x1408 - Number of DevIntConfig Entry Number of Device Interrupt Configuration Entry. If this is not zero, the DevIntConfigPtr must not be NULL. **/ UINT8 NumOfDevIntConfig; -/** Offset 0x13C9 - Select GPIO IRQ Route +/** Offset 0x1409 - Select GPIO IRQ Route GPIO IRQ Select. The valid value is 14 or 15. **/ UINT8 GpioIrqRoute; -/** Offset 0x13CA - Select SciIrqSelect +/** Offset 0x140A - Select SciIrqSelect SCI IRQ Select. The valid value is 9, 10, 11, and 20, 21, 22, 23 for APIC only. **/ UINT8 SciIrqSelect; -/** Offset 0x13CB - Select TcoIrqSelect +/** Offset 0x140B - Select TcoIrqSelect TCO IRQ Select. The valid value is 9, 10, 11, 20, 21, 22, 23. **/ UINT8 TcoIrqSelect; -/** Offset 0x13CC - Enable/Disable Tco IRQ +/** Offset 0x140C - Enable/Disable Tco IRQ Enable/disable TCO IRQ $EN_DIS **/ UINT8 TcoIrqEnable; -/** Offset 0x13CD - Reserved +/** Offset 0x140D - Reserved **/ - UINT8 Reserved47[5]; + UINT8 Reserved51[5]; -/** Offset 0x13D2 - Mask to enable the usage of external V1p05 VR rail in specific S0ix or Sx states +/** Offset 0x1412 - Mask to enable the usage of external V1p05 VR rail in specific S0ix or Sx states Enable External V1P05 Rail in: BIT0:S0i1/S0i2, BIT1:S0i3, BIT2:S3, BIT3:S4, BIT5:S5 **/ UINT8 PchFivrExtV1p05RailEnabledStates; -/** Offset 0x13D3 - Mask to enable the platform configuration of external V1p05 VR rail +/** Offset 0x1413 - Mask to enable the platform configuration of external V1p05 VR rail External V1P05 Rail Supported Configuration **/ UINT8 PchFivrExtV1p05RailSupportedVoltageStates; -/** Offset 0x13D4 - External V1P05 Voltage Value that will be used in S0i2/S0i3 states +/** Offset 0x1414 - External V1P05 Voltage Value that will be used in S0i2/S0i3 states Value is given in 2.5mV increments (0=0mV, 1=2.5mV, 2=5mV...) **/ UINT16 PchFivrExtV1p05RailVoltage; -/** Offset 0x13D6 - External V1P05 Icc Max Value +/** Offset 0x1416 - External V1P05 Icc Max Value Granularity of this setting is 1mA and maximal possible value is 200mA **/ UINT8 PchFivrExtV1p05RailIccMax; -/** Offset 0x13D7 - Mask to enable the usage of external Vnn VR rail in specific S0ix or Sx states +/** Offset 0x1417 - Mask to enable the usage of external Vnn VR rail in specific S0ix or Sx states Enable External Vnn Rail in: BIT0:S0i1/S0i2, BIT1:S0i3, BIT2:S3, BIT3:S4, BIT5:S5 **/ UINT8 PchFivrExtVnnRailEnabledStates; -/** Offset 0x13D8 - Mask to enable the platform configuration of external Vnn VR rail +/** Offset 0x1418 - Mask to enable the platform configuration of external Vnn VR rail External Vnn Rail Supported Configuration **/ UINT8 PchFivrExtVnnRailSupportedVoltageStates; -/** Offset 0x13D9 - Reserved +/** Offset 0x1419 - Reserved **/ - UINT8 Reserved48; + UINT8 Reserved52; -/** Offset 0x13DA - External Vnn Voltage Value that will be used in S0ix/Sx states +/** Offset 0x141A - External Vnn Voltage Value that will be used in S0ix/Sx states Value is given in 2.5mV increments (0=0mV, 1=2.5mV, 2=5mV...), Default is set to 420 **/ UINT16 PchFivrExtVnnRailVoltage; -/** Offset 0x13DC - External Vnn Icc Max Value that will be used in S0ix/Sx states +/** Offset 0x141C - External Vnn Icc Max Value that will be used in S0ix/Sx states Granularity of this setting is 1mA and maximal possible value is 200mA **/ UINT8 PchFivrExtVnnRailIccMax; -/** Offset 0x13DD - Mask to enable the usage of external Vnn VR rail in Sx states +/** Offset 0x141D - Mask to enable the usage of external Vnn VR rail in Sx states Use only if Ext Vnn Rail config is different in Sx. Enable External Vnn Rail in Sx: BIT0-1:Reserved, BIT2:S3, BIT3:S4, BIT5:S5 **/ UINT8 PchFivrExtVnnRailSxEnabledStates; -/** Offset 0x13DE - External Vnn Voltage Value that will be used in Sx states +/** Offset 0x141E - External Vnn Voltage Value that will be used in Sx states Use only if Ext Vnn Rail config is different in Sx. Value is given in 2.5mV increments (0=0mV, 1=2.5mV, 2=5mV...) **/ UINT16 PchFivrExtVnnRailSxVoltage; -/** Offset 0x13E0 - External Vnn Icc Max Value that will be used in Sx states +/** Offset 0x1420 - External Vnn Icc Max Value that will be used in Sx states Use only if Ext Vnn Rail config is different in Sx. Granularity of this setting is 1mA and maximal possible value is 200mA **/ UINT8 PchFivrExtVnnRailSxIccMax; -/** Offset 0x13E1 - Transition time in microseconds from Low Current Mode Voltage to High Current Mode Voltage +/** Offset 0x1421 - Transition time in microseconds from Low Current Mode Voltage to High Current Mode Voltage This field has 1us resolution. When value is 0 PCH will not transition VCCIN_AUX to low current mode voltage. **/ UINT8 PchFivrVccinAuxLowToHighCurModeVolTranTime; -/** Offset 0x13E2 - Transition time in microseconds from Retention Mode Voltage to High Current Mode Voltage +/** Offset 0x1422 - Transition time in microseconds from Retention Mode Voltage to High Current Mode Voltage This field has 1us resolution. When value is 0 PCH will not transition VCCIN_AUX to retention mode voltage. **/ UINT8 PchFivrVccinAuxRetToHighCurModeVolTranTime; -/** Offset 0x13E3 - Transition time in microseconds from Retention Mode Voltage to Low Current Mode Voltage +/** Offset 0x1423 - Transition time in microseconds from Retention Mode Voltage to Low Current Mode Voltage This field has 1us resolution. When value is 0 PCH will not transition VCCIN_AUX to retention mode voltage. **/ UINT8 PchFivrVccinAuxRetToLowCurModeVolTranTime; -/** Offset 0x13E4 - Transition time in microseconds from Off (0V) to High Current Mode Voltage +/** Offset 0x1424 - Transition time in microseconds from Off (0V) to High Current Mode Voltage This field has 1us resolution. When value is 0 Transition to 0V is disabled. **/ UINT16 PchFivrVccinAuxOffToHighCurModeVolTranTime; -/** Offset 0x13E6 - FIVR Dynamic Power Management +/** Offset 0x1426 - FIVR Dynamic Power Management Enable/Disable FIVR Dynamic Power Management. $EN_DIS **/ UINT8 PchFivrDynPm; -/** Offset 0x13E7 - Reserved +/** Offset 0x1427 - Reserved **/ - UINT8 Reserved49; + UINT8 Reserved53; -/** Offset 0x13E8 - External V1P05 Icc Max Value +/** Offset 0x1428 - External V1P05 Icc Max Value Granularity of this setting is 1mA and maximal possible value is 500mA **/ UINT16 PchFivrExtV1p05RailIccMaximum; -/** Offset 0x13EA - External Vnn Icc Max Value that will be used in S0ix/Sx states +/** Offset 0x142A - External Vnn Icc Max Value that will be used in S0ix/Sx states Granularity of this setting is 1mA and maximal possible value is 500mA **/ UINT16 PchFivrExtVnnRailIccMaximum; -/** Offset 0x13EC - External Vnn Icc Max Value that will be used in Sx states +/** Offset 0x142C - External Vnn Icc Max Value that will be used in Sx states Use only if Ext Vnn Rail config is different in Sx. Granularity of this setting is 1mA and maximal possible value is 500mA **/ UINT16 PchFivrExtVnnRailSxIccMaximum; -/** Offset 0x13EE - External V1P05 Control Ramp Timer value +/** Offset 0x142E - External V1P05 Control Ramp Timer value Hold off time to be used when changing the v1p05_ctrl for external bypass value in us **/ UINT8 PchFivrExtV1p05RailCtrlRampTmr; -/** Offset 0x13EF - External VNN Control Ramp Timer value +/** Offset 0x142F - External VNN Control Ramp Timer value Hold off time to be used when changing the vnn_ctrl for external bypass value in us **/ UINT8 PchFivrExtVnnRailCtrlRampTmr; -/** Offset 0x13F0 - PCH Compatibility Revision ID +/** Offset 0x1430 - PCH Compatibility Revision ID This member describes whether or not the CRID feature of PCH should be enabled. $EN_DIS **/ UINT8 PchCrid; -/** Offset 0x13F1 - PCH Legacy IO Low Latency Enable +/** Offset 0x1431 - PCH Legacy IO Low Latency Enable Set to enable low latency of legacy IO. 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchLegacyIoLowLatency; -/** Offset 0x13F2 - Reserved +/** Offset 0x1432 - Reserved **/ - UINT8 Reserved50; + UINT8 Reserved54; -/** Offset 0x13F3 - PCH Unlock SideBand access +/** Offset 0x1433 - PCH Unlock SideBand access The SideBand PortID mask for certain end point (e.g. PSFx) will be locked before 3rd party code execution. 0: Lock SideBand access; 1: Unlock SideBand access. $EN_DIS **/ UINT8 PchSbAccessUnlock; -/** Offset 0x13F4 - Enable 8254 Static Clock Gating +/** Offset 0x1434 - Enable 8254 Static Clock Gating Set 8254CGE=1 is required for SLP_S0 support. However, set 8254CGE=1 in POST time might fail to boot legacy OS using 8254 timer. Make sure it is disabled to support legacy OS using 8254 timer. Also enable this while S0ix is enabled. @@ -2135,7 +2216,7 @@ typedef struct { **/ UINT8 Enable8254ClockGating; -/** Offset 0x13F5 - Enable 8254 Static Clock Gating On S3 +/** Offset 0x1435 - Enable 8254 Static Clock Gating On S3 This is only applicable when Enable8254ClockGating is disabled. FSP will do the 8254 CGE programming on S3 resume when Enable8254ClockGatingOnS3 is enabled. This avoids the SMI requirement for the programming. @@ -2143,174 +2224,174 @@ typedef struct { **/ UINT8 Enable8254ClockGatingOnS3; -/** Offset 0x13F6 - Enable PCH Io Apic Entry 24-119 +/** Offset 0x1436 - Enable PCH Io Apic Entry 24-119 0: Disable; 1: Enable. $EN_DIS **/ UINT8 PchIoApicEntry24_119; -/** Offset 0x13F7 - PCH Io Apic ID +/** Offset 0x1437 - PCH Io Apic ID This member determines IOAPIC ID. Default is 0x02. **/ UINT8 PchIoApicId; -/** Offset 0x13F8 - CNVi Configuration +/** Offset 0x1438 - CNVi Configuration This option allows for automatic detection of Connectivity Solution. [Auto Detection] assumes that CNVi will be enabled when available, [Disable] allows for disabling CNVi. 0:Disable, 1:Auto **/ UINT8 CnviMode; -/** Offset 0x13F9 - CNVi Wi-Fi Core +/** Offset 0x1439 - CNVi Wi-Fi Core Enable/Disable CNVi Wi-Fi Core, Default is ENABLE. 0: DISABLE, 1: ENABLE $EN_DIS **/ UINT8 CnviWifiCore; -/** Offset 0x13FA - CNVi BT Core +/** Offset 0x143A - CNVi BT Core Enable/Disable CNVi BT Core, Default is ENABLE. 0: DISABLE, 1: ENABLE $EN_DIS **/ UINT8 CnviBtCore; -/** Offset 0x13FB - CNVi BT Interface +/** Offset 0x143B - CNVi BT Interface This option configures BT device interface to either USB/PCI 1:USB, 2:PCI **/ UINT8 CnviBtInterface; -/** Offset 0x13FC - CNVi BT Audio Offload +/** Offset 0x143C - CNVi BT Audio Offload Enable/Disable BT Audio Offload, Default is ENABLE. 0: DISABLE, 1: ENABLE $EN_DIS **/ UINT8 CnviBtAudioOffload; -/** Offset 0x13FD - Reserved +/** Offset 0x143D - Reserved **/ - UINT8 Reserved51[3]; + UINT8 Reserved55[3]; -/** Offset 0x1400 - CNVi RF_RESET pin muxing +/** Offset 0x1440 - CNVi RF_RESET pin muxing Select CNVi RF_RESET# pin depending on board routing. LP/P/M: GPP_A8 = 0x2942E408(default) or GPP_F4 = 0x194CE404. H/S: 0. Refer to GPIO_*_MUXING_CNVI_RF_RESET_* in GpioPins*.h. **/ UINT32 CnviRfResetPinMux; -/** Offset 0x1404 - CNVi CLKREQ pin muxing +/** Offset 0x1444 - CNVi CLKREQ pin muxing Select CNVi CLKREQ pin depending on board routing. LP/P/M: GPP_A9 = 0x3942E609(default) or GPP_F5 = 0x394CE605. H/S: 0. Refer to GPIO_*_MUXING_CNVI_CRF_XTAL_CLKREQ_* in GpioPins*.h. **/ UINT32 CnviClkreqPinMux; -/** Offset 0x1408 - Reserved +/** Offset 0x1448 - Reserved **/ - UINT8 Reserved52; + UINT8 Reserved56; -/** Offset 0x1409 - Enable Device 4 +/** Offset 0x1449 - Enable Device 4 Enable/disable Device 4 $EN_DIS **/ UINT8 Device4Enable; -/** Offset 0x140A - Skip PAM regsiter lock +/** Offset 0x144A - Skip PAM regsiter lock Enable: PAM register will not be locked by RC, platform code should lock it, Disable(Default): PAM registers will be locked by RC $EN_DIS **/ UINT8 SkipPamLock; -/** Offset 0x140B - Reserved +/** Offset 0x144B - Reserved **/ - UINT8 Reserved53; + UINT8 Reserved57; -/** Offset 0x140C - PCH HDA Verb Table Entry Number +/** Offset 0x144C - PCH HDA Verb Table Entry Number Number of Entries in Verb Table. **/ UINT8 PchHdaVerbTableEntryNum; -/** Offset 0x140D - Reserved +/** Offset 0x144D - Reserved **/ - UINT8 Reserved54[3]; + UINT8 Reserved58[3]; -/** Offset 0x1410 - PCH HDA Verb Table Pointer +/** Offset 0x1450 - PCH HDA Verb Table Pointer Pointer to Array of pointers to Verb Table. **/ UINT64 PchHdaVerbTablePtr; -/** Offset 0x1418 - PCH HDA Codec Sx Wake Capability +/** Offset 0x1458 - PCH HDA Codec Sx Wake Capability Capability to detect wake initiated by a codec in Sx **/ UINT8 PchHdaCodecSxWakeCapability; -/** Offset 0x1419 - Enable Pme +/** Offset 0x1459 - Enable Pme Enable Azalia wake-on-ring. $EN_DIS **/ UINT8 PchHdaPme; -/** Offset 0x141A - HD Audio Link Frequency +/** Offset 0x145A - HD Audio Link Frequency HDA Link Freq (PCH_HDAUDIO_LINK_FREQUENCY enum): 0: 6MHz, 1: 12MHz, 2: 24MHz. 0: 6MHz, 1: 12MHz, 2: 24MHz **/ UINT8 PchHdaLinkFrequency; -/** Offset 0x141B - Reserved +/** Offset 0x145B - Reserved **/ - UINT8 Reserved55[2]; + UINT8 Reserved59[2]; -/** Offset 0x141D - HD Audio Microphone Privacy applied for SoundWire Link number 0 in HW Mode +/** Offset 0x145D - HD Audio Microphone Privacy applied for SoundWire Link number 0 in HW Mode HD Audio Microphone Privacy applied for SoundWire Link number 0 in HW Mode: 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchHdaMicPrivacyHwModeSoundWire0; -/** Offset 0x141E - HD Audio Microphone Privacy applied for SoundWire Link number 1 in HW Mode +/** Offset 0x145E - HD Audio Microphone Privacy applied for SoundWire Link number 1 in HW Mode HD Audio Microphone Privacy applied for SoundWire Link number 1 in HW Mode: 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchHdaMicPrivacyHwModeSoundWire1; -/** Offset 0x141F - HD Audio Microphone Privacy applied for SoundWire Link number 2 in HW Mode +/** Offset 0x145F - HD Audio Microphone Privacy applied for SoundWire Link number 2 in HW Mode HD Audio Microphone Privacy applied for SoundWire Link number 2 in HW Mode: 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchHdaMicPrivacyHwModeSoundWire2; -/** Offset 0x1420 - HD Audio Microphone Privacy applied for SoundWire Link number 3 in HW Mode +/** Offset 0x1460 - HD Audio Microphone Privacy applied for SoundWire Link number 3 in HW Mode HD Audio Microphone Privacy applied for SoundWire Link number 3 in HW Mode: 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchHdaMicPrivacyHwModeSoundWire3; -/** Offset 0x1421 - HD Audio Microphone Privacy applied for SoundWire Link number 4 in HW Mode +/** Offset 0x1461 - HD Audio Microphone Privacy applied for SoundWire Link number 4 in HW Mode HD Audio Microphone Privacy applied for SoundWire Link number 4 in HW Mode: 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchHdaMicPrivacyHwModeSoundWire4; -/** Offset 0x1422 - HD Audio Microphone Privacy applied for Dmic in HW Mode +/** Offset 0x1462 - HD Audio Microphone Privacy applied for Dmic in HW Mode HD Audio Microphone Privacy applied for Dmic in HW Mode: 0: Disable, 1: Enable $EN_DIS **/ UINT8 PchHdaMicPrivacyHwModeDmic; -/** Offset 0x1423 - Reserved +/** Offset 0x1463 - Reserved **/ - UINT8 Reserved56[13]; + UINT8 Reserved60[13]; -/** Offset 0x1430 - Pointer to ChipsetInit Binary +/** Offset 0x1470 - Pointer to ChipsetInit Binary ChipsetInit Binary Pointer. **/ UINT64 ChipsetInitBinPtr; -/** Offset 0x1438 - Length of ChipsetInit Binary +/** Offset 0x1478 - Length of ChipsetInit Binary ChipsetInit Binary Length. **/ UINT32 ChipsetInitBinLen; -/** Offset 0x143C - Reserved +/** Offset 0x147C - Reserved **/ - UINT8 Reserved57[36]; + UINT8 Reserved61[36]; } FSP_S_CONFIG; /** Fsp S UPD Configuration @@ -2329,11 +2410,11 @@ typedef struct { **/ FSP_S_CONFIG FspsConfig; -/** Offset 0x1460 +/** Offset 0x14A0 **/ - UINT8 UnusedUpdSpace36[6]; + UINT8 FspsUpdRsvd36[6]; -/** Offset 0x1466 +/** Offset 0x14A6 **/ UINT16 UpdTerminator; } FSPS_UPD; From 09670ec9d61a987917f7854ef3e39625c18122fa Mon Sep 17 00:00:00 2001 From: Ronak Kanabar Date: Thu, 6 Feb 2025 16:02:45 +0530 Subject: [PATCH 0122/3886] soc/intel/pantherlake: Add support for VMD device This commit adds support for VMD (Volume Management Device) in the Panther Lake SoC. VMD is a feature that allows the management of NVMe storage devices by abstracting the PCIe root complex. It provides a way to manage multiple NVMe drives more efficiently. Changes include: - Adding VMD to the `min_pci_sleep_states` array in `acpi.c`. - Updating `chipset.cb` to include the VMD device. - Disabling the VMD device by default. - Introducing a new function `fill_fsps_vmd_params`. - Defining the VMD device and function numbers in `pci_devs.h`. BUG=b:391083063 TEST=Able to build and boot google/fatcat. Observed that VmdEnable UPD is disabled in debug FSP logs. Change-Id: Ie391196e7b4537d1146ac30177a0ba472a1bfb43 Signed-off-by: Ronak Kanabar Reviewed-on: https://review.coreboot.org/c/coreboot/+/86301 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Jayvik Desai Reviewed-by: Kapil Porwal Reviewed-by: Bora Guvendik --- src/soc/intel/pantherlake/acpi.c | 1 + src/soc/intel/pantherlake/chipset.cb | 1 + src/soc/intel/pantherlake/fsp_params.c | 7 +++++++ src/soc/intel/pantherlake/include/soc/pci_devs.h | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/src/soc/intel/pantherlake/acpi.c b/src/soc/intel/pantherlake/acpi.c index 5df3ef928d..1c965f411e 100644 --- a/src/soc/intel/pantherlake/acpi.c +++ b/src/soc/intel/pantherlake/acpi.c @@ -193,6 +193,7 @@ static struct min_sleep_state min_pci_sleep_states[] = { { PCI_DEVFN_TCSS_XDCI, ACPI_DEVICE_SLEEP_D3 }, { SA_DEVFN_TCSS_DMA0, ACPI_DEVICE_SLEEP_D3 }, { SA_DEVFN_TCSS_DMA1, ACPI_DEVICE_SLEEP_D3 }, + { PCI_DEVFN_VMD, ACPI_DEVICE_SLEEP_D3 }, { PCI_DEVFN_THC0, ACPI_DEVICE_SLEEP_D3 }, { PCI_DEVFN_THC1, ACPI_DEVICE_SLEEP_D3 }, { PCH_DEVFN_XHCI, ACPI_DEVICE_SLEEP_D3 }, diff --git a/src/soc/intel/pantherlake/chipset.cb b/src/soc/intel/pantherlake/chipset.cb index 0f7967b184..0c57a7def6 100644 --- a/src/soc/intel/pantherlake/chipset.cb +++ b/src/soc/intel/pantherlake/chipset.cb @@ -86,6 +86,7 @@ chip soc/intel/pantherlake device pci 0d.1 alias tcss_xdci off end device pci 0d.2 alias tcss_dma0 off end device pci 0d.3 alias tcss_dma1 off end + device pci 0e.0 alias vmd off end device pci 10.0 alias thc0 off end device pci 10.1 alias thc1 off end device pci 12.0 alias ish off end diff --git a/src/soc/intel/pantherlake/fsp_params.c b/src/soc/intel/pantherlake/fsp_params.c index a78059d512..fefd3e0890 100644 --- a/src/soc/intel/pantherlake/fsp_params.c +++ b/src/soc/intel/pantherlake/fsp_params.c @@ -560,6 +560,12 @@ static void fill_fsps_cnvi_params(FSP_S_CONFIG *s_cfg, s_cfg->CnviBtInterface = is_devfn_enabled(PCI_DEVFN_CNVI_BT) ? 2 : 1; } +static void fill_fsps_vmd_params(FSP_S_CONFIG *s_cfg, + const struct soc_intel_pantherlake_config *config) +{ + s_cfg->VmdEnable = is_devfn_enabled(PCI_DEVFN_VMD); +} + static void fill_fsps_pmcpd_params(FSP_S_CONFIG *s_cfg, const struct soc_intel_pantherlake_config *config) { @@ -710,6 +716,7 @@ static void soc_silicon_init_params(FSP_S_CONFIG *s_cfg, fill_fsps_pci_ssid_params, fill_fsps_lan_params, fill_fsps_cnvi_params, + fill_fsps_vmd_params, fill_fsps_pmcpd_params, fill_fsps_thc_params, fill_fsps_8254_params, diff --git a/src/soc/intel/pantherlake/include/soc/pci_devs.h b/src/soc/intel/pantherlake/include/soc/pci_devs.h index 5c74b6d7ef..a69f4820c8 100644 --- a/src/soc/intel/pantherlake/include/soc/pci_devs.h +++ b/src/soc/intel/pantherlake/include/soc/pci_devs.h @@ -79,6 +79,10 @@ #define PCI_DEV_TCSS_DMA0 _PCI_DEV(TCSS, 2) #define PCI_DEV_TCSS_DMA1 _PCI_DEV(TCSS, 3) +#define PCI_DEV_SLOT_VMD 0x0e +#define PCI_DEVFN_VMD _PCI_DEVFN(VMD, 0) +#define PCI_DEV_VMD _PCI_DEV(VMD, 0) + #define PCI_DEV_SLOT_THC 0x10 #define PCI_DEVFN_THC0 _PCI_DEVFN(THC, 0) #define PCI_DEVFN_THC1 _PCI_DEVFN(THC, 1) From 9aaa3e99d3c59d2aadf7dbcdf63426e9a424e1ce Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 13 Feb 2025 19:06:50 -0600 Subject: [PATCH 0123/3886] src/acpi/acpigen: Increase LENSTACK_SIZE from 10 to 15 Some upcoming patches run up against the existing limit, which was added 16 years ago without any justification as to the size. Bump the size from 10 to 15, to prevent tripping the runtime assertion. TEST=Tested with rest of patch train Change-Id: I8362b3a63a23bea0ce47920e5d41cd2535dbc084 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86427 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes Reviewed-by: Patrick Rudolph --- src/acpi/acpigen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index f682522bc8..7d24b9e131 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* How much nesting do we support? */ -#define ACPIGEN_LENSTACK_SIZE 10 +#define ACPIGEN_LENSTACK_SIZE 15 /* If you need to change this, change acpigen_pop_len too */ #define ACPIGEN_RSVD_PKGLEN_BYTES 3 From d81378d1d7235fb4d740145e969d24ef9779b571 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 16:28:27 +0000 Subject: [PATCH 0124/3886] drivers/usb/intel_bluetooth: Use correct function to close scope The scope should be closed with `acpigen_write_scope_end`, rather than `acpigen_pop_len`. Change-Id: I80df2ee1b51d7dbba85e556bee0fd7513ac933bb Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86500 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/drivers/usb/acpi/intel_bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 4cefcf28b6..5794a5bc37 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -352,5 +352,5 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp } acpigen_pop_len(); - acpigen_pop_len(); + acpigen_write_scope_end(); } From 7377896e119adbe0b7f30cbbbf9d682be53c0e6c Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 20:27:19 +0000 Subject: [PATCH 0125/3886] mb/starlabs/{lite_adl,byte_adl}: Disable CNVi Audio Offload Both of these boards use the Intel 9560, which does not support audio offload so configure it accordingly. Change-Id: Idcdbd7cc83eda50ece74ce823bef60b16b49600c Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86502 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb | 2 -- src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb b/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb index 6ba3e7de25..bbedc9657a 100644 --- a/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb +++ b/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb @@ -2,7 +2,6 @@ chip soc/intel/alderlake # FSP UPDs register "enable_c6dram" = "true" register "eist_enable" = "true" - register "cnvi_bt_audio_offload" = "true" register "cnvi_bt_core" = "true" register "sagv" = "SaGv_Enabled" @@ -123,7 +122,6 @@ chip soc/intel/alderlake register "type" = "UPC_TYPE_INTERNAL" register "group" = "ACPI_PLD_GROUP(0, 5)" register "is_intel_bluetooth" = "1" - register "cnvi_bt_audio_offload" = "1" register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_VGPIO_0)" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A13)" device ref usb2_port10 on end diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb b/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb index 16603f3569..0c9b7a5dde 100644 --- a/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb +++ b/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb @@ -1,6 +1,5 @@ chip soc/intel/alderlake # FSP UPDs - register "cnvi_bt_audio_offload" = "true" register "cnvi_bt_core" = "true" register "enable_c6dram" = "true" register "eist_enable" = "true" @@ -108,7 +107,6 @@ chip soc/intel/alderlake register "desc" = ""CNVi Bluetooth"" register "type" = "UPC_TYPE_INTERNAL" register "is_intel_bluetooth" = "1" - register "cnvi_bt_audio_offload" = "1" register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_VGPIO_0)" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A13)" register "group" = "ACPI_PLD_GROUP(0, 5)" From 5776ea9d0493c5ed99298611b5a0bd755762bdf1 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 20:28:57 +0000 Subject: [PATCH 0126/3886] drivers/usb/intel_bluetooth: Make AOLD Method NotSerialized This method only returns a package, so it does not need to be serialized. Change-Id: I5e61e92b0cffb28aaa070db3e9e8e2ff0e7c4251 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86503 Reviewed-by: Andy Ebrahiem Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/drivers/usb/acpi/intel_bluetooth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 5794a5bc37..d83bcb285d 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -230,7 +230,7 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo acpigen_pop_len(); /* - * Method (AOLD, 0, Serialized) + * Method (AOLD, 0, NotSerialized) * { * Name (AODS, Package (0x03) * { @@ -242,7 +242,7 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo * Return (AODS) * } */ - acpigen_write_method_serialized("AOLD", 0); + acpigen_write_method("AOLD", 0); { acpigen_write_name("AODS"); acpigen_write_package(3); From 741017dfe85c633d1897710f33e4249cd4f108c0 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 20:30:14 +0000 Subject: [PATCH 0127/3886] drivers/usb/acpi: Make SBTE Method NotSerialized This method calls STXS and CTXS, which are both serialized so this method itself does not need to be serialized. Change-Id: Ia46eaa8746bcff5a57831c14a2845139116b01da Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86504 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Andy Ebrahiem --- src/drivers/usb/acpi/intel_bluetooth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index d83bcb285d..2678d52faf 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -267,7 +267,7 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp acpigen_write_mutex("CNMT", 0); /* - * Method (SBTE, 1, Serialized) + * Method (SBTE, 1, NotSerialized) * { * If (Arg0 == 1) * { @@ -277,7 +277,7 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp * } * } */ - acpigen_write_method_serialized("SBTE", 1); + acpigen_write_method("SBTE", 1); { if (enable_gpio) { acpigen_write_if_lequal_op_int(ARG0_OP, 1); From 017260c5345e9db5b79972676773b55dd7dfe8cb Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 20:32:34 +0000 Subject: [PATCH 0128/3886] driver/usb/intel_bluetooth: Set BTRK to NotSerialized This method calls STXS and CTXS, which are both serialized so this method itself does not need to be serialized. Change-Id: I6d9d6d3b765bba918c08f64458bd1fdad18eff18 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86505 Reviewed-by: Andy Ebrahiem Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/drivers/usb/acpi/intel_bluetooth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 2678d52faf..a979b42ebf 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -311,7 +311,7 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp acpigen_pop_len(); /* - * Method (BTRK, 1, Serialized) + * Method (BTRK, 1, NotSerialized) * { * If (Arg0 == 1) * { @@ -321,7 +321,7 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp * } * } */ - acpigen_write_method_serialized("BTRK", 1); + acpigen_write_method("BTRK", 1); { acpigen_write_if_lequal_op_int(ARG0_OP, 1); { From e2ea7f22c6355d15515c049ca0dc4352173a0c01 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 20:51:47 +0000 Subject: [PATCH 0129/3886] soc/intel/cnvi: Remove _S0W and DSW Methods coreboot already has a way to configure wakeup from wireless through the `wifi/generic` driver, so remove these to avoid conflicts. Change-Id: I744ef37690b7a2478ec29a43b987b43592df2235 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86506 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/soc/intel/common/block/cnvi/cnvi.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index 87e9bbb72e..a4263af646 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -86,19 +86,6 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_write_field("CWAR", fields2, ARRAY_SIZE(fields2), FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); -/* - * Method (_S0W, 0, NotSerialized) // _S0W: S0 Device Wake State - * { - * Return (ACPI_DEVICE_SLEEP_D3_HOT) - * } - */ - acpigen_write_method("_S0W", 0); - { - acpigen_write_return_integer(ACPI_DEVICE_SLEEP_D3_HOT); - } - acpigen_pop_len(); - - /* * Name (RSTT, Zero) */ @@ -326,10 +313,6 @@ static void cnvw_fill_ssdt(const struct device *dev) * Method (_PS3, 0, Serialized) * { * } - * - * Method (_DSW, 3) - * { - * } */ acpigen_write_method_serialized("_PS0", 0); acpigen_pop_len(); @@ -337,9 +320,6 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_write_method_serialized("_PS3", 0); acpigen_pop_len(); - acpigen_write_method("_DSW", 3); - acpigen_pop_len(); - /* * Method (CFLR, 0, NotSerialized) * { From ad81102108ead197276d0a8dba83703b6facf817 Mon Sep 17 00:00:00 2001 From: Brian Hsu Date: Tue, 11 Feb 2025 14:33:03 +0800 Subject: [PATCH 0130/3886] mb/google/nissa/var/guren: Create empty variant for guren Create the template files to a new directory named for the guren variant. BUG=b:397149037 BRANCH=firmware-nissa-15217.B TEST=None Change-Id: I23803aaceb122d2b9e3c2215914643593afa1246 Signed-off-by: Brian Hsu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86492 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- src/mainboard/google/brya/Kconfig | 7 +++++++ src/mainboard/google/brya/Kconfig.name | 3 +++ .../google/brya/variants/guren/include/variant/ec.h | 8 ++++++++ .../google/brya/variants/guren/include/variant/gpio.h | 8 ++++++++ .../google/brya/variants/guren/memory/Makefile.mk | 5 +++++ .../brya/variants/guren/memory/dram_id.generated.txt | 1 + .../brya/variants/guren/memory/mem_parts_used.txt | 11 +++++++++++ .../google/brya/variants/guren/overridetree.cb | 6 ++++++ 8 files changed, 49 insertions(+) create mode 100644 src/mainboard/google/brya/variants/guren/include/variant/ec.h create mode 100644 src/mainboard/google/brya/variants/guren/include/variant/gpio.h create mode 100644 src/mainboard/google/brya/variants/guren/memory/Makefile.mk create mode 100644 src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt create mode 100644 src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt create mode 100644 src/mainboard/google/brya/variants/guren/overridetree.cb diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 213d49967c..fc18f8f660 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -295,6 +295,9 @@ config BOARD_GOOGLE_GOTHRAX select DRIVERS_I2C_SX9324_SUPPORT_LEGACY_LINUX_DRIVER select HAVE_WWAN_POWER_SEQUENCE +config BOARD_GOOGLE_GUREN + select BOARD_GOOGLE_BASEBOARD_NISSA + config BOARD_GOOGLE_HADES select BOARD_GOOGLE_BASEBOARD_HADES select DRIVERS_GENESYSLOGIC_GL9755 @@ -766,6 +769,7 @@ config DRIVER_TPM_I2C_BUS default 0x1 if BOARD_GOOGLE_GLADIOS default 0x0 if BOARD_GOOGLE_GLASSWAY default 0x0 if BOARD_GOOGLE_GOTHRAX + default 0x0 if BOARD_GOOGLE_GUREN default 0x3 if BOARD_GOOGLE_HADES default 0x0 if BOARD_GOOGLE_JOXER default 0x1 if BOARD_GOOGLE_KANO @@ -847,6 +851,7 @@ config TPM_TIS_ACPI_INTERRUPT default 13 if BOARD_GOOGLE_GLADIOS default 13 if BOARD_GOOGLE_GLASSWAY default 13 if BOARD_GOOGLE_GOTHRAX + default 13 if BOARD_GOOGLE_GUREN default 20 if BOARD_GOOGLE_HADES # GPE0_DW0_20 (GPP_A20_IRQ) default 13 if BOARD_GOOGLE_JOXER default 13 if BOARD_GOOGLE_KANO @@ -932,6 +937,7 @@ config MAINBOARD_PART_NUMBER default "Gladios" if BOARD_GOOGLE_GLADIOS default "Glassway" if BOARD_GOOGLE_GLASSWAY default "Gothrax" if BOARD_GOOGLE_GOTHRAX + default "Guren" if BOARD_GOOGLE_GUREN default "Hades" if BOARD_GOOGLE_HADES default "Joxer" if BOARD_GOOGLE_JOXER default "Kano" if BOARD_GOOGLE_KANO @@ -1006,6 +1012,7 @@ config VARIANT_DIR default "gladios" if BOARD_GOOGLE_GLADIOS default "glassway" if BOARD_GOOGLE_GLASSWAY default "gothrax" if BOARD_GOOGLE_GOTHRAX + default "guren" if BOARD_GOOGLE_GUREN default "hades" if BOARD_GOOGLE_HADES default "joxer" if BOARD_GOOGLE_JOXER default "kano" if BOARD_GOOGLE_KANO diff --git a/src/mainboard/google/brya/Kconfig.name b/src/mainboard/google/brya/Kconfig.name index 50bfaeff34..6007aa2c2a 100644 --- a/src/mainboard/google/brya/Kconfig.name +++ b/src/mainboard/google/brya/Kconfig.name @@ -68,6 +68,9 @@ config BOARD_GOOGLE_GLASSWAY config BOARD_GOOGLE_GOTHRAX bool "-> Gothrax" +config BOARD_GOOGLE_GUREN + bool "-> Guren" + config BOARD_GOOGLE_HADES bool "-> Hades" diff --git a/src/mainboard/google/brya/variants/guren/include/variant/ec.h b/src/mainboard/google/brya/variants/guren/include/variant/ec.h new file mode 100644 index 0000000000..7a2a6ff8b7 --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/include/variant/ec.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __VARIANT_EC_H__ +#define __VARIANT_EC_H__ + +#include + +#endif diff --git a/src/mainboard/google/brya/variants/guren/include/variant/gpio.h b/src/mainboard/google/brya/variants/guren/include/variant/gpio.h new file mode 100644 index 0000000000..c4fe342621 --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/include/variant/gpio.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef VARIANT_GPIO_H +#define VARIANT_GPIO_H + +#include + +#endif diff --git a/src/mainboard/google/brya/variants/guren/memory/Makefile.mk b/src/mainboard/google/brya/variants/guren/memory/Makefile.mk new file mode 100644 index 0000000000..eace2e443e --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/memory/Makefile.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# This is an auto-generated file. Do not edit!! +# Add memory parts in mem_parts_used.txt and run spd_tools to regenerate. + +SPD_SOURCES = placeholder diff --git a/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt b/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt new file mode 100644 index 0000000000..fa247902ee --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt @@ -0,0 +1 @@ +DRAM Part Name ID to assign diff --git a/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt b/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt new file mode 100644 index 0000000000..2499005682 --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt @@ -0,0 +1,11 @@ +# This is a CSV file containing a list of memory parts used by this variant. +# One part per line with an optional fixed ID in column 2. +# Only include a fixed ID if it is required for legacy reasons! +# Generated IDs are dependent on the order of parts in this file, +# so new parts must always be added at the end of the file! +# +# Generate an updated Makefile.mk and dram_id.generated.txt by running the +# part_id_gen tool from util/spd_tools. +# See util/spd_tools/README.md for more details and instructions. + +# Part Name diff --git a/src/mainboard/google/brya/variants/guren/overridetree.cb b/src/mainboard/google/brya/variants/guren/overridetree.cb new file mode 100644 index 0000000000..4f2c04a57a --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/overridetree.cb @@ -0,0 +1,6 @@ +chip soc/intel/alderlake + + device domain 0 on + end + +end From 584cdc99b708eeee8e9930569c9ba51e524c4368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kope=C4=87?= Date: Mon, 27 May 2024 11:20:12 +0200 Subject: [PATCH 0131/3886] mb/novacustom: add V5x0TU board (Meteor Lake) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NovaCustom (Clevo) V5x0TU are two laptops with Intel Core Ultra (Meteor Lake) series processors. Two variants (V540TU and V560TU) are supported. Their EC firmware is different due to keyboard layout changes. On coreboot's side, the only difference are SMBIOS strings. Working: - DDR5 SODIMM in slot RAM2 - M.2 2280 PCIe slots - Thunderbolt, USB ports - Video outputs in OS and firmware via FSP GOP - I2C touchpad, webcam, SD Card reader - S0ix - Booting Ubuntu 24.04 with edk2 UefiPayload - Vboot, TPM measured boot VBT was extracted from Clevo Insyde firmware, version v1.07.2. Change-Id: I82c73ddb1e76a9baf9b97e13124aa249ae1c2771 Signed-off-by: Michał Kopeć Reviewed-on: https://review.coreboot.org/c/coreboot/+/82673 Reviewed-by: Krystian Hebel Tested-by: build bot (Jenkins) --- src/mainboard/novacustom/Kconfig | 17 + src/mainboard/novacustom/Kconfig.name | 4 + src/mainboard/novacustom/mtl-h/Kconfig | 105 ++++ src/mainboard/novacustom/mtl-h/Kconfig.name | 7 + src/mainboard/novacustom/mtl-h/Makefile.mk | 14 + .../novacustom/mtl-h/acpi/backlight.asl | 32 + .../novacustom/mtl-h/acpi/mainboard.asl | 11 + src/mainboard/novacustom/mtl-h/board_info.txt | 6 + src/mainboard/novacustom/mtl-h/bootblock.c | 9 + src/mainboard/novacustom/mtl-h/cmos.default | 3 + src/mainboard/novacustom/mtl-h/cmos.layout | 46 ++ src/mainboard/novacustom/mtl-h/data.vbt | Bin 0 -> 7680 bytes src/mainboard/novacustom/mtl-h/devicetree.cb | 316 ++++++++++ src/mainboard/novacustom/mtl-h/dsdt.asl | 34 ++ src/mainboard/novacustom/mtl-h/fadt.c | 8 + src/mainboard/novacustom/mtl-h/gpio.c | 574 ++++++++++++++++++ src/mainboard/novacustom/mtl-h/gpio_early.c | 16 + src/mainboard/novacustom/mtl-h/hda_verb.c | 42 ++ .../novacustom/mtl-h/include/mainboard/gpio.h | 17 + src/mainboard/novacustom/mtl-h/ramstage.c | 42 ++ src/mainboard/novacustom/mtl-h/romstage.c | 31 + src/mainboard/novacustom/mtl-h/vboot-rwab.fmd | 49 ++ 22 files changed, 1383 insertions(+) create mode 100644 src/mainboard/novacustom/Kconfig create mode 100644 src/mainboard/novacustom/Kconfig.name create mode 100644 src/mainboard/novacustom/mtl-h/Kconfig create mode 100644 src/mainboard/novacustom/mtl-h/Kconfig.name create mode 100644 src/mainboard/novacustom/mtl-h/Makefile.mk create mode 100644 src/mainboard/novacustom/mtl-h/acpi/backlight.asl create mode 100644 src/mainboard/novacustom/mtl-h/acpi/mainboard.asl create mode 100644 src/mainboard/novacustom/mtl-h/board_info.txt create mode 100644 src/mainboard/novacustom/mtl-h/bootblock.c create mode 100644 src/mainboard/novacustom/mtl-h/cmos.default create mode 100644 src/mainboard/novacustom/mtl-h/cmos.layout create mode 100644 src/mainboard/novacustom/mtl-h/data.vbt create mode 100644 src/mainboard/novacustom/mtl-h/devicetree.cb create mode 100644 src/mainboard/novacustom/mtl-h/dsdt.asl create mode 100644 src/mainboard/novacustom/mtl-h/fadt.c create mode 100644 src/mainboard/novacustom/mtl-h/gpio.c create mode 100644 src/mainboard/novacustom/mtl-h/gpio_early.c create mode 100644 src/mainboard/novacustom/mtl-h/hda_verb.c create mode 100644 src/mainboard/novacustom/mtl-h/include/mainboard/gpio.h create mode 100644 src/mainboard/novacustom/mtl-h/ramstage.c create mode 100644 src/mainboard/novacustom/mtl-h/romstage.c create mode 100644 src/mainboard/novacustom/mtl-h/vboot-rwab.fmd diff --git a/src/mainboard/novacustom/Kconfig b/src/mainboard/novacustom/Kconfig new file mode 100644 index 0000000000..e159480899 --- /dev/null +++ b/src/mainboard/novacustom/Kconfig @@ -0,0 +1,17 @@ +## SPDX-License-Identifier: GPL-2.0-only + +if VENDOR_NOVACUSTOM + +choice + prompt "Mainboard model" + +source "src/mainboard/novacustom/*/Kconfig.name" + +endchoice + +source "src/mainboard/novacustom/*/Kconfig" + +config MAINBOARD_VENDOR + default "NovaCustom" + +endif # VENDOR_NOVACUSTOM diff --git a/src/mainboard/novacustom/Kconfig.name b/src/mainboard/novacustom/Kconfig.name new file mode 100644 index 0000000000..242b3bbf3f --- /dev/null +++ b/src/mainboard/novacustom/Kconfig.name @@ -0,0 +1,4 @@ +## SPDX-License-Identifier: GPL-2.0-only + +config VENDOR_NOVACUSTOM + bool "NovaCustom" diff --git a/src/mainboard/novacustom/mtl-h/Kconfig b/src/mainboard/novacustom/mtl-h/Kconfig new file mode 100644 index 0000000000..5d608b40ac --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/Kconfig @@ -0,0 +1,105 @@ +config BOARD_NOVACUSTOM_MTLH_COMMON + def_bool n + select BOARD_ROMSIZE_KB_32768 + select DRIVERS_GENERIC_BAYHUB_LV2 + select DRIVERS_GFX_GENERIC + select DRIVERS_I2C_HID + select DRIVERS_INTEL_PMC + select DRIVERS_INTEL_USB4_RETIMER + select DRIVERS_WIFI_GENERIC + select EC_DASHARO_EC + select HAVE_ACPI_TABLES + select HAVE_CMOS_DEFAULT + select HAVE_OPTION_TABLE + select INTEL_GMA_HAVE_VBT + select MAINBOARD_HAS_TPM2 + select MEMORY_MAPPED_TPM + select NO_UART_ON_SUPERIO + select PMC_IPC_ACPI_INTERFACE + select SOC_INTEL_COMMON_BLOCK_HDA_VERB + select SOC_INTEL_CRASHLOG + select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES + select SOC_INTEL_METEORLAKE_U_H + select SPD_READ_BY_WORD + select SYSTEM_TYPE_LAPTOP + +config BOARD_NOVACUSTOM_V5X0TU_BASE + bool + select BOARD_NOVACUSTOM_MTLH_COMMON + select MAINBOARD_USES_IFD_GBE_REGION + +config BOARD_NOVACUSTOM_V540TU + bool + select BOARD_NOVACUSTOM_V5X0TU_BASE + +config BOARD_NOVACUSTOM_V560TU + bool + select BOARD_NOVACUSTOM_V5X0TU_BASE + +if BOARD_NOVACUSTOM_MTLH_COMMON + +config MAINBOARD_DIR + default "novacustom/mtl-h" + +config MAINBOARD_PART_NUMBER + default "V54x_6x_TU" if BOARD_NOVACUSTOM_V5X0TU_BASE + +config MAINBOARD_SMBIOS_PRODUCT_NAME + default "V54x_6x_TU" if BOARD_NOVACUSTOM_V5X0TU_BASE + +config MAINBOARD_SMBIOS_MANUFACTURER + default "Notebook" + +config MAINBOARD_VERSION + default "V540TU" if BOARD_NOVACUSTOM_V540TU + default "V560TU" if BOARD_NOVACUSTOM_V560TU + +config MAINBOARD_FAMILY + string + default "Not Applicable" # Match Insyde firmware, for Windows Update + +config CBFS_SIZE + default 0xA00000 + +config CONSOLE_POST + default y + +config DIMM_SPD_SIZE + default 1024 + +config POST_DEVICE + default n + +config USE_PM_ACPI_TIMER + default n + +config VBOOT + select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC + select GBB_FLAG_DISABLE_FWMP + select GBB_FLAG_DISABLE_LID_SHUTDOWN + select GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC + select HAS_RECOVERY_MRC_CACHE + select VBOOT_ALWAYS_ENABLE_DISPLAY + select VBOOT_CLEAR_RECOVERY_IN_RAMSTAGE + select VBOOT_MOCK_SECDATA + select VBOOT_NO_BOARD_SUPPORT + +config VBOOT_SLOTS_RW_AB + default y if VBOOT + +config VBOOT_VBNV_OFFSET + default 0x28 + +config TPM_PIRQ + default 0x61 # GPP_E01 + +config FMDFILE + default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/vboot-rwab.fmd" if VBOOT && VBOOT_SLOTS_RW_AB + +config SOC_INTEL_CSE_SEND_EOP_EARLY + default n + +config EC_DASHARO_EC_FLASH_SIZE + default 0x40000 + +endif diff --git a/src/mainboard/novacustom/mtl-h/Kconfig.name b/src/mainboard/novacustom/mtl-h/Kconfig.name new file mode 100644 index 0000000000..ff079a0f52 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/Kconfig.name @@ -0,0 +1,7 @@ +comment "Meteor Lake H" + +config BOARD_NOVACUSTOM_V540TU + bool "V540TU (14\")" + +config BOARD_NOVACUSTOM_V560TU + bool "V560TU (16\")" diff --git a/src/mainboard/novacustom/mtl-h/Makefile.mk b/src/mainboard/novacustom/mtl-h/Makefile.mk new file mode 100644 index 0000000000..9a35f5a80b --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/Makefile.mk @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-only + +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include + +bootblock-y += bootblock.c +bootblock-y += gpio_early.c + +romstage-y += romstage.c + +ramstage-y += ramstage.c +ramstage-y += hda_verb.c +ramstage-y += gpio.c + +ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c diff --git a/src/mainboard/novacustom/mtl-h/acpi/backlight.asl b/src/mainboard/novacustom/mtl-h/acpi/backlight.asl new file mode 100644 index 0000000000..01fa83ea61 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/acpi/backlight.asl @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +Scope (GFX0) +{ + Name (BRIG, Package (23) { + 40, /* default AC */ + 40, /* default Battery */ + 0, + 5, + 10, + 15, + 20, + 25, + 30, + 35, + 40, + 45, + 50, + 55, + 60, + 65, + 70, + 75, + 80, + 85, + 90, + 95, + 100 + }) +} diff --git a/src/mainboard/novacustom/mtl-h/acpi/mainboard.asl b/src/mainboard/novacustom/mtl-h/acpi/mainboard.asl new file mode 100644 index 0000000000..ec229038c2 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/acpi/mainboard.asl @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#define EC_GPE_SCI 0x6E +#define EC_GPE_SWI 0x6B +#include + +Scope (\_SB) { + Scope (PCI0) { + #include "backlight.asl" + } +} diff --git a/src/mainboard/novacustom/mtl-h/board_info.txt b/src/mainboard/novacustom/mtl-h/board_info.txt new file mode 100644 index 0000000000..4b3db962d5 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/board_info.txt @@ -0,0 +1,6 @@ +Vendor name: NovaCustom +Category: laptop +ROM package: WSON-8 +ROM protocol: SPI +ROM socketed: n +Flashrom support: y diff --git a/src/mainboard/novacustom/mtl-h/bootblock.c b/src/mainboard/novacustom/mtl-h/bootblock.c new file mode 100644 index 0000000000..8d06adc9d7 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/bootblock.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +void bootblock_mainboard_early_init(void) +{ + mainboard_configure_early_gpios(); +} diff --git a/src/mainboard/novacustom/mtl-h/cmos.default b/src/mainboard/novacustom/mtl-h/cmos.default new file mode 100644 index 0000000000..62715bc6ba --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/cmos.default @@ -0,0 +1,3 @@ +boot_option=Fallback +debug_level=Debug +me_state=Enable diff --git a/src/mainboard/novacustom/mtl-h/cmos.layout b/src/mainboard/novacustom/mtl-h/cmos.layout new file mode 100644 index 0000000000..66b8665b47 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/cmos.layout @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0-only + +entries + +0 304 r 0 reserved_memory + +# coreboot config options: ramtop +304 80 h 0 ramtop + +# RTC_BOOT_BYTE (coreboot hardcoded) +384 1 e 4 boot_option +388 4 h 0 reboot_counter + +# RTC_CLK_ALTCENTURY +400 8 r 0 century + +412 4 e 6 debug_level +416 1 e 2 me_state +417 3 h 0 me_state_counter + +# Vboot non-volatile data +432 128 r 0 vbnv + +984 16 h 0 check_sum + +enumerations + +2 0 Enable +2 1 Disable + +4 0 Fallback +4 1 Normal + +6 0 Emergency +6 1 Alert +6 2 Critical +6 3 Error +6 4 Warning +6 5 Notice +6 6 Info +6 7 Debug +6 8 Spew + +checksums + +checksum 408 431 984 diff --git a/src/mainboard/novacustom/mtl-h/data.vbt b/src/mainboard/novacustom/mtl-h/data.vbt new file mode 100644 index 0000000000000000000000000000000000000000..59c3c783a59dbc11cd961b3de3b40557542db287 GIT binary patch literal 7680 zcmeHMUu;uV82`?_ybZzn(y9o z&i9?)`M&S`x!=9rGt@T7dpZX@d;7Zs$2z&7DCu;#;yYX)q_$x1z;H)kFfiQK-P?YQ z-=*!ez2eW?L{Y|ex_r9s3!a~fjd}ZPc+dFA=vb_wBX;4C>^X*yO3H zSdC;Qg@+vB|e%(fVSi07{a>#)z1cN|J}unla0IoJ(Wz)~-*jOs&4`G6_tyVpT>&%Fv5Q$;-qP@ZY$a;Qudg(9nx#F#wO z&SA|rXUXlRGrNQ>M8#`p5yquK0$Uhtsa;O1l~{fxX(C6B)6EEl-E<9VW$3nzNW(2j z@fOW@1k55XUUKLvjY{tA2@{4Mx<@GszB z!M}sIL@}r$R?d^S0#~6_Ds|m?gEBiKm0I&+vzASSI)|N{FJ;$JzCG5{yQSW;PO0@23hn>X z2zaX~r8ed`zmTSEW9^U@S5{bj>+|y2=a_V1hlLfFyst7h?pn!SoQOYciJN@oMYkhT zW%aIXn!(vG$}X;km5mV+C7gWW3hs@Iry~dm@*D?(IGZ*`i0&jKK-IcuuE|31G|i|o z0RVzVHi6KJ-LSqFdM(ZOk#6V{>CFlo&{3edrnU0C5TA658ZRQr~MZ72Opay@9KeCWCo+H4-{ z;c87{xo@^g4_(=jK~U*AQAQ;5LC|ZBrO0el_w>m%AZ<{wm;}OOu1Ul}6`7xZPVtuXG$_uITFS3Jr%&osW$jKXoql3{)%!pX@c2dd0`=N0-PRUU(u`lK~ld zY7QxivJIRek+wcAhtOA?Nsr57^*Qb%G(D2`jnHph&#Aa}=$pt-Xc(>-R=^tXoFxZ^BVz;$)DAGcO$~!^DaSUXNN^$>ATZ?rLJRd-S{?FOS3CR`Nq#zGC8D7&#leLbU(+ z6}HN(-(2b6FJ)&Yw`7;peACJba%G#mcJO_h9p^!T3K1wopb&xoCIT&=DHZhk2vJ-y z@wyYC751Y1jw{Sbf{jmzxJt}RaSB71S#SJOcIz$_YzFht9KL{5<3-Dk24I0#KF9YB zZJy~g0UaIvtg|kemQ8D%xgjgJxpQRZ&y1$E6&9v>$f|Q>%hL)Oc3m+r`l8LBBfHbX zXh>UNU1Y+RO2|awWZCl5G9%NTz+X-rn3WkjlaQMy6^a*GvPIi&_-=i=7BX9cQ9@g0 zA-Y1dY85c8oJ`1se};XDJk$qSRA_^(n5`F=B;nLE6`?)z+cR~cnSaj literal 0 HcmV?d00001 diff --git a/src/mainboard/novacustom/mtl-h/devicetree.cb b/src/mainboard/novacustom/mtl-h/devicetree.cb new file mode 100644 index 0000000000..663d6940dc --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/devicetree.cb @@ -0,0 +1,316 @@ +chip soc/intel/meteorlake + # Common SoC configuration + register "common_soc_config" = "{ + // Touchpad I2C bus + .i2c[0] = { + .speed = I2C_SPEED_FAST, + .rise_time_ns = 80, + .fall_time_ns = 110, + }, + }" + + # Enable Enhanced Intel SpeedStep + register "eist_enable" = "1" + + # Enable S0ix / Modern Standby + register "s0ix_enable" = "1" + + # SaGv configuration + register "sagv" = "SAGV_ENABLED" + + # Disable C1 and Package C-state auto-demotion + register "disable_c1_state_auto_demotion" = "1" + register "disable_package_c_state_demotion" = "1" + + # Enable Energy Reporting + register "pch_pm_energy_report_enable" = "1" + + # Thermal + register "tcc_offset" = "10" # TCC of 100C + + register "usb2_ports" = "{ + [0] = USB2_PORT_LONG(OC_SKIP), /* USB Type-A Port 1 (Left) */ + [1] = USB2_PORT_TYPE_C(OC_SKIP), /* USB Type-C Port 1 (Non-TBT) */ + [2] = USB2_PORT_MID(OC_SKIP), /* USB Type-A Port 2 (Right) */ + [5] = USB2_PORT_TYPE_C(OC_SKIP), /* USB Type-C Port 2 (TBT) */ + [6] = USB2_PORT_LONG(OC_SKIP), /* Integrated Camera */ + [9] = USB2_PORT_MID(OC_SKIP), /* Bluetooth on M.2 2230 */ + }" + + register "usb3_ports" = "{ + [0] = USB3_PORT_DEFAULT(OC_SKIP), /* USB Type-A Port 1 (Left) */ + [1] = USB3_PORT_DEFAULT(OC_SKIP), /* USB Type-A Port 2 (Right) */ + }" + + register "tcss_ports" = "{ + [0] = TCSS_PORT_DEFAULT(OC_SKIP), /* USB Type-C Port 1 (TBT) */ + [1] = TCSS_PORT_DEFAULT(OC_SKIP), /* USB Type-C Port 2 (Non-TBT) */ + }" + + device cpu_cluster 0 on end + device domain 0 on + subsystemid 0x1558 0xa743 inherit + device ref system_agent on end + device ref igpu on + register "ddi_port_A_config" = "1" + register "ddi_ports_config" = "{ + [DDI_PORT_A] = DDI_ENABLE_HPD, /* eDP */ + [DDI_PORT_2] = DDI_ENABLE_DDC | DDI_ENABLE_HPD, /* HDMI 2.1 */ + }" + chip drivers/gfx/generic + register "device_count" = "6" + # DDIA for eDP + register "device[0].name" = ""LCD0"" + register "device[0].type" = "panel" + # DDIB unused + register "device[1].name" = ""DD01"" + # TCP0 for Thunderbolt 4 + register "device[2].name" = ""DD02"" + register "device[2].use_pld" = "true" + register "device[2].pld" = "ACPI_PLD_TYPE_C(RIGHT, CENTER, ACPI_PLD_GROUP(1, 1))" + # TCP1 unused + register "device[3].name" = ""DD03"" + # TCP2 for HDMI 2.1 + register "device[4].name" = ""DD04"" + # TCP3 unused + register "device[5].name" = ""DD05"" + device generic 0 on end + end + end + device ref dtt on end + device ref pcie_rp10 on # M.2 2280 #2 + register "pcie_rp[PCH_RP(10)]" = "{ + .clk_src = 8, + .clk_req = 8, + .flags = PCIE_RP_LTR | PCIE_RP_AER | PCIE_RP_CLK_REQ_DETECT, + }" + chip soc/intel/common/block/pcie/rtd3 + register "is_storage" = "true" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D01)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A13)" + register "srcclk_pin" = "8" + device generic 0 on end + end + smbios_slot_desc "SlotTypeM2Socket3" "SlotLengthOther" "M.2/M 2280 (J_SSD2)" "SlotDataBusWidth4X" + end + device ref pcie_rp11 on # M.2 2280 #1 + register "pcie_rp[PCH_RP(11)]" = "{ + .clk_src = 7, + .clk_req = 7, + .flags = PCIE_RP_LTR | PCIE_RP_AER | PCIE_RP_CLK_REQ_DETECT, + }" + chip soc/intel/common/block/pcie/rtd3 + register "is_storage" = "true" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D05)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D02)" + register "srcclk_pin" = "7" + device generic 0 on end + end + smbios_slot_desc "SlotTypeM2Socket3" "SlotLengthOther" "M.2/M 2280 (J_SSD1)" "SlotDataBusWidth4X" + end + device ref tbt_pcie_rp0 on end + device ref gna on end + device ref crashlog on end + device ref vpu on end + device ref tcss_xhci on + chip drivers/usb/acpi + device ref tcss_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port 1 (TBT)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, CENTER, ACPI_PLD_GROUP(1, 1))" + device ref tcss_usb3_port0 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port 2"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, LEFT, ACPI_PLD_GROUP(1, 2))" + device ref tcss_usb3_port1 on end + end + end + end + end + device ref tcss_dma0 on + chip drivers/intel/usb4/retimer + register "dfp[0].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)" + use tcss_usb3_port0 as dfp[0].typec_port + device generic 0 on end + end + end + device ref ioe_shared_sram on end + device ref xhci on + chip drivers/usb/acpi + device ref xhci_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Left"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(LEFT, CENTER, ACPI_PLD_GROUP(2, 1))" + device ref usb2_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port 2"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, LEFT, ACPI_PLD_GROUP(1, 2))" + device ref usb2_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Right"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, RIGHT, ACPI_PLD_GROUP(1, 3))" + device ref usb2_port3 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port 1 (TBT)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, CENTER, ACPI_PLD_GROUP(1, 2))" + device ref usb2_port6 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Camera"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port7 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port10 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Left"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(LEFT, CENTER, ACPI_PLD_GROUP(2, 1))" + device ref usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Right"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(RIGHT, RIGHT, ACPI_PLD_GROUP(1, 3))" + device ref usb3_port2 on end + end + end + end + end + device ref pmc_shared_sram on end + device ref cnvi_wifi on + register "cnvi_wifi_core" = "true" + register "cnvi_bt_core" = "true" + register "cnvi_bt_audio_offload" = "true" + chip drivers/wifi/generic + register "wake" = "GPE0_PME_B0" + register "add_acpi_dma_property" = "true" + register "enable_cnvi_ddr_rfim" = "true" + device generic 0 on end + end + end + device ref i2c0 on # Touchpad + register "serial_io_i2c_mode[PchSerialIoIndexI2C0]" = "PchSerialIoPci" + chip drivers/i2c/hid + register "generic.hid" = ""ELAN0412"" + register "generic.desc" = ""ELAN Touchpad"" + register "generic.irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPP_B00)" + register "generic.detect" = "1" + register "hid_desc_reg_offset" = "0x01" + device i2c 15 on end + end + chip drivers/i2c/hid + register "generic.hid" = ""FTCS1000"" + register "generic.desc" = ""FocalTech Touchpad"" + register "generic.irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPP_B00)" + register "generic.detect" = "1" + register "hid_desc_reg_offset" = "0x01" + device i2c 38 on end + end + end + device ref i2c1 on # USB-PD EEPROM + register "serial_io_i2c_mode[PchSerialIoIndexI2C1]" = "PchSerialIoPci" + end + device ref i2c3 on # Pantone ROM + register "serial_io_i2c_mode[PchSerialIoIndexI2C3]" = "PchSerialIoPci" + end + device ref pcie_rp5 on # GLAN + register "pcie_rp[PCH_RP(5)]" = "{ + .clk_src = 2, + .clk_req = 2, + .flags = PCIE_RP_LTR | PCIE_RP_CLK_SRC_UNUSED, + }" + register "pcie_clk_config_flag[2]" = "PCIE_CLK_LAN" + end + device ref pcie_rp6 on # SD Card Reader + register "pcie_rp[PCH_RP(6)]" = "{ + .clk_src = 3, + .clk_req = 3, + .flags = PCIE_RP_LTR | PCIE_RP_AER, + }" + chip drivers/generic/bayhub_lv2 + register "enable_power_saving" = "1" + device pci 00.0 on end + end + end + device ref pcie_rp8 on # M.2 2230 + register "pcie_rp[PCH_RP(8)]" = "{ + .clk_src = 5, + .clk_req = 5, + .flags = PCIE_RP_LTR | PCIE_RP_AER, + }" + chip drivers/wifi/generic + register "wake" = "GPE0_DW2_09" + register "add_acpi_dma_property" = "true" + device pci 00.0 on end + end + smbios_slot_desc "SlotTypeM2Socket1_SD" "SlotLengthOther" "M.2/E 2230 (J_WLAN1)" "SlotDataBusWidth1X" + end + device ref uart0 on # BIOS Debug Port + register "serial_io_uart_mode[PchSerialIoIndexUART0]" = "PchSerialIoPci" + end + device ref soc_espi on + register "gen1_dec" = "0x00040069" # EC PM channel + register "gen2_dec" = "0x00fc0e01" # AP/EC command + register "gen3_dec" = "0x00fc0f01" # AP/EC debug + chip drivers/pc80/tpm # SLB 9672 TPM 2.0 + device pnp 0c31.0 on end + end + end + device ref pmc hidden + register "pmc_gpe0_dw0" = "PMC_GPP_V" + register "pmc_gpe0_dw1" = "PMC_GPP_B" + register "pmc_gpe0_dw2" = "PMC_GPP_S" + chip drivers/intel/pmc_mux + device generic 0 on + chip drivers/intel/pmc_mux/conn + # USB Type-C Port 1 (TBT) + use usb2_port6 as usb2_port + use tcss_usb3_port0 as usb3_port + device generic 0 alias conn0 on end + end + chip drivers/intel/pmc_mux/conn + # USB Type-C Port 2 (Non-TBT) + use usb2_port2 as usb2_port + use tcss_usb3_port1 as usb3_port + device generic 1 alias conn1 on end + end + end + end + end + device ref hda on + subsystemid 0x1558 0xa763 + #register "pch_hda_audio_link_hda_enable" = "1" + register "pch_hda_sdi_enable[0]" = "1" + register "pch_hda_dsp_enable" = "1" + register "pch_hda_idisp_codec_enable" = "1" + register "pch_hda_idisp_link_frequency" = "HDA_LINKFREQ_96MHZ" + register "pch_hda_idisp_link_tmode" = "HDA_TMODE_8T" + + end + device ref smbus on end + device ref fast_spi on end + device ref gbe on end + end +end diff --git a/src/mainboard/novacustom/mtl-h/dsdt.asl b/src/mainboard/novacustom/mtl-h/dsdt.asl new file mode 100644 index 0000000000..06e7263d07 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/dsdt.asl @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +DefinitionBlock( + "dsdt.aml", + "DSDT", + ACPI_DSDT_REV_2, + OEM_ID, + ACPI_TABLE_CREATOR, + 0x20110725 +) +{ + #include + #include + #include + #include + + Device (\_SB.PCI0) + { + #include + #include + #include + } + + /* Chipset specific sleep states */ + #include + + Scope (\_SB.PCI0.LPCB) + { + #include + } + + #include "acpi/mainboard.asl" +} diff --git a/src/mainboard/novacustom/mtl-h/fadt.c b/src/mainboard/novacustom/mtl-h/fadt.c new file mode 100644 index 0000000000..f983717e09 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/fadt.c @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +void mainboard_fill_fadt(acpi_fadt_t *fadt) +{ + fadt->preferred_pm_profile = PM_MOBILE; +} diff --git a/src/mainboard/novacustom/mtl-h/gpio.c b/src/mainboard/novacustom/mtl-h/gpio.c new file mode 100644 index 0000000000..f52b044a9e --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/gpio.c @@ -0,0 +1,574 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* Pad configuration was generated automatically using intelp2m utility */ +static const struct pad_config gpio_table[] = { + + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group V ------- */ + + /* GPP_V00 - BATLOW# */ + PAD_CFG_NF(GPP_V00, UP_20K, DEEP, NF1), + /* GPP_V01 - ACPRESENT */ + PAD_CFG_NF(GPP_V01, NATIVE, DEEP, NF1), + /* GPP_V02 - SOC_WAKE# */ + PAD_CFG_NF(GPP_V02, NATIVE, DEEP, NF1), + /* GPP_V03 - PWRBTN# */ + PAD_CFG_NF(GPP_V03, UP_20K, DEEP, NF1), + /* GPP_V04 - SLP_S3# */ + PAD_CFG_NF(GPP_V04, NONE, DEEP, NF1), + /* GPP_V05 - SLP_S4# */ + PAD_CFG_NF(GPP_V05, NONE, DEEP, NF1), + /* GPP_V06 - SLP_A# */ + PAD_CFG_NF(GPP_V06, NONE, DEEP, NF1), + /* GPP_V07 - GPIO */ + PAD_CFG_GPO(GPP_V07, 0, DEEP), + /* GPP_V08 - SUSCLK */ + PAD_CFG_NF(GPP_V08, NONE, DEEP, NF1), + /* GPP_V09 - SLP_WLAN# */ + PAD_CFG_NF(GPP_V09, NONE, DEEP, NF1), + /* GPP_V10 - SLP_S5# */ + PAD_CFG_NF(GPP_V10, NONE, DEEP, NF1), + /* GPP_V11 - LANPHYPC */ + PAD_CFG_NF(GPP_V11, NONE, DEEP, NF1), + /* GPP_V12 - SLP_LAN# */ + PAD_CFG_NF(GPP_V12, NONE, DEEP, NF1), + /* GPP_V13 - GPIO */ + PAD_CFG_GPO(GPP_V13, 0, DEEP), + /* GPP_V14 - WAKE# */ + PAD_CFG_NF(GPP_V14, NONE, DEEP, NF1), + /* GPP_V15 - GPIO */ + PAD_CFG_GPO(GPP_V15, 0, DEEP), + /* GPP_V16 - GPIO */ + PAD_CFG_GPO(GPP_V16, 0, DEEP), + /* GPP_V17 - GPIO */ + PAD_CFG_GPO(GPP_V17, 0, DEEP), + /* GPP_V18 - GPIO */ + PAD_CFG_GPO(GPP_V18, 0, DEEP), + /* GPP_V19 - n/a */ + PAD_CFG_NF(GPP_V19, NONE, DEEP, NF1), + /* GPP_V20 - n/a */ + PAD_CFG_NF(GPP_V20, NONE, DEEP, NF1), + /* GPP_V21 - n/a */ + PAD_CFG_NF(GPP_V21, NONE, DEEP, NF1), + /* GPP_V22 - GPIO */ + PAD_CFG_GPO(GPP_V22, 0, DEEP), + /* GPP_V23 - GPIO */ + PAD_CFG_GPO(GPP_V23, 0, DEEP), + + /* ------- GPIO Group GPP_C ------- */ + + /* GPP_C00 - SMBCLK */ + PAD_CFG_NF(GPP_C00, UP_20K, DEEP, NF1), + /* GPP_C01 - SMBDATA */ + PAD_CFG_NF(GPP_C01, UP_20K, DEEP, NF1), + /* GPP_C02 - GPIO */ + PAD_CFG_GPO(GPP_C02, 0, DEEP), + /* GPP_C03 - SML0CLK */ + PAD_CFG_NF(GPP_C03, NONE, DEEP, NF1), + /* GPP_C04 - SML0DATA */ + PAD_CFG_NF(GPP_C04, NONE, DEEP, NF1), + /* GPP_C05 - GPIO */ + PAD_CFG_GPO(GPP_C05, 0, DEEP), + /* GPP_C06 - SML1CLK */ + PAD_CFG_NF(GPP_C06, NONE, RSMRST, NF1), + /* GPP_C07 - SML1DATA */ + PAD_CFG_NF(GPP_C07, NONE, RSMRST, NF1), + /* GPP_C08 - GPIO */ + PAD_CFG_GPO(GPP_C08, 0, DEEP), + /* GPP_C09 - GPIO */ + PAD_CFG_GPO(GPP_C09, 0, DEEP), + /* GPP_C10 - GPIO */ + PAD_CFG_GPO(GPP_C10, 0, DEEP), + /* GPP_C11 - SRCCLKREQ2# */ + PAD_CFG_NF(GPP_C11, NONE, DEEP, NF1), + /* GPP_C12 - SRCCLKREQ3# */ + PAD_CFG_NF(GPP_C12, NONE, DEEP, NF1), + /* GPP_C13 - GPIO */ + PAD_CFG_GPO(GPP_C13, 0, DEEP), + /* GPP_C14 - GPIO */ + PAD_CFG_GPO(GPP_C14, 0, DEEP), + /* GPP_C15 - GPIO */ + PAD_CFG_GPO(GPP_C15, 0, DEEP), + /* GPP_C16 - TBT_LSX0_TXD */ + PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1), + /* GPP_C17 - TBT_LSX0_RXD */ + PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1), + /* GPP_C18 - GPIO */ + PAD_CFG_GPO(GPP_C18, 0, DEEP), + /* GPP_C19 - GPIO */ + PAD_CFG_GPO(GPP_C19, 0, DEEP), + /* GPP_C20 - DDP2_CTRLCLK */ + PAD_CFG_NF(GPP_C20, NONE, DEEP, NF2), + /* GPP_C21 - DDP2_CTRLDATA */ + PAD_CFG_NF(GPP_C21, NONE, DEEP, NF2), + /* GPP_C22 - GPIO */ + PAD_CFG_GPO(GPP_C22, 0, DEEP), + /* GPP_C23 - GPIO */ + PAD_CFG_GPO(GPP_C23, 0, DEEP), + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + + /* GPP_A00 - ESPI_IO0 */ + PAD_CFG_NF(GPP_A00, UP_20K, DEEP, NF1), + /* GPP_A01 - ESPI_IO1 */ + PAD_CFG_NF(GPP_A01, UP_20K, DEEP, NF1), + /* GPP_A02 - ESPI_IO2 */ + PAD_CFG_NF(GPP_A02, UP_20K, DEEP, NF1), + /* GPP_A03 - ESPI_IO3 */ + PAD_CFG_NF(GPP_A03, UP_20K, DEEP, NF1), + /* GPP_A04 - ESPI_CS0# */ + PAD_CFG_NF(GPP_A04, UP_20K, DEEP, NF1), + /* GPP_A05 - ESPI_CLK */ + PAD_CFG_NF(GPP_A05, UP_20K, DEEP, NF1), + /* GPP_A06 - ESPI_RESET# */ + PAD_CFG_NF(GPP_A06, NONE, DEEP, NF1), + /* GPP_A07 - GPIO */ + PAD_CFG_GPO(GPP_A07, 0, DEEP), + /* GPP_A08 - GPIO */ + PAD_CFG_GPO(GPP_A08, 0, DEEP), + /* GPP_A09 - GPIO */ + PAD_CFG_GPO(GPP_A09, 0, DEEP), + /* GPP_A10 - GPIO */ + PAD_CFG_GPO(GPP_A10, 0, DEEP), + /* GPP_A11 - GPIO */ + PAD_CFG_GPO(GPP_A11, 0, DEEP), + /* GPP_A12 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_A12, NONE, DEEP, OFF, ACPI), + /* GPP_A13 - GPIO */ + PAD_CFG_TERM_GPO(GPP_A13, 1, UP_20K, PLTRST), + /* GPP_A14 - GPIO */ + PAD_CFG_GPO(GPP_A14, 0, DEEP), + /* GPP_A15 - GPIO */ + PAD_CFG_GPO(GPP_A15, 0, DEEP), + /* GPP_A16 - RSVD */ + PAD_CFG_NF(GPP_A16, UP_20K, DEEP, NF1), + /* GPP_A17 - GPIO */ + PAD_CFG_GPO(GPP_A17, 0, DEEP), + /* GPP_A18 - GPIO */ + PAD_CFG_GPO(GPP_A18, 0, DEEP), + /* GPP_A19 - GPIO */ + PAD_CFG_GPO(GPP_A19, 0, DEEP), + /* GPP_A20 - GPIO */ + PAD_CFG_GPO(GPP_A20, 0, DEEP), + /* GPP_A21 - PMCALERT# */ + PAD_CFG_NF(GPP_A21, NATIVE, DEEP, NF1), + /* GPP_A22 - GPIO */ + PAD_NC(GPP_A22, NATIVE), + /* GPP_A23 - GPIO */ + PAD_NC(GPP_A23, NATIVE), + /* GPP_ESPI_CLK_LPBK - n/a */ + PAD_CFG_NF(GPP_ESPI_CLK_LPBK, NONE, DEEP, NF1), + + /* ------- GPIO Group GPP_E ------- */ + + /* GPP_E00 - GPIO */ + PAD_CFG_GPO(GPP_E00, 0, DEEP), + /* GPP_E01 - GPIO */ + PAD_CFG_GPI_APIC(GPP_E01, UP_20K, DEEP, LEVEL, NONE), + /* GPP_E02 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_E02, NONE, DEEP, OFF, ACPI), + /* GPP_E03 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_E03, NONE, DEEP, OFF, ACPI), + /* GPP_E04 - GPIO */ + PAD_CFG_GPO(GPP_E04, 0, DEEP), + /* GPP_E05 - GPIO */ + PAD_CFG_GPO(GPP_E05, 0, DEEP), + /* GPP_E06 - GPIO */ + PAD_CFG_GPO(GPP_E06, 0, DEEP), + /* GPP_E07 - GPIO */ + PAD_CFG_GPO(GPP_E07, 0, DEEP), + /* GPP_E08 - GPIO */ + PAD_CFG_GPO(GPP_E08, 0, DEEP), + /* GPP_E09 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_E09, NONE, DEEP, OFF, ACPI), + /* GPP_E10 - GPIO */ + PAD_CFG_GPO(GPP_E10, 0, DEEP), + /* GPP_E11 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_E11, NONE, DEEP, OFF, ACPI), + /* GPP_E12 - GPIO */ + PAD_CFG_GPO(GPP_E12, 0, DEEP), + /* GPP_E13 - GPIO */ + PAD_CFG_GPO(GPP_E13, 0, DEEP), + /* GPP_E14 - DDSP_HPDA */ + PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), + /* GPP_E15 - GPIO */ + PAD_CFG_GPO(GPP_E15, 0, DEEP), + /* GPP_E16 - VRALERT# */ + PAD_CFG_NF(GPP_E16, NONE, DEEP, NF2), + /* GPP_E17 - GPIO */ + PAD_CFG_GPO(GPP_E17, 0, DEEP), + /* GPP_E18 - GPIO */ + PAD_CFG_GPO(GPP_E18, 0, DEEP), + /* GPP_E19 - GPIO */ + PAD_CFG_GPO(GPP_E19, 0, DEEP), + /* GPP_E20 - GPIO */ + PAD_CFG_GPO(GPP_E20, 0, DEEP), + /* GPP_E21 - GPIO */ + PAD_CFG_GPO(GPP_E21, 0, DEEP), + /* GPP_E22 - GPIO */ + PAD_CFG_GPO(GPP_E22, 0, DEEP), + /* GPP_E23 - GPIO */ + PAD_NC(GPP_E23, NONE), + /* GPP_THC0_GSPI_CLK_LPBK - GPIO */ + PAD_NC(GPP_THC0_GSPI_CLK_LPBK, NONE), + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_H ------- */ + + /* GPP_H00 - GPIO */ + PAD_CFG_GPO(GPP_H00, 0, DEEP), + /* GPP_H01 - GPIO */ + PAD_CFG_GPO(GPP_H01, 0, DEEP), + /* GPP_H02 - GPIO */ + PAD_CFG_GPO(GPP_H02, 0, DEEP), + /* GPP_H03 - GPIO */ + PAD_CFG_GPO(GPP_H03, 0, DEEP), + /* GPP_H04 - GPIO */ + PAD_CFG_GPO(GPP_H04, 0, DEEP), + /* GPP_H05 - GPIO */ + PAD_CFG_GPO(GPP_H05, 0, DEEP), + /* GPP_H06 - I2C3_SDA */ + PAD_CFG_NF(GPP_H06, NONE, DEEP, NF1), + /* GPP_H07 - I2C3_SCL */ + PAD_CFG_NF(GPP_H07, NONE, DEEP, NF1), + /* GPP_H08 - GPIO */ + PAD_CFG_GPO(GPP_H08, 0, DEEP), + /* GPP_H09 - GPIO */ + PAD_CFG_GPO(GPP_H09, 0, DEEP), + /* GPP_H10 - GPIO */ + PAD_CFG_GPO(GPP_H10, 0, DEEP), + /* GPP_H11 - GPIO */ + PAD_CFG_GPO(GPP_H11, 0, DEEP), + /* GPP_H12 - GPIO */ + PAD_CFG_GPO(GPP_H12, 0, DEEP), + /* GPP_H13 - PROC_C10_GATE# */ + PAD_CFG_NF(GPP_H13, NONE, DEEP, NF1), + /* GPP_H14 - GPIO */ + PAD_CFG_GPO(GPP_H14, 0, DEEP), + /* GPP_H15 - GPIO */ + PAD_CFG_GPO(GPP_H15, 0, DEEP), + /* GPP_H16 - GPIO */ + PAD_CFG_GPO(GPP_H16, 0, DEEP), + /* GPP_H17 - GPIO */ + PAD_CFG_GPO(GPP_H17, 0, DEEP), + /* GPP_H18 - GPIO */ + PAD_CFG_GPO(GPP_H18, 0, DEEP), + /* GPP_H19 - I2C0_SDA */ + PAD_CFG_NF(GPP_H19, NONE, DEEP, NF1), + /* GPP_H20 - I2C0_SCL */ + PAD_CFG_NF(GPP_H20, NONE, DEEP, NF1), + /* GPP_H21 - I2C1_SDA */ + PAD_CFG_NF(GPP_H21, NONE, DEEP, NF1), + /* GPP_H22 - I2C1_SCL */ + PAD_CFG_NF(GPP_H22, NONE, DEEP, NF1), + /* GPP_H23 - GPIO */ + PAD_NC(GPP_H23, NONE), + /* GPP_LPI3C1_CLK_LPBK - GPIO */ + PAD_NC(GPP_LPI3C1_CLK_LPBK, NATIVE), + /* GPP_LPI3C0_CLK_LPBK - n/a */ + PAD_CFG_NF(GPP_LPI3C0_CLK_LPBK, NATIVE, DEEP, NF2), + + /* ------- GPIO Group GPP_F ------- */ + + /* GPP_F00 - CNV_BRI_DT */ + PAD_CFG_NF(GPP_F00, NONE, DEEP, NF1), + /* GPP_F01 - CNV_BRI_RSP */ + PAD_CFG_NF(GPP_F01, UP_20K, DEEP, NF1), + /* GPP_F02 - CNV_RGI_DT */ + PAD_CFG_NF(GPP_F02, NONE, DEEP, NF1), + /* GPP_F03 - CNV_RGI_RSP */ + PAD_CFG_NF(GPP_F03, UP_20K, DEEP, NF1), + /* GPP_F04 - CNV_RF_RESET# */ + PAD_CFG_NF(GPP_F04, NONE, DEEP, NF1), + /* GPP_F05 - MODEM_CLKREQ */ + PAD_CFG_NF(GPP_F05, NONE, DEEP, NF3), + /* GPP_F06 - GPIO */ + PAD_CFG_GPO(GPP_F06, 0, DEEP), + /* GPP_F07 - GPIO */ + PAD_CFG_GPO(GPP_F07, 0, DEEP), + /* GPP_F08 - GPIO */ + PAD_CFG_GPO(GPP_F08, 0, DEEP), + /* GPP_F09 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_F09, NONE, DEEP, OFF, ACPI), + /* GPP_F10 - GPIO */ + PAD_CFG_GPO(GPP_F10, 0, DEEP), + /* GPP_F11 - GPIO */ + PAD_CFG_GPO(GPP_F11, 0, DEEP), + /* GPP_F12 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_F12, NONE, DEEP, OFF, ACPI), + /* GPP_F13 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_F13, NONE, DEEP, OFF, ACPI), + /* GPP_F14 - GPIO */ + PAD_CFG_GPO(GPP_F14, 0, DEEP), + /* GPP_F15 - GPIO */ + PAD_CFG_GPO(GPP_F15, 0, DEEP), + /* GPP_F16 - GPIO */ + PAD_CFG_GPO(GPP_F16, 0, DEEP), + /* GPP_F17 - GPIO */ + PAD_CFG_GPO(GPP_F17, 0, DEEP), + /* GPP_F18 - GPIO */ + PAD_CFG_GPO(GPP_F18, 0, DEEP), + /* GPP_F19 - GPIO */ + PAD_CFG_GPO(GPP_F19, 0, DEEP), + /* GPP_F20 - GPIO */ + PAD_CFG_GPO(GPP_F20, 0, DEEP), + /* GPP_F21 - GPIO */ + PAD_CFG_GPO(GPP_F21, 0, DEEP), + /* GPP_F22 - GPIO */ + PAD_CFG_GPO(GPP_F22, 0, DEEP), + /* GPP_F23 - GPIO */ + PAD_CFG_GPO(GPP_F23, 0, DEEP), + /* GPP_THC1_GSPI1_CLK_LPBK - GPIO */ + PAD_NC(GPP_THC1_GSPI1_CLK_LPBK, NONE), + /* GPP_GSPI0A_CLK_LOOPBK - GPIO */ + PAD_NC(GPP_GSPI0A_CLK_LOOPBK, NONE), + + /* ------- GPIO Group SPI ------- */ + + /* ------- GPIO Group VGPIO3 ------- */ + + /* GPP_VGPIO3_USB0 - GPP_VGPIO3_USB0 */ + PAD_CFG_NF(GPP_VGPIO3_USB0, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB1 - GPP_VGPIO3_USB1 */ + PAD_CFG_NF(GPP_VGPIO3_USB1, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB2 - GPP_VGPIO3_USB2 */ + PAD_CFG_NF(GPP_VGPIO3_USB2, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB3 - GPP_VGPIO3_USB3 */ + PAD_CFG_NF(GPP_VGPIO3_USB3, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB4 - GPP_VGPIO3_USB4 */ + PAD_CFG_NF(GPP_VGPIO3_USB4, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB5 - GPP_VGPIO3_USB5 */ + PAD_CFG_NF(GPP_VGPIO3_USB5, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB6 - GPP_VGPIO3_USB6 */ + PAD_CFG_NF(GPP_VGPIO3_USB6, NONE, DEEP, NF1), + /* GPP_VGPIO3_USB7 - GPP_VGPIO3_USB7 */ + PAD_CFG_NF(GPP_VGPIO3_USB7, NONE, DEEP, NF1), + /* GPP_VGPIO3_TS0 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO3_TS0, NONE, DEEP, OFF, ACPI), + /* GPP_VGPIO3_TS1 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO3_TS1, NONE, DEEP, OFF, ACPI), + /* GPP_VGPIO3_THC0 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO3_THC0, NONE, DEEP, OFF, ACPI), + /* GPP_VGPIO3_THC1 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO3_THC1, NONE, DEEP, OFF, ACPI), + /* GPP_VGPIO3_THC2 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO3_THC2, NONE, DEEP, OFF, ACPI), + /* GPP_VGPIO3_THC3 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO3_THC3, NONE, DEEP, OFF, ACPI), + + /* ------- GPIO Community 4 ------- */ + + /* ------- GPIO Group GPP_S ------- */ + + /* GPP_S00 - GPIO */ + PAD_CFG_GPO(GPP_S00, 0, DEEP), + /* GPP_S01 - GPIO */ + PAD_CFG_GPO(GPP_S01, 0, DEEP), + /* GPP_S02 - GPIO */ + PAD_CFG_GPO(GPP_S02, 0, DEEP), + /* GPP_S03 - GPIO */ + PAD_CFG_GPO(GPP_S03, 0, DEEP), + /* GPP_S04 - GPIO */ + PAD_CFG_GPO(GPP_S04, 0, DEEP), + /* GPP_S05 - GPIO */ + PAD_CFG_GPO(GPP_S05, 0, DEEP), + /* GPP_S06 - GPIO */ + PAD_CFG_GPO(GPP_S06, 0, DEEP), + /* GPP_S07 - GPIO */ + PAD_CFG_GPO(GPP_S07, 0, DEEP), + + /* ------- GPIO Group JTAG ------- */ + + /* ------- GPIO Community 5 ------- */ + + /* ------- GPIO Group GPP_B ------- */ + + /* GPP_B00 - GPIO */ + PAD_CFG_GPI_INT(GPP_B00, NONE, PLTRST, LEVEL), + /* GPP_B01 - GPIO */ + PAD_CFG_GPO(GPP_B01, 0, DEEP), + /* GPP_B02 - GPIO */ + PAD_CFG_GPO(GPP_B02, 0, DEEP), + /* GPP_B03 - GPIO */ + PAD_CFG_GPO(GPP_B03, 0, DEEP), + /* GPP_B04 - GPIO */ + PAD_CFG_GPO(GPP_B04, 0, DEEP), + /* GPP_B05 - GPIO */ + PAD_CFG_GPO(GPP_B05, 0, DEEP), + /* GPP_B06 - GPIO */ + PAD_CFG_GPO(GPP_B06, 0, DEEP), + /* GPP_B07 - GPIO */ + PAD_CFG_GPO(GPP_B07, 0, DEEP), + /* GPP_B08 - GPIO */ + PAD_CFG_GPO(GPP_B08, 0, DEEP), + /* GPP_B09 - GPIO */ + PAD_CFG_GPO(GPP_B09, 0, DEEP), + /* GPP_B10 - GPIO */ + PAD_CFG_GPO(GPP_B10, 0, DEEP), + /* GPP_B11 - DDSP_HPD2 */ + PAD_CFG_NF(GPP_B11, NONE, DEEP, NF2), + /* GPP_B12 - SLP_S0# */ + PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1), + /* GPP_B13 - PLTRST# */ + PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), + /* GPP_B14 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_B14, NONE, DEEP, OFF, ACPI), + /* GPP_B15 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_B15, NONE, DEEP, OFF, ACPI), + /* GPP_B16 - GPIO */ + PAD_CFG_GPO(GPP_B16, 0, DEEP), + /* GPP_B17 - GPIO */ + PAD_CFG_GPO(GPP_B17, 0, DEEP), + /* GPP_B18 - GPIO */ + PAD_CFG_GPO(GPP_B18, 1, DEEP), + /* GPP_B19 - GPIO */ + PAD_CFG_GPO(GPP_B19, 1, DEEP), + /* GPP_B20 - GPIO */ + PAD_CFG_GPO(GPP_B20, 0, DEEP), + /* GPP_B21 - GPIO */ + PAD_CFG_GPO(GPP_B21, 0, PLTRST), + /* GPP_B22 - GPIO */ + PAD_CFG_GPO(GPP_B22, 0, DEEP), + /* GPP_B23 - GPIO */ + PAD_CFG_GPO(GPP_B23, 0, DEEP), + /* GPP_ACI3C0_CLK_LPBK - n/a */ + PAD_CFG_NF(GPP_ACI3C0_CLK_LPBK, NATIVE, DEEP, NF4), + + /* ------- GPIO Group GPP_D ------- */ + + /* GPP_D00 - GPIO */ + PAD_CFG_GPO(GPP_D00, 1, DEEP), + /* GPP_D01 - GPIO */ + PAD_CFG_GPO(GPP_D01, 1, DEEP), + /* GPP_D02 - GPIO */ + PAD_CFG_GPO(GPP_D02, 1, DEEP), + /* GPP_D03 - GPIO */ + PAD_CFG_GPO(GPP_D03, 0, DEEP), + /* GPP_D04 - GPIO */ + PAD_CFG_GPO(GPP_D04, 0, DEEP), + /* GPP_D05 - GPIO */ + PAD_CFG_GPO(GPP_D05, 1, DEEP), + /* GPP_D06 - GPIO */ + PAD_CFG_GPO(GPP_D06, 0, DEEP), + /* GPP_D07 - GPIO */ + PAD_CFG_GPO(GPP_D07, 0, DEEP), + /* GPP_D08 - GPIO */ + PAD_CFG_GPO(GPP_D08, 0, DEEP), + /* GPP_D09 - GPIO */ + PAD_CFG_GPO(GPP_D09, 0, DEEP), + /* GPP_D10 - HDA_BCLK */ + PAD_CFG_NF(GPP_D10, NONE, DEEP, NF1), + /* GPP_D11 - HDA_SYNC */ + PAD_CFG_NF(GPP_D11, NATIVE, DEEP, NF1), + /* GPP_D12 - HDA_SDO */ + PAD_CFG_NF(GPP_D12, NATIVE, DEEP, NF1), + /* GPP_D13 - HDA_SDI0 */ + PAD_CFG_NF(GPP_D13, NATIVE, DEEP, NF1), + /* GPP_D14 - GPIO */ + PAD_CFG_GPO(GPP_D14, 0, DEEP), + /* GPP_D15 - GPIO */ + PAD_CFG_GPO(GPP_D15, 0, DEEP), + /* GPP_D16 - GPIO */ + PAD_CFG_GPO(GPP_D16, 0, DEEP), + /* GPP_D17 - HDA_RST# */ + PAD_CFG_NF(GPP_D17, NONE, DEEP, NF1), + /* GPP_D18 - SRCCLKREQ6# */ + PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), + /* GPP_D19 - SRCCLKREQ7# */ + PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1), + /* GPP_D20 - SRCCLKREQ8# */ + PAD_CFG_NF(GPP_D20, NONE, DEEP, NF1), + /* GPP_D21 - SRCCLKREQ5# */ + PAD_CFG_NF(GPP_D21, NONE, DEEP, NF2), + /* GPP_D22 - n/a */ + PAD_CFG_NF(GPP_D22, NATIVE, DEEP, NF1), + /* GPP_D23 - n/a */ + PAD_CFG_NF(GPP_D23, NATIVE, DEEP, NF1), + /* GPP_BOOTHALT_B - n/a */ + PAD_CFG_NF(GPP_BOOTHALT_B, UP_20K, DEEP, NF1), + + /* ------- GPIO Group VGPIO ------- */ + + /* VGPIO00 - GPIO */ + PAD_CFG_GPO(GPP_VGPIO00, 1, DEEP), + /* VGPIO04 - GPIO */ + PAD_CFG_GPI_TRIG_OWN(GPP_VGPIO04, NONE, DEEP, OFF, ACPI), + /* VGPIO05 - GPIO */ + PAD_CFG_GPO(GPP_VGPIO05, 1, DEEP), + /* VGPIO06 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO06, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO07 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO07, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO08 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO08, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO09 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO09, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO10 - VGPIO10 */ + PAD_CFG_NF(GPP_VGPIO10, NONE, DEEP, NF1), + /* VGPIO11 - VGPIO11 */ + PAD_CFG_NF(GPP_VGPIO11, NONE, DEEP, NF1), + /* VGPIO12 - VGPIO12 */ + PAD_CFG_NF(GPP_VGPIO12, NONE, DEEP, NF1), + /* VGPIO13 - VGPIO13 */ + PAD_CFG_NF(GPP_VGPIO13, NONE, DEEP, NF1), + /* VGPIO18 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO18, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO19 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO19, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO20 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO20, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO21 - GPIO */ + PAD_CFG_GPIO_BIDIRECT(GPP_VGPIO21, 0, NONE, DEEP, LEVEL, ACPI), + /* VGPIO22 - VGPIO22 */ + PAD_CFG_NF(GPP_VGPIO22, NONE, DEEP, NF1), + /* VGPIO23 - VGPIO23 */ + PAD_CFG_NF(GPP_VGPIO23, NONE, DEEP, NF1), + /* VGPIO24 - VGPIO24 */ + PAD_CFG_NF(GPP_VGPIO24, NONE, DEEP, NF1), + /* VGPIO25 - VGPIO25 */ + PAD_CFG_NF(GPP_VGPIO25, NONE, DEEP, NF1), + /* VGPIO30 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO30, NONE, DEEP, NF3), + /* VGPIO31 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO31, NONE, DEEP, NF3), + /* VGPIO32 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO32, NONE, DEEP, NF3), + /* VGPIO33 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO33, NONE, DEEP, NF3), + /* VGPIO34 - VGPIO34 */ + PAD_CFG_NF(GPP_VGPIO34, NONE, DEEP, NF1), + /* VGPIO35 - VGPIO35 */ + PAD_CFG_NF(GPP_VGPIO35, NONE, DEEP, NF1), + /* VGPIO36 - VGPIO36 */ + PAD_CFG_NF(GPP_VGPIO36, NONE, DEEP, NF1), + /* VGPIO37 - VGPIO37 */ + PAD_CFG_NF(GPP_VGPIO37, NONE, DEEP, NF1), + /* VGPIO40 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO40, NONE, DEEP, NF2), + /* VGPIO41 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO41, NONE, DEEP, NF2), + /* VGPIO42 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO42, NONE, DEEP, NF2), + /* VGPIO43 - RESERVED */ + PAD_CFG_NF(GPP_VGPIO43, NONE, DEEP, NF2), + /* VGPIO44 - VGPIO44 */ + PAD_CFG_NF(GPP_VGPIO44, NONE, DEEP, NF1), + /* VGPIO45 - VGPIO45 */ + PAD_CFG_NF(GPP_VGPIO45, NONE, DEEP, NF1), + /* VGPIO46 - VGPIO46 */ + PAD_CFG_NF(GPP_VGPIO46, NONE, DEEP, NF1), + /* VGPIO47 - VGPIO47 */ + PAD_CFG_NF(GPP_VGPIO47, NONE, DEEP, NF1), +}; + +void mainboard_configure_gpios(void) +{ + gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); +} diff --git a/src/mainboard/novacustom/mtl-h/gpio_early.c b/src/mainboard/novacustom/mtl-h/gpio_early.c new file mode 100644 index 0000000000..c47883e3d6 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/gpio_early.c @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +static const struct pad_config early_gpio_table[] = { + /* GPP_C00 - SMBCLK */ + PAD_CFG_NF(GPP_C00, UP_20K, DEEP, NF1), + /* GPP_C01 - SMBDATA */ + PAD_CFG_NF(GPP_C01, UP_20K, DEEP, NF1), +}; + +void mainboard_configure_early_gpios(void) +{ + gpio_configure_pads(early_gpio_table, ARRAY_SIZE(early_gpio_table)); +} diff --git a/src/mainboard/novacustom/mtl-h/hda_verb.c b/src/mainboard/novacustom/mtl-h/hda_verb.c new file mode 100644 index 0000000000..cd7493e6d3 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/hda_verb.c @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +const u32 cim_verb_data[] = { + /* Realtek, ALC245 */ + 0x10ec0245, /* Vendor ID */ + 0x1558a763, /* Subsystem ID */ + 13, /* Number of entries */ + AZALIA_SUBVENDOR(0, 0x1558a763), + AZALIA_RESET(1), + AZALIA_PIN_CFG(0, 0x12, 0x90a60130), + AZALIA_PIN_CFG(0, 0x13, 0x40000000), + AZALIA_PIN_CFG(0, 0x14, 0x90170110), + AZALIA_PIN_CFG(0, 0x17, 0x411111f0), + AZALIA_PIN_CFG(0, 0x18, 0x411111f0), + AZALIA_PIN_CFG(0, 0x19, 0x411111f0), + AZALIA_PIN_CFG(0, 0x1a, 0x411111f0), + AZALIA_PIN_CFG(0, 0x1b, 0x411111f0), + AZALIA_PIN_CFG(0, 0x1d, 0x40789b2d), + AZALIA_PIN_CFG(0, 0x1e, 0x411111f0), + AZALIA_PIN_CFG(0, 0x21, 0x04211020), + + /* Intel Meteor Lake HDMI */ + 0x8086281d, /* Vendor ID */ + 0x80860101, /* Subsystem ID */ + 10, /* Number of entries */ + AZALIA_SUBVENDOR(2, 0x80860101), + AZALIA_PIN_CFG(2, 0x04, 0x18560010), + AZALIA_PIN_CFG(2, 0x06, 0x18560010), + AZALIA_PIN_CFG(2, 0x08, 0x18560010), + AZALIA_PIN_CFG(2, 0x0a, 0x18560010), + AZALIA_PIN_CFG(2, 0x0b, 0x18560010), + AZALIA_PIN_CFG(2, 0x0c, 0x18560010), + AZALIA_PIN_CFG(2, 0x0d, 0x18560010), + AZALIA_PIN_CFG(2, 0x0e, 0x18560010), + AZALIA_PIN_CFG(2, 0x0f, 0x18560010), +}; + +const u32 pc_beep_verbs[] = {}; + +AZALIA_ARRAY_SIZES; diff --git a/src/mainboard/novacustom/mtl-h/include/mainboard/gpio.h b/src/mainboard/novacustom/mtl-h/include/mainboard/gpio.h new file mode 100644 index 0000000000..57924a615f --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/include/mainboard/gpio.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef MAINBOARD_GPIO_H +#define MAINBOARD_GPIO_H + +#ifndef PAD_CFG_GPIO_BIDIRECT +#define PAD_CFG_GPIO_BIDIRECT(pad, val, pull, rst, trig, own) \ + _PAD_CFG_STRUCT(pad, \ + PAD_FUNC(GPIO) | PAD_RESET(rst) | PAD_TRIG(trig) | \ + PAD_BUF(NO_DISABLE) | val, \ + PAD_PULL(pull) | PAD_CFG_OWN_GPIO(own)) +#endif + +void mainboard_configure_early_gpios(void); +void mainboard_configure_gpios(void); + +#endif diff --git a/src/mainboard/novacustom/mtl-h/ramstage.c b/src/mainboard/novacustom/mtl-h/ramstage.c new file mode 100644 index 0000000000..cd7031ba01 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/ramstage.c @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +const char *smbios_system_sku(void) +{ + return "Not Applicable"; +} + +smbios_enclosure_type smbios_mainboard_enclosure_type(void) +{ + return SMBIOS_ENCLOSURE_NOTEBOOK; +} + +smbios_wakeup_type smbios_system_wakeup_type(void) +{ + return SMBIOS_WAKEUP_TYPE_POWER_SWITCH; +} + +static void mainboard_init(void *chip_info) +{ + mainboard_configure_gpios(); +} + +struct chip_operations mainboard_ops = { + .init = mainboard_init, +}; + +void mainboard_silicon_init_params(FSP_S_CONFIG *params) +{ + // Enable reporting CPU C10 state over eSPI + params->PchEspiHostC10ReportEnable = 1; + + // Pinmux configuration + params->CnviRfResetPinMux = 0x194CE404; // GPP_F04 + params->CnviClkreqPinMux = 0x394CE605; // GPP_F05 + + params->LidStatus = dasharo_ec_get_lid_state(); +} diff --git a/src/mainboard/novacustom/mtl-h/romstage.c b/src/mainboard/novacustom/mtl-h/romstage.c new file mode 100644 index 0000000000..8fdd9eca61 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/romstage.c @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +void mainboard_memory_init_params(FSPM_UPD *mupd) +{ + const bool half_populated = false; + + static const struct mb_cfg mem_config = { + .type = MEM_TYPE_DDR5, + + .ect = true, /* Early Command Training */ + + .UserBd = BOARD_TYPE_ULT_ULX, + }; + const struct mem_spd dimm_module_spd_info = { + .topo = MEM_TOPO_DIMM_MODULE, + + .smbus = { + [0] = { + .addr_dimm[0] = 0x50, + }, + [1] = { + .addr_dimm[0] = 0x52, + }, + }, + }; + + memcfg_init(mupd, &mem_config, &dimm_module_spd_info, half_populated); +} diff --git a/src/mainboard/novacustom/mtl-h/vboot-rwab.fmd b/src/mainboard/novacustom/mtl-h/vboot-rwab.fmd new file mode 100644 index 0000000000..18a5027593 --- /dev/null +++ b/src/mainboard/novacustom/mtl-h/vboot-rwab.fmd @@ -0,0 +1,49 @@ +FLASH 32M { + SI_ALL 9M { + SI_DESC 16K + SI_GBE 8K + SI_ME + } + SI_BIOS { + RW_SECTION_A 7M { + VBLOCK_A 8K + FW_MAIN_A(CBFS) + RW_FWID_A 256 + } + + # This section starts at the 16M boundary in SPI flash. + # MTL does not support a region crossing this boundary, + # because the SPI flash is memory-mapped into two non- + # contiguous windows. + RW_MISC 2M { + UNIFIED_MRC_CACHE(PRESERVE) 128K { + RECOVERY_MRC_CACHE 64K + RW_MRC_CACHE 64K + } + SMMSTORE(PRESERVE) 256K + RW_ELOG(PRESERVE) 16K + RW_SHARED 16K { + SHARED_DATA 8K + VBLOCK_DEV 8K + } + RW_NVRAM(PRESERVE) 24K + BOOTSPLASH(CBFS) 1M + } + + RW_SECTION_B 7M { + VBLOCK_B 8K + FW_MAIN_B(CBFS) + RW_FWID_B 256 + } + + WP_RO 7M { + RO_VPD(PRESERVE) 16K + RO_SECTION { + FMAP 2K + RO_FRID 256 + GBB@4K 12K + COREBOOT(CBFS) + } + } + } +} From 2988beac8e5df0b5cddd9b7c7fbcf9ca12b679b0 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 13:00:15 -0600 Subject: [PATCH 0132/3886] Kconfig: Rework SYSTEM_TYPE_XX to better map to SMBIOS Add SYSTEM_TYPE_SERVER and SYSTEM_TYPE_ALL_INE_ONE; rename SYSTEM_TYPE_BOX to SYSTEM_TYPE_MINIPC. Map these entries to the analogous SMBIOS enclosure types. Follow-on patches will have mainboards select these new SYSTEM_TYPE entries as appropriate. Change-Id: I2a35101ccc60daf4863568216ef145c9c701140b Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86454 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Eric Lai Reviewed-by: Andy Ebrahiem --- src/Kconfig | 28 ++++++++++++++++++---------- src/lib/smbios_defaults.c | 6 ++++++ src/mainboard/google/brya/Kconfig | 4 ++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Kconfig b/src/Kconfig index 1d71840308..e4c8467f21 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -652,18 +652,11 @@ endmenu # load site-local kconfig to allow user specific defaults and overrides source "site-local/Kconfig" -config SYSTEM_TYPE_BOX - default n - bool - help - For devices like chromebox, mac-mini etc. These devices - without built-in display and operates on AC supply alone. - -config SYSTEM_TYPE_LAPTOP +config SYSTEM_TYPE_ALL_IN_ONE default n bool -config SYSTEM_TYPE_TABLET +config SYSTEM_TYPE_CONVERTIBLE default n bool @@ -671,7 +664,22 @@ config SYSTEM_TYPE_DETACHABLE default n bool -config SYSTEM_TYPE_CONVERTIBLE +config SYSTEM_TYPE_LAPTOP + default n + bool + +config SYSTEM_TYPE_MINIPC + default n + bool + help + For devices like chromebox, mac-mini etc. These devices + without built-in display and operates on AC supply alone. + +config SYSTEM_TYPE_SERVER + default n + bool + +config SYSTEM_TYPE_TABLET default n bool diff --git a/src/lib/smbios_defaults.c b/src/lib/smbios_defaults.c index 0ad6442a4f..ba6b231741 100644 --- a/src/lib/smbios_defaults.c +++ b/src/lib/smbios_defaults.c @@ -99,6 +99,12 @@ __weak smbios_enclosure_type smbios_mainboard_enclosure_type(void) return SMBIOS_ENCLOSURE_CONVERTIBLE; else if (CONFIG(SYSTEM_TYPE_DETACHABLE)) return SMBIOS_ENCLOSURE_DETACHABLE; + else if (CONFIG(SYSTEM_TYPE_SERVER)) + return SMBIOS_ENCLOSURE_MAIN_SERVER_CHASSIS; + else if (CONFIG(SYSTEM_TYPE_MINIPC)) + return SMBIOS_ENCLOSURE_MINI_PC; + else if (CONFIG(SYSTEM_TYPE_ALL_IN_ONE)) + return SMBIOS_ENCLOSURE_ALL_IN_ONE; else return SMBIOS_ENCLOSURE_DESKTOP; } diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index fc18f8f660..31948fbdb7 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -97,7 +97,7 @@ config BOARD_GOOGLE_BASEBOARD_NISSA select SOC_INTEL_ALDERLAKE_PCH_N select SOC_INTEL_CSE_LITE_COMPRESS_ME_RW select SOC_INTEL_CSE_LITE_SYNC_IN_RAMSTAGE - select SYSTEM_TYPE_LAPTOP if !SYSTEM_TYPE_BOX + select SYSTEM_TYPE_LAPTOP if !SYSTEM_TYPE_MINIPC select TPM_GOOGLE_TI50 select SOC_INTEL_COMMON_MMC_OVERRIDE @@ -223,7 +223,7 @@ config BOARD_GOOGLE_CROTA config BOARD_GOOGLE_DIRKS select BOARD_GOOGLE_BASEBOARD_NISSA select SOC_INTEL_TWINLAKE - select SYSTEM_TYPE_BOX + select SYSTEM_TYPE_MINIPC config BOARD_GOOGLE_DOCHI select BOARD_GOOGLE_BASEBOARD_BRYA From 620eb090ddeb49dbe78512f057af45f22bc6764e Mon Sep 17 00:00:00 2001 From: Dtrain Hsu Date: Mon, 17 Feb 2025 10:44:34 +0800 Subject: [PATCH 0133/3886] mb/trulo/var/uldrenite: Add Fn support and clean up Kconfig order Support Fn key on uldrenite emits a scancode of 94 (0x5e) and order the Kconfig. BUG=b:394749952 TEST=fn + top row (F1~F12) keys work fine Change-Id: I92c1bd200f1849a460943bdb96ab122d464a0f40 Signed-off-by: Dtrain Hsu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86474 Reviewed-by: John Su Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Andy Ebrahiem Reviewed-by: Eric Lai --- src/mainboard/google/brya/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 31948fbdb7..2e57055b1e 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -643,12 +643,13 @@ config BOARD_GOOGLE_ULDRENITE select BOARD_GOOGLE_BASEBOARD_TRULO select BOARD_ROMSIZE_KB_32768 select CHROMEOS_WIFI_SAR if CHROMEOS - select SOC_INTEL_TCSS_USE_PDC_PMC_USBC_MUX_CONFIGURATION + select DRIVERS_WWAN_FM350GL + select ENFORCE_MEM_CHANNEL_DISABLE select HAVE_PCIE_WWAN select HAVE_WWAN_POWER_SEQUENCE - select DRIVERS_WWAN_FM350GL + select MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD select SOC_INTEL_COMMON_BLOCK_HDA_VERB - select ENFORCE_MEM_CHANNEL_DISABLE + select SOC_INTEL_TCSS_USE_PDC_PMC_USBC_MUX_CONFIGURATION config BOARD_GOOGLE_VELL select BOARD_GOOGLE_BASEBOARD_BRYA From fe018334af248392316e32b309a4c0241e9ba585 Mon Sep 17 00:00:00 2001 From: David Wu Date: Mon, 20 Jan 2025 15:57:39 +0800 Subject: [PATCH 0134/3886] mb/google/brya: Create moxie variant Create the moxie variant of the kuldax project by copying the files to a new directory named for the variant. BUG=b:389391652 TEST=util/abuild/abuild -p none -t google/brya -x -a make sure the build includes GOOGLE_MOXIE Change-Id: Ie2b4888e4150cf2110fbcd57906b3496c97f6712 Signed-off-by: David Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86061 Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai Reviewed-by: Ren Kuo --- src/mainboard/google/brya/Kconfig | 12 + src/mainboard/google/brya/Kconfig.name | 3 + .../google/brya/variants/moxie/Makefile.mk | 9 + .../google/brya/variants/moxie/data.vbt | Bin 0 -> 8704 bytes .../google/brya/variants/moxie/fw_config.c | 75 ++++ .../google/brya/variants/moxie/gpio.c | 133 +++++++ .../brya/variants/moxie/include/variant/ec.h | 8 + .../variants/moxie/include/variant/gpio.h | 8 + .../brya/variants/moxie/overridetree.cb | 347 ++++++++++++++++++ .../google/brya/variants/moxie/ramstage.c | 58 +++ .../google/brya/variants/moxie/variant.c | 23 ++ 11 files changed, 676 insertions(+) create mode 100644 src/mainboard/google/brya/variants/moxie/Makefile.mk create mode 100644 src/mainboard/google/brya/variants/moxie/data.vbt create mode 100644 src/mainboard/google/brya/variants/moxie/fw_config.c create mode 100644 src/mainboard/google/brya/variants/moxie/gpio.c create mode 100644 src/mainboard/google/brya/variants/moxie/include/variant/ec.h create mode 100644 src/mainboard/google/brya/variants/moxie/include/variant/gpio.h create mode 100644 src/mainboard/google/brya/variants/moxie/overridetree.cb create mode 100644 src/mainboard/google/brya/variants/moxie/ramstage.c create mode 100644 src/mainboard/google/brya/variants/moxie/variant.c diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 2e57055b1e..9b0d59bc6e 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -361,6 +361,14 @@ config BOARD_GOOGLE_MOLI select BOARD_GOOGLE_BASEBOARD_BRASK select INTEL_GMA_HAVE_VBT +config BOARD_GOOGLE_MOXIE + select BOARD_GOOGLE_BASEBOARD_BRASK + select CHROMEOS_WIFI_SAR if CHROMEOS + select DRIVERS_GENESYSLOGIC_GL9755 + select EC_GOOGLE_CHROMEEC_INCLUDE_SSFC_IN_FW_CONFIG + select INTEL_GMA_HAVE_VBT + select SOC_INTEL_RAPTORLAKE + config BOARD_GOOGLE_NIVVIKS select BOARD_GOOGLE_BASEBOARD_NISSA select BOARD_ROMSIZE_KB_32768 @@ -780,6 +788,7 @@ config DRIVER_TPM_I2C_BUS default 0x1 if BOARD_GOOGLE_MARASOV default 0x1 if BOARD_GOOGLE_MITHRAX default 0x1 if BOARD_GOOGLE_MOLI + default 0x1 if BOARD_GOOGLE_MOXIE default 0x0 if BOARD_GOOGLE_NEREID default 0x0 if BOARD_GOOGLE_NIVVIKS default 0x1 if BOARD_GOOGLE_NOVA @@ -862,6 +871,7 @@ config TPM_TIS_ACPI_INTERRUPT default 13 if BOARD_GOOGLE_MARASOV default 13 if BOARD_GOOGLE_MITHRAX default 13 if BOARD_GOOGLE_MOLI + default 13 if BOARD_GOOGLE_MOXIE default 13 if BOARD_GOOGLE_NEREID default 13 if BOARD_GOOGLE_NIVVIKS default 13 if BOARD_GOOGLE_NOVA @@ -948,6 +958,7 @@ config MAINBOARD_PART_NUMBER default "Marasov" if BOARD_GOOGLE_MARASOV default "Mithrax" if BOARD_GOOGLE_MITHRAX default "Moli" if BOARD_GOOGLE_MOLI + default "Moxie" if BOARD_GOOGLE_MOXIE default "Nereid" if BOARD_GOOGLE_NEREID default "Nivviks" if BOARD_GOOGLE_NIVVIKS default "Nokris" if BOARD_GOOGLE_NOKRIS @@ -1023,6 +1034,7 @@ config VARIANT_DIR default "marasov" if BOARD_GOOGLE_MARASOV default "mithrax" if BOARD_GOOGLE_MITHRAX default "moli" if BOARD_GOOGLE_MOLI + default "moxie" if BOARD_GOOGLE_MOXIE default "nereid" if BOARD_GOOGLE_NEREID default "nereid" if BOARD_GOOGLE_TEREID default "nivviks" if BOARD_GOOGLE_NIVVIKS diff --git a/src/mainboard/google/brya/Kconfig.name b/src/mainboard/google/brya/Kconfig.name index 6007aa2c2a..db99d326f3 100644 --- a/src/mainboard/google/brya/Kconfig.name +++ b/src/mainboard/google/brya/Kconfig.name @@ -98,6 +98,9 @@ config BOARD_GOOGLE_MITHRAX config BOARD_GOOGLE_MOLI bool "-> Moli" +config BOARD_GOOGLE_MOXIE + bool "-> Moxie" + config BOARD_GOOGLE_NIVVIKS bool "-> Nivviks" diff --git a/src/mainboard/google/brya/variants/moxie/Makefile.mk b/src/mainboard/google/brya/variants/moxie/Makefile.mk new file mode 100644 index 0000000000..e31aaa1707 --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/Makefile.mk @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +bootblock-y += gpio.c + +romstage-y += gpio.c + +ramstage-y += gpio.c +ramstage-y += ramstage.c +ramstage-$(CONFIG_FW_CONFIG) += fw_config.c +ramstage-$(CONFIG_FW_CONFIG) += variant.c diff --git a/src/mainboard/google/brya/variants/moxie/data.vbt b/src/mainboard/google/brya/variants/moxie/data.vbt new file mode 100644 index 0000000000000000000000000000000000000000..7d14588c613c3501ddb3970a2254560b709b00a0 GIT binary patch literal 8704 zcmeHMO>7%Q6n?X7Z(QS$Z4FeIJ85twq&TS!jp{aT znxcS^vPd}uA*7X%P+EbokPwhlICJr(5D6r#9x9MHMB-9aaI3_n#k`r_*m2qrmr`gd zKkMy`=e_y%y>Dh`XLk>c`A4a5AlMfj@SW~!4^xx`C~&_qg~tcQ9~vGR5Bf%ZX)1)00!FWM?pW<-+WAnuY@*>N|HXnM%$~ z%qA0bWb73mWq8$g|JA8ff(~81IGLR3r3j*+H+3KF=sHTN=jBeNtJ9;nkD;a4-Q9ca zc(py)7Z@H4hX#D3q2VDq9Hqg~h;L-1Z_qz*mWHFlCqw?wXkW0}UXns!I{ntn)Enn# zsVmS*J$RmWj>|))f$5oa2lb^=G|GIg&}i~Xa^}rsqNCc*fU;n-5C9@UO%||n-w!fa z@B}IG(C<5O^?|lmt#+6|y?}ZZbsqIS)DKZVLHz>tYt(O0Z=n8&`ZMaUsK2A` zN+6`bN8m{vmr?BBv*}<+KEKmzj#@Z{(@eB^7Y^`T&H&^;ty>1k_zU1&Pw^q;Q(=4I zh?uLgL$2yBS*(3JYY(Ari>Bg?+QOmITw&m`7;rU#Aa<2Nuw{)&v9WE;stIdE+x;QFX zbp-@t{RRhHnYKqr><85cEsAro+dy!3&x`!_j|f( zc4TOdIct4c2y--2FRStf1fp9X0pZKexwS}riyB)h#z1t5BdF3!88MtZp(>Lr9#zd2 z5hUPS9LJco9423H99xb+gVL{?W5Jlz`Q8dcDTjx5I`mAuzCl%}ITpyIMc>7<(5lMG z!sXR6>6K76zP7J`Ai{I3?og$25R^7`HNKEg zoDn_;cnl&=CWi12=Okt!0`B}6f|Zt$#hrS{gy}xTp#)ejBL*F>M?}!7diZ=`lYHx0 zE%a*6%RTLCti3oEBJlm918g8|e_gby5Z9nKF3Y>wc}*T;@TR%F5aN~Uj z!jOO?{Qf;ifZ%Z`q#0ACO{ z5uDGT;HraHkez9*9$h!R7-z1f##`89(+t3cX`2s?)+gA z%gULH+*R2A_h;B$V*D0sAH7x_nbMlXrRS!x11Poa@PEgnc8Tw;c6c6@@GA^d7^pB% zVW7f5g@FnK6$buC26{ge4!~=Z0GgoVtExDxk%Q*9J^p%#L$-*Z)+io zLEpZQ2a8Iau!wK3Tks_rds~56sB53&yJ_nZQ6P;z3iiWiS(Gd)v&~s4kVhm5C+6M`J(l*8IIq8pU%YMj6&!yc)nY9C-9P8^ M@5b+0upw=K0cSRME&u=k literal 0 HcmV?d00001 diff --git a/src/mainboard/google/brya/variants/moxie/fw_config.c b/src/mainboard/google/brya/variants/moxie/fw_config.c new file mode 100644 index 0000000000..42613af163 --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/fw_config.c @@ -0,0 +1,75 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +static const struct pad_config dmic_enable_pads[] = { + PAD_CFG_NF(GPP_R6, NONE, DEEP, NF3), /* DMIC_CLK1_R */ + PAD_CFG_NF(GPP_R7, NONE, DEEP, NF3), /* DMIC_DATA1_R */ +}; + +static const struct pad_config dmic_disable_pads[] = { + PAD_NC(GPP_R6, NONE), + PAD_NC(GPP_R7, NONE), +}; + +static const struct pad_config i2s_enable_pads[] = { + PAD_CFG_NF(GPP_R0, NONE, DEEP, NF2), /* I2S_HP_SCLK_R */ + PAD_CFG_NF(GPP_R1, NONE, DEEP, NF2), /* I2S_HP_SFRM_R */ + PAD_CFG_NF(GPP_R2, DN_20K, DEEP, NF2), /* I2S_PCH_TX_HP_RX_STRAP */ + PAD_CFG_NF(GPP_R3, NONE, DEEP, NF2), /* I2S_PCH_RX_HP_TX */ +}; + +static const struct pad_config i2s_disable_pads[] = { + PAD_NC(GPP_R0, NONE), + PAD_NC(GPP_R1, NONE), + PAD_NC(GPP_R2, NONE), + PAD_NC(GPP_R3, NONE), +}; + +static const struct pad_config bt_i2s_enable_pads[] = { + PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), /* BT_I2S_BCLK */ + PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), /* BT_I2S_SYNC */ + PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), /* BT_I2S_SDO */ + PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), /* BT_I2S_SDI */ + PAD_CFG_NF(GPP_VGPIO_34, NONE, DEEP, NF1), /* SSP2_SCLK */ + PAD_CFG_NF(GPP_VGPIO_35, NONE, DEEP, NF1), /* SSP2_SFRM */ + PAD_CFG_NF(GPP_VGPIO_36, NONE, DEEP, NF1), /* SSP_TXD */ + PAD_CFG_NF(GPP_VGPIO_37, NONE, DEEP, NF1), /* SSP_RXD */ +}; + +static const struct pad_config bt_i2s_disable_pads[] = { + PAD_NC(GPP_VGPIO_30, NONE), + PAD_NC(GPP_VGPIO_31, NONE), + PAD_NC(GPP_VGPIO_32, NONE), + PAD_NC(GPP_VGPIO_33, NONE), + PAD_NC(GPP_VGPIO_34, NONE), + PAD_NC(GPP_VGPIO_35, NONE), + PAD_NC(GPP_VGPIO_36, NONE), + PAD_NC(GPP_VGPIO_37, NONE), +}; + +static void fw_config_handle(void *unused) +{ + if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(AUDIO, AUDIO_UNKNOWN))) { + printk(BIOS_INFO, "Disable audio related GPIO pins.\n"); + gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads)); + gpio_configure_pads(dmic_disable_pads, ARRAY_SIZE(dmic_disable_pads)); + gpio_configure_pads(bt_i2s_disable_pads, ARRAY_SIZE(bt_i2s_disable_pads)); + return; + } + + if (fw_config_probe(FW_CONFIG(AUDIO, NAU88L25B_I2S))) { + printk(BIOS_INFO, "Configure audio over I2S with NAU88L25B.\n"); + gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads)); + gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads)); + printk(BIOS_INFO, "BT offload enabled\n"); + gpio_configure_pads(bt_i2s_enable_pads, ARRAY_SIZE(bt_i2s_enable_pads)); + } else { + printk(BIOS_INFO, "BT offload disabled\n"); + gpio_configure_pads(bt_i2s_disable_pads, ARRAY_SIZE(bt_i2s_disable_pads)); + } +} +BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); diff --git a/src/mainboard/google/brya/variants/moxie/gpio.c b/src/mainboard/google/brya/variants/moxie/gpio.c new file mode 100644 index 0000000000..556e8b694c --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/gpio.c @@ -0,0 +1,133 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +/* Pad configuration in ramstage */ +static const struct pad_config override_gpio_table[] = { + /* A14 : USB_OC1# ==> HDMIA_HPD */ + PAD_CFG_NF(GPP_A14, NONE, DEEP, NF2), + /* A15 : USB_OC2# ==> NC */ + PAD_NC(GPP_A15, NONE), + /* A19 : DDSP_HPD1 ==> NC */ + PAD_NC(GPP_A19, NONE), + /* A20 : DDSP_HPD2 ==> NC */ + PAD_NC(GPP_A20, NONE), + /* A21 : DDPC_CTRCLK ==> NC */ + PAD_NC(GPP_A21, NONE), + /* A22 : DDPC_CTRLDATA ==> NC */ + PAD_NC(GPP_A22, NONE), + + /* B7 : ISH_12C1_SDA ==> PCH_I2C_MISCB_SDA */ + PAD_CFG_NF_LOCK(GPP_B7, NONE, NF2, LOCK_CONFIG), + /* B8 : ISH_I2C1_SCL ==> PCH_I2C_MISCB_SCL */ + PAD_CFG_NF_LOCK(GPP_B8, NONE, NF2, LOCK_CONFIG), + + /* C3 : SML0CLK ==> USB_C0_AUX_DC_P */ + PAD_CFG_NF(GPP_C3, NONE, DEEP, NF6), + /* C4 : SML0DATA ==> USB_C0_AUX_DC_N */ + PAD_CFG_NF(GPP_C4, NONE, DEEP, NF6), + + /* D0 : ISH_GP0 ==> NC */ + PAD_NC_LOCK(GPP_D0, NONE, LOCK_CONFIG), + /* D1 : ISH_GP1 ==> NC */ + PAD_NC_LOCK(GPP_D1, NONE, LOCK_CONFIG), + /* D2 : ISH_GP2 ==> NC */ + PAD_NC_LOCK(GPP_D2, NONE, LOCK_CONFIG), + /* D3 : ISH_GP3 ==> NC */ + PAD_NC_LOCK(GPP_D3, NONE, LOCK_CONFIG), + /* D9 : ISH_SPI_CS# ==> NC */ + PAD_NC_LOCK(GPP_D9, NONE, LOCK_CONFIG), + + /* E20 : DDP2_CTRLCLK ==> HDMIA_CTRLCLK */ + PAD_CFG_NF(GPP_E20, NONE, DEEP, NF1), + /* E21 : DDP2_CTRLDATA ==> HDMIA_CTRLDATA_STRAP */ + PAD_CFG_NF(GPP_E21, NONE, DEEP, NF1), + + /* F11 : THC1_SPI2_CLK ==> NC */ + PAD_NC_LOCK(GPP_F11, NONE, LOCK_CONFIG), + /* F12 : GSXDOUT ==> NC */ + PAD_NC_LOCK(GPP_F12, NONE, LOCK_CONFIG), + /* F13 : GSXDOUT ==> NC */ + PAD_NC_LOCK(GPP_F13, NONE, LOCK_CONFIG), + /* F15 : GSXSRESET# ==> NC */ + PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG), + /* F16 : GSXCLK ==> NC */ + PAD_NC_LOCK(GPP_F16, NONE, LOCK_CONFIG), + + /* R4 : HDA_RST# ==> NC */ + PAD_NC(GPP_R4, NONE), + /* R5 : HDA_SDI1 ==> NC */ + PAD_NC(GPP_R5, NONE), +}; + +/* Early pad configuration in bootblock */ +static const struct pad_config early_gpio_table[] = { + /* A13 : PMC_I2C_SCL ==> GSC_PCH_INT_ODL */ + PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT), + /* B4 : PROC_GP3 ==> SSD_PERST_L */ + PAD_CFG_GPO(GPP_B4, 0, DEEP), + /* E15 : RSVD_TP ==> PCH_WP_OD */ + PAD_CFG_GPI_GPIO_DRIVER(GPP_E15, NONE, DEEP), + /* F14 : GSXDIN ==> EN_PP3300_SSD */ + PAD_CFG_GPO(GPP_F14, 1, DEEP), + /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */ + PAD_CFG_GPI(GPP_F18, NONE, DEEP), + /* H6 : I2C1_SDA ==> PCH_I2C_TPM_SDA */ + PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1), + /* H7 : I2C1_SCL ==> PCH_I2C_TPM_SCL */ + PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1), + /* H10 : UART0_RXD ==> UART_PCH_RX_DBG_TX */ + PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2), + /* H11 : UART0_TXD ==> UART_PCH_TX_DBG_RX */ + PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2), + /* H13 : I2C7_SCL ==> EN_PP3300_SD */ + PAD_CFG_GPO(GPP_H13, 1, DEEP), + + /* CPU PCIe VGPIO for PEG60 */ + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_48, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_49, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_50, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_51, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_52, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_53, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_54, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_55, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_56, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_57, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_58, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_59, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_60, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_61, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_62, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_63, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_76, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_77, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_78, NONE, PLTRST, NF1), + PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_79, NONE, PLTRST, NF1), +}; + +static const struct pad_config romstage_gpio_table[] = { + /* B4 : PROC_GP3 ==> SSD_PERST_L */ + PAD_CFG_GPO(GPP_B4, 1, DEEP), +}; + +const struct pad_config *variant_gpio_override_table(size_t *num) +{ + *num = ARRAY_SIZE(override_gpio_table); + return override_gpio_table; +} + +const struct pad_config *variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} + +const struct pad_config *variant_romstage_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(romstage_gpio_table); + return romstage_gpio_table; +} diff --git a/src/mainboard/google/brya/variants/moxie/include/variant/ec.h b/src/mainboard/google/brya/variants/moxie/include/variant/ec.h new file mode 100644 index 0000000000..7a2a6ff8b7 --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/include/variant/ec.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __VARIANT_EC_H__ +#define __VARIANT_EC_H__ + +#include + +#endif diff --git a/src/mainboard/google/brya/variants/moxie/include/variant/gpio.h b/src/mainboard/google/brya/variants/moxie/include/variant/gpio.h new file mode 100644 index 0000000000..c4fe342621 --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/include/variant/gpio.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef VARIANT_GPIO_H +#define VARIANT_GPIO_H + +#include + +#endif diff --git a/src/mainboard/google/brya/variants/moxie/overridetree.cb b/src/mainboard/google/brya/variants/moxie/overridetree.cb new file mode 100644 index 0000000000..19a20a14ec --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/overridetree.cb @@ -0,0 +1,347 @@ +fw_config + field AUDIO 0 2 + option AUDIO_UNKNOWN 0 + option NAU88L25B_I2S 1 + end + field BJ_POWER 3 4 + option BJ_POWER_150W 0 + option BJ_POWER_230W 1 + option BJ_POWER_65W 2 + option BJ_POWER_135W 3 + end + field MB_USBC 6 7 + option TC_USB4 0 + option TC_USB3 1 + end + field USB_HUB 32 + option HUB_ABSENT 0 + option HUB_PRESENT 1 + end +end + +chip soc/intel/alderlake + register "domain_vr_config[VR_DOMAIN_IA]" = "{ + .enable_fast_vmode = 1, + }" + + register "sagv" = "SaGv_Enabled" + + register "usb2_ports[1]" = "USB2_PORT_EMPTY" # Disable USB2 Port 1 + register "usb2_ports[2]" = "USB2_PORT_EMPTY" # Disable USB2 Port 2 + register "usb2_ports[4]" = "USB2_PORT_EMPTY" # Disable USB2 Port 4 + + register "usb3_ports[0]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .tx_de_emp = 0x2B, + .tx_downscale_amp = 0x00, + }" # Type-A port A0 + register "usb3_ports[1]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .tx_de_emp = 0x2B, + .tx_downscale_amp = 0x00, + }" # Type-A port A1 + + register "serial_io_gspi_mode" = "{ + [PchSerialIoIndexGSPI0] = PchSerialIoDisabled, + [PchSerialIoIndexGSPI1] = PchSerialIoDisabled, + }" + + register "ddi_ports_config" = "{ + [DDI_PORT_A] = DDI_ENABLE_HPD, + [DDI_PORT_B] = DDI_ENABLE_HPD | DDI_ENABLE_DDC, + [DDI_PORT_1] = DDI_ENABLE_HPD, + [DDI_PORT_3] = DDI_ENABLE_HPD | DDI_ENABLE_DDC, + }" + + register "power_limits_config[RPL_P_282_242_142_15W_CORE]" = "{ + .tdp_pl1_override = 15, + .tdp_pl2_override = 55, + .tdp_pl4 = 100, + }" + + device domain 0 on + device ref dtt on + chip drivers/intel/dptf + ## sensor information + register "options.tsr[0].desc" = ""DRAM"" + register "options.tsr[1].desc" = ""Charger"" + + # TODO: below values are initial reference values only + ## Active Policy + register "policies.active" = "{ + [0] = { + .target = DPTF_CPU, + .thresholds = { + TEMP_PCT(85, 90), + TEMP_PCT(80, 80), + TEMP_PCT(75, 70), + } + } + }" + + ## Passive Policy + register "policies.passive" = "{ + [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 75, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 75, 5000), + }" + + ## Critical Policy + register "policies.critical" = "{ + [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), + }" + + register "controls.power_limits" = "{ + .pl1 = { + .min_power = 3000, + .max_power = 15000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 200, + }, + .pl2 = { + .min_power = 55000, + .max_power = 55000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 1000, + } + }" + + ## Charger Performance Control (Control, mA) + register "controls.charger_perf" = "{ + [0] = { 255, 1700 }, + [1] = { 24, 1500 }, + [2] = { 16, 1000 }, + [3] = { 8, 500 } + }" + + ## Fan Performance Control (Percent, Speed, Noise, Power) + register "controls.fan_perf" = "{ + [0] = { 90, 6700, 220, 2200, }, + [1] = { 80, 5800, 180, 1800, }, + [2] = { 70, 5000, 145, 1450, }, + [3] = { 60, 4900, 115, 1150, }, + [4] = { 50, 3838, 90, 900, }, + [5] = { 40, 2904, 55, 550, }, + [6] = { 30, 2337, 30, 300, }, + [7] = { 20, 1608, 15, 150, }, + [8] = { 10, 800, 10, 100, }, + [9] = { 0, 0, 0, 50, } + }" + + ## Fan options + register "options.fan.fine_grained_control" = "true" + register "options.fan.step_size" = "2" + + device generic 0 alias dptf_policy on end + end + end + device ref pcie4_0 on + # Enable CPU PCIE RP 1 using CLK 0 + register "cpu_pcie_rp[CPU_RP(1)]" = "{ + .clk_req = 0, + .clk_src = 0, + .flags = PCIE_RP_LTR | PCIE_RP_AER, + }" + end + device ref tbt_pcie_rp0 on + probe MB_USBC TC_USB4 + end + device ref tbt_pcie_rp1 on + probe MB_USBC TC_USB4 + end + device ref tbt_pcie_rp2 on + probe MB_USBC TC_USB4 + end + device ref tcss_dma0 on + probe MB_USBC TC_USB4 + chip drivers/intel/usb4/retimer + register "dfp[0].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E4)" + use tcss_usb3_port1 as dfp[0].typec_port + device generic 0 on end + end + end + device ref cnvi_wifi on + chip drivers/wifi/generic + register "wake" = "GPE0_PME_B0" + device generic 0 on end + end + end + device ref i2c0 on + chip drivers/i2c/nau8825 + register "irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPP_A23)" + register "jkdet_enable" = "1" + register "jkdet_pull_enable" = "0" + register "jkdet_pull_up" = "0" + register "jkdet_polarity" = "1" # ActiveLow + register "vref_impedance" = "2" # 125kOhm + register "micbias_voltage" = "6" # 2.754 + register "sar_threshold_num" = "4" + register "sar_threshold[0]" = "0x0C" + register "sar_threshold[1]" = "0x1C" + register "sar_threshold[2]" = "0x38" + register "sar_threshold[3]" = "0x60" + register "sar_hysteresis" = "1" + register "sar_voltage" = "0" # VDDA + register "sar_compare_time" = "0" # 500ns + register "sar_sampling_time" = "0" # 2us + register "short_key_debounce" = "2" # 100ms + register "jack_insert_debounce" = "7" # 512ms + register "jack_eject_debounce" = "7" # 512ms + device i2c 1a on + probe AUDIO NAU88L25B_I2S + end + end + end + device ref pcie_rp7 on + chip drivers/net + register "wake" = "GPE0_DW0_07" + register "led_feature" = "0xe0" + register "customized_leds" = "0x05af" + register "customized_led0" = "0x23f" + register "customized_led2" = "0x028" + register "enable_aspm_l1_2" = "1" + register "add_acpi_dma_property" = "true" + device pci 00.0 on end + end + end # RTL8125 and RTL8111K Ethernet NIC + device ref pcie_rp8 on + chip soc/intel/common/block/pcie/rtd3 + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_H13)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D18)" + register "srcclk_pin" = "3" + device generic 0 on end + end + end #PCIE8 SD card + device ref gspi1 off end + device ref pch_espi on + chip ec/google/chromeec + use conn0 as mux_conn[0] + device pnp 0c09.0 on end + end + end + device ref pmc hidden + chip drivers/intel/pmc_mux + device generic 0 on + chip drivers/intel/pmc_mux/conn + use usb2_port1 as usb2_port + use tcss_usb3_port1 as usb3_port + device generic 0 alias conn0 on end + end + end + end + end + device ref tcss_xhci on + chip drivers/usb/acpi + device ref tcss_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C0 (MLB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(BACK, RIGHT, ACPI_PLD_GROUP(1, 1))" + device ref tcss_usb3_port1 on end + end + end + end + end + device ref xhci on + chip drivers/usb/acpi + device ref xhci_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C0 (MLB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(BACK, RIGHT, ACPI_PLD_GROUP(1, 1))" + device ref usb2_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A3 (MLB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, LEFT, ACPI_PLD_GROUP(5, 1))" + device ref usb2_port6 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A2 (MLB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, CENTER, ACPI_PLD_GROUP(6, 1))" + device ref usb2_port7 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A1 (MLB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, LEFT, ACPI_PLD_GROUP(4, 1))" + device ref usb2_port8 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A0 (MLB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, RIGHT, ACPI_PLD_GROUP(1, 2))" + device ref usb2_port9 on + probe USB_HUB HUB_ABSENT + end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Hub for Type-A Port A0/A4/A5 (MLB)"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port9 on + probe USB_HUB HUB_PRESENT + end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + register "reset_gpio" = + "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" + device ref usb2_port10 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A0 (MLB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, RIGHT, ACPI_PLD_GROUP(1, 2))" + device ref usb3_port1 on + probe USB_HUB HUB_ABSENT + end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Hub for Type-A Port A0/A4/A5 (MLB)"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb3_port1 on + probe USB_HUB HUB_PRESENT + end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A1 (MLB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(FRONT, LEFT, ACPI_PLD_GROUP(4, 1))" + device ref usb3_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A2 (MLB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, CENTER, ACPI_PLD_GROUP(6, 1))" + device ref usb3_port3 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A3 (MLB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(BACK, LEFT, ACPI_PLD_GROUP(5, 1))" + device ref usb3_port4 on end + end + end + end + end + end +end diff --git a/src/mainboard/google/brya/variants/moxie/ramstage.c b/src/mainboard/google/brya/variants/moxie/ramstage.c new file mode 100644 index 0000000000..f4f80bebe0 --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/ramstage.c @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include +#include +#include +#include + +const struct cpu_power_limits limits[] = { + /* SKU_ID, TDP (Watts), pl1_min, pl1_max, pl2_min, pl2_max, pl4 */ + { PCI_DID_INTEL_RPL_P_ID_5, 15, 15000, 15000, 55000, 55000, 100000 }, + { PCI_DID_INTEL_RPL_P_ID_4, 15, 15000, 15000, 55000, 55000, 100000 }, + { PCI_DID_INTEL_RPL_P_ID_3, 15, 15000, 15000, 55000, 55000, 100000 }, +}; + +const struct system_power_limits sys_limits[] = { + /* SKU_ID, TDP (Watts), psys_pl2 (Watts) */ + { PCI_DID_INTEL_RPL_P_ID_5, 15, 138 }, + { PCI_DID_INTEL_RPL_P_ID_4, 15, 138 }, + { PCI_DID_INTEL_RPL_P_ID_3, 15, 138 }, +}; + +/* + * Psys_pmax considerations. + * + * Given the hardware design in moxie, the serial shunt resistor is 0.005ohm. + * The full scale of hardware PSYS signal 1.6v maps to system current 11.25A + * instead of real system power. The equation is shown below: + * PSYS = 1.6v = (0.005ohm x 11.25A) x 50 (INA213, gain 50V/V) x R501/(R501 + R510) + * R501/(R501 + R510) = 0.57 = 20K / (20K + 15K) + * + * The Psys_pmax is a SW setting which tells IMVP9.1 the mapping b/w system input + * current and the actual system power. Since there is no voltage information + * from PSYS, different voltage input would map to different Psys_pmax settings: + * For Type-C 15V, the Psys_pmax should be 15v x 11.25A = 168.75W + * For Type-C 20V, the Psys_pmax should be 20v x 11.25A = 225W + * For a barrel jack, the Psys_pmax should be 20v x 11.25A = 225W + * + * Imagine that there is a type-c 100W (20V/5A) connected to DUT w/ full loading, + * and the Psys_pmax setting is 225W. Then IMVP9.1 can calculate the current system + * power = 225W * 5A / 11.25A = 100W, which is the actual system power. + */ +const struct psys_config psys_config = { + .efficiency = 97, + .psys_imax_ma = 11250, + .bj_volts_mv = 20000 +}; + +void variant_devtree_update(void) +{ + size_t total_entries = ARRAY_SIZE(limits); + variant_update_psys_power_limits(limits, sys_limits, total_entries, &psys_config); + + variant_update_power_limits(limits, total_entries); +} diff --git a/src/mainboard/google/brya/variants/moxie/variant.c b/src/mainboard/google/brya/variants/moxie/variant.c new file mode 100644 index 0000000000..b7cba968a5 --- /dev/null +++ b/src/mainboard/google/brya/variants/moxie/variant.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +const char *get_wifi_sar_cbfs_filename(void) +{ + return "wifi_sar_0.hex"; +} + +void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config) +{ + config->cnvi_bt_audio_offload = fw_config_probe(FW_CONFIG(AUDIO, + NAU88L25B_I2S)); + + if (fw_config_probe(FW_CONFIG(MB_USBC, TC_USB3))) { + config->tcss_aux_ori = 1; + config->typec_aux_bias_pads[0].pad_auxp_dc = GPP_C3; + config->typec_aux_bias_pads[0].pad_auxn_dc = GPP_C4; + } +} From 2e2b35062e0df056a0168e3219e9b3c321319170 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 18:14:33 -0600 Subject: [PATCH 0135/3886] mb/google/brya: Set SYSTEM_TYPE_MINIPC for brask baseboard boards Brask devices are all Chromeboxes, so select SYSTEM_TYPE_MINIPC to ensure the SMBIOS enclosure type is set correctly. Change-Id: I133a26223ad204dfad67e136cf342d2fb2a7205e Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86469 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Eric Lai --- src/mainboard/google/brya/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 9b0d59bc6e..0f1c3c50e6 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -68,6 +68,7 @@ config BOARD_GOOGLE_BASEBOARD_BRASK select RT8168_GET_MAC_FROM_VPD select RT8168_SET_LED_MODE select SOC_INTEL_ALDERLAKE_PCH_P + select SYSTEM_TYPE_MINIPC select TPM_GOOGLE_CR50 config BOARD_GOOGLE_BASEBOARD_HADES From d0c1a4966fa9cf6d98c2441316c26e881750369c Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 18:19:46 -0600 Subject: [PATCH 0136/3886] mb/purism/librem_cnl: Set SYSTEM_TYPE_MINIPC for Librem mini v1/v2 Ensures SMBIOS enslosure type set properly. Change-Id: I047e6319b70f2747796869151bf361afe4c3e961 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86470 Tested-by: build bot (Jenkins) Reviewed-by: Jonathon Hall --- src/mainboard/purism/librem_cnl/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/purism/librem_cnl/Kconfig b/src/mainboard/purism/librem_cnl/Kconfig index ab6a67f48d..a718678605 100644 --- a/src/mainboard/purism/librem_cnl/Kconfig +++ b/src/mainboard/purism/librem_cnl/Kconfig @@ -20,6 +20,7 @@ config BOARD_PURISM_LIBREM_MINI select HAVE_OPTION_TABLE select SOC_INTEL_WHISKEYLAKE select SUPERIO_ITE_IT8528E + select SYSTEM_TYPE_MINIPC config BOARD_PURISM_LIBREM_MINI_V2 select BOARD_PURISM_BASEBOARD_LIBREM_CNL @@ -27,6 +28,7 @@ config BOARD_PURISM_LIBREM_MINI_V2 select HAVE_OPTION_TABLE select SOC_INTEL_COMETLAKE_1 select SUPERIO_ITE_IT8528E + select SYSTEM_TYPE_MINIPC config BOARD_PURISM_LIBREM_14 select BOARD_PURISM_BASEBOARD_LIBREM_CNL From 2d35aceeb3013cbceae9aea7f648195be87524f5 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 18:21:24 -0600 Subject: [PATCH 0137/3886] mb/starlabs/byte: Set SYSTEM_TYPE_MINIPC Ensures SMBIOS enclosure type set properly. Change-Id: I65ca75a57dbc4a9251316d48bf660dd631c716dd Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86471 Reviewed-by: Sean Rhodes Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/byte_adl/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/starlabs/byte_adl/Kconfig b/src/mainboard/starlabs/byte_adl/Kconfig index 77a4ea4c0e..51fa7aa77a 100644 --- a/src/mainboard/starlabs/byte_adl/Kconfig +++ b/src/mainboard/starlabs/byte_adl/Kconfig @@ -10,6 +10,7 @@ config BOARD_STARLABS_BYTE_SERIES select INTEL_LPSS_UART_FOR_CONSOLE select NO_UART_ON_SUPERIO select SOC_INTEL_COMMON_BLOCK_HDA_VERB + select SYSTEM_TYPE_MINIPC select VALIDATE_INTEL_DESCRIPTOR config BOARD_STARLABS_BYTE_ADL From 270d4b6b334ce64cafc18e970dc7cf88b517100d Mon Sep 17 00:00:00 2001 From: David Wu Date: Mon, 17 Feb 2025 15:50:42 +0800 Subject: [PATCH 0138/3886] mb/google/nissa/var/dirks: Generate SPD ID for supported parts Add supported memory parts in mem_parts_used.txt, and generate SPD id for these parts. 1. K3KL9L90CM-MGCT (SAMSUNG) 2. H58G66BK8BX067 (HYNIX) BUG=b:388117663 TEST=Run part_id_gen tool and check the generated files. Change-Id: I1ca97e28852660cae0352d771e30c9348a5939a0 Signed-off-by: David Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86477 Reviewed-by: Ivy Jian Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/variants/dirks/memory/Makefile.mk | 2 ++ .../google/brya/variants/dirks/memory/dram_id.generated.txt | 2 ++ .../google/brya/variants/dirks/memory/mem_parts_used.txt | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/mainboard/google/brya/variants/dirks/memory/Makefile.mk b/src/mainboard/google/brya/variants/dirks/memory/Makefile.mk index 2d0d1bb0d8..67b6ac1b88 100644 --- a/src/mainboard/google/brya/variants/dirks/memory/Makefile.mk +++ b/src/mainboard/google/brya/variants/dirks/memory/Makefile.mk @@ -10,3 +10,5 @@ SPD_SOURCES += spd/lp5/set-0/spd-5.hex # ID = 2(0b0010) Parts = K3LKLKL0EM SPD_SOURCES += spd/lp5/set-0/spd-3.hex # ID = 3(0b0011) Parts = K3LKBKB0BM-MGCP SPD_SOURCES += spd/lp5/set-0/spd-7.hex # ID = 4(0b0100) Parts = K3KL8L80CM-MGCT SPD_SOURCES += spd/lp5/set-0/spd-11.hex # ID = 5(0b0101) Parts = H58G56BK8BX068 +SPD_SOURCES += spd/lp5/set-0/spd-8.hex # ID = 6(0b0110) Parts = K3KL9L90CM-MGCT +SPD_SOURCES += spd/lp5/set-0/spd-10.hex # ID = 7(0b0111) Parts = H58G66BK8BX067 diff --git a/src/mainboard/google/brya/variants/dirks/memory/dram_id.generated.txt b/src/mainboard/google/brya/variants/dirks/memory/dram_id.generated.txt index c10bbb76e2..059f1e69be 100644 --- a/src/mainboard/google/brya/variants/dirks/memory/dram_id.generated.txt +++ b/src/mainboard/google/brya/variants/dirks/memory/dram_id.generated.txt @@ -12,3 +12,5 @@ K3LKBKB0BM-MGCP 3 (0011) H9JCNNNCP3MLYR-N6E 0 (0000) K3KL8L80CM-MGCT 4 (0100) H58G56BK8BX068 5 (0101) +K3KL9L90CM-MGCT 6 (0110) +H58G66BK8BX067 7 (0111) diff --git a/src/mainboard/google/brya/variants/dirks/memory/mem_parts_used.txt b/src/mainboard/google/brya/variants/dirks/memory/mem_parts_used.txt index 2c18a19d34..61be3e79aa 100644 --- a/src/mainboard/google/brya/variants/dirks/memory/mem_parts_used.txt +++ b/src/mainboard/google/brya/variants/dirks/memory/mem_parts_used.txt @@ -17,3 +17,5 @@ K3LKBKB0BM-MGCP H9JCNNNCP3MLYR-N6E K3KL8L80CM-MGCT H58G56BK8BX068 +K3KL9L90CM-MGCT +H58G66BK8BX067 From 3783e06c339d361067b3b82e4c83df0106255f38 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Fri, 14 Feb 2025 20:21:08 +0100 Subject: [PATCH 0139/3886] acpi/acpigen: fix typo in acpigen_write_if_lequal_op_op comment Change-Id: I2e4159e1e34560dacffbb6b9e392c2d2e2ad6887 Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/86463 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/acpi/acpigen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index 7d24b9e131..308cf5ac85 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -1586,7 +1586,7 @@ void acpigen_write_if_and(uint8_t arg1, uint8_t arg2) * Generates ACPI code for checking if operand1 and operand2 are equal. * Both operand1 and operand2 are ACPI ops. * - * If (Lequal (op,1 op2)) + * If (Lequal (op1, op2)) */ void acpigen_write_if_lequal_op_op(uint8_t op1, uint8_t op2) { From c972e6113f053fd8fa67282b16ccccb3eecf6c6c Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 13:08:58 -0600 Subject: [PATCH 0140/3886] mb/google/auron: Clean up Kconfig selections Select the newly-added SYSTEM_TYPE_ALL_IN_ONE for Buddy variant, and use that as a discriminator to de-duplicate selections for system type and HAVE_SPD_IN_CBFS. Change-Id: I0d28bc496ff6bcfa9947a4d15ed2d8f75cf74ac3 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86455 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/google/auron/Kconfig | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/mainboard/google/auron/Kconfig b/src/mainboard/google/auron/Kconfig index 72f7758b55..2381c797d9 100644 --- a/src/mainboard/google/auron/Kconfig +++ b/src/mainboard/google/auron/Kconfig @@ -10,6 +10,7 @@ config BOARD_GOOGLE_BASEBOARD_AURON select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_OPTION_TABLE + select HAVE_SPD_IN_CBFS if !SYSTEM_TYPE_ALL_IN_ONE select INTEL_GMA_HAVE_VBT select INTEL_INT15 select MAINBOARD_HAS_CHROMEOS @@ -17,34 +18,26 @@ config BOARD_GOOGLE_BASEBOARD_AURON select MEMORY_MAPPED_TPM select MAINBOARD_HAS_TPM1 select SOC_INTEL_BROADWELL + select SYSTEM_TYPE_LAPTOP if !SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_AURON_PAINE select BOARD_GOOGLE_BASEBOARD_AURON - select HAVE_SPD_IN_CBFS - select SYSTEM_TYPE_LAPTOP config BOARD_GOOGLE_AURON_YUNA select BOARD_GOOGLE_BASEBOARD_AURON - select HAVE_SPD_IN_CBFS - select SYSTEM_TYPE_LAPTOP config BOARD_GOOGLE_BUDDY select BOARD_GOOGLE_BASEBOARD_AURON + select SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_GANDOF select BOARD_GOOGLE_BASEBOARD_AURON - select HAVE_SPD_IN_CBFS - select SYSTEM_TYPE_LAPTOP config BOARD_GOOGLE_LULU select BOARD_GOOGLE_BASEBOARD_AURON - select HAVE_SPD_IN_CBFS - select SYSTEM_TYPE_LAPTOP config BOARD_GOOGLE_SAMUS select BOARD_GOOGLE_BASEBOARD_AURON - select HAVE_SPD_IN_CBFS - select SYSTEM_TYPE_LAPTOP if BOARD_GOOGLE_BASEBOARD_AURON From d0f5fc744495a5a261ae3bf78cd1b69178073cc5 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 13:11:39 -0600 Subject: [PATCH 0141/3886] mb/google/beltino: Set SMBIOS system type Beltino variants will now correctly show their SMBIOS type as an all-in-one (monroe) or a mini-pc (all other variants) rather than the default desktop type. Change-Id: Ia9f17236c415b626fd5d553a453cf43d4145ef41 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86456 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/mainboard/google/beltino/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/google/beltino/Kconfig b/src/mainboard/google/beltino/Kconfig index b3695cc383..8bde8e6d1c 100644 --- a/src/mainboard/google/beltino/Kconfig +++ b/src/mainboard/google/beltino/Kconfig @@ -15,12 +15,14 @@ config BOARD_GOOGLE_BASEBOARD_BELTINO select NORTHBRIDGE_INTEL_HASWELL select SOUTHBRIDGE_INTEL_LYNXPOINT select SUPERIO_ITE_IT8772F + select SYSTEM_TYPE_MINIPC if !SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_MCCLOUD select BOARD_GOOGLE_BASEBOARD_BELTINO config BOARD_GOOGLE_MONROE select BOARD_GOOGLE_BASEBOARD_BELTINO + select SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_PANTHER select BOARD_GOOGLE_BASEBOARD_BELTINO From de964a7de360671ecb0e5d99338d51f1e27852c6 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 15:09:16 -0600 Subject: [PATCH 0142/3886] mb/google/cyan: Set SYSTEM_TYPE_CONVERTIBLE for cyan/kefka Cyan and Kefka are convertible devices, so set them as such so their SMBIOS type is set correctly, necessary for some Linux tablet drivers. Change-Id: Ief81c7ba83eb5326dd6199508a3194008dee243b Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86457 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/mainboard/google/cyan/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/google/cyan/Kconfig b/src/mainboard/google/cyan/Kconfig index 2bb6b9238c..eacc8ef87d 100644 --- a/src/mainboard/google/cyan/Kconfig +++ b/src/mainboard/google/cyan/Kconfig @@ -29,12 +29,14 @@ config BOARD_GOOGLE_CELES config BOARD_GOOGLE_CYAN select BOARD_GOOGLE_BASEBOARD_CYAN + select SYSTEM_TYPE_CONVERTIBLE config BOARD_GOOGLE_EDGAR select BOARD_GOOGLE_BASEBOARD_CYAN config BOARD_GOOGLE_KEFKA select BOARD_GOOGLE_BASEBOARD_CYAN + select SYSTEM_TYPE_CONVERTIBLE config BOARD_GOOGLE_REKS select BOARD_GOOGLE_BASEBOARD_CYAN From 2974781987e83dee014bcc3a02c9099bbe6da8aa Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 15:12:00 -0600 Subject: [PATCH 0143/3886] mb/google/fizz: Set SMBIOS system type Fizz variants will now correctly show their SMBIOS type as an all-in-one (karma) or a mini-pc (all other variants) rather than the default desktop type. Change-Id: Ida61c68d3664115ca29cb11e6820edb1496e4709 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86458 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/mainboard/google/fizz/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/google/fizz/Kconfig b/src/mainboard/google/fizz/Kconfig index 44ea908fda..84a514566e 100644 --- a/src/mainboard/google/fizz/Kconfig +++ b/src/mainboard/google/fizz/Kconfig @@ -24,6 +24,7 @@ config BOARD_GOOGLE_BASEBOARD_FIZZ select RT8168_GET_MAC_FROM_VPD select RT8168_SUPPORT_LEGACY_VPD_MAC select RT8168_SET_LED_MODE + select SYSTEM_TYPE_MINIPC if !SYSTEM_TYPE_ALL_IN_ONE select TPM_GOOGLE_CR50 config BOARD_GOOGLE_FIZZ @@ -34,6 +35,7 @@ config BOARD_GOOGLE_KARMA select DRIVERS_GENERIC_MAX98357A select DRIVERS_I2C_DA7219 select EXCLUDE_NATIVE_SD_INTERFACE + select SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_ENDEAVOUR select BOARD_GOOGLE_BASEBOARD_FIZZ From a06faf96873ad1005010ef44d65b3fbbc0546b77 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 15:14:04 -0600 Subject: [PATCH 0144/3886] mb/google/jecht: Set SMBIOS system type Jecht variants will now correctly show their SMBIOS type as mini-pc rather than the default desktop type. Change-Id: I4f1be147bcfdad6247101db5b5943301466e60ad Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86459 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/google/jecht/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/jecht/Kconfig b/src/mainboard/google/jecht/Kconfig index c8cf7d61ca..eb3b985e5a 100644 --- a/src/mainboard/google/jecht/Kconfig +++ b/src/mainboard/google/jecht/Kconfig @@ -13,6 +13,7 @@ config BOARD_GOOGLE_BASEBOARD_JECHT select MAINBOARD_HAS_TPM1 select SOC_INTEL_BROADWELL select SUPERIO_ITE_IT8772F + select SYSTEM_TYPE_MINIPC config BOARD_GOOGLE_GUADO select BOARD_GOOGLE_BASEBOARD_JECHT From 77d50109bbb54076b4dfbf9aa8badda79d051c66 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 15:21:52 -0600 Subject: [PATCH 0145/3886] mb/google/puff: Set SMBIOS system type Puff variants will now correctly show their SMBIOS type as an all-in-one (dooly, scout) or a mini-pc (all other variants) rather than the default desktop type. Change-Id: Id24ff40f0aacade359f281def8be2a41c752d0d6 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86460 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/google/puff/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainboard/google/puff/Kconfig b/src/mainboard/google/puff/Kconfig index 0abe53a10e..3e64f05388 100644 --- a/src/mainboard/google/puff/Kconfig +++ b/src/mainboard/google/puff/Kconfig @@ -35,6 +35,7 @@ config BOARD_GOOGLE_BASEBOARD_PUFF select SPD_CACHE_IN_FMAP select SPD_READ_BY_WORD select SPI_TPM + select SYSTEM_TYPE_MINIPC if !SYSTEM_TYPE_ALL_IN_ONE select TPM_GOOGLE_CR50 config BOARD_GOOGLE_AMBASSADOR @@ -44,6 +45,7 @@ config BOARD_GOOGLE_AMBASSADOR config BOARD_GOOGLE_DOOLY select BOARD_GOOGLE_BASEBOARD_PUFF select INTEL_GMA_HAVE_VBT + select SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_DUFFY_LEGACY select BOARD_GOOGLE_BASEBOARD_PUFF @@ -85,6 +87,7 @@ config BOARD_GOOGLE_PUFF config BOARD_GOOGLE_SCOUT select BOARD_GOOGLE_BASEBOARD_PUFF + select SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_WYVERN select BOARD_GOOGLE_BASEBOARD_PUFF From ab24ddbb49c4c63125121acaa0304587f88065c2 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 15:22:59 -0600 Subject: [PATCH 0146/3886] mb/google/puff: Add missing device names to Kconfig.name Taken from: https://dl.google.com/dl/edgedl/chromeos/recovery/recovery2.json https://dl.google.com/dl/edgedl/chromeos/recovery/workspaceHardware_recovery2.json Change-Id: I1da5c129c3912b4158bdc5349eb038265f80bf85 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86461 Reviewed-by: Andy Ebrahiem Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/google/puff/Kconfig.name | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mainboard/google/puff/Kconfig.name b/src/mainboard/google/puff/Kconfig.name index fe35e0697b..fa5b0f5ee6 100644 --- a/src/mainboard/google/puff/Kconfig.name +++ b/src/mainboard/google/puff/Kconfig.name @@ -3,10 +3,10 @@ comment "Puff" config BOARD_GOOGLE_AMBASSADOR - bool "-> Ambassador" + bool "-> Ambassador (Meet Compute System [Intel 10th Gen])" config BOARD_GOOGLE_DOOLY - bool "-> Dooly" + bool "-> Dooly (HP Chromebase 21.5)" config BOARD_GOOGLE_DUFFY_LEGACY bool "-> Duffy Legacy (32MB)" @@ -18,7 +18,7 @@ config BOARD_GOOGLE_FAFFY bool "-> Faffy (ASUS Fanless Chromebox)" config BOARD_GOOGLE_GENESIS - bool "-> Genesis" + bool "-> Genesis (Meet Compute System - Series One [Intel 10th Gen])" config BOARD_GOOGLE_KAISA_LEGACY bool "-> Kaisa Legacy (32MB)" @@ -27,7 +27,7 @@ config BOARD_GOOGLE_KAISA bool "-> Kaisa (Acer Chromebox CXI4)" config BOARD_GOOGLE_MOONBUGGY - bool "-> Moonbuggy" + bool "-> Moonbuggy (Series One Board 65)" config BOARD_GOOGLE_NOIBAT bool "-> Noibat (HP Chromebox G3)" @@ -36,7 +36,7 @@ config BOARD_GOOGLE_PUFF bool "-> Puff" config BOARD_GOOGLE_SCOUT - bool "-> Scout" + bool "-> Scout (Series One Desk 27)" config BOARD_GOOGLE_WYVERN bool "-> Wyvern (CTL Chromebox CBx2)" From 3e062c82709ba28a95c33640a70d916c6c23086b Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 15:26:40 -0600 Subject: [PATCH 0147/3886] mb/google/rambi: Set system type for ninja/sumo variants Set these to minipc and all-in-one respectively now that these system types exist, so that the SMBIOS enclosure type is correctly set vs defaulting to desktop. Change-Id: I661401dcd7fe348a07e34ace309c0a8b7e0f00eb Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86462 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/google/rambi/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/google/rambi/Kconfig b/src/mainboard/google/rambi/Kconfig index 65339e02e4..750eba1e30 100644 --- a/src/mainboard/google/rambi/Kconfig +++ b/src/mainboard/google/rambi/Kconfig @@ -63,6 +63,7 @@ config BOARD_GOOGLE_KIP config BOARD_GOOGLE_NINJA select BOARD_GOOGLE_BASEBOARD_RAMBI select INTEL_GMA_HAVE_VBT + select SYSTEM_TYPE_MINIPC config BOARD_GOOGLE_ORCO select BOARD_GOOGLE_BASEBOARD_RAMBI @@ -86,6 +87,7 @@ config BOARD_GOOGLE_RAMBI config BOARD_GOOGLE_SUMO select BOARD_GOOGLE_BASEBOARD_RAMBI select INTEL_GMA_HAVE_VBT + select SYSTEM_TYPE_ALL_IN_ONE config BOARD_GOOGLE_SWANKY select BOARD_GOOGLE_BASEBOARD_RAMBI From 2320593a3ba51a6caa7af0afdb261db77aa75b5b Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 18:07:34 -0600 Subject: [PATCH 0148/3886] mb/google/glados/var/cave: Set SYSTEM_TYPE_CONVERTIBLE Cave is a 2-in-1 device, this sets the SMBIOS enclosure type properly. Change-Id: I8f2ec82c97676aa315c18286b5e2eb94d46004ec Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86467 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer Reviewed-by: Andy Ebrahiem --- src/mainboard/google/glados/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/glados/Kconfig b/src/mainboard/google/glados/Kconfig index 57d54d0be8..287d938341 100644 --- a/src/mainboard/google/glados/Kconfig +++ b/src/mainboard/google/glados/Kconfig @@ -20,7 +20,7 @@ config BOARD_GOOGLE_BASEBOARD_GLADOS select MEMORY_MAPPED_TPM select MAINBOARD_HAS_TPM1 select SOC_INTEL_SKYLAKE - select SYSTEM_TYPE_LAPTOP + select SYSTEM_TYPE_LAPTOP if !SYSTEM_TYPE_CONVERTIBLE config BOARD_GOOGLE_ASUKA select BOARD_GOOGLE_BASEBOARD_GLADOS @@ -43,6 +43,7 @@ config BOARD_GOOGLE_CAVE select INTEL_GMA_HAVE_VBT select MAINBOARD_NO_FSP_GOP select NHLT_MAX98357 if INCLUDE_NHLT_BLOBS + select SYSTEM_TYPE_CONVERTIBLE config BOARD_GOOGLE_CHELL select BOARD_GOOGLE_BASEBOARD_GLADOS From c5a0beed9a456cb32302a36e757c54a86ccced5f Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 16 Feb 2025 18:09:38 -0600 Subject: [PATCH 0149/3886] mb/google/skyrim/var/frostflow: Set SYSTEM_TYPE_CONVERTIBLE Frostflow is a 2-in-1 device, this sets the SMBIOS enclosure type properly. Change-Id: I6c3306270cbc80bb55fb536a1fc51a5546287649 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86468 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/google/skyrim/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/skyrim/Kconfig b/src/mainboard/google/skyrim/Kconfig index dc28fbca72..756db5f69a 100644 --- a/src/mainboard/google/skyrim/Kconfig +++ b/src/mainboard/google/skyrim/Kconfig @@ -11,6 +11,7 @@ config BOARD_GOOGLE_FROSTFLOW select DRIVERS_GENESYSLOGIC_GL9755 select FEATURE_TABLET_MODE_DPTC select SOC_AMD_COMMON_BLOCK_ACPI_DPTC + select SYSTEM_TYPE_CONVERTIBLE config BOARD_GOOGLE_MARKARTH select BOARD_GOOGLE_BASEBOARD_SKYRIM @@ -67,7 +68,7 @@ config BOARD_SPECIFIC_OPTIONS select SOC_AMD_COMMON_BLOCK_I2C3_TPM_SHARED_WITH_PSP select SOC_AMD_COMMON_BLOCK_USE_ESPI select SOC_AMD_GFX_CACHE_VBIOS_IN_FMAP if CHROMEOS && RUN_FSP_GOP - select SYSTEM_TYPE_LAPTOP + select SYSTEM_TYPE_LAPTOP if !SYSTEM_TYPE_CONVERTIBLE select TPM_GOOGLE_TI50 config DEVICETREE From 61b99e9527ff836d62e5765c6df81893ba6573c9 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 11:19:17 +0000 Subject: [PATCH 0150/3886] mb/starlabs/starbook/mtl: Correct HDMI HPD GPIO config This GPIO should be NF2, not NF1. Change-Id: I012acfa43ada5641b37f38892a1e3bfbc6e74843 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86495 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/mtl/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c index e64baa3a9a..f95109418f 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c @@ -428,7 +428,7 @@ const struct pad_config gpio_table[] = { /* B15: */ PAD_NC(GPP_B15, NONE), /* B16: DDIB_DP_HPD */ - PAD_CFG_NF(GPP_B16, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_B16, NONE, DEEP, NF2), /* B17: */ PAD_NC(GPP_B17, NONE), /* B18: BT_RF_KILL_N */ From 1f2bb567af019be6490a4399e0ca75364e31920f Mon Sep 17 00:00:00 2001 From: Rui Zhou Date: Mon, 17 Feb 2025 17:06:18 +0800 Subject: [PATCH 0151/3886] mb/google/nissa/var/rull: Adjust SSD power sequencing to give the SSD more preparation time Improve SSD reset time by enabling earlier sequencing, save 230ms BUG=b:397098950 TEST=build and boot normal using NVMe Change-Id: I2e48a6614e8bded36d03138869b0eba7e1acb567 Signed-off-by: Rui Zhou Reviewed-on: https://review.coreboot.org/c/coreboot/+/86483 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Eric Lai --- src/mainboard/google/brya/variants/rull/gpio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/google/brya/variants/rull/gpio.c b/src/mainboard/google/brya/variants/rull/gpio.c index 81bd2800b1..24096d73bc 100644 --- a/src/mainboard/google/brya/variants/rull/gpio.c +++ b/src/mainboard/google/brya/variants/rull/gpio.c @@ -141,6 +141,8 @@ static const struct pad_config early_gpio_table[] = { }; static const struct pad_config romstage_gpio_table[] = { + /* B4 : SSD_PERST_L */ + PAD_CFG_GPO(GPP_B4, 1, DEEP), }; const struct pad_config *variant_gpio_override_table(size_t *num) From 71b62486022073a7e129baaa7546a516bbc197a3 Mon Sep 17 00:00:00 2001 From: John Su Date: Fri, 7 Feb 2025 00:26:33 +0800 Subject: [PATCH 0152/3886] mb/google/trulo/var/uldrenite: Add FW_CONFIG probe for fivr Uldrenite will support internal fivr in next phase and using fw_config to decide the board with internal or external fivr. BUG=b:394752422 BRANCH=firmware-trulo-15217.771.B TEST=boot to ChromeOS, cold reboot/suspend/recovery mode/install OS work normally Change-Id: I14233090f2445461cf422c1257f21556fd745b43 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86303 Reviewed-by: Dtrain Hsu Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- .../brya/variants/uldrenite/overridetree.cb | 19 ++++----------- .../google/brya/variants/uldrenite/variant.c | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb index dd129d7b9e..fdc933eb3b 100644 --- a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb +++ b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb @@ -3,6 +3,10 @@ fw_config option CELLULAR_ABSENT 0 option CELLULAR_RW350R 1 end + field EXT_VR 3 3 + option EXT_VR_PRESENT 0 + option EXT_VR_ABSENT 1 + end field TOUCHSCREEN 4 4 option TOUCHSCREEN_UNKNOWN 0 option TOUCHSCREEN_NONE 1 @@ -100,21 +104,6 @@ chip soc/intel/alderlake register "pch_hda_idisp_link_frequency" = "HDA_LINKFREQ_96MHZ" register "pch_hda_idisp_codec_enable" = "1" - # Configure external V1P05/Vnn/VnnSx Rails - register "ext_fivr_settings" = "{ - .configure_ext_fivr = 1, - .v1p05_enable_bitmap = FIVR_ENABLE_ALL_SX & ~FIVR_ENABLE_S0, - .vnn_enable_bitmap = FIVR_ENABLE_ALL_SX, - .vnn_sx_enable_bitmap = FIVR_ENABLE_ALL_SX, - .v1p05_supported_voltage_bitmap = FIVR_VOLTAGE_NORMAL, - .vnn_supported_voltage_bitmap = FIVR_VOLTAGE_MIN_ACTIVE, - .v1p05_voltage_mv = 1050, - .vnn_voltage_mv = 780, - .vnn_sx_voltage_mv = 1050, - .v1p05_icc_max_ma = 500, - .vnn_icc_max_ma = 500, - }" - register "serial_io_i2c_mode" = "{ [PchSerialIoIndexI2C0] = PchSerialIoPci, [PchSerialIoIndexI2C1] = PchSerialIoPci, diff --git a/src/mainboard/google/brya/variants/uldrenite/variant.c b/src/mainboard/google/brya/variants/uldrenite/variant.c index 41ab7b8c14..3620c3a0c8 100644 --- a/src/mainboard/google/brya/variants/uldrenite/variant.c +++ b/src/mainboard/google/brya/variants/uldrenite/variant.c @@ -83,3 +83,27 @@ void variant_init(void) mdelay(RW350R_PERST_DELAY_MS); gpio_configure_pads(rw350r_perst_pad, ARRAY_SIZE(rw350r_perst_pad)); } + +void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config) +{ + if (fw_config_probe(FW_CONFIG(EXT_VR, EXT_VR_PRESENT))) { + /* # Configure external V1P05/Vnn/VnnSx Rails */ + config->ext_fivr_settings.configure_ext_fivr = 1; + config->ext_fivr_settings.v1p05_enable_bitmap = + FIVR_ENABLE_ALL_SX & ~FIVR_ENABLE_S0; + config->ext_fivr_settings.vnn_enable_bitmap = + FIVR_ENABLE_ALL_SX; + config->ext_fivr_settings.vnn_sx_enable_bitmap = + FIVR_ENABLE_ALL_SX; + config->ext_fivr_settings.v1p05_supported_voltage_bitmap = + FIVR_VOLTAGE_NORMAL; + config->ext_fivr_settings.vnn_supported_voltage_bitmap = + FIVR_VOLTAGE_MIN_ACTIVE; + config->ext_fivr_settings.v1p05_voltage_mv = 1050; + config->ext_fivr_settings.vnn_voltage_mv = 780; + config->ext_fivr_settings.vnn_sx_voltage_mv = 1050; + config->ext_fivr_settings.v1p05_icc_max_ma = 500; + config->ext_fivr_settings.vnn_icc_max_ma = 500; + printk(BIOS_INFO, "Configured External FIVR\n"); + } +} From adc53a8837e6872d25fec9da98b6bb7b359eefe1 Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Fri, 7 Feb 2025 17:01:04 +0900 Subject: [PATCH 0153/3886] mb/google/nissa: Create meliks variant Create the meliks variant of the nissa reference board by copying the template files to a new directory named for the variant. (Auto-Generated by create_coreboot_variant.sh version 4.5.0) BUG=b:394359785 BRANCH=None TEST=util/abuild/abuild -p none -t google/brya -x -a make sure the build includes GOOGLE_MELIKS Change-Id: Iff5e27ef06a44976c2724751de0f9c6d5cf6eaaf Signed-off-by: Seunghwan Kim Reviewed-on: https://review.coreboot.org/c/coreboot/+/86373 Reviewed-by: Eric Lai Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/Kconfig | 10 ++++++++++ src/mainboard/google/brya/Kconfig.name | 3 +++ .../google/brya/variants/meliks/include/variant/ec.h | 8 ++++++++ .../brya/variants/meliks/include/variant/gpio.h | 8 ++++++++ .../google/brya/variants/meliks/memory/Makefile.mk | 5 +++++ .../brya/variants/meliks/memory/dram_id.generated.txt | 1 + .../brya/variants/meliks/memory/mem_parts_used.txt | 11 +++++++++++ .../google/brya/variants/meliks/overridetree.cb | 6 ++++++ 8 files changed, 52 insertions(+) create mode 100644 src/mainboard/google/brya/variants/meliks/include/variant/ec.h create mode 100644 src/mainboard/google/brya/variants/meliks/include/variant/gpio.h create mode 100644 src/mainboard/google/brya/variants/meliks/memory/Makefile.mk create mode 100644 src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt create mode 100644 src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt create mode 100644 src/mainboard/google/brya/variants/meliks/overridetree.cb diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 0f1c3c50e6..fd88c1b9f9 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -351,6 +351,12 @@ config BOARD_GOOGLE_MARASOV select SOC_INTEL_RAPTORLAKE select USE_UNIFIED_AP_FIRMWARE_FOR_UFS_AND_NON_UFS +config BOARD_GOOGLE_MELIKS + select BOARD_GOOGLE_BASEBOARD_NISSA + select DRIVERS_I2C_DA7219 + select DRIVERS_INTEL_MIPI_CAMERA + select SOC_INTEL_TWINLAKE + config BOARD_GOOGLE_MITHRAX select BOARD_GOOGLE_BASEBOARD_BRYA select CHROMEOS_WIFI_SAR if CHROMEOS @@ -826,6 +832,7 @@ config DRIVER_TPM_I2C_BUS default 0x1 if BOARD_GOOGLE_ZYDRON default 0x0 if BOARD_GOOGLE_TELITH default 0x0 if BOARD_GOOGLE_PUJJOGATWIN + default 0x0 if BOARD_GOOGLE_MELIKS config DRIVER_TPM_I2C_ADDR hex @@ -909,6 +916,7 @@ config TPM_TIS_ACPI_INTERRUPT default 13 if BOARD_GOOGLE_ZYDRON default 13 if BOARD_GOOGLE_TELITH default 13 if BOARD_GOOGLE_PUJJOGATWIN + default 13 if BOARD_GOOGLE_MELIKS config OVERRIDE_DEVICETREE default "variants/\$(CONFIG_VARIANT_DIR)/overridetree_pujjogatwin.cb" if BOARD_GOOGLE_PUJJOGATWIN @@ -1000,6 +1008,7 @@ config MAINBOARD_PART_NUMBER default "Pujjoga" if BOARD_GOOGLE_PUJJOGA default "Telith" if BOARD_GOOGLE_TELITH default "Pujjogatwin" if BOARD_GOOGLE_PUJJOGATWIN + default "Meliks" if BOARD_GOOGLE_MELIKS config VARIANT_DIR default "agah" if BOARD_GOOGLE_AGAH @@ -1076,6 +1085,7 @@ config VARIANT_DIR default "pujjoga" if BOARD_GOOGLE_PUJJOGA default "telith" if BOARD_GOOGLE_TELITH default "pujjoga" if BOARD_GOOGLE_PUJJOGATWIN + default "meliks" if BOARD_GOOGLE_MELIKS config VBOOT select VBOOT_EARLY_EC_SYNC if !(BOARD_GOOGLE_BASEBOARD_NISSA || BOARD_GOOGLE_BASEBOARD_TRULO) diff --git a/src/mainboard/google/brya/Kconfig.name b/src/mainboard/google/brya/Kconfig.name index db99d326f3..ac4c262d78 100644 --- a/src/mainboard/google/brya/Kconfig.name +++ b/src/mainboard/google/brya/Kconfig.name @@ -223,3 +223,6 @@ config BOARD_GOOGLE_ORISA config BOARD_GOOGLE_TELITH bool "-> Telith" + +config BOARD_GOOGLE_MELIKS + bool "-> Meliks" diff --git a/src/mainboard/google/brya/variants/meliks/include/variant/ec.h b/src/mainboard/google/brya/variants/meliks/include/variant/ec.h new file mode 100644 index 0000000000..7a2a6ff8b7 --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/include/variant/ec.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __VARIANT_EC_H__ +#define __VARIANT_EC_H__ + +#include + +#endif diff --git a/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h b/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h new file mode 100644 index 0000000000..c4fe342621 --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef VARIANT_GPIO_H +#define VARIANT_GPIO_H + +#include + +#endif diff --git a/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk b/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk new file mode 100644 index 0000000000..eace2e443e --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# This is an auto-generated file. Do not edit!! +# Add memory parts in mem_parts_used.txt and run spd_tools to regenerate. + +SPD_SOURCES = placeholder diff --git a/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt b/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt new file mode 100644 index 0000000000..fa247902ee --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt @@ -0,0 +1 @@ +DRAM Part Name ID to assign diff --git a/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt b/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt new file mode 100644 index 0000000000..2499005682 --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt @@ -0,0 +1,11 @@ +# This is a CSV file containing a list of memory parts used by this variant. +# One part per line with an optional fixed ID in column 2. +# Only include a fixed ID if it is required for legacy reasons! +# Generated IDs are dependent on the order of parts in this file, +# so new parts must always be added at the end of the file! +# +# Generate an updated Makefile.mk and dram_id.generated.txt by running the +# part_id_gen tool from util/spd_tools. +# See util/spd_tools/README.md for more details and instructions. + +# Part Name diff --git a/src/mainboard/google/brya/variants/meliks/overridetree.cb b/src/mainboard/google/brya/variants/meliks/overridetree.cb new file mode 100644 index 0000000000..4f2c04a57a --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/overridetree.cb @@ -0,0 +1,6 @@ +chip soc/intel/alderlake + + device domain 0 on + end + +end From 804d2c8306947cbb90ec44f302231a3e35bb86cb Mon Sep 17 00:00:00 2001 From: John Su Date: Wed, 19 Feb 2025 01:58:12 +0800 Subject: [PATCH 0154/3886] mb/trulo/var/uldrenite: Decrease ROM size to 16MB According to the design, the SPI ROM will be replaced with a 16MB size, so the Kconfig is modified to 16MB. BUG=b:397372760 TEST=emerge-nissa coreboot and check rom size is 16MB Change-Id: I3ef1aa2401d44259e4301f65e2ba0ac7b9418bbd Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86501 Reviewed-by: Dtrain Hsu Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index fd88c1b9f9..aac2393017 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -656,7 +656,6 @@ config BOARD_GOOGLE_ULDREN config BOARD_GOOGLE_ULDRENITE select BOARD_GOOGLE_BASEBOARD_TRULO - select BOARD_ROMSIZE_KB_32768 select CHROMEOS_WIFI_SAR if CHROMEOS select DRIVERS_WWAN_FM350GL select ENFORCE_MEM_CHANNEL_DISABLE From a0d0327685b47ea74e77afb2d13465c04629b055 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 19 Feb 2025 19:45:24 +0000 Subject: [PATCH 0155/3886] mb/starlabs/starbook/{kbl,cml}: Unselect LIBGFXINIT Unselect LIBGFXINIT to bring these two variants inline with the others. Change-Id: If0fdc9ffd391f2710f252be7358d87644a77b36a Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86515 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mainboard/starlabs/starbook/Kconfig b/src/mainboard/starlabs/starbook/Kconfig index 1565f88290..e4e4c63c9f 100644 --- a/src/mainboard/starlabs/starbook/Kconfig +++ b/src/mainboard/starlabs/starbook/Kconfig @@ -24,7 +24,6 @@ config BOARD_STARLABS_LABTOP_KBL select CRB_TPM select HAVE_INTEL_PTT select HAVE_SPD_IN_CBFS - select MAINBOARD_HAS_LIBGFXINIT select SOC_INTEL_KABYLAKE select SPI_FLASH_GIGADEVICE select TPM2 @@ -41,7 +40,6 @@ config BOARD_STARLABS_LABTOP_CML select HAVE_INTEL_PTT select HAVE_SPD_IN_CBFS select CRB_TPM - select MAINBOARD_HAS_LIBGFXINIT select SOC_INTEL_COMETLAKE_1 select SPI_FLASH_WINBOND select TPM2 From 0438858b2122d567b3e197561c80722878ba34ab Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 10 Feb 2025 16:20:52 +0000 Subject: [PATCH 0156/3886] mb/starlabs/starbook_adl_n: Fix USB port assignments/descriptions Fix USB port assignments/descriptions to match actual topology. TEST=build/boot Win11 on starlabs/starbook_adl_n. Verify ports match assignmented in devicetree using USBTreeview. Change-Id: If0b341f1c5f99b53df8fff69f8a58fa732adbbc4 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86346 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- .../starbook/variants/adl_n/devicetree.cb | 43 +++++-------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb b/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb index d84c243767..2c66936923 100644 --- a/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb @@ -37,23 +37,19 @@ chip soc/intel/alderlake [DDI_PORT_1] = DDI_ENABLE_HPD, }" end - device ref gna on end - device ref xhci on + device ref gna on end + device ref xhci on # Motherboard USB 3.0 Type-C Front 9557 mil - register "usb2_ports[1]" = "USB2_PORT_TYPE_C(OC_SKIP)" - register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC_SKIP)" - - # Motherboard USB 3.0 Type-C Back 7893 mil register "usb2_ports[2]" = "USB2_PORT_TYPE_C(OC_SKIP)" - register "usb3_ports[3]" = "USB3_PORT_DEFAULT(OC_SKIP)" + register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Motherboard USB 3.0 Type-A 8916 mil register "usb2_ports[6]" = "USB2_PORT_MID(OC_SKIP)" - register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" + register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Daughterboard USB 3.0 Type-A 2229 mil register "usb2_ports[0]" = "USB2_PORT_SHORT(OC_SKIP)" - register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC_SKIP)" + register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Internal Webcam 9070 mil register "usb2_ports[CONFIG_CCD_PORT]" = "USB2_PORT_MID(OC_SKIP)" @@ -66,18 +62,6 @@ chip soc/intel/alderlake chip drivers/usb/acpi device ref xhci_root_hub on - chip drivers/usb/acpi - register "desc" = ""Back USB Type-C"" - register "type" = "UPC_TYPE_C_USB2_SS" - register "group" = "ACPI_PLD_GROUP(0, 0)" - device ref usb2_port2 on end - end - chip drivers/usb/acpi - register "desc" = ""Back USB Type-C"" - register "type" = "UPC_TYPE_C_USB2_SS" - register "group" = "ACPI_PLD_GROUP(0, 0)" - device ref usb3_port3 on end - end chip drivers/usb/acpi register "desc" = ""Front USB Type-C"" register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" @@ -88,7 +72,7 @@ chip soc/intel/alderlake register "desc" = ""Front USB Type-C"" register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "group" = "ACPI_PLD_GROUP(0, 1)" - device ref usb3_port4 on end + device ref usb3_port3 on end end chip drivers/usb/acpi register "desc" = ""Left USB Type-A"" @@ -100,7 +84,7 @@ chip soc/intel/alderlake register "desc" = ""Left USB Type-A"" register "type" = "UPC_TYPE_USB3_A" register "group" = "ACPI_PLD_GROUP(0, 2)" - device ref usb3_port1 on end + device ref usb3_port2 on end end chip drivers/usb/acpi register "desc" = ""Right USB Type-A"" @@ -112,7 +96,7 @@ chip soc/intel/alderlake register "desc" = ""Right USB Type-A"" register "type" = "UPC_TYPE_USB3_A" register "group" = "ACPI_PLD_GROUP(0, 3)" - device ref usb3_port2 on end + device ref usb3_port1 on end end chip drivers/usb/acpi register "desc" = ""Internal Webcam"" @@ -205,8 +189,8 @@ chip soc/intel/alderlake device ref uart0 on end device ref pch_espi on register "gen1_dec" = "0x00040069" - register "gen2_dec" = "0x00fc0e01" - register "gen3_dec" = "0x00fc0f01" + register "gen2_dec" = "0x00040069" + register "gen3_dec" = "0x00040069" chip drivers/pc80/tpm device pnp 0c31.0 on end @@ -239,15 +223,10 @@ chip soc/intel/alderlake chip drivers/intel/pmc_mux device generic 0 on chip drivers/intel/pmc_mux/conn - use usb2_port2 as usb2_port + use usb2_port3 as usb2_port use usb3_port3 as usb3_port device generic 0 alias conn0 on end end - chip drivers/intel/pmc_mux/conn - use usb2_port3 as usb2_port - use usb3_port4 as usb3_port - device generic 1 alias conn1 on end - end end end end From 9495063993e32345b138fa99631d03309f3506f1 Mon Sep 17 00:00:00 2001 From: Zhixing Ma Date: Mon, 13 Jan 2025 13:20:12 -0800 Subject: [PATCH 0157/3886] mainboard/google/fatcat: Fix SMBIOS Processor upgrade info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current SMBIOS for fatcat is missing processor upgrade information. This patch adds the missing value by enabling kconfig flag CPU_INTEL_SOCKET_OTHER. Refer to SMBIOS spec sheet for documentation on cpu socket values: https://web.archive.org/web/20221012222420/https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.6.0.pdf Output of dmidecode: Handle 0x0004, DMI type 4, 48 bytes Processor Information Socket Designation: CPU0 Type: Central Processor Family: Pentium Pro Manufacturer: GenuineIntel ID: C0 06 0C 00 FF FB EB BF Signature: Type 0, Family 6, Model 204, Stepping 0 Flags: ... Version: Genuine Intel(R) 0000 Voltage: Unknown External Clock: 100 MHz Max Speed: 3200 MHz Current Speed: 3000 MHz Status: Populated, Enabled - Upgrade: Unknown + Upgrade: Other BUG=NONE TEST=Boot and verified that SMBIOS processor upgrade value is correct. Change-Id: Ica92d15e4a6123f928fceb77c7638e4c45d6dc7d Signed-off-by: Zhixing Ma Reviewed-on: https://review.coreboot.org/c/coreboot/+/85960 Tested-by: build bot (Jenkins) Reviewed-by: Jérémy Compostella Reviewed-by: Bora Guvendik --- src/mainboard/google/fatcat/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/fatcat/Kconfig b/src/mainboard/google/fatcat/Kconfig index e82081d822..13d791a812 100644 --- a/src/mainboard/google/fatcat/Kconfig +++ b/src/mainboard/google/fatcat/Kconfig @@ -3,6 +3,7 @@ config BOARD_GOOGLE_FATCAT_COMMON def_bool n select BOARD_ROMSIZE_KB_32768 + select CPU_INTEL_SOCKET_OTHER select DRIVERS_GFX_GENERIC select DRIVERS_I2C_GENERIC select DRIVERS_I2C_HID From 4b1c4e7ee8fc1cceed8569baed7ba5456e075942 Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Fri, 20 Sep 2024 17:55:32 +0800 Subject: [PATCH 0158/3886] amdfwtool: Reorder the PSP L2 and BIOS L2 for A/B recovery For A/B recovery, it is better, even though it is not mandatory, to put BIOS level 2 table next to its PSP level2. So the relative addresses of BIOS table are the same. So all the data in B could be a copy of A. Identical binary test on all non A/B recovery platform. Booting test on Majolica with A/B recovery enabled. Change-Id: Ia25277d307329a2fa66d38d1a7fc21b18246cfe6 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/84440 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- util/amdfwtool/amdfwtool.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 42d13d8aa8..0de0475b9a 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1770,11 +1770,17 @@ int main(int argc, char **argv) /* Do 2nd PSP directory followed by 1st */ integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); + if (cb_config.recovery_ab) + integrate_bios_firmwares(&ctx, + amd_bios_table, BHDL2_COOKIE, &cb_config); + if (cb_config.recovery_ab && !cb_config.recovery_ab_single_copy) { /* Create a copy of PSP Directory 2 in the backup slot B. Related biosdir2_b copy will be created later. */ integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); + integrate_bios_firmwares(&ctx, + amd_bios_table, BHDL2_COOKIE, &cb_config); } else { /* * Either the platform is using only @@ -1790,6 +1796,8 @@ int main(int argc, char **argv) integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSP_COOKIE, &cb_config); integrate_psp_levels(&ctx, &cb_config); + if (cb_config.recovery_ab) + integrate_bios_levels(&ctx, &cb_config); } else { /* flat: PSP 1 cookie and no pointer to 2nd table */ integrate_psp_firmwares(&ctx, @@ -1805,21 +1813,13 @@ int main(int argc, char **argv) add_combo_entry(ctx.psp_combo_dir, ctx.pspdir, combo_index, &ctx, &cb_config); } - if (have_bios_tables(amd_bios_table)) { + if (have_bios_tables(amd_bios_table) && !cb_config.recovery_ab) { if (cb_config.multi_level) { /* Do 2nd level BIOS directory followed by 1st */ integrate_bios_firmwares(&ctx, amd_bios_table, BHDL2_COOKIE, &cb_config); - if (cb_config.recovery_ab) { - if (ctx.pspdir2_b != NULL) { - integrate_bios_firmwares(&ctx, - amd_bios_table, BHDL2_COOKIE, - &cb_config); - } - } else { - integrate_bios_firmwares(&ctx, + integrate_bios_firmwares(&ctx, amd_bios_table, BHD_COOKIE, &cb_config); - } integrate_bios_levels(&ctx, &cb_config); } else { /* flat: BHD1 cookie and no pointer to 2nd table */ From daf32b75c6f1a3dca782998ea405429a97a7936c Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Sat, 21 Sep 2024 11:22:11 +0800 Subject: [PATCH 0159/3886] amdfwtool: Merge all the steps for A/B recovery into one branch Clean up the code to make it more logical. This is for later changes to reorder the PSP Level 1, Level 2, ISH and BIOS tables. TEST=Identical test on all AMD platform Change-Id: I5f7213fd42c7f0ff5ecd9e504a6654cdfb1e3513 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/84531 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwtool.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 0de0475b9a..89aff6aaa7 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1770,34 +1770,21 @@ int main(int argc, char **argv) /* Do 2nd PSP directory followed by 1st */ integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); - if (cb_config.recovery_ab) + if (cb_config.recovery_ab) { integrate_bios_firmwares(&ctx, amd_bios_table, BHDL2_COOKIE, &cb_config); - - if (cb_config.recovery_ab && !cb_config.recovery_ab_single_copy) { - /* Create a copy of PSP Directory 2 in the backup slot B. - Related biosdir2_b copy will be created later. */ - integrate_psp_firmwares(&ctx, + if (!cb_config.recovery_ab_single_copy) { + integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); - integrate_bios_firmwares(&ctx, + integrate_bios_firmwares(&ctx, amd_bios_table, BHDL2_COOKIE, &cb_config); - } else { - /* - * Either the platform is using only - * one slot or B is same as above - * directories for A. Skip creating - * pspdir2_b here to save flash space. - * Related biosdir2_b will be skipped - * automatically. - */ - ctx.pspdir2_b = NULL; /* More explicitly */ + } + integrate_bios_levels(&ctx, &cb_config); } if (!cb_config.combo_new_rab || combo_index == 0) integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSP_COOKIE, &cb_config); integrate_psp_levels(&ctx, &cb_config); - if (cb_config.recovery_ab) - integrate_bios_levels(&ctx, &cb_config); } else { /* flat: PSP 1 cookie and no pointer to 2nd table */ integrate_psp_firmwares(&ctx, From 018c9a6388a650806799031ca5b1a9f9fef78bfa Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Sat, 14 Dec 2024 09:04:14 +0800 Subject: [PATCH 0160/3886] amdfwtool: Add combo_index into context We need to know how many combo entries have been processed. It will be checked in functions in later change. Change-Id: I4b026b0630a18d1f46bff98ffe5f11e7f930d7a8 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/85590 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwtool.c | 27 +++++++++++++-------------- util/amdfwtool/amdfwtool.h | 1 + 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 89aff6aaa7..7b5e70e3c3 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1628,7 +1628,6 @@ static bool needs_new_combo_layout(enum platform soc_id) int main(int argc, char **argv) { int retval = 0; - int combo_index = 0; int targetfd; context ctx = { 0 }; uint32_t romsig_offset; @@ -1719,17 +1718,17 @@ int main(int argc, char **argv) ctx.bhd_combo_dir = new_combo_dir(&ctx, BHD2_COOKIE); } - combo_index = 0; + ctx.combo_index = 0; if (cb_config.config) cb_config.combo_config[0] = cb_config.config; do { if (cb_config.use_combo && cb_config.debug) - printf("Processing %dth combo entry\n", combo_index); + printf("Processing %dth combo entry\n", ctx.combo_index); /* The pspdir level 1 is special. For new combo layout, all the combo entries share one pspdir L1. It should not be cleared at each iteration. */ - if (!cb_config.combo_new_rab || combo_index == 0) { + if (!cb_config.combo_new_rab || ctx.combo_index == 0) { ctx.pspdir = NULL; ctx.pspdir_bak = NULL; } @@ -1746,14 +1745,14 @@ int main(int argc, char **argv) * and make it clear this will not affect non-combo * case. */ - if (cb_config.use_combo && combo_index > 0) { + if (cb_config.use_combo && ctx.combo_index > 0) { /* Restore the table as clean data. */ memcpy(amd_psp_fw_table, ctx.amd_psp_fw_table_clean, sizeof(amd_psp_fw_table)); memcpy(amd_bios_table, ctx.amd_bios_table_clean, sizeof(amd_bios_table)); - assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); - open_process_config(cb_config.combo_config[combo_index], &cb_config); + assert_fw_entry(ctx.combo_index, MAX_COMBO_ENTRIES, &ctx); + open_process_config(cb_config.combo_config[ctx.combo_index], &cb_config); /* In most cases, the address modes are same. */ if (cb_config.need_ish) @@ -1763,7 +1762,7 @@ int main(int argc, char **argv) else ctx.address_mode = AMD_ADDR_PHYSICAL; - register_apcb_combo(&cb_config, combo_index, &ctx); + register_apcb_combo(&cb_config, ctx.combo_index, &ctx); } if (cb_config.multi_level) { @@ -1781,7 +1780,7 @@ int main(int argc, char **argv) } integrate_bios_levels(&ctx, &cb_config); } - if (!cb_config.combo_new_rab || combo_index == 0) + if (!cb_config.combo_new_rab || ctx.combo_index == 0) integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSP_COOKIE, &cb_config); integrate_psp_levels(&ctx, &cb_config); @@ -1791,13 +1790,13 @@ int main(int argc, char **argv) amd_psp_fw_table, PSP_COOKIE, &cb_config); } - if (!cb_config.use_combo || (cb_config.combo_new_rab && combo_index == 0)) { + if (!cb_config.use_combo || (cb_config.combo_new_rab && ctx.combo_index == 0)) { /* For new combo layout, there is only 1 PSP level 1 directory. */ fill_psp_directory_to_efs(ctx.amd_romsig_ptr, ctx.pspdir, &ctx, &cb_config); fill_psp_bak_directory_to_efs(ctx.amd_romsig_ptr, ctx.pspdir_bak, &ctx, &cb_config); } else if (cb_config.use_combo && !cb_config.combo_new_rab) { fill_psp_directory_to_efs(ctx.amd_romsig_ptr, ctx.psp_combo_dir, &ctx, &cb_config); - add_combo_entry(ctx.psp_combo_dir, ctx.pspdir, combo_index, &ctx, &cb_config); + add_combo_entry(ctx.psp_combo_dir, ctx.pspdir, ctx.combo_index, &ctx, &cb_config); } if (have_bios_tables(amd_bios_table) && !cb_config.recovery_ab) { @@ -1822,13 +1821,13 @@ int main(int argc, char **argv) */ fill_bios_directory_to_efs(ctx.amd_romsig_ptr, ctx.bhd_combo_dir, &ctx, &cb_config); - add_combo_entry(ctx.bhd_combo_dir, ctx.biosdir, combo_index, &ctx, &cb_config); + add_combo_entry(ctx.bhd_combo_dir, ctx.biosdir, ctx.combo_index, &ctx, &cb_config); } } if (cb_config.debug) dump_image_addresses(&ctx); - } while (cb_config.use_combo && ++combo_index < MAX_COMBO_ENTRIES && - cb_config.combo_config[combo_index] != NULL); + } while (cb_config.use_combo && ++ctx.combo_index < MAX_COMBO_ENTRIES && + cb_config.combo_config[ctx.combo_index] != NULL); targetfd = open(cb_config.output, O_RDWR | O_CREAT | O_TRUNC, 0666); if (targetfd >= 0) { diff --git a/util/amdfwtool/amdfwtool.h b/util/amdfwtool/amdfwtool.h index f87fbf56ce..3c773f70d5 100644 --- a/util/amdfwtool/amdfwtool.h +++ b/util/amdfwtool/amdfwtool.h @@ -447,6 +447,7 @@ typedef struct _context { uint32_t current; /* pointer within flash & proxy buffer */ uint32_t current_pointer_saved; uint32_t current_table; + uint32_t combo_index; void *amd_psp_fw_table_clean; void *amd_bios_table_clean; struct _combo_apcb { From b1fb0dff2477a01fbe20fa22fe580f84972a091b Mon Sep 17 00:00:00 2001 From: Tongtong Pan Date: Fri, 21 Feb 2025 10:46:49 +0800 Subject: [PATCH 0161/3886] mb/google/fatcat/var/felino: Enable CNVi wifi core Enable CNVi wifi core for felino. BUG=b:388982526 TEST=abuild -v -a -x -c max -p none -t google/fatcat -b felino Change-Id: Ib5a98dc481b0c64612ffd50242262714f114b5b7 Signed-off-by: Tongtong Pan Reviewed-on: https://review.coreboot.org/c/coreboot/+/86549 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Weimin Wu --- src/mainboard/google/fatcat/variants/felino/overridetree.cb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainboard/google/fatcat/variants/felino/overridetree.cb b/src/mainboard/google/fatcat/variants/felino/overridetree.cb index d401ed2c63..62b4160b74 100644 --- a/src/mainboard/google/fatcat/variants/felino/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/felino/overridetree.cb @@ -28,6 +28,9 @@ chip soc/intel/pantherlake .tdp_pl2_override = 25, }" + # Enable CNVi WiFi + register "cnvi_wifi_core" = "true" + register "usb2_ports[0]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C0 register "usb2_ports[1]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C1 register "usb2_ports[4]" = "USB2_PORT_MID(OC_SKIP)" # Type-A Port A0 # USB HUB (USB2 Camera) From 67dab0c3c942b58f5421bc9d87312ac6793f5093 Mon Sep 17 00:00:00 2001 From: Nicolas Kochlowski Date: Thu, 19 Dec 2024 12:36:50 -0300 Subject: [PATCH 0162/3886] drivers/amd/opensil/memmap.c: Factor out common memmap code to driver Refactor the vendorcode openSIL memory map code and move all common calls that do not require any openSIL headers to the driver. Improve the legibility of the logic to return memory hole type string. Change-Id: I80b9bdd7fd633c7b12d695ced5d4b9b518570d80 Signed-off-by: Nicolas Kochlowski Reviewed-on: https://review.coreboot.org/c/coreboot/+/85634 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/drivers/amd/opensil/Makefile.mk | 1 + src/drivers/amd/opensil/memmap.c | 89 +++++++++++++++++ src/drivers/amd/opensil/opensil.h | 3 + src/soc/amd/genoa_poc/domain.c | 5 +- src/soc/amd/phoenix/memmap.c | 4 +- src/vendorcode/amd/opensil/genoa_poc/memmap.c | 97 +++---------------- src/vendorcode/amd/opensil/opensil.h | 5 +- src/vendorcode/amd/opensil/stub/ramstage.c | 10 +- 8 files changed, 124 insertions(+), 90 deletions(-) create mode 100644 src/drivers/amd/opensil/memmap.c diff --git a/src/drivers/amd/opensil/Makefile.mk b/src/drivers/amd/opensil/Makefile.mk index 98377186aa..6ed46d1f81 100644 --- a/src/drivers/amd/opensil/Makefile.mk +++ b/src/drivers/amd/opensil/Makefile.mk @@ -8,5 +8,6 @@ romstage-y += romstage.c ramstage-y += acpi.c ramstage-y += ramstage.c +ramstage-y += memmap.c endif diff --git a/src/drivers/amd/opensil/memmap.c b/src/drivers/amd/opensil/memmap.c new file mode 100644 index 0000000000..9b80a882ef --- /dev/null +++ b/src/drivers/amd/opensil/memmap.c @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +#include "opensil.h" + +/* + * This structure definition must align exactly with the MEMORY_HOLE_TYPES structure + * defined in openSIL to ensure accurate casting. + */ +typedef struct { + uint64_t base; + uint64_t size; + uint32_t type; + uint32_t reserved; +} HOLE_INFO; + +/* This assumes holes are allocated */ +void amd_opensil_add_memmap(struct device *dev, unsigned long *idx) +{ + uint64_t top_of_mem = 0; + uint32_t n_holes = 0; + void *hole_info = NULL; + + /* Account for UMA and TSEG */ + const uint32_t mem_usable = cbmem_top(); + const uint32_t top_mem = ALIGN_DOWN(get_top_of_mem_below_4gb(), 1 * MiB); + if (mem_usable != top_mem) + reserved_ram_from_to(dev, (*idx)++, mem_usable, top_mem); + + /* Holes in upper DRAM */ + /* This assumes all the holes in upper DRAM are continuous */ + opensil_get_hole_info(&n_holes, &top_of_mem, &hole_info); + if (hole_info == NULL) + return; + + /* Check if we're done */ + if (top_of_mem <= 4ULL * GiB) + return; + + HOLE_INFO *holes = (HOLE_INFO *)hole_info; + + uint64_t lowest_upper_hole_base = top_of_mem; + uint64_t highest_upper_hole_end = 4ULL * GiB; + for (size_t hole = 0; hole < n_holes; hole++) { + if (!strcmp(opensil_get_hole_info_type(holes[hole].type), "MMIO")) + continue; + if (holes[hole].base < 4ULL * GiB) + continue; + lowest_upper_hole_base = MIN(lowest_upper_hole_base, holes[hole].base); + highest_upper_hole_end = MAX(highest_upper_hole_end, holes[hole].base + holes[hole].size); + if (!strcmp(opensil_get_hole_info_type(holes[hole].type), "UMA")) + mmio_range(dev, (*idx)++, holes[hole].base, holes[hole].size); + else + reserved_ram_range(dev, (*idx)++, holes[hole].base, holes[hole].size); + } + + ram_from_to(dev, (*idx)++, 4ULL * GiB, lowest_upper_hole_base); + + if (top_of_mem > highest_upper_hole_end) + ram_from_to(dev, (*idx)++, highest_upper_hole_end, top_of_mem); +} + +static void print_memory_holes(void *unused) +{ + uint64_t top_of_mem = 0; + uint32_t n_holes = 0; + void *hole_info = NULL; + + opensil_get_hole_info(&n_holes, &top_of_mem, &hole_info); + if (hole_info == NULL) + return; + + HOLE_INFO *holes = (HOLE_INFO *)hole_info; + + printk(BIOS_DEBUG, "APOB: top of memory 0x%016llx\n", top_of_mem); + printk(BIOS_DEBUG, "The following holes are reported in APOB\n"); + for (size_t hole = 0; hole < n_holes; hole++) { + printk(BIOS_DEBUG, " Base: 0x%016llx, Size: 0x%016llx, Type: %02d:%s\n", + holes[hole].base, holes[hole].size, holes[hole].type, + opensil_get_hole_info_type(holes[hole].type)); + } +} + +BOOT_STATE_INIT_ENTRY(BS_DEV_RESOURCES, BS_ON_ENTRY, print_memory_holes, NULL); diff --git a/src/drivers/amd/opensil/opensil.h b/src/drivers/amd/opensil/opensil.h index f2bcd6b900..e6efbdc80a 100644 --- a/src/drivers/amd/opensil/opensil.h +++ b/src/drivers/amd/opensil/opensil.h @@ -4,11 +4,14 @@ #define OPENSIL_DRIVER_H #include +#include /* Set up openSIL env and call TP1 */ void amd_opensil_silicon_init(void); /* Set global and per-device MPIO configurations */ void configure_mpio(void); +/* Add the memory map to dev, starting at index idx, returns last use idx */ +void amd_opensil_add_memmap(struct device *dev, unsigned long *idx); /* Fill in FADT from openSIL */ void amd_opensil_fill_fadt_io_ports(acpi_fadt_t *fadt); diff --git a/src/soc/amd/genoa_poc/domain.c b/src/soc/amd/genoa_poc/domain.c index 65b13958cb..d45d317605 100644 --- a/src/soc/amd/genoa_poc/domain.c +++ b/src/soc/amd/genoa_poc/domain.c @@ -9,17 +9,16 @@ #include #include #include +#include #include -#include - #define IOHC_IOAPIC_BASE_ADDR_LO 0x2f0 void read_soc_memmap_resources(struct device *domain, unsigned long *idx) { read_lower_soc_memmap_resources(domain, idx); - add_opensil_memmap(domain, idx); + amd_opensil_add_memmap(domain, idx); } static void genoa_domain_set_resources(struct device *domain) diff --git a/src/soc/amd/phoenix/memmap.c b/src/soc/amd/phoenix/memmap.c index d29dcbee63..1b45b9c93c 100644 --- a/src/soc/amd/phoenix/memmap.c +++ b/src/soc/amd/phoenix/memmap.c @@ -4,8 +4,8 @@ #include #include #include +#include #include -#include /* * +--------------------------------+ @@ -69,5 +69,5 @@ void read_soc_memmap_resources(struct device *dev, unsigned long *idx) if (CONFIG(PLATFORM_USES_FSP2_0)) read_fsp_resources(dev, idx); else - add_opensil_memmap(dev, idx); + amd_opensil_add_memmap(dev, idx); } diff --git a/src/vendorcode/amd/opensil/genoa_poc/memmap.c b/src/vendorcode/amd/opensil/genoa_poc/memmap.c index ece9877183..eed1be7e5f 100644 --- a/src/vendorcode/amd/opensil/genoa_poc/memmap.c +++ b/src/vendorcode/amd/opensil/genoa_poc/memmap.c @@ -1,20 +1,17 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include -#include -#include #include #include // needed above ApobCmn.h #include -#include #include -#include -#include -#include #include "../opensil.h" -static const char *hole_info_type(MEMORY_HOLE_TYPES type) +_Static_assert(sizeof(uint32_t) == sizeof(((MEMORY_HOLE_DESCRIPTOR){0}).Type), + "Unexpected size of MEMORY_HOLE_TYPES in the MEMORY_HOLE_DESCRIPTOR " + "struct which doesn't match the code in drivers/amd/opensil/memmap.c"); + +const char *opensil_get_hole_info_type(uint32_t type) { const struct hole_type { MEMORY_HOLE_TYPES type; @@ -40,85 +37,21 @@ static const char *hole_info_type(MEMORY_HOLE_TYPES type) }; int i; + MEMORY_HOLE_TYPES enum_type = (MEMORY_HOLE_TYPES)type; // Cast int to enum for (i = 0; i < ARRAY_SIZE(types); i++) - if (type == types[i].type) - break; - if (i == ARRAY_SIZE(types)) - return "Unknown type"; - return types[i].string; + if (enum_type == types[i].type) + return types[i].string; + return "Unknown type"; } -static uint64_t top_of_mem; -static uint32_t n_holes; -static MEMORY_HOLE_DESCRIPTOR *hole_info; - -static void get_hole_info(void) +void opensil_get_hole_info(uint32_t *n_holes, uint64_t *top_of_mem, void **hole_info) { - static bool done; - if (done) - return; - SIL_STATUS status = xPrfGetSystemMemoryMap(&n_holes, &top_of_mem, (void **)&hole_info); + SIL_STATUS status = xPrfGetSystemMemoryMap(n_holes, top_of_mem, hole_info); SIL_STATUS_report("xPrfGetSystemMemoryMap", status); // Make sure hole_info does not get initialized to something odd by xPRF on failure - if (status != SilPass) - hole_info = NULL; - done = true; -} - - -static void print_memory_holes(void *unused) -{ - get_hole_info(); - if (hole_info == NULL) - return; - - printk(BIOS_DEBUG, "APOB: top of memory 0x%016llx\n", top_of_mem); - printk(BIOS_DEBUG, "The following holes are reported in APOB\n"); - for (int hole = 0; hole < n_holes; hole++) { - printk(BIOS_DEBUG, " Base: 0x%016llx, Size: 0x%016llx, Type: %02d:%s\n", - hole_info[hole].Base, hole_info[hole].Size, hole_info[hole].Type, - hole_info_type(hole_info[hole].Type)); + if (status != SilPass) { + *hole_info = NULL; + *n_holes = 0; + *top_of_mem = 0; } } - -BOOT_STATE_INIT_ENTRY(BS_DEV_RESOURCES, BS_ON_ENTRY, print_memory_holes, NULL); - -// This assumes holes are allocated -void add_opensil_memmap(struct device *dev, unsigned long *idx) -{ - // Account for UMA and TSEG - const uint32_t mem_usable = cbmem_top(); - const uint32_t top_mem = ALIGN_DOWN(get_top_of_mem_below_4gb(), 1 * MiB); - if (mem_usable != top_mem) - reserved_ram_from_to(dev, (*idx)++, mem_usable, top_mem); - - // Check if we're done - if (top_of_mem <= 4ULL * GiB) - return; - - // Holes in upper DRAM - // This assumes all the holes in upper DRAM are continuous - get_hole_info(); - if (hole_info == NULL) - return; - uint64_t lowest_upper_hole_base = top_of_mem; - uint64_t highest_upper_hole_end = 4ULL * GiB; - for (int hole = 0; hole < n_holes; hole++) { - if (hole_info[hole].Type == MMIO) - continue; - if (hole_info[hole].Base < 4ULL * GiB) - continue; - lowest_upper_hole_base = MIN(lowest_upper_hole_base, hole_info[hole].Base); - highest_upper_hole_end = MAX(highest_upper_hole_end, hole_info[hole].Base + hole_info[hole].Size); - if (hole_info[hole].Type == UMA) - mmio_range(dev, (*idx)++, hole_info[hole].Base, hole_info[hole].Size); - else - reserved_ram_range(dev, (*idx)++, hole_info[hole].Base, hole_info[hole].Size); - } - - ram_from_to(dev, (*idx)++, 4ULL * GiB, lowest_upper_hole_base); - - // Do we need this? - if (top_of_mem > highest_upper_hole_end) - ram_from_to(dev, (*idx)++, highest_upper_hole_end, top_of_mem); -} diff --git a/src/vendorcode/amd/opensil/opensil.h b/src/vendorcode/amd/opensil/opensil.h index c84a180b86..3ed896067f 100644 --- a/src/vendorcode/amd/opensil/opensil.h +++ b/src/vendorcode/amd/opensil/opensil.h @@ -8,8 +8,9 @@ #include void SIL_STATUS_report(const char *function, const int status); -// Add the memory map to dev, starting at index idx, returns last use idx -void add_opensil_memmap(struct device *dev, unsigned long *idx); + +void opensil_get_hole_info(uint32_t *n_holes, uint64_t *top_of_mem, void **hole_info); +const char *opensil_get_hole_info_type(uint32_t type); void opensil_fill_fadt(acpi_fadt_t *fadt); unsigned long add_opensil_acpi_table(unsigned long current, acpi_rsdp_t *rsdp); diff --git a/src/vendorcode/amd/opensil/stub/ramstage.c b/src/vendorcode/amd/opensil/stub/ramstage.c index 5da6134ce3..d2e3d6aa21 100644 --- a/src/vendorcode/amd/opensil/stub/ramstage.c +++ b/src/vendorcode/amd/opensil/stub/ramstage.c @@ -5,9 +5,17 @@ #include "../opensil.h" -void add_opensil_memmap(struct device *dev, unsigned long *idx) +void opensil_get_hole_info(uint32_t *n_holes, uint64_t *top_of_mem, void **hole_info) +{ + *n_holes = 0; + *top_of_mem = 0xc0000000; + printk(BIOS_NOTICE, "openSIL stub: %s\n", __func__); +} + +const char *opensil_get_hole_info_type(uint32_t type) { printk(BIOS_NOTICE, "openSIL stub: %s\n", __func__); + return ""; } void opensil_fill_fadt(acpi_fadt_t *fadt) From 14ff47783b97d748c81d20cc4b27f90325c219ae Mon Sep 17 00:00:00 2001 From: Ivy Jian Date: Thu, 20 Feb 2025 15:37:46 +0800 Subject: [PATCH 0163/3886] mb/google/nissa/var/dirks: Update ddi_ports_config Update ddi_ports_config to match VBT's settings. DDI_PORT_A = HDMI DDI_PORT_B = HDMI DDI_PORT_1 = Type-C DP BUG=b:389391653 TEST=emerge-nissa coreboot Change-Id: I67e9fcf4a3caa303ec8d873507a7533389c095ae Signed-off-by: Ivy Jian Reviewed-on: https://review.coreboot.org/c/coreboot/+/86537 Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: David Wu --- .../google/brya/variants/dirks/overridetree.cb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mainboard/google/brya/variants/dirks/overridetree.cb b/src/mainboard/google/brya/variants/dirks/overridetree.cb index bc1c1867bb..a953b4ca76 100644 --- a/src/mainboard/google/brya/variants/dirks/overridetree.cb +++ b/src/mainboard/google/brya/variants/dirks/overridetree.cb @@ -87,6 +87,16 @@ chip soc/intel/alderlake # Enable the Cnvi BT Audio Offload register "cnvi_bt_audio_offload" = "1" + # Disable eDP on DDI portA + register "ddi_portA_config" = "0" + + # Enable HPD and DDC for DDI port A + register "ddi_ports_config" = "{ + [DDI_PORT_A] = DDI_ENABLE_HPD | DDI_ENABLE_DDC, + [DDI_PORT_B] = DDI_ENABLE_HPD | DDI_ENABLE_DDC, + [DDI_PORT_1] = DDI_ENABLE_HPD + }" + # Intel Common SoC Config #+-------------------+---------------------------+ #| Field | Value | From e3cf1bc4ccba5fdcf4aaccfc24a5b9240492775f Mon Sep 17 00:00:00 2001 From: Dinesh Gehlot Date: Fri, 14 Feb 2025 20:05:51 +0530 Subject: [PATCH 0164/3886] mb/google/brya: Do not select HAVE_ACPI_RESUME This patch removes the HAVE_ACPI_RESUME config option from the Google Brya mainboard configuration. The Intel Alder Lake SoC does not support S3 (ACPI sleep state) entry/exit, and attempting S3 validation could lead to abnormal platform behavior. This change ensures that `_S3` is not listed as a valid wake source in the DSDT (Differentiated System Description Table) after booting to the OS. BUG=b:337274309 TEST=Boot verfied google/trulo. TEST=Veified that the _S3 name variable is not present in the DSDT ASL. Change-Id: Ic0dce9c7779333ca079001e3763e843a4aad9a81 Signed-off-by: Dinesh Gehlot Reviewed-on: https://review.coreboot.org/c/coreboot/+/86422 Reviewed-by: Matt DeVillier Reviewed-by: Eric Lai Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/mainboard/google/brya/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index aac2393017..1ca5094e92 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -28,7 +28,6 @@ config BOARD_GOOGLE_BRYA_COMMON select FW_CONFIG select FW_CONFIG_SOURCE_CHROMEEC_CBI select GOOGLE_SMBIOS_MAINBOARD_VERSION - select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_FSP_LOGO_SUPPORT if RUN_FSP_GOP select I2C_TPM From 61f7e5a6cfcd08890d9a730a8a594dbc4bc7afbe Mon Sep 17 00:00:00 2001 From: Vince Liu Date: Tue, 18 Feb 2025 14:44:37 +0800 Subject: [PATCH 0165/3886] soc/mediatek/mt8196: Move common functions to gpio_eint_v2.c Move gpio_get_eint_reg() and gpio_calc_eint_pos_bit() to common code to avoid redundant definitions for other platforms such as MT8189. BUG=b:379008996 BRANCH=none TEST=build passed. Signed-off-by: Vince Liu Change-Id: Id21f627a49f730f3a0db786a148f81806aeba287 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86541 Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/gpio_eint_v2.c | 55 ++++++++++++++ .../common/include/soc/gpio_eint_v2.h | 25 +++++++ src/soc/mediatek/mt8196/Makefile.mk | 3 +- src/soc/mediatek/mt8196/gpio_eint.c | 72 ++----------------- 4 files changed, 87 insertions(+), 68 deletions(-) create mode 100644 src/soc/mediatek/common/gpio_eint_v2.c create mode 100644 src/soc/mediatek/common/include/soc/gpio_eint_v2.h diff --git a/src/soc/mediatek/common/gpio_eint_v2.c b/src/soc/mediatek/common/gpio_eint_v2.c new file mode 100644 index 0000000000..5e848fe279 --- /dev/null +++ b/src/soc/mediatek/common/gpio_eint_v2.c @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#include +#include +#include +#include + +void gpio_calc_eint_pos_bit(gpio_t gpio, u32 *pos, u32 *bit) +{ + uint32_t idx = gpio.id; + + *pos = 0; + *bit = 0; + + if (idx >= eint_data_len) + return; + + uint8_t index = eint_data[idx].index; + + *pos = index / MAX_EINT_REG_BITS; + *bit = index % MAX_EINT_REG_BITS; +} + +struct eint_regs *gpio_get_eint_reg(gpio_t gpio) +{ + uint32_t idx = gpio.id; + uintptr_t addr; + + if (idx >= eint_data_len) + return NULL; + + switch (eint_data[idx].instance) { + case EINT_E: + addr = EINT_E_BASE; + break; + case EINT_S: + addr = EINT_S_BASE; + break; + case EINT_W: + addr = EINT_W_BASE; + break; + case EINT_N: + addr = EINT_N_BASE; + break; + case EINT_C: + addr = EINT_C_BASE; + break; + default: + printk(BIOS_ERR, "%s: Failed to look up a valid EINT base for %d\n", + __func__, idx); + return NULL; + } + + return (void *)addr; +} diff --git a/src/soc/mediatek/common/include/soc/gpio_eint_v2.h b/src/soc/mediatek/common/include/soc/gpio_eint_v2.h new file mode 100644 index 0000000000..6f4acc61e9 --- /dev/null +++ b/src/soc/mediatek/common/include/soc/gpio_eint_v2.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#ifndef __SOC_MEDIATEK_COMMON_INCLUDE_SOC_GPIO_EINT_V2_H__ +#define __SOC_MEDIATEK_COMMON_INCLUDE_SOC_GPIO_EINT_V2_H__ + +#include + +enum { + EINT_INVALID = 0, + EINT_E, + EINT_S, + EINT_W, + EINT_N, + EINT_C, +}; + +struct eint_info { + uint8_t instance; + uint8_t index; +}; + +extern const struct eint_info eint_data[]; +extern const size_t eint_data_len; + +#endif /* __SOC_MEDIATEK_COMMON_INCLUDE_SOC_GPIO_EINT_V2_H__ */ diff --git a/src/soc/mediatek/mt8196/Makefile.mk b/src/soc/mediatek/mt8196/Makefile.mk index 85b670afb3..1793104d42 100644 --- a/src/soc/mediatek/mt8196/Makefile.mk +++ b/src/soc/mediatek/mt8196/Makefile.mk @@ -3,7 +3,8 @@ ifeq ($(CONFIG_SOC_MEDIATEK_MT8196),y) all-y += ../common/flash_controller.c -all-y += ../common/gpio.c ../common/gpio_op.c gpio.c gpio_eint.c +all-y += ../common/gpio.c ../common/gpio_op.c gpio.c +all-y += ../common/gpio_eint_v2.c gpio_eint.c all-y += ../common/i2c.c i2c.c all-y += ../common/pll.c pll.c all-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c diff --git a/src/soc/mediatek/mt8196/gpio_eint.c b/src/soc/mediatek/mt8196/gpio_eint.c index f24860d128..9263e9e576 100644 --- a/src/soc/mediatek/mt8196/gpio_eint.c +++ b/src/soc/mediatek/mt8196/gpio_eint.c @@ -1,29 +1,14 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ /* * This file is created based on MT8196_EINT_Datasheet * Chapter number: 1 */ -#include -#include -#include +#include +#include -enum { - EINT_INVALID = 0, - EINT_E, - EINT_S, - EINT_W, - EINT_N, - EINT_C, -}; - -struct eint_info { - uint8_t instance; - uint8_t index; -}; - -static struct eint_info eint_data[] = { +const struct eint_info eint_data[] = { /* instance, index */ [0] = { EINT_W, 0 }, [1] = { EINT_W, 1 }, @@ -258,51 +243,4 @@ static struct eint_info eint_data[] = { }; _Static_assert(ARRAY_SIZE(eint_data) == 293, "Incorrect eint_data size"); -void gpio_calc_eint_pos_bit(gpio_t gpio, u32 *pos, u32 *bit) -{ - uint32_t idx = gpio.id; - - *pos = 0; - *bit = 0; - - if (idx >= ARRAY_SIZE(eint_data)) - return; - - uint8_t index = eint_data[idx].index; - - *pos = index / MAX_EINT_REG_BITS; - *bit = index % MAX_EINT_REG_BITS; -} - -struct eint_regs *gpio_get_eint_reg(gpio_t gpio) -{ - uint32_t idx = gpio.id; - uintptr_t addr; - - if (idx >= ARRAY_SIZE(eint_data)) - return NULL; - - switch (eint_data[idx].instance) { - case EINT_E: - addr = EINT_E_BASE; - break; - case EINT_S: - addr = EINT_S_BASE; - break; - case EINT_W: - addr = EINT_W_BASE; - break; - case EINT_N: - addr = EINT_N_BASE; - break; - case EINT_C: - addr = EINT_C_BASE; - break; - default: - printk(BIOS_ERR, "%s: Failed to look up a valid EINT base for %d\n", - __func__, idx); - return NULL; - } - - return (void *)addr; -} +const size_t eint_data_len = ARRAY_SIZE(eint_data); From ac80241fc9a1f71423c3cf1b25ce66c958105ba6 Mon Sep 17 00:00:00 2001 From: Vince Liu Date: Wed, 19 Feb 2025 13:26:12 +0800 Subject: [PATCH 0166/3886] soc/mediatek/mt8189: Reduce bootblock size by separating SPI NOR GPIOs In the bootblock stage, only SPI NOR related GPIOs are used. To optimize the code size, separate the SPI NOR GPIO driving information. This modification reduces the bootblock code size by 1KB. BUG=b:379008996 BRANCH=none TEST=booted successfully Signed-off-by: Vince Liu Change-Id: If7e8e5c7db59b5f181db14f6e66df2f333dbb6d4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86538 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/soc/mediatek/mt8189/gpio.c | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/soc/mediatek/mt8189/gpio.c b/src/soc/mediatek/mt8189/gpio.c index 27179c38e2..dde8d14ad5 100644 --- a/src/soc/mediatek/mt8189/gpio.c +++ b/src/soc/mediatek/mt8189/gpio.c @@ -8,6 +8,26 @@ #include #include +#define SPI_NOR_GPIO_BASE 150 + +enum { + SPI_NOR_CK = 0, + SPI_NOR_CS = 1, + SPI_NOR_IO0 = 2, + SPI_NOR_IO1 = 3, + SPI_NOR_IO2 = 4, + SPI_NOR_IO3 = 5, +}; + +static const struct gpio_drv_info bootblock_gpio_driving_info[] = { + [SPI_NOR_CK] = { 0x10, 12, 3, }, + [SPI_NOR_CS] = { 0x10, 27, 3, }, + [SPI_NOR_IO0] = { 0x10, 15, 3, }, + [SPI_NOR_IO1] = { 0x10, 18, 3, }, + [SPI_NOR_IO2] = { 0x10, 21, 3, }, + [SPI_NOR_IO3] = { 0x10, 24, 3, }, +}; + static const struct gpio_drv_info gpio_driving_info[] = { [0] = { 0x10, 15, 3, }, [1] = { 0x10, 9, 3, }, @@ -261,14 +281,26 @@ void *gpio_find_reg_addr(gpio_t gpio) const struct gpio_drv_info *get_gpio_driving_info(uint32_t raw_id) { - if (raw_id >= ARRAY_SIZE(gpio_driving_info)) - return NULL; - return &gpio_driving_info[raw_id]; + if (ENV_BOOTBLOCK) { + uint32_t id = raw_id - SPI_NOR_GPIO_BASE; + + if (id >= ARRAY_SIZE(bootblock_gpio_driving_info)) + return NULL; + return &bootblock_gpio_driving_info[id]; + } else { + if (raw_id >= ARRAY_SIZE(gpio_driving_info)) + return NULL; + return &gpio_driving_info[raw_id]; + } } const struct gpio_drv_info *get_gpio_driving_adv_info(uint32_t raw_id) { - if (raw_id >= ARRAY_SIZE(gpio_driving_adv_info)) + if (ENV_BOOTBLOCK) { return NULL; - return &gpio_driving_adv_info[raw_id]; + } else { + if (raw_id >= ARRAY_SIZE(gpio_driving_adv_info)) + return NULL; + return &gpio_driving_adv_info[raw_id]; + } } From d0c6ff5f265851386feda73e9da14e2c00360eb4 Mon Sep 17 00:00:00 2001 From: Nicholas Chin Date: Fri, 16 Dec 2022 08:29:22 -0700 Subject: [PATCH 0167/3886] mb/lenovo: Add ThinkCentre M900 (Skylake/LGA 1151) The mainboard is marked IQ1X0MS, though it is also known as the MS-7988. The Small Form Factor version was used for this port, though the Mini Tower seems to use the exact same board. Other systems such as the ThinkCentre M800, ThinkStation P310, ThinkStation P320, and IdeaCentre 700-25ISH appear to use the same PCB with different configurations of components. All the code in this port was originally copied from the Asrock H110M and then modified to match the actual configuration of the M900. The VBT was extracted using `intelvbttool -l -v data.vbt` while running version FWKTBFA of the vendor firmware. Working: - Boots to Linux with SeaBIOS 1.16.3 - Boots to Linux with EDK2 (MrChromebox uefipayload_202408) - Display Ports - VGA port - PCIe slots - Console over serial port - Front and rear USB 3.0 ports and internal USB2.0 headers - Front and rear audio jacks - Internal speaker - SATA ports 1-4 (5 and 6 are not populated on the M900) - Hardware monitoring via nct6683 kernel module - Gigabit Ethernet - S3 suspend/resume Unknown/untested: - M.2 E-key slot - Parallel port header - PS/2 Mouse/Keyboard via KB_MS1 header - TPM Change-Id: I4e70c9f42c19f130a00170b32ae74b61f0483a22 Signed-off-by: Nicholas Chin Reviewed-on: https://review.coreboot.org/c/coreboot/+/74187 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- src/mainboard/lenovo/m900/Kconfig | 36 +++ src/mainboard/lenovo/m900/Kconfig.name | 4 + src/mainboard/lenovo/m900/Makefile.mk | 6 + src/mainboard/lenovo/m900/acpi/ec.asl | 3 + src/mainboard/lenovo/m900/acpi/superio.asl | 3 + src/mainboard/lenovo/m900/board_info.txt | 6 + src/mainboard/lenovo/m900/bootblock.c | 53 +++++ src/mainboard/lenovo/m900/cmos.default | 3 + src/mainboard/lenovo/m900/cmos.layout | 57 +++++ src/mainboard/lenovo/m900/data.vbt | Bin 0 -> 3834 bytes src/mainboard/lenovo/m900/devicetree.cb | 188 +++++++++++++++ src/mainboard/lenovo/m900/dsdt.asl | 25 ++ src/mainboard/lenovo/m900/gma-mainboard.ads | 19 ++ src/mainboard/lenovo/m900/gpio.h | 244 ++++++++++++++++++++ src/mainboard/lenovo/m900/hda_verb.c | 32 +++ src/mainboard/lenovo/m900/ramstage.c | 13 ++ src/mainboard/lenovo/m900/romstage.c | 39 ++++ 17 files changed, 731 insertions(+) create mode 100644 src/mainboard/lenovo/m900/Kconfig create mode 100644 src/mainboard/lenovo/m900/Kconfig.name create mode 100644 src/mainboard/lenovo/m900/Makefile.mk create mode 100644 src/mainboard/lenovo/m900/acpi/ec.asl create mode 100644 src/mainboard/lenovo/m900/acpi/superio.asl create mode 100644 src/mainboard/lenovo/m900/board_info.txt create mode 100644 src/mainboard/lenovo/m900/bootblock.c create mode 100644 src/mainboard/lenovo/m900/cmos.default create mode 100644 src/mainboard/lenovo/m900/cmos.layout create mode 100644 src/mainboard/lenovo/m900/data.vbt create mode 100644 src/mainboard/lenovo/m900/devicetree.cb create mode 100644 src/mainboard/lenovo/m900/dsdt.asl create mode 100644 src/mainboard/lenovo/m900/gma-mainboard.ads create mode 100644 src/mainboard/lenovo/m900/gpio.h create mode 100644 src/mainboard/lenovo/m900/hda_verb.c create mode 100644 src/mainboard/lenovo/m900/ramstage.c create mode 100644 src/mainboard/lenovo/m900/romstage.c diff --git a/src/mainboard/lenovo/m900/Kconfig b/src/mainboard/lenovo/m900/Kconfig new file mode 100644 index 0000000000..882f3131c7 --- /dev/null +++ b/src/mainboard/lenovo/m900/Kconfig @@ -0,0 +1,36 @@ +## SPDX-License-Identifier: GPL-2.0-only + +if BOARD_LENOVO_M900 + +config BOARD_SPECIFIC_OPTIONS + def_bool y + select BOARD_ROMSIZE_KB_16384 + select HAVE_ACPI_RESUME + select HAVE_ACPI_TABLES + select HAVE_CMOS_DEFAULT + select HAVE_OPTION_TABLE + select INTEL_GMA_HAVE_VBT + select INTEL_INT15 + select MAINBOARD_HAS_LIBGFXINIT + select MAINBOARD_HAS_TPM1 + select MAINBOARD_USES_IFD_GBE_REGION + select MEMORY_MAPPED_TPM + select SKYLAKE_SOC_PCH_H + select SOC_INTEL_COMMON_BLOCK_HDA_VERB + select SOC_INTEL_SKYLAKE + # Actual chip is NCT6685 + select SUPERIO_NUVOTON_NCT6687D + +config DIMM_SPD_SIZE + default 512 # DDR4 + +config DISABLE_HECI1_AT_PRE_BOOT + default y + +config MAINBOARD_DIR + default "lenovo/m900" + +config MAINBOARD_PART_NUMBER + default "M900" + +endif diff --git a/src/mainboard/lenovo/m900/Kconfig.name b/src/mainboard/lenovo/m900/Kconfig.name new file mode 100644 index 0000000000..92481401d4 --- /dev/null +++ b/src/mainboard/lenovo/m900/Kconfig.name @@ -0,0 +1,4 @@ +## SPDX-License-Identifier: GPL-2.0-only + +config BOARD_LENOVO_M900 + bool "ThinkCentre M900" diff --git a/src/mainboard/lenovo/m900/Makefile.mk b/src/mainboard/lenovo/m900/Makefile.mk new file mode 100644 index 0000000000..ef44a4c074 --- /dev/null +++ b/src/mainboard/lenovo/m900/Makefile.mk @@ -0,0 +1,6 @@ +## SPDX-License-Identifier: GPL-2.0-only + +bootblock-y += bootblock.c + +ramstage-y += ramstage.c +ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads diff --git a/src/mainboard/lenovo/m900/acpi/ec.asl b/src/mainboard/lenovo/m900/acpi/ec.asl new file mode 100644 index 0000000000..16990d45f4 --- /dev/null +++ b/src/mainboard/lenovo/m900/acpi/ec.asl @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: CC-PDDC */ + +/* Please update the license if adding licensable material. */ diff --git a/src/mainboard/lenovo/m900/acpi/superio.asl b/src/mainboard/lenovo/m900/acpi/superio.asl new file mode 100644 index 0000000000..16990d45f4 --- /dev/null +++ b/src/mainboard/lenovo/m900/acpi/superio.asl @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: CC-PDDC */ + +/* Please update the license if adding licensable material. */ diff --git a/src/mainboard/lenovo/m900/board_info.txt b/src/mainboard/lenovo/m900/board_info.txt new file mode 100644 index 0000000000..a19aea3a9a --- /dev/null +++ b/src/mainboard/lenovo/m900/board_info.txt @@ -0,0 +1,6 @@ +Category: desktop +ROM package: SOIC-8 +ROM protocol: SPI +ROM socketed: n +Flashrom support: y +Release year: 2015 diff --git a/src/mainboard/lenovo/m900/bootblock.c b/src/mainboard/lenovo/m900/bootblock.c new file mode 100644 index 0000000000..8afe6b36ec --- /dev/null +++ b/src/mainboard/lenovo/m900/bootblock.c @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +#define GLOBAL_DEV PNP_DEV(0x2e, 0) +/* Change to NCT6687D_SP1 to use COM2 header */ +#define SERIAL_DEV PNP_DEV(0x2e, NCT6687D_SP2) +#define POWER_DEV PNP_DEV(0x2e, NCT6687D_SLEEP_PWR) + +void bootblock_mainboard_early_init(void) +{ + nuvoton_pnp_enter_conf_state(GLOBAL_DEV); + + /* + * Replicate non-default vendor settings (mostly multi-function pin + * selection settings) in the global LDN. It seems like some bits are + * set to non-default values before coreboot configures them; possibly + * by the MCU firmware. Comments provided for notable settings. + */ + pnp_write_config(GLOBAL_DEV, 0x13, 0x0c); + /* Pins 121, 122 as TACHPWM */ + pnp_write_config(GLOBAL_DEV, 0x15, 0xf0); + /* Pin 125 as TACHPWM */ + pnp_write_config(GLOBAL_DEV, 0x1a, 0x07); + pnp_write_config(GLOBAL_DEV, 0x1b, 0xf0); + pnp_write_config(GLOBAL_DEV, 0x1d, 0x08); + /* Pins 95, 98, 124 as TACHPWM */ + pnp_write_config(GLOBAL_DEV, 0x1e, 0xfc); + /* Pins 126, 127 as TACHPWM */ + pnp_write_config(GLOBAL_DEV, 0x1f, 0xf0); + pnp_write_config(GLOBAL_DEV, 0x22, 0xbc); + pnp_write_config(GLOBAL_DEV, 0x23, 0xdf); + /* Route pins 29-36 to COM A (COM2 header) */ + pnp_write_config(GLOBAL_DEV, 0x24, 0x61); + pnp_write_config(GLOBAL_DEV, 0x25, 0xff); + /* Route pins to parallel port */ + pnp_write_config(GLOBAL_DEV, 0x27, 0xbe); + pnp_write_config(GLOBAL_DEV, 0x29, 0xfd); + /* Route pins 7-13 to COM B (Back panel COM1) */ + pnp_write_config(GLOBAL_DEV, 0x2a, 0xcf); + + /* Configure pin for PECI */ + pnp_set_logical_device(POWER_DEV); + pnp_write_config(POWER_DEV, 0xf3, 0x0c); + + nuvoton_pnp_exit_conf_state(GLOBAL_DEV); + + /* Back panel COM1 */ + nuvoton_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); +} diff --git a/src/mainboard/lenovo/m900/cmos.default b/src/mainboard/lenovo/m900/cmos.default new file mode 100644 index 0000000000..f3330e5070 --- /dev/null +++ b/src/mainboard/lenovo/m900/cmos.default @@ -0,0 +1,3 @@ +boot_option=Fallback +debug_level=Debug +power_on_after_fail=Disable diff --git a/src/mainboard/lenovo/m900/cmos.layout b/src/mainboard/lenovo/m900/cmos.layout new file mode 100644 index 0000000000..2c67e5aabf --- /dev/null +++ b/src/mainboard/lenovo/m900/cmos.layout @@ -0,0 +1,57 @@ +## SPDX-License-Identifier: GPL-2.0-only + +# ----------------------------------------------------------------- +entries + +#start-bit length config config-ID name + +# ----------------------------------------------------------------- +0 120 r 0 reserved_memory + +# ----------------------------------------------------------------- +# RTC_BOOT_BYTE (coreboot hardcoded) +384 1 e 4 boot_option +388 4 h 0 reboot_counter + +# ----------------------------------------------------------------- +# coreboot config options: console +395 4 e 6 debug_level + +# coreboot config options: cpu +400 1 e 2 hyper_threading + +# coreboot config options: southbridge +409 2 e 7 power_on_after_fail + +# coreboot config options: bootloader +# Used by vboot +416 128 r 0 vbnv + +# coreboot config options: check sums +984 16 h 0 check_sum + +# ----------------------------------------------------------------- + +enumerations + +#ID value text +2 0 Enable +2 1 Disable +4 0 Fallback +4 1 Normal +6 0 Emergency +6 1 Alert +6 2 Critical +6 3 Error +6 4 Warning +6 5 Notice +6 6 Info +6 7 Debug +6 8 Spew +7 0 Disable +7 1 Enable +7 2 Keep +# ----------------------------------------------------------------- +checksums + +checksum 392 415 984 diff --git a/src/mainboard/lenovo/m900/data.vbt b/src/mainboard/lenovo/m900/data.vbt new file mode 100644 index 0000000000000000000000000000000000000000..37bfddfb43c614b63451ccbd2b275dd38449a081 GIT binary patch literal 3834 zcmds3U2GIp6h5=FyEAiVww+Ev%7XO>2yKCOx`hh0#Mz&gF5S}Y52Yj~Y++YvEVTAV zi$S|2O~eOfO^g9Uqz@(kwiVq%1%LuNN$9am;2dI(W7U9xuT9SsMV7Lhzz(BOqJa!V6y<0$rDXHMrOL?<4@< z_oDzFT|mKhBWJYWa*BJgQpZaMpicluD4>UTI2NMowc7Pk0Q~%&WD4kfntO2zVL`R+ zWovG;$ji0kT&KJJh1P|-2Hz6@Kzx<>I`J)H$+1Quk|H%k&x32(MPA4bnGm6P(aCSTYN#4puHjRf(WbGz8or_#CpC6j3siZ0 zS6WnDfJVAvpqEwdp%1dOcf*4_O8Z?>@p`t z<@FODCmk9;43&>zg^$tQ={euB$CfQ-gB-4%FX7Sn+qPvoPF}rR0@g1vFhAZDp+or=;neV>CMrv z4@EL76|#zo#_ZJ4^jbow;-j2g +DefinitionBlock( + "dsdt.aml", + "DSDT", + ACPI_DSDT_REV_2, + OEM_ID, + ACPI_TABLE_CREATOR, + 0x20110725 +) +{ + #include + #include + #include + #include + + Device (\_SB.PCI0) + { + #include + #include + } + + #include +} diff --git a/src/mainboard/lenovo/m900/gma-mainboard.ads b/src/mainboard/lenovo/m900/gma-mainboard.ads new file mode 100644 index 0000000000..dd45ad4576 --- /dev/null +++ b/src/mainboard/lenovo/m900/gma-mainboard.ads @@ -0,0 +1,19 @@ +-- SPDX-License-Identifier: GPL-2.0-or-later + +with HW.GFX.GMA; +with HW.GFX.GMA.Display_Probing; + +use HW.GFX.GMA; +use HW.GFX.GMA.Display_Probing; + +private package GMA.Mainboard is + + ports : constant Port_List := + (DP1, -- mainboard VGA port + DP2, -- DP++ port 1 + DP3, -- DP++ port 2 + HDMI2, -- DP++ port 1 + HDMI3, -- DP++ port 2 + others => Disabled); + +end GMA.Mainboard; diff --git a/src/mainboard/lenovo/m900/gpio.h b/src/mainboard/lenovo/m900/gpio.h new file mode 100644 index 0000000000..d9146cee42 --- /dev/null +++ b/src/mainboard/lenovo/m900/gpio.h @@ -0,0 +1,244 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef CFG_GPIO_H +#define CFG_GPIO_H + +#include + +/* Pad configuration was generated automatically using intelp2m utility */ +static const struct pad_config gpio_table[] = { + + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + PAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A2, UP_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A3, UP_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A4, UP_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A6, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A7, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A8, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A9, DN_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A10, DN_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A11, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A12, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_A14, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_A15, UP_20K, DEEP, NF1), + PAD_CFG_TERM_GPO(GPP_A16, 0, UP_20K, DEEP), + PAD_CFG_GPO(GPP_A17, 1, PLTRST), + PAD_CFG_GPO(GPP_A18, 0, PLTRST), + PAD_CFG_TERM_GPO(GPP_A19, 0, UP_20K, DEEP), + PAD_CFG_GPO(GPP_A20, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_A21, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_A22, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_A23, NONE, PLTRST, OFF, ACPI), + + /* ------- GPIO Group GPP_B ------- */ + PAD_CFG_GPO(GPP_B0, 0, PLTRST), + PAD_CFG_GPO(GPP_B1, 0, PLTRST), + PAD_CFG_NF(GPP_B2, NONE, PLTRST, NF1), + PAD_CFG_GPO(GPP_B3, 0, PLTRST), + PAD_CFG_GPO(GPP_B4, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_B5, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_B6, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_B7, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_B8, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_B9, 0, PLTRST), + PAD_CFG_NF(GPP_B10, NONE, PLTRST, NF1), + PAD_CFG_GPO(GPP_B11, 0, PLTRST), + PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_B14, DN_20K, PLTRST, NF1), + PAD_CFG_GPO(GPP_B15, 0, PLTRST), + PAD_CFG_GPO(GPP_B16, 0, PLTRST), + PAD_CFG_GPO(GPP_B17, 0, PLTRST), + PAD_CFG_NF(GPP_B18, NONE, PLTRST, NF1), + PAD_CFG_GPO(GPP_B19, 0, PLTRST), + PAD_CFG_GPI_DUAL_ROUTE(GPP_B20, NONE, PLTRST, OFF, NONE, NMI, SMI), + PAD_CFG_GPO(GPP_B21, 0, PLTRST), + PAD_CFG_NF(GPP_B22, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_B23, DN_20K, PLTRST, NF1), + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_C ------- */ + PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C2, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C3, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C4, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C5, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_C6, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C7, NONE, DEEP, NF1), + PAD_CFG_GPI_TRIG_OWN(GPP_C8, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_C9, 0, PLTRST), + PAD_CFG_GPO(GPP_C10, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_C11, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_C12, 1, PLTRST), + PAD_CFG_GPO(GPP_C13, 1, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_C14, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_C15, 1, PLTRST), + PAD_CFG_GPO(GPP_C16, 0, PLTRST), + PAD_CFG_GPO(GPP_C17, 0, PLTRST), + PAD_CFG_GPO(GPP_C18, 0, PLTRST), + PAD_CFG_GPO(GPP_C19, 0, PLTRST), + PAD_CFG_GPO(GPP_C20, 0, PLTRST), + PAD_CFG_GPO(GPP_C21, 0, PLTRST), + PAD_CFG_GPO(GPP_C22, 0, PLTRST), + PAD_CFG_GPO(GPP_C23, 0, PLTRST), + + /* ------- GPIO Group GPP_D ------- */ + PAD_CFG_GPO(GPP_D0, 0, PLTRST), + PAD_CFG_GPO(GPP_D1, 1, PLTRST), + PAD_CFG_NF(GPP_D2, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_D3, NONE, PLTRST, NF1), + PAD_CFG_GPO(GPP_D4, 1, RSMRST), + PAD_CFG_GPO(GPP_D5, 0, RSMRST), + PAD_CFG_GPO(GPP_D6, 0, RSMRST), + PAD_CFG_GPO(GPP_D7, 0, RSMRST), + PAD_CFG_GPO(GPP_D8, 0, RSMRST), + PAD_CFG_GPO(GPP_D9, 0, RSMRST), + PAD_CFG_GPO(GPP_D10, 0, RSMRST), + PAD_CFG_GPI_TRIG_OWN(GPP_D11, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_D12, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_D13, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_D14, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_D15, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_D16, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_D17, NONE, PLTRST, LEVEL, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_D18, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_D19, 0, PLTRST), + PAD_CFG_GPO(GPP_D20, 0, PLTRST), + PAD_CFG_GPO(GPP_D21, 0, PLTRST), + PAD_CFG_GPO(GPP_D22, 0, PLTRST), + PAD_CFG_GPO(GPP_D23, 0, PLTRST), + + /* ------- GPIO Group GPP_E ------- */ + PAD_CFG_TERM_GPO(GPP_E0, 0, UP_20K, PLTRST), + PAD_CFG_TERM_GPO(GPP_E1, 0, UP_20K, PLTRST), + PAD_CFG_TERM_GPO(GPP_E2, 0, UP_20K, PLTRST), + PAD_CFG_GPO(GPP_E3, 0, PLTRST), + PAD_CFG_GPO(GPP_E4, 0, PLTRST), + PAD_CFG_GPO(GPP_E5, 0, PLTRST), + PAD_CFG_GPO(GPP_E6, 0, PLTRST), + PAD_CFG_GPO(GPP_E7, 0, PLTRST), + PAD_CFG_NF(GPP_E8, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_E10, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_E11, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF1), + + /* ------- GPIO Group GPP_F ------- */ + PAD_CFG_GPO(GPP_F0, 0, PLTRST), + PAD_CFG_NF(GPP_F1, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_F2, NONE, PLTRST, NF1), + PAD_CFG_GPO(GPP_F3, 0, PLTRST), + PAD_CFG_GPO(GPP_F4, 0, PLTRST), + PAD_CFG_NF(GPP_F5, NONE, DEEP, NF1), + PAD_CFG_GPI_TRIG_OWN(GPP_F6, NONE, DEEP, OFF, ACPI), + PAD_CFG_GPO(GPP_F7, 0, DEEP), + PAD_CFG_GPO(GPP_F8, 0, PLTRST), + PAD_CFG_GPO(GPP_F9, 0, PLTRST), + PAD_CFG_NF(GPP_F10, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_F11, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_F12, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_F13, NONE, PLTRST, NF1), + PAD_CFG_GPI_APIC_HIGH(GPP_F14, NONE, DEEP), + PAD_CFG_NF(GPP_F15, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_F16, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_F17, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_F18, NONE, PLTRST, NF1), + PAD_CFG_GPO(GPP_F19, 0, PLTRST), + PAD_CFG_GPO(GPP_F20, 0, PLTRST), + PAD_CFG_GPO(GPP_F21, 0, PLTRST), + PAD_CFG_GPO(GPP_F22, 1, PLTRST), + PAD_CFG_GPO(GPP_F23, 0, PLTRST), + + /* ------- GPIO Group GPP_G ------- */ + PAD_CFG_GPI_TRIG_OWN(GPP_G0, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G1, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G2, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_G3, 0, PLTRST), + PAD_CFG_GPO(GPP_G4, 0, PLTRST), + PAD_CFG_GPO(GPP_G5, 0, PLTRST), + PAD_CFG_GPO(GPP_G6, 0, PLTRST), + PAD_CFG_GPO(GPP_G7, 0, PLTRST), + PAD_CFG_GPO(GPP_G8, 0, PLTRST), + PAD_CFG_GPO(GPP_G9, 0, PLTRST), + PAD_CFG_GPO(GPP_G10, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_G11, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G12, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G13, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G14, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G15, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G16, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPI_TRIG_OWN(GPP_G17, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_G18, 1, PLTRST), + PAD_CFG_GPI_SCI(GPP_G19, NONE, PLTRST, LEVEL, INVERT), + PAD_CFG_GPO(GPP_G20, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_G21, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_G22, 0, PLTRST), + PAD_CFG_GPO(GPP_G23, 0, PLTRST), + + /* ------- GPIO Group GPP_H ------- */ + PAD_CFG_GPO(GPP_H0, 0, PLTRST), + PAD_CFG_GPO(GPP_H1, 0, RSMRST), + PAD_CFG_GPI_TRIG_OWN(GPP_H2, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_H3, 0, PLTRST), + PAD_CFG_GPO(GPP_H4, 0, PLTRST), + PAD_CFG_GPO(GPP_H5, 0, PLTRST), + PAD_CFG_GPO(GPP_H6, 0, PLTRST), + PAD_CFG_GPO(GPP_H7, 0, PLTRST), + PAD_CFG_GPO(GPP_H8, 0, PLTRST), + PAD_CFG_GPO(GPP_H9, 0, PLTRST), + PAD_CFG_GPO(GPP_H10, 1, PLTRST), + PAD_CFG_GPO(GPP_H11, 1, PLTRST), + PAD_CFG_GPO(GPP_H12, 0, PLTRST), + PAD_CFG_GPO(GPP_H13, 0, PLTRST), + PAD_CFG_GPO(GPP_H14, 0, PLTRST), + PAD_CFG_GPO(GPP_H15, 1, PLTRST), + PAD_CFG_GPO(GPP_H16, 0, PLTRST), + PAD_CFG_GPO(GPP_H17, 0, PLTRST), + PAD_CFG_GPO(GPP_H18, 1, PLTRST), + PAD_CFG_GPO(GPP_H19, 0, PLTRST), + PAD_CFG_GPO(GPP_H20, 0, PLTRST), + PAD_CFG_GPO(GPP_H21, 0, PLTRST), + PAD_CFG_GPO(GPP_H22, 0, PLTRST), + PAD_CFG_GPO(GPP_H23, 0, PLTRST), + + /* ------- GPIO Community 2 ------- */ + + /* -------- GPIO Group GPD -------- */ + PAD_CFG_NF(GPD0, NONE, PLTRST, NF1), + PAD_CFG_NF(GPD1, NONE, PWROK, NF1), + PAD_CFG_NF(GPD2, DN_20K, PWROK, NF1), + PAD_CFG_NF(GPD3, UP_20K, PWROK, NF1), + PAD_CFG_NF(GPD4, NONE, PWROK, NF1), + PAD_CFG_NF(GPD5, NONE, PWROK, NF1), + PAD_CFG_NF(GPD6, NONE, PWROK, NF1), + PAD_CFG_GPO(GPD7, 0, PWROK), + PAD_CFG_NF(GPD8, NONE, PWROK, NF1), + PAD_CFG_GPO(GPD9, 0, PWROK), + PAD_CFG_NF(GPD10, NONE, PWROK, NF1), + PAD_CFG_NF(GPD11, NONE, PWROK, NF1), + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_I ------- */ + PAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1), + PAD_CFG_GPI_DUAL_ROUTE(GPP_I3, NONE, PLTRST, OFF, NONE, SMI, NMI), + PAD_CFG_GPI_TRIG_OWN(GPP_I4, NONE, PLTRST, OFF, ACPI), + PAD_CFG_GPO(GPP_I5, 0, PLTRST), + PAD_CFG_GPI_TRIG_OWN(GPP_I6, DN_20K, PLTRST, OFF, ACPI), + PAD_CFG_NF(GPP_I7, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_I8, DN_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_I9, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_I10, DN_20K, PLTRST, NF1), +}; + +#endif /* CFG_GPIO_H */ diff --git a/src/mainboard/lenovo/m900/hda_verb.c b/src/mainboard/lenovo/m900/hda_verb.c new file mode 100644 index 0000000000..e400a59e59 --- /dev/null +++ b/src/mainboard/lenovo/m900/hda_verb.c @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +const u32 cim_verb_data[] = { + 0x10ec0662, /* Codec Vendor / Device ID: Realtek ALC662 rev3 */ + 0x17aa30bc, /* Subsystem ID */ + 12, /* Number of 4 dword sets */ + AZALIA_SUBVENDOR(0, 0x17aa30bc), + AZALIA_PIN_CFG(0, 0x12, 0x40000000), + AZALIA_PIN_CFG(0, 0x14, 0x01014020), + AZALIA_PIN_CFG(0, 0x15, 0x99130110), + AZALIA_PIN_CFG(0, 0x16, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, 0x18, 0x01a19040), + AZALIA_PIN_CFG(0, 0x19, 0x02a19050), + AZALIA_PIN_CFG(0, 0x1a, 0x0181304f), + AZALIA_PIN_CFG(0, 0x1b, 0x02214030), + AZALIA_PIN_CFG(0, 0x1c, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, 0x1d, 0x4047c62b), + AZALIA_PIN_CFG(0, 0x1e, AZALIA_PIN_CFG_NC(0)), + + 0x80862809, /* Codec Vendor / Device ID: Intel Skylake HDMI */ + 0x80860101, /* Subsystem ID */ + 4, /* Number of 4 dword sets */ + AZALIA_SUBVENDOR(2, 0x80860101), + AZALIA_PIN_CFG(2, 0x05, 0x58560010), + AZALIA_PIN_CFG(2, 0x06, 0x18560020), + AZALIA_PIN_CFG(2, 0x07, 0x18560030), +}; + +const u32 pc_beep_verbs[] = {}; +AZALIA_ARRAY_SIZES; diff --git a/src/mainboard/lenovo/m900/ramstage.c b/src/mainboard/lenovo/m900/ramstage.c new file mode 100644 index 0000000000..4ae8415907 --- /dev/null +++ b/src/mainboard/lenovo/m900/ramstage.c @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include "gpio.h" + +static void init_mainboard(void *chip_info) +{ + gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); +} + +struct chip_operations mainboard_ops = { + .init = init_mainboard, +}; diff --git a/src/mainboard/lenovo/m900/romstage.c b/src/mainboard/lenovo/m900/romstage.c new file mode 100644 index 0000000000..1a94d61c91 --- /dev/null +++ b/src/mainboard/lenovo/m900/romstage.c @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +void mainboard_memory_init_params(FSPM_UPD *mupd) +{ + const u16 rcomp_resistors[3] = {121, 75, 100}; + + const u16 rcomp_targets[5] = {50, 26, 20, 20, 26}; + + FSP_M_CONFIG *const mem_cfg = &mupd->FspmConfig; + + struct spd_block blk = { + .addr_map = {0x50, 0x51, 0x52, 0x53}, + }; + + mem_cfg->DqPinsInterleaved = 1; + mem_cfg->CaVrefConfig = 2; + get_spd_smbus(&blk); + mem_cfg->MemorySpdDataLen = blk.len; + mem_cfg->MemorySpdPtr00 = (uintptr_t)blk.spd_array[0]; + mem_cfg->MemorySpdPtr01 = (uintptr_t)blk.spd_array[1]; + mem_cfg->MemorySpdPtr10 = (uintptr_t)blk.spd_array[2]; + mem_cfg->MemorySpdPtr11 = (uintptr_t)blk.spd_array[3]; + dump_spd_info(&blk); + + assert(sizeof(mem_cfg->RcompResistor) == sizeof(rcomp_resistors)); + assert(sizeof(mem_cfg->RcompTarget) == sizeof(rcomp_targets)); + + memcpy(mem_cfg->RcompResistor, rcomp_resistors, sizeof(mem_cfg->RcompResistor)); + memcpy(mem_cfg->RcompTarget, rcomp_targets, sizeof(mem_cfg->RcompTarget)); + + /* use virtual channel 1 for the dmi interface of the PCH */ + mupd->FspmTestConfig.DmiVc1 = 1; +} From d46943d84917a5bf67353379acfb2ec6fd1dd208 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 10 Feb 2025 16:19:19 +0000 Subject: [PATCH 0168/3886] mb/starlabs/starlite_adl: Reconfigure the vGPIO's for CNVi BT It seems FSP will only automatically configure the vGPIO's for CNVi Bluetooth if USB 2 Port 7 is used. On this board, USB 2 Port 9 is used, so manually confgiure the vGPIO's related to CNVi for USB Bluetooth instead of UART. Change-Id: I8d1c337523450de41f11fc9bfbc9b52825d7311c Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86387 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- .../starlite_adl/variants/mk_v/gpio.c | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c b/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c index f7a9737aa3..8a0b804904 100644 --- a/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c +++ b/src/mainboard/starlabs/starlite_adl/variants/mk_v/gpio.c @@ -449,26 +449,36 @@ const struct pad_config gpio_table[] = { /* R7: Not Connected */ PAD_NC(GPP_R7, NONE), - /* BT_EN */ + /* CNV_BTEN */ PAD_CFG_GPO(GPP_VGPIO_0, 1, DEEP), - - /* CNVi BT UART0 */ + /* CNV_BT_HOST_WAKEB */ + PAD_NC(GPP_VGPIO_4, NONE), + /* CNV_BT_IF_SELECT */ + PAD_CFG_GPO(GPP_VGPIO_5, 1, DEEP), + /* vCNV_BT_UART_TXD */ PAD_NC(GPP_VGPIO_6, NONE), + /* vCNV_BT_UART_RXD */ PAD_NC(GPP_VGPIO_7, NONE), + /* vCNV_BT_UART_CTS_B */ PAD_NC(GPP_VGPIO_8, NONE), + /* vCNV_BT_UART_RTS_B */ PAD_NC(GPP_VGPIO_9, NONE), - - /* CNVi UART0 */ + /* vUART0_TXD */ PAD_NC(GPP_VGPIO_18, NONE), + /* vUART0_RXD */ PAD_NC(GPP_VGPIO_19, NONE), + /* vUART0_CTS_B */ PAD_NC(GPP_VGPIO_20, NONE), + /* vUART0_RTS_B */ PAD_NC(GPP_VGPIO_21, NONE), - - /* BT I2S */ - PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), - PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), - PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), - PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), + /* BT_I2S_BCLK */ + PAD_NC(GPP_VGPIO_30, NONE), + /* BT_I2S_SYNC */ + PAD_NC(GPP_VGPIO_31, NONE), + /* BT_I2S_SDO */ + PAD_NC(GPP_VGPIO_32, NONE), + /* BT_I2S_SDI */ + PAD_NC(GPP_VGPIO_33, NONE), }; const struct pad_config *variant_gpio_table(size_t *num) From 7dd2cf2f85aef7f303ad6c466c2146613a663c56 Mon Sep 17 00:00:00 2001 From: Jakub Czapiga Date: Wed, 19 Feb 2025 11:36:28 +0000 Subject: [PATCH 0169/3886] util/cbmem: Use uintN_t instead of uN int types Replace all occurrences of u8, u16, u32 and u64 with their respective alternatives of uint8_t. There is no need to unnecessarily compress code by using standard types aliases. BUG=b:391874512 TEST=Compile cbmem Change-Id: I4fdb4a31923368342ef218144f8cb44624cd4b2a Signed-off-by: Jakub Czapiga Reviewed-on: https://review.coreboot.org/c/coreboot/+/86556 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer Reviewed-by: Elyes Haouas --- util/cbmem/cbmem.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index 15b6770315..bdb6794dbf 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -35,13 +35,8 @@ #include #endif -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - /* Return < 0 on error, 0 on success. */ -static int parse_cbtable(u64 address, size_t table_size); +static int parse_cbtable(uint64_t address, size_t table_size); struct mapping { void *virt; @@ -178,8 +173,8 @@ static size_t mapping_size(const struct mapping *mapping) */ static void *aligned_memcpy(void *dest, const void *src, size_t n) { - u8 *d = dest; - const volatile u8 *s = src; /* volatile to prevent optimization */ + uint8_t *d = dest; + const volatile uint8_t *s = src; /* volatile to prevent optimization */ while ((uintptr_t)s & (sizeof(size_t) - 1)) { if (n-- == 0) @@ -353,7 +348,7 @@ static int parse_cbtable_entries(const struct mapping *table_mapping) } /* Return < 0 on error, 0 on success. */ -static int parse_cbtable(u64 address, size_t table_size) +static int parse_cbtable(uint64_t address, size_t table_size) { const void *buf; struct mapping header_mapping; @@ -441,7 +436,7 @@ static unsigned long arch_tick_frequency(void) char freqs[100]; int size; char *endp; - u64 rv; + uint64_t rv; const char* freq_file = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; @@ -509,7 +504,7 @@ static void timestamp_set_tick_freq(unsigned long table_tick_freq_mhz) debug("Timestamp tick frequency: %ld MHz\n", tick_freq_mhz); } -static u64 arch_convert_raw_ts_entry(u64 ts) +static uint64_t arch_convert_raw_ts_entry(uint64_t ts) { return ts / tick_freq_mhz; } @@ -518,14 +513,14 @@ static u64 arch_convert_raw_ts_entry(u64 ts) * Print an integer in 'normalized' form - with commas separating every three * decimal orders. */ -static void print_norm(u64 v) +static void print_norm(uint64_t v) { if (v >= 1000) { /* print the higher order sections first */ print_norm(v / 1000); - printf(",%3.3u", (u32)(v % 1000)); + printf(",%3.3u", (uint32_t)(v % 1000)); } else { - printf("%u", (u32)(v % 1000)); + printf("%u", (uint32_t)(v % 1000)); } } @@ -1096,9 +1091,9 @@ static void dump_tpm_log(void) } struct cbmem_console { - u32 size; - u32 cursor; - u8 body[]; + uint32_t size; + uint32_t cursor; + uint8_t body[]; } __attribute__ ((__packed__)); #define CBMC_CURSOR_MASK ((1 << 28) - 1) @@ -1828,7 +1823,7 @@ int main(int argc, char** argv) int i; size_t size_to_read = addr_cells * 4 + size_cells * 4; - u8 *dtbuffer = alloca(size_to_read); + uint8_t *dtbuffer = alloca(size_to_read); if (read(fd, dtbuffer, size_to_read) < 0) { perror(reg); return 1; @@ -1836,13 +1831,13 @@ int main(int argc, char** argv) close(fd); /* No variable-length byte swap function anywhere in C... how sad. */ - u64 baseaddr = 0; + uint64_t baseaddr = 0; for (i = 0; i < addr_cells * 4; i++) { baseaddr <<= 8; baseaddr |= *dtbuffer; dtbuffer++; } - u64 cb_table_size = 0; + uint64_t cb_table_size = 0; for (i = 0; i < size_cells * 4; i++) { cb_table_size <<= 8; cb_table_size |= *dtbuffer; From b63f8a1d0e28f95dc225fc8abdc787f7e397ad1c Mon Sep 17 00:00:00 2001 From: David Wu Date: Thu, 20 Feb 2025 16:49:02 +0800 Subject: [PATCH 0170/3886] mb/google/nissa/var/dirks: Add fw_config probe for WIFI Type Use fw_config to probe WIFI Type. BUG=b:389391653 TEST=emerge-nissa coreboot Change-Id: Iaefda61e4929d48f02ce7190e9e45d70b32b75e3 Signed-off-by: David Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86540 Reviewed-by: Eric Lai Reviewed-by: Ivy Jian Tested-by: build bot (Jenkins) --- .../brya/variants/dirks/overridetree.cb | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/mainboard/google/brya/variants/dirks/overridetree.cb b/src/mainboard/google/brya/variants/dirks/overridetree.cb index a953b4ca76..8b7bc438fe 100644 --- a/src/mainboard/google/brya/variants/dirks/overridetree.cb +++ b/src/mainboard/google/brya/variants/dirks/overridetree.cb @@ -1,3 +1,15 @@ +fw_config + field WIFI_SAR_ID 0 0 + option ID_0 0 + option ID_1 1 + end + field WIFI_TYPE 1 2 + option WIFI_ALL 0 + option WIFI_CNVI 1 + option WIFI_PCIE 2 + end +end + chip soc/intel/alderlake register "sagv" = "SaGv_Enabled" @@ -184,7 +196,10 @@ chip soc/intel/alderlake device ref cnvi_wifi on chip drivers/wifi/generic register "enable_cnvi_ddr_rfim" = "true" - device generic 0 on end + device generic 0 on + probe WIFI_TYPE WIFI_CNVI + probe WIFI_TYPE WIFI_ALL + end end end device ref i2c3 on @@ -209,6 +224,8 @@ chip soc/intel/alderlake end device ref pcie_rp11 on # Enable wlan PCIe 11 using clk 2 + probe WIFI_TYPE WIFI_PCIE + probe WIFI_TYPE WIFI_ALL register "pch_pcie_rp[PCH_RP(10)]" = "{ .clk_src = 2, .clk_req = 2, @@ -218,13 +235,19 @@ chip soc/intel/alderlake register "wake" = "GPE0_DW1_03" register "add_acpi_dma_property" = "true" use usb2_port8 as bluetooth_companion - device pci 00.0 on end + device pci 00.0 on + probe WIFI_TYPE WIFI_PCIE + probe WIFI_TYPE WIFI_ALL + end end chip soc/intel/common/block/pcie/rtd3 register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B11)" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_H20)" register "srcclk_pin" = "2" - device generic 0 on end + device generic 0 on + probe WIFI_TYPE WIFI_PCIE + probe WIFI_TYPE WIFI_ALL + end end end device ref emmc on end @@ -315,14 +338,20 @@ chip soc/intel/alderlake register "type" = "UPC_TYPE_INTERNAL" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" - device ref usb2_port8 on end + device ref usb2_port8 on + probe WIFI_TYPE WIFI_PCIE + probe WIFI_TYPE WIFI_ALL + end end chip drivers/usb/acpi register "desc" = ""CNVI Bluetooth"" register "type" = "UPC_TYPE_INTERNAL" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" - device ref usb2_port10 on end + device ref usb2_port10 on + probe WIFI_TYPE WIFI_CNVI + probe WIFI_TYPE WIFI_ALL + end end chip drivers/usb/acpi register "desc" = ""USB3 Type-A Port A1"" From 4dd07e0355ee21fd8ab16e33409ec033e613e49c Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Wed, 17 Apr 2024 17:02:31 +0200 Subject: [PATCH 0171/3886] soc/intel/common/block/cse: Drop unused symbols SOC_INTEL_CSE_RW_A_FMAP_NAME, SOC_INTEL_CSE_RW_B_FMAP_NAME and SOC_INTEL_CSE_RW_HASH_CBFS_NAME are not used. Change-Id: I0639f03baf4edcf5f01d6673137dfbab1f2d4a25 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/81976 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/soc/intel/common/block/cse/Kconfig | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/soc/intel/common/block/cse/Kconfig b/src/soc/intel/common/block/cse/Kconfig index 657494a03a..bfef3d5db8 100644 --- a/src/soc/intel/common/block/cse/Kconfig +++ b/src/soc/intel/common/block/cse/Kconfig @@ -195,30 +195,12 @@ config SOC_INTEL_CSE_FMAP_NAME help Name of CSE region in FMAP -config SOC_INTEL_CSE_RW_A_FMAP_NAME - string "Location of CSE RW A in FMAP" if SOC_INTEL_CSE_RW_UPDATE - default "ME_RW_A" - help - Name of CSE RW A region in FMAP - -config SOC_INTEL_CSE_RW_B_FMAP_NAME - string "Location of CSE RW B in FMAP" if SOC_INTEL_CSE_RW_UPDATE - default "ME_RW_B" - help - Name of CSE RW B region in FMAP - config SOC_INTEL_CSE_RW_CBFS_NAME string "CBFS entry name for CSE RW blob" if SOC_INTEL_CSE_RW_UPDATE default "me_rw" help CBFS entry name for Intel CSE CBFS RW blob -config SOC_INTEL_CSE_RW_HASH_CBFS_NAME - string "CBFS name for CSE RW hash file" if SOC_INTEL_CSE_RW_UPDATE - default "me_rw.hash" - help - CBFS name for Intel CSE CBFS RW hash file - config SOC_INTEL_CSE_RW_VERSION_CBFS_NAME string "CBFS name for CSE RW version file" if SOC_INTEL_CSE_RW_UPDATE default "me_rw.version" From 9e6a52fb506416c817e516cea2423364cce4c616 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Sun, 23 Feb 2025 20:00:02 +0000 Subject: [PATCH 0172/3886] mb/starlabs/byte_adl: Disconnect WLAN Sleep GPIO This GPIO is not connected, so configure it accordingly. Change-Id: I4b3421f1ab676599ffec6b2f46429ce937704e40 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86564 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c index 6981b85fc0..a1b95d020d 100644 --- a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c +++ b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c @@ -37,7 +37,7 @@ const struct pad_config gpio_table[] = { /* GPD8: Suspend Clock */ PAD_CFG_NF(GPD8, NONE, DEEP, NF1), /* GPD9: Wireless LAN Sleep */ - PAD_CFG_NF(GPD9, NONE, DEEP, NF1), + PAD_NC(GPD9, NONE), /* GPD10: Sleep S5 */ PAD_NC(GPD10, NONE), /* GPD11: LAN PHY Enable */ From b84ad781f2a93f3c2e79a1bceb227b59f0d48e5a Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Sun, 23 Feb 2025 20:01:44 +0000 Subject: [PATCH 0173/3886] mb/starlabs/byte_adl: Reconfigure the vGPIO's for CNVi BT Manually confgiure the vGPIO's related to CNVi for USB Bluetooth instead of UART. Change-Id: I7d6007e40b2edbadeb5611f6cd67df0c1e6ee8a6 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86565 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- .../starlabs/byte_adl/variants/mk_ii/gpio.c | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c index a1b95d020d..71b706d270 100644 --- a/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c +++ b/src/mainboard/starlabs/byte_adl/variants/mk_ii/gpio.c @@ -451,26 +451,36 @@ const struct pad_config gpio_table[] = { /* R7: Not Connected */ PAD_NC(GPP_R7, NONE), - /* BT_EN */ + /* CNV_BTEN */ PAD_CFG_GPO(GPP_VGPIO_0, 1, DEEP), - - /* CNVi BT UART0 */ + /* CNV_BT_HOST_WAKEB */ + PAD_NC(GPP_VGPIO_4, NONE), + /* CNV_BT_IF_SELECT */ + PAD_CFG_GPO(GPP_VGPIO_5, 1, DEEP), + /* vCNV_BT_UART_TXD */ PAD_NC(GPP_VGPIO_6, NONE), + /* vCNV_BT_UART_RXD */ PAD_NC(GPP_VGPIO_7, NONE), + /* vCNV_BT_UART_CTS_B */ PAD_NC(GPP_VGPIO_8, NONE), + /* vCNV_BT_UART_RTS_B */ PAD_NC(GPP_VGPIO_9, NONE), - - /* CNVi UART0 */ + /* vUART0_TXD */ PAD_NC(GPP_VGPIO_18, NONE), + /* vUART0_RXD */ PAD_NC(GPP_VGPIO_19, NONE), + /* vUART0_CTS_B */ PAD_NC(GPP_VGPIO_20, NONE), + /* vUART0_RTS_B */ PAD_NC(GPP_VGPIO_21, NONE), - - /* BT I2S */ - PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), - PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), - PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), - PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), + /* BT_I2S_BCLK */ + PAD_NC(GPP_VGPIO_30, NONE), + /* BT_I2S_SYNC */ + PAD_NC(GPP_VGPIO_31, NONE), + /* BT_I2S_SDO */ + PAD_NC(GPP_VGPIO_32, NONE), + /* BT_I2S_SDI */ + PAD_NC(GPP_VGPIO_33, NONE), }; const struct pad_config *variant_gpio_table(size_t *num) From d9d731d97dffd46459b8455b4c0dc73ffb684e97 Mon Sep 17 00:00:00 2001 From: Tongtong Pan Date: Thu, 20 Feb 2025 19:49:33 +0800 Subject: [PATCH 0174/3886] mb/google/fatcat/var/felino: Modify the overridetree.cb for enable touchpad Modify the overridetree.cb configuration and gpio.c to enable touchpad. BUG=b:388982526 TEST=abuild -v -a -x -c max -p none -t google/fatcat -b felino Change-Id: I47667120f098727f0d3ef05c17ea48f62b13c135 Signed-off-by: Tongtong Pan Reviewed-on: https://review.coreboot.org/c/coreboot/+/86542 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- .../google/fatcat/variants/felino/gpio.c | 10 +++++----- .../fatcat/variants/felino/overridetree.cb | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/felino/gpio.c b/src/mainboard/google/fatcat/variants/felino/gpio.c index 6c75a416b6..e5ca754dea 100644 --- a/src/mainboard/google/fatcat/variants/felino/gpio.c +++ b/src/mainboard/google/fatcat/variants/felino/gpio.c @@ -222,10 +222,10 @@ static const struct pad_config gpio_table[] = { PAD_NC(GPP_E10, NONE), /* GPP_E11: NC */ PAD_NC(GPP_E11, NONE), - /* GPP_E12: I2C0_SOC_SCL */ - PAD_CFG_NF(GPP_E12, NONE, DEEP, NF1), - /* GPP_E13: I2C0_SOC_SDA */ - PAD_CFG_NF(GPP_E13, NONE, DEEP, NF1), + /* GPP_E12: I2C4_SOC_SCL */ + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF8), + /* GPP_E13: I2C4_SOC_SDA */ + PAD_CFG_NF(GPP_E13, NONE, DEEP, NF8), /* GPP_E14: NC */ PAD_NC(GPP_E14, NONE), /* GPP_E15: NC */ @@ -235,7 +235,7 @@ static const struct pad_config gpio_table[] = { /* GPP_E17: NC */ PAD_NC(GPP_E17, NONE), /* GPP_E18: TOUCHPAD_INT_N */ - PAD_CFG_NF(GPP_E18, NONE, DEEP, NF3), + PAD_CFG_GPI_APIC(GPP_E18, NONE, PLTRST, LEVEL, NONE), /* GPP_E19: HW_ID5 */ PAD_CFG_GPO(GPP_E19, 1, PLTRST), /* GPP_E20: HW_ID4 */ diff --git a/src/mainboard/google/fatcat/variants/felino/overridetree.cb b/src/mainboard/google/fatcat/variants/felino/overridetree.cb index 62b4160b74..6b4d32e0a0 100644 --- a/src/mainboard/google/fatcat/variants/felino/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/felino/overridetree.cb @@ -70,6 +70,9 @@ chip soc/intel/pantherlake }, .i2c[4] = { .speed = I2C_SPEED_FAST, + .rise_time_ns = 650, + .fall_time_ns = 350, + .data_hold_time_ns = 400, }, }" @@ -231,14 +234,13 @@ chip soc/intel/pantherlake end # I2C1 device ref i2c4 on - chip drivers/i2c/hid - register "generic.hid" = ""P3840"" - register "generic.desc" = ""Synaptics TOUCHPAD"" - register "generic.irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E18_IRQ)" - register "generic.uid" = "5" - register "generic.detect" = "1" - register "hid_desc_reg_offset" = "0x20" - device i2c 2c on end + chip drivers/i2c/generic + register "hid" = ""ELAN0000"" + register "desc" = ""ELAN Touchpad"" + register "irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_E18_IRQ)" + register "wake" = "GPE0_DW2_18" + register "detect" = "1" + device i2c 0x15 on end end end # I2C4 From 9c0edfa76bfabe87f083da84c1c53734787f6a95 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Thu, 20 Feb 2025 07:53:41 +0100 Subject: [PATCH 0175/3886] libpayload/tests: Remove unused test files Change-Id: Id2cec6a56ba5ce98832aced6fc2cfd8ebda91f02 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/86536 Reviewed-by: Julius Werner Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- payloads/libpayload/tests/Makefile | 12 -------- payloads/libpayload/tests/cbfs-x86-test.c | 34 ----------------------- 2 files changed, 46 deletions(-) delete mode 100644 payloads/libpayload/tests/Makefile delete mode 100644 payloads/libpayload/tests/cbfs-x86-test.c diff --git a/payloads/libpayload/tests/Makefile b/payloads/libpayload/tests/Makefile deleted file mode 100644 index 8c55053af7..0000000000 --- a/payloads/libpayload/tests/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CC=gcc -g -m32 -INCLUDES=-I. -I../include -I../include/x86 -TARGETS=cbfs-x86-test - -cbfs-x86-test: cbfs-x86-test.c ../arch/x86/rom_media.c ../libcbfs/ram_media.c ../libcbfs/cbfs.c - $(CC) -o $@ $^ $(INCLUDES) - - -all: $(TARGETS) - -run: all - for i in $(TARGETS); do ./$$i; done diff --git a/payloads/libpayload/tests/cbfs-x86-test.c b/payloads/libpayload/tests/cbfs-x86-test.c deleted file mode 100644 index 81029656fc..0000000000 --- a/payloads/libpayload/tests/cbfs-x86-test.c +++ /dev/null @@ -1,34 +0,0 @@ -/* system headers */ -#include -#include - -/* libpayload headers */ -#include "cbfs.h" - -int fail(const char* str) -{ - fprintf(stderr, "%s", str); - exit(1); -} - -int main(int argc, char** argv) -{ - FILE *cbfs = fopen("data/cbfs-x86.bin", "rb"); - if (!cbfs) fail("could not open test file\n"); - if (fseek(cbfs, 0, SEEK_END) != 0) fail("seek to end failed\n"); - - long size = ftell(cbfs); - if (size == -1) fail("could not determine file size\n"); - if (fseek(cbfs, 0, SEEK_SET) != 0) fail("seek to start failed\n"); - - void *data = malloc(size); - if (!data) fail("could not allocate buffer\n"); - - if (fread(data, size, 1, cbfs) != 1) fail("could not read data\n"); - if (fclose(cbfs)) fail("could not close file\n"); - - if (setup_cbfs_from_ram(data, size) != 0) fail("could not setup CBFS in RAM\n"); - struct cbfs_file *file = cbfs_find("foo"); - if (file == NULL) fail("could not find file in CBFS\n"); - exit(0); -} From 5a7c1c6729a5cc0d26123ae0c97d8547d35ee602 Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Mon, 24 Feb 2025 12:35:05 +0530 Subject: [PATCH 0176/3886] mb/google/trulo: Lock GPIO pad configuration for GPP_F17 BUG=b:397905085 TEST=Make sure that GPP_F17 pad configuration is locked. Change-Id: I9211ac70539d251746332448691d22b454bc6a2b Signed-off-by: Kapil Porwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/86579 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Jayvik Desai Reviewed-by: Eric Lai --- src/mainboard/google/brya/variants/trulo/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/variants/trulo/gpio.c b/src/mainboard/google/brya/variants/trulo/gpio.c index c813154cf8..3ccc54a3e2 100644 --- a/src/mainboard/google/brya/variants/trulo/gpio.c +++ b/src/mainboard/google/brya/variants/trulo/gpio.c @@ -242,7 +242,7 @@ static const struct pad_config gpio_table[] = { /* F16 : NC */ PAD_NC_LOCK(GPP_F16, NONE, LOCK_CONFIG), /* F17 : THC1_SPI2_RST# ==> EC_SOC_WAKE_ODL */ - PAD_CFG_GPI_IRQ_WAKE(GPP_F17, NONE, PWROK, EDGE_SINGLE, INVERT), + PAD_CFG_GPI_IRQ_WAKE_LOCK(GPP_F17, NONE, EDGE_SINGLE, INVERT, LOCK_CONFIG), /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */ PAD_CFG_GPI_LOCK(GPP_F18, NONE, LOCK_CONFIG), /* F19 : Not available */ From 5c53441738c8eb72da1f7caf5633ae9a94020d96 Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Fri, 21 Feb 2025 19:25:35 +0530 Subject: [PATCH 0177/3886] mb/google/trulo: Update GPIO wake pins List of changes - 1. Make GPP_B3 IRQ only pin. 2. Remove redundant GPE option from touchpad device. BUG=b:397905085 TEST=Verified wake from S0ix using touchpad. Change-Id: I055a60476e4a37bf74940802157bb9cd30bac3c4 Signed-off-by: Kapil Porwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/86555 Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai Reviewed-by: Eric Lai Reviewed-by: Subrata Banik --- src/mainboard/google/brya/variants/trulo/gpio.c | 2 +- src/mainboard/google/brya/variants/trulo/overridetree.cb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/trulo/gpio.c b/src/mainboard/google/brya/variants/trulo/gpio.c index 3ccc54a3e2..fb805d6f28 100644 --- a/src/mainboard/google/brya/variants/trulo/gpio.c +++ b/src/mainboard/google/brya/variants/trulo/gpio.c @@ -58,7 +58,7 @@ static const struct pad_config gpio_table[] = { /* B2 : NC */ PAD_NC(GPP_B2, NONE), /* B3 : CPU_GP2 ==> EC_TP_INT */ - PAD_CFG_GPI_IRQ_WAKE(GPP_B3, NONE, PWROK, LEVEL, INVERT), + PAD_CFG_GPI_APIC(GPP_B3, NONE, PWROK, LEVEL, INVERT), /* B4 : PROC_GP3 ==> EN_PP3300_UCAM_X */ PAD_CFG_GPO_LOCK(GPP_B4, 1, LOCK_CONFIG), /* B5 : GPP_B5 ==> ISH_I2C0_SCL */ diff --git a/src/mainboard/google/brya/variants/trulo/overridetree.cb b/src/mainboard/google/brya/variants/trulo/overridetree.cb index cdc777b0b0..4c21173a76 100644 --- a/src/mainboard/google/brya/variants/trulo/overridetree.cb +++ b/src/mainboard/google/brya/variants/trulo/overridetree.cb @@ -455,7 +455,6 @@ chip soc/intel/alderlake register "hid" = ""ELAN0000"" register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_B3_IRQ)" - register "wake" = "GPE0_DW1_03" register "detect" = "1" device i2c 15 on end end From d64385f307943caf7f2a612992bf4afaf71bfa25 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 19 Feb 2025 09:47:40 +0000 Subject: [PATCH 0178/3886] acpi: Fix incorrect TPM2 table generation for CRB_TPM If CONFIG(CRB_TPM) is enabled but the TPM is inactive, and no other TPM interface (SPI, I2C, Memory-Mapped) is configured, the function would incorrectly fallback to generate a TPM2 table for FIFO mode. This commit adds a check to ensure crb_tpm_is_active() is only called if CONFIG(CRB_TPM) is enabled and no other TPM interface is present. If the CRB TPM is inactive and no other TPMs are available, the function now exits early to prevent generating an invalid TPM2 table. Test=boot `starlabs/starlite_adl` and check Linux doesn't probe for a TPM when PTT is not active. Change-Id: I153779aa1f3d84ffeb694543f9da1d09b120f98f Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86513 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/acpi/acpi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 8f5c09fd08..06879540bf 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -258,6 +258,10 @@ static void acpi_create_tpm2(acpi_header_t *header, void *unused) if (tlcl_get_family() != TPM_2) return; + if (CONFIG(CRB_TPM) && !(CONFIG(SPI_TPM) || CONFIG(I2C_TPM) || CONFIG(MEMORY_MAPPED_TPM))) + if (!crb_tpm_is_active()) + return; + acpi_tpm2_t *tpm2 = (acpi_tpm2_t *)header; u32 tpm2_log_len; void *lasa; @@ -275,7 +279,7 @@ static void acpi_create_tpm2(acpi_header_t *header, void *unused) /* Hard to detect for coreboot. Just set it to 0 */ tpm2->platform_class = 0; - if (CONFIG(CRB_TPM) && crb_tpm_is_active()) { + if (CONFIG(CRB_TPM)) { /* Must be set to 7 for CRB Support */ tpm2->control_area = CONFIG_CRB_TPM_BASE_ADDRESS + 0x40; tpm2->start_method = 7; From bf649fb150eb21f241d101c5ed1aa87a0826a8ea Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 11 Feb 2025 20:40:28 +0000 Subject: [PATCH 0179/3886] drivers/crb: Always generate TPM ACPI Tables Commit `fb2c09d5162719a72f0fbc533bec0aa3e8458b93` stopped the SSDT containing TPM tables if PTT was not active, as at the time, the table unconditionally reported the device present in the _STA method. Commit `d503ce1277b968daf9f96bb2215c8ec0e8a17f8a` made the _STA to return an accurate state, so now, the tables can always be generated and Linux will report the presence correctly. Change-Id: I594bf25a207b809c1ae2632eb1aea0d0fb6df35e Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86369 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/drivers/crb/tis.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/drivers/crb/tis.c b/src/drivers/crb/tis.c index 0222f6d92d..b51a04f54f 100644 --- a/src/drivers/crb/tis.c +++ b/src/drivers/crb/tis.c @@ -210,11 +210,6 @@ static struct device_operations __maybe_unused crb_ops = { static void enable_dev(struct device *dev) { - if (crb_tis_probe(NULL) == NULL) { - dev->enabled = 0; - return; - } - #if !DEVTREE_EARLY dev->ops = &crb_ops; #endif From 024a23e47869d197b18541dbd21df0d451f75403 Mon Sep 17 00:00:00 2001 From: Guangjie Song Date: Mon, 10 Feb 2025 19:24:38 +0800 Subject: [PATCH 0180/3886] soc/mediatek/mt8196: Disable HWRot's clocks HWRot (Hardware Root of trust) is not used, so we disable its clocks to save power. This patch is a subitem of Vcore power consumption improvement. The whole work improves SoC power consumption from 120mW to 90mW in suspend. BRANCH=rauru BUG=b:377628718 TEST=Bootup OK & Suspend/Resume passed Signed-off-by: Guangjie Song Change-Id: I25e607e8e8b2d52608d279e1862f423ca50aab6a Reviewed-on: https://review.coreboot.org/c/coreboot/+/86553 Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/mt8196/pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/mt8196/pll.c b/src/soc/mediatek/mt8196/pll.c index 2007197003..91d2fed669 100644 --- a/src/soc/mediatek/mt8196/pll.c +++ b/src/soc/mediatek/mt8196/pll.c @@ -1628,14 +1628,14 @@ void mt_pll_post_init(void) write32(&mtk_topckgen->clk_cfg[12].set, 0x80800000); write32(&mtk_topckgen->clk_cfg[15].set, 0x8000); write32(&mtk_topckgen->clk_cfg[16].set, 0x800000); - write32(&mtk_topckgen->clk_cfg[18].set, 0x80000000); + write32(&mtk_topckgen->clk_cfg[18].set, 0x80800000); write32(&mtk_topckgen->clk_cfg[19].set, 0x80808000); write32(&mtk_topckgen->clk_cfg[20].set, 0x80808080); write32(&mtk_topckgen->clk_cfg[21].set, 0x80808080); write32(&mtk_topckgen->clk_cfg[22].set, 0x80); write32(&mtk_vlpsys->vlp_clk_cfg[6].set, 0x80); - write32(&mtk_vlpsys->vlp_clk_cfg[10].set, 0x80800000); + write32(&mtk_vlpsys->vlp_clk_cfg[10].set, 0x80808000); write32(&mtk_vlpsys->vlp_clk_cfg[11].set, 0x80); write32(&mtk_topckgen2->cksys2_clk_cfg[0].set, 0x80808080); From a8139c0b87053dbe9868da01c8e64e64e62786e3 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Mon, 24 Feb 2025 17:21:35 +0100 Subject: [PATCH 0181/3886] treewide: Rename PM4LE -> PML4E MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The x86 (AMD and Intel) spec defines it as Page-Map Level-4 Entry. It is annoying when searching for the wrong abbreviation in the spec so fix it everywhere it occurs. source: Intel 64 spec April 2022 and AMD64 spec April 2024. Signed-off-by: Maximilian Brune Change-Id: I730235beea69b3720f080bbade083c2eeed26587 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86587 Reviewed-by: Jérémy Compostella Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Benjamin Doron Reviewed-by: Andy Ebrahiem --- payloads/libpayload/arch/x86/head_64.S | 4 ++-- payloads/libpayload/arch/x86/pt.S | 8 ++++---- src/cpu/intel/car/core2/cache_as_ram.S | 2 +- src/cpu/intel/car/non-evict/cache_as_ram.S | 2 +- src/cpu/intel/car/p4-netburst/cache_as_ram.S | 2 +- src/cpu/x86/64bit/mode_switch2.S | 2 +- src/cpu/x86/64bit/pt.S | 4 ++-- src/cpu/x86/64bit/pt1G.S | 4 ++-- src/cpu/x86/smm/smm_module_loader.c | 10 +++++----- src/soc/amd/common/block/cpu/noncar/pre_c.S | 2 +- src/soc/intel/common/block/cpu/car/cache_as_ram.S | 2 +- src/soc/intel/common/block/cpu/car/cache_as_ram_fsp.S | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/payloads/libpayload/arch/x86/head_64.S b/payloads/libpayload/arch/x86/head_64.S index 65242749fa..1fd0d01e7a 100644 --- a/payloads/libpayload/arch/x86/head_64.S +++ b/payloads/libpayload/arch/x86/head_64.S @@ -70,7 +70,7 @@ _entry: movl %eax, cb_header_ptr call init_page_table - movl $pm4le, %eax + movl $pml4e, %eax /* load identity mapped page tables */ movl %eax, %cr3 @@ -107,7 +107,7 @@ _init64: movq %rdi, cb_header_ptr call init_page_table - movq $pm4le, %rax + movq $pml4e, %rax /* load identity mapped page tables */ movq %rax, %cr3 diff --git a/payloads/libpayload/arch/x86/pt.S b/payloads/libpayload/arch/x86/pt.S index 0e6e7bffef..080d044b84 100644 --- a/payloads/libpayload/arch/x86/pt.S +++ b/payloads/libpayload/arch/x86/pt.S @@ -41,10 +41,10 @@ #define _D (1ULL << 6) #define _PS (1ULL << 7) -.section .bss.pm4le -.global pm4le +.section .bss.pml4e +.global pml4e .align 4096 -pm4le: +pml4e: .skip 8 .section .bss.main_page_table @@ -144,6 +144,6 @@ no_overflow_1gb: leave: or $(_PRES + _RW + _US + _A), %eax - mov %eax, pm4le + mov %eax, pml4e ret diff --git a/src/cpu/intel/car/core2/cache_as_ram.S b/src/cpu/intel/car/core2/cache_as_ram.S index 227ddf4c22..de945a9396 100644 --- a/src/cpu/intel/car/core2/cache_as_ram.S +++ b/src/cpu/intel/car/core2/cache_as_ram.S @@ -163,7 +163,7 @@ addrsize_set_high: subl $4, %esp #if ENV_X86_64 - setup_longmode $PM4LE + setup_longmode $PML4E movd %mm2, %rdi shlq $32, %rdi diff --git a/src/cpu/intel/car/non-evict/cache_as_ram.S b/src/cpu/intel/car/non-evict/cache_as_ram.S index 9485cd44fb..7186422595 100644 --- a/src/cpu/intel/car/non-evict/cache_as_ram.S +++ b/src/cpu/intel/car/non-evict/cache_as_ram.S @@ -214,7 +214,7 @@ end_microcode_update: andl $0xfffffff0, %esp #if ENV_X86_64 - setup_longmode $PM4LE + setup_longmode $PML4E movd %mm2, %rdi shlq $32, %rdi diff --git a/src/cpu/intel/car/p4-netburst/cache_as_ram.S b/src/cpu/intel/car/p4-netburst/cache_as_ram.S index 1cb422dbfc..1843954539 100644 --- a/src/cpu/intel/car/p4-netburst/cache_as_ram.S +++ b/src/cpu/intel/car/p4-netburst/cache_as_ram.S @@ -363,7 +363,7 @@ fill_cache: subl $4, %esp #if ENV_X86_64 - setup_longmode $PM4LE + setup_longmode $PML4E movd %mm2, %rdi shlq $32, %rdi /* BIST */ diff --git a/src/cpu/x86/64bit/mode_switch2.S b/src/cpu/x86/64bit/mode_switch2.S index 18c6425d7f..3be56c4c5a 100644 --- a/src/cpu/x86/64bit/mode_switch2.S +++ b/src/cpu/x86/64bit/mode_switch2.S @@ -21,7 +21,7 @@ long_mode_call_3arg: mov %esp, %ebp /* Enter long mode, preserves ebx */ - setup_longmode $PM4LE + setup_longmode $PML4E /* Align stack */ movabs $0xfffffffffffffff0, %rax diff --git a/src/cpu/x86/64bit/pt.S b/src/cpu/x86/64bit/pt.S index 4b2f3c8163..1297296a37 100644 --- a/src/cpu/x86/64bit/pt.S +++ b/src/cpu/x86/64bit/pt.S @@ -17,9 +17,9 @@ #define _GEN_DIR(a) (_PRES + _RW + _US + _A + (a)) #define _GEN_PAGE(a) (_PRES + _RW + _US + _PS + _A + _D + (a)) -.global PM4LE +.global PML4E .align 4096 -PM4LE: +PML4E: .quad _GEN_DIR(PDPT) .align 4096 diff --git a/src/cpu/x86/64bit/pt1G.S b/src/cpu/x86/64bit/pt1G.S index 3502964d15..42cdfb17d0 100644 --- a/src/cpu/x86/64bit/pt1G.S +++ b/src/cpu/x86/64bit/pt1G.S @@ -17,9 +17,9 @@ #define _GEN_DIR(a) (_PRES + _RW + _US + _A + (a)) #define _GEN_PAGE(a) (_PRES + _RW + _US + _PS + _A + _D + (a)) -.global PM4LE +.global PML4E .align 4096 -PM4LE: +PML4E: .quad _GEN_DIR(PDPT) .align 4096 diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index c6d0753c6b..ba92e1ff2f 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -420,27 +420,27 @@ static int append_and_check_region(const struct region smram, #define _GEN_PAGE(a) (_PRES + _RW + _US + _PS + _A + _D + (a)) #define PAGE_SIZE 8 -/* Return the PM4LE */ +/* Return the PML4E */ static uintptr_t install_page_table(const uintptr_t handler_base) { const bool one_g_pages = !!(cpuid_edx(0x80000001) & (1 << 26)); /* 4 1G pages or 4 PDPE entries with 512 * 2M pages */ const size_t pages_needed = one_g_pages ? 4 : 2048 + 4; const uintptr_t pages_base = ALIGN_DOWN(handler_base - pages_needed * PAGE_SIZE, 4096); - const uintptr_t pm4le = ALIGN_DOWN(pages_base - 8, 4096); + const uintptr_t pml4e = ALIGN_DOWN(pages_base - 8, 4096); if (one_g_pages) { for (size_t i = 0; i < 4; i++) write64p(pages_base + i * PAGE_SIZE, _GEN_PAGE(1ull * GiB * i)); - write64p(pm4le, _GEN_DIR(pages_base)); + write64p(pml4e, _GEN_DIR(pages_base)); } else { for (size_t i = 0; i < 2048; i++) write64p(pages_base + i * PAGE_SIZE, _GEN_PAGE(2ull * MiB * i)); - write64p(pm4le, _GEN_DIR(pages_base + 2048 * PAGE_SIZE)); + write64p(pml4e, _GEN_DIR(pages_base + 2048 * PAGE_SIZE)); for (size_t i = 0; i < 4; i++) write64p(pages_base + (2048 + i) * PAGE_SIZE, _GEN_DIR(pages_base + 4096 * i)); } - return pm4le; + return pml4e; } /* diff --git a/src/soc/amd/common/block/cpu/noncar/pre_c.S b/src/soc/amd/common/block/cpu/noncar/pre_c.S index 0e0be524f2..b75458815e 100644 --- a/src/soc/amd/common/block/cpu/noncar/pre_c.S +++ b/src/soc/amd/common/block/cpu/noncar/pre_c.S @@ -28,7 +28,7 @@ bootblock_pre_c_entry: post_code(POSTCODE_BOOTBLOCK_PRE_C_ENTRY) #if ENV_X86_64 - setup_longmode $PM4LE + setup_longmode $PML4E #endif /* Clear .bss section */ diff --git a/src/soc/intel/common/block/cpu/car/cache_as_ram.S b/src/soc/intel/common/block/cpu/car/cache_as_ram.S index 2c4beebf46..b84a06e0ba 100644 --- a/src/soc/intel/common/block/cpu/car/cache_as_ram.S +++ b/src/soc/intel/common/block/cpu/car/cache_as_ram.S @@ -280,7 +280,7 @@ car_init_done: andl $0xfffffff0, %esp #if ENV_X86_64 - setup_longmode $PM4LE + setup_longmode $PML4E movd %mm2, %rdi shlq $32, %rdi diff --git a/src/soc/intel/common/block/cpu/car/cache_as_ram_fsp.S b/src/soc/intel/common/block/cpu/car/cache_as_ram_fsp.S index 4e057f046d..ed735dbce3 100644 --- a/src/soc/intel/common/block/cpu/car/cache_as_ram_fsp.S +++ b/src/soc/intel/common/block/cpu/car/cache_as_ram_fsp.S @@ -83,7 +83,7 @@ CAR_init_done: movl %ecx, temp_memory_start #if ENV_X86_64 - setup_longmode $PM4LE + setup_longmode $PML4E movl %ebp, %edi shlq $32, %rdi movd %mm1, %rsi From d9da2628292123e571e58947200fbf56afda677e Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 24 Feb 2025 11:40:35 +0530 Subject: [PATCH 0182/3886] soc/intel/common/reset: Mark do_low_battery_poweroff with __noreturn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the low battery poweroff scenario, the platform should halt after issuing the poweroff command. This ensures that no further code execution occurs, preventing potential issues. Additionally, the do_low_battery_poweroff() function is marked with __noreturn to indicate that it does not return. This is appropriate because the platform will either power off or halt. TEST=Able to compile google/fatcat. Change-Id: Ieb77645283360b5731ca48b94551712b99109a1c Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86578 Reviewed-by: Jérémy Compostella Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai --- src/soc/intel/common/reset.c | 1 + src/soc/intel/common/reset.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/common/reset.c b/src/soc/intel/common/reset.c index 3fefa57d30..307be5769a 100644 --- a/src/soc/intel/common/reset.c +++ b/src/soc/intel/common/reset.c @@ -32,4 +32,5 @@ void do_low_battery_poweroff(void) } poweroff(); + halt(); } diff --git a/src/soc/intel/common/reset.h b/src/soc/intel/common/reset.h index 8331853023..71fe05d638 100644 --- a/src/soc/intel/common/reset.h +++ b/src/soc/intel/common/reset.h @@ -30,6 +30,6 @@ efi_return_status_t fsp_get_pch_reset_status(void); * * Call this function to power off the platform if the battery level is critically low. */ -void do_low_battery_poweroff(void); +__noreturn void do_low_battery_poweroff(void); #endif /* _INTEL_COMMON_RESET_H_ */ From e4ee0ce5ac8c479f7966d047642258ca0f3048e8 Mon Sep 17 00:00:00 2001 From: Anil Kumar Date: Thu, 7 Nov 2024 13:48:41 -0800 Subject: [PATCH 0183/3886] soc/intel/pantherlake: Display Sign-of-Life during memory training This commit activates the Firmware Support Package (FSP) Memory Sign-of-Life feature (FSP_UGOP_EARLY_SIGN_OF_LIFE), which allows for the display of a user-configurable text message on-screen during memory initialization. This feature enhances the user experience by providing reassurance that the memory training process is underway and may take some time. The following FSP-M UPDs (Updateable Product Data) are utilized: - VgaInitControl (boolean): Initializes graphics, establishes VGA text mode, and centers the VgaMessage text on the screen. It clears the screen, disables VGA text mode, and deactivates graphics upon exiting the FSP-M (Firmware Support Package - Memory Initialization). - VbtPtr (address): This is a pointer to the VBT (Video BIOS Table) binary. - VbtSize (unsigned integer): Indicates the size of the VBT binary. - LidStatus (boolean): Given the limited resources available at early boot stages, the text message is shown on a single monitor. The lid status determines the most appropriate display to use: - 0: If the lid is closed, display the text message on an external display if one is available; otherwise, display nothing. - 1: If the lid is open, display the message on the internal display; if unavailable, default to an external display. - VgaMessage (string): Specifies the text message to be displayed. When the FSP_UGOP_EARLY_SIGN_OF_LIFE flag is set, coreboot is configured to use the UPDs mentioned above to show a text message during the memory training phase. This text message can be customized through the locale text mechanism using the identifier memory_training_desc. In addition, the newly introduced code records an extra event to indicate when early Sign-Of-Life has been requested, to cover the Memory Reference Code (MRC) training scenario. This event logging is crucial for debugging and analyzing the boot process, especially in production environments where it helps in pinpointing the exact stage where a boot issue might occur. TEST="Enabling FSP-M Sign-of-Life" message is present in the log upon the first boot, and a message is displayed on the screen while the FSP performs MRC training. Signed-off-by: Anil Kumar Signed-off-by: Jeremy Compostella Change-Id: I993eb0d59cd01fa62f35a77f84e262e389efb367 Reviewed-on: https://review.coreboot.org/c/coreboot/+/85454 Reviewed-by: Ronak Kanabar Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal Reviewed-by: Subrata Banik --- src/soc/intel/pantherlake/Kconfig | 1 + .../intel/pantherlake/romstage/fsp_params.c | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/soc/intel/pantherlake/Kconfig b/src/soc/intel/pantherlake/Kconfig index df95e529e3..a54f0defe5 100644 --- a/src/soc/intel/pantherlake/Kconfig +++ b/src/soc/intel/pantherlake/Kconfig @@ -17,6 +17,7 @@ config SOC_INTEL_PANTHERLAKE_BASE select FAST_SPI_SUPPORTS_EXT_BIOS_WINDOW select FSP_COMPRESS_FSP_S_LZ4 select FSP_M_XIP + select FSP_UGOP_EARLY_SIGN_OF_LIFE select FSP_USES_CB_DEBUG_EVENT_HANDLER select FSPS_HAS_ARCH_UPD select GENERIC_GPIO_LIB diff --git a/src/soc/intel/pantherlake/romstage/fsp_params.c b/src/soc/intel/pantherlake/romstage/fsp_params.c index 0c17d020c3..8de99d2f95 100644 --- a/src/soc/intel/pantherlake/romstage/fsp_params.c +++ b/src/soc/intel/pantherlake/romstage/fsp_params.c @@ -1,7 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include +#include #include #include #include @@ -11,6 +13,7 @@ #include #include #include +#include #define FSP_CLK_NOTUSED 0xff #define FSP_CLK_LAN 0x70 @@ -355,6 +358,35 @@ static void fill_fsp_event_handler(FSPM_UPD *mupd) fsp_control_log_level(mupd, fsp_debug_enable); } +static void fill_fspm_sign_of_life(FSPM_UPD *mupd) +{ + FSP_M_CONFIG *m_cfg = &mupd->FspmConfig; + FSPM_ARCHx_UPD *arch_upd = &mupd->FspmArchUpd; + void *vbt; + size_t vbt_size; + + if (arch_upd->NvsBufferPtr) + return; + + /* To enhance the user experience, let's display on-screen guidance during memory + training, acknowledging that the process may require patience. */ + + vbt = cbfs_map("vbt.bin", &vbt_size); + if (!vbt) { + printk(BIOS_ERR, "Could not load vbt.bin\n"); + return; + } + + printk(BIOS_INFO, "Enabling FSP-M Sign-of-Life\n"); + elog_add_event_byte(ELOG_TYPE_FW_EARLY_SOL, ELOG_FW_EARLY_SOL_MRC); + + m_cfg->VgaInitControl = 1; + m_cfg->VbtPtr = (efi_uintn_t)vbt; + m_cfg->VbtSize = vbt_size; + m_cfg->LidStatus = CONFIG(VBOOT_LID_SWITCH) ? get_lid_switch() : CONFIG(RUN_FSP_GOP); + m_cfg->VgaMessage = (efi_uintn_t)ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); +} + void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) { const struct soc_intel_pantherlake_config *config = config_of_soc(); @@ -363,6 +395,10 @@ void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) fill_fsp_event_handler(mupd); soc_memory_init_params(&mupd->FspmConfig, config); + + if (CONFIG(FSP_UGOP_EARLY_SIGN_OF_LIFE)) + fill_fspm_sign_of_life(mupd); + mainboard_memory_init_params(mupd); } From 77e8b821cbda0570731ac4f20745c0f9a6692642 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sun, 16 Feb 2025 22:55:04 +0530 Subject: [PATCH 0184/3886] drivers/intel/fsp2_0: Add early low-battery shutdown during memory init This commit introduces an early low-battery shutdown mechanism during FSP memory initialization. This is particularly important during firmware updates, where memory training can consume significant power and lead to abrupt shutdowns, potentially corrupting the firmware. The changes include: - Adding platform_display_early_shutdown_notification() to notify the user of the impending shutdown. - Checking platform_is_low_battery_shutdown_needed() to determine if a shutdown is necessary. - Implementing a shutdown sequence if low battery is detected during memory init, especially when no MRC cache is found (i.e. firmware update). - Deferring shutdown on systems without MAINBOARD_HAS_EARLY_LIBGFXINIT so that FSP-M (uGOP) can display a message. This prevents firmware update corruption due to low battery. BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown. Change-Id: Ia135b238d1e16722c2ca8d3b461e83b4ce513adf Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86452 Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal --- src/drivers/intel/fsp2_0/include/fsp/api.h | 20 ++++++++++++ src/drivers/intel/fsp2_0/memory_init.c | 36 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h index 28b24ce95f..d159b71e02 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/api.h +++ b/src/drivers/intel/fsp2_0/include/fsp/api.h @@ -63,6 +63,26 @@ bool platform_is_low_battery_shutdown_needed(void); #else static inline bool platform_is_low_battery_shutdown_needed(void) { return false; } #endif + +/* + * Displays an early shutdown notification to the user. + * + * This function is responsible to perform the needful operations for informing + * the user that the system is about to shut down prematurely. The implementation + * might be different depending upon the underlying technology that can be used for + * implementing eSOL for user notification. + * + * Argument: NULL for platform with libgfxinit and FSP-M UPD pointer for uGOP. + * + * Note: This function should be called before the actual shutdown process begins, + * allowing the user to potentially save data or take other necessary actions. + */ +#if CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) +void platform_display_early_shutdown_notification(void *arg); +#else +static inline void platform_display_early_shutdown_notification(void *arg) { /* nop */ } +#endif + /* Check if MultiPhase Si Init is enabled */ bool fsp_is_multi_phase_init_enabled(void); /* diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index ce0d2831e3..38627c6b06 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -331,6 +332,31 @@ static void fspm_multi_phase_init(const struct fsp_header *hdr) timestamp_add_now(TS_FSP_MULTI_PHASE_MEM_INIT_END); } +/** + * Checks for low battery during firmware update and initiates shutdown if necessary. + * + * This function checks if the system is in firmware update mode (indicated by + * a missing MRC cache) and if the battery is critically low. If both conditions + * are met, it initiates a shutdown to prevent interruption of the firmware + * update process. + */ +static void handle_low_battery_during_firmware_update(bool *defer_shutdown, FSPM_UPD *fspm_upd) +{ + if (!CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) || + !platform_is_low_battery_shutdown_needed()) + return; + + if (CONFIG(MAINBOARD_HAS_EARLY_LIBGFXINIT)) { + platform_display_early_shutdown_notification(NULL); + /* User has been notified of low battery; safe to power off. */ + do_low_battery_poweroff(); /* Do not return */ + } + + /* Defer shutdown until FSP-M (uGOP) display text message for user notification */ + platform_display_early_shutdown_notification(fspm_upd); + *defer_shutdown = true; +} + static void do_fsp_memory_init(const struct fspm_context *context, bool s3wake) { efi_return_status_t status; @@ -338,6 +364,7 @@ static void do_fsp_memory_init(const struct fspm_context *context, bool s3wake) FSPM_UPD fspm_upd, *upd; FSPM_ARCHx_UPD *arch_upd; uint32_t version; + bool poweroff_after_fsp_execution = false; const struct fsp_header *hdr = &context->header; const struct memranges *memmap = &context->memmap; @@ -389,6 +416,11 @@ static void do_fsp_memory_init(const struct fspm_context *context, bool s3wake) early_ramtop_enable_cache_range(); #endif + /* Low battery check during firmware update */ + if (!arch_upd->NvsBufferPtr) + handle_low_battery_during_firmware_update(&poweroff_after_fsp_execution, + &fspm_upd); + /* Give SoC and mainboard a chance to update the UPD */ platform_fsp_memory_init_params_cb(&fspm_upd, version); @@ -425,6 +457,10 @@ static void do_fsp_memory_init(const struct fspm_context *context, bool s3wake) null_breakpoint_init(); stack_canary_breakpoint_init(); + /* User has been notified of low battery; safe to power off. */ + if (poweroff_after_fsp_execution) + do_low_battery_poweroff(); + post_code(POSTCODE_FSP_MEMORY_EXIT); timestamp_add_now(TS_FSP_MEMORY_INIT_END); From 3a57364bc4b4d54253674645ee6513a843e6f5e4 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sun, 16 Feb 2025 23:05:30 +0530 Subject: [PATCH 0185/3886] soc/intel/adl: Delegate low-battery shutdown notification to platform This commit removes the SoC-specific implementation of the early low-battery shutdown notification. The generic implementation now resides within the FSP driver layer, requiring only platform-specific customization. Platforms can now implement platform_display_early_shutdown_notification() when CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) is enabled. This function utilizes ux_inform_user_of_poweroff_operation() to display a "low-battery shutdown" message using libgfxinit. BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown. Change-Id: If9f68b2b5cc710e00584b451f904e60d724d1e32 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86453 Reviewed-by: Andy Ebrahiem Reviewed-by: Jayvik Desai Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/soc/intel/alderlake/romstage/fsp_params.c | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/soc/intel/alderlake/romstage/fsp_params.c b/src/soc/intel/alderlake/romstage/fsp_params.c index 71791ae90b..24b2c8c002 100644 --- a/src/soc/intel/alderlake/romstage/fsp_params.c +++ b/src/soc/intel/alderlake/romstage/fsp_params.c @@ -415,6 +415,13 @@ static void debug_override_memory_init_params(FSP_M_CONFIG *mupd) debug_get_pch_cpu_tracehub_modes(&mupd->CpuTraceHubMode, &mupd->PchTraceHubMode); } +#if CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) +void platform_display_early_shutdown_notification(void *arg) +{ + ux_inform_user_of_poweroff_operation("low-battery shutdown"); +} +#endif + static void fill_fspm_sign_of_life(FSP_M_CONFIG *m_cfg, FSPM_ARCH_UPD *arch_upd) { @@ -429,28 +436,6 @@ static void fill_fspm_sign_of_life(FSP_M_CONFIG *m_cfg, * user with an on-screen text message. */ if (!arch_upd->NvsBufferPtr) { - /* - * Low Battery Check During Firmware Update (Chrome OS specific): - * - If `PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR` is enabled AND the - * system is in firmware update mode (If valid MRC cache data is not found, - * it means that the system needs to perform), it checks if the battery level is - * critically low. - * - This is because memory training, which can take a significant amount of - * time, might cause an abrupt shutdown due to low battery, interrupting the - * firmware update process and potentially leaving the system in an unstable - * state. - * - To prevent this, if the battery is critically low, the system is powered - * off to allow it to charge. This ensures that the firmware update process - * can complete without interruption. - * - Since a functional GFX mode display may not be ready at this stage, VGA - * mode is used to display a text message informing the user about the - * shutdown. - */ - if (CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) && - platform_is_low_battery_shutdown_needed()) { - ux_inform_user_of_poweroff_operation("low-battery shutdown"); - do_low_battery_poweroff(); - } esol_required = true; name = "memory training"; elog_add_event_byte(ELOG_TYPE_FW_EARLY_SOL, ELOG_FW_EARLY_SOL_MRC); From 3130c410c6b4e2f8608de1c0f8f73b0e7124b033 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 18 Feb 2025 12:27:43 +0530 Subject: [PATCH 0186/3886] soc/intel/pantherlake: Implement UX help APIs for eSOL handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch refactors the eSOL implementation for Panther Lake and introduces two new APIs, mirroring those in Alder Lake, to manage: - Low battery shutdown notifications - Firmware update memory training BUG=b:397302064 TEST=Built and booted google/fatcat successfully. Change-Id: I14229af4a4920414f3c572576d67fa6d665681cd Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86509 Reviewed-by: Kapil Porwal Reviewed-by: Jérémy Compostella Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) --- .../intel/pantherlake/romstage/Makefile.mk | 1 + src/soc/intel/pantherlake/romstage/ux.c | 67 +++++++++++++++++++ src/soc/intel/pantherlake/romstage/ux.h | 9 +++ 3 files changed, 77 insertions(+) create mode 100644 src/soc/intel/pantherlake/romstage/ux.c create mode 100644 src/soc/intel/pantherlake/romstage/ux.h diff --git a/src/soc/intel/pantherlake/romstage/Makefile.mk b/src/soc/intel/pantherlake/romstage/Makefile.mk index 99c1d2ca25..999241c738 100644 --- a/src/soc/intel/pantherlake/romstage/Makefile.mk +++ b/src/soc/intel/pantherlake/romstage/Makefile.mk @@ -4,3 +4,4 @@ romstage-y += fsp_params.c romstage-y += ../../../../cpu/intel/car/romstage.c romstage-y += romstage.c romstage-y += systemagent.c +romstage-y += ux.c diff --git a/src/soc/intel/pantherlake/romstage/ux.c b/src/soc/intel/pantherlake/romstage/ux.c new file mode 100644 index 0000000000..9fcb418157 --- /dev/null +++ b/src/soc/intel/pantherlake/romstage/ux.c @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +#include "ux.h" + +static bool ux_inform_user_of_operation(const char *name, enum ux_locale_msg id, + FSPM_UPD *mupd) +{ + timestamp_add_now(TS_ESOL_START); + + if (!CONFIG(CHROMEOS_ENABLE_ESOL)) { + timestamp_add_now(TS_ESOL_END); + return false; + } + + FSP_M_CONFIG *m_cfg = &mupd->FspmConfig; + void *vbt; + size_t vbt_size; + static bool ux_done = false; + + /* + * Prevents multiple VGA text messages from being rendered during the boot process. + * + * This function is designed to be called only once. Subsequent calls are intentionally + * ignored to avoid overwriting previously displayed messages. For example, if a + * low-battery shutdown notification is scheduled, a later call with a firmware + * update notification could result in the low-battery message being lost. + */ + if (ux_done) { + timestamp_add_now(TS_ESOL_END); + return true; + } + + printk(BIOS_INFO, "Informing user on-display of %s.\n", name); + + vbt = cbfs_map("vbt.bin", &vbt_size); + if (!vbt) { + printk(BIOS_ERR, "Could not load vbt.bin\n"); + return false; + } + + m_cfg->VgaInitControl = 1; + m_cfg->VbtPtr = (efi_uintn_t)vbt; + m_cfg->VbtSize = vbt_size; + m_cfg->LidStatus = CONFIG(VBOOT_LID_SWITCH) ? get_lid_switch() : CONFIG(RUN_FSP_GOP); + m_cfg->VgaMessage = (efi_uintn_t)ux_locales_get_text(id); + + ux_done = true; + + timestamp_add_now(TS_ESOL_END); + return true; +} + +bool ux_inform_user_of_update_operation(const char *name, FSPM_UPD *mupd) +{ + return ux_inform_user_of_operation(name, UX_LOCALE_MSG_MEMORY_TRAINING, mupd); +} + +bool ux_inform_user_of_poweroff_operation(const char *name, FSPM_UPD *mupd) +{ + return ux_inform_user_of_operation(name, UX_LOCALE_MSG_LOW_BATTERY, mupd); +} diff --git a/src/soc/intel/pantherlake/romstage/ux.h b/src/soc/intel/pantherlake/romstage/ux.h new file mode 100644 index 0000000000..bcee87f24d --- /dev/null +++ b/src/soc/intel/pantherlake/romstage/ux.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ +#define _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ + +bool ux_inform_user_of_update_operation(const char *name, FSPM_UPD *mupd); +bool ux_inform_user_of_poweroff_operation(const char *name, FSPM_UPD *mupd); + +#endif /* _SOC_INTEL_PANTHERLAKE_ROMSTAGE_UX_H_ */ From 2f57986700dfd55ec875372fee0979d0309f0bd7 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 25 Feb 2025 13:37:37 +0530 Subject: [PATCH 0187/3886] soc/intel/pantherlake: Centralize FSP-M eSOL UX with common APIs Refactor the FSP-M early Sign-of-Life (eSOL) implementation to utilize the UX APIs defined in `ux.c`. This eliminates redundant code and ensures consistent messaging during critical boot phases, such as memory training. BUG=b:339673254 TEST=Verified eSOL message over eDP while booting google/fatcat. Change-Id: Icf22c39c21e2357b2a548398700a1488f4ef463a Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86592 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal --- .../intel/pantherlake/romstage/fsp_params.c | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/soc/intel/pantherlake/romstage/fsp_params.c b/src/soc/intel/pantherlake/romstage/fsp_params.c index 8de99d2f95..a8f86a8e56 100644 --- a/src/soc/intel/pantherlake/romstage/fsp_params.c +++ b/src/soc/intel/pantherlake/romstage/fsp_params.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include #include #include @@ -13,7 +12,8 @@ #include #include #include -#include + +#include "ux.h" #define FSP_CLK_NOTUSED 0xff #define FSP_CLK_LAN 0x70 @@ -360,31 +360,16 @@ static void fill_fsp_event_handler(FSPM_UPD *mupd) static void fill_fspm_sign_of_life(FSPM_UPD *mupd) { - FSP_M_CONFIG *m_cfg = &mupd->FspmConfig; FSPM_ARCHx_UPD *arch_upd = &mupd->FspmArchUpd; - void *vbt; - size_t vbt_size; if (arch_upd->NvsBufferPtr) return; /* To enhance the user experience, let's display on-screen guidance during memory training, acknowledging that the process may require patience. */ - - vbt = cbfs_map("vbt.bin", &vbt_size); - if (!vbt) { - printk(BIOS_ERR, "Could not load vbt.bin\n"); - return; - } - printk(BIOS_INFO, "Enabling FSP-M Sign-of-Life\n"); elog_add_event_byte(ELOG_TYPE_FW_EARLY_SOL, ELOG_FW_EARLY_SOL_MRC); - - m_cfg->VgaInitControl = 1; - m_cfg->VbtPtr = (efi_uintn_t)vbt; - m_cfg->VbtSize = vbt_size; - m_cfg->LidStatus = CONFIG(VBOOT_LID_SWITCH) ? get_lid_switch() : CONFIG(RUN_FSP_GOP); - m_cfg->VgaMessage = (efi_uintn_t)ux_locales_get_text(UX_LOCALE_MSG_MEMORY_TRAINING); + ux_inform_user_of_update_operation("memory training", mupd); } void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) From 80db7cdae04bb2a5c47035c3a0ad3bb5b6380d6b Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 25 Feb 2025 13:10:23 +0530 Subject: [PATCH 0188/3886] soc/intel/pantherlake: Add early shutdown notification hook This commit display UX message for low-battery shutdown using platform_display_early_shutdown_notification(). This commit also enables the HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR Kconfig option, which is required for displaying the VGA text message during early shutdown. BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown. Change-Id: I45c0fb07b984fcde6209631612cb8b4a08ac2041 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86476 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai --- src/soc/intel/pantherlake/Kconfig | 1 + src/soc/intel/pantherlake/romstage/fsp_params.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/soc/intel/pantherlake/Kconfig b/src/soc/intel/pantherlake/Kconfig index a54f0defe5..fc8664a927 100644 --- a/src/soc/intel/pantherlake/Kconfig +++ b/src/soc/intel/pantherlake/Kconfig @@ -22,6 +22,7 @@ config SOC_INTEL_PANTHERLAKE_BASE select FSPS_HAS_ARCH_UPD select GENERIC_GPIO_LIB select HAVE_DEBUG_RAM_SETUP + select HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR if CHROMEOS_ENABLE_ESOL select HAVE_FSP_GOP select HAVE_FSP_LOGO_SUPPORT if RUN_FSP_GOP select HAVE_HYPERTHREADING diff --git a/src/soc/intel/pantherlake/romstage/fsp_params.c b/src/soc/intel/pantherlake/romstage/fsp_params.c index a8f86a8e56..93c8777d82 100644 --- a/src/soc/intel/pantherlake/romstage/fsp_params.c +++ b/src/soc/intel/pantherlake/romstage/fsp_params.c @@ -289,6 +289,14 @@ static void fill_fspm_vr_config_params(FSP_M_CONFIG *m_cfg, m_cfg->EnableFastVmode[i] = 0; } +#if CONFIG(PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR) +void platform_display_early_shutdown_notification(void *arg) +{ + FSPM_UPD *mupd = arg; + ux_inform_user_of_poweroff_operation("low-battery shutdown", mupd); +} +#endif + static void soc_memory_init_params(FSP_M_CONFIG *m_cfg, const struct soc_intel_pantherlake_config *config) { From 2a10fac565b942d0dac1efe388331f1627025e67 Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Wed, 12 Feb 2025 19:25:03 +0900 Subject: [PATCH 0189/3886] mb/google/nissa/var/meliks: Update memory DQ/DQS map Update memory DQ/DQS map configuration by following schematics. BUG=b:394359785 TEST=Build coreboot and verified booting to depthcharge Change-Id: Iae3f2c65b4d1004d1d9ebf76b099fc7f50e8365f Signed-off-by: Seunghwan Kim Reviewed-on: https://review.coreboot.org/c/coreboot/+/86376 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Subrata Banik Reviewed-by: Kapil Porwal --- .../google/brya/variants/meliks/Makefile.mk | 2 + .../google/brya/variants/meliks/memory.c | 97 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/mainboard/google/brya/variants/meliks/Makefile.mk create mode 100644 src/mainboard/google/brya/variants/meliks/memory.c diff --git a/src/mainboard/google/brya/variants/meliks/Makefile.mk b/src/mainboard/google/brya/variants/meliks/Makefile.mk new file mode 100644 index 0000000000..c44e4f0364 --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/Makefile.mk @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +romstage-y += memory.c diff --git a/src/mainboard/google/brya/variants/meliks/memory.c b/src/mainboard/google/brya/variants/meliks/memory.c new file mode 100644 index 0000000000..d7f73fb9a0 --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/memory.c @@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +static const struct mb_cfg variant_memcfg = { + .type = MEM_TYPE_LP5X, + + .rcomp = { + /* Baseboard uses only 100ohm Rcomp resistors */ + .resistor = 100, + }, + + /* DQ byte map */ + .lpx_dq_map = { + .ddr0 = { + .dq0 = { 15, 10, 8, 11, 14, 13, 9, 12 }, + .dq1 = { 3, 1, 2, 0, 7, 5, 4, 6 }, + }, + .ddr1 = { + .dq0 = { 7, 0, 3, 2, 1, 4, 6, 5 }, + .dq1 = { 12, 9, 8, 11, 10, 13, 15, 14 }, + }, + .ddr2 = { + .dq0 = { 2, 1, 3, 0, 4, 6, 5, 7 }, + .dq1 = { 8, 9, 10, 11, 13, 14, 12, 15 }, + }, + .ddr3 = { + .dq0 = { 3, 0, 1, 2, 5, 6, 4, 7 }, + .dq1 = { 13, 9, 11, 8, 14, 15, 10, 12 }, + }, + .ddr4 = { + .dq0 = { 15, 10, 8, 11, 14, 13, 9, 12 }, + .dq1 = { 3, 1, 2, 0, 7, 5, 4, 6 }, + }, + .ddr5 = { + .dq0 = { 7, 0, 3, 2, 1, 4, 6, 5 }, + .dq1 = { 12, 9, 8, 11, 10, 13, 15, 14 }, + }, + .ddr6 = { + .dq0 = { 2, 1, 3, 0, 4, 6, 5, 7 }, + .dq1 = { 8, 9, 10, 11, 13, 14, 12, 15 }, + }, + .ddr7 = { + .dq0 = { 3, 0, 1, 2, 5, 6, 4, 7 }, + .dq1 = { 13, 9, 11, 8, 14, 15, 10, 12 }, + }, + }, + + /* DQS CPU<>DRAM map */ + .lpx_dqs_map = { + .ddr0 = { .dqs0 = 1, .dqs1 = 0 }, + .ddr1 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr2 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr3 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr4 = { .dqs0 = 1, .dqs1 = 0 }, + .ddr5 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr6 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr7 = { .dqs0 = 0, .dqs1 = 1 }, + }, + + .lp5x_config = { + .ccc_config = 0xff, + }, + + .ect = 1, /* Early Command Training */ + + .UserBd = BOARD_TYPE_MOBILE, +}; + +const struct mb_cfg *variant_memory_params(void) +{ + return &variant_memcfg; +} + +int variant_memory_sku(void) +{ + /* + * Memory configuration board straps + * GPIO_MEM_CONFIG_0 GPP_E1 + * GPIO_MEM_CONFIG_1 GPP_E2 + * GPIO_MEM_CONFIG_2 GPP_E3 + */ + gpio_t spd_gpios[] = { + GPP_E1, + GPP_E2, + GPP_E3, + }; + + if (board_id() == BOARD_ID_UNKNOWN) + return 0; + + return gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios)); +} From 76fecd1e55fef5732f99416c1fb6354215c16af2 Mon Sep 17 00:00:00 2001 From: Brian Hsu Date: Thu, 20 Feb 2025 12:34:17 +0800 Subject: [PATCH 0190/3886] mb/google/nissa/var/guren: Generate SPD ID for 7 supported memory parts Add supported memory parts in mem_parts_used list, and generate SPD ID for these parts. DRAM Part Name Vendor Model Spec ID to assign K3KL8L80CM-MGCT Samsung LPDDR5X 7500 32Gb 0 (0000) K3KL6L60GM-MGCT Samsung LPDDR5X 7500 16Gb 1 (0001) H58G56AK6BX069 SK hynix LPDDR5 6400 32Gb 2 (0010) H9JCNNNBK3MLYR-N6E SK hynix LPDDR5 6400 16Gb 3 (0011) H58G66AK6BX070 SK hynix LPDDR5 6400 64Gb 4 (0100) K3KL9L90CM-MGCT Samsung LPDDR5X 7500 64Gb 5 (0101) K3LKBKB0BM-MGCP Samsung LPDDR5 6400 16Gb 2 (0010) BUG=b:397149037 BRANCH=firmware-nissa-15217.B TEST=Run command "go run ./util/spd_tools/src/part_id_gen/\ part_id_gen.go ADL lp5 \ src/mainboard/google/brya/variants/guren/memory/ \ src/mainboard/google/brya/variants/guren/memory/\ mem_parts_used.txt" Change-Id: Ibc8626ea51e1143706b8c627f21d33c3ade6a232 Signed-off-by: Brian Hsu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86535 Reviewed-by: Eric Lai Reviewed-by: Kapil Porwal Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai Reviewed-by: Paul Menzel --- .../google/brya/variants/guren/memory/Makefile.mk | 11 +++++++++-- .../brya/variants/guren/memory/dram_id.generated.txt | 12 ++++++++++++ .../brya/variants/guren/memory/mem_parts_used.txt | 7 +++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/guren/memory/Makefile.mk b/src/mainboard/google/brya/variants/guren/memory/Makefile.mk index eace2e443e..943dfba198 100644 --- a/src/mainboard/google/brya/variants/guren/memory/Makefile.mk +++ b/src/mainboard/google/brya/variants/guren/memory/Makefile.mk @@ -1,5 +1,12 @@ # SPDX-License-Identifier: GPL-2.0-or-later # This is an auto-generated file. Do not edit!! -# Add memory parts in mem_parts_used.txt and run spd_tools to regenerate. +# Generated by: +# /tmp/go-build776947141/b001/exe/part_id_gen ADL lp5 src/mainboard/google/brya/variants/guren/memory/ src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt -SPD_SOURCES = placeholder +SPD_SOURCES = +SPD_SOURCES += spd/lp5/set-0/spd-7.hex # ID = 0(0b0000) Parts = K3KL8L80CM-MGCT +SPD_SOURCES += spd/lp5/set-0/spd-9.hex # ID = 1(0b0001) Parts = K3KL6L60GM-MGCT +SPD_SOURCES += spd/lp5/set-0/spd-3.hex # ID = 2(0b0010) Parts = H58G56AK6BX069, K3LKBKB0BM-MGCP +SPD_SOURCES += spd/lp5/set-0/spd-1.hex # ID = 3(0b0011) Parts = H9JCNNNBK3MLYR-N6E +SPD_SOURCES += spd/lp5/set-0/spd-6.hex # ID = 4(0b0100) Parts = H58G66AK6BX070 +SPD_SOURCES += spd/lp5/set-0/spd-8.hex # ID = 5(0b0101) Parts = K3KL9L90CM-MGCT diff --git a/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt b/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt index fa247902ee..62cd085718 100644 --- a/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt +++ b/src/mainboard/google/brya/variants/guren/memory/dram_id.generated.txt @@ -1 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# This is an auto-generated file. Do not edit!! +# Generated by: +# /tmp/go-build776947141/b001/exe/part_id_gen ADL lp5 src/mainboard/google/brya/variants/guren/memory/ src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt + DRAM Part Name ID to assign +K3KL8L80CM-MGCT 0 (0000) +K3KL6L60GM-MGCT 1 (0001) +H58G56AK6BX069 2 (0010) +H9JCNNNBK3MLYR-N6E 3 (0011) +H58G66AK6BX070 4 (0100) +K3KL9L90CM-MGCT 5 (0101) +K3LKBKB0BM-MGCP 2 (0010) diff --git a/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt b/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt index 2499005682..a7e81204ae 100644 --- a/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt +++ b/src/mainboard/google/brya/variants/guren/memory/mem_parts_used.txt @@ -9,3 +9,10 @@ # See util/spd_tools/README.md for more details and instructions. # Part Name +K3KL8L80CM-MGCT +K3KL6L60GM-MGCT +H58G56AK6BX069 +H9JCNNNBK3MLYR-N6E +H58G66AK6BX070 +K3KL9L90CM-MGCT +K3LKBKB0BM-MGCP From ebd8e77596d6fc3b05c119a03660b4d9db2c1299 Mon Sep 17 00:00:00 2001 From: Hualin Wei Date: Fri, 21 Feb 2025 20:37:10 +0800 Subject: [PATCH 0191/3886] mb/google/nissa/var/pujjoniru: Modify the gpio of GPIO_PCH_WP According to the circuit schematic diagram, pujjoniru uses GPP_E17 as a write-protected gpio,so it is necessary to add the GPIO_PCH_WP definition for GPP_E17 in gpio.h. Duo to cros_gpios under variants/baseboard/nissa/gpio.c will call GPIO_PCH_WP under variants/baseboard/nissa/include/baseboard/gpio.h, causing our modifications to not take effect. In order to achieve the above modification, we follow brya, we modify DECLARE_CROS_GPIOS in variants/baseboard/nissa/gpio.c to DECLARE_WEAK_CROS_GPIOS, so that the cros_gpios we defined in /pujjoniru/gpio.c can overwrite variants/baseboard/nissa/gpio.c BUG=b:396594296 TEST=wp status update verified by toggling it on and off. Change-Id: Ic92ff33a5fde50a1a400043b2daba0414eb9e255 Signed-off-by: Hualin Wei Reviewed-on: https://review.coreboot.org/c/coreboot/+/86554 Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: Qinghong Zeng Reviewed-by: Subrata Banik Reviewed-by: Kapil Porwal --- .../google/brya/variants/baseboard/nissa/gpio.c | 2 +- src/mainboard/google/brya/variants/pujjoniru/gpio.c | 11 ++++++++++- .../brya/variants/pujjoniru/include/variant/gpio.h | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/gpio.c b/src/mainboard/google/brya/variants/baseboard/nissa/gpio.c index 520bbe08eb..9f322f6874 100644 --- a/src/mainboard/google/brya/variants/baseboard/nissa/gpio.c +++ b/src/mainboard/google/brya/variants/baseboard/nissa/gpio.c @@ -453,7 +453,7 @@ static const struct cros_gpio cros_gpios[] = { CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME), CROS_GPIO_WP_AH(GPIO_PCH_WP, CROS_GPIO_DEVICE_NAME), }; -DECLARE_CROS_GPIOS(cros_gpios); +DECLARE_WEAK_CROS_GPIOS(cros_gpios); const struct pad_config *__weak variant_romstage_gpio_table(size_t *num) { diff --git a/src/mainboard/google/brya/variants/pujjoniru/gpio.c b/src/mainboard/google/brya/variants/pujjoniru/gpio.c index 1241b60c8f..60cf8f2889 100644 --- a/src/mainboard/google/brya/variants/pujjoniru/gpio.c +++ b/src/mainboard/google/brya/variants/pujjoniru/gpio.c @@ -1,9 +1,10 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#include +#include #include #include #include +#include /* Pad configuration in ramstage */ static const struct pad_config override_gpio_table[] = { @@ -72,6 +73,8 @@ static const struct pad_config override_gpio_table[] = { PAD_CFG_NF_LOCK(GPP_E12, NONE, NF7, LOCK_CONFIG), /* E13 : NC ==> GSPI1_SOC_MOSI_TCHSCR */ PAD_CFG_NF_LOCK(GPP_E13, NONE, NF7, LOCK_CONFIG), + /* E17 : THC0_SPI1_IO1 ==> SOC_WP_OD */ + PAD_CFG_GPI_GPIO_DRIVER_LOCK(GPP_E17, NONE, LOCK_CONFIG), /* E20 : DDP2_CTRLCLK ==> NC */ PAD_NC_LOCK(GPP_E20, NONE, LOCK_CONFIG), /* E21 : DDP2_CTRLDATA ==> GPP_E21_STRAP */ @@ -201,3 +204,9 @@ const struct pad_config *variant_romstage_gpio_table(size_t *num) *num = ARRAY_SIZE(romstage_gpio_table); return romstage_gpio_table; } + +static const struct cros_gpio cros_gpios[] = { + CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME), + CROS_GPIO_WP_AH(GPIO_PCH_WP, CROS_GPIO_DEVICE_NAME), +}; +DECLARE_CROS_GPIOS(cros_gpios); diff --git a/src/mainboard/google/brya/variants/pujjoniru/include/variant/gpio.h b/src/mainboard/google/brya/variants/pujjoniru/include/variant/gpio.h index c4fe342621..2bfb4bfdab 100644 --- a/src/mainboard/google/brya/variants/pujjoniru/include/variant/gpio.h +++ b/src/mainboard/google/brya/variants/pujjoniru/include/variant/gpio.h @@ -3,6 +3,7 @@ #ifndef VARIANT_GPIO_H #define VARIANT_GPIO_H -#include - +#undef GPIO_PCH_WP +/* WP signal to PCH */ +#define GPIO_PCH_WP GPP_E17 #endif From 75759bfada4d29d141b3ec6ac45ef0eb58c7a0d5 Mon Sep 17 00:00:00 2001 From: Hualin Wei Date: Tue, 25 Feb 2025 09:31:13 +0800 Subject: [PATCH 0192/3886] mb/google/nissa/var/pujjoniru: Add Fn key scancode The Fn key on pujjoniru emits a scancode of 94 (0x5e). BUG=b:398943428 TEST=Flash Pujjoniru, boot to Linux kernel, and verify that KEY_FN is generated when pressed using `evtest`. Change-Id: I8eb7f253a637741b0aa45aac4d1d59bd0309d559 Signed-off-by: Hualin Wei Reviewed-on: https://review.coreboot.org/c/coreboot/+/86589 Tested-by: build bot (Jenkins) Reviewed-by: Qinghong Zeng Reviewed-by: Subrata Banik Reviewed-by: Eric Lai Reviewed-by: Kapil Porwal --- src/mainboard/google/brya/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 1ca5094e92..5ab7d5de6c 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -482,6 +482,7 @@ config BOARD_GOOGLE_PUJJONIRU select DRIVERS_GENERIC_GPIO_KEYS select DRIVERS_GFX_GENERIC select DRIVERS_AUDIO_SOF + select MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD select SOC_INTEL_TWINLAKE config BOARD_GOOGLE_QUANDISO From cb446c0404b43c4678b6d8cbf7e57631e56d28d0 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 2 Oct 2024 12:22:20 +0100 Subject: [PATCH 0193/3886] soc/intel/alderlake: Add IRQ mapping for PEG PCI-E ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ACPI _PRT method was missing from PEG (SoC PCI-E) links, resulting in OS complaining about interrupt routing: pcieport 0000:00:06.0: can't derive routing for PCI INT A Tested on `starbook_adl` with Ubuntu 24.04 by running SSD benchmark with GNOME disks and suspend. Change-Id: I2e36cee37716d3b003b9ce250f28fdf5581a15bc Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/84620 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal Reviewed-by: Jérémy Compostella --- src/soc/intel/alderlake/acpi/pcie.asl | 36 +++++++++++++++++++++ src/soc/intel/alderlake/acpi/pcie_pch_s.asl | 12 +++++++ 2 files changed, 48 insertions(+) diff --git a/src/soc/intel/alderlake/acpi/pcie.asl b/src/soc/intel/alderlake/acpi/pcie.asl index f37c1684b0..50d9464169 100644 --- a/src/soc/intel/alderlake/acpi/pcie.asl +++ b/src/soc/intel/alderlake/acpi/pcie.asl @@ -309,16 +309,52 @@ Device (RP12) Device (PEG0) { Name (_ADR, 0x00060000) + + OperationRegion (RPCS, PCI_Config, 0x4c, 4) + Field (RPCS, AnyAcc, NoLock, Preserve) + { + , 24, + RPPN, 8, /* Root Port Number */ + } + + Method (_PRT) + { + Return (IRQM (RPPN)) + } } Device (PEG1) { Name (_ADR, 0x00060002) + + OperationRegion (RPCS, PCI_Config, 0x4c, 4) + Field (RPCS, AnyAcc, NoLock, Preserve) + { + , 24, + RPPN, 8, /* Root Port Number */ + } + + Method (_PRT) + { + Return (IRQM (RPPN)) + } } Device (PEG2) { Name (_ADR, 0x00010000) + + OperationRegion (RPCS, PCI_Config, 0x4c, 4) + Field (RPCS, AnyAcc, NoLock, Preserve) + { + , 24, + RPPN, 8, /* Root Port Number */ + } + + Method (_PRT) + { + Return (IRQM (RPPN)) + } } #endif diff --git a/src/soc/intel/alderlake/acpi/pcie_pch_s.asl b/src/soc/intel/alderlake/acpi/pcie_pch_s.asl index 5437730af1..c2f22b54c0 100644 --- a/src/soc/intel/alderlake/acpi/pcie_pch_s.asl +++ b/src/soc/intel/alderlake/acpi/pcie_pch_s.asl @@ -275,14 +275,26 @@ Device (RP28) Device (PEG0) { Name (_ADR, 0x00060000) + Method (_PRT) + { + Return (IRQM (1)) + } } Device (PEG1) { Name (_ADR, 0x00010000) + Method (_PRT) + { + Return (IRQM (1)) + } } Device (PEG2) { Name (_ADR, 0x00010001) + Method (_PRT) + { + Return (IRQM (2)) + } } From 4e99ffcb022104b77476999e8b68743f4d00164a Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Sat, 11 May 2024 18:48:22 +0200 Subject: [PATCH 0194/3886] intel/broadwell/spd: Use and Use already defined macros in and . TEST=Built purism/librem_bdw (Librem 13 v1) with BUILD_TIMELESS=1, no change in output ROM. Change-Id: Id38b97017b43f1421129fed0bb9c1fff5c3423d8 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/82315 Reviewed-by: Eric Lai Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/soc/intel/broadwell/spd.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/soc/intel/broadwell/spd.c b/src/soc/intel/broadwell/spd.c index 1af66f1d67..419334db70 100644 --- a/src/soc/intel/broadwell/spd.c +++ b/src/soc/intel/broadwell/spd.c @@ -2,22 +2,17 @@ #include #include +#include #include #include +#include #include #include -#define SPD_DRAM_TYPE 2 -#define SPD_DRAM_DDR3 0x0b -#define SPD_DRAM_LPDDR3 0xf1 #define SPD_DENSITY_BANKS 4 #define SPD_ADDRESSING 5 #define SPD_ORGANIZATION 7 #define SPD_BUS_DEV_WIDTH 8 -#define SPD_PART_OFF 128 -#define SPD_PART_LEN 18 - -#define SPD_LEN 256 static void print_spd_info(uint8_t spd[]) { @@ -28,7 +23,7 @@ static void print_spd_info(uint8_t spd[]) const int spd_ranks[8] = { 1, 2, 3, 4, -1, -1, -1, -1 }; const int spd_devw[8] = { 4, 8, 16, 32, -1, -1, -1, -1 }; const int spd_busw[8] = { 8, 16, 32, 64, -1, -1, -1, -1 }; - char spd_name[SPD_PART_LEN+1] = { 0 }; + char spd_name[SPD_DDR3_PART_LEN + 1] = { 0 }; int banks = spd_banks[(spd[SPD_DENSITY_BANKS] >> 4) & 7]; int capmb = spd_capmb[spd[SPD_DENSITY_BANKS] & 7] * 256; @@ -40,21 +35,21 @@ static void print_spd_info(uint8_t spd[]) /* Module type */ printk(BIOS_INFO, "SPD: module type is "); - switch (spd[SPD_DRAM_TYPE]) { - case SPD_DRAM_DDR3: + switch (spd[SPD_MEMORY_TYPE]) { + case SPD_MEMORY_TYPE_SDRAM_DDR3: printk(BIOS_INFO, "DDR3\n"); break; - case SPD_DRAM_LPDDR3: + case SPD_MEMORY_TYPE_LPDDR3_INTEL: printk(BIOS_INFO, "LPDDR3\n"); break; default: - printk(BIOS_INFO, "Unknown (%02x)\n", spd[SPD_DRAM_TYPE]); + printk(BIOS_INFO, "Unknown (%02x)\n", spd[SPD_MEMORY_TYPE]); break; } /* Module Part Number */ - memcpy(spd_name, &spd[SPD_PART_OFF], SPD_PART_LEN); - spd_name[SPD_PART_LEN] = 0; + memcpy(spd_name, &spd[SPD_DDR3_PART_NUM], SPD_DDR3_PART_LEN); + spd_name[SPD_DDR3_PART_LEN] = 0; printk(BIOS_INFO, "SPD: module part is %s\n", spd_name); printk(BIOS_INFO, "SPD: banks %d, ranks %d, rows %d, columns %d, " @@ -79,15 +74,15 @@ void copy_spd(struct pei_data *pei_data, struct spd_info *spdi) if (!spd_file) die("SPD data not found."); - if (spd_file_len < SPD_LEN) + if (spd_file_len < SPD_SIZE_MAX_DDR3) die("Missing SPD data."); - if (spd_file_len < ((spdi->spd_index + 1) * SPD_LEN)) { + if (spd_file_len < ((spdi->spd_index + 1) * SPD_SIZE_MAX_DDR3)) { printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); spdi->spd_index = 0; } - uint8_t *const spd = spd_file + (spdi->spd_index * SPD_LEN); + uint8_t *const spd = spd_file + (spdi->spd_index * SPD_SIZE_MAX_DDR3); /* Make sure a valid SPD was found */ if (spd[0] == 0) @@ -97,6 +92,6 @@ void copy_spd(struct pei_data *pei_data, struct spd_info *spdi) for (size_t i = 0; i < ARRAY_SIZE(spdi->addresses); i++) { if (spdi->addresses[i] == SPD_MEMORY_DOWN) - memcpy(pei_data->spd_data[i / 2][i % 2], spd, SPD_LEN); + memcpy(pei_data->spd_data[i / 2][i % 2], spd, SPD_SIZE_MAX_DDR3); } } From c1acd33247ac674311b4915af9b3505e8daa8d0e Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 25 Feb 2025 08:49:50 +0000 Subject: [PATCH 0195/3886] mb/starlabs/starbook/kbl: Update the verb table Use the newer verb for the ALC2669-VB6 from `starbook/mtl`, as the current verb table failed to detect headphones being connected. Change-Id: Iaa50c6622f3ca75fbeff96300e08eb00e071c8b6 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86594 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- .../starlabs/starbook/variants/kbl/hda_verb.c | 116 +++++++++++++----- 1 file changed, 82 insertions(+), 34 deletions(-) diff --git a/src/mainboard/starlabs/starbook/variants/kbl/hda_verb.c b/src/mainboard/starlabs/starbook/variants/kbl/hda_verb.c index 9c023897f0..7da0991336 100644 --- a/src/mainboard/starlabs/starbook/variants/kbl/hda_verb.c +++ b/src/mainboard/starlabs/starbook/variants/kbl/hda_verb.c @@ -1,73 +1,121 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include + +#define DMIC 0x12 +#define SPEAKERS 0x14 +#define HEADPHONE 0x15 +#define MONO 0x17 +#define MIC1 0x18 +#define MIC2 0x19 +#define LINE1 0x1a +#define LINE2 0x1b +#define PC_BEEP 0x1d +#define S_PDIF 0x1e const u32 cim_verb_data[] = { /* coreboot specific header */ - 0x10ec0269, /* Codec Vendor / Device ID: Realtek ALC269 */ - 0x10ec10d0, /* Subsystem ID */ - 18, /* Number of jacks (NID entries) */ + 0x10ec0269, /* Codec Vendor / Device ID: Realtek ALC269 */ + 0x10ec10d0, /* Subsystem ID */ + 18, /* Number of verb entries */ /* Reset Codec First */ AZALIA_RESET(0x1), - /* HDA Codec Subsystem ID Verb-table */ - AZALIA_SUBVENDOR(0, 0x10ec10d0), + /* HDA Codec Subsystem ID */ + AZALIA_SUBVENDOR(0, 0x1e507038), - /* Pin Widget Verb-table */ - AZALIA_PIN_CFG(0, 0x01, 0x00000000), - AZALIA_PIN_CFG(0, 0x12, 0x90a61120), - AZALIA_PIN_CFG(0, 0x14, 0x90171110), - AZALIA_PIN_CFG(0, 0x15, 0x04ab1020), - AZALIA_PIN_CFG(0, 0x17, 0x411111F0), - AZALIA_PIN_CFG(0, 0x18, 0x04AB1020), - AZALIA_PIN_CFG(0, 0x19, 0x411111F0), - AZALIA_PIN_CFG(0, 0x1A, 0x411111F0), - AZALIA_PIN_CFG(0, 0x1B, 0x411111F0), - AZALIA_PIN_CFG(0, 0x1D, 0x411111F0), - AZALIA_PIN_CFG(0, 0x1E, 0x411111F0), + AZALIA_PIN_CFG(0, 0x01, 0x00000000), + AZALIA_PIN_CFG(0, DMIC, AZALIA_PIN_DESC( \ + AZALIA_INTEGRATED, \ + AZALIA_INTERNAL | AZALIA_TOP, \ + AZALIA_MIC_IN, \ + AZALIA_TYPE_UNKNOWN, \ + AZALIA_BLACK, \ + AZALIA_JACK_PRESENCE_DETECT, \ + 3, \ + 0 \ + )), + + AZALIA_PIN_CFG(0, SPEAKERS, AZALIA_PIN_DESC( \ + AZALIA_INTEGRATED, \ + AZALIA_INTERNAL | AZALIA_FRONT, \ + AZALIA_SPEAKER, \ + AZALIA_TYPE_UNKNOWN, \ + AZALIA_BLACK, \ + AZALIA_JACK_PRESENCE_DETECT, \ + 1, \ + 0 \ + )), + AZALIA_PIN_CFG(0, HEADPHONE, AZALIA_PIN_DESC( \ + AZALIA_JACK, \ + AZALIA_EXTERNAL_PRIMARY_CHASSIS | AZALIA_RIGHT, \ + AZALIA_HP_OUT, \ + AZALIA_STEREO_MONO_1_8, \ + AZALIA_BLACK, \ + AZALIA_JACK_PRESENCE_DETECT, \ + 2, \ + 0 \ + )), + AZALIA_PIN_CFG(0, MONO, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, MIC1, AZALIA_PIN_DESC( \ + AZALIA_JACK, \ + AZALIA_EXTERNAL_PRIMARY_CHASSIS | AZALIA_RIGHT, \ + AZALIA_MIC_IN, \ + AZALIA_STEREO_MONO_1_8, \ + AZALIA_BLACK, \ + AZALIA_JACK_PRESENCE_DETECT, \ + 4, \ + 0 \ + )), + AZALIA_PIN_CFG(0, MIC2, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, LINE1, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, LINE2, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, PC_BEEP, AZALIA_PIN_CFG_NC(0)), + AZALIA_PIN_CFG(0, S_PDIF, AZALIA_PIN_CFG_NC(0)), - /* ALC269 Default 1 */ 0x02050018, - 0x02043984, - 0x0205001C, - 0x02040800, + 0x02040184, + + 0x0205001C, + 0x02044b00, - /* ALC269 Default 2 */ 0x02050024, 0x02040000, + 0x02050004, 0x02040080, - /* ALC269 Default 3 */ 0x02050008, - 0x02040300, + 0x02040000, + 0x0205000C, 0x02043F00, - /* ALC269 Default 4 */ - 0x02050015, - 0x02048002, 0x02050015, 0x02048002, - /* ALC269 Default 5 */ + 0x02050015, + 0x02048002, + 0x00C37080, 0x00270610, 0x00D37080, 0x00370610, - 0x8086280b, /* Codec Vendor / Device ID: Intel */ - 0x80860101, /* Subsystem ID */ - 4, /* Number of 4 dword sets */ + 0x8086280d, /* Codec Vendor / Device ID: Intel */ + 0x80860101, /* Subsystem ID */ + 4, /* Number of 4 dword sets */ AZALIA_SUBVENDOR(2, 0x80860101), AZALIA_PIN_CFG(2, 0x05, 0x18560010), - AZALIA_PIN_CFG(2, 0x06, 0x18560010), - AZALIA_PIN_CFG(2, 0x07, 0x18560010), + AZALIA_PIN_CFG(2, 0x06, 0x18560020), + AZALIA_PIN_CFG(2, 0x07, 0x18560030), }; -const u32 pc_beep_verbs[] = {}; +const u32 pc_beep_verbs[] = { +}; AZALIA_ARRAY_SIZES; From 2e9f1f0990609ffa8dd3633ee5b3a5d7c05168eb Mon Sep 17 00:00:00 2001 From: John Su Date: Tue, 18 Feb 2025 14:51:40 +0800 Subject: [PATCH 0196/3886] mb/google/brya/var/agah: Remove the AGAH DPTF OEM variant Because the AGAH EC code is based on monitoring adapter current to choose the corresponding DPTF OEM variable table, but not every project follows this design. Based on the comment below, the AGAH EC code was removed in 2023, so remove the AGAH DPTF OEM variant, allowing each OEM to adjust in EC ASL accordingly. BUG=b:394177292 BRANCH=None TEST=None Change-Id: I2929eaa65a518b06f32e33cc31ae4a01bcfb77e8 Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86493 Reviewed-by: Dtrain Hsu Tested-by: build bot (Jenkins) --- src/ec/google/chromeec/acpi/ec.asl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl index 436207cb13..8e241fcfe1 100644 --- a/src/ec/google/chromeec/acpi/ec.asl +++ b/src/ec/google/chromeec/acpi/ec.asl @@ -379,14 +379,6 @@ Device (EC0) Printf ("EC: THROTTLE START") \_TZ.THRT (1) #endif - -#ifdef DPTF_ENABLE_OEM_VARIABLES - Local0 = ToInteger(EOVD) & EC_OEM_VARIABLE_DATA_MASK - \_SB.DPTF.ODUP(0, Local0) - Local0 = \_SB.DPTF.ODGT(0) - \_SB.DPTF.ODVP() - Notify (\_SB.DPTF, INT3400_ODVP_CHANGED) -#endif } // Throttle Stop From 632ae13fe0ea459b29d10c25d23d89cfca20e3b7 Mon Sep 17 00:00:00 2001 From: "joel.bueno" Date: Mon, 24 Feb 2025 19:01:59 +0100 Subject: [PATCH 0197/3886] soc/riscv/ucb: Switch to FDT parsing to get memory size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, coreboot tries to manually probe the memory for the Spike target as part of the SOC_UCB_RISCV target. However, Spike already passes a pointer to the device tree, so use it instead to get the memory size (like qemu-riscv does). TEST=Compile for SPIKE-RISCV and run (cmdline: spike -m1024 build/coreboot.elf) Change-Id: I5c826ab5e4896e07a78632d5d594377a3d6a7a43 Signed-off-by: joel.bueno Reviewed-on: https://review.coreboot.org/c/coreboot/+/86588 Reviewed-by: Carlos López Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- src/soc/ucb/riscv/Kconfig | 1 + src/soc/ucb/riscv/cbmem.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/soc/ucb/riscv/Kconfig b/src/soc/ucb/riscv/Kconfig index bd0945e908..e8a8d376ba 100644 --- a/src/soc/ucb/riscv/Kconfig +++ b/src/soc/ucb/riscv/Kconfig @@ -9,6 +9,7 @@ config SOC_UCB_RISCV select ARCH_ROMSTAGE_RISCV select ARCH_RAMSTAGE_RISCV select RISCV_USE_ARCH_TIMER + select FLATTENED_DEVICE_TREE bool default n diff --git a/src/soc/ucb/riscv/cbmem.c b/src/soc/ucb/riscv/cbmem.c index 5c423a05bb..ff3f5db3fc 100644 --- a/src/soc/ucb/riscv/cbmem.c +++ b/src/soc/ucb/riscv/cbmem.c @@ -1,10 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include #include +#include +#include uintptr_t cbmem_top_chipset(void) { - return (uintptr_t)_dram + (probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB) * MiB); + uint64_t top; + + top = fdt_get_memory_top((void *)HLS()->fdt); + ASSERT_MSG(top, "Failed reading memory range from FDT"); + + return MIN(top, (uint64_t)4 * GiB - 1); } From f4bf05051855b54621b3b88b88b7d8340cd6a938 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Sat, 22 Feb 2025 11:51:22 +0100 Subject: [PATCH 0198/3886] cpu/x86/64bit: Allow to map more of the address space On AMD platforms the SPI flash can be accessed using the ROM3 mapping in upper MMIO space. To reach the MMIO window the default page tables must be extended to cover the address by default. Add support for a SoC specific default address space being used on x86_64, where the default of 4GiB/512GiB remains. The size can be specified by the Kconfig CPU_PT_ROM_MAP_GB option. Used in the following patch to use ROM3 mapping on AMD platforms. TEST: Access ROM3 bar at 0xfd00000000 on amd/birman+ using x86_64 TEST: x86_64 still works on qemu/q35. Change-Id: If669426f2b5ae40dd5c62e17f3a0234783b7d462 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86580 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- src/cpu/x86/64bit/pt.S | 23 ++++++++++++++--------- src/cpu/x86/64bit/pt1G.S | 12 ++++++++---- src/cpu/x86/Kconfig | 9 +++++++++ 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/cpu/x86/64bit/pt.S b/src/cpu/x86/64bit/pt.S index 1297296a37..5b10b10118 100644 --- a/src/cpu/x86/64bit/pt.S +++ b/src/cpu/x86/64bit/pt.S @@ -20,16 +20,21 @@ .global PML4E .align 4096 PML4E: -.quad _GEN_DIR(PDPT) - -.align 4096 -PDT: /* identity map 2MiB pages */ -.rept 2048 -.quad _GEN_PAGE(0x200000 * ((. - PDT) >> 3)) +/* For every 512GiB generate a pointer to the corresponding PDPT */ +.rept (CONFIG_CPU_PT_ROM_MAP_GB + 511) / 512 +.quad _GEN_DIR(PDPT + 4096 * ((. - PML4E) >> 3)) /* Point to PDPT */ .endr .align 4096 -PDPT: /* Point to PDT */ -.rept 4 -.quad _GEN_DIR(PDT + 4096 * ((. - PDPT) >> 3)) +PDT: +/* For every 2MiB generate a page entry. In one GiB there are 512 pages. */ +.rept 512 * CONFIG_CPU_PT_ROM_MAP_GB +.quad _GEN_PAGE(0x200000 * ((. - PDT) >> 3)) /* identity map 2MiB page */ +.endr + +.align 4096 +PDPT: +/* For every 1GiB generate a pointer to the corresponding PDT */ +.rept CONFIG_CPU_PT_ROM_MAP_GB +.quad _GEN_DIR(PDT + 4096 * ((. - PDPT) >> 3)) /* Point to PDT */ .endr diff --git a/src/cpu/x86/64bit/pt1G.S b/src/cpu/x86/64bit/pt1G.S index 42cdfb17d0..b1f443301d 100644 --- a/src/cpu/x86/64bit/pt1G.S +++ b/src/cpu/x86/64bit/pt1G.S @@ -20,10 +20,14 @@ .global PML4E .align 4096 PML4E: -.quad _GEN_DIR(PDPT) +/* For every 512GiB generate a pointer to the corresponding PDPT */ +.rept (CONFIG_CPU_PT_ROM_MAP_GB + 511) / 512 +.quad _GEN_DIR(PDPT + 4096 * ((. - PML4E) >> 3)) /* Point to PDPT */ +.endr .align 4096 -PDPT: /* identity map 1GiB pages * 512 */ -.rept 512 -.quad _GEN_PAGE(0x40000000 * ((. - PDPT) >> 3)) +PDPT: +/* For every 1GiB generate a page entry */ +.rept CONFIG_CPU_PT_ROM_MAP_GB +.quad _GEN_PAGE(0x40000000 * ((. - PDPT) >> 3)) /* identity map 1GiB page */ .endr diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig index 828c0f9ce2..15c884e1e8 100644 --- a/src/cpu/x86/Kconfig +++ b/src/cpu/x86/Kconfig @@ -159,6 +159,15 @@ config NEED_SMALL_2MB_PAGE_TABLES Select this option from boards/SoCs that do not support the Page1GB CPUID feature (CPUID.80000001H:EDX.bit26). +config CPU_PT_ROM_MAP_GB + int + default 4 if NEED_SMALL_2MB_PAGE_TABLES + default 512 + help + GiB of the lower address space to identity map when using x86_64 + page tables in ROM. Higher values require more space in SPI flash. + SoC can overwrite the value if necessary. + config SMM_ASEG bool default n From 2494c28a49b9cc575c74920b6d91b3c9fc09d4ab Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Sat, 22 Feb 2025 15:11:41 +0100 Subject: [PATCH 0199/3886] soc/amd/glinda: Enable x86_64 support The code compiles and works fine in x86_64. Thus allow the user to use x86_64. TEST: Booted on amd/birman+ to OS using EDK2 as payload. Change-Id: If1b5d91a376770c0f0e1a4ee46dd625b401fbfa6 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/86581 Tested-by: build bot (Jenkins) Reviewed-by: Ana Carolina Cabral Reviewed-by: Maximilian Brune --- src/soc/amd/glinda/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/soc/amd/glinda/Kconfig b/src/soc/amd/glinda/Kconfig index 39fb785691..70bdb69d6d 100644 --- a/src/soc/amd/glinda/Kconfig +++ b/src/soc/amd/glinda/Kconfig @@ -90,6 +90,7 @@ config SOC_AMD_GLINDA select VBOOT_DEFINE_WIDEVINE_COUNTERS if VBOOT_STARTS_BEFORE_BOOTBLOCK select X86_AMD_FIXED_MTRRS select X86_INIT_NEED_1_SIPI + select HAVE_X86_64_SUPPORT help AMD Glinda support From ec7b6a5a246e648697672de6a265ad9db5591ee9 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 28 Jan 2025 14:28:04 +0000 Subject: [PATCH 0200/3886] mb/starlabs/*: Unify IO genx_dec configuration across all boards Change-Id: I614b4cbf6ad502e69f463d71a2536b017c483907 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86188 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/lite/variants/glk/devicetree.cb | 5 +++-- src/mainboard/starlabs/lite/variants/glkr/devicetree.cb | 5 +++-- src/mainboard/starlabs/starbook/variants/adl/devicetree.cb | 6 +++--- .../starlabs/starbook/variants/adl_n/devicetree.cb | 4 ++-- src/mainboard/starlabs/starbook/variants/cml/devicetree.cb | 7 +++---- src/mainboard/starlabs/starbook/variants/kbl/devicetree.cb | 7 +++---- src/mainboard/starlabs/starbook/variants/rpl/devicetree.cb | 6 +++--- src/mainboard/starlabs/starbook/variants/tgl/devicetree.cb | 4 ++-- .../starlabs/starfighter/variants/rpl/devicetree.cb | 6 +++--- .../starlabs/starlite_adl/variants/mk_v/devicetree.cb | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/mainboard/starlabs/lite/variants/glk/devicetree.cb b/src/mainboard/starlabs/lite/variants/glk/devicetree.cb index 46aedd17b1..a8962af514 100644 --- a/src/mainboard/starlabs/lite/variants/glk/devicetree.cb +++ b/src/mainboard/starlabs/lite/variants/glk/devicetree.cb @@ -102,8 +102,9 @@ chip soc/intel/apollolake device ref uart2 on end device ref spi2 on end device ref lpc_espi on - register "gen1_dec" = "0x000c06a1" - register "gen2_dec" = "0x000c0081" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip ec/starlabs/merlin # Port pair 4Eh/4Fh diff --git a/src/mainboard/starlabs/lite/variants/glkr/devicetree.cb b/src/mainboard/starlabs/lite/variants/glkr/devicetree.cb index c906dbbc83..bd25b0e68d 100644 --- a/src/mainboard/starlabs/lite/variants/glkr/devicetree.cb +++ b/src/mainboard/starlabs/lite/variants/glkr/devicetree.cb @@ -102,8 +102,9 @@ chip soc/intel/apollolake device ref uart2 on end device ref spi2 on end device ref lpc_espi on - register "gen1_dec" = "0x000c06a1" - register "gen2_dec" = "0x000c0081" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip ec/starlabs/merlin # Port pair 4Eh/4Fh diff --git a/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb b/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb index 217c375148..ccbad90b06 100644 --- a/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/adl/devicetree.cb @@ -200,9 +200,9 @@ chip soc/intel/alderlake end device ref uart0 on end device ref pch_espi on - register "gen1_dec" = "0x00fc0201" - register "gen2_dec" = "0x00000381" - register "gen3_dec" = "0x00000511" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip drivers/pc80/tpm device pnp 0c31.0 on end diff --git a/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb b/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb index 2c66936923..5f19e50113 100644 --- a/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/adl_n/devicetree.cb @@ -189,8 +189,8 @@ chip soc/intel/alderlake device ref uart0 on end device ref pch_espi on register "gen1_dec" = "0x00040069" - register "gen2_dec" = "0x00040069" - register "gen3_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip drivers/pc80/tpm device pnp 0c31.0 on end diff --git a/src/mainboard/starlabs/starbook/variants/cml/devicetree.cb b/src/mainboard/starlabs/starbook/variants/cml/devicetree.cb index 9ab9179882..f0398c7d97 100644 --- a/src/mainboard/starlabs/starbook/variants/cml/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/cml/devicetree.cb @@ -165,10 +165,9 @@ chip soc/intel/cannonlake smbios_slot_desc "SlotTypeM2Socket3" "SlotLengthOther" "M.2/M 2280" "SlotDataBusWidth4X" end device ref lpc_espi on - register "gen1_dec" = "0x000c0681" - register "gen2_dec" = "0x000c1641" - register "gen3_dec" = "0x00fc0201" - register "gen4_dec" = "0x000c0081" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip ec/starlabs/merlin # Port pair 4Eh/4Fh diff --git a/src/mainboard/starlabs/starbook/variants/kbl/devicetree.cb b/src/mainboard/starlabs/starbook/variants/kbl/devicetree.cb index ed61df852c..3ab819ed56 100644 --- a/src/mainboard/starlabs/starbook/variants/kbl/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/kbl/devicetree.cb @@ -105,10 +105,9 @@ chip soc/intel/skylake end device ref uart0 on end device ref lpc_espi on - register "gen1_dec" = "0x000c0681" - register "gen2_dec" = "0x000c1641" - register "gen3_dec" = "0x00000069" - register "gen4_dec" = "0x0000006d" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip ec/starlabs/merlin # Port pair 4Eh/4Fh diff --git a/src/mainboard/starlabs/starbook/variants/rpl/devicetree.cb b/src/mainboard/starlabs/starbook/variants/rpl/devicetree.cb index abc4a7a8ce..52e0411406 100644 --- a/src/mainboard/starlabs/starbook/variants/rpl/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/rpl/devicetree.cb @@ -211,9 +211,9 @@ chip soc/intel/alderlake end device ref uart0 on end device ref pch_espi on - register "gen1_dec" = "0x00fc0201" - register "gen2_dec" = "0x00000381" - register "gen3_dec" = "0x00000511" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip drivers/pc80/tpm device pnp 0c31.0 on end diff --git a/src/mainboard/starlabs/starbook/variants/tgl/devicetree.cb b/src/mainboard/starlabs/starbook/variants/tgl/devicetree.cb index 938a18ff94..7a7c386996 100644 --- a/src/mainboard/starlabs/starbook/variants/tgl/devicetree.cb +++ b/src/mainboard/starlabs/starbook/variants/tgl/devicetree.cb @@ -215,8 +215,8 @@ chip soc/intel/tigerlake end device ref gspi1 on end device ref pch_espi on - register "gen1_dec" = "0x000c1641" - register "gen2_dec" = "0x000c0681" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" register "gen3_dec" = "0x000c0081" chip drivers/pc80/tpm device pnp 0c31.0 on end diff --git a/src/mainboard/starlabs/starfighter/variants/rpl/devicetree.cb b/src/mainboard/starlabs/starfighter/variants/rpl/devicetree.cb index 50cb8ae087..c37ff7271f 100644 --- a/src/mainboard/starlabs/starfighter/variants/rpl/devicetree.cb +++ b/src/mainboard/starlabs/starfighter/variants/rpl/devicetree.cb @@ -238,9 +238,9 @@ chip soc/intel/alderlake end device ref uart0 on end device ref pch_espi on - register "gen1_dec" = "0x00fc0201" - register "gen2_dec" = "0x00000381" - register "gen3_dec" = "0x00000511" + register "gen1_dec" = "0x00040069" + register "gen2_dec" = "0x00fc0201" + register "gen3_dec" = "0x000c0081" chip drivers/pc80/tpm device pnp 0c31.0 on end diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb b/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb index 0c9b7a5dde..5b8bd2c2d0 100644 --- a/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb +++ b/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb @@ -175,7 +175,7 @@ chip soc/intel/alderlake end device ref uart0 on end device ref pch_espi on - register "gen1_dec" = "0x3c030070" + register "gen1_dec" = "0x00040069" register "gen2_dec" = "0x00fc0201" register "gen3_dec" = "0x000c0081" From ed85f0128176e782b36b7a634271816b8c7e0231 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Tue, 1 Nov 2022 13:29:09 +0100 Subject: [PATCH 0201/3886] mb/*/*/irq_tables.c: Use PCI_DEVFN(dev, fn) Change-Id: Ic97bf7c8f04edbb56f200c34060d22a8c5fb7ec2 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/69066 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks Reviewed-by: Maximilian Brune --- .../asus/p2b/variants/p2b-d/irq_tables.c | 17 ++++---- .../asus/p2b/variants/p2b-ds/irq_tables.c | 19 +++++---- .../asus/p2b/variants/p2b-f/irq_tables.c | 19 +++++---- .../asus/p2b/variants/p2b-ls/irq_tables.c | 21 +++++----- .../asus/p2b/variants/p2b/irq_tables.c | 17 ++++---- .../asus/p2b/variants/p3b-f/irq_tables.c | 21 +++++----- .../emulation/qemu-i440fx/irq_tables.c | 17 ++++---- src/mainboard/getac/p470/irq_tables.c | 41 ++++++++++--------- src/mainboard/ibase/mb899/irq_tables.c | 41 ++++++++++--------- src/mainboard/intel/d945gclf/irq_tables.c | 41 ++++++++++--------- src/mainboard/kontron/986lcd-m/irq_tables.c | 41 ++++++++++--------- src/mainboard/lenovo/x60/irq_tables.c | 33 +++++++-------- src/mainboard/roda/rk886ex/irq_tables.c | 41 ++++++++++--------- 13 files changed, 191 insertions(+), 178 deletions(-) diff --git a/src/mainboard/asus/p2b/variants/p2b-d/irq_tables.c b/src/mainboard/asus/p2b/variants/p2b-d/irq_tables.c index 358260b67d..4cab6be0f8 100644 --- a/src/mainboard/asus/p2b/variants/p2b-d/irq_tables.c +++ b/src/mainboard/asus/p2b/variants/p2b-d/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x04 << 3) | 0x0, /* Interrupt router device */ + PCI_DEVFN(0x04, 0), /* Interrupt router device */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -16,13 +17,13 @@ static const struct irq_routing_table intel_irq_routing_table = { 0x54, /* Checksum */ /* clang-format off */ { - /* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00, (0x0c << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x1, 0x0}, - {0x00, (0x0b << 3) | 0x0, {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}}, 0x2, 0x0}, - {0x00, (0x0a << 3) | 0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x3, 0x0}, - {0x00, (0x09 << 3) | 0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x4, 0x0}, - {0x00, (0x04 << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, - {0x00, (0x01 << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, + /* bus, PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00, PCI_DEVFN(0x0c, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x1, 0x0}, + {0x00, PCI_DEVFN(0x0b, 0), {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}}, 0x2, 0x0}, + {0x00, PCI_DEVFN(0x0a, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x3, 0x0}, + {0x00, PCI_DEVFN(0x09, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x4, 0x0}, + {0x00, PCI_DEVFN(0x04, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, + {0x00, PCI_DEVFN(0x01, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/asus/p2b/variants/p2b-ds/irq_tables.c b/src/mainboard/asus/p2b/variants/p2b-ds/irq_tables.c index 0b78c0bd0e..863db32d0d 100644 --- a/src/mainboard/asus/p2b/variants/p2b-ds/irq_tables.c +++ b/src/mainboard/asus/p2b/variants/p2b-ds/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x04 << 3) | 0x0, /* Interrupt router device */ + PCI_DEVFN(0x04, 0), /* Interrupt router device */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -16,14 +17,14 @@ static const struct irq_routing_table intel_irq_routing_table = { 0x36, /* Checksum */ /* clang-format off */ { - /* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00, (0x0c << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x1, 0x0}, - {0x00, (0x0b << 3) | 0x0, {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}}, 0x2, 0x0}, - {0x00, (0x0a << 3) | 0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x3, 0x0}, - {0x00, (0x09 << 3) | 0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x4, 0x0}, - {0x00, (0x04 << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, - {0x00, (0x01 << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, - {0x00, (0x06 << 3) | 0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x0, 0x0}, + /* bus, PCI_DEVFN(dev, fn), link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00, PCI_DEVFN(0x0c, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x1, 0x0}, + {0x00, PCI_DEVFN(0x0b, 0), {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}}, 0x2, 0x0}, + {0x00, PCI_DEVFN(0x0a, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x3, 0x0}, + {0x00, PCI_DEVFN(0x09, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x4, 0x0}, + {0x00, PCI_DEVFN(0x04, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, + {0x00, PCI_DEVFN(0x01, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, + {0x00, PCI_DEVFN(0x06, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x0, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/asus/p2b/variants/p2b-f/irq_tables.c b/src/mainboard/asus/p2b/variants/p2b-f/irq_tables.c index 8c57ca6e40..c6b1d27a2c 100644 --- a/src/mainboard/asus/p2b/variants/p2b-f/irq_tables.c +++ b/src/mainboard/asus/p2b/variants/p2b-f/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x04 << 3) | 0x0, /* Interrupt router device */ + PCI_DEVFN(0x04, 0), /* Interrupt router device */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -16,14 +17,14 @@ static const struct irq_routing_table intel_irq_routing_table = { 0xf9, /* Checksum */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x0c << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x1, 0x0}, - {0x00,(0x0b << 3)|0x0, {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x01eb8}}, 0x2, 0x0}, - {0x00,(0x0a << 3)|0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x3, 0x0}, - {0x00,(0x09 << 3)|0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x4, 0x0}, - {0x00,(0x0d << 3)|0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x5, 0x0}, - {0x00,(0x04 << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, - {0x00,(0x01 << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x0c, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x1, 0x0}, + {0x00,PCI_DEVFN(0x0b, 0), {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x01eb8}}, 0x2, 0x0}, + {0x00,PCI_DEVFN(0x0a, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x3, 0x0}, + {0x00,PCI_DEVFN(0x09, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x4, 0x0}, + {0x00,PCI_DEVFN(0x0d, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x5, 0x0}, + {0x00,PCI_DEVFN(0x04, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/asus/p2b/variants/p2b-ls/irq_tables.c b/src/mainboard/asus/p2b/variants/p2b-ls/irq_tables.c index 1bad19bbfc..e03af5e2ea 100644 --- a/src/mainboard/asus/p2b/variants/p2b-ls/irq_tables.c +++ b/src/mainboard/asus/p2b/variants/p2b-ls/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x04 << 3) | 0x0, /* Interrupt router device */ + PCI_DEVFN(0x04, 0), /* Interrupt router device */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -19,15 +20,15 @@ static const struct irq_routing_table intel_irq_routing_table = { */ /* clang-format off */ { - /* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00, (0x0c << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x1, 0x0}, - {0x00, (0x0b << 3) | 0x0, {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}}, 0x2, 0x0}, - {0x00, (0x0a << 3) | 0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x3, 0x0}, - {0x00, (0x09 << 3) | 0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x4, 0x0}, - {0x00, (0x04 << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, - {0x00, (0x01 << 3) | 0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, - {0x00, (0x06 << 3) | 0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x0, 0x0}, - {0x00, (0x07 << 3) | 0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x0, 0x0}, + /* bus, PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00, PCI_DEVFN(0x0c, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x1, 0x0}, + {0x00, PCI_DEVFN(0x0b, 0), {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}}, 0x2, 0x0}, + {0x00, PCI_DEVFN(0x0a, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x3, 0x0}, + {0x00, PCI_DEVFN(0x09, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x4, 0x0}, + {0x00, PCI_DEVFN(0x04, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, + {0x00, PCI_DEVFN(0x01, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}}, 0x0, 0x0}, + {0x00, PCI_DEVFN(0x06, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}}, 0x0, 0x0}, + {0x00, PCI_DEVFN(0x07, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}}, 0x0, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/asus/p2b/variants/p2b/irq_tables.c b/src/mainboard/asus/p2b/variants/p2b/irq_tables.c index 8967f845cf..0c78d6ff10 100644 --- a/src/mainboard/asus/p2b/variants/p2b/irq_tables.c +++ b/src/mainboard/asus/p2b/variants/p2b/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x04 << 3) | 0x0, /* Interrupt router device */ + PCI_DEVFN(0x04, 0), /* Interrupt router device */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -16,13 +17,13 @@ static const struct irq_routing_table intel_irq_routing_table = { 0x54, /* Checksum */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x0c << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x1, 0x0}, - {0x00,(0x0b << 3)|0x0, {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x01eb8}}, 0x2, 0x0}, - {0x00,(0x0a << 3)|0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x3, 0x0}, - {0x00,(0x09 << 3)|0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x4, 0x0}, - {0x00,(0x04 << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, - {0x00,(0x01 << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x0c, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x1, 0x0}, + {0x00,PCI_DEVFN(0x0b, 0), {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x01eb8}}, 0x2, 0x0}, + {0x00,PCI_DEVFN(0x0a, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x3, 0x0}, + {0x00,PCI_DEVFN(0x09, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x4, 0x0}, + {0x00,PCI_DEVFN(0x04, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/asus/p2b/variants/p3b-f/irq_tables.c b/src/mainboard/asus/p2b/variants/p3b-f/irq_tables.c index 39c2058672..3e2284e549 100644 --- a/src/mainboard/asus/p2b/variants/p3b-f/irq_tables.c +++ b/src/mainboard/asus/p2b/variants/p3b-f/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x04 << 3) | 0x0, /* Interrupt router device */ + PCI_DEVFN(0x04, 0), /* Interrupt router device */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -16,15 +17,15 @@ static const struct irq_routing_table intel_irq_routing_table = { 0x95, /* Checksum */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x0c << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x1, 0x0}, - {0x00,(0x0b << 3)|0x0, {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x01eb8}}, 0x2, 0x0}, - {0x00,(0x0a << 3)|0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x3, 0x0}, - {0x00,(0x09 << 3)|0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x4, 0x0}, - {0x00,(0x0d << 3)|0x0, {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x5, 0x0}, - {0x00,(0x0e << 3)|0x0, {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x6, 0x0}, - {0x00,(0x04 << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, - {0x00,(0x01 << 3)|0x0, {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x0c, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x1, 0x0}, + {0x00,PCI_DEVFN(0x0b, 0), {{0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x01eb8}}, 0x2, 0x0}, + {0x00,PCI_DEVFN(0x0a, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x3, 0x0}, + {0x00,PCI_DEVFN(0x09, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x4, 0x0}, + {0x00,PCI_DEVFN(0x0d, 0), {{0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x01eb8}}, 0x5, 0x0}, + {0x00,PCI_DEVFN(0x0e, 0), {{0x62, 0x1eb8}, {0x63, 0x1eb8}, {0x60, 0x1eb8}, {0x61, 0x01eb8}}, 0x6, 0x0}, + {0x00,PCI_DEVFN(0x04, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0x1eb8}, {0x61, 0x1eb8}, {0x62, 0x1eb8}, {0x63, 0x01eb8}}, 0x0, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/emulation/qemu-i440fx/irq_tables.c b/src/mainboard/emulation/qemu-i440fx/irq_tables.c index e288afd8c4..7d6f83d22c 100644 --- a/src/mainboard/emulation/qemu-i440fx/irq_tables.c +++ b/src/mainboard/emulation/qemu-i440fx/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32+16*CONFIG_IRQ_SLOT_COUNT, /* there can be total CONFIG_IRQ_SLOT_COUNT devices on the bus */ 0x00, /* Where the interrupt router lies (bus) */ - (0x01 << 3)|0x0, /* Where the interrupt router lies (dev) */ + PCI_DEVFN(0x01, 0), /* Where the interrupt router lies (dev) */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x7000, /* Device */ @@ -16,13 +17,13 @@ static const struct irq_routing_table intel_irq_routing_table = { 0x7, /* u8 checksum , this hase to set to some value that would give 0 after the sum of all bytes for this structure (including checksum) */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x01 << 3)|0x0, {{0x60, 0xdef8}, {0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0x0def8}}, 0x0, 0x0}, - {0x00,(0x02 << 3)|0x0, {{0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0xdef8}, {0x60, 0x0def8}}, 0x1, 0x0}, - {0x00,(0x03 << 3)|0x0, {{0x62, 0xdef8}, {0x63, 0xdef8}, {0x60, 0xdef8}, {0x61, 0x0def8}}, 0x2, 0x0}, - {0x00,(0x04 << 3)|0x0, {{0x63, 0xdef8}, {0x60, 0xdef8}, {0x61, 0xdef8}, {0x62, 0x0def8}}, 0x3, 0x0}, - {0x00,(0x05 << 3)|0x0, {{0x60, 0xdef8}, {0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0x0def8}}, 0x4, 0x0}, - {0x00,(0x06 << 3)|0x0, {{0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0xdef8}, {0x60, 0x0def8}}, 0x5, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0xdef8}, {0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0x0def8}}, 0x0, 0x0}, + {0x00,PCI_DEVFN(0x02, 0), {{0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0xdef8}, {0x60, 0x0def8}}, 0x1, 0x0}, + {0x00,PCI_DEVFN(0x03, 0), {{0x62, 0xdef8}, {0x63, 0xdef8}, {0x60, 0xdef8}, {0x61, 0x0def8}}, 0x2, 0x0}, + {0x00,PCI_DEVFN(0x04, 0), {{0x63, 0xdef8}, {0x60, 0xdef8}, {0x61, 0xdef8}, {0x62, 0x0def8}}, 0x3, 0x0}, + {0x00,PCI_DEVFN(0x05, 0), {{0x60, 0xdef8}, {0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0x0def8}}, 0x4, 0x0}, + {0x00,PCI_DEVFN(0x06, 0), {{0x61, 0xdef8}, {0x62, 0xdef8}, {0x63, 0xdef8}, {0x60, 0x0def8}}, 0x5, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/getac/p470/irq_tables.c b/src/mainboard/getac/p470/irq_tables.c index 1d5c97e654..e0c807378d 100644 --- a/src/mainboard/getac/p470/irq_tables.c +++ b/src/mainboard/getac/p470/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32+16*CONFIG_IRQ_SLOT_COUNT, /* There can be total 18 devices on the bus */ 0x00, /* Where the interrupt router lies (bus) */ - (0x1f << 3)|0x0, /* Where the interrupt router lies (dev) */ + PCI_DEVFN(0x1f, 0), /* Where the interrupt router lies (dev) */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x27b0, /* Device */ @@ -16,25 +17,25 @@ static const struct irq_routing_table intel_irq_routing_table = { 0xf, /* u8 checksum. */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x01 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // PCIe? - {0x00,(0x02 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // VGA - {0x00,(0x1e << 3)|0x0, {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // PCI bridge - {0x00,(0x1f << 3)|0x0, {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // LPC - {0x00,(0x1d << 3)|0x0, {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, // USB#1 - {0x00,(0x1b << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Audio device - {0x00,(0x1c << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, // PCIe bridge - {0x04,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Firewire - {0x04,(0x01 << 3)|0x0, {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, // PCI Bridge - {0x04,(0x02 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, - {0x04,(0x03 << 3)|0x0, {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, - {0x04,(0x04 << 3)|0x0, {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, - {0x04,(0x05 << 3)|0x0, {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, - {0x04,(0x06 << 3)|0x0, {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, - {0x04,(0x09 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, - {0x01,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // Ethernet 8168 - {0x02,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, - {0x03,(0x00 << 3)|0x0, {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // PCIe? + {0x00,PCI_DEVFN(0x02, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // VGA + {0x00,PCI_DEVFN(0x1e, 0), {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // PCI bridge + {0x00,PCI_DEVFN(0x1f, 0), {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // LPC + {0x00,PCI_DEVFN(0x1d, 0), {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, // USB#1 + {0x00,PCI_DEVFN(0x1b, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Audio device + {0x00,PCI_DEVFN(0x1c, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, // PCIe bridge + {0x04,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Firewire + {0x04,PCI_DEVFN(0x01, 0), {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, // PCI Bridge + {0x04,PCI_DEVFN(0x02, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, + {0x04,PCI_DEVFN(0x03, 0), {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, + {0x04,PCI_DEVFN(0x04, 0), {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, + {0x04,PCI_DEVFN(0x05, 0), {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, + {0x04,PCI_DEVFN(0x06, 0), {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, + {0x04,PCI_DEVFN(0x09, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, + {0x01,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // Ethernet 8168 + {0x02,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, + {0x03,PCI_DEVFN(0x00, 0), {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/ibase/mb899/irq_tables.c b/src/mainboard/ibase/mb899/irq_tables.c index 7974422b6c..e40eec2fd8 100644 --- a/src/mainboard/ibase/mb899/irq_tables.c +++ b/src/mainboard/ibase/mb899/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32+16*CONFIG_IRQ_SLOT_COUNT, /* There can be total CONFIG_IRQ_SLOT_COUNT devices on the bus */ 0x00, /* Where the interrupt router lies (bus) */ - (0x1f << 3)|0x0, /* Where the interrupt router lies (dev) */ + PCI_DEVFN(0x1f, 0), /* Where the interrupt router lies (dev) */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x27b9, /* Device */ @@ -16,25 +17,25 @@ static const struct irq_routing_table intel_irq_routing_table = { 0xf, /* u8 checksum. */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x01 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // PCIe? - {0x00,(0x02 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // VGA - {0x00,(0x1e << 3)|0x0, {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // PCI bridge - {0x00,(0x1f << 3)|0x0, {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // LPC - {0x00,(0x1d << 3)|0x0, {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, // USB#1 - {0x00,(0x1b << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Audio device - {0x00,(0x1c << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, // PCIe bridge - {0x04,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Firewire - {0x04,(0x01 << 3)|0x0, {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, // PCI Bridge - {0x04,(0x02 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, - {0x04,(0x03 << 3)|0x0, {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, - {0x04,(0x04 << 3)|0x0, {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, - {0x04,(0x05 << 3)|0x0, {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, - {0x04,(0x06 << 3)|0x0, {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, - {0x04,(0x09 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, - {0x01,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // Ethernet Marvell 88E8053 - {0x02,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, - {0x03,(0x00 << 3)|0x0, {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // PCIe? + {0x00,PCI_DEVFN(0x02, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // VGA + {0x00,PCI_DEVFN(0x1e, 0), {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // PCI bridge + {0x00,PCI_DEVFN(0x1f, 0), {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // LPC + {0x00,PCI_DEVFN(0x1d, 0), {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, // USB#1 + {0x00,PCI_DEVFN(0x1b, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Audio device + {0x00,PCI_DEVFN(0x1c, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, // PCIe bridge + {0x04,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Firewire + {0x04,PCI_DEVFN(0x01, 0), {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, // PCI Bridge + {0x04,PCI_DEVFN(0x02, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, + {0x04,PCI_DEVFN(0x03, 0), {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, + {0x04,PCI_DEVFN(0x04, 0), {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, + {0x04,PCI_DEVFN(0x05, 0), {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, + {0x04,PCI_DEVFN(0x06, 0), {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, + {0x04,PCI_DEVFN(0x09, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, + {0x01,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // Ethernet Marvell 88E8053 + {0x02,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, + {0x03,PCI_DEVFN(0x00, 0), {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/intel/d945gclf/irq_tables.c b/src/mainboard/intel/d945gclf/irq_tables.c index 4e1f6b9f18..44cf175f55 100644 --- a/src/mainboard/intel/d945gclf/irq_tables.c +++ b/src/mainboard/intel/d945gclf/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32+16*18, /* There can be total 18 devices on the bus */ 0x00, /* Where the interrupt router lies (bus) */ - (0x1f << 3)|0x0, /* Where the interrupt router lies (dev) */ + PCI_DEVFN(0x1f, 0), /* Where the interrupt router lies (dev) */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x27b0, /* Device */ @@ -16,25 +17,25 @@ static const struct irq_routing_table intel_irq_routing_table = { 0xf, /* u8 checksum. */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x01 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // PCIe? - {0x00,(0x02 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // VGA - {0x00,(0x1e << 3)|0x0, {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // PCI bridge - {0x00,(0x1f << 3)|0x0, {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // LPC - {0x00,(0x1d << 3)|0x0, {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, // USB#1 - {0x00,(0x1b << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Audio device - {0x00,(0x1c << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, // PCIe bridge - {0x04,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Firewire - {0x04,(0x01 << 3)|0x0, {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, // PCI Bridge - {0x04,(0x02 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, - {0x04,(0x03 << 3)|0x0, {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, - {0x04,(0x04 << 3)|0x0, {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, - {0x04,(0x05 << 3)|0x0, {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, - {0x04,(0x06 << 3)|0x0, {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, - {0x04,(0x09 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, - {0x01,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // Ethernet 8168 - {0x02,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, - {0x03,(0x00 << 3)|0x0, {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // PCIe? + {0x00,PCI_DEVFN(0x02, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // VGA + {0x00,PCI_DEVFN(0x1e, 0), {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // PCI bridge + {0x00,PCI_DEVFN(0x1f, 0), {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // LPC + {0x00,PCI_DEVFN(0x1d, 0), {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, // USB#1 + {0x00,PCI_DEVFN(0x1b, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Audio device + {0x00,PCI_DEVFN(0x1c, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, // PCIe bridge + {0x04,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, // Firewire + {0x04,PCI_DEVFN(0x01, 0), {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, // PCI Bridge + {0x04,PCI_DEVFN(0x02, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, + {0x04,PCI_DEVFN(0x03, 0), {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, + {0x04,PCI_DEVFN(0x04, 0), {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, + {0x04,PCI_DEVFN(0x05, 0), {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, + {0x04,PCI_DEVFN(0x06, 0), {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, + {0x04,PCI_DEVFN(0x09, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, + {0x01,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, // Ethernet 8168 + {0x02,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, + {0x03,PCI_DEVFN(0x00, 0), {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/kontron/986lcd-m/irq_tables.c b/src/mainboard/kontron/986lcd-m/irq_tables.c index 2545aa8bfa..65db97c23e 100644 --- a/src/mainboard/kontron/986lcd-m/irq_tables.c +++ b/src/mainboard/kontron/986lcd-m/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32+16*CONFIG_IRQ_SLOT_COUNT, /* There can be total CONFIG_IRQ_SLOT_COUNT devices on the bus */ 0x00, /* Where the interrupt router lies (bus) */ - (0x1f << 3)|0x0, /* Where the interrupt router lies (dev) */ + PCI_DEVFN(0x1f, 0), /* Where the interrupt router lies (dev) */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x27b0, /* Device */ @@ -16,25 +17,25 @@ static const struct irq_routing_table intel_irq_routing_table = { 0xf, /* u8 checksum. */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x01 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* PCIe? */ - {0x00,(0x02 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* VGA */ - {0x00,(0x1e << 3)|0x0, {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* PCI bridge */ - {0x00,(0x1f << 3)|0x0, {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* LPC */ - {0x00,(0x1d << 3)|0x0, {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, /* USB#1 */ - {0x00,(0x1b << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Audio device */ - {0x00,(0x1c << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, /* PCIe bridge */ - {0x04,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Firewire */ - {0x04,(0x01 << 3)|0x0, {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, /* PCI Bridge */ - {0x04,(0x02 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, - {0x04,(0x03 << 3)|0x0, {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, - {0x04,(0x04 << 3)|0x0, {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, - {0x04,(0x05 << 3)|0x0, {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, - {0x04,(0x06 << 3)|0x0, {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, - {0x04,(0x09 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, - {0x01,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* Ethernet 8168 */ - {0x02,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, - {0x03,(0x00 << 3)|0x0, {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* PCIe? */ + {0x00,PCI_DEVFN(0x02, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* VGA */ + {0x00,PCI_DEVFN(0x1e, 0), {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* PCI bridge */ + {0x00,PCI_DEVFN(0x1f, 0), {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* LPC */ + {0x00,PCI_DEVFN(0x1d, 0), {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, /* USB#1 */ + {0x00,PCI_DEVFN(0x1b, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Audio device */ + {0x00,PCI_DEVFN(0x1c, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, /* PCIe bridge */ + {0x04,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Firewire */ + {0x04,PCI_DEVFN(0x01, 0), {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, /* PCI Bridge */ + {0x04,PCI_DEVFN(0x02, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, + {0x04,PCI_DEVFN(0x03, 0), {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, + {0x04,PCI_DEVFN(0x04, 0), {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, + {0x04,PCI_DEVFN(0x05, 0), {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, + {0x04,PCI_DEVFN(0x06, 0), {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, + {0x04,PCI_DEVFN(0x09, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, + {0x01,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* Ethernet 8168 */ + {0x02,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, + {0x03,PCI_DEVFN(0x00, 0), {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, } /* clang-format on */ }; diff --git a/src/mainboard/lenovo/x60/irq_tables.c b/src/mainboard/lenovo/x60/irq_tables.c index b39a440fdd..adfb84d55b 100644 --- a/src/mainboard/lenovo/x60/irq_tables.c +++ b/src/mainboard/lenovo/x60/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32 + 16 * 15, /* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ - (0x1f << 3) | 0x0, /* Interrupt router dev */ + PCI_DEVFN(0x1f, 0), /* Interrupt router dev */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x122e, /* Device */ @@ -19,21 +20,21 @@ static const struct irq_routing_table intel_irq_routing_table = { */ /* clang-format off */ { - /* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00, (0x02 << 3) | 0x0, {{0x00, 0xdef8}, {0x61, 0x1cf8}, {0x00, 0xdef8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* VGA 0:02.0 */ - {0x00, (0x1b << 3) | 0x0, {{0x00, 0xdef8}, {0x61, 0x1cf8}, {0x00, 0xdef8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* HD Audio 0:1b.0 */ - {0x00, (0x1c << 3) | 0x0, {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.0 */ - {0x00, (0x1c << 3) | 0x1, {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.1 */ - {0x00, (0x1c << 3) | 0x2, {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.2 */ - {0x00, (0x1c << 3) | 0x3, {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.3 */ - {0x00, (0x1d << 3) | 0x0, {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.0 */ - {0x00, (0x1d << 3) | 0x1, {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.1 */ - {0x00, (0x1d << 3) | 0x2, {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.2 */ - {0x00, (0x1d << 3) | 0x3, {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.3 */ - {0x00, (0x1e << 3) | 0x0, {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* PCI 0:1e.0 */ - {0x00, (0x1f << 3) | 0x0, {{0x6b, 0x1cf8}, {0x60, 0x1cf8}, {0x60, 0x1cf8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* LPC 0:1f.0 */ - {0x00, (0x1f << 3) | 0x1, {{0x6b, 0x1cf8}, {0x60, 0x1cf8}, {0x60, 0x1cf8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* IDE 0:1f.1 */ - {0x00, (0x1f << 3) | 0x2, {{0x6b, 0x1cf8}, {0x60, 0x1cf8}, {0x60, 0x1cf8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* SATA 0:1f.2 */ + /* bus, PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00, PCI_DEVFN(0x02, 0), {{0x00, 0xdef8}, {0x61, 0x1cf8}, {0x00, 0xdef8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* VGA 0:02.0 */ + {0x00, PCI_DEVFN(0x1b, 0), {{0x00, 0xdef8}, {0x61, 0x1cf8}, {0x00, 0xdef8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* HD Audio 0:1b.0 */ + {0x00, PCI_DEVFN(0x1c, 0), {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.0 */ + {0x00, PCI_DEVFN(0x1c, 1), {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.1 */ + {0x00, PCI_DEVFN(0x1c, 2), {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.2 */ + {0x00, PCI_DEVFN(0x1c, 3), {{0x68, 0x1cf8}, {0x69, 0x1cf8}, {0x6a, 0x1cf8}, {0x6b, 0x1cf8}}, 0x0, 0x0}, /* PCIe 0:1c.3 */ + {0x00, PCI_DEVFN(0x1d, 0), {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.0 */ + {0x00, PCI_DEVFN(0x1d, 1), {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.1 */ + {0x00, PCI_DEVFN(0x1d, 2), {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.2 */ + {0x00, PCI_DEVFN(0x1d, 3), {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* USB 0:1d.3 */ + {0x00, PCI_DEVFN(0x1e, 0), {{0x60, 0x1cf8}, {0x61, 0x1cf8}, {0x62, 0x1cf8}, {0x63, 0x1cf8}}, 0x0, 0x0}, /* PCI 0:1e.0 */ + {0x00, PCI_DEVFN(0x1f, 0), {{0x6b, 0x1cf8}, {0x60, 0x1cf8}, {0x60, 0x1cf8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* LPC 0:1f.0 */ + {0x00, PCI_DEVFN(0x1f, 1), {{0x6b, 0x1cf8}, {0x60, 0x1cf8}, {0x60, 0x1cf8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* IDE 0:1f.1 */ + {0x00, PCI_DEVFN(0x1f, 2), {{0x6b, 0x1cf8}, {0x60, 0x1cf8}, {0x60, 0x1cf8}, {0x00, 0xdef8}}, 0x0, 0x0}, /* SATA 0:1f.2 */ } /* clang-format on */ }; diff --git a/src/mainboard/roda/rk886ex/irq_tables.c b/src/mainboard/roda/rk886ex/irq_tables.c index bacf5fe273..73b7412c0d 100644 --- a/src/mainboard/roda/rk886ex/irq_tables.c +++ b/src/mainboard/roda/rk886ex/irq_tables.c @@ -1,13 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, /* u32 signature */ PIRQ_VERSION, /* u16 version */ 32+16*18, /* There can be total 18 devices on the bus */ 0x00, /* Where the interrupt router lies (bus) */ - (0x1f << 3)|0x0, /* Where the interrupt router lies (dev) */ + PCI_DEVFN(0x1f, 0), /* Where the interrupt router lies (dev) */ 0, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x27b0, /* Device */ @@ -16,25 +17,25 @@ static const struct irq_routing_table intel_irq_routing_table = { 0xf, /* u8 checksum. */ /* clang-format off */ { - /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ - {0x00,(0x01 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* PCIe? */ - {0x00,(0x02 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* VGA */ - {0x00,(0x1e << 3)|0x0, {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* PCI bridge */ - {0x00,(0x1f << 3)|0x0, {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* LPC */ - {0x00,(0x1d << 3)|0x0, {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, /* USB#1 */ - {0x00,(0x1b << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Audio device */ - {0x00,(0x1c << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, /* PCIe bridge */ - {0x04,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Firewire */ - {0x04,(0x01 << 3)|0x0, {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, /* PCI Bridge */ - {0x04,(0x02 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, - {0x04,(0x03 << 3)|0x0, {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, - {0x04,(0x04 << 3)|0x0, {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, - {0x04,(0x05 << 3)|0x0, {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, - {0x04,(0x06 << 3)|0x0, {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, - {0x04,(0x09 << 3)|0x0, {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, - {0x01,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* Ethernet 8168 */ - {0x02,(0x00 << 3)|0x0, {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, - {0x03,(0x00 << 3)|0x0, {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, + /* bus,PCI_DEVFN(dev, fn), {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ + {0x00,PCI_DEVFN(0x01, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* PCIe? */ + {0x00,PCI_DEVFN(0x02, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* VGA */ + {0x00,PCI_DEVFN(0x1e, 0), {{0x61, 0xdcf8}, {0x68, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* PCI bridge */ + {0x00,PCI_DEVFN(0x1f, 0), {{0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* LPC */ + {0x00,PCI_DEVFN(0x1d, 0), {{0x6b, 0xdcf8}, {0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x60, 0x0dcf8}}, 0x0, 0x0}, /* USB#1 */ + {0x00,PCI_DEVFN(0x1b, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Audio device */ + {0x00,PCI_DEVFN(0x1c, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x2, 0x0}, /* PCIe bridge */ + {0x04,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x00000}}, 0x0, 0x0}, /* Firewire */ + {0x04,PCI_DEVFN(0x01, 0), {{0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0x0dcf8}}, 0x1, 0x0}, /* PCI Bridge */ + {0x04,PCI_DEVFN(0x02, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x2, 0x0}, + {0x04,PCI_DEVFN(0x03, 0), {{0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0x0dcf8}}, 0x3, 0x0}, + {0x04,PCI_DEVFN(0x04, 0), {{0x6b, 0xdcf8}, {0x68, 0xdcf8}, {0x69, 0xdcf8}, {0x6a, 0x0dcf8}}, 0x4, 0x0}, + {0x04,PCI_DEVFN(0x05, 0), {{0x63, 0xdcd8}, {0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0x0dcf8}}, 0x5, 0x0}, + {0x04,PCI_DEVFN(0x06, 0), {{0x62, 0xdcf8}, {0x61, 0xdcf8}, {0x60, 0xdcf8}, {0x63, 0x0dcd8}}, 0x6, 0x0}, + {0x04,PCI_DEVFN(0x09, 0), {{0x69, 0xdcf8}, {0x6a, 0xdcf8}, {0x6b, 0xdcf8}, {0x68, 0x0dcf8}}, 0x9, 0x0}, + {0x01,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x0, 0x0}, /* Ethernet 8168 */ + {0x02,PCI_DEVFN(0x00, 0), {{0x60, 0xdcf8}, {0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0x0dcd8}}, 0x9, 0x0}, + {0x03,PCI_DEVFN(0x00, 0), {{0x61, 0xdcf8}, {0x62, 0xdcf8}, {0x63, 0xdcd8}, {0x60, 0x0dcf8}}, 0xa, 0x0}, } /* clang-format on */ }; From ce3b7f0e34257ea20a5694b2180d6f7bcf321079 Mon Sep 17 00:00:00 2001 From: Bora Guvendik Date: Fri, 25 Oct 2024 17:06:21 -0700 Subject: [PATCH 0202/3886] soc/intel/pantherlake: Inject CSE TS into CBMEM timestamp table Get boot performance timestamps from CSE and inject them into CBMEM timestamp table. For Panther Lake, remove "Die Management Unit (DMU) load completed" and add "ESE completed AUnit loading" instead. 990:CSME ROM started execution 0 992:ESE completed AUnit loading 0 944:CSE sent 'Boot Stall Done' to PMC 174,000 945:CSE started to handle ICC configuration 274,000 (100,000) 946:CSE sent 'Host BIOS Prep Done' to PMC 274,000 (0) 947:CSE received 'CPU Reset Done Ack sent' from PMC 448,000 (174,000) 0:1st timestamp 556,874 (108,874) BUG=b:376218080 TEST=Able to see TS elapse prior to IA reset on Fatcat Signed-off-by: Bora Guvendik Change-Id: Ie7716b8c371b82c13da1b0217dce1a16e7b95cee Reviewed-on: https://review.coreboot.org/c/coreboot/+/84872 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/soc/intel/common/block/cse/Kconfig | 7 ++++ .../block/include/intelblocks/cse_telemetry.h | 2 + .../include/intelblocks/cse_telemetry_v3.h | 41 +++++++++++++++++++ src/soc/intel/pantherlake/cse_telemetry.c | 4 +- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/soc/intel/common/block/include/intelblocks/cse_telemetry_v3.h diff --git a/src/soc/intel/common/block/cse/Kconfig b/src/soc/intel/common/block/cse/Kconfig index bfef3d5db8..d1548a1fcb 100644 --- a/src/soc/intel/common/block/cse/Kconfig +++ b/src/soc/intel/common/block/cse/Kconfig @@ -295,6 +295,13 @@ config SOC_INTEL_CSE_PRE_CPU_RESET_TELEMETRY_V2 This config will make mainboard use version 2 of the CSE timestamp definitions, it can be used for Meteor Lake M/P. +config SOC_INTEL_CSE_PRE_CPU_RESET_TELEMETRY_V3 + bool + select SOC_INTEL_CSE_PRE_CPU_RESET_TELEMETRY + help + This config will make mainboard use version 3 of the CSE timestamp + definitions, it can be used for Panther Lake U/H. + config SOC_INTEL_CSE_LITE_SYNC_IN_ROMSTAGE bool default !SOC_INTEL_CSE_LITE_SYNC_IN_RAMSTAGE diff --git a/src/soc/intel/common/block/include/intelblocks/cse_telemetry.h b/src/soc/intel/common/block/include/intelblocks/cse_telemetry.h index 291a264725..66cc7f40db 100644 --- a/src/soc/intel/common/block/include/intelblocks/cse_telemetry.h +++ b/src/soc/intel/common/block/include/intelblocks/cse_telemetry.h @@ -7,6 +7,8 @@ #include "cse_telemetry_v1.h" #elif CONFIG(SOC_INTEL_CSE_PRE_CPU_RESET_TELEMETRY_V2) #include "cse_telemetry_v2.h" +#elif CONFIG(SOC_INTEL_CSE_PRE_CPU_RESET_TELEMETRY_V3) +#include "cse_telemetry_v3.h" #endif #endif // SOC_INTEL_COMMON_CSE_TELEMETRY_H diff --git a/src/soc/intel/common/block/include/intelblocks/cse_telemetry_v3.h b/src/soc/intel/common/block/include/intelblocks/cse_telemetry_v3.h new file mode 100644 index 0000000000..6dbadff986 --- /dev/null +++ b/src/soc/intel/common/block/include/intelblocks/cse_telemetry_v3.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef SOC_INTEL_COMMON_CSE_TELEMETRY_V3_H +#define SOC_INTEL_COMMON_CSE_TELEMETRY_V3_H + +enum cse_boot_perf_data_v3 { + /* CSME ROM start execution */ + PERF_DATA_CSME_ROM_START = 0, + + /* 1 - 5 Reserved */ + + /* CSME RBE set "Boot Stall Done" indication to PMC */ + PERF_DATA_CSME_RBE_BOOT_STALL_DONE_TO_PMC = 6, + + /* 7 - 14 Reserved */ + + /* CSME got ICC_CFG_START message from PMC */ + PERF_DATA_CSME_GOT_ICC_CFG_START_MSG_FROM_PMC = 15, + + /* 15 - 16 Reserved */ + + /* CSME set "Host Boot Prep Done" indication to PMC */ + PERF_DATA_CSME_HOST_BOOT_PREP_DONE = 17, + + /* 18 - 32 Reserved */ + + /* PMC sent "Core Reset Done Ack - Sent" message to CSME */ + PERF_DATA_PMC_SENT_CRDA = 33, + + /* 34 - 35 Reserved */ + + /* ESE completed AUnit loading */ + PERF_DATA_ESE_LOAD_AUNIT_COMPLETED = 36, + + /* 37 - 62 Reserved */ + + /* Timestamp when CSME responded to BupGetBootData message itself */ + PERF_DATA_CSME_GET_PERF_RESPONSE = 63, +}; + +#endif /* SOC_INTEL_COMMON_CSE_TELEMETRY_V3_H */ diff --git a/src/soc/intel/pantherlake/cse_telemetry.c b/src/soc/intel/pantherlake/cse_telemetry.c index 6a599c9306..60faeb2b31 100644 --- a/src/soc/intel/pantherlake/cse_telemetry.c +++ b/src/soc/intel/pantherlake/cse_telemetry.c @@ -24,6 +24,6 @@ void soc_cbmem_inject_telemetry_data(s64 *ts, s64 current_time) start_stamp + ts[PERF_DATA_CSME_HOST_BOOT_PREP_DONE]); timestamp_add(TS_ME_RECEIVED_CRDA_FROM_PMC, start_stamp + ts[PERF_DATA_PMC_SENT_CRDA]); - timestamp_add(TS_ISSE_DMU_LOAD_END, - start_stamp + ts[PERF_DATA_ISSE_DMU_LOAD_COMPLETED]); + timestamp_add(TS_ESE_LOAD_AUNIT_END, + start_stamp + ts[PERF_DATA_ESE_LOAD_AUNIT_COMPLETED]); } From b927d558bb452cf723c34ff9c363dca3cc6b9909 Mon Sep 17 00:00:00 2001 From: John Su Date: Thu, 13 Feb 2025 14:31:44 +0800 Subject: [PATCH 0203/3886] mb/google/trulo/var/uldrenite: Enable DPTF oem_variables Support oem_variables and change based on EC notify event. BUG=b:394177292 BRANCH=firmware-trulo-15217.771.B TEST=emerge-nissa coreboot Change-Id: Iac18cb968906a9dfe53836432ba8dbefee1dcc8e Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86394 Reviewed-by: Dtrain Hsu Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal Reviewed-by: Eric Lai --- .../google/brya/variants/uldrenite/include/variant/ec.h | 3 +++ .../google/brya/variants/uldrenite/overridetree.cb | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/include/variant/ec.h b/src/mainboard/google/brya/variants/uldrenite/include/variant/ec.h index 7a2a6ff8b7..818cdef7df 100644 --- a/src/mainboard/google/brya/variants/uldrenite/include/variant/ec.h +++ b/src/mainboard/google/brya/variants/uldrenite/include/variant/ec.h @@ -5,4 +5,7 @@ #include +/* Enable DPTF OEM variable */ +#define DPTF_ENABLE_OEM_VARIABLES + #endif diff --git a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb index fdc933eb3b..5571fe7902 100644 --- a/src/mainboard/google/brya/variants/uldrenite/overridetree.cb +++ b/src/mainboard/google/brya/variants/uldrenite/overridetree.cb @@ -225,7 +225,11 @@ chip soc/intel/alderlake [3] = { 8, 500 } }" - device generic 0 on end + register "oem_data.oem_variables" = "{ + [0] = 0x0 + }" + + device generic 0 alias dptf_policy on end end end # DPTF device ref tcss_xhci on From a53d8ad8ac01f5ea127899c045a853bb5ca26174 Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Wed, 12 Feb 2025 19:21:44 +0900 Subject: [PATCH 0204/3886] mb/google/nissa/var/meliks: Generate SPD ID for 3 supported parts Add supported memory parts in mem_parts_used.txt, and generate SPD id for these parts. - K3KL6L60GM-MGCT (Samsung) - MT62F512M32D2DR-031 WT:B (Micron) - K3KL8L80DM-MGCU (Samsung) BUG=b:394359785 TEST=Build coreboot and verified booting to depthcharge Change-Id: Ief1272ef4cb7971c3abfe6ee982b019121f54793 Signed-off-by: Seunghwan Kim Reviewed-on: https://review.coreboot.org/c/coreboot/+/86375 Reviewed-by: Dinesh Gehlot Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal Reviewed-by: Eric Lai --- .../google/brya/variants/meliks/memory/Makefile.mk | 8 ++++++-- .../brya/variants/meliks/memory/dram_id.generated.txt | 8 ++++++++ .../google/brya/variants/meliks/memory/mem_parts_used.txt | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk b/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk index eace2e443e..1f7a706678 100644 --- a/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk +++ b/src/mainboard/google/brya/variants/meliks/memory/Makefile.mk @@ -1,5 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-or-later # This is an auto-generated file. Do not edit!! -# Add memory parts in mem_parts_used.txt and run spd_tools to regenerate. +# Generated by: +# util/spd_tools/bin/part_id_gen ADL lp5 src/mainboard/google/brya/variants/meliks/memory src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt -SPD_SOURCES = placeholder +SPD_SOURCES = +SPD_SOURCES += spd/lp5/set-0/spd-9.hex # ID = 0(0b0000) Parts = K3KL6L60GM-MGCT +SPD_SOURCES += spd/lp5/set-0/spd-1.hex # ID = 1(0b0001) Parts = MT62F512M32D2DR-031 WT:B +SPD_SOURCES += spd/lp5/set-0/spd-11.hex # ID = 2(0b0010) Parts = K3KL8L80DM-MGCU diff --git a/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt b/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt index fa247902ee..5ca8b34c83 100644 --- a/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt +++ b/src/mainboard/google/brya/variants/meliks/memory/dram_id.generated.txt @@ -1 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# This is an auto-generated file. Do not edit!! +# Generated by: +# util/spd_tools/bin/part_id_gen ADL lp5 src/mainboard/google/brya/variants/meliks/memory src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt + DRAM Part Name ID to assign +K3KL6L60GM-MGCT 0 (0000) +MT62F512M32D2DR-031 WT:B 1 (0001) +K3KL8L80DM-MGCU 2 (0010) diff --git a/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt b/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt index 2499005682..cb07b5236e 100644 --- a/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt +++ b/src/mainboard/google/brya/variants/meliks/memory/mem_parts_used.txt @@ -9,3 +9,6 @@ # See util/spd_tools/README.md for more details and instructions. # Part Name +K3KL6L60GM-MGCT +MT62F512M32D2DR-031 WT:B +K3KL8L80DM-MGCU From 4ba6dc6b1c23cea0813f93335b8d4d37bae9aed3 Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Wed, 12 Feb 2025 18:33:24 +0900 Subject: [PATCH 0205/3886] =?UTF-8?q?mb/google/nissa/var/meliks:=20Copy=20?= =?UTF-8?q?pirrha=E2=80=99s=20overridetree=20as=20initial=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upload the initial devicetree for meliks. All devices and port usages are the same as pirrha, just copied from pirrha's devicetree for the initial configuration except typec_aux_bias_pads[0] since pirrha had incorrect setting. About detection method of the touch screen device, the panel-built-in touch screen for meliks needs some delay after panel power up, so it may not be detected in coreboot phase. So we would keep `probed` instead of `detect` for this special touch screen device to avoid missing it in OS. BUG=b:394359785 BRANCH=nissa TEST=FW_NAME=meliks emerge-nissa coreboot Change-Id: Ifd6dfbeca7276dbacd72f9145ed7119566c8faef Signed-off-by: Seunghwan Kim Reviewed-on: https://review.coreboot.org/c/coreboot/+/86377 Reviewed-by: Eric Lai Reviewed-by: Dinesh Gehlot Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Kapil Porwal --- .../brya/variants/meliks/overridetree.cb | 510 +++++++++++++++++- 1 file changed, 508 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/brya/variants/meliks/overridetree.cb b/src/mainboard/google/brya/variants/meliks/overridetree.cb index 4f2c04a57a..1d9ced5eb8 100644 --- a/src/mainboard/google/brya/variants/meliks/overridetree.cb +++ b/src/mainboard/google/brya/variants/meliks/overridetree.cb @@ -1,6 +1,512 @@ chip soc/intel/alderlake + # GPE configuration + register "pmc_gpe0_dw1" = "GPP_C" - device domain 0 on - end + # Enable MIPI DSI on DDI port A + register "ddi_portA_config" = "2" # MIPI DSI + register "sagv" = "SaGv_Enabled" + + # SOC Aux orientation override: + # This is a bitfield that corresponds to up to 4 TCSS ports. + # Bits (0,1) allocated for TCSS Port1 configuration and Bits (2,3)for TCSS Port2. + # TcssAuxOri = 0101b + # Bit0,Bit2 set to "1" indicates no retimer on USBC Ports + # Bit1,Bit3 set to "0" indicates Aux lines are not swapped on the + # motherboard to USBC connector + register "tcss_aux_ori" = "5" + + register "typec_aux_bias_pads[0]" = "{.pad_auxp_dc = GPP_A14, .pad_auxn_dc = GPP_A15}" + register "typec_aux_bias_pads[1]" = "{.pad_auxp_dc = GPP_A21, .pad_auxn_dc = GPP_A22}" + + register "usb2_ports[0]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .pre_emp_bias = USB2_BIAS_28P15MV, + .tx_bias = USB2_BIAS_0MV, + .tx_emp_enable = USB2_DE_EMP_ON_PRE_EMP_ON, + .pre_emp_bit = USB2_FULL_BIT_PRE_EMP, + .type_c = 1, + }" # USB2_C0 + register "usb2_ports[1]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .pre_emp_bias = USB2_BIAS_28P15MV, + .tx_bias = USB2_BIAS_11P25MV, + .tx_emp_enable = USB2_DE_EMP_ON_PRE_EMP_ON, + .pre_emp_bit = USB2_FULL_BIT_PRE_EMP, + .type_c = 1, + }" # USB2_C1 + register "usb2_ports[3]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .pre_emp_bias = USB2_BIAS_28P15MV, + .tx_bias = USB2_BIAS_11P25MV, + .tx_emp_enable = USB2_DE_EMP_ON_PRE_EMP_ON, + .pre_emp_bit = USB2_FULL_BIT_PRE_EMP, + }" # USB2_A0 + register "usb2_ports[4]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .pre_emp_bias = USB2_BIAS_28P15MV, + .tx_bias = USB2_BIAS_0MV, + .tx_emp_enable = USB2_DE_EMP_ON, + .pre_emp_bit = USB2_FULL_BIT_PRE_EMP, + }" # uSD + register "usb2_ports[5]" = "{ + .enable = 1, + .ocpin = OC_SKIP, + .tx_bias = USB2_BIAS_0MV, + .tx_emp_enable = USB2_DE_EMP_ON_PRE_EMP_ON, + .pre_emp_bias = USB2_BIAS_28P15MV, + .pre_emp_bit = USB2_FULL_BIT_PRE_EMP, + }" # UFCamera + register "usb2_ports[9]" = "USB2_PORT_MID(OC_SKIP)" # Bluetooth port for CNVi WLAN + + register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB3/2 Type A port A1 + + register "tcss_ports[0]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + register "tcss_ports[1]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + + register "serial_io_i2c_mode" = "{ + [PchSerialIoIndexI2C0] = PchSerialIoPci, + [PchSerialIoIndexI2C1] = PchSerialIoPci, + [PchSerialIoIndexI2C2] = PchSerialIoPci, + [PchSerialIoIndexI2C3] = PchSerialIoPci, + [PchSerialIoIndexI2C4] = PchSerialIoPci, + [PchSerialIoIndexI2C5] = PchSerialIoPci, + }" + + # Configure external V1P05/Vnn/VnnSx Rails + register "ext_fivr_settings" = "{ + .configure_ext_fivr = 1, + .v1p05_enable_bitmap = FIVR_ENABLE_ALL_SX & ~FIVR_ENABLE_S0, + .vnn_enable_bitmap = FIVR_ENABLE_ALL_SX , + .vnn_sx_enable_bitmap = FIVR_ENABLE_ALL_SX , + .v1p05_supported_voltage_bitmap = FIVR_VOLTAGE_NORMAL, + .vnn_supported_voltage_bitmap = FIVR_VOLTAGE_MIN_RETENTION, + .v1p05_voltage_mv = 1050, + .vnn_voltage_mv = 780, + .vnn_sx_voltage_mv = 1050, + .v1p05_icc_max_ma = 500, + .vnn_icc_max_ma = 500, + }" + + # VR Settings + register "domain_vr_config[VR_DOMAIN_IA]" = "{ + .vr_config_enable = 1, + .tdc_timewindow = 1000, + .ac_loadline = 500, + .dc_loadline = 500, + .psi1threshold = VR_CFG_AMP(20), + .psi2threshold = VR_CFG_AMP(5), + .psi3threshold = VR_CFG_AMP(1), + }" + + register "domain_vr_config[VR_DOMAIN_GT]" = "{ + .vr_config_enable = 1, + .tdc_timewindow = 1000, + .psi1threshold = VR_CFG_AMP(13), + .psi2threshold = VR_CFG_AMP(5), + .psi3threshold = VR_CFG_AMP(1), + + }" + + # Enable the Cnvi BT Audio Offload + register "cnvi_bt_audio_offload" = "1" + + # Intel Common SoC Config + #+-------------------+---------------------------+ + #| Field | Value | + #+-------------------+---------------------------+ + #| I2C0 | TPM. Early init is | + #| | required to set up a BAR | + #| | for TPM communication | + #| I2C1 | Touchscreen | + #| I2C2 | WCAM | + #| I2C3 | Audio | + #| I2C4 | EMR | + #| I2C5 | Trackpad | + #+-------------------+---------------------------+ + register "common_soc_config" = "{ + .panel_orientation = LB_FB_ORIENTATION_RIGHT_UP, + .i2c[0] = { + .early_init = 1, + .speed = I2C_SPEED_FAST_PLUS, + .speed_config[0] = { + .speed = I2C_SPEED_FAST_PLUS, + .scl_lcnt = 55, + .scl_hcnt = 30, + .sda_hold = 7, + } + }, + .i2c[1] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 157, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + .i2c[2] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 157, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + .i2c[3] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 158, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + .i2c[4] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 158, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + .i2c[5] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 158, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + }" + + device domain 0 on + device ref dtt on + chip drivers/intel/dptf + ## sensor information + register "options.tsr[0].desc" = ""Memory"" + register "options.tsr[1].desc" = ""Charger"" + register "options.tsr[2].desc" = ""Ambient"" + register "options.tsr[3].desc" = ""Sub Charger"" + + # TODO: below values are initial reference values only + ## Passive Policy + register "policies.passive" = "{ + [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 75, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 75, 5000), + [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 75, 5000), + [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_3, 75, 5000), + }" + + ## Critical Policy + register "policies.critical" = "{ + [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), + [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 85, SHUTDOWN), + [4] = DPTF_CRITICAL(TEMP_SENSOR_3, 85, SHUTDOWN), + }" + + register "controls.power_limits" = "{ + .pl1 = { + .min_power = 3000, + .max_power = 6000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 200 + }, + .pl2 = { + .min_power = 25000, + .max_power = 25000, + .time_window_min = 1, + .time_window_max = 1, + .granularity = 1000 + } + }" + + ## Charger Performance Control (Control, mA) + register "controls.charger_perf" = "{ + [0] = { 255, 1700 }, + [1] = { 24, 1500 }, + [2] = { 16, 1000 }, + [3] = { 8, 500 } + }" + + device generic 0 on end + end + end + device ref ipu on + chip drivers/intel/mipi_camera + register "acpi_uid" = "0x50000" + register "acpi_name" = ""IPU0"" + register "device_type" = "INTEL_ACPI_CAMERA_CIO2" + register "cio2_num_ports" = "1" + register "cio2_lanes_used" = "{4}" # 4 CSI Camera lanes are used + register "cio2_lane_endpoint[0]" = ""^I2C2.CAM0"" + register "cio2_prt[0]" = "2" + device generic 0 on end + end + end + device ref cnvi_wifi on + chip drivers/wifi/generic + register "enable_cnvi_ddr_rfim" = "true" + device generic 0 on end + end + end + device ref i2c1 on + chip drivers/i2c/hid + register "generic.hid" = ""HX121A"" + register "generic.desc" = ""HX Touchscreen"" + register "generic.irq" = "ACPI_IRQ_LEVEL_LOW(GPP_C7_IRQ)" + register "generic.probed" = "1" + register "generic.reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_C1)" + register "generic.reset_delay_ms" = "200" + register "generic.reset_off_delay_ms" = "2" + register "generic.has_power_resource" = "1" + register "hid_desc_reg_offset" = "0x1" + device i2c 4F on end + end + end + device ref i2c2 on + chip drivers/intel/mipi_camera + register "acpi_hid" = ""OVTI8856"" + register "acpi_uid" = "0" + register "acpi_name" = ""CAM0"" + register "chip_name" = ""Ov 8856 Camera"" + register "device_type" = "INTEL_ACPI_CAMERA_SENSOR" + + register "ssdb.lanes_used" = "4" + register "ssdb.link_used" = "1" + register "ssdb.vcm_type" = "0x0C" + register "vcm_name" = ""VCM0"" + register "num_freq_entries" = "2" + register "link_freq[0]" = "360000000" + register "link_freq[1]" = "180000000" + register "remote_name" = ""IPU0"" + + register "has_power_resource" = "true" + #Controls + register "clk_panel.clks[0].clknum" = "IMGCLKOUT_3" + register "clk_panel.clks[0].freq" = "FREQ_19_2_MHZ" + + register "gpio_panel.gpio[0].gpio_num" = "GPP_D15" # EN_PP2800_WCAM_X + register "gpio_panel.gpio[1].gpio_num" = "GPP_D16" # EN_PP1800_PP1200_WCAM_X + register "gpio_panel.gpio[2].gpio_num" = "GPP_D3" # WCAM_RST_L + + #_ON + register "on_seq.ops_cnt" = "5" + register "on_seq.ops[0]" = "SEQ_OPS_CLK_ENABLE(0, 0)" + register "on_seq.ops[1]" = "SEQ_OPS_GPIO_ENABLE(0, 5)" + register "on_seq.ops[2]" = "SEQ_OPS_GPIO_ENABLE(1, 5)" + register "on_seq.ops[3]" = "SEQ_OPS_GPIO_DISABLE(2, 5)" + register "on_seq.ops[4]" = "SEQ_OPS_GPIO_ENABLE(2, 5)" + + #_OFF + register "off_seq.ops_cnt" = "4" + register "off_seq.ops[0]" = "SEQ_OPS_CLK_DISABLE(0, 0)" + register "off_seq.ops[1]" = "SEQ_OPS_GPIO_DISABLE(2, 0)" + register "off_seq.ops[2]" = "SEQ_OPS_GPIO_DISABLE(1, 0)" + register "off_seq.ops[3]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 36 on end + end + chip drivers/intel/mipi_camera + register "acpi_uid" = "3" + register "acpi_name" = ""VCM0"" + register "chip_name" = ""DW AF DAC"" + register "device_type" = "INTEL_ACPI_CAMERA_VCM" + + register "pr0" = ""\\_SB.PCI0.I2C2.CAM0.PRIC"" + register "vcm_compat" = ""dongwoon,dw9714"" + + device i2c 0C on end + end + chip drivers/intel/mipi_camera + register "acpi_hid" = "ACPI_DT_NAMESPACE_HID" + register "acpi_uid" = "1" + register "acpi_name" = ""NVM0"" + register "chip_name" = ""GT24C08"" + register "device_type" = "INTEL_ACPI_CAMERA_NVM" + + register "pr0" = ""\\_SB.PCI0.I2C2.CAM0.PRIC"" + + register "nvm_size" = "0x2000" + register "nvm_pagesize" = "1" + register "nvm_readonly" = "1" + register "nvm_width" = "0x10" + register "nvm_compat" = ""atmel,24c08"" + + device i2c 50 on end + end + end + device ref i2c3 on + chip drivers/i2c/da7219 + register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A23)" + register "btn_cfg" = "50" + register "mic_det_thr" = "200" + register "jack_ins_deb" = "20" + register "jack_det_rate" = ""32ms_64ms"" + register "jack_rem_deb" = "1" + register "a_d_btn_thr" = "0xa" + register "d_b_btn_thr" = "0x16" + register "b_c_btn_thr" = "0x21" + register "c_mic_btn_thr" = "0x3e" + register "btn_avg" = "4" + register "adc_1bit_rpt" = "1" + register "micbias_lvl" = "2600" + register "mic_amp_in_sel" = ""diff"" + device i2c 1a on end + end + end + device ref i2c4 on + chip drivers/i2c/hid + register "generic.hid" = ""WCOM014B"" + register "generic.desc" = ""WCOM Digitizer"" + register "generic.irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPP_F12)" + register "generic.enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_C0)" + register "generic.enable_delay_ms" = "20" + register "generic.reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F16)" + register "generic.reset_delay_ms" = "100" + register "generic.has_power_resource" = "1" + register "hid_desc_reg_offset" = "0x1" + device i2c 09 on end + end + end + device ref i2c5 on + chip drivers/i2c/hid + register "generic.hid" = ""ZNT0000"" + register "generic.desc" = ""Zinitix Touchpad"" + register "generic.irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_F14_IRQ)" + register "generic.wake" = "GPE0_DW2_14" + register "generic.detect" = "1" + register "hid_desc_reg_offset" = "0xE" + device i2c 40 on end + end + end + device ref hda on + chip drivers/generic/max98357a + register "hid" = ""MX98360A"" + register "sdmode_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_A11)" + register "sdmode_delay" = "5" + device generic 0 on end + end + chip drivers/sof + register "spkr_tplg" = "max98360a" + register "jack_tplg" = "da7219" + register "mic_tplg" = "_2ch_pdm0" + device generic 0 on end + end + end + device ref pcie_rp7 off end + device ref pcie_rp9 off end + device ref ish on + chip drivers/intel/ish + register "add_acpi_dma_property" = "true" + device generic 0 on end + end + end + device ref ufs on end + device ref pch_espi on + chip ec/google/chromeec + use conn0 as mux_conn[0] + use conn1 as mux_conn[1] + device pnp 0c09.0 on end + end + end + device ref pmc hidden + chip drivers/intel/pmc_mux + device generic 0 on + chip drivers/intel/pmc_mux/conn + use usb2_port1 as usb2_port + use tcss_usb3_port1 as usb3_port + device generic 0 alias conn0 on end + end + chip drivers/intel/pmc_mux/conn + use usb2_port2 as usb2_port + use tcss_usb3_port2 as usb3_port + device generic 1 alias conn1 on end + end + end + end + end + device ref tcss_xhci on + chip drivers/usb/acpi + device ref tcss_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C0 (MLB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(LEFT, LEFT, ACPI_PLD_GROUP(1, 1))" + device ref tcss_usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C1 (DB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, RIGHT, ACPI_PLD_GROUP(2, 1))" + device ref tcss_usb3_port2 on end + end + end + end + end + device ref xhci on + chip drivers/usb/acpi + device ref xhci_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C0 (MLB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(LEFT, LEFT, ACPI_PLD_GROUP(1, 1))" + device ref usb2_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C1 (DB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, RIGHT, ACPI_PLD_GROUP(2, 1))" + device ref usb2_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A1 (DB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(RIGHT, LEFT, ACPI_PLD_GROUP(4, 1))" + device ref usb2_port4 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 SDCard"" + register "type" = "UPC_TYPE_EXPRESSCARD" + device ref usb2_port5 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Camera"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port6 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + register "reset_gpio" = + "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" + device ref usb2_port10 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A1 (DB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(RIGHT, LEFT, ACPI_PLD_GROUP(4, 1))" + device ref usb3_port2 on end + end + end + end + end + end end From f46f2cb6782fe00bd4ead528da99cf3465b7d28f Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Wed, 12 Feb 2025 18:39:08 +0900 Subject: [PATCH 0206/3886] mb/google/nissa/var/meliks: Update GPIO configuration Update the initial GPIO configuration for meliks by referring to the schematics. BUG=b:394359785 BRANCH=nissa TEST=FW_NAME=meliks emerge-nissa coreboot Change-Id: I33e1e3be5f2530feb396e7413f3f0cd75d5f38ca Signed-off-by: Seunghwan Kim Reviewed-on: https://review.coreboot.org/c/coreboot/+/86378 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Subrata Banik Reviewed-by: Kapil Porwal Reviewed-by: Dinesh Gehlot --- .../google/brya/variants/meliks/Makefile.mk | 4 + .../google/brya/variants/meliks/gpio.c | 109 ++++++++++++++++++ .../variants/meliks/include/variant/gpio.h | 2 + 3 files changed, 115 insertions(+) create mode 100644 src/mainboard/google/brya/variants/meliks/gpio.c diff --git a/src/mainboard/google/brya/variants/meliks/Makefile.mk b/src/mainboard/google/brya/variants/meliks/Makefile.mk index c44e4f0364..227b163fc8 100644 --- a/src/mainboard/google/brya/variants/meliks/Makefile.mk +++ b/src/mainboard/google/brya/variants/meliks/Makefile.mk @@ -1,2 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only +bootblock-y += gpio.c + romstage-y += memory.c + +ramstage-y += gpio.c diff --git a/src/mainboard/google/brya/variants/meliks/gpio.c b/src/mainboard/google/brya/variants/meliks/gpio.c new file mode 100644 index 0000000000..431b613c0a --- /dev/null +++ b/src/mainboard/google/brya/variants/meliks/gpio.c @@ -0,0 +1,109 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +/* Pad configuration in ramstage */ +static const struct pad_config override_gpio_table[] = { + /* A14 : USB_C0_AUX_DC_P */ + PAD_CFG_NF(GPP_A14, NONE, DEEP, NF6), + /* A15 : USB_C0_AUX_DC_N */ + PAD_CFG_NF(GPP_A15, NONE, DEEP, NF6), + + /* B11 : PMCALERT# ==> EN_PP3300_WLAN */ + PAD_CFG_GPO(GPP_B11, 1, DEEP), + + /* D6 : WWAN_EN ==> NC */ + PAD_NC(GPP_D6, NONE), + /* D7 : WLAN_CLKREQ_ODL ==> NC */ + PAD_NC(GPP_D7, NONE), + /* D8 : SD_CLKREQ_ODL ==> NC */ + PAD_NC(GPP_D8, NONE), + + /* E14 : EDP_HPD ==> NC */ + PAD_NC(GPP_E14, NONE), + /* E20 : HDMI_DDC_SCL ==> NC */ + PAD_NC(GPP_E20, NONE), + /* E21 : DDP2_CTRLDATA ==> HDMI_DDC_SDA_STRAP */ + PAD_CFG_NF(GPP_E21, NONE, DEEP, NF1), + /* E22 : DDPA_CTRLCLK ==> LCD_RST_N - used for MIPI Power seq. */ + PAD_CFG_NF(GPP_E22, NONE, DEEP, NF1), + /* E23 : NC */ + PAD_NC(GPP_E23, NONE), + + /* F6 : NC */ + PAD_NC(GPP_F6, NONE), + /* F12 : GSXDOUT ==> EMR_INT_ODL */ + PAD_CFG_GPI_INT(GPP_F12, NONE, PLTRST, LEVEL), + /* F13 : SOC_PEN_DETECT_R_ODL ==> NC */ + PAD_NC(GPP_F13, NONE), + /* F15 : SOC_PEN_DETECT_OEL ==> NC */ + PAD_NC(GPP_F15, NONE), + /* F16 : GSXCLK ==> EMR_RESET_L */ + PAD_CFG_GPO(GPP_F16, 0, DEEP), + + /* H3 : NC */ + PAD_NC(GPP_H3, NONE), + /* H8 : I2C4_SDA ==> SOC_I2C_EMR_SDA */ + PAD_CFG_NF(GPP_H8, NONE, DEEP, NF1), + /* H9 : I2C4_SCL ==> SOC_I2C_EMR_SCL */ + PAD_CFG_NF(GPP_H9, NONE, DEEP, NF1), + /* H12 : SD_PERST_L ==> NC */ + PAD_NC(GPP_H12, NONE), + /* H19 : NC */ + PAD_NC(GPP_H19, NONE), + /* H20 : NC */ + PAD_NC(GPP_H20, NONE), + + /* Configure the virtual CNVi Bluetooth I2S GPIO pads */ + /* BT_I2S_BCLK */ + PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), + /* BT_I2S_SYNC */ + PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), + /* BT_I2S_SDO */ + PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), + /* BT_I2S_SDI */ + PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), + /* SSP2_SCLK */ + PAD_CFG_NF(GPP_VGPIO_34, NONE, DEEP, NF1), + /* SSP2_SFRM */ + PAD_CFG_NF(GPP_VGPIO_35, NONE, DEEP, NF1), + /* SSP_TXD */ + PAD_CFG_NF(GPP_VGPIO_36, NONE, DEEP, NF1), + /* SSP_RXD */ + PAD_CFG_NF(GPP_VGPIO_37, NONE, DEEP, NF1), +}; + +/* Early pad configuration in bootblock for pirrha */ +static const struct pad_config early_gpio_table[] = { + /* A13 : GPP_A13 ==> GSC_SOC_INT_ODL */ + PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT), + /* E12 : THC0_SPI1_IO1 ==> SOC_WP_OD */ + PAD_CFG_GPI_GPIO_DRIVER(GPP_E12, NONE, DEEP), + /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */ + PAD_CFG_GPI(GPP_F18, NONE, DEEP), + /* H4 : I2C0_SDA ==> SOC_I2C_GSC_SDA */ + PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1), + /* H5 : I2C0_SCL ==> SOC_I2C_GSC_SCL */ + PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1), + /* H10 : UART0_RXD ==> UART_SOC_RX_DBG_TX */ + PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2), + /* H11 : UART0_TXD ==> UART_SOC_TX_DBG_RX */ + PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2), + /* H13 : UART0_CTS# ==> EN_PP3300_SD_X */ + PAD_CFG_GPO(GPP_H13, 1, DEEP), +}; + +const struct pad_config *variant_gpio_override_table(size_t *num) +{ + *num = ARRAY_SIZE(override_gpio_table); + return override_gpio_table; +} + +const struct pad_config *variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} diff --git a/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h b/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h index c4fe342621..b98b09d2e2 100644 --- a/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h +++ b/src/mainboard/google/brya/variants/meliks/include/variant/gpio.h @@ -5,4 +5,6 @@ #include +#define SD_CARD_POWER GPP_H13 + #endif From 5cc8685fcdb2d13bdcc887ef45fd9b8eafc72a68 Mon Sep 17 00:00:00 2001 From: Shuo Liu Date: Mon, 13 Mar 2023 22:40:09 +0800 Subject: [PATCH 0207/3886] util/cbfstool: Add missing \n and use __func__ in debug messages For adding missing \n, find all potential missings by below script and apply manual checks and fixes. grep -nE "(DEBUG|ERROR)\(\".+[^\\n]\"" util/cbfstool/ -r For using __func__ in debug message, below script is used with manual checks and fixes. grep -nE "DEBUG\(.+:" util/cbfstool/ -r Change-Id: I3e2c225dc16a65470f9f94db89d8ec3711e781c8 Signed-off-by: Shuo Liu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86567 Reviewed-by: Elyes Haouas Tested-by: build bot (Jenkins) --- util/cbfstool/cbfs_image.c | 28 ++++++++++++++-------------- util/cbfstool/fit.c | 8 ++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index e9353570cb..bb7c6f102a 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -257,13 +257,13 @@ int cbfs_legacy_image_create(struct cbfs_image *image, void *header_loc; size_t size = image->buffer.size; - DEBUG("cbfs_image_create: bootblock=0x%x+0x%zx, " - "header=0x%x+0x%zx, entries_offset=0x%x\n", + DEBUG("%s: bootblock=0x%x+0x%zx, " + "header=0x%x+0x%zx, entries_offset=0x%x\n", __func__, bootblock_offset, bootblock->size, header_offset, sizeof(image->header), entries_offset); - DEBUG("cbfs_create_image: (real offset) bootblock=0x%x, " - "header=0x%x, entries_offset=0x%x\n", + DEBUG("%s: (real offset) bootblock=0x%x, " + "header=0x%x, entries_offset=0x%x\n", __func__, bootblock_offset, header_offset, entries_offset); // Prepare bootblock @@ -636,7 +636,7 @@ static int cbfs_add_entry_at(struct cbfs_image *image, if (header_offset % align) header_offset -= header_offset % align; if (header_offset < addr) { - ERROR("No space to hold cbfs_file header."); + ERROR("No space to hold cbfs_file header.\n"); return -1; } @@ -771,7 +771,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, entry_size = addr_next - addr; max_null_entry_size = MAX(max_null_entry_size, entry_size); - DEBUG("cbfs_add_entry: space at 0x%x+0x%x(%d) bytes\n", + DEBUG("%s: space at 0x%x+0x%x(%d) bytes\n", __func__, addr, entry_size, entry_size); /* Will the file fit? Don't yet worry if we have space for a new @@ -783,10 +783,10 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, // Test for complicated cases if (content_offset > 0) { if (addr_next < content_offset) { - DEBUG("Not for specified offset yet"); + DEBUG("Not for specified offset yet.\n"); continue; } else if (addr > content_offset) { - DEBUG("Exceed specified content_offset."); + DEBUG("Exceed specified content_offset.\n"); break; } else if (addr + header_size > content_offset) { ERROR("Not enough space for header.\n"); @@ -830,7 +830,7 @@ struct cbfs_file *cbfs_get_entry(struct cbfs_image *image, const char *name) entry && cbfs_is_valid_entry(image, entry); entry = cbfs_find_next_entry(image, entry)) { if (strcasecmp(entry->filename, name) == 0) { - DEBUG("cbfs_get_entry: found %s\n", name); + DEBUG("%s: found %s\n", __func__, name); return entry; } } @@ -1323,7 +1323,7 @@ int cbfs_remove_entry(struct cbfs_image *image, const char *name) ERROR("CBFS file %s not found.\n", name); return -1; } - DEBUG("cbfs_remove_entry: Removed %s @ 0x%x\n", + DEBUG("%s: Removed %s @ 0x%x\n", __func__, entry->filename, cbfs_get_entry_addr(image, entry)); entry->type = htobe32(CBFS_TYPE_DELETED); cbfs_legacy_walk(image, cbfs_merge_empty_entry, NULL); @@ -1879,7 +1879,7 @@ struct cbfs_file_attribute *cbfs_add_file_attr(struct cbfs_file *header, } while (next != NULL); uint32_t header_size = be32toh(header->offset) + size; if (header_size > CBFS_METADATA_MAX_SIZE) { - DEBUG("exceeding allocated space for cbfs_file headers"); + DEBUG("exceeding allocated space for cbfs_file headers.\n"); return NULL; } /* attr points to the last valid attribute now. @@ -2024,14 +2024,14 @@ int32_t cbfs_locate_entry(struct cbfs_image *image, size_t size, offset = absolute_align(image, addr + metadata_size, align); if (is_in_same_page(offset, size, page_size) && is_in_range(addr, addr_next, metadata_size, offset, size)) { - DEBUG("cbfs_locate_entry: FIT (PAGE1)."); + DEBUG("%s: FIT (PAGE1).\n", __func__); return offset; } addr2 = align_up(addr, page_size); offset = absolute_align(image, addr2, align); if (is_in_range(addr, addr_next, metadata_size, offset, size)) { - DEBUG("cbfs_locate_entry: OVERLAP (PAGE2)."); + DEBUG("%s: OVERLAP (PAGE2).\n", __func__); return offset; } @@ -2041,7 +2041,7 @@ int32_t cbfs_locate_entry(struct cbfs_image *image, size_t size, addr3 = addr2 + page_size; offset = absolute_align(image, addr3, align); if (is_in_range(addr, addr_next, metadata_size, offset, size)) { - DEBUG("cbfs_locate_entry: OVERLAP+ (PAGE3)."); + DEBUG("%s: OVERLAP+ (PAGE3).\n", __func__); return offset; } } diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c index d4e48f1946..ca60720b2c 100644 --- a/util/cbfstool/fit.c +++ b/util/cbfstool/fit.c @@ -719,12 +719,12 @@ int fit_add_entry(struct fit_table *fit, struct fit_entry *entry; if (!fit) { - ERROR("Internal error."); + ERROR("Internal error.\n"); return 1; } if (fit_free_space(fit, max_fit_entries) < 1) { - ERROR("No space left in FIT."); + ERROR("No space left in FIT.\n"); return 1; } @@ -781,12 +781,12 @@ int fit_delete_entry(struct fit_table *fit, const size_t idx) { if (!fit) { - ERROR("Internal error."); + ERROR("Internal error.\n"); return 1; } if (idx >= fit_table_entries(fit)) { - ERROR("Index out of range."); + ERROR("Index out of range.\n"); return 1; } From 0870f977c81ad871a8a497ef8ee002214b6f43f7 Mon Sep 17 00:00:00 2001 From: Brian Hsu Date: Tue, 11 Feb 2025 15:34:31 +0800 Subject: [PATCH 0208/3886] mb/google/nissa/var/guren: Add initial override devicetree The schematic is the same as Glassway project and only difference for CPU. Therefore, we clone the coreboot settings of glassway to guren then remove some configurations to meet those keypart/design for guren. BUG=b:397149037 BRANCH=firmware-nissa-15217.B TEST=Local build successfully and boot to OOBE normally. Change-Id: Ia43a78c340426069571172319be1675b3d94eba4 Signed-off-by: Brian Hsu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86602 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Eric Lai --- src/mainboard/google/brya/Kconfig | 9 + .../google/brya/variants/guren/Makefile.mk | 11 + .../google/brya/variants/guren/data.vbt | Bin 0 -> 9216 bytes .../google/brya/variants/guren/fw_config.c | 45 ++ .../google/brya/variants/guren/gpio.c | 120 ++++ .../variants/guren/include/variant/gpio.h | 4 + .../brya/variants/guren/overridetree.cb | 638 +++++++++++++++++- .../google/brya/variants/guren/ramstage.c | 9 + .../google/brya/variants/guren/variant.c | 19 + 9 files changed, 850 insertions(+), 5 deletions(-) create mode 100644 src/mainboard/google/brya/variants/guren/Makefile.mk create mode 100644 src/mainboard/google/brya/variants/guren/data.vbt create mode 100644 src/mainboard/google/brya/variants/guren/fw_config.c create mode 100644 src/mainboard/google/brya/variants/guren/gpio.c create mode 100644 src/mainboard/google/brya/variants/guren/ramstage.c create mode 100644 src/mainboard/google/brya/variants/guren/variant.c diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index 5ab7d5de6c..0cc66243b5 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -297,6 +297,15 @@ config BOARD_GOOGLE_GOTHRAX config BOARD_GOOGLE_GUREN select BOARD_GOOGLE_BASEBOARD_NISSA + select CHROMEOS_WIFI_SAR if CHROMEOS + select DRIVERS_GENERIC_GPIO_KEYS + select DRIVERS_GENESYSLOGIC_GL9750 + select DRIVERS_I2C_SX9324 + select DRIVERS_I2C_SX9324_SUPPORT_LEGACY_LINUX_DRIVER + select EC_GOOGLE_CHROMEEC_INCLUDE_SSFC_IN_FW_CONFIG + select HAVE_WWAN_POWER_SEQUENCE + select INTEL_GMA_HAVE_VBT + select SOC_INTEL_TWINLAKE config BOARD_GOOGLE_HADES select BOARD_GOOGLE_BASEBOARD_HADES diff --git a/src/mainboard/google/brya/variants/guren/Makefile.mk b/src/mainboard/google/brya/variants/guren/Makefile.mk new file mode 100644 index 0000000000..b4698058ab --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/Makefile.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +bootblock-y += gpio.c + +romstage-y += gpio.c + +ramstage-$(CONFIG_FW_CONFIG) += fw_config.c +ramstage-y += gpio.c + +ramstage-y += variant.c + +ramstage-y += ramstage.c diff --git a/src/mainboard/google/brya/variants/guren/data.vbt b/src/mainboard/google/brya/variants/guren/data.vbt new file mode 100644 index 0000000000000000000000000000000000000000..ba47065a880a6a07a4332704ec9131e10d252d8f GIT binary patch literal 9216 zcmeHMUrbw782`?_ZRu)}PH=QM@eCFQIN(w?WQ2rU{<&`aDSt+~%!H1$IwBjDF=fVN z*T@5jF}aC}vc<$|Vq)+?UVOGs2D2A36XSy>ytypCnDFLi{hf15OBqOYo679heD|K7 z?>oQqeZO<=x#!+{XtZO5`+K{(hkE^|y6b`*5+RM$ic%c!myW=|@K~3B#6Q;2JJ5NG z|3>@h*1_NJ5Jecc=MxDWl*Nn9B+@0^;B)pP&kBp(t!m-$fia&-FjXr#W-C4ds-v@s&)qM`($Amm;L zdB{ly)CSd|94hJ*D1#D%!b-3btOP5;3IkLely{i|`(YTj6@A;gp-@%TsP=Q*K38 zN(qW(xyi18_D0HWFOeNRCCJEf6M=|M-%q&}6FH=tndK(ChTE4ZH_-~Rxl>6b+-`1m zqZFE8F=x5^CR|elF=9f9o@V-e05{d;`|8fxT@-~*L9asJfxZX*5c&!93+PwSuc6;U zzk~h+{TcczbWa43iX5m%bzFqFZc_TnNG8{_*sUdZF`dM8SDkHh2V^d%iIN|eERw_e zOVqZW;uh!sgzcGnb)~>XD+Oz8zIbElHtN?{taM}DR(_AZZVT$Rslq%;T|XNgA|&Q^ zUh)h)33N2V@K?CX+z;n{yI8sDv$| zK(O;1vba-5@gOhN+*+q-WyN6PdIW+|&?4u9nB?2fYNgfizSdHwhw3t8p%V6=A_i=k zcfKxabP5|(9QJsy9Tg(8kXu!EZ%=S6ccP62GaPg4-Pp(E@Ax~<~& zV+qocvTu`!`mMn0HAeGk*&RhIkM(r^@pF@0!mS{VHe=Z_u?olqaTCGGWV>WtEWIMi zmDEGFSV)VmJ=b1>K@@|zowT))(>GDo)6A%H;*t*!ieuGnoWwcbbB4P-+Yf(+ ztugC2U;NignUTpZIi$4QvUUL3wq5@3_>jvX_g1?+k9_!f2J#H#8OSq`XCTi&o`F0A z{~`mepDG9FrEwxdG4ZM@OsnkK)Ym=n6_ZH+h={Ais>z@be3|vOR@!dggM&?HUYf_- z>ngk?bI4Q-99KWXyJ`CZ(Fyp1o?&M>~9<9&dm7_rEA|B}x?8^6cF2HNuSe`Vkg DU$Axx literal 0 HcmV?d00001 diff --git a/src/mainboard/google/brya/variants/guren/fw_config.c b/src/mainboard/google/brya/variants/guren/fw_config.c new file mode 100644 index 0000000000..52dff5c3ad --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/fw_config.c @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +static const struct pad_config hdmi_disable_pads[] = { + /* A20 : DDSP_HPD2 ==> NC */ + PAD_NC_LOCK(GPP_A20, NONE, LOCK_CONFIG), + /* E20 : DDP2_CTRLCLK ==> NC */ + PAD_NC_LOCK(GPP_E20, NONE, LOCK_CONFIG), + /* E21 : DDP2_CTRLDATA ==> NC */ + PAD_NC_LOCK(GPP_E21, NONE, LOCK_CONFIG), +}; + +static const struct pad_config lte_disable_pads[] = { + /* A8 : WWAN_RF_DISABLE_ODL */ + PAD_NC(GPP_A8, NONE), + /* D6 : WWAN_EN */ + PAD_NC(GPP_D6, NONE), + /* F12 : WWAN_RST_L */ + PAD_NC_LOCK(GPP_F12, NONE, LOCK_CONFIG), + /* H19 : SOC_I2C_SUB_INT_ODL */ + PAD_NC(GPP_H19, NONE), + /* H23 : WWAN_SAR_DETECT_ODL */ + PAD_NC(GPP_H23, NONE), +}; + +void fw_config_gpio_padbased_override(struct pad_config *padbased_table) +{ + if (!fw_config_probe(FW_CONFIG(DB_USB, DB_HDMI_LTE))) { + printk(BIOS_INFO, "Disable HDMI GPIO pins.\n"); + gpio_padbased_override(padbased_table, hdmi_disable_pads, + ARRAY_SIZE(hdmi_disable_pads)); + } + + /* Set to Disable LTE-related GPIO pins when field DB_USB is not DB_1C_LTE and DB_HDMI_LTE. */ + if (!fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE)) + && !fw_config_probe(FW_CONFIG(DB_USB, DB_HDMI_LTE))) { + printk(BIOS_INFO, "Disable LTE GPIO pins.\n"); + gpio_padbased_override(padbased_table, lte_disable_pads, + ARRAY_SIZE(lte_disable_pads)); + } +} diff --git a/src/mainboard/google/brya/variants/guren/gpio.c b/src/mainboard/google/brya/variants/guren/gpio.c new file mode 100644 index 0000000000..0c462659c9 --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/gpio.c @@ -0,0 +1,120 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include + +/* Pad configuration in ramstage for guren */ +static const struct pad_config override_gpio_table[] = { + /* A8 : WWAN_RF_DISABLE_ODL */ + PAD_CFG_GPO(GPP_A8, 1, DEEP), + /* D3 : ISH_GP3 ==> NC */ + PAD_NC_LOCK(GPP_D3, NONE, LOCK_CONFIG), + /* D6 : WWAN_EN */ + PAD_CFG_GPO(GPP_D6, 1, DEEP), + /* D7 : SRCCLKREQ2# ==> WLAN_CLKREQ_ODL */ + PAD_CFG_NF(GPP_D7, NONE, DEEP, NF1), + /* D15 : ISH_UART0_RTS# ==> NC */ + PAD_NC_LOCK(GPP_D15, NONE, LOCK_CONFIG), + /* D16 : ISH_UART0_CTS# ==> NC */ + PAD_NC_LOCK(GPP_D16, NONE, LOCK_CONFIG), + /* D17 : PCIE SLOT1 WAKE N */ + PAD_NC_LOCK(GPP_D17, NONE, LOCK_CONFIG), + /* E4 : SDD_STRAP1 */ + PAD_CFG_GPI(GPP_E4, NONE, DEEP), + /* E5 : SDD_STRAP2 */ + PAD_CFG_GPI(GPP_E5, NONE, DEEP), + /* F12 : WWAN_RST_L */ + PAD_CFG_GPO_LOCK(GPP_F12, 1, LOCK_CONFIG), + /* F13 : GSXSLOAD ==> NC */ + PAD_NC_LOCK(GPP_F13, NONE, LOCK_CONFIG), + /* F15 : GSXSRESET# ==> NC */ + PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG), + /* H19 : SOC_I2C_SUB_INT_ODL */ + PAD_CFG_GPI_APIC(GPP_H19, NONE, PLTRST, LEVEL, NONE), + /* H22 : IMGCLKOUT3 ==> NC */ + PAD_NC_LOCK(GPP_H22, NONE, LOCK_CONFIG), + /* H23 : WWAN_SAR_DETECT_ODL */ + PAD_CFG_GPO(GPP_H23, 1, DEEP), + /* R4 : I2S2_SCLK ==> DMIC_UCAM_CLK_R */ + PAD_CFG_NF(GPP_R4, NONE, DEEP, NF3), + /* R5 : I2S2_SFRM ==> DMIC_UCAM_DATA_R */ + PAD_CFG_NF(GPP_R5, NONE, DEEP, NF3), + /* R6 : DMIC_CLK_A_1A ==> NC */ + PAD_NC_LOCK(GPP_R6, NONE, LOCK_CONFIG), + + /* Configure the virtual CNVi Bluetooth I2S GPIO pads */ + /* BT_I2S_BCLK */ + PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), + /* BT_I2S_SYNC */ + PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), + /* BT_I2S_SDO */ + PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), + /* BT_I2S_SDI */ + PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), + /* SSP2_SCLK */ + PAD_CFG_NF(GPP_VGPIO_34, NONE, DEEP, NF1), + /* SSP2_SFRM */ + PAD_CFG_NF(GPP_VGPIO_35, NONE, DEEP, NF1), + /* SSP_TXD */ + PAD_CFG_NF(GPP_VGPIO_36, NONE, DEEP, NF1), + /* SSP_RXD */ + PAD_CFG_NF(GPP_VGPIO_37, NONE, DEEP, NF1), +}; + +/* Early pad configuration in bootblock for guren */ +static const struct pad_config early_gpio_table[] = { + /* F12 : GSXDOUT ==> WWAN_RST_L */ + PAD_CFG_GPO(GPP_F12, 0, DEEP), + /* H12 : UART0_RTS# ==> SD_PERST_L */ + PAD_CFG_GPO(GPP_H12, 0, DEEP), + /* A13 : GPP_A13 ==> GSC_SOC_INT_ODL */ + PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT), + /* D6 : SRCCLKREQ1# ==> WWAN_EN */ + PAD_CFG_GPO(GPP_D6, 1, DEEP), + /* E12 : THC0_SPI1_IO1 ==> SOC_WP_OD */ + PAD_CFG_GPI_GPIO_DRIVER(GPP_E12, NONE, DEEP), + /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */ + PAD_CFG_GPI(GPP_F18, NONE, DEEP), + /* H4 : I2C0_SDA ==> SOC_I2C_GSC_SDA */ + PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1), + /* H5 : I2C0_SCL ==> SOC_I2C_GSC_SCL */ + PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1), + /* H10 : UART0_RXD ==> UART_SOC_RX_DBG_TX */ + PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2), + /* H11 : UART0_TXD ==> UART_SOC_TX_DBG_RX */ + PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2), + /* H13 : UART0_CTS# ==> EN_PP3300_SD_X */ + PAD_CFG_GPO(GPP_H13, 1, DEEP), +}; + +static const struct pad_config romstage_gpio_table[] = { + /* Enable touchscreen, hold in reset */ + /* C0 : SMBCLK ==> EN_PP3300_TCHSCR */ + PAD_CFG_GPO(GPP_C0, 1, DEEP), + /* C1 : SMBDATA ==> USI_RST_L */ + PAD_CFG_GPO(GPP_C1, 0, DEEP), + /* C6 : SML1CLK ==> TCHSCR_REPORT_EN */ + PAD_CFG_GPO(GPP_C6, 0, DEEP), + /* H12 : UART0_RTS# ==> SD_PERST_L */ + PAD_CFG_GPO(GPP_H12, 1, DEEP), +}; + +const struct pad_config *variant_gpio_override_table(size_t *num) +{ + *num = ARRAY_SIZE(override_gpio_table); + return override_gpio_table; +} + +const struct pad_config *variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} + + +const struct pad_config *variant_romstage_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(romstage_gpio_table); + return romstage_gpio_table; +} diff --git a/src/mainboard/google/brya/variants/guren/include/variant/gpio.h b/src/mainboard/google/brya/variants/guren/include/variant/gpio.h index c4fe342621..c96b01fc15 100644 --- a/src/mainboard/google/brya/variants/guren/include/variant/gpio.h +++ b/src/mainboard/google/brya/variants/guren/include/variant/gpio.h @@ -5,4 +5,8 @@ #include +#define WWAN_FCPO GPP_D6 +#define WWAN_RST GPP_F12 +#define T2_OFF_MS 20 + #endif diff --git a/src/mainboard/google/brya/variants/guren/overridetree.cb b/src/mainboard/google/brya/variants/guren/overridetree.cb index 4f2c04a57a..95c4b58307 100644 --- a/src/mainboard/google/brya/variants/guren/overridetree.cb +++ b/src/mainboard/google/brya/variants/guren/overridetree.cb @@ -1,6 +1,634 @@ -chip soc/intel/alderlake - - device domain 0 on - end - +fw_config + field THERMAL_SOLUTION 0 + option THERMAL_SOLUTION_PASSIVE 0 + option THERMAL_SOLUTION_ACTIVE 1 + end + field DB_USB 5 8 + option DB_NONE 0 + option DB_1C 1 + option DB_1A 2 + option DB_1C_1A 3 + option DB_1C_LTE 4 + option DB_HDMI_LTE 5 + end + field SD_CARD 9 + option SD_ABSENT 0 + option SD_GL9750S 1 + end + field WIFI_SAR_ID 11 13 + option WIFI_SAR_ID_INTEL_CONVERTIBLE 0 + option WIFI_SAR_ID_INTEL_CLAMSHELL 1 + end + field TOUCHSCREEN_SOURCE 32 34 + option TOUCHSCREEN_UNPROVISIONED 0 + option TOUCHSCREEN_ELAN0001 1 + end +end + +chip soc/intel/alderlake + register "sagv" = "SaGv_Enabled" + + # EMMC Tx CMD Delay + # Refer to EDS-Vol2-42.3.7. + # [14:8] steps of delay for DDR mode, each 125ps, range: 0 - 39. + # [6:0] steps of delay for SDR mode, each 125ps, range: 0 - 39. + register "common_soc_config.emmc_dll.emmc_tx_cmd_cntl" = "0x505" + + # EMMC TX DATA Delay 1 + # Refer to EDS-Vol2-42.3.8. + # [14:8] steps of delay for HS400, each 125ps, range: 0 - 78. + # [6:0] steps of delay for SDR104/HS200, each 125ps, range: 0 - 79. + register "common_soc_config.emmc_dll.emmc_tx_data_cntl1" = "0x909" + + # EMMC TX DATA Delay 2 + # Refer to EDS-Vol2-42.3.9. + # [30:24] steps of delay for SDR50, each 125ps, range: 0 - 79. + # [22:16] steps of delay for DDR50, each 125ps, range: 0 - 78. + # [14:8] steps of delay for SDR25/HS50, each 125ps, range: 0 -79. + # [6:0] steps of delay for SDR12, each 125ps. Range: 0 - 79. + register "common_soc_config.emmc_dll.emmc_tx_data_cntl2" = "0x1C2A2828" + + # EMMC RX CMD/DATA Delay 1 + # Refer to EDS-Vol2-42.3.10. + # [30:24] steps of delay for SDR50, each 125ps, range: 0 - 119. + # [22:16] steps of delay for DDR50, each 125ps, range: 0 - 78. + # [14:8] steps of delay for SDR25/HS50, each 125ps, range: 0 - 119. + # [6:0] steps of delay for SDR12, each 125ps, range: 0 - 119. + register "common_soc_config.emmc_dll.emmc_rx_cmd_data_cntl1" = "0x1C1B4F1B" + + # EMMC RX CMD/DATA Delay 2 + # Refer to EDS-Vol2-42.3.12. + # [17:16] stands for Rx Clock before Output Buffer, + # 00: Rx clock after output buffer, + # 01: Rx clock before output buffer, + # 10: Automatic selection based on working mode. + # 11: Reserved + # [14:8] steps of delay for Auto Tuning Mode, each 125ps, range: 0 - 39. + # [6:0] steps of delay for HS200, each 125ps, range: 0 - 79. + register "common_soc_config.emmc_dll.emmc_rx_cmd_data_cntl2" = "0x10048" + + # EMMC Rx Strobe Delay + # Refer to EDS-Vol2-42.3.11. + # [14:8] Rx Strobe Delay DLL 1(HS400 Mode), each 125ps, range: 0 - 39. + # [6:0] Rx Strobe Delay DLL 2(HS400 Mode), each 125ps, range: 0 - 39. + register "common_soc_config.emmc_dll.emmc_rx_strobe_cntl" = "0x01515" + + # SOC Aux orientation override: + # This is a bitfield that corresponds to up to 4 TCSS ports. + # Bits (0,1) allocated for TCSS Port1 configuration and Bits (2,3)for TCSS Port2. + # TcssAuxOri = 0101b + # Bit0,Bit2 set to "1" indicates no retimer on USBC Ports + # Bit1,Bit3 set to "0" indicates Aux lines are not swapped on the + # motherboard to USBC connector + register "tcss_aux_ori" = "5" + + register "typec_aux_bias_pads[0]" = "{.pad_auxp_dc = GPP_E22, .pad_auxn_dc = GPP_E23}" + register "typec_aux_bias_pads[1]" = "{.pad_auxp_dc = GPP_A21, .pad_auxn_dc = GPP_A22}" + + register "usb2_ports[9]" = "USB2_PORT_MID(OC_SKIP)" # Bluetooth port for CNVi WLAN + + # Configure external V1P05/Vnn/VnnSx Rails + register "ext_fivr_settings" = "{ + .configure_ext_fivr = 1, + .v1p05_enable_bitmap = FIVR_ENABLE_ALL_SX & ~FIVR_ENABLE_S0, + .vnn_enable_bitmap = FIVR_ENABLE_ALL_SX, + .vnn_sx_enable_bitmap = FIVR_ENABLE_ALL_SX, + .v1p05_supported_voltage_bitmap = FIVR_VOLTAGE_NORMAL, + .vnn_supported_voltage_bitmap = FIVR_VOLTAGE_MIN_ACTIVE, + .v1p05_voltage_mv = 1050, + .vnn_voltage_mv = 780, + .vnn_sx_voltage_mv = 1050, + .v1p05_icc_max_ma = 500, + .vnn_icc_max_ma = 500, + }" + + # Enable the Cnvi BT Audio Offload + register "cnvi_bt_audio_offload" = "1" + + # Intel Common SoC Config + #+-------------------+---------------------------+ + #| Field | Value | + #+-------------------+---------------------------+ + #| I2C0 | TPM. Early init is | + #| | required to set up a BAR | + #| | for TPM communication | + #| I2C1 | Touchscreen | + #| I2C2 | Sub-board(PSensor)/WCAM | + #| I2C3 | Audio | + #| I2C5 | Trackpad | + #+-------------------+---------------------------+ + register "common_soc_config" = "{ + .i2c[0] = { + .early_init = 1, + .speed = I2C_SPEED_FAST_PLUS, + .speed_config[0] = { + .speed = I2C_SPEED_FAST_PLUS, + .scl_lcnt = 55, + .scl_hcnt = 30, + .sda_hold = 7, + } + }, + .i2c[1] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 157, + .scl_hcnt = 79, + .sda_hold = 40, + } + }, + .i2c[2] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 157, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + .i2c[3] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 158, + .scl_hcnt = 79, + .sda_hold = 7, + } + }, + .i2c[5] = { + .speed = I2C_SPEED_FAST, + .speed_config[0] = { + .speed = I2C_SPEED_FAST, + .scl_lcnt = 158, + .scl_hcnt = 79, + .sda_hold = 40, + } + }, + }" + + device domain 0 on + device ref dtt on + chip drivers/intel/dptf + ## sensor information + register "options.tsr[0].desc" = ""Memory"" + register "options.tsr[1].desc" = ""Charger"" + register "options.tsr[2].desc" = ""Ambient"" + + # TODO: below values are initial reference values only + ## Passive Policy + register "policies.passive" = "{ + [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 75, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 75, 5000), + [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 75, 5000), + }" + + ## Critical Policy + register "policies.critical" = "{ + [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), + [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 85, SHUTDOWN), + }" + + register "controls.power_limits" = "{ + .pl1 = { + .min_power = 3000, + .max_power = 6000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 200 + }, + .pl2 = { + .min_power = 25000, + .max_power = 25000, + .time_window_min = 1, + .time_window_max = 1, + .granularity = 1000 + } + }" + + ## Charger Performance Control (Control, mA) + register "controls.charger_perf" = "{ + [0] = { 255, 1700 }, + [1] = { 24, 1500 }, + [2] = { 16, 1000 }, + [3] = { 8, 500 } + }" + + device generic 0 on + probe THERMAL_SOLUTION THERMAL_SOLUTION_PASSIVE + end + end + chip drivers/intel/dptf + ## sensor information + register "options.tsr[0].desc" = ""Memory"" + register "options.tsr[1].desc" = ""Charger"" + register "options.tsr[2].desc" = ""Ambient"" + + # TODO: below values are initial reference values only + ## Active Policy + register "policies.active" = "{ + [0] = { + .target = DPTF_CPU, + .thresholds = { + TEMP_PCT(85, 90), + TEMP_PCT(80, 80), + TEMP_PCT(75, 70), + TEMP_PCT(70, 50), + TEMP_PCT(65, 30), + } + }, + [1] = { + .target = DPTF_TEMP_SENSOR_2, + .thresholds = { + TEMP_PCT(50, 90), + TEMP_PCT(48, 70), + TEMP_PCT(46, 60), + TEMP_PCT(43, 40), + TEMP_PCT(40, 30), + } + } + }" + + # TODO: below values are initial reference values only + ## Passive Policy + register "policies.passive" = "{ + [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 75, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 75, 5000), + [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 75, 5000), + }" + + ## Critical Policy + register "policies.critical" = "{ + [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), + [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 85, SHUTDOWN), + }" + + register "controls.power_limits" = "{ + .pl1 = { + .min_power = 12000, + .max_power = 15000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 200 + }, + .pl2 = { + .min_power = 35000, + .max_power = 35000, + .time_window_min = 1, + .time_window_max = 1, + .granularity = 1000 + } + }" + + ## Charger Performance Control (Control, mA) + register "controls.charger_perf" = "{ + [0] = { 255, 1700 }, + [1] = { 24, 1500 }, + [2] = { 16, 1000 }, + [3] = { 8, 500 } + }" + + ## Fan Performance Control (Percent, Speed, Noise, Power) + register "controls.fan_perf" = "{ + [0] = { 100, 6000, 220, 2200, }, + [1] = { 92, 5500, 180, 1800, }, + [2] = { 85, 5000, 145, 1450, }, + [3] = { 70, 4400, 115, 1150, }, + [4] = { 56, 3900, 90, 900, }, + [5] = { 45, 3300, 55, 550, }, + [6] = { 38, 3000, 30, 300, }, + [7] = { 33, 2900, 15, 150, }, + [8] = { 10, 800, 10, 100, }, + [9] = { 0, 0, 0, 50, } + }" + + ## Fan options + register "options.fan.fine_grained_control" = "true" + register "options.fan.step_size" = "2" + + device generic 1 on + probe THERMAL_SOLUTION THERMAL_SOLUTION_ACTIVE + end + end + end + device ref cnvi_wifi on + chip drivers/wifi/generic + register "enable_cnvi_ddr_rfim" = "true" + device generic 0 on end + end + end + device ref i2c1 on + chip drivers/i2c/generic + register "hid" = ""ELAN0001"" + register "desc" = ""ELAN Touchscreen"" + register "irq" = "ACPI_IRQ_LEVEL_LOW(GPP_C7_IRQ)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_C1)" + register "reset_delay_ms" = "20" + register "reset_off_delay_ms" = "4" + register "stop_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_C6)" + register "stop_delay_ms" = "5" + register "stop_off_delay_ms" = "25" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_C0)" + register "enable_delay_ms" = "25" + register "has_power_resource" = "true" + device i2c 10 on + probe TOUCHSCREEN_SOURCE TOUCHSCREEN_ELAN0001 + end + end + + end #I2C1 + device ref i2c2 on + chip drivers/i2c/sx9324 + register "desc" = ""SAR Proximity Sensor"" + register "irq" = "ACPI_IRQ_LEVEL_LOW(GPP_H19_IRQ)" + register "speed" = "I2C_SPEED_FAST" + register "uid" = "1" + register "reg_gnrl_ctrl0" = "0x16" + register "reg_gnrl_ctrl1" = "0x21" + register "reg_afe_ctrl0" = "0x20" + register "reg_afe_ctrl3" = "0x00" + register "reg_afe_ctrl4" = "0x46" + register "reg_afe_ctrl6" = "0x00" + register "reg_afe_ctrl7" = "0x46" + register "reg_afe_ph0" = "0x3d" + register "reg_afe_ph1" = "0x1b" + register "reg_afe_ph2" = "0x1f" + register "reg_afe_ph3" = "0x3d" + register "reg_afe_ctrl8" = "0x12" + register "reg_afe_ctrl9" = "0x08" + register "reg_prox_ctrl0" = "0x0b" + register "reg_prox_ctrl1" = "0x0b" + register "reg_prox_ctrl2" = "0x20" + register "reg_prox_ctrl3" = "0x20" + register "reg_prox_ctrl4" = "0x0c" + register "reg_prox_ctrl5" = "0x00" + register "reg_prox_ctrl6" = "0x20" + register "reg_prox_ctrl7" = "0xc0" + register "reg_adv_ctrl0" = "0x00" + register "reg_adv_ctrl1" = "0x00" + register "reg_adv_ctrl2" = "0x00" + register "reg_adv_ctrl3" = "0x00" + register "reg_adv_ctrl4" = "0x00" + register "reg_adv_ctrl5" = "0x05" + register "reg_adv_ctrl6" = "0x00" + register "reg_adv_ctrl7" = "0x00" + register "reg_adv_ctrl8" = "0x00" + register "reg_adv_ctrl9" = "0x00" + register "reg_adv_ctrl10" = "0x00" + register "reg_adv_ctrl11" = "0x00" + register "reg_adv_ctrl12" = "0x00" + register "reg_adv_ctrl13" = "0x00" + register "reg_adv_ctrl14" = "0x80" + register "reg_adv_ctrl15" = "0x0c" + register "reg_adv_ctrl16" = "0x04" + register "reg_adv_ctrl17" = "0x70" + register "reg_adv_ctrl18" = "0x20" + register "reg_adv_ctrl19" = "0x00" + register "reg_adv_ctrl20" = "0x00" + register "reg_irq_msk" = "0x60" + register "reg_irq_cfg0" = "0x00" + register "reg_irq_cfg1" = "0x80" + register "reg_irq_cfg2" = "0x00" + + register "ph0_pin" = "{1, 3, 3}" + register "ph1_pin" = "{3, 2, 1}" + register "ph2_pin" = "{3, 3, 1}" + register "ph3_pin" = "{1, 3, 3}" + register "ph01_resolution" = "512" + register "ph23_resolution" = "512" + register "startup_sensor" = "1" + register "ph01_proxraw_strength" = "3" + register "ph23_proxraw_strength" = "3" + register "avg_pos_strength" = "256" + register "cs_idle_sleep" = ""gnd"" + register "int_comp_resistor" = ""lowest"" + register "input_precharge_resistor_ohms" = "4000" + register "input_analog_gain" = "1" + device i2c 28 on + probe DB_USB DB_1C_LTE + probe DB_USB DB_HDMI_LTE + end + end + end #I2C2 + device ref i2c3 on + chip drivers/i2c/generic + register "hid" = ""10EC5650"" + register "name" = ""RT58"" + register "desc" = ""Realtek RT5650"" + register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A23)" + register "property_count" = "1" + register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER" + register "property_list[0].name" = ""realtek,jd-mode"" + register "property_list[0].integer" = "2" + device i2c 1a on end + end + end #I2C3 + device ref i2c5 on + chip drivers/i2c/generic + register "hid" = ""ELAN0000"" + register "desc" = ""ELAN Touchpad"" + register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_F14_IRQ)" + register "wake" = "GPE0_DW2_14" + register "detect" = "1" + device i2c 15 on end + end + chip drivers/i2c/hid + register "generic.hid" = ""PNP0C50"" + register "generic.desc" = ""PIXART Touchpad"" + register "generic.irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_F14_IRQ)" + register "generic.wake" = "GPE0_DW2_14" + register "generic.detect" = "1" + register "hid_desc_reg_offset" = "0x20" + device i2c 2c on end + end + end #I2C5 + device ref pcie_rp4 on + # Enable wlan PCIe 4 using clk 2 + register "pch_pcie_rp[PCH_RP(4)]" = "{ + .clk_src = 2, + .clk_req = 2, + .flags = PCIE_RP_LTR | PCIE_RP_AER, + }" + chip drivers/wifi/generic + register "add_acpi_dma_property" = "true" + device pci 00.0 on end + end + end + device ref pcie_rp7 on + # Enable SD Card PCIe 7 using clk 3 + register "pch_pcie_rp[PCH_RP(7)]" = "{ + .clk_src = 3, + .clk_req = 3, + .flags = PCIE_RP_HOTPLUG | PCIE_RP_LTR | PCIE_RP_AER, + }" + chip soc/intel/common/block/pcie/rtd3 + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_H13)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_H12)" + register "srcclk_pin" = "3" + device generic 0 on end + end + probe SD_CARD SD_GL9750S + end + device ref emmc on + probe STORAGE STORAGE_EMMC + end + device ref ish on + chip drivers/intel/ish + register "add_acpi_dma_property" = "true" + device generic 0 on end + end + probe STORAGE STORAGE_UFS + end + device ref ufs on + probe STORAGE STORAGE_UFS + end + device ref pch_espi on + chip ec/google/chromeec + use conn0 as mux_conn[0] + use conn1 as mux_conn[1] + device pnp 0c09.0 on end + end + end + device ref pmc hidden + chip drivers/intel/pmc_mux + device generic 0 on + chip drivers/intel/pmc_mux/conn + use usb2_port1 as usb2_port + use tcss_usb3_port1 as usb3_port + device generic 0 alias conn0 on end + end + chip drivers/intel/pmc_mux/conn + use usb2_port2 as usb2_port + use tcss_usb3_port2 as usb3_port + device generic 1 alias conn1 on + probe DB_USB DB_1C + probe DB_USB DB_1A + probe DB_USB DB_1C_1A + probe DB_USB DB_1C_LTE + end + end + end + end + end + device ref tcss_xhci on + chip drivers/usb/acpi + device ref tcss_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C0 (MLB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(LEFT, LEFT, ACPI_PLD_GROUP(1, 1))" + device ref tcss_usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C1 (DB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, RIGHT, ACPI_PLD_GROUP(2, 1))" + device ref tcss_usb3_port2 on + probe DB_USB DB_1C + probe DB_USB DB_1C_1A + probe DB_USB DB_1C_LTE + end + end + end + end + end + device ref xhci on + chip drivers/usb/acpi + device ref xhci_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C0 (MLB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(LEFT, LEFT, ACPI_PLD_GROUP(1, 1))" + device ref usb2_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C1 (DB)"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_C(RIGHT, RIGHT, ACPI_PLD_GROUP(2, 1))" + device ref usb2_port2 on + probe DB_USB DB_1C + probe DB_USB DB_1C_1A + probe DB_USB DB_1C_LTE + end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A0 (MLB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(LEFT, RIGHT, ACPI_PLD_GROUP(3, 1))" + device ref usb2_port3 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port A1 (DB)"" + register "type" = "UPC_TYPE_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(RIGHT, LEFT, ACPI_PLD_GROUP(4, 1))" + device ref usb2_port4 on + probe DB_USB DB_1A + probe DB_USB DB_1C_1A + end + end + chip drivers/usb/acpi + register "desc" = ""USB2 WWAN"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port4 on + probe DB_USB DB_1C_LTE + probe DB_USB DB_HDMI_LTE + end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Camera"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port6 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Camera"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb2_port7 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + register "reset_gpio" = + "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)" + device ref usb2_port8 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A0 (MLB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(LEFT, RIGHT, ACPI_PLD_GROUP(3, 1))" + device ref usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port A1 (DB)"" + register "type" = "UPC_TYPE_USB3_A" + register "use_custom_pld" = "true" + register "custom_pld" = "ACPI_PLD_TYPE_A(RIGHT, LEFT, ACPI_PLD_GROUP(4, 1))" + device ref usb3_port2 on + probe DB_USB DB_1A + probe DB_USB DB_1C_1A + end + end + chip drivers/usb/acpi + register "desc" = ""USB3 WWAN"" + register "type" = "UPC_TYPE_INTERNAL" + device ref usb3_port2 on + probe DB_USB DB_1C_LTE + probe DB_USB DB_HDMI_LTE + end + end + end + end + end + end end diff --git a/src/mainboard/google/brya/variants/guren/ramstage.c b/src/mainboard/google/brya/variants/guren/ramstage.c new file mode 100644 index 0000000000..6d63eaa8f7 --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/ramstage.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include + +void mainboard_silicon_init_params(FSP_S_CONFIG *params) +{ + params->VccInAuxImonIccImax = 100; // 25 * 4 for ADL-N + printk(BIOS_INFO, "Override VccInAuxImonIccImax = %d\n", params->VccInAuxImonIccImax); +} diff --git a/src/mainboard/google/brya/variants/guren/variant.c b/src/mainboard/google/brya/variants/guren/variant.c new file mode 100644 index 0000000000..ff71b6415e --- /dev/null +++ b/src/mainboard/google/brya/variants/guren/variant.c @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +const char *get_wifi_sar_cbfs_filename(void) +{ + return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_SAR_ID)); +} + +void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config) +{ + if (fw_config_probe(FW_CONFIG(DB_USB, DB_HDMI_LTE))) { + printk(BIOS_INFO, "Enable DDI PORT 2 for HPD and DDC.\n"); + config->ddi_ports_config[DDI_PORT_2] = DDI_ENABLE_HPD | DDI_ENABLE_DDC; + } +} From f7ca6600adbeb8a31c07d05b24940958c91cce38 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 27 Feb 2025 19:41:29 +0000 Subject: [PATCH 0209/3886] mb/starlabs/starbook/mtl: Set the MMIO Size to 3GiB This is required when using 96GB of memory. Change-Id: I3a2a3e737eeb9282a4edf09eb0a24019ceeb016e Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86623 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/starbook/variants/mtl/romstage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c index 7d9b9ae4fd..addcae5915 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/romstage.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/romstage.c @@ -44,4 +44,5 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) mupd->FspmConfig.PcieRpEnableMask &= ~(1 << 8); mupd->FspmConfig.PchHdaSubSystemIds = 0x70381e50; + mupd->FspmConfig.MmioSize = 0xb00; }; From f2d91575ac003c902968ef2c214dac8b00f06e61 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 13 Feb 2025 09:21:58 +0000 Subject: [PATCH 0210/3886] drivers/wifi/generic: Add Methods to control CNVi enable GPIO Add two new methods, CNVS and CNVC, that can check and control the enable GPIO for a CNVi module. These will be used by the common code for WiFi SW RF Kill (Low Power Mode). Change-Id: I09d0011ede6f739511a61daf2f1b317f6500a343 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86402 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/drivers/wifi/generic/acpi.c | 60 +++++++++++++++++++++++++++++++++ src/drivers/wifi/generic/chip.h | 10 ++++++ 2 files changed, 70 insertions(+) diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 7820987eca..8cab106d36 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -1181,6 +1181,60 @@ const char *wifi_pcie_acpi_name(const struct device *dev) return wifi_acpi_name; } +#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI) +static void write_cnvi_control(const struct acpi_gpio *gpio) +{ + + acpigen_write_scope("\\_SB.PCI0"); + +/* + * CNVi Status + * + * Method (CNVS, 0) + * { + * Local0 = \_SB.PCI0.GTXS (gpio) + * Return (Local0) + * } + */ + acpigen_write_method("CNVS", 0); + { + acpigen_get_tx_gpio(gpio); + acpigen_write_return_op(LOCAL0_OP); + } + acpigen_pop_len(); +/* + * CNVi Control + * + * Method (CNVC, 1, NotSerialized) + * { + * If ((Arg0 == One)) + * { + * \_SB.PCI0.STXS (gpio) + * } + * Else + * { + * \_SB.PCI0.CTXS (gpio) + * } + * } + */ + acpigen_write_method("CNVC", 1); + { + acpigen_write_if_lequal_op_int(ARG0_OP, 1); + { + acpigen_enable_tx_gpio(gpio); + } + acpigen_write_else(); + { + acpigen_disable_tx_gpio(gpio); + } + acpigen_pop_len(); + } + acpigen_pop_len(); + + acpigen_write_scope_end(); +} +#endif + void wifi_cnvi_fill_ssdt(const struct device *dev) { const char *path; @@ -1192,4 +1246,10 @@ void wifi_cnvi_fill_ssdt(const struct device *dev) return; wifi_ssdt_write_properties(dev, path); + +#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI) + const struct drivers_wifi_generic_config *config = dev->chip_info; + if (config->cnvi_enable_gpio.pin_count) + write_cnvi_control(&config->cnvi_enable_gpio); +#endif } diff --git a/src/drivers/wifi/generic/chip.h b/src/drivers/wifi/generic/chip.h index 302dd144ef..f6a68e2068 100644 --- a/src/drivers/wifi/generic/chip.h +++ b/src/drivers/wifi/generic/chip.h @@ -3,6 +3,8 @@ #ifndef _WIFI_GENERIC_H_ #define _WIFI_GENERIC_H_ +#include + /** * struct drivers_wifi_generic_config - Data structure to contain generic wifi config * @wake: Wake pin for ACPI _PRW @@ -20,6 +22,14 @@ struct drivers_wifi_generic_config { */ bool enable_cnvi_ddr_rfim; +#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI) + /* + * Enable GPIO for CNVi that will be used for WiFi SW RF Kill (Low + * Power Mode). + */ + struct acpi_gpio cnvi_enable_gpio; +#endif + /* Pointer to the Bluetooth companion device */ DEVTREE_CONST struct device *bluetooth_companion; }; From def337aa7ec6fb1d4c4f668fa5884cf17cb45efb Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 13 Feb 2025 09:27:19 +0000 Subject: [PATCH 0211/3886] soc/intel/common: Add support for WiFi SW RF Kill on CNVi Hook CNVC and CNVS Methods into the power resource for the CNVi which is provided via the `wifi/generic` driver to allow for WiFi SW RF Kill (low power mode) support. Add corresponding _PS3 and _PS0 Methods, change the power resource to S0 from S5, and rename the power resource from WRST to CNVP for better relevance. Test=boot `starlabs/starlite_adl`, disconnect wireless and verify with inteltool that the WIFI_RF_KILL GPIO is asserted. Change-Id: I22292ad97c439e50fe5d7a6b79f77847e71ca62c Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86403 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/cnvi/cnvi.c | 119 ++++++++++++++++++++----- 1 file changed, 98 insertions(+), 21 deletions(-) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index a4263af646..e0a9566b1f 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -92,17 +92,30 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_write_name_integer("RSTT", 0); /* - * PowerResource(WRST, 5, 0) + * PowerResource(CNVP, 0, 0) * { * Method(_STA) * { - * Return (0x01) + * If (CondRefOf (\_SB.PCI0.CNVS)) { + * Local0 = \_SB.PCI0.CNVS() + * Return (Local0) + * } + * Else + * { + * Return (0x01) + * } * } * Method(_ON, 0) * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(1) + * } * } * Method(_OFF, 0) * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(0) + * } * } * Method(_RST, 0, NotSerialized) * { @@ -150,18 +163,46 @@ static void cnvw_fill_ssdt(const struct device *dev) * } * */ - acpigen_write_power_res("WRST", 5, 0, NULL, 0); + acpigen_write_power_res("CNVP", 0, 0, NULL, 0); { acpigen_write_method("_STA", 0); { - acpigen_write_return_integer(1); + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVS"); + { + acpigen_write_store(); + acpigen_emit_namestring("\\_SB.PCI0.CNVS"); + acpigen_emit_byte(LOCAL0_OP); + + acpigen_write_return_op(LOCAL0_OP); + } + acpigen_write_else(); + { + acpigen_write_return_integer(1); + } + acpigen_pop_len(); } acpigen_pop_len(); acpigen_write_method("_ON", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(1); + } + acpigen_pop_len(); + } acpigen_pop_len(); acpigen_write_method("_OFF", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(0); + } + acpigen_pop_len(); + } acpigen_pop_len(); acpigen_write_method("_RST", 0); @@ -266,13 +307,64 @@ static void cnvw_fill_ssdt(const struct device *dev) /* * Name (_PRR, Package (0x01) * { - * WRST + * CNVP * }) */ acpigen_write_name("_PRR"); { acpigen_write_package(1); - acpigen_emit_namestring("WRST"); + acpigen_emit_namestring("CNVP"); + } + acpigen_pop_len(); + +/* + * Name (_PR0, Package (0x01) + * { + * CNVP + * }) + */ + acpigen_write_name("_PR0"); + { + acpigen_write_package(1); + acpigen_emit_namestring("CNVP"); + } + acpigen_pop_len(); + +/* + * Method (_PS0, 0, NotSerialized) + * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(1) + * } + * } + */ + acpigen_write_method("_PS0", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(1); + } + acpigen_pop_len(); + } + acpigen_pop_len(); + +/* + * Method (_PS3, 0, NotSerialized) + * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(0) + * } + * } + */ + acpigen_write_method("_PS3", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(0); + } + acpigen_pop_len(); } acpigen_pop_len(); @@ -305,21 +397,6 @@ static void cnvw_fill_ssdt(const struct device *dev) } acpigen_pop_len(); -/* - * Method (_PS0, 0, Serialized) - * { - * } - * - * Method (_PS3, 0, Serialized) - * { - * } - */ - acpigen_write_method_serialized("_PS0", 0); - acpigen_pop_len(); - - acpigen_write_method_serialized("_PS3", 0); - acpigen_pop_len(); - /* * Method (CFLR, 0, NotSerialized) * { From 0476770659485ad42a91a1975eac15fb7bee559a Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Sat, 15 Feb 2025 19:45:22 +0000 Subject: [PATCH 0212/3886] soc/intel/cnvi: Deref BTRK as it might not exist Check for the existence of BTRK method before attempting to call it, as coreboot doesn't enforce its creation. Change-Id: Ibb0dace635c6a014ce65ae3d1c96a92ff991ce5b Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86450 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/cnvi/cnvi.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index e0a9566b1f..f0821973f2 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -129,11 +129,13 @@ static void cnvw_fill_ssdt(const struct device *dev) * If (((PCRR (CNVI_SIDEBAND_ID, CNVI_ABORT_PLDR) & CNVI_ABORT_REQUEST) == Zero)) * { * Local2 = Zero - * If ((\_SB.PCI0.GBTR() == One)) - * { - * \_SB.PCI0.BTRK (Zero) - * Sleep (105) - * Local2 = One + * If (CondRefOf (\_SB.PCI0.GBTR)) { + * If ((\_SB.PCI0.GBTR() == One)) + * { + * \_SB.PCI0.BTRK (Zero) + * Sleep (105) + * Local2 = One + * } * } * PCRO (CNVI_SIDEBAND_ID, CNVI_ABORT_PLDR, CNVI_ABORT_REQUEST | CNVI_ABORT_ENABLE) * Sleep (10) @@ -233,14 +235,18 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_write_if_lequal_op_int(LOCAL0_OP, 0); { acpigen_write_store_int_to_op(0, LOCAL2_OP); - acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.GBTR", 1); + acpigen_write_if_cond_ref_of("\\_SB.PCI0.GBTR"); { - acpigen_emit_namestring("\\_SB.PCI0.BTRK"); - acpigen_emit_byte(0); + acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.GBTR", 1); + { + acpigen_emit_namestring("\\_SB.PCI0.BTRK"); + acpigen_emit_byte(0); - acpigen_write_sleep(105); + acpigen_write_sleep(105); - acpigen_write_store_ops(1, LOCAL2_OP); + acpigen_write_store_ops(1, LOCAL2_OP); + } + acpigen_pop_len(); } acpigen_pop_len(); From e4832dce9398525c3f6b08c3cee61531d877541f Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Fri, 14 Feb 2025 20:09:03 +0000 Subject: [PATCH 0213/3886] mb/starlabs/{byte_adl,starlite_adl}: Enable SW RF Kill for CNVi Specify an enable GPIO for CNVi wireless so that the driver will add support for WiFi SW RF Kill. Test=boot starlite_adl/byte_adl, and use acpi_call dkms to check that _OFF and _ON Methods in the power resource successfully disable the wireless. Change-Id: Ib172230f2c9e926870e35f040ce1b80628561863 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86428 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb | 1 + src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb b/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb index bbedc9657a..df79411fa2 100644 --- a/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb +++ b/src/mainboard/starlabs/byte_adl/variants/mk_ii/devicetree.cb @@ -133,6 +133,7 @@ chip soc/intel/alderlake device ref cnvi_wifi on chip drivers/wifi/generic register "add_acpi_dma_property" = "true" + register "cnvi_enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E3)" register "enable_cnvi_ddr_rfim" = "true" device generic 0 on end end diff --git a/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb b/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb index 5b8bd2c2d0..247c5bcaa7 100644 --- a/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb +++ b/src/mainboard/starlabs/starlite_adl/variants/mk_v/devicetree.cb @@ -119,6 +119,7 @@ chip soc/intel/alderlake device ref cnvi_wifi on chip drivers/wifi/generic register "add_acpi_dma_property" = "true" + register "cnvi_enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E3)" register "enable_cnvi_ddr_rfim" = "true" device generic 0 on end end From aab800b1a405745ef4216e48df8c8b8ec7b8b67d Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 17 Feb 2025 16:55:36 +0000 Subject: [PATCH 0214/3886] soc/intel/cnvi: Increase the reset delay to 160ms from 105ms The Intel reference code for Thunder Peak increase the reset delay to 160ms from 105ms seen on Jefferson Peak, Cyclone Peak and others. For the sake of 110ms, use 160ms to cover all use cases. Change-Id: I19c1bf7eeffa340e2564381a184ebfaca89bf364 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86489 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/cnvi/cnvi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index f0821973f2..e23ada8d8a 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -133,7 +133,7 @@ static void cnvw_fill_ssdt(const struct device *dev) * If ((\_SB.PCI0.GBTR() == One)) * { * \_SB.PCI0.BTRK (Zero) - * Sleep (105) + * Sleep (160 * Local2 = One * } * } @@ -146,7 +146,7 @@ static void cnvw_fill_ssdt(const struct device *dev) * If ((Local2 == One)) * { * \_SB.PCI0.BTRK (One) - * Sleep (105) + * Sleep (160) * } * } * Else @@ -242,7 +242,7 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_emit_namestring("\\_SB.PCI0.BTRK"); acpigen_emit_byte(0); - acpigen_write_sleep(105); + acpigen_write_sleep(160); acpigen_write_store_ops(1, LOCAL2_OP); } @@ -283,7 +283,7 @@ static void cnvw_fill_ssdt(const struct device *dev) { acpigen_emit_namestring("\\_SB.PCI0.BTRK"); acpigen_emit_byte(1); - acpigen_write_sleep(105); + acpigen_write_sleep(160); } acpigen_pop_len(); } From 9f351c76a343942b1f07c7ad577360c3db48c665 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 13 Feb 2025 09:13:06 +0000 Subject: [PATCH 0215/3886] drivers/usb/acpi: Account for GPIO polarity Whilst the GPIO's used for Intel Bluetooth should always be consistent as to whether they're active high or active low, adjust the driver to pass the GPIO as a pointer, so that it can correctly account for polarity. Change-Id: Ib481d49d536b702fef149af882209501c61de6da Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86400 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/drivers/usb/acpi/chip.h | 9 ++--- src/drivers/usb/acpi/intel_bluetooth.c | 47 ++++++++++++++++---------- src/drivers/usb/acpi/usb_acpi.c | 8 ++--- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/src/drivers/usb/acpi/chip.h b/src/drivers/usb/acpi/chip.h index f5edba4f58..434d856d12 100644 --- a/src/drivers/usb/acpi/chip.h +++ b/src/drivers/usb/acpi/chip.h @@ -88,10 +88,11 @@ struct drivers_usb_acpi_config { bool usb_acpi_get_pld(const struct device *usb_device, struct acpi_pld *pld); /* Intel Bluetooth */ -void acpi_device_intel_bt(unsigned int reset_gpio, - unsigned int enable_gpio, +void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, + const struct acpi_gpio *reset_gpio, bool audio_offload); -void acpi_device_intel_bt_common(unsigned int enable_gpio, - unsigned int reset_gpio); + +void acpi_device_intel_bt_common(const struct acpi_gpio *enable_gpio, + const struct acpi_gpio *reset_gpio); #endif /* __USB_ACPI_CHIP_H__ */ diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index a979b42ebf..151930fc4a 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -44,7 +44,9 @@ static void not_supported(void *arg) void (*reset_supported[])(void *) = { check_reset_delay, set_reset_delay }; void (*reset_unsupported[])(void *) = { not_supported }; -void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, bool audio_offload) +void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, + const struct acpi_gpio *reset_gpio, + bool audio_offload) { /* * Name (RDLY, 0x69) @@ -91,8 +93,10 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo struct dsm_uuid uuid_callbacks[] = { DSM_UUID("aa10f4e0-81ac-4233-abf6-3b2ac50e28d9", - reset_gpio ? reset_supported : reset_unsupported, - reset_gpio ? ARRAY_SIZE(reset_supported) : ARRAY_SIZE(reset_unsupported), + reset_gpio->pin_count ? + reset_supported : reset_unsupported, + reset_gpio->pin_count ? + ARRAY_SIZE(reset_supported) : ARRAY_SIZE(reset_unsupported), NULL), }; @@ -130,7 +134,7 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo { acpigen_write_method("_STA", 0); { - if (enable_gpio) { + if (enable_gpio->pin_count) { acpigen_write_store(); acpigen_emit_namestring("\\_SB.PCI0.GBTE"); acpigen_emit_byte(LOCAL0_OP); @@ -144,7 +148,7 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo acpigen_write_method("_ON", 0); { - if (enable_gpio) { + if (enable_gpio->pin_count) { acpigen_emit_namestring("\\_SB.PCI0.SBTE"); acpigen_emit_byte(1); } @@ -153,7 +157,7 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo acpigen_write_method("_OFF", 0); { - if (enable_gpio) { + if (enable_gpio->pin_count) { acpigen_emit_namestring("\\_SB.PCI0.SBTE"); acpigen_emit_byte(0); } @@ -162,7 +166,7 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo acpigen_write_method("_RST", 0); { - if (reset_gpio) { + if (reset_gpio->pin_count) { acpigen_write_store(); acpigen_write_acquire("\\_SB.PCI0.CNMT", 1000); acpigen_emit_byte(LOCAL0_OP); @@ -258,7 +262,8 @@ void acpi_device_intel_bt(unsigned int reset_gpio, unsigned int enable_gpio, boo acpigen_pop_len(); } -void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gpio) +void acpi_device_intel_bt_common(const struct acpi_gpio *enable_gpio, + const struct acpi_gpio *reset_gpio) { acpigen_write_scope("\\_SB.PCI0"); /* @@ -279,14 +284,14 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp */ acpigen_write_method("SBTE", 1); { - if (enable_gpio) { + if (enable_gpio->pin_count) { acpigen_write_if_lequal_op_int(ARG0_OP, 1); { - acpigen_soc_set_tx_gpio(enable_gpio); + acpigen_enable_tx_gpio(enable_gpio); } acpigen_write_else(); { - acpigen_soc_clear_tx_gpio(enable_gpio); + acpigen_disable_tx_gpio(enable_gpio); } acpigen_pop_len(); } @@ -301,8 +306,8 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp */ acpigen_write_method("GBTE", 0); { - if (enable_gpio) { - acpigen_soc_get_tx_gpio(enable_gpio); + if (enable_gpio->pin_count) { + acpigen_get_tx_gpio(enable_gpio); acpigen_write_return_op(LOCAL0_OP); } else { acpigen_write_return_integer(0); @@ -325,11 +330,13 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp { acpigen_write_if_lequal_op_int(ARG0_OP, 1); { - acpigen_soc_set_tx_gpio(reset_gpio); + /* De-assert reset */ + acpigen_disable_tx_gpio(reset_gpio); } acpigen_write_else(); { - acpigen_soc_clear_tx_gpio(reset_gpio); + /* Assert Reset */ + acpigen_enable_tx_gpio(reset_gpio); } acpigen_pop_len(); } @@ -338,13 +345,17 @@ void acpi_device_intel_bt_common(unsigned int enable_gpio, unsigned int reset_gp /* * Method (GBTR, 0, NotSerialized) * { - * Return (GTXS (reset_gpio)) + * Local0 = GTXS (reset_gpio) + * Local0 ^= One + * Return (Local0) * } */ acpigen_write_method("GBTR", 0); { - if (reset_gpio) { - acpigen_soc_get_tx_gpio(reset_gpio); + if (reset_gpio->pin_count) { + /* Return 1 if not in reset */ + acpigen_get_tx_gpio(reset_gpio); + acpigen_write_xor(LOCAL0_OP, 1, LOCAL0_OP); acpigen_write_return_op(LOCAL0_OP); } else { acpigen_write_return_op(0); diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c index a920fa1e58..8173c06960 100644 --- a/src/drivers/usb/acpi/usb_acpi.c +++ b/src/drivers/usb/acpi/usb_acpi.c @@ -111,8 +111,8 @@ static void usb_acpi_fill_ssdt_generator(const struct device *dev) } if (config->is_intel_bluetooth) - acpi_device_intel_bt(config->reset_gpio.pins[0], - config->enable_gpio.pins[0], + acpi_device_intel_bt(&config->enable_gpio, + &config->reset_gpio, config->cnvi_bt_audio_offload); acpigen_pop_len(); @@ -122,8 +122,8 @@ static void usb_acpi_fill_ssdt_generator(const struct device *dev) * other code to access it i.e. CNVi driver. */ if (config->is_intel_bluetooth) - acpi_device_intel_bt_common(config->enable_gpio.pins[0], - config->reset_gpio.pins[0]); + acpi_device_intel_bt_common(&config->enable_gpio, + &config->reset_gpio); printk(BIOS_INFO, "%s: %s at %s\n", path, config->desc ? : dev->chip_ops->name, dev_path(dev)); From 970d983083bd0a370357c6fe5d44ac6c7be8c84c Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 13 Feb 2025 09:14:47 +0000 Subject: [PATCH 0216/3886] drivers/usb/intel_bluetooth: Guard BTRK if no GPIO passed Don't attempt any GPIO operations of there isn't a reset GPIO specified. Change-Id: I9c97963e61f790f2d9c55d8ec1a384a5779782b4 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86401 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/drivers/usb/acpi/intel_bluetooth.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 151930fc4a..6307dcb35d 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -328,17 +328,19 @@ void acpi_device_intel_bt_common(const struct acpi_gpio *enable_gpio, */ acpigen_write_method("BTRK", 1); { - acpigen_write_if_lequal_op_int(ARG0_OP, 1); - { - /* De-assert reset */ - acpigen_disable_tx_gpio(reset_gpio); + if (reset_gpio->pin_count) { + acpigen_write_if_lequal_op_int(ARG0_OP, 1); + { + /* De-assert reset */ + acpigen_disable_tx_gpio(reset_gpio); + } + acpigen_write_else(); + { + /* Assert Reset */ + acpigen_enable_tx_gpio(reset_gpio); + } + acpigen_pop_len(); } - acpigen_write_else(); - { - /* Assert Reset */ - acpigen_enable_tx_gpio(reset_gpio); - } - acpigen_pop_len(); } acpigen_pop_len(); From c166b6d95c0eff3d922fab682866b7a41520bb0e Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 25 Feb 2025 09:52:08 +0000 Subject: [PATCH 0217/3886] drivers/usb/intel-bluetooth: Remove the _PR3 Object _PR3 should return resources required for the device to be in D3Hot for which the Intel Bluetooth needs none, so remove it. Change-Id: I65f206899affd46d791c2ba39235a1af320395d2 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86595 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/drivers/usb/acpi/intel_bluetooth.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 6307dcb35d..5ed42c8f2f 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -220,19 +220,6 @@ void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, } acpigen_pop_len(); -/* - * Name (_PR3, Package (0x01) - * { - * BTRT - * }) - */ - acpigen_write_name("_PR3"); - { - acpigen_write_package(1); - acpigen_emit_namestring("BTRT"); - } - acpigen_pop_len(); - /* * Method (AOLD, 0, NotSerialized) * { From b6c2d01d011462206ca29c532dbbcc2b5afcf8dd Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 18 Feb 2025 21:28:00 +0000 Subject: [PATCH 0218/3886] driver/usb/intel_bluetooth: Add PS0 and PS3 methods Add PS0 and PS3 methods that return the Bluetooth power resource. This allows the OS to turn on or off the device. This fixes and issue where the Bluetooth reported a power failure in device manager. Change-Id: I0e37fc0369b1dc2b166f851daa183b145a09eb32 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86507 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/drivers/usb/acpi/intel_bluetooth.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 5ed42c8f2f..97fb4816f8 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -220,6 +220,32 @@ void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, } acpigen_pop_len(); +/* + * Method (_PS0, 0, NotSerialized) + * { + * \_SB.PCI0.SBTE(1) + * } + */ + acpigen_write_method("_PS0", 0); + { + acpigen_emit_namestring("\\_SB.PCI0.SBTE"); + acpigen_emit_byte(1); + } + acpigen_pop_len(); + +/* + * Name (_PS3, Package (0x01) + * { + * \_SB.PCI0.SBTE(0) + * } + */ + acpigen_write_method("_PS3", 0); + { + acpigen_emit_namestring("\\_SB.PCI0.SBTE"); + acpigen_emit_byte(0); + } + acpigen_pop_len(); + /* * Method (AOLD, 0, NotSerialized) * { From 1633ae8378e1afeee2061f6885ddeb8d47dc9981 Mon Sep 17 00:00:00 2001 From: Zhaoqing Jiu Date: Thu, 20 Feb 2025 15:37:47 +0800 Subject: [PATCH 0219/3886] soc/mediatek/mt8196: Adjust thermal trip point parameters Adjust thermal trip point parameters so the thermal can trigger the interrupt at the expected trip point. BRANCH=rauru BUG=b:389026545 TEST=Boot up and check temperature in coreboot log: [INFO ] [LVTS_MSR] ts0 msr_all=141d0, msr_temp=16848, temp=41086 [INFO ] lvts_tscpu_thermal_read_tc_temp order 0 ts_name 0 temp 41086 rg_temp 41073(42059) [INFO ] [LVTS_MSR] ts1 msr_all=141e3, msr_temp=16867, temp=41540 [INFO ] lvts_tscpu_thermal_read_tc_temp order 1 ts_name 1 temp 41540 rg_temp 41526(42523) [INFO ] [LVTS_MSR] ts2 msr_all=14199, msr_temp=16793, temp=39772[0m [INFO ] lvts_tscpu_thermal_read_tc_temp order 2 ts_name 2 temp 39772 rg_temp 39760(40715) [INFO ] [LVTS_MSR] ts3 msr_all=141c2, msr_temp=16834, temp=40751 [INFO ] lvts_tscpu_thermal_read_tc_temp order 3 ts_name 3 temp 40751 rg_temp 40739(41717) [INFO ] [LVTS_MSR] ts4 msr_all=141d0, msr_temp=16848, temp=41086 [INFO ] lvts_tscpu_thermal_read_tc_temp order 0 ts_name 4 temp 41086 rg_temp 41073(42059) [INFO ] [LVTS_MSR] ts5 msr_all=141b3, msr_temp=16819, temp=40393 [INFO ] lvts_tscpu_thermal_read_tc_temp order 1 ts_name 5 temp 40393 rg_temp 40380(41350) [INFO ] [LVTS_MSR] ts6 msr_all=14194, msr_temp=16788, temp=39652 [INFO ] lvts_tscpu_thermal_read_tc_temp order 2 ts_name 6 temp 39652 rg_temp 39641(40593) [INFO ] [LVTS_MSR] ts7 msr_all=14186, msr_temp=16774, temp=39318 [INFO ] lvts_tscpu_thermal_read_tc_temp order 3 ts_name 7 temp 39318 rg_temp 39307(40251) Signed-off-by: Zhaoqing Jiu Change-Id: Ia7361edd7f75b82fff4241ec94488ed1ef07346f Reviewed-on: https://review.coreboot.org/c/coreboot/+/86552 Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8196/include/soc/thermal_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/mt8196/include/soc/thermal_internal.h b/src/soc/mediatek/mt8196/include/soc/thermal_internal.h index b5841178c2..55c300d7e1 100644 --- a/src/soc/mediatek/mt8196/include/soc/thermal_internal.h +++ b/src/soc/mediatek/mt8196/include/soc/thermal_internal.h @@ -171,8 +171,8 @@ check_member(mtk_thermal_controller_regs, lvtsspare, 0x0f0); #define AP_RST_SET (INFRACFG_AO_SEC_BASE + 0xf30) #define AP_RST_CLR (INFRACFG_AO_SEC_BASE + 0xf34) -#define LVTS_COF_T_SLP_GLD 358830 -#define LVTS_COF_COUNT_R_GLD 34389 +#define LVTS_COF_T_SLP_GLD 391460 +#define LVTS_COF_COUNT_R_GLD 34412 #define LVTS_COF_T_CONST_OFS 0 #define DEFAULT_EFUSE_GOLDEN_TEMP 60 From 3ef23c9a881fee5a6a639eabfb85d98b4d7776d5 Mon Sep 17 00:00:00 2001 From: Cliff Huang Date: Thu, 13 Feb 2025 22:58:54 -0800 Subject: [PATCH 0220/3886] soc/intel/common/gpio: Add macro for interrupt GPI with driver mode Adds PAD_CFG_GPI_APIC_DRIVER macros to configure interrupt pad with driver mode. This is needed when a PAD is configured as an interrupt such that the corresponding GPI_IS status bit can be updated by the host controller hardware. BUG=none TEST=Check a GPIO pad that is used as interrupt via GpioInt in the ACPI device _CRS method and check the interrupt has been assigned in /proc/interrupts. Signed-off-by: Cliff Huang Change-Id: Ibc1ed3089c24302bc7eb02318714b8ec464fad01 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86414 Reviewed-by: Wonkyu Kim Reviewed-by: Kyoung Il Kim Reviewed-by: Bora Guvendik Tested-by: build bot (Jenkins) --- .../intel/common/block/include/intelblocks/gpio_defs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h index f0ff08c492..bcf8e73f7e 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h @@ -436,6 +436,14 @@ PAD_IRQ_CFG(IOAPIC, trig, inv), PAD_PULL(pull) | \ PAD_IOSSTATE(TxDRxE)) +/* General purpose input, routed to APIC, HostOwn */ +#define PAD_CFG_GPI_APIC_DRIVER(pad, pull, rst, trig, inv) \ + _PAD_CFG_STRUCT(pad, \ + PAD_FUNC(GPIO) | PAD_RESET(rst) | PAD_BUF(TX_DISABLE) | \ + PAD_IRQ_CFG(IOAPIC, trig, inv), PAD_PULL(pull) | \ + PAD_IOSSTATE(TxDRxE) | \ + PAD_CFG_OWN_GPIO(DRIVER)) + /* General purpose input with lock, routed to APIC */ #define PAD_CFG_GPI_APIC_LOCK(pad, pull, trig, inv, lock_action) \ _PAD_CFG_STRUCT_LOCK(pad, \ From 0ac29ad3ce7340c462d9580aafc6f965a3014137 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Thu, 12 Sep 2024 17:36:13 -0700 Subject: [PATCH 0221/3886] device/dram/ddr5: Add 7500 MT/s support Before I got the following error: [ERROR] DDR5 speed of 3750 MHz is out of range tested: glinda based mainboard Change-Id: I141f63c4fc505a9e16eed132a9a550441f4ad68d Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/86543 Reviewed-by: Paul Menzel Reviewed-by: Alicja Michalska Reviewed-by: Andy Ebrahiem Reviewed-by: Marvin Drees Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Naresh Solanki --- src/device/dram/ddr5.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/device/dram/ddr5.c b/src/device/dram/ddr5.c index b546abf4d4..90b67f857b 100644 --- a/src/device/dram/ddr5.c +++ b/src/device/dram/ddr5.c @@ -21,6 +21,7 @@ enum ddr5_speed_grade { DDR5_5500, DDR5_6000, DDR5_6400, + DDR5_7500, }; struct ddr5_speed_attr { @@ -108,6 +109,11 @@ static const struct ddr5_speed_attr ddr5_speeds[] = { .max_clock_mhz = 3200, .reported_mts = 6400 }, + [DDR5_7500] = { + .min_clock_mhz = 3201, + .max_clock_mhz = 3750, + .reported_mts = 7500 + }, }; /** From f1fbcf76479851e61d84a9e888585161c8902cb9 Mon Sep 17 00:00:00 2001 From: John Su Date: Wed, 19 Feb 2025 23:17:25 +0800 Subject: [PATCH 0222/3886] mb/trulo/var/uldrenite: Fix boot time caused by WWAN initialization The previous approach would increase the delay time by 50 ms. So move WWAN power sequence to GPIO control to reduce boot time caused by WWAN initialization. Additionally, add a 150ms delay to T0_OFF_MS before powering off the WWAN. This ensures that the WWAN Power OFF Sequence operates correctly during a reboot. BUG=b:383212261 BRANCH=firmware-trulo-15217.771.B TEST=Confirm the measured WWAN power sequence Change-Id: Ie01019eca7eaa4bbb34dd80aeb65b9b6b08587fd Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86514 Reviewed-by: Eric Lai Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- .../google/brya/variants/uldrenite/gpio.c | 10 +++--- .../variants/uldrenite/include/variant/gpio.h | 1 + .../google/brya/variants/uldrenite/variant.c | 32 ------------------- src/mainboard/google/brya/wwan_power.asl | 3 ++ 4 files changed, 10 insertions(+), 36 deletions(-) diff --git a/src/mainboard/google/brya/variants/uldrenite/gpio.c b/src/mainboard/google/brya/variants/uldrenite/gpio.c index 3e11b48d0a..e8355d37e8 100644 --- a/src/mainboard/google/brya/variants/uldrenite/gpio.c +++ b/src/mainboard/google/brya/variants/uldrenite/gpio.c @@ -232,9 +232,9 @@ static const struct pad_config gpio_table[] = { /* F11 : NC */ PAD_NC_LOCK(GPP_F11, NONE, LOCK_CONFIG), /* F12 : NC ==> WWAN_RST_L */ - PAD_CFG_GPO(GPP_F12, 0, DEEP), + PAD_CFG_GPO(GPP_F12, 1, DEEP), /* F13 : NC ==> PLTRST_WWAN# */ - PAD_CFG_GPO(GPP_F13, 0, DEEP), + PAD_CFG_GPO(GPP_F13, 1, DEEP), /* F14 : NC */ PAD_NC(GPP_F14, NONE), /* F15 : NC */ @@ -303,7 +303,7 @@ static const struct pad_config gpio_table[] = { /* H22 : NC */ PAD_NC(GPP_H22, NONE), /* H23 : LTE_PWR_OFF_EN */ - PAD_CFG_GPO(GPP_H23, 0, DEEP), + PAD_CFG_GPO(GPP_H23, 1, DEEP), /* R0 : HDA_BCLK ==> HDA_BIT_CLK */ PAD_CFG_NF(GPP_R0, NONE, DEEP, NF1), @@ -435,7 +435,7 @@ static const struct pad_config early_gpio_table[] = { /* H11 : UART0_TXD ==> UART_SOC_TX_DBG_RX */ PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2), /* H23 : LTE_PWR_OFF_EN */ - PAD_CFG_GPO(GPP_H23, 0, DEEP), + PAD_CFG_GPO(GPP_H23, 1, DEEP), }; /* Fill romstage gpio configuration */ @@ -445,6 +445,8 @@ static const struct pad_config romstage_gpio_table[] = { PAD_CFG_GPO(GPP_E17, 1, DEEP), /* D15 : GPP_D15 ==> SOC_TS_I2C_RST# */ PAD_CFG_GPO(GPP_D15, 0, DEEP), + /* F12 : NC ==> WWAN_RST_L */ + PAD_CFG_GPO(GPP_F12, 1, DEEP), }; const struct pad_config *variant_gpio_table(size_t *num) diff --git a/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h b/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h index 612ea2adbb..e7524565d0 100644 --- a/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h +++ b/src/mainboard/google/brya/variants/uldrenite/include/variant/gpio.h @@ -10,5 +10,6 @@ #define WWAN_PERST GPP_F13 #define T1_OFF_MS 20 #define T2_OFF_MS 10 +#define T0_OFF_MS 150 #endif diff --git a/src/mainboard/google/brya/variants/uldrenite/variant.c b/src/mainboard/google/brya/variants/uldrenite/variant.c index 3620c3a0c8..421799694a 100644 --- a/src/mainboard/google/brya/variants/uldrenite/variant.c +++ b/src/mainboard/google/brya/variants/uldrenite/variant.c @@ -7,27 +7,11 @@ #include #include -#define RW350R_RST_DELAY_MS 20 -#define RW350R_PERST_DELAY_MS 30 - const char *get_wifi_sar_cbfs_filename(void) { return "wifi_sar_0.hex"; } -static const struct pad_config rw350r_en_pad[] = { - /* H23 : LTE_PWR_OFF_EN */ - PAD_CFG_GPO(GPP_H23, 1, DEEP), -}; -static const struct pad_config rw350r_rst_pad[] = { - /* F12 : WWAN_RST_L */ - PAD_CFG_GPO_LOCK(GPP_F12, 1, LOCK_CONFIG), -}; -static const struct pad_config rw350r_perst_pad[] = { - /* F13 : PLTRST_WWAN# */ - PAD_CFG_GPO(GPP_F13, 1, DEEP), -}; - static const struct pad_config touchscreen_disable_pads[] = { /* A21 : TCHSCR_REPORT_EN */ PAD_NC(GPP_A21, NONE), @@ -68,22 +52,6 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table) } } -void variant_init(void) -{ - if (fw_config_probe(FW_CONFIG(DB_CELLULAR, CELLULAR_ABSENT))) - return; - /* - * RW350R power on seuqence: - * De-assert WWAN_EN -> 20ms -> de-assert WWAN_RST -> 30ms -> - * de-assert WWAN_PERST - */ - gpio_configure_pads(rw350r_en_pad, ARRAY_SIZE(rw350r_en_pad)); - mdelay(RW350R_RST_DELAY_MS); - gpio_configure_pads(rw350r_rst_pad, ARRAY_SIZE(rw350r_rst_pad)); - mdelay(RW350R_PERST_DELAY_MS); - gpio_configure_pads(rw350r_perst_pad, ARRAY_SIZE(rw350r_perst_pad)); -} - void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config) { if (fw_config_probe(FW_CONFIG(EXT_VR, EXT_VR_PRESENT))) { diff --git a/src/mainboard/google/brya/wwan_power.asl b/src/mainboard/google/brya/wwan_power.asl index f19a5ef4e9..4f9b788bc5 100644 --- a/src/mainboard/google/brya/wwan_power.asl +++ b/src/mainboard/google/brya/wwan_power.asl @@ -11,4 +11,7 @@ Method (MPTS, 1) \_SB.PCI0.CTXS(WWAN_RST); Sleep(T2_OFF_MS) \_SB.PCI0.CTXS(WWAN_FCPO); +#if CONFIG(BOARD_GOOGLE_ULDRENITE) + Sleep(T0_OFF_MS) +#endif } From d5bd4fbdfa6561e9003b9523ceb5389a1e656062 Mon Sep 17 00:00:00 2001 From: John Su Date: Thu, 27 Feb 2025 17:52:29 +0800 Subject: [PATCH 0223/3886] mb/trulo: Add host event EC_HOST_EVENT_BODY_DETECT_CHANGE Add host event EC_HOST_EVENT_BODY_DETECT_CHANGE for trulo. BRANCH=firmware-trulo-15217.771.B BUG=b:394177292 TEST=bodydetectmode on|off, verify host event is received Change-Id: Ifac0460e0e8feb33ad0085d250928adb593bb8ca Signed-off-by: John Su Reviewed-on: https://review.coreboot.org/c/coreboot/+/86615 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- .../brya/variants/baseboard/trulo/include/baseboard/ec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/brya/variants/baseboard/trulo/include/baseboard/ec.h b/src/mainboard/google/brya/variants/baseboard/trulo/include/baseboard/ec.h index 3d2fc5a4b3..5bf2995d94 100644 --- a/src/mainboard/google/brya/variants/baseboard/trulo/include/baseboard/ec.h +++ b/src/mainboard/google/brya/variants/baseboard/trulo/include/baseboard/ec.h @@ -22,7 +22,8 @@ EC_HOST_EVENT_MASK(EC_HOST_EVENT_MKBP) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE) |\ - EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX)) + EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BODY_DETECT_CHANGE)) #define MAINBOARD_EC_SMI_EVENTS \ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED)) From 70ca54bf37624e1d17a4e7b7e824294214468208 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Fri, 1 Mar 2024 16:17:45 +0100 Subject: [PATCH 0224/3886] mb/emulation/qemu-riscv: Add support for 512 harts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QEMU has a maximum of 512 of emulated harts supported. Signed-off-by: Maximilian Brune Change-Id: I149c8d8a43733c8ba3e02a84b0a3606d98f8b2c1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/81083 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks Reviewed-by: Alicja Michalska Reviewed-by: Carlos López --- src/commonlib/Makefile.mk | 1 + src/mainboard/emulation/qemu-riscv/Kconfig | 4 ++- .../emulation/qemu-riscv/Makefile.mk | 3 ++ .../emulation/qemu-riscv/memlayout.ld | 2 +- src/mainboard/emulation/qemu-riscv/smp.c | 28 +++++++++++++++++++ 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/mainboard/emulation/qemu-riscv/smp.c diff --git a/src/commonlib/Makefile.mk b/src/commonlib/Makefile.mk index a274d5fc96..91648c5170 100644 --- a/src/commonlib/Makefile.mk +++ b/src/commonlib/Makefile.mk @@ -32,6 +32,7 @@ romstage-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp_relocate.c endif ramstage-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp_relocate.c +bootblock-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c romstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig index 9b5a6f0dce..286e68441e 100644 --- a/src/mainboard/emulation/qemu-riscv/Kconfig +++ b/src/mainboard/emulation/qemu-riscv/Kconfig @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS select FLATTENED_DEVICE_TREE select MISSING_BOARD_RESET select DRIVERS_UART_8250MEM + select RISCV_GET_HART_COUNT_AT_RUNTIME select RISCV_HAS_OPENSBI select ARCH_RISCV_S select ARCH_RISCV_U @@ -35,6 +36,7 @@ config BOARD_SPECIFIC_OPTIONS select ARCH_ROMSTAGE_RISCV select ARCH_RAMSTAGE_RISCV select RISCV_USE_ARCH_TIMER + select FLATTENED_DEVICE_TREE config MEMLAYOUT_LD_FILE string @@ -48,7 +50,7 @@ config MAINBOARD_PART_NUMBER config MAX_CPUS int - default 1 + default 512 # QEMUs current limit for the virt target config RISCV_ARCH string diff --git a/src/mainboard/emulation/qemu-riscv/Makefile.mk b/src/mainboard/emulation/qemu-riscv/Makefile.mk index bed0f80392..0f240aacd1 100644 --- a/src/mainboard/emulation/qemu-riscv/Makefile.mk +++ b/src/mainboard/emulation/qemu-riscv/Makefile.mk @@ -4,12 +4,14 @@ bootblock-y += mainboard.c bootblock-y += uart.c bootblock-y += rom_media.c bootblock-y += clint.c +bootblock-y += smp.c romstage-y += cbmem.c romstage-y += romstage.c romstage-y += uart.c romstage-y += rom_media.c romstage-y += clint.c +romstage-y += smp.c ramstage-y += mainboard.c ramstage-y += uart.c @@ -17,5 +19,6 @@ ramstage-y += rom_media.c ramstage-y += clint.c ramstage-y += cbmem.c ramstage-y += chip.c +ramstage-y += smp.c CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include diff --git a/src/mainboard/emulation/qemu-riscv/memlayout.ld b/src/mainboard/emulation/qemu-riscv/memlayout.ld index 9c16496e11..9a52ec2035 100644 --- a/src/mainboard/emulation/qemu-riscv/memlayout.ld +++ b/src/mainboard/emulation/qemu-riscv/memlayout.ld @@ -16,5 +16,5 @@ SECTIONS PRERAM_CBMEM_CONSOLE(QEMU_VIRT_DRAM + 128K + 256K + 256K + 2M, 8K) FMAP_CACHE(QEMU_VIRT_DRAM + 128K + 256K + 256K + 2M + 8K, 2K) CBFS_MCACHE(QEMU_VIRT_DRAM + 128K + 256K + 256K + 2M + 8K + 2K, 10K) - STACK(QEMU_VIRT_DRAM + 128K + 256K + 256K + 2M + 8K + 2K + 10K, 4M) + STACK(QEMU_VIRT_DRAM + 128K + 256K + 256K + 2M + 8K + 2K + 10K, 4K * CONFIG_MAX_CPUS) } diff --git a/src/mainboard/emulation/qemu-riscv/smp.c b/src/mainboard/emulation/qemu-riscv/smp.c new file mode 100644 index 0000000000..b6dce4719e --- /dev/null +++ b/src/mainboard/emulation/qemu-riscv/smp.c @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +unsigned int smp_get_hart_count(void) +{ + if (!fdt_is_valid(HLS()->fdt)) + goto error; + + uint32_t cpus_offset = fdt_find_node_by_path(HLS()->fdt, "/cpus", NULL, NULL); + if (!cpus_offset) + goto error; + + static u32 harts[CONFIG_MAX_CPUS]; // too big for the stack + size_t count_harts = fdt_find_subnodes_by_prefix(HLS()->fdt, cpus_offset, "cpu@", + NULL, NULL, harts, CONFIG_MAX_CPUS); + if (!count_harts) + goto error; + + printk(BIOS_DEBUG, "found %zu harts in devicetree\n", count_harts); + return count_harts; +error: + printk(BIOS_ERR, "%s: Failed to read devicetree to get number of harts\n", __func__); + return 1; // Return single hart on failure to keep booting +} From 4cfc5db6b64f3b13c72b917734563d011b0d876d Mon Sep 17 00:00:00 2001 From: Fred Reitberger Date: Tue, 4 Oct 2022 15:07:49 -0400 Subject: [PATCH 0225/3886] soc/amd/common: Support sbin ucode files Recent PI releases have been distributing the ucode patch files as sbin files instead of bin files. The sbin uses a 256 byte amd_fw_header to wrap the bin file. Offset 0x14 of the header is the size field. The can be extracted with od to get the size of the ucode bin file. The bin file can then be extracted with dd and placed in the build directory for inclusion as a cbfs file. In the case where both an sbin and bin ucode file are present, the bin file will be added and a note will print at the start of the build about the sbin file being skipped. TEST=builds with only bin, only sbin, non-matching bin and sbin, matching bin and sbin files Signed-off-by: Fred Reitberger Signed-off-by: Maximilian Brune Change-Id: I29768ea19543bdc76662e687f59bf31b76f555ae Reviewed-on: https://review.coreboot.org/c/coreboot/+/68122 Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) --- src/soc/amd/common/Makefile.mk | 2 - src/soc/amd/common/block/cpu/Makefile.mk | 56 +++++++++++++++++++----- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/soc/amd/common/Makefile.mk b/src/soc/amd/common/Makefile.mk index 626260f93e..a030687817 100644 --- a/src/soc/amd/common/Makefile.mk +++ b/src/soc/amd/common/Makefile.mk @@ -38,8 +38,6 @@ AMDFW_CFG_WITH_PATH = $(shell echo "$(AMDFW_CFG_FILES)" | tr ' ' '\n' | grep "/" DEP_FILES = $(patsubst %,$(FIRMWARE_LOCATION)/%, $(AMDFW_CFG_IN_FW_LOC)) \ $(AMDFW_CFG_WITH_PATH) -amd_microcode_bins += $(wildcard ${FIRMWARE_LOCATION}/*U?odePatch*.bin) - ifeq ($(CONFIG_RESET_VECTOR_IN_RAM),y) $(objcbfs)/bootblock.bin: $(obj)/amdfw.rom $(obj)/fmap_config.h cp $< $@ diff --git a/src/soc/amd/common/block/cpu/Makefile.mk b/src/soc/amd/common/block/cpu/Makefile.mk index 1c4331cb91..ea40801bc6 100644 --- a/src/soc/amd/common/block/cpu/Makefile.mk +++ b/src/soc/amd/common/block/cpu/Makefile.mk @@ -9,18 +9,52 @@ ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_SVI3) += svi3.c ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_UCODE) += update_microcode.c ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_UCODE),y) -define add-ucode-as-cbfs -$(if $(value cpu_microcode_$(2).bin-file),$(info File1: $(cpu_microcode_$(2).bin-file)) $(info File2: $(1)) $(error Error: The cbfs filename "cpu_microcode_$(2).bin" is used for both above files. Check your microcode patches for duplicates.)) -cbfs-files-y += cpu_microcode_$(2).bin -cpu_microcode_$(2).bin-file := $(1) -cpu_microcode_$(2).bin-type := microcode -ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y) -cpu_microcode_$(2).bin-align := 64 -else -cpu_microcode_$(2).bin-align := 16 +define add-ucode-as-cbfs + +# check for duplicate microcode files. Same sbin and bin ucode is allowed here though, because mendocino has a duplicate. +ifeq ($(cpu_microcode_$(2).bin-file), $(obj)/cpu_microcode_$(2).$(3)) + $$(info Tried to add ucode: $(1)) + $$(error Error: The cbfs filename "cpu_microcode_$(2).bin" is already used. Check your microcode patches for duplicates.) endif + +# offset 0x14 contains the size of the unwrapped ucode file +# .sbin files contain a 256 wrapper around the usual microcode file +$(obj)/cpu_microcode_$(2).$(3): $(1) + echo $$< "->" $$@ + if [ $(3) = "bin" ]; then \ + cp $$< $$@; \ + elif [ $(3) = "sbin" ]; then \ + size=$$$$(od --endian little --address-radix n --read-bytes 4 --skip-bytes 0x14 --format u4 $$<); \ + dd status=none ibs=1 skip=256 count=$$$$((size)) if=$$< of=$$@; \ + fi + +# if there is both a sbin and bin microcode only include the bin one to keep the old behaviour +ifeq ($(cpu_microcode_$(2).bin-file),) + cbfs-files-y += cpu_microcode_$(2).bin + cpu_microcode_$(2).bin-file := $(obj)/cpu_microcode_$(2).$(3) + cpu_microcode_$(2).bin-type := microcode + + ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y) + cpu_microcode_$(2).bin-align := 64 + else + cpu_microcode_$(2).bin-align := 16 + endif +endif + endef -$(foreach ucode,$(amd_microcode_bins),$(eval $(call add-ucode-as-cbfs,$(ucode),$(shell hexdump -n 2 -s 0x18 -e '"%x"' $(ucode))))) -endif +amd_microcode_bins += $(wildcard ${FIRMWARE_LOCATION}/*U?odePatch*.bin) +amd_microcode_sbins += $(wildcard ${FIRMWARE_LOCATION}/*UcodePatch_*.sbin) + +# Function to grab bytes from a file and format them as desired +# $(call extract-bytes,filename,bytes-to-read,offset-to-bytes,output-format) +extract-bytes = $(shell echo $(shell od --endian little --address-radix n --read-bytes $(2) --skip-bytes $(3) --format $(4) $(1))) + +$(foreach ucode, $(amd_microcode_bins), \ + $(eval $(call add-ucode-as-cbfs,$(ucode),$(call extract-bytes,$(ucode),2,0x18,x2),bin))) + +$(foreach ucode, $(amd_microcode_sbins), \ + $(eval $(call add-ucode-as-cbfs,$(ucode),$(call extract-bytes,$(ucode),2,0x118,x2),sbin))) + +endif #ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_UCODE),y) From af2d11f96328dd2fd16be8c4881f7b536736bec4 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Tue, 25 Feb 2025 16:11:08 +0800 Subject: [PATCH 0226/3886] mb/google/fatcat/var/francka: Adjust NVMe SSD power sequence Move SSD enable/reset pins to romstage to have more time for initialization. BUG=b:398070426 BRANCH=None TEST=Build francka and do EC reset to check the SSD boots to OS successfully Change-Id: I468ba34a54046ef6ed3d5ec4c625a87bb5255640 Signed-off-by: Frank Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86593 Reviewed-by: Ian Feng Reviewed-by: Kapil Porwal Reviewed-by: Dtrain Hsu Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/mainboard/google/fatcat/variants/francka/gpio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mainboard/google/fatcat/variants/francka/gpio.c b/src/mainboard/google/fatcat/variants/francka/gpio.c index 6265b1667d..f2868fc638 100644 --- a/src/mainboard/google/fatcat/variants/francka/gpio.c +++ b/src/mainboard/google/fatcat/variants/francka/gpio.c @@ -416,6 +416,8 @@ static const struct pad_config early_gpio_table[] = { /* Pad configuration in romstage */ static const struct pad_config romstage_gpio_table[] = { + /* GPP_B16: SOC_SSD2_EN */ + PAD_CFG_GPO(GPP_B16, 1, PLTRST), /* GPP_C00: SOC_SMBCLK */ PAD_CFG_NF(GPP_C00, NONE, DEEP, NF1), /* GPP_C01: SOC_SMBDATA */ @@ -424,6 +426,8 @@ static const struct pad_config romstage_gpio_table[] = { PAD_CFG_GPO(GPP_H03, 0, DEEP), /* GPP_H17: FP_RST_1V8_OD# */ PAD_CFG_GPO(GPP_H17, 0, DEEP), + /* GPP_E03: SOC_SSD2_RST# */ + PAD_CFG_GPO(GPP_E03, 1, PLTRST), }; const struct pad_config *variant_gpio_table(size_t *num) From d8aaa220c8f0004e43331ff248d7eef6be3dd13a Mon Sep 17 00:00:00 2001 From: Vesek Date: Thu, 2 Jan 2025 06:40:48 +0100 Subject: [PATCH 0227/3886] mb/hp: Add Pro 3400 Based on autoport and HP Pro 3500. As part of this change renamed 3500 to 3x00 and added this as it's variant. It's an almost identical board to the 3500 but has a smaller flash. Other differences between boards were identified by autoport. They may or may not important but were included anyway. Tested on HP Pro 3400, behaves exactly as 3500 described in the docs. Changes were not significant enough to require retesting on 3500. Change-Id: I833996f6eddcaac91fb0ad0cd95fcc2a99447387 Signed-off-by: Vesek Reviewed-on: https://review.coreboot.org/c/coreboot/+/85825 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- Documentation/mainboard/hp/pro_3500_series.md | 76 +++---- Documentation/mainboard/index.md | 2 +- src/mainboard/hp/pro_3500_series/Kconfig | 37 ---- src/mainboard/hp/pro_3x00_series/Kconfig | 48 +++++ .../Kconfig.name | 3 + .../Makefile.mk | 4 +- .../acpi/ec.asl | 0 .../acpi/platform.asl | 0 .../acpi/superio.asl | 0 .../acpi_tables.c | 0 .../hp/pro_3x00_series/board_info.txt | 5 + src/mainboard/hp/pro_3x00_series/cmos.default | 8 + src/mainboard/hp/pro_3x00_series/cmos.layout | 68 +++++++ .../common_defines.h | 0 .../devicetree.cb | 16 -- .../dsdt.asl | 3 +- .../early_init.c | 0 .../gma-mainboard.ads | 0 .../hda_verb.c | 0 .../led.c | 0 .../led.h | 0 .../mainboard.c | 0 .../smihandler.c | 0 .../variants/pro_3400_series/board_info.txt | 5 + .../variants/pro_3400_series/data.vbt | Bin 0 -> 7168 bytes .../variants/pro_3400_series/gpio.c | 189 ++++++++++++++++++ .../variants/pro_3400_series/overridetree.cb | 27 +++ .../variants}/pro_3500_series/board_info.txt | 1 - .../variants}/pro_3500_series/data.vbt | Bin .../variants}/pro_3500_series/gpio.c | 0 .../variants/pro_3500_series/overridetree.cb | 27 +++ 31 files changed, 425 insertions(+), 94 deletions(-) delete mode 100644 src/mainboard/hp/pro_3500_series/Kconfig create mode 100644 src/mainboard/hp/pro_3x00_series/Kconfig rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/Kconfig.name (63%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/Makefile.mk (69%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/acpi/ec.asl (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/acpi/platform.asl (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/acpi/superio.asl (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/acpi_tables.c (100%) create mode 100644 src/mainboard/hp/pro_3x00_series/board_info.txt create mode 100644 src/mainboard/hp/pro_3x00_series/cmos.default create mode 100644 src/mainboard/hp/pro_3x00_series/cmos.layout rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/common_defines.h (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/devicetree.cb (91%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/dsdt.asl (99%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/early_init.c (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/gma-mainboard.ads (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/hda_verb.c (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/led.c (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/led.h (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/mainboard.c (100%) rename src/mainboard/hp/{pro_3500_series => pro_3x00_series}/smihandler.c (100%) create mode 100644 src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/board_info.txt create mode 100644 src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/data.vbt create mode 100644 src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/gpio.c create mode 100644 src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/overridetree.cb rename src/mainboard/hp/{ => pro_3x00_series/variants}/pro_3500_series/board_info.txt (83%) rename src/mainboard/hp/{ => pro_3x00_series/variants}/pro_3500_series/data.vbt (100%) rename src/mainboard/hp/{ => pro_3x00_series/variants}/pro_3500_series/gpio.c (100%) create mode 100644 src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/overridetree.cb diff --git a/Documentation/mainboard/hp/pro_3500_series.md b/Documentation/mainboard/hp/pro_3500_series.md index 881bf372f4..3280066875 100644 --- a/Documentation/mainboard/hp/pro_3500_series.md +++ b/Documentation/mainboard/hp/pro_3500_series.md @@ -1,43 +1,53 @@ -# HP Pro 3500 Series +# HP Pro 3x00 Series -This page describes how to run coreboot on the [Pro 3500 Series] -desktop from [HP]. +This page describes how to run coreboot on the [Pro 3400 Series] and [Pro 3500 Series] +desktops from [HP]. ## State All peripherals should work. Automatic fan control as well as S3 are working. The board was tested to boot Linux and Windows. EHCI debug -is untested. When using MrChromebox edk2 with secure boot build in, the -board will hang on each boot for about 20 seconds before continuing. -With disabled ME, the SuperIO will not get CPU temperatures via PECI and -therefore the automatic fan control will not increase the fan speed. +is untested. With disabled ME, the SuperIO will not get CPU +temperatures via PECI and therefore the automatic fan control +will not increase the fan speed. ## Flashing coreboot ```{eval-rst} -+---------------------+-------------------------+ -| Type | Value | -+=====================+=========================+ -| Socketed flash | No | -+---------------------+-------------------------+ -| Model | W25Q64FVSIG | -+---------------------+-------------------------+ -| Size | 8 MiB | -+---------------------+-------------------------+ -| In circuit flashing | Yes | -+---------------------+-------------------------+ -| Package | SOIC-8 | -+---------------------+-------------------------+ -| Write protection | See below | -+---------------------+-------------------------+ -| Dual BIOS feature | No | -+---------------------+-------------------------+ -| Internal flashing | Yes | -+---------------------+-------------------------+ ++---------------------+-----------------------------------------+ +| Type | Value | ++=====================+=========================================+ +| Socketed flash | No | ++---------------------+-----------------------------------------+ +| Model | W25Q32BVSIG (3400) / W25Q64FVSIG (3500) | ++---------------------+-----------------------------------------+ +| Size | 4 MiB (3400) / 8 MiB (3500) | ++---------------------+-----------------------------------------+ +| In circuit flashing | Yes | ++---------------------+-----------------------------------------+ +| Package | SOIC-8 | ++---------------------+-----------------------------------------+ +| Write protection | See below | ++---------------------+-----------------------------------------+ +| Dual BIOS feature | No | ++---------------------+-----------------------------------------+ +| Internal flashing | Yes | ++---------------------+-----------------------------------------+ ``` ### Flash layout The original layout of the flash should look like this: + +#### Pro 3400 +``` +00000000:00000fff fd +00180000:003fffff bios +00001000:0017ffff me +00fff000:00000fff gbe +00fff000:00000fff pd +``` + +#### Pro 3500 ``` 00000000:00000fff fd 00400000:007fffff bios @@ -48,8 +58,7 @@ The original layout of the flash should look like this: ### Internal programming -The SPI flash can be accessed using [flashrom] (although it reports as -"N25Q064..3E", it works fine). +The SPI flash can be accessed using [flashrom]. With a missing FDO jumper, `fd` region is read-only, `bios` region is read-write and `me` region is locked. Vendor firmware will additionally @@ -62,9 +71,7 @@ region will be modified on shutdown. Cut the AC power or do a restart from the OS. **Position of FDO jumper (E2) close to the F_USB3** -![][pro_3500_jumper] - -[pro_3500_jumper]: pro_3500_series_jumper.avif +![FDO jumper position](pro_3500_series_jumper.avif) ### External programming @@ -76,9 +83,7 @@ The supply needs to quickly reach 3V3 or else the chip is also unstable until cleanly power cycled. **Position of SOIC-8 flash and pin-header near ATX power connector** -![][pro_3500_flash] - -[pro_3500_flash]: pro_3500_series_flash.avif +![Flash position](pro_3500_series_flash.avif) ## Technology @@ -98,6 +103,7 @@ until cleanly power cycled. +------------------+--------------------------------------------------+ ``` -[Pro 3500 Series]: https://support.hp.com/us-en/document/c03364089 +[Pro 3400 Series]: https://support.hp.com/us-en/product/details/hp-pro-3400-microtower-pc/5160137 +[Pro 3500 Series]: https://support.hp.com/us-en/product/details/hp-pro-3500-microtower-pc/5270849 [HP]: https://www.hp.com/ [flashrom]: https://flashrom.org/Flashrom diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md index 518c02a994..177abff452 100644 --- a/Documentation/mainboard/index.md +++ b/Documentation/mainboard/index.md @@ -139,7 +139,7 @@ GA-H61M-S2PV Compaq 8200 Elite SFF Compaq 8300 Elite SFF Compaq Elite 8300 USDT -Pro 3500 Series +Pro 3x00 Series Z220 Workstation SFF ``` diff --git a/src/mainboard/hp/pro_3500_series/Kconfig b/src/mainboard/hp/pro_3500_series/Kconfig deleted file mode 100644 index ab77654b39..0000000000 --- a/src/mainboard/hp/pro_3500_series/Kconfig +++ /dev/null @@ -1,37 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -if BOARD_HP_PRO_3500_SERIES - -config BOARD_SPECIFIC_OPTIONS - def_bool y - select BOARD_ROMSIZE_KB_8192 - select HAVE_ACPI_RESUME - select HAVE_ACPI_TABLES - select INTEL_GMA_HAVE_VBT - select MAINBOARD_HAS_LIBGFXINIT - select MAINBOARD_USES_IFD_GBE_REGION - select NORTHBRIDGE_INTEL_SANDYBRIDGE - select NO_UART_ON_SUPERIO - select SERIRQ_CONTINUOUS_MODE - select SOUTHBRIDGE_INTEL_BD82X6X - select SUPERIO_ITE_IT8772F - select USE_NATIVE_RAMINIT - -config CBFS_SIZE - default 0x400000 - -config MAINBOARD_DIR - default "hp/pro_3500_series" - -config MAINBOARD_PART_NUMBER - default "Pro 3500 Series" - -config VGA_BIOS_ID - default "8086,0152" - -config DRAM_RESET_GATE_GPIO - default 60 - -config USBDEBUG_HCD_INDEX - default 2 -endif diff --git a/src/mainboard/hp/pro_3x00_series/Kconfig b/src/mainboard/hp/pro_3x00_series/Kconfig new file mode 100644 index 0000000000..47f24db10d --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/Kconfig @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config BOARD_HP_PRO_3X00_SERIES_COMMON + def_bool n + select HAVE_ACPI_RESUME + select HAVE_ACPI_TABLES + select HAVE_CMOS_DEFAULT + select HAVE_OPTION_TABLE + select INTEL_GMA_HAVE_VBT + select MAINBOARD_HAS_LIBGFXINIT + select NORTHBRIDGE_INTEL_SANDYBRIDGE + select NO_UART_ON_SUPERIO + select SERIRQ_CONTINUOUS_MODE + select SOUTHBRIDGE_INTEL_BD82X6X + select SUPERIO_ITE_IT8772F + select USE_NATIVE_RAMINIT + +config BOARD_HP_PRO_3400_SERIES + select BOARD_HP_PRO_3X00_SERIES_COMMON + select BOARD_ROMSIZE_KB_4096 + +config BOARD_HP_PRO_3500_SERIES + select BOARD_HP_PRO_3X00_SERIES_COMMON + select BOARD_ROMSIZE_KB_8192 + +if BOARD_HP_PRO_3X00_SERIES_COMMON + +config CBFS_SIZE + default 0x200000 if BOARD_ROMSIZE_KB_4096 + default 0x400000 if BOARD_ROMSIZE_KB_8192 + +config MAINBOARD_DIR + default "hp/pro_3x00_series" + +config VARIANT_DIR + default "pro_3400_series" if BOARD_HP_PRO_3400_SERIES + default "pro_3500_series" if BOARD_HP_PRO_3500_SERIES + +config MAINBOARD_PART_NUMBER + default "Pro 3400 Series" if BOARD_HP_PRO_3400_SERIES + default "Pro 3500 Series" if BOARD_HP_PRO_3500_SERIES + +config OVERRIDE_DEVICETREE + default "variants/\$(CONFIG_VARIANT_DIR)/overridetree.cb" + +config USBDEBUG_HCD_INDEX + default 2 +endif diff --git a/src/mainboard/hp/pro_3500_series/Kconfig.name b/src/mainboard/hp/pro_3x00_series/Kconfig.name similarity index 63% rename from src/mainboard/hp/pro_3500_series/Kconfig.name rename to src/mainboard/hp/pro_3x00_series/Kconfig.name index fd1222c68a..fea2e4f707 100644 --- a/src/mainboard/hp/pro_3500_series/Kconfig.name +++ b/src/mainboard/hp/pro_3x00_series/Kconfig.name @@ -1,4 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later +config BOARD_HP_PRO_3400_SERIES + bool "Pro 3400 Series" + config BOARD_HP_PRO_3500_SERIES bool "Pro 3500 Series" diff --git a/src/mainboard/hp/pro_3500_series/Makefile.mk b/src/mainboard/hp/pro_3x00_series/Makefile.mk similarity index 69% rename from src/mainboard/hp/pro_3500_series/Makefile.mk rename to src/mainboard/hp/pro_3x00_series/Makefile.mk index 6554ed5e8c..bc01687e99 100644 --- a/src/mainboard/hp/pro_3500_series/Makefile.mk +++ b/src/mainboard/hp/pro_3x00_series/Makefile.mk @@ -1,11 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later bootblock-y += early_init.c -bootblock-y += gpio.c +bootblock-y += variants/$(VARIANT_DIR)/gpio.c bootblock-y += led.c romstage-y += early_init.c -romstage-y += gpio.c +romstage-y += variants/$(VARIANT_DIR)/gpio.c ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads diff --git a/src/mainboard/hp/pro_3500_series/acpi/ec.asl b/src/mainboard/hp/pro_3x00_series/acpi/ec.asl similarity index 100% rename from src/mainboard/hp/pro_3500_series/acpi/ec.asl rename to src/mainboard/hp/pro_3x00_series/acpi/ec.asl diff --git a/src/mainboard/hp/pro_3500_series/acpi/platform.asl b/src/mainboard/hp/pro_3x00_series/acpi/platform.asl similarity index 100% rename from src/mainboard/hp/pro_3500_series/acpi/platform.asl rename to src/mainboard/hp/pro_3x00_series/acpi/platform.asl diff --git a/src/mainboard/hp/pro_3500_series/acpi/superio.asl b/src/mainboard/hp/pro_3x00_series/acpi/superio.asl similarity index 100% rename from src/mainboard/hp/pro_3500_series/acpi/superio.asl rename to src/mainboard/hp/pro_3x00_series/acpi/superio.asl diff --git a/src/mainboard/hp/pro_3500_series/acpi_tables.c b/src/mainboard/hp/pro_3x00_series/acpi_tables.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/acpi_tables.c rename to src/mainboard/hp/pro_3x00_series/acpi_tables.c diff --git a/src/mainboard/hp/pro_3x00_series/board_info.txt b/src/mainboard/hp/pro_3x00_series/board_info.txt new file mode 100644 index 0000000000..7114c27cfe --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/board_info.txt @@ -0,0 +1,5 @@ +Category: desktop +ROM package: SOIC-8 +ROM socketed: no +Flashrom support: yes +Release year: 2011-2012 diff --git a/src/mainboard/hp/pro_3x00_series/cmos.default b/src/mainboard/hp/pro_3x00_series/cmos.default new file mode 100644 index 0000000000..7c313be420 --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/cmos.default @@ -0,0 +1,8 @@ +## SPDX-License-Identifier: GPL-2.0-only + +boot_option=Fallback +debug_level=Debug +gfx_uma_size=64M +nmi=Disable +power_on_after_fail=Disable +sata_mode=AHCI diff --git a/src/mainboard/hp/pro_3x00_series/cmos.layout b/src/mainboard/hp/pro_3x00_series/cmos.layout new file mode 100644 index 0000000000..e6dba00063 --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/cmos.layout @@ -0,0 +1,68 @@ +## SPDX-License-Identifier: GPL-2.0-only + +# ----------------------------------------------------------------- +entries + +# start-bit length config enum-ID name +0 384 r 0 reserved_memory + +# ----------------------------------------------------------------- +# RTC_BOOT_BYTE (coreboot hardcoded) +384 1 e 3 boot_option +388 4 h 0 reboot_counter + +# ----------------------------------------------------------------- +# coreboot config options: console +395 4 e 4 debug_level + +# coreboot config options: southbridge +408 1 e 1 nmi +409 2 e 5 power_on_after_fail +411 1 e 6 sata_mode + +# coreboot config options: northbridge +412 3 e 7 gfx_uma_size + +# coreboot config options: check sums +984 16 h 0 check_sum + +# ----------------------------------------------------------------- + +enumerations + +#ID value text +1 0 Disable +1 1 Enable + +3 0 Fallback +3 1 Normal + +4 0 Emergency +4 1 Alert +4 2 Critical +4 3 Error +4 4 Warning +4 5 Notice +4 6 Info +4 7 Debug +4 8 Spew + +5 0 Disable +5 1 Enable +5 2 Keep + +6 0 AHCI +6 1 Compatible + +7 0 32M +7 1 64M +7 2 96M +7 3 128M +7 4 160M +7 5 192M +7 6 224M + +# ----------------------------------------------------------------- +checksums + +checksum 392 415 984 diff --git a/src/mainboard/hp/pro_3500_series/common_defines.h b/src/mainboard/hp/pro_3x00_series/common_defines.h similarity index 100% rename from src/mainboard/hp/pro_3500_series/common_defines.h rename to src/mainboard/hp/pro_3x00_series/common_defines.h diff --git a/src/mainboard/hp/pro_3500_series/devicetree.cb b/src/mainboard/hp/pro_3x00_series/devicetree.cb similarity index 91% rename from src/mainboard/hp/pro_3500_series/devicetree.cb rename to src/mainboard/hp/pro_3x00_series/devicetree.cb index 3d9cf6170b..cf75313432 100644 --- a/src/mainboard/hp/pro_3500_series/devicetree.cb +++ b/src/mainboard/hp/pro_3x00_series/devicetree.cb @@ -22,22 +22,6 @@ chip northbridge/intel/sandybridge register "sata_port_map" = "0x33" register "spi_lvscc" = "0x2005" register "spi_uvscc" = "0x2005" - register "usb_port_config" = "{ - { 1, 6, 0 }, - { 1, 6, 0 }, - { 1, 6, 1 }, - { 1, 9, 1 }, - { 1, 10, 2 }, - { 1, 11, 2 }, - { 1, 6, 3 }, - { 1, 6, 3 }, - { 1, 6, 4 }, - { 1, 12, 4 }, - { 1, 6, 6 }, - { 1, 11, 5 }, - { 1, 6, 5 }, - { 1, 6, 6 }, - }" device ref ehci2 on end device ref hda on end device ref pcie_rp2 on end # MINI_PCIE diff --git a/src/mainboard/hp/pro_3500_series/dsdt.asl b/src/mainboard/hp/pro_3x00_series/dsdt.asl similarity index 99% rename from src/mainboard/hp/pro_3500_series/dsdt.asl rename to src/mainboard/hp/pro_3x00_series/dsdt.asl index cbdf0c6fba..cee4939fe0 100644 --- a/src/mainboard/hp/pro_3500_series/dsdt.asl +++ b/src/mainboard/hp/pro_3x00_series/dsdt.asl @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ + #define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB #define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB - - #include DefinitionBlock( diff --git a/src/mainboard/hp/pro_3500_series/early_init.c b/src/mainboard/hp/pro_3x00_series/early_init.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/early_init.c rename to src/mainboard/hp/pro_3x00_series/early_init.c diff --git a/src/mainboard/hp/pro_3500_series/gma-mainboard.ads b/src/mainboard/hp/pro_3x00_series/gma-mainboard.ads similarity index 100% rename from src/mainboard/hp/pro_3500_series/gma-mainboard.ads rename to src/mainboard/hp/pro_3x00_series/gma-mainboard.ads diff --git a/src/mainboard/hp/pro_3500_series/hda_verb.c b/src/mainboard/hp/pro_3x00_series/hda_verb.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/hda_verb.c rename to src/mainboard/hp/pro_3x00_series/hda_verb.c diff --git a/src/mainboard/hp/pro_3500_series/led.c b/src/mainboard/hp/pro_3x00_series/led.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/led.c rename to src/mainboard/hp/pro_3x00_series/led.c diff --git a/src/mainboard/hp/pro_3500_series/led.h b/src/mainboard/hp/pro_3x00_series/led.h similarity index 100% rename from src/mainboard/hp/pro_3500_series/led.h rename to src/mainboard/hp/pro_3x00_series/led.h diff --git a/src/mainboard/hp/pro_3500_series/mainboard.c b/src/mainboard/hp/pro_3x00_series/mainboard.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/mainboard.c rename to src/mainboard/hp/pro_3x00_series/mainboard.c diff --git a/src/mainboard/hp/pro_3500_series/smihandler.c b/src/mainboard/hp/pro_3x00_series/smihandler.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/smihandler.c rename to src/mainboard/hp/pro_3x00_series/smihandler.c diff --git a/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/board_info.txt b/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/board_info.txt new file mode 100644 index 0000000000..9a9d75de47 --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/board_info.txt @@ -0,0 +1,5 @@ +Category: desktop +ROM package: SOIC-8 +ROM socketed: n +Flashrom support: y +Release year: 2011 diff --git a/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/data.vbt b/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/data.vbt new file mode 100644 index 0000000000000000000000000000000000000000..b7cb35a632e7ce21f417d6d80a41bab708b1974c GIT binary patch literal 7168 zcmeHKZ)g)|7=JEzN$%cU+VtwQ&9pr2#HC$Zud(Y&>9$Ln)~3cbO=_v4v(>~uthP0+ zLz&ET>tJKU<%5V0kqkjZ81$RphGQ@~22zB{*gmZ6lM@EA`C$xa_S{|4+Ev;x=H?*p z@q7O~_uMb<`+J}Fxy#1E-~h%0y`i1KSU9w`vmu0-02RhcQdBQ5!Ej%EZzwPj*c*)W zb!@{=U@g2-^6)M|0=P1_ze)9n$EK2_zF2L1WGr!FU+Qq;U=l;g$=9dGCotL(#=!pl z$`SKF&>$jjY-(=Y(u}A!ZC3r8{c2Ma^_$z8 zUu^SlakEfoN8k2nI1(5L_w{053`5~~ARh1B9*pe7XsoY091IV1hTJT_j*jt(6RE=o z4^5%3qZa+Dsy0xy1kxQ6hMf%B7aV}yxFGEzpjgsRjLF&VDg(e~hM&Gi9?*Cp^sF ztblA*eA)OV?H+A8xrV4UN_Vb}m@UsobK?PO4Zoq>IGbgcK{OwEsw>wOsMcwQxsXI_ zvJ)GuHdpJ^KI&kzr&e}Y^0YC~36C-uwk1WU(TWaoIrPx+HYQ=jk7FmT_2j}}i)zpb{%Tjf9 z^YQt9?lwRhX_qq4VpU$2o)atd5-g7Xy#IN=&@V7+#O;nh~ z)=1bUDG`YcN_bLI&PeRMgr7;uoW#D95SXGcww_^-DFckX#&DV`=NQW{{E{i(GWH`w z(WQ7@Y@-W%T*_`2JK(|(UCJdFyXwN5E@j@u?z+$;D>X8!moX+Q37L(_cve=f$ZST& z+p=;;X1~bpx_g3do9Fa03N6||F(uOm4B2F}z0Y~5wU<6mx%jrEr*VFRM;xxP)>TD& zo{IzIhit1eWJ(d5hSsA`x3UKigDn?7Mp{{&VR;Z6v1r8|eH;h|L;H%WSRV9744dy2 z`MBL%5W{io_j)wX!m%-8-%LyeGAuu427~$OB5RJB0_L#%SQ@9!%og&Xy$~f2R1aS3 zhbpxzo!g5FQZjAkOPWd{I-G1wXNJ91nu@uELc1xX=@Sb;)}4i{!q={6CT5-^hPs7_ zvZu}0hn%rb7Z490*JkGWr)$*cg>?%IJh;p`XpTY{)H-c;csik0^jqH+MojV`n+$(5 zCQSyn#bCz*R&m!0nJBJPWwm2*6=^z;rjo5@Jgj^+ZEbqR(bfiSs9|w0cqp~zAcAA{ zb5X0ouny(J9#7fg9Kd5T6!?<)-?+Un0*; + +static const struct pch_gpio_set1 pch_gpio_set1_mode = { + .gpio0 = GPIO_MODE_GPIO, + .gpio1 = GPIO_MODE_GPIO, + .gpio2 = GPIO_MODE_NATIVE, + .gpio3 = GPIO_MODE_NATIVE, + .gpio4 = GPIO_MODE_NATIVE, + .gpio5 = GPIO_MODE_NATIVE, + .gpio6 = GPIO_MODE_GPIO, + .gpio7 = GPIO_MODE_GPIO, + .gpio8 = GPIO_MODE_GPIO, + .gpio9 = GPIO_MODE_NATIVE, + .gpio10 = GPIO_MODE_NATIVE, + .gpio11 = GPIO_MODE_NATIVE, + .gpio12 = GPIO_MODE_GPIO, + .gpio13 = GPIO_MODE_GPIO, + .gpio14 = GPIO_MODE_NATIVE, + .gpio15 = GPIO_MODE_GPIO, + .gpio16 = GPIO_MODE_GPIO, + .gpio17 = GPIO_MODE_GPIO, + .gpio18 = GPIO_MODE_NATIVE, + .gpio19 = GPIO_MODE_NATIVE, + .gpio20 = GPIO_MODE_NATIVE, + .gpio21 = GPIO_MODE_NATIVE, + .gpio22 = GPIO_MODE_GPIO, + .gpio23 = GPIO_MODE_NATIVE, + .gpio24 = GPIO_MODE_GPIO, + .gpio25 = GPIO_MODE_NATIVE, + .gpio26 = GPIO_MODE_NATIVE, + .gpio27 = GPIO_MODE_GPIO, + .gpio28 = GPIO_MODE_GPIO, + .gpio29 = GPIO_MODE_GPIO, + .gpio30 = GPIO_MODE_NATIVE, + .gpio31 = GPIO_MODE_GPIO, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_direction = { + .gpio0 = GPIO_DIR_INPUT, + .gpio1 = GPIO_DIR_INPUT, + .gpio6 = GPIO_DIR_INPUT, + .gpio7 = GPIO_DIR_INPUT, + .gpio8 = GPIO_DIR_OUTPUT, + .gpio12 = GPIO_DIR_INPUT, + .gpio13 = GPIO_DIR_INPUT, + .gpio15 = GPIO_DIR_OUTPUT, + .gpio16 = GPIO_DIR_INPUT, + .gpio17 = GPIO_DIR_INPUT, + .gpio22 = GPIO_DIR_INPUT, + .gpio24 = GPIO_DIR_OUTPUT, + .gpio27 = GPIO_DIR_INPUT, + .gpio28 = GPIO_DIR_OUTPUT, + .gpio29 = GPIO_DIR_OUTPUT, + .gpio31 = GPIO_DIR_INPUT, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_level = { + .gpio8 = GPIO_LEVEL_HIGH, + .gpio15 = GPIO_LEVEL_LOW, + .gpio24 = GPIO_LEVEL_LOW, + .gpio28 = GPIO_LEVEL_LOW, + .gpio29 = GPIO_LEVEL_HIGH, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_reset = { +}; + +static const struct pch_gpio_set1 pch_gpio_set1_invert = { + .gpio13 = GPIO_INVERT, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_blink = { +}; + +static const struct pch_gpio_set2 pch_gpio_set2_mode = { + .gpio32 = GPIO_MODE_GPIO, + .gpio33 = GPIO_MODE_GPIO, + .gpio34 = GPIO_MODE_GPIO, + .gpio35 = GPIO_MODE_GPIO, + .gpio36 = GPIO_MODE_GPIO, + .gpio37 = GPIO_MODE_GPIO, + .gpio38 = GPIO_MODE_GPIO, + .gpio39 = GPIO_MODE_GPIO, + .gpio40 = GPIO_MODE_NATIVE, + .gpio41 = GPIO_MODE_NATIVE, + .gpio42 = GPIO_MODE_NATIVE, + .gpio43 = GPIO_MODE_GPIO, + .gpio44 = GPIO_MODE_NATIVE, + .gpio45 = GPIO_MODE_NATIVE, + .gpio46 = GPIO_MODE_NATIVE, + .gpio47 = GPIO_MODE_NATIVE, + .gpio48 = GPIO_MODE_GPIO, + .gpio49 = GPIO_MODE_GPIO, + .gpio50 = GPIO_MODE_NATIVE, + .gpio51 = GPIO_MODE_NATIVE, + .gpio52 = GPIO_MODE_NATIVE, + .gpio53 = GPIO_MODE_NATIVE, + .gpio54 = GPIO_MODE_NATIVE, + .gpio55 = GPIO_MODE_NATIVE, + .gpio56 = GPIO_MODE_NATIVE, + .gpio57 = GPIO_MODE_GPIO, + .gpio58 = GPIO_MODE_NATIVE, + .gpio59 = GPIO_MODE_NATIVE, + .gpio60 = GPIO_MODE_GPIO, + .gpio61 = GPIO_MODE_GPIO, + .gpio62 = GPIO_MODE_NATIVE, + .gpio63 = GPIO_MODE_NATIVE, +}; + +static const struct pch_gpio_set2 pch_gpio_set2_direction = { + .gpio32 = GPIO_DIR_OUTPUT, + .gpio33 = GPIO_DIR_OUTPUT, + .gpio34 = GPIO_DIR_INPUT, + .gpio35 = GPIO_DIR_INPUT, + .gpio36 = GPIO_DIR_INPUT, + .gpio37 = GPIO_DIR_INPUT, + .gpio38 = GPIO_DIR_INPUT, + .gpio39 = GPIO_DIR_INPUT, + .gpio43 = GPIO_DIR_INPUT, + .gpio48 = GPIO_DIR_INPUT, + .gpio49 = GPIO_DIR_INPUT, + .gpio57 = GPIO_DIR_INPUT, + .gpio60 = GPIO_DIR_OUTPUT, + .gpio61 = GPIO_DIR_OUTPUT, +}; + +static const struct pch_gpio_set2 pch_gpio_set2_level = { + .gpio32 = GPIO_LEVEL_HIGH, + .gpio33 = GPIO_LEVEL_HIGH, + .gpio60 = GPIO_LEVEL_LOW, + .gpio61 = GPIO_LEVEL_HIGH, +}; + +static const struct pch_gpio_set2 pch_gpio_set2_reset = { +}; + +static const struct pch_gpio_set3 pch_gpio_set3_mode = { + .gpio64 = GPIO_MODE_NATIVE, + .gpio65 = GPIO_MODE_NATIVE, + .gpio66 = GPIO_MODE_NATIVE, + .gpio67 = GPIO_MODE_NATIVE, + .gpio68 = GPIO_MODE_GPIO, + .gpio69 = GPIO_MODE_GPIO, + .gpio70 = GPIO_MODE_GPIO, + .gpio71 = GPIO_MODE_GPIO, + .gpio72 = GPIO_MODE_GPIO, + .gpio73 = GPIO_MODE_NATIVE, + .gpio74 = GPIO_MODE_NATIVE, + .gpio75 = GPIO_MODE_NATIVE, +}; + +static const struct pch_gpio_set3 pch_gpio_set3_direction = { + .gpio68 = GPIO_DIR_INPUT, + .gpio69 = GPIO_DIR_INPUT, + .gpio70 = GPIO_DIR_INPUT, + .gpio71 = GPIO_DIR_INPUT, + .gpio72 = GPIO_DIR_INPUT, +}; + +static const struct pch_gpio_set3 pch_gpio_set3_level = { +}; + +static const struct pch_gpio_set3 pch_gpio_set3_reset = { +}; + +const struct pch_gpio_map mainboard_gpio_map = { + .set1 = { + .mode = &pch_gpio_set1_mode, + .direction = &pch_gpio_set1_direction, + .level = &pch_gpio_set1_level, + .blink = &pch_gpio_set1_blink, + .invert = &pch_gpio_set1_invert, + .reset = &pch_gpio_set1_reset, + }, + .set2 = { + .mode = &pch_gpio_set2_mode, + .direction = &pch_gpio_set2_direction, + .level = &pch_gpio_set2_level, + .reset = &pch_gpio_set2_reset, + }, + .set3 = { + .mode = &pch_gpio_set3_mode, + .direction = &pch_gpio_set3_direction, + .level = &pch_gpio_set3_level, + .reset = &pch_gpio_set3_reset, + }, +}; diff --git a/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/overridetree.cb b/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/overridetree.cb new file mode 100644 index 0000000000..fbbdbf6232 --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/variants/pro_3400_series/overridetree.cb @@ -0,0 +1,27 @@ +## SPDX-License-Identifier: GPL-2.0-only + +chip northbridge/intel/sandybridge + device domain 0x0 on + chip southbridge/intel/bd82x6x # Intel Series 6 Cougar Point PCH + register "usb_port_config" = "{ + { 0, 6, -1 }, + { 1, 6, 0 }, + { 1, 6, 0 }, + { 1, 6, 1 }, + { 1, 6, 1 }, + { 1, 6, 2 }, + { 0, 6, -1 }, + { 0, 6, -1 }, + { 1, 12, 5 }, + { 1, 12, 5 }, + { 1, 12, 6 }, + { 1, 12, 6 }, + { 0, 6, -1 }, + { 0, 6, -1 }, + }" + + # Dummy device, sconfig requires at least one device per chip + device ref ehci1 on end + end + end +end diff --git a/src/mainboard/hp/pro_3500_series/board_info.txt b/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/board_info.txt similarity index 83% rename from src/mainboard/hp/pro_3500_series/board_info.txt rename to src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/board_info.txt index 178039429c..5ddb210df7 100644 --- a/src/mainboard/hp/pro_3500_series/board_info.txt +++ b/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/board_info.txt @@ -1,6 +1,5 @@ Category: desktop ROM package: SOIC-8 -ROM protocol: SPI ROM socketed: n Flashrom support: y Release year: 2012 diff --git a/src/mainboard/hp/pro_3500_series/data.vbt b/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/data.vbt similarity index 100% rename from src/mainboard/hp/pro_3500_series/data.vbt rename to src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/data.vbt diff --git a/src/mainboard/hp/pro_3500_series/gpio.c b/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/gpio.c similarity index 100% rename from src/mainboard/hp/pro_3500_series/gpio.c rename to src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/gpio.c diff --git a/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/overridetree.cb b/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/overridetree.cb new file mode 100644 index 0000000000..9e9fa86c9c --- /dev/null +++ b/src/mainboard/hp/pro_3x00_series/variants/pro_3500_series/overridetree.cb @@ -0,0 +1,27 @@ +## SPDX-License-Identifier: GPL-2.0-only + +chip northbridge/intel/sandybridge + device domain 0x0 on + chip southbridge/intel/bd82x6x # Intel Series 6 Cougar Point PCH + register "usb_port_config" = "{ + { 1, 6, 0 }, + { 1, 6, 0 }, + { 1, 6, 1 }, + { 1, 9, 1 }, + { 1, 10, 2 }, + { 1, 11, 2 }, + { 1, 6, 3 }, + { 1, 6, 3 }, + { 1, 6, 4 }, + { 1, 12, 4 }, + { 1, 6, 6 }, + { 1, 11, 5 }, + { 1, 6, 5 }, + { 1, 6, 6 }, + }" + + # Dummy device, sconfig requires at least one device per chip + device ref ehci1 on end + end + end +end From ddc373afabfc087e3c1dd6e5e37196d44e5f6e51 Mon Sep 17 00:00:00 2001 From: Vesek Date: Sat, 4 Jan 2025 02:09:59 +0100 Subject: [PATCH 0228/3886] Doc/mb/hp: Rename pro_3500_series to pro_3x00 series The pro_3500_series was converted to a variant to include the Pro 3400, so rename the corresponding documentation. Change-Id: I5977f223d6f004a801e163397d1c97febd7ee1d4 Signed-off-by: Vesek Reviewed-on: https://review.coreboot.org/c/coreboot/+/85846 Reviewed-by: Nicholas Chin Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- .../hp/{pro_3500_series.md => pro_3x00_series.md} | 4 ++-- ...series_flash.avif => pro_3x00_series_flash.avif} | Bin ...ries_jumper.avif => pro_3x00_series_jumper.avif} | Bin Documentation/mainboard/index.md | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename Documentation/mainboard/hp/{pro_3500_series.md => pro_3x00_series.md} (97%) rename Documentation/mainboard/hp/{pro_3500_series_flash.avif => pro_3x00_series_flash.avif} (100%) rename Documentation/mainboard/hp/{pro_3500_series_jumper.avif => pro_3x00_series_jumper.avif} (100%) diff --git a/Documentation/mainboard/hp/pro_3500_series.md b/Documentation/mainboard/hp/pro_3x00_series.md similarity index 97% rename from Documentation/mainboard/hp/pro_3500_series.md rename to Documentation/mainboard/hp/pro_3x00_series.md index 3280066875..a92c4f5c3f 100644 --- a/Documentation/mainboard/hp/pro_3500_series.md +++ b/Documentation/mainboard/hp/pro_3x00_series.md @@ -71,7 +71,7 @@ region will be modified on shutdown. Cut the AC power or do a restart from the OS. **Position of FDO jumper (E2) close to the F_USB3** -![FDO jumper position](pro_3500_series_jumper.avif) +![FDO jumper position](pro_3x00_series_jumper.avif) ### External programming @@ -83,7 +83,7 @@ The supply needs to quickly reach 3V3 or else the chip is also unstable until cleanly power cycled. **Position of SOIC-8 flash and pin-header near ATX power connector** -![Flash position](pro_3500_series_flash.avif) +![Flash position](pro_3x00_series_flash.avif) ## Technology diff --git a/Documentation/mainboard/hp/pro_3500_series_flash.avif b/Documentation/mainboard/hp/pro_3x00_series_flash.avif similarity index 100% rename from Documentation/mainboard/hp/pro_3500_series_flash.avif rename to Documentation/mainboard/hp/pro_3x00_series_flash.avif diff --git a/Documentation/mainboard/hp/pro_3500_series_jumper.avif b/Documentation/mainboard/hp/pro_3x00_series_jumper.avif similarity index 100% rename from Documentation/mainboard/hp/pro_3500_series_jumper.avif rename to Documentation/mainboard/hp/pro_3x00_series_jumper.avif diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md index 177abff452..f2be295f1f 100644 --- a/Documentation/mainboard/index.md +++ b/Documentation/mainboard/index.md @@ -139,7 +139,7 @@ GA-H61M-S2PV Compaq 8200 Elite SFF Compaq 8300 Elite SFF Compaq Elite 8300 USDT -Pro 3x00 Series +Pro 3x00 Series Z220 Workstation SFF ``` From 670ed107de640055a943f357486b1e68fa4b7da2 Mon Sep 17 00:00:00 2001 From: Vesek Date: Sat, 4 Jan 2025 02:20:42 +0100 Subject: [PATCH 0229/3886] mb/hp/pro_3x00_series: Remove unused ACPI brightness control These lines are not needed because this mainboard does not have an integrated display to control. Tested on HP Pro 3400 Series. Change-Id: Id39cd18713cc596eb2c92e028dad480fe7de8ef2 Signed-off-by: Vesek Reviewed-on: https://review.coreboot.org/c/coreboot/+/85847 Reviewed-by: Nicholas Chin Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/hp/pro_3x00_series/dsdt.asl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mainboard/hp/pro_3x00_series/dsdt.asl b/src/mainboard/hp/pro_3x00_series/dsdt.asl index cee4939fe0..9b86d2ac74 100644 --- a/src/mainboard/hp/pro_3x00_series/dsdt.asl +++ b/src/mainboard/hp/pro_3x00_series/dsdt.asl @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB -#define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB #include DefinitionBlock( @@ -23,7 +21,6 @@ DefinitionBlock( Device (\_SB.PCI0) { #include - #include #include } } From 7164abff0b5460f5621369656a81a1fbc1fe6186 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Mon, 23 Sep 2024 21:07:55 +0300 Subject: [PATCH 0230/3886] drivers/efi/capsules: check for overflows of capsule sizes As was pointed out in comments on CB:83422 [0], the code lacks overflow checks: - when computing size of capsules in a single capsule block - when computing size of capsules in all capsule blocks If an overflow is triggered, the code might allocate a capsule buffer smaller than the data that's going to be written to it leading to overwriting memory after the buffer. [0]: https://review.coreboot.org/c/coreboot/+/83422 Change-Id: I43d17d77197fc2cbd721d47941101551603c352a Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/84541 Reviewed-by: Krystian Hebel Reviewed-by: Paul Menzel Tested-by: build bot (Jenkins) --- src/drivers/efi/capsules.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/drivers/efi/capsules.c b/src/drivers/efi/capsules.c index e674e33228..38178c618e 100644 --- a/src/drivers/efi/capsules.c +++ b/src/drivers/efi/capsules.c @@ -344,7 +344,15 @@ static struct block_descr check_capsule_block(struct block_descr first_block, goto error; } - data_size += ALIGN_UP(capsule_hdr->CapsuleImageSize, CAPSULE_ALIGNMENT); + uint64_t capsule_size = + ALIGN_UP((uint64_t)capsule_hdr->CapsuleImageSize, CAPSULE_ALIGNMENT); + if (data_size + capsule_size < data_size) { /* overflow detection */ + printk(BIOS_ERR, + "capsules: capsules block size is too large (%#llx + %#llx) for uint64.\n", + data_size, capsule_size); + goto error; + } + data_size += capsule_size; uint32_t size_left = capsule_hdr->CapsuleImageSize; while (size_left != 0) { @@ -384,6 +392,12 @@ static struct block_descr check_capsule_block(struct block_descr first_block, } /* Increase the size only on successful parsing of the capsule block. */ + if (*total_data_size + data_size < *total_data_size) { /* overflow detection */ + printk(BIOS_ERR, + "capsules: total capsule's size is too large (%#llx + %#llx) for uint64.\n", + *total_data_size, data_size); + goto error; + } *total_data_size += data_size; return block; From 39d890073f015571652c1700bc57284fe58935cb Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Tue, 24 Sep 2024 11:31:05 -0700 Subject: [PATCH 0231/3886] mb/intel/ptlrvp: Add Intel Panther Lake RVP as copy of google/fatcat This commit introduces the Intel Panther Lake (PTL) Reference Validation Platform (RVP) mainboard definition. It is aligned with the Google Fatcat mainboard in the coreboot codebase, with the commit hash e2ea7f22c6355d15515c049ca0dc4352173a0c01. Intel's proprietary platform, commonly referred to as PTLRVP, and Google's Fatcat mainboard share a considerable degree of similarity in their design and capabilities. Nevertheless, Intel faces unique challenges and requires specific board configurations that Google does not. Consequently, there is a necessity for a specialized mainboard tailored to Intel's individual needs. To maintain consistency with the Fatcat board definition, the Chrome OS Board Information (CBI) firmware configuration aligns with that of Google Fatcat. If necessary, new bits will be appended, starting from the end of the 32-bit firmware configuration field. BUG=b:398880064 TEST=The Intel PTLRVP board successfully boots to the operating System. Change-Id: I914f73ff06bfb801fc319b45b23d7ce4cb7a6d60 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/84564 Reviewed-by: Cliff Huang Tested-by: build bot (Jenkins) Reviewed-by: Wonkyu Kim --- src/mainboard/intel/ptlrvp/Kconfig | 144 +++ src/mainboard/intel/ptlrvp/Kconfig.name | 6 + src/mainboard/intel/ptlrvp/Makefile.mk | 26 + src/mainboard/intel/ptlrvp/board_info.txt | 6 + src/mainboard/intel/ptlrvp/bootblock.c | 13 + src/mainboard/intel/ptlrvp/chromeos.c | 34 + src/mainboard/intel/ptlrvp/chromeos.fmd | 50 + src/mainboard/intel/ptlrvp/dsdt.asl | 42 + src/mainboard/intel/ptlrvp/ec.c | 22 + src/mainboard/intel/ptlrvp/mainboard.c | 74 ++ src/mainboard/intel/ptlrvp/romstage.c | 36 + src/mainboard/intel/ptlrvp/smihandler.c | 29 + src/mainboard/intel/ptlrvp/spd/Makefile.mk | 6 + .../baseboard/include/baseboard/variants.h | 40 + .../variants/baseboard/ptlrvp/Makefile.mk | 4 + .../variants/baseboard/ptlrvp/devicetree.cb | 99 ++ .../baseboard/ptlrvp/include/baseboard/ec.h | 82 ++ .../baseboard/ptlrvp/include/baseboard/gpio.h | 17 + .../ptlrvp/variants/baseboard/ptlrvp/memory.c | 31 + .../variants/baseboard/ptlrvp/ramstage.c | 62 ++ .../intel/ptlrvp/variants/ptlrvp/Makefile.mk | 9 + .../intel/ptlrvp/variants/ptlrvp/fw_config.c | 651 +++++++++++++ .../intel/ptlrvp/variants/ptlrvp/gpio.c | 419 +++++++++ .../intel/ptlrvp/variants/ptlrvp/hda_verb.c | 126 +++ .../variants/ptlrvp/include/variant/ec.h | 8 + .../variants/ptlrvp/include/variant/gpio.h | 12 + .../intel/ptlrvp/variants/ptlrvp/memory.c | 76 ++ .../ptlrvp/variants/ptlrvp/memory/Makefile.mk | 7 + .../ptlrvp/memory/dram_id.generated.txt | 7 + .../variants/ptlrvp/memory/mem_parts_used.txt | 12 + .../ptlrvp/variants/ptlrvp/overridetree.cb | 890 ++++++++++++++++++ .../intel/ptlrvp/variants/ptlrvp/variant.c | 30 + 32 files changed, 3070 insertions(+) create mode 100644 src/mainboard/intel/ptlrvp/Kconfig create mode 100644 src/mainboard/intel/ptlrvp/Kconfig.name create mode 100644 src/mainboard/intel/ptlrvp/Makefile.mk create mode 100644 src/mainboard/intel/ptlrvp/board_info.txt create mode 100644 src/mainboard/intel/ptlrvp/bootblock.c create mode 100644 src/mainboard/intel/ptlrvp/chromeos.c create mode 100644 src/mainboard/intel/ptlrvp/chromeos.fmd create mode 100644 src/mainboard/intel/ptlrvp/dsdt.asl create mode 100644 src/mainboard/intel/ptlrvp/ec.c create mode 100644 src/mainboard/intel/ptlrvp/mainboard.c create mode 100644 src/mainboard/intel/ptlrvp/romstage.c create mode 100644 src/mainboard/intel/ptlrvp/smihandler.c create mode 100644 src/mainboard/intel/ptlrvp/spd/Makefile.mk create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/Makefile.mk create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/devicetree.cb create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/ec.h create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/gpio.h create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/memory.c create mode 100644 src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/ramstage.c create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/fw_config.c create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/hda_verb.c create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/ec.h create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/gpio.h create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/overridetree.cb create mode 100644 src/mainboard/intel/ptlrvp/variants/ptlrvp/variant.c diff --git a/src/mainboard/intel/ptlrvp/Kconfig b/src/mainboard/intel/ptlrvp/Kconfig new file mode 100644 index 0000000000..dd60855d3c --- /dev/null +++ b/src/mainboard/intel/ptlrvp/Kconfig @@ -0,0 +1,144 @@ +## SPDX-License-Identifier: GPL-2.0-only + +config BOARD_INTEL_PTLRVP_COMMON + def_bool n + select BOARD_ROMSIZE_KB_32768 + select DRIVERS_GFX_GENERIC + select DRIVERS_I2C_GENERIC + select DRIVERS_I2C_HID + select DRIVERS_INTEL_DPTF + select DRIVERS_INTEL_MIPI_CAMERA + select DRIVERS_INTEL_PMC + select DRIVERS_INTEL_SOUNDWIRE + select DRIVERS_WWAN_FM350GL + select DRIVERS_AUDIO_SOF + select DRIVERS_SOUNDWIRE_ALC_BASE_7XX + select DRIVERS_SPI_ACPI + select DUMP_SMBIOS_TYPE17 + select EC_ACPI + select EC_GOOGLE_CHROMEEC + select EC_GOOGLE_CHROMEEC_BOARDID + select EC_GOOGLE_CHROMEEC_ESPI + select EC_GOOGLE_CHROMEEC_SKUID + select FW_CONFIG + select FW_CONFIG_SOURCE_CHROMEEC_CBI + select GENERATE_SMBIOS_TABLES + select GOOGLE_SMBIOS_MAINBOARD_VERSION + select HAVE_ACPI_RESUME + select HAVE_ACPI_TABLES + select HAVE_SPD_IN_CBFS + select I2C_TPM + select INTEL_LPSS_UART_FOR_CONSOLE + select MAINBOARD_DISABLE_STAGE_CACHE + select MAINBOARD_HAS_TPM2 + select MB_COMPRESS_RAMSTAGE_LZ4 + select PMC_IPC_ACPI_INTERFACE + select SOC_INTEL_COMMON_BLOCK_VARIANT_POWER_LIMIT + select SOC_INTEL_CSE_LITE_SYNC_BY_PAYLOAD + select SOC_INTEL_CSE_SEND_EOP_BY_PAYLOAD + select SOC_INTEL_PANTHERLAKE_U_H + select SOC_INTEL_TCSS_USE_PDC_PMC_USBC_MUX_CONFIGURATION + +config BOARD_INTEL_BASEBOARD_PTLRVP + def_bool n + select BOARD_INTEL_PTLRVP_COMMON + select CHROMEOS_WIFI_SAR if CHROMEOS + select DRIVERS_INTEL_ISH + select DRIVER_INTEL_ISH_HAS_MAIN_FW + select DRIVERS_INTEL_USB4_RETIMER + select HAVE_SLP_S0_GATE + select MAINBOARD_HAS_CHROMEOS + select MEMORY_SOLDERDOWN + select SOC_INTEL_COMMON_BLOCK_HDA_VERB + select SOC_INTEL_IOE_DIE_SUPPORT + select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES + select SYSTEM_TYPE_LAPTOP + select TPM_GOOGLE_TI50 + +config BOARD_INTEL_MODEL_PTLRVP + def_bool n + select BOARD_INTEL_BASEBOARD_PTLRVP + select DRIVERS_GENERIC_BAYHUB_LV2 + select DRIVERS_GENERIC_MAX98357A + +config BOARD_INTEL_PTLRVP + select BOARD_INTEL_MODEL_PTLRVP + select EC_GOOGLE_CHROMEEC_MEC + select MAINBOARD_USES_IFD_EC_REGION + +if BOARD_INTEL_PTLRVP_COMMON + +config BASEBOARD_DIR + string + default "ptlrvp" + +config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES + select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC + select GBB_FLAG_FORCE_DEV_BOOT_USB + select GBB_FLAG_FORCE_MANUAL_RECOVERY + select HAS_RECOVERY_MRC_CACHE + +config CHROMEOS_WIFI_SAR + bool "Enable SAR options for ChromeOS build" + depends on CHROMEOS + select DSAR_ENABLE + select GEO_SAR_ENABLE + select SAR_ENABLE + select USE_SAR + +config DEVICETREE + default "variants/baseboard/\$(CONFIG_BASEBOARD_DIR)/devicetree.cb" + +config DIMM_SPD_SIZE + default 512 + +config DRIVER_TPM_I2C_ADDR + hex + default 0x50 + +config DRIVER_TPM_I2C_BUS + hex + default 0x03 if BOARD_INTEL_MODEL_PTLRVP + +config HAVE_SLP_S0_GATE + def_bool n + +config MAINBOARD_DIR + default "intel/ptlrvp" + +config MAINBOARD_FAMILY + string + default "Intel_Ptlrvp" + +config MAINBOARD_PART_NUMBER + default "Ptlrvp" if BOARD_INTEL_PTLRVP + +config MEMORY_SOLDERDOWN + def_bool n + select CHROMEOS_DRAM_PART_NUMBER_IN_CBI if CHROMEOS + select HAVE_SPD_IN_CBFS + +config TPM_TIS_ACPI_INTERRUPT + int + default 47 if BOARD_INTEL_MODEL_PTLRVP # GPE0_DW1_15 (GPP_D15) + +# FIXME: update as per board schematics +config UART_FOR_CONSOLE + int + default 0 + +config USE_PM_ACPI_TIMER + default n + +config VARIANT_DIR + string + default "ptlrvp" if BOARD_INTEL_MODEL_PTLRVP + +config OVERRIDE_DEVICETREE + default "variants/\$(CONFIG_VARIANT_DIR)/overridetree.cb" + +config VBOOT + select VBOOT_LID_SWITCH + +endif # BOARD_INTEL_PTLRVP_COMMON diff --git a/src/mainboard/intel/ptlrvp/Kconfig.name b/src/mainboard/intel/ptlrvp/Kconfig.name new file mode 100644 index 0000000000..f8d8f17dc1 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/Kconfig.name @@ -0,0 +1,6 @@ +## SPDX-License-Identifier: GPL-2.0-only + +comment "Ptlrvp" + +config BOARD_INTEL_PTLRVP + bool "-> Ptlrvp" diff --git a/src/mainboard/intel/ptlrvp/Makefile.mk b/src/mainboard/intel/ptlrvp/Makefile.mk new file mode 100644 index 0000000000..aea91d577a --- /dev/null +++ b/src/mainboard/intel/ptlrvp/Makefile.mk @@ -0,0 +1,26 @@ +## SPDX-License-Identifier: GPL-2.0-only + +bootblock-y += bootblock.c + +verstage-$(CONFIG_CHROMEOS) += chromeos.c + +romstage-y += romstage.c +romstage-$(CONFIG_CHROMEOS) += chromeos.c + +ramstage-y += mainboard.c +ramstage-$(CONFIG_CHROMEOS) += chromeos.c +ramstage-y += ec.c +ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_HDA_VERB) += variants/$(VARIANT_DIR)/hda_verb.c + +smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c + +BASEBOARD_DIR:=$(call strip_quotes,$(CONFIG_BASEBOARD_DIR)) + +subdirs-y += variants/baseboard/$(BASEBOARD_DIR) +subdirs-y += variants/$(VARIANT_DIR) +subdirs-y += variants/$(VARIANT_DIR)/memory +subdirs-$(CONFIG_HAVE_SPD_IN_CBFS) += spd + +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/$(BASEBOARD_DIR)/include +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/intel/ptlrvp/board_info.txt b/src/mainboard/intel/ptlrvp/board_info.txt new file mode 100644 index 0000000000..c7de62f6c6 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/board_info.txt @@ -0,0 +1,6 @@ +Vendor name: Intel +Board name: Ptlrvp +Category: laptop +ROM protocol: SPI +ROM socketed: n +Flashrom support: y diff --git a/src/mainboard/intel/ptlrvp/bootblock.c b/src/mainboard/intel/ptlrvp/bootblock.c new file mode 100644 index 0000000000..6ee655ee58 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/bootblock.c @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include + +void bootblock_mainboard_early_init(void) +{ + const struct pad_config *pads; + size_t num; + + pads = variant_early_gpio_table(&num); + gpio_configure_pads(pads, num); +} diff --git a/src/mainboard/intel/ptlrvp/chromeos.c b/src/mainboard/intel/ptlrvp/chromeos.c new file mode 100644 index 0000000000..5ed041f52b --- /dev/null +++ b/src/mainboard/intel/ptlrvp/chromeos.c @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +void fill_lb_gpios(struct lb_gpios *gpios) +{ + struct lb_gpio chromeos_gpios[] = { +#if CONFIG(VBOOT_LID_SWITCH) + {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, +#else + /* fake LID open to avoid shutdown in depthcharge */ + {-1, ACTIVE_HIGH, 1, "lid"}, +#endif + {-1, ACTIVE_HIGH, 0, "power"}, + {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, + {-1, ACTIVE_HIGH, 0, "EC in RW"}, + }; + lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); +} + +int get_write_protect_state(void) +{ + return gpio_get(GPIO_PCH_WP); +} + +int get_ec_is_trusted(void) +{ + /* VB2_CONTEXT_EC_TRUSTED should be set according to the Ti50 boot mode. */ + return 0; +} diff --git a/src/mainboard/intel/ptlrvp/chromeos.fmd b/src/mainboard/intel/ptlrvp/chromeos.fmd new file mode 100644 index 0000000000..693f485e4a --- /dev/null +++ b/src/mainboard/intel/ptlrvp/chromeos.fmd @@ -0,0 +1,50 @@ +FLASH 32M { + SI_ALL 8M { + SI_DESC 16K + SI_EC 576K + SI_ME + } + SI_BIOS 24M { + RW_SECTION_A 8M { + VBLOCK_A 8K + FW_MAIN_A(CBFS) + RW_FWID_A 64 + } + # This section starts at the 16M boundary in SPI flash. + # PTL does not support a region crossing this boundary, + # because the SPI flash is memory-mapped into two non- + # contiguous windows. + RW_SECTION_B 8M { + VBLOCK_B 8K + FW_MAIN_B(CBFS) + RW_FWID_B 64 + } + RW_MISC 1M { + UNIFIED_MRC_CACHE(PRESERVE) 128K { + RECOVERY_MRC_CACHE 64K + RW_MRC_CACHE 64K + } + RW_ELOG(PRESERVE) 16K + RW_SHARED 16K { + SHARED_DATA 8K + VBLOCK_DEV 8K + } + RW_VPD(PRESERVE) 8K + RW_NVRAM(PRESERVE) 24K + } + RW_LEGACY(CBFS) 1M + RW_UNUSED 2M + # Make WP_RO region align with SPI vendor + # memory protected range specification. + WP_RO 4M { + RO_VPD(PRESERVE) 16K + RO_GSCVD 8K + RO_SECTION { + FMAP 2K + RO_FRID 64 + GBB@4K 12K + COREBOOT(CBFS) + } + } + } +} diff --git a/src/mainboard/intel/ptlrvp/dsdt.asl b/src/mainboard/intel/ptlrvp/dsdt.asl new file mode 100644 index 0000000000..03882c6327 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/dsdt.asl @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include + +DefinitionBlock( + "dsdt.aml", + "DSDT", + ACPI_DSDT_REV_2, + OEM_ID, + ACPI_TABLE_CREATOR, + 0x20240917 +) +{ + #include + #include + + /* global NVS and variables */ + #include + + #include + + Device (\_SB.PCI0) { + #include + #include + #include + } + +#if CONFIG(EC_GOOGLE_CHROMEEC) + /* ChromeOS Embedded Controller */ + Scope (\_SB.PCI0.LPCB) + { + /* ACPI code for EC SuperIO functions */ + #include + /* ACPI code for EC functions */ + #include + } +#endif + + #include +} diff --git a/src/mainboard/intel/ptlrvp/ec.c b/src/mainboard/intel/ptlrvp/ec.c new file mode 100644 index 0000000000..f828bc5547 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/ec.c @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +void mainboard_ec_init(void) +{ + static const struct google_chromeec_event_info info = { + .log_events = MAINBOARD_EC_LOG_EVENTS, + .sci_events = MAINBOARD_EC_SCI_EVENTS, + .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS, + .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS, + .s0ix_wake_events = MAINBOARD_EC_S0IX_WAKE_EVENTS, + }; + + printk(BIOS_DEBUG, "mainboard: EC init\n"); + + google_chromeec_events_init(&info, acpi_is_wakeup_s3()); +} diff --git a/src/mainboard/intel/ptlrvp/mainboard.c b/src/mainboard/intel/ptlrvp/mainboard.c new file mode 100644 index 0000000000..f514eb96d1 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/mainboard.c @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void __weak fw_config_gpio_padbased_override(struct pad_config *padbased_table) +{ + /* default implementation does nothing */ +} + +void mainboard_update_soc_chip_config(struct soc_intel_pantherlake_config *config) +{ + variant_update_soc_chip_config(config); +} + +void __weak variant_update_soc_chip_config(struct soc_intel_pantherlake_config *config) +{ + /* default implementation does nothing */ +} + +static void mainboard_init(void *chip_info) +{ + struct pad_config *padbased_table; + const struct pad_config *base_pads; + size_t base_num; + + padbased_table = new_padbased_table(); + base_pads = variant_gpio_table(&base_num); + gpio_padbased_override(padbased_table, base_pads, base_num); + fw_config_gpio_padbased_override(padbased_table); + gpio_configure_pads_with_padbased(padbased_table); + free(padbased_table); + baseboard_devtree_update(); +} + +void __weak baseboard_devtree_update(void) +{ + /* Override dev tree settings per baseboard */ +} + +void __weak variant_generate_s0ix_hook(enum s0ix_entry entry) +{ + /* Add board-specific MS0X entries */ + /* + if (s0ix_entry == S0IX_ENTRY) { + implement variant operations here + } + if (s0ix_entry == S0IX_EXIT) { + implement variant operations here + } + */ +} + +static void mainboard_dev_init(struct device *dev) +{ + mainboard_ec_init(); +} + +static void mainboard_enable(struct device *dev) +{ + dev->ops->init = mainboard_dev_init; +} + +struct chip_operations mainboard_ops = { + .init = mainboard_init, + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/intel/ptlrvp/romstage.c b/src/mainboard/intel/ptlrvp/romstage.c new file mode 100644 index 0000000000..7b56e28e3c --- /dev/null +++ b/src/mainboard/intel/ptlrvp/romstage.c @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +/* + * Placeholder to configure GPIO early from romstage relying on the FW_CONFIG. + * + * If any platform would like to override early GPIOs, they should override from + * the variant directory. + */ +__weak void fw_config_configure_pre_mem_gpio(void) +{ + /* Nothing to do */ +} + +void mainboard_memory_init_params(FSPM_UPD *memupd) +{ + const struct pad_config *pads; + size_t pads_num; + const struct mb_cfg *mem_config = variant_memory_params(); + bool half_populated = variant_is_half_populated(); + struct mem_spd spd_info; + + pads = variant_romstage_gpio_table(&pads_num); + if (pads_num) + gpio_configure_pads(pads, pads_num); + fw_config_configure_pre_mem_gpio(); + + memset(&spd_info, 0, sizeof(spd_info)); + variant_get_spd_info(&spd_info); + + memcfg_init(memupd, mem_config, &spd_info, half_populated); +} diff --git a/src/mainboard/intel/ptlrvp/smihandler.c b/src/mainboard/intel/ptlrvp/smihandler.c new file mode 100644 index 0000000000..9208d51613 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/smihandler.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include +#include + +void mainboard_smi_sleep(u8 slp_typ) +{ + chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS, MAINBOARD_EC_S5_WAKE_EVENTS); +} + +int mainboard_smi_apmc(u8 apmc) +{ + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); + return 0; +} + +void elog_gsmi_cb_mainboard_log_wake_source(void) +{ + google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | MAINBOARD_EC_S0IX_WAKE_EVENTS); +} + +void mainboard_smi_espi_handler(void) +{ + chromeec_smi_process_events(); +} diff --git a/src/mainboard/intel/ptlrvp/spd/Makefile.mk b/src/mainboard/intel/ptlrvp/spd/Makefile.mk new file mode 100644 index 0000000000..be4d98bd1d --- /dev/null +++ b/src/mainboard/intel/ptlrvp/spd/Makefile.mk @@ -0,0 +1,6 @@ +## SPDX-License-Identifier: GPL-2.0-or-later +## + +ifneq ($(SPD_SOURCES),) +LIB_SPD_DEPS := $(SPD_SOURCES) +endif diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h b/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h new file mode 100644 index 0000000000..2a70408e0d --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __BASEBOARD_VARIANTS_H__ +#define __BASEBOARD_VARIANTS_H__ + +#include +#include +#include +#include +#include + +/* The next set of functions return the gpio table and fill in the number of entries for + * each table. + */ + +const struct pad_config *variant_gpio_table(size_t *num); +const struct pad_config *variant_early_gpio_table(size_t *num); +const struct pad_config *variant_romstage_gpio_table(size_t *num); +void fw_config_configure_pre_mem_gpio(void); +void fw_config_gpio_padbased_override(struct pad_config *padbased_table); + +const struct mb_cfg *variant_memory_params(void); +void variant_get_spd_info(struct mem_spd *spd_info); +int variant_memory_sku(void); +bool variant_is_half_populated(void); +void variant_update_soc_chip_config(struct soc_intel_pantherlake_config *config); + +enum s0ix_entry { + S0IX_EXIT, + S0IX_ENTRY, +}; + +void variant_generate_s0ix_hook(enum s0ix_entry entry); + +/* Modify devictree settings during ramstage by baseboard */ +void baseboard_devtree_update(void); +/* Modify devictree settings during ramstage by dedicated variant */ +void variant_devtree_update(void); + +#endif /*__BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/Makefile.mk b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/Makefile.mk new file mode 100644 index 0000000000..47123cd318 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/Makefile.mk @@ -0,0 +1,4 @@ +## SPDX-License-Identifier: GPL-2.0-only + +romstage-y += memory.c +ramstage-y += ramstage.c diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/devicetree.cb b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/devicetree.cb new file mode 100644 index 0000000000..2cf249f9aa --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/devicetree.cb @@ -0,0 +1,99 @@ +chip soc/intel/pantherlake + # GPE configuration + register "pmc_gpe0_dw0" = "GPP_A" + register "pmc_gpe0_dw1" = "GPP_D" + register "pmc_gpe0_dw2" = "GPP_E" + + # For Ptlrvp variants with microchip EC: + # EC host command ranges are in 0x800-0x807 & 0x200-0x20f + # For Ptlrvp variants with ITE/Nuvoton EC: + # EC host command ranges are in 0x800-0x8ff & 0x200-0x20f + register "gen1_dec" = "CONFIG(BOARD_INTEL_PTLRVP) ? 0x00040801 : 0x00fc0801" + register "gen2_dec" = "0x000c0201" + # EC memory map range is 0x900-0x9ff + register "gen3_dec" = "0x00fc0901" + + register "usb2_ports[0]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 0 + register "usb2_ports[1]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 1 + register "usb2_ports[2]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 2 + register "usb2_ports[3]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 3 + register "usb2_ports[4]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 4 + register "usb2_ports[5]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 5 + register "usb2_ports[6]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 6 + register "usb2_ports[7]" = "USB2_PORT_EMPTY" # Disable USB2.0 Port 7 + + register "usb3_ports[0]" = "USB3_PORT_EMPTY" # Disable USB3.0 Port 0 + register "usb3_ports[1]" = "USB3_PORT_EMPTY" # Disable USB3.0 Port 1 + + register "tcss_ports[0]" = "TCSS_PORT_EMPTY" # Disable USB-C Port 0 + register "tcss_ports[1]" = "TCSS_PORT_EMPTY" # Disable USB-C Port 1 + register "tcss_ports[2]" = "TCSS_PORT_EMPTY" # Disable USB-C Port 2 + register "tcss_ports[3]" = "TCSS_PORT_EMPTY" # Disable USB-C Port 3 + + # Enable SAGv + register "sagv" = "SAGV_ENABLED" + + register "sagv_freq_mhz[0]" = "2400" + register "sagv_gear[0]" = "GEAR_4" + + register "sagv_freq_mhz[1]" = "3200" + register "sagv_gear[1]" = "GEAR_4" + + register "sagv_freq_mhz[2]" = "6000" + register "sagv_gear[2]" = "GEAR_4" + + register "sagv_freq_mhz[3]" = "6400" + register "sagv_gear[3]" = "GEAR_4" + + # Enable s0ix + register "s0ix_enable" = "true" + + # DPTF enable + register "dptf_enable" = "true" + + # Setting TCC of 100C = Tj max (110) - TCC_Offset (10) + register "tcc_offset" = "10" + + # Disable C1 C-state auto-demotion + register "disable_c1_state_auto_demotion" = "true" + # Disable PKGC-state auto-demotion + register "disable_package_c_state_demotion" = "true" + + # Enable Energy Reporting + register "pch_pm_energy_report_enable" = "true" + + # Enable CNVi BT + register "cnvi_bt_core" = "true" + + register "serial_io_uart_mode" = "{ + [PchSerialIoIndexUART0] = PchSerialIoSkipInit, + [PchSerialIoIndexUART1] = PchSerialIoDisabled, + [PchSerialIoIndexUART2] = PchSerialIoDisabled, + }" + + register "serial_io_gspi_mode" = "{ + [PchSerialIoIndexGSPI0] = PchSerialIoPci, + [PchSerialIoIndexGSPI1] = PchSerialIoPci, + [PchSerialIoIndexGSPI0A] = PchSerialIoPci, + }" + + register "pch_hda_dsp_enable" = "true" + register "pch_hda_idisp_link_tmode" = "HDA_TMODE_8T" + register "pch_hda_idisp_link_frequency" = "HDA_LINKFREQ_96MHZ" + register "pch_hda_idisp_codec_enable" = "true" + register "pch_hda_sdi_enable" = "{ true, false }" + + device domain 0 on + device ref dtt on end + device ref npu on end + device ref xhci on end + device ref pmc_shared_sram on end + device ref heci1 on end + device ref uart0 on end + device ref soc_espi on + chip ec/google/chromeec + device pnp 0c09.0 on end + end + end + end +end diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/ec.h b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/ec.h new file mode 100644 index 0000000000..f3e31b0448 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/ec.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __BASEBOARD_EC_H__ +#define __BASEBOARD_EC_H__ + +#include +#include +#include + +#define MAINBOARD_EC_SCI_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_MKBP) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX)) +#define MAINBOARD_EC_SMI_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED)) +/* EC can wake from S5 with lid or power button */ +#define MAINBOARD_EC_S5_WAKE_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON)) +/* + * EC can wake from S3/S0ix with: + * 1. Lid open + * 2. AC Connect/Disconnect + * 3. Power button + * 4. Key press + * 5. Mode change + * 6. Low battery + */ +#define MAINBOARD_EC_S3_WAKE_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_SHUTDOWN) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE) | \ + MAINBOARD_EC_S5_WAKE_EVENTS) +#define MAINBOARD_EC_S0IX_WAKE_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_HANG_DETECT) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_MUX) | \ + MAINBOARD_EC_S3_WAKE_EVENTS) +/* Log EC wake events plus EC shutdown events */ +#define MAINBOARD_EC_LOG_EVENTS \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_SHUTDOWN) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_PANIC) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN)) +/* + * ACPI related definitions for ASL code. + */ + +/* Enable EC backed ALS device in ACPI */ +#define EC_ENABLE_ALS_DEVICE + +/* Enable Keyboard Backlight */ +#define EC_ENABLE_KEYBOARD_BACKLIGHT + +/* Enable LID switch and provide wake pin for EC */ +#define EC_ENABLE_LID_SWITCH +#define EC_ENABLE_WAKE_PIN GPE_EC_WAKE + +/* Enable MKBP for buttons and switches */ +#define EC_ENABLE_MKBP_DEVICE + +/* Enable EC backed PD MCU device in ACPI */ +#define EC_ENABLE_PD_MCU_DEVICE + +#define SIO_EC_ENABLE_PS2K /* Enable PS/2 Keyboard */ +#define SIO_EC_HOST_ENABLE /* EC Host Interface Resources */ +#define SIO_EC_MEMMAP_ENABLE /* EC Memory Map Resources */ + +#endif /* __BASEBOARD_EC_H__ */ diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/gpio.h b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/gpio.h new file mode 100644 index 0000000000..5a77e4eb2c --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/include/baseboard/gpio.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __BASEBOARD_GPIO_H__ +#define __BASEBOARD_GPIO_H__ + +#include +#include + +/* FIXME: update below code as per board schematics */ +/* eSPI virtual wire reporting */ +#define EC_SCI_GPI GPE0_ESPI +/* GPIO IRQ for tight timestamps / wake support */ +#define EC_SYNC_IRQ 0 +/* WP signal to PCH */ +#define GPIO_PCH_WP 0 + +#endif /* __BASEBOARD_GPIO_H__ */ diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/memory.c b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/memory.c new file mode 100644 index 0000000000..4f621f38ce --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/memory.c @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ + +#include + +static const struct mb_cfg baseboard_memcfg = { + .type = MEM_TYPE_LP5X, + + /* TODO: Add Memory configuration */ + .ect = 1, /* Early Command Training */ +}; + +const struct mb_cfg *__weak variant_memory_params(void) +{ + return &baseboard_memcfg; +} + +int __weak variant_memory_sku(void) +{ + return 0; +} + +bool __weak variant_is_half_populated(void) +{ + return 0; +} + +void __weak variant_get_spd_info(struct mem_spd *spd_info) +{ + spd_info->topo = MEM_TOPO_MEMORY_DOWN; + spd_info->cbfs_index = variant_memory_sku(); +} diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/ramstage.c b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/ramstage.c new file mode 100644 index 0000000000..030b587579 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/baseboard/ptlrvp/ramstage.c @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include + +/* + * SKU_ID, TDP (Watts), pl1_min (milliWatts), pl1_max (milliWatts), + * pl2_min (milliWatts), pl2_max (milliWatts), pl4 (milliWatts) + */ +const struct cpu_tdp_power_limits power_optimized_limits[] = { + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_1, + .cpu_tdp = TDP_25W, + .power_limits_index = PTL_H_1_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 65000 + }, + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_2, + .cpu_tdp = TDP_25W, + .power_limits_index = PTL_H_1_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 65000 + }, + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_3, + .cpu_tdp = TDP_25W, + .power_limits_index = PTL_H_2_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 65000 + }, + { + .mch_id = PCI_DID_INTEL_PTL_H_ID_4, + .cpu_tdp = TDP_25W, + .power_limits_index = PTL_H_2_CORE, + .pl1_min_power = 10000, + .pl1_max_power = 25000, + .pl2_min_power = 50000, + .pl2_max_power = 50000, + .pl4_power = 65000 + }, +}; + +void baseboard_devtree_update(void) +{ + /* Don't optimize the power limit if booting with barrel attached */ + if (google_chromeec_is_barrel_charger_present()) + return; + + if (!google_chromeec_is_battery_present()) + variant_update_cpu_power_limits(power_optimized_limits, + ARRAY_SIZE(power_optimized_limits)); +} diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk b/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk new file mode 100644 index 0000000000..eb361dfe89 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk @@ -0,0 +1,9 @@ +## SPDX-License-Identifier: GPL-2.0-only + +bootblock-y += gpio.c +romstage-y += gpio.c +romstage-y += memory.c +romstage-$(CONFIG_FW_CONFIG) += fw_config.c +ramstage-y += gpio.c +ramstage-$(CONFIG_FW_CONFIG) += variant.c +ramstage-$(CONFIG_FW_CONFIG) += fw_config.c diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/fw_config.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/fw_config.c new file mode 100644 index 0000000000..9419caf709 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/fw_config.c @@ -0,0 +1,651 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +/* t: base table; o: override table */ +#define GPIO_PADBASED_OVERRIDE(t, o) gpio_padbased_override(t, o, ARRAY_SIZE(o)) +/* t: table */ +#define GPIO_CONFIGURE_PADS(t) gpio_configure_pads(t, ARRAY_SIZE(t)) + +static const struct pad_config i2s_enable_pads[] = { + /* I2S_MCLK1_OUT */ + PAD_CFG_NF(GPP_D09, NONE, DEEP, NF2), + /* I2S0_SCLK_HDR */ + PAD_CFG_NF(GPP_D10, NONE, DEEP, NF2), + /* I2S0_SFRM_HDR */ + PAD_CFG_NF(GPP_D11, NONE, DEEP, NF2), + /* I2S0_TXD_HDR */ + PAD_CFG_NF(GPP_D12, NONE, DEEP, NF2), + /* I2S0_RXD_HDR */ + PAD_CFG_NF(GPP_D13, NONE, DEEP, NF2), + /* I2S1_SCLK_HDR */ + PAD_CFG_NF(GPP_S00, NONE, DEEP, NF6), + /* I2S1_SFRM_HDR */ + PAD_CFG_NF(GPP_S01, NONE, DEEP, NF6), + /* I2S1_TXD_HDR */ + PAD_CFG_NF(GPP_S02, NONE, DEEP, NF6), + /* I2S1_RXD_HDR */ + PAD_CFG_NF(GPP_S03, NONE, DEEP, NF6), + + /* DMIC_CLK */ + PAD_CFG_NF(GPP_D16, NONE, DEEP, NF3), + /* DMIC_DATA */ + PAD_CFG_NF(GPP_D17, NONE, DEEP, NF3), + + /* DMIC_CLK */ + PAD_CFG_NF(GPP_S04, NONE, DEEP, NF5), + /* DMIC_DATA */ + PAD_CFG_NF(GPP_S05, NONE, DEEP, NF5), +}; + +static const struct pad_config hda_enable_pads[] = { + /* HDA_BCLK */ + PAD_CFG_NF(GPP_D10, NONE, DEEP, NF1), + /* HDA_SYNC */ + PAD_CFG_NF(GPP_D11, NATIVE, DEEP, NF1), + /* HDA_SDO */ + PAD_CFG_NF(GPP_D12, NATIVE, DEEP, NF1), + /* HDA_SDI_0 */ + PAD_CFG_NF(GPP_D13, NATIVE, DEEP, NF1), + /* HDA_RST_B */ + PAD_CFG_NF(GPP_D16, NONE, DEEP, NF1), + /* HDA_SDI_1 */ + PAD_CFG_NF(GPP_D17, NATIVE, DEEP, NF1), + + /* DMIC_CLK */ + PAD_CFG_NF(GPP_S04, NONE, DEEP, NF5), + /* DMIC_DATA */ + PAD_CFG_NF(GPP_S05, NONE, DEEP, NF5), +}; + +static const struct pad_config sndw_external_codec_enable_pads[] = { + /* Soundwire - External codec - JE Header */ + /* SNDW3_CLK */ + PAD_CFG_NF(GPP_S00, NONE, DEEP, NF1), + /* SNDW3_DATA0 */ + PAD_CFG_NF(GPP_S01, NONE, DEEP, NF1), + /* SNDW0_CLK */ + PAD_CFG_NF(GPP_S02, NONE, DEEP, NF3), + /* SNDW0_DATA */ + PAD_CFG_NF(GPP_S03, NONE, DEEP, NF3), + /* SNDW2_CLK */ + PAD_CFG_NF(GPP_S04, NONE, DEEP, NF2), + /* SNDW2_DATA */ + PAD_CFG_NF(GPP_S05, NONE, DEEP, NF2), + /* SNDW1_CLK */ + PAD_CFG_NF(GPP_S06, NONE, DEEP, NF3), + /* SNDW1_DATA */ + PAD_CFG_NF(GPP_S07, NONE, DEEP, NF3), + + /* GPP_D13: RST_HP_L */ + PAD_CFG_GPO(GPP_D13, 1, PLTRST), +}; + +static const struct pad_config bt_i2s_enable_pads[] = { + /* GPP_V30 : [] ==> BT_I2S_BCLK - SSP2 */ + PAD_CFG_NF(GPP_VGPIO30, NONE, DEEP, NF3), + /* GPP_V31 : [] ==> BT_I2S_SYNC - SSP2 */ + PAD_CFG_NF(GPP_VGPIO31, NONE, DEEP, NF3), + /* GPP_V32 : [] ==> BT_I2S_SDO - SSP2 */ + PAD_CFG_NF(GPP_VGPIO32, NONE, DEEP, NF3), + /* GPP_V33 : [] ==> BT_I2S_SDI - SSP2 */ + PAD_CFG_NF(GPP_VGPIO33, NONE, DEEP, NF3), + /* GPP_V34 : [] ==> SSP_SCLK */ + PAD_CFG_NF(GPP_VGPIO34, NONE, DEEP, NF1), + /* GPP_V35 : [] ==> SSP_SFRM */ + PAD_CFG_NF(GPP_VGPIO35, NONE, DEEP, NF1), + /* GPP_V36 : [] ==> SSP_TXD */ + PAD_CFG_NF(GPP_VGPIO36, NONE, DEEP, NF1), + /* GPP_V37 : [] ==> SSP_RXD */ + PAD_CFG_NF(GPP_VGPIO37, NONE, DEEP, NF1), +}; + +static const struct pad_config bt_i2s_disable_pads[] = { + /* GPP_V30 : [] ==> BT_I2S_BCLK */ + PAD_NC(GPP_VGPIO30, NONE), + /* GPP_V31 : [] ==> BT_I2S_SYNC */ + PAD_NC(GPP_VGPIO31, NONE), + /* GPP_V32 : [] ==> BT_I2S_SDO */ + PAD_NC(GPP_VGPIO32, NONE), + /* GPP_V33 : [] ==> BT_I2S_SDI */ + PAD_NC(GPP_VGPIO33, NONE), + /* GPP_V34 : [] ==> SSP2_SCLK */ + PAD_NC(GPP_VGPIO34, NONE), + /* GPP_V35 : [] ==> SSP2_SFRM */ + PAD_NC(GPP_VGPIO35, NONE), + /* GPP_V36 : [] ==> SSP_TXD */ + PAD_NC(GPP_VGPIO36, NONE), + /* GPP_V37 : [] ==> SSP_RXD */ + PAD_NC(GPP_VGPIO37, NONE), +}; + +static const struct pad_config sndw_alc722_enable_pads[] = { + /* SNDW3_CLK */ + PAD_CFG_NF(GPP_S00, NONE, DEEP, NF1), + /* SNDW3_DATA0 */ + PAD_CFG_NF(GPP_S01, NONE, DEEP, NF1), + /* SNDW3_DATA1 */ + PAD_CFG_NF(GPP_S02, NONE, DEEP, NF1), + /* SNDW3_DATA2 */ + PAD_CFG_NF(GPP_S03, NONE, DEEP, NF1), + /* DMIC_CLK_A0 */ + PAD_CFG_NF(GPP_S04, NONE, DEEP, NF5), + /* DMIC_DATA_0 */ + PAD_CFG_NF(GPP_S05, NONE, DEEP, NF5), + /* SNDW1_CLK */ + PAD_CFG_NF(GPP_S06, NONE, DEEP, NF3), + /* SNDW1_DATA */ + PAD_CFG_NF(GPP_S07, NONE, DEEP, NF3), + + /* DMIC_CLK */ + PAD_CFG_NF(GPP_D16, NONE, DEEP, NF3), + /* DMIC_DATA */ + PAD_CFG_NF(GPP_D17, NONE, DEEP, NF3), +}; + +static const struct pad_config audio_disable_pads[] = { + PAD_NC(GPP_S00, NONE), + PAD_NC(GPP_S01, NONE), + PAD_NC(GPP_S02, NONE), + PAD_NC(GPP_S03, NONE), + PAD_NC(GPP_S04, NONE), + PAD_NC(GPP_S05, NONE), + PAD_NC(GPP_S06, NONE), + PAD_NC(GPP_S07, NONE), + PAD_NC(GPP_D09, NONE), + PAD_NC(GPP_D10, NONE), + PAD_NC(GPP_D11, NONE), + PAD_NC(GPP_D12, NONE), + PAD_NC(GPP_D13, NONE), + PAD_NC(GPP_D16, NONE), + PAD_NC(GPP_D17, NONE), +}; + +static const struct pad_config pre_mem_x1slot_pads[] = { + /* GPP_A08: X1_PCIE_SLOT_PWR_EN */ + PAD_CFG_GPO(GPP_A08, 0, PLTRST), +}; +static const struct pad_config x1slot_pads[] = { + /* GPP_A08: X1_PCIE_SLOT_PWR_EN */ + PAD_CFG_GPO(GPP_A08, 1, PLTRST), + /* GPP_D19: X1_DT_PCIE_RST_N */ + PAD_CFG_GPO(GPP_D19, 1, PLTRST), + /* GPP_B25: X1_SLOT_WAKE_N */ + PAD_CFG_GPI_SCI_LOW(GPP_B25, NONE, DEEP, LEVEL), +}; + +static const struct pad_config x1slot_disable_pads[] = { + /* GPP_A08: X1_PCIE_SLOT_PWR_EN */ + PAD_CFG_GPO(GPP_A08, 0, PLTRST), + /* GPP_D19: X1_DT_PCIE_RST_N */ + PAD_NC(GPP_D19, NONE), + /* GPP_B25: X1_SLOT_WAKE_N */ + PAD_NC(GPP_B25, NONE) +}; + +/* + * WWAN: power sequence requires three stages: + * step 1: 3.3V power, FCP# (Full Card Power), RST#, and PERST# off + * step 2: deassert FCP# + * step 3: deassert RST# first, and then PERST#. + * NOTE: Since PERST# is gated by platform reset, PERST# deassertion will happen + * at much later time and time between RST# and PERSET# is guaranteed. + */ +static const struct pad_config pre_mem_wwan_pwr_seq1_pads[] = { + /* GPP_H16: WWAN_PWREN */ + PAD_CFG_GPO(GPP_H16, 1, PLTRST), + /* GPP_A09: M.2_WWAN_FCP_OFF_N */ + PAD_CFG_GPO(GPP_A09, 0, PLTRST), + /* GPP_B20: M.2_WWAN_RST_N */ + PAD_CFG_GPO(GPP_B20, 0, PLTRST), + /* GPP_D03: M.2_WWAN_PERST_GPIO_N */ + PAD_CFG_GPO(GPP_D03, 0, PLTRST), +}; + +static const struct pad_config pre_mem_wwan_pwr_seq2_pads[] = { + /* GPP_A09: M.2_WWAN_FCP_OFF_N */ + PAD_CFG_GPO(GPP_A09, 1, PLTRST), +}; + +static const struct pad_config wwan_pwr_seq3_pads[] = { + /* GPP_D03: M.2_WWAN_PERST_GPIO_N */ + PAD_CFG_GPO(GPP_D03, 1, PLTRST), + /* GPP_B20: M.2_WWAN_RST_N */ + PAD_CFG_GPO(GPP_B20, 1, PLTRST), + /* GPP_E02: WWAN_WAKE_GPIO_N */ + PAD_CFG_GPI_SCI_LOW(GPP_E02, NONE, DEEP, LEVEL), +}; + +static const struct pad_config wwan_disable_pads[] = { + /* GPP_A09: M.2_WWAN_FCP_OFF_N */ + PAD_NC(GPP_A09, NONE), + /* GPP_D03: M.2_WWAN_PERST_GPIO_N */ + PAD_NC(GPP_D03, NONE), + /* GPP_B20: M.2_WWAN_RST_N */ + PAD_NC(GPP_B20, NONE), + /* GPP_H16: WWAN_PWREN */ + PAD_NC(GPP_H16, NONE), + /* GPP_A10: M.2_WWAN_DISABLE_N */ + PAD_NC(GPP_A10, NONE), + /* GPP_E02: WWAN_WAKE_GPIO_N */ + PAD_NC(GPP_E02, NONE), +}; + +/* Gen4 NVME: at the top M.2 slot */ +static const struct pad_config pre_mem_gen4_ssd_pwr_pads[] = { + /* GPP_B10: GEN4_SSD_PWREN */ + PAD_CFG_GPO(GPP_B10, 0, PLTRST), +}; + +static const struct pad_config gen4_ssd_pads[] = { + /* GPP_B10: GEN4_SSD_PWREN */ + PAD_CFG_GPO(GPP_B10, 1, PLTRST), + /* GPP_B09: M2_GEN4_SSD_RESET_N */ + PAD_CFG_GPO(GPP_B09, 1, PLTRST), +}; + +static const struct pad_config ufs_enable_pads[] = { + /* GPP_D21: GPP_D21_UFS_REFCLK */ + PAD_CFG_NF(GPP_D21, NONE, DEEP, NF1), +}; + +/* Gen5 NVME: at the bottom M.2 slot */ +static const struct pad_config pre_mem_gen5_ssd_pwr_pads[] = { + /* GPP_B16: GEN5_SSD_PWREN */ + PAD_CFG_GPO(GPP_B16, 0, PLTRST), +}; + +static const struct pad_config gen5_ssd_pads[] = { + /* GPP_B16: GEN5_SSD_PWREN */ + PAD_CFG_GPO(GPP_B16, 1, PLTRST), + /* GPP_E03: M2_GEN5_SSD_RESET_N */ + PAD_CFG_GPO(GPP_E03, 1, PLTRST), +}; + +static const struct pad_config peg_x4slot_wake_disable_pads[] = { + /* GPP_D24: PEG_SLOT_WAKE_N */ + PAD_NC(GPP_D24, NONE), + /* GPP_D25: X4_SLOT_WAKE_N */ + PAD_NC(GPP_D25, NONE), +}; + +static const struct pad_config pcie_wlan_enable_pads[] = { + /* GPP_A11: WLAN_RST_N */ + PAD_CFG_GPO(GPP_A11, 1, PLTRST), + /* GPP_A12: WIFI_WAKE_N */ + PAD_CFG_GPI_SCI_LOW(GPP_A12, NONE, DEEP, LEVEL), +}; + +static const struct pad_config pcie_wlan_disable_pads[] = { + /* GPP_A11: WLAN_RST_N */ + PAD_NC(GPP_A11, NONE), + /* GPP_A12: WIFI_WAKE_N */ + PAD_NC(GPP_A12, NONE), +}; + +static const struct pad_config cnvi_enable_pads[] = { + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F00, NONE, DEEP, NF1), + /* GPP_F01: M.2_CNV_BRI_RSP_BT_UART2_RXD */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F01, NONE, DEEP, NF1), + /* GPP_F02: M.2_CNV_RGI_DT_BT_UART2_TXD */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F02, NONE, DEEP, NF1), + /* GPP_F03: M.2_CNV_RGI_RSP_BT_UART2_CTS_N */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F03, NONE, DEEP, NF1), + /* GPP_F04: CNV_RF_RESET_R_N */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F04, NONE, DEEP, NF1), + /* GPP_F05: CRF_CLKREQ_R */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F05, NONE, DEEP, NF3), + /* GPP_A16: BT_RF_KILL_N */ + PAD_CFG_GPO(GPP_A16, 1, DEEP), + /* GPP_A17: WIFI_RF_KILL_N */ + PAD_CFG_GPO(GPP_A17, 1, DEEP), +}; + +static const struct pad_config cnvi_disable_pads[] = { + /* GPP_F00: M.2_CNV_BRI_DT_BT_UART2_RTS_N */ + PAD_NC(GPP_F00, NONE), + /* GPP_F01: M.2_CNV_BRI_RSP_BT_UART2_RXD */ + PAD_NC(GPP_F01, NONE), + /* GPP_F02: M.2_CNV_RGI_DT_BT_UART2_TXD */ + PAD_NC(GPP_F02, NONE), + /* GPP_F03: M.2_CNV_RGI_RSP_BT_UART2_CTS_N */ + PAD_NC(GPP_F03, NONE), + /* GPP_F04: CNV_RF_RESET_R_N */ + PAD_NC(GPP_F04, NONE), + /* GPP_F05: CRF_CLKREQ_R */ + PAD_NC(GPP_F05, NONE), + + /* GPP_A16: BT_RF_KILL_N */ + PAD_NC(GPP_A16, NONE), + /* GPP_A17: WIFI_RF_KILL_N */ + PAD_NC(GPP_A17, NONE), +}; + +static const struct pad_config touchscreen_disable_pads[] = { + /* GPP_F08: TCH_PNL1_PWR_EN */ + PAD_CFG_GPO(GPP_F08, 0, PLTRST), + + /* GPP_E11: THC0_SPI1_CLK_TCH_PNL1 */ + PAD_NC(GPP_E11, NONE), + /* GPP_E12: THC0_SPI1_IO_0_I2C4_SCL_TCH_PNL1 NF8: I2C4_SCL */ + PAD_NC(GPP_E12, NONE), + /* GPP_E13: THC0_SPI1_IO_1_I2C4_SDA_TCH_PNL1 NF8: I2C4 SDA */ + PAD_NC(GPP_E13, NONE), + /* GPP_E14: THC0_SPI1_IO_2_TCH_PNL1 */ + PAD_NC(GPP_E14, NONE), + /* GPP_E15: THC0_SPI1_IO_3_TCH_PNL1 */ + PAD_NC(GPP_E15, NONE), + /* GPP_E16: THC0_SPI1_RST_N_TCH_PNL1 */ + PAD_NC(GPP_E16, NONE), + /* GPP_E17: THC0_SPI1_CS0_N_TCH_PNL1 */ + PAD_NC(GPP_E17, NONE), + /* GPP_E18: THC0_SPI1_INT_N_TCH_PNL1 */ + PAD_NC(GPP_E18, NONE), +}; + +static const struct pad_config touchscreen_lpss_i2c_enable_pads[] = { + /* GPP_E11: THC0_SPI1_CLK_TCH_PNL1 */ + PAD_NC(GPP_E11, NONE), + /* GPP_E12: THC0_SPI1_IO_0_I2C4_SCL_TCH_PNL1 NF8: I2C4_SCL */ + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF8), + /* GPP_E13: THC0_SPI1_IO_1_I2C4_SDA_TCH_PNL1 NF8: I2C4 SDA */ + PAD_CFG_NF(GPP_E13, NONE, DEEP, NF8), + /* GPP_E14: THC0_SPI1_IO_2_TCH_PNL1 */ + PAD_NC(GPP_E14, NONE), + /* GPP_E15: THC0_SPI1_IO_3_TCH_PNL1 */ + PAD_NC(GPP_E15, NONE), + /* GPP_E16: THC0_SPI1_RST_N_TCH_PNL1 */ + PAD_CFG_GPO(GPP_E16, 1, DEEP), + /* GPP_E17: THC0_SPI1_CS0_N_TCH_PNL1 */ + PAD_NC(GPP_E17, NONE), + /* GPP_E18: THC0_SPI1_INT_N_TCH_PNL1 */ + PAD_CFG_GPI_APIC(GPP_E18, NONE, PLTRST, LEVEL, NONE), +}; + +static const struct pad_config touchscreen_thc_i2c_enable_pads[] = { + /* GPP_E11: THC0_SPI1_CLK_TCH_PNL1 */ + PAD_NC(GPP_E11, NONE), + /* GPP_E12: THC0_SPI1_IO_0_I2C4_SCL_TCH_PNL1 NF1: THC I2C0_SCL */ + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF1), + /* GPP_E13: THC0_SPI1_IO_1_I2C4_SDA_TCH_PNL1 NF1: THC I2C0 SDA */ + PAD_CFG_NF(GPP_E13, NONE, DEEP, NF1), + /* GPP_E14: THC0_SPI1_IO_2_TCH_PNL1 */ + PAD_NC(GPP_E14, NONE), + /* GPP_E15: THC0_SPI1_IO_3_TCH_PNL1 */ + PAD_NC(GPP_E15, NONE), + /* GPP_E16: THC0_SPI1_RST_N_TCH_PNL1 */ + PAD_CFG_GPO(GPP_E16, 1, DEEP), + /* GPP_E17: THC0_SPI1_CS0_N_TCH_PNL1 */ + PAD_NC(GPP_E17, NONE), + /* GPP_E18: THC0_SPI1_INT_N_TCH_PNL1 */ + PAD_CFG_GPI_APIC(GPP_E18, NONE, PLTRST, LEVEL, NONE), +}; + +static const struct pad_config touchscreen_gspi_enable_pads[] = { + /* GPP_E11: THC0_SPI1_CLK_TCH_PNL1 NF5: GSPI0 */ + PAD_CFG_NF(GPP_E11, NONE, DEEP, NF5), + /* GPP_E12: THC0_SPI1_IO_0_I2C4_SCL_TCH_PNL1 NF5: GSPI0 */ + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF5), + /* GPP_E13: THC0_SPI1_IO_1_I2C4_SDA_TCH_PNL1 NF5: GSPI0 */ + PAD_CFG_NF(GPP_E13, NONE, DEEP, NF5), + /* GPP_E14: THC0_SPI1_IO_2_TCH_PNL1 */ + PAD_NC(GPP_E14, NONE), + /* GPP_E15: THC0_SPI1_IO_3_TCH_PNL1 */ + PAD_NC(GPP_E15, NONE), + /* GPP_E16: THC0_SPI1_RST_N_TCH_PNL1 */ + PAD_CFG_GPO(GPP_E16, 1, DEEP), + /* GPP_E17: THC0_SPI1_CS0_N_TCH_PNL1 NF5: GSPI0 */ + PAD_CFG_NF(GPP_E17, NONE, DEEP, NF5), + /* GPP_E18: THC0_SPI1_INT_N_TCH_PNL1 */ + PAD_CFG_GPI_APIC(GPP_E18, NONE, PLTRST, EDGE_SINGLE, INVERT) +}; + +static const struct pad_config touchscreen_thc_spi_enable_pads[] = { + /* GPP_E11: THC0_SPI1_CLK_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E11, NONE, DEEP, NF3), + /* GPP_E12: THC0_SPI1_IO_0_I2C4_SCL_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF3), + /* GPP_E13: THC0_SPI1_IO_1_I2C4_SDA_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E13, NONE, DEEP, NF3), + /* GPP_E14: THC0_SPI1_IO_2_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E14, NONE, DEEP, NF3), + /* GPP_E15: THC0_SPI1_IO_3_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E15, NONE, DEEP, NF3), + /* GPP_E16: THC0_SPI1_RST_N_TCH_PNL1 NF3: THC HID-SPI */ + /* THC NOTE: use GPO instead of NF for THC0 Rst */ + PAD_CFG_GPO(GPP_E16, 1, DEEP), + /* GPP_E17: THC0_SPI1_CS0_N_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E17, NONE, DEEP, NF3), + /* GPP_E18: THC0_SPI1_INT_N_TCH_PNL1 NF3: THC HID-SPI */ + PAD_CFG_NF(GPP_E18, NONE, DEEP, NF3), +}; + +static const struct pad_config touchpad_thc_i2c_enable_pads[] = { + /* GPP_F12: NF1: thc_i2c1_scl */ + PAD_CFG_NF(GPP_F12, NONE, DEEP, NF1), + /* GPP_F13: NF1: thc_i2c1_sda */ + PAD_CFG_NF(GPP_F13, NONE, DEEP, NF1), +}; + +static const struct pad_config touchpad_lpss_i2c_enable_pads[] = { + /* GPP_F12: THC_I2C1_SCL_TCH_PAD */ + PAD_CFG_NF(GPP_F12, NONE, DEEP, NF8), + /* GPP_F13: THC_I2C1_SDA_TCH_PAD */ + PAD_CFG_NF(GPP_F13, NONE, DEEP, NF8), + /* GPP_A13: TCH_PAD_INT_N */ + PAD_CFG_GPI_IRQ_WAKE(GPP_A13, NONE, PWROK, EDGE_SINGLE, INVERT), +}; + +static const struct pad_config touchpad_i2c_disable_pads[] = { + /* GPP_F12: THC_I2C1_SCL_TCH_PAD */ + PAD_NC(GPP_F12, NONE), + /* GPP_F13: THC_I2C1_SDA_TCH_PAD */ + PAD_NC(GPP_F13, NONE), + /* GPP_A13: TCH_PAD_INT_N */ + PAD_NC(GPP_A13, NONE), +}; + +static const struct pad_config ish_disable_pads[] = { + /* GPP_D06: NC */ + PAD_NC(GPP_D06, NONE), + /* GPP_E05: NC */ + PAD_NC(GPP_E05, NONE), + /* GPP_F23: NC */ + PAD_NC(GPP_F23, NONE), +}; + +static const struct pad_config ish_enable_pads[] = { + /* GPP_D06: ISH_UART0_TXD */ + PAD_CFG_NF(GPP_D06, NONE, DEEP, NF2), + /* GPP_E05: ISH_GP_7_SNSR_HDR */ + PAD_CFG_NF(GPP_E05, NONE, DEEP, NF4), + /* GPP_F23: ISH_GP_9A */ + PAD_CFG_NF(GPP_F23, NONE, DEEP, NF8), +}; + +static const struct pad_config fp_disable_pads[] = { + PAD_NC(GPP_C15, NONE), + /* GPP_D01: MOD_TCSS1_TYP_A_VBUS_EN */ + PAD_CFG_GPO(GPP_D01, 1, DEEP), + /* FIXME: b/390031369 + * use dedicated GPIO PIN for codec enable + * when FPS is enabled. + */ + /* GPP_E19: CODEC_EN */ + PAD_CFG_GPO(GPP_E19, 1, PLTRST), + PAD_NC(GPP_E20, NONE), + PAD_NC(GPP_F14, NONE), + PAD_NC(GPP_F15, NONE), + PAD_NC(GPP_F16, NONE), + PAD_NC(GPP_F18, NONE), +}; + +static const struct pad_config fp_enable_pads[] = { + /* GPP_C15: FPS_RST_N */ + PAD_CFG_GPO_LOCK(GPP_C15, 1, LOCK_CONFIG), + /* GPP_D01: FPS_SOC_INT_L */ + PAD_CFG_GPI_IRQ_WAKE(GPP_D01, NONE, PWROK, LEVEL, INVERT), + /* GPP_E19: FPMCU_PWREN */ + PAD_CFG_GPO(GPP_E19, 1, DEEP), + /* GPP_E20: FPMCU_FW_UPDATE */ + PAD_CFG_GPO_LOCK(GPP_E20, 0, LOCK_CONFIG), + /* GPP_F14: GPSI0A_MOSI */ + PAD_CFG_NF(GPP_F14, NONE, DEEP, NF8), + /* GPP_F15: GSPI0A_MISO */ + PAD_CFG_NF(GPP_F15, NONE, DEEP, NF8), + /* GPP_F16: GPSI0A_CLK */ + PAD_CFG_NF(GPP_F16, NONE, DEEP, NF8), + /* GPP_F18: GSPI0A_CS0 */ + PAD_CFG_NF(GPP_F18, NONE, DEEP, NF8), +}; + +static const struct pad_config pre_mem_fp_enable_pads[] = { + /* GPP_C15: FPS_RST_N */ + PAD_CFG_GPO(GPP_C15, 0, DEEP), +}; + +void fw_config_configure_pre_mem_gpio(void) +{ + if (!fw_config_is_provisioned()) { + printk(BIOS_WARNING, "FW_CONFIG is not provisioned, Exiting\n"); + return; + } + + if (!fw_config_probe(FW_CONFIG(CELLULAR, CELLULAR_ABSENT))) + GPIO_CONFIGURE_PADS(pre_mem_wwan_pwr_seq1_pads); + + if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME_GEN4))) { + GPIO_CONFIGURE_PADS(pre_mem_gen4_ssd_pwr_pads); + } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME_GEN5))) { + GPIO_CONFIGURE_PADS(pre_mem_gen5_ssd_pwr_pads); + } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UNKNOWN))) { + GPIO_CONFIGURE_PADS(pre_mem_gen4_ssd_pwr_pads); + GPIO_CONFIGURE_PADS(pre_mem_gen5_ssd_pwr_pads); + } + + if (!fw_config_probe(FW_CONFIG(SD, SD_NONE))) + GPIO_CONFIGURE_PADS(pre_mem_x1slot_pads); + + /* + * NOTE: We place WWAN sequence 2 here. According to the WWAN FIBOCOM + * FM350-GL datasheet, the minimum time requirement (Tpr: time between 3.3V + * and FCP#) is '0'. Therefore, it will be fine even though there is no + * GPIO configured for other PADs via fw_config to have the time delay + * introduced in between sequence 1 and 2. Also, FCP# was not the last PAD + * configured in sequence 1. Although the Tpr is '0' in the datasheet, three + * stages are preserved at this time to guarantee the sequence shown in the + * datasheet timing diagram. + */ + if (!fw_config_probe(FW_CONFIG(CELLULAR, CELLULAR_ABSENT))) + GPIO_CONFIGURE_PADS(pre_mem_wwan_pwr_seq2_pads); + + if (fw_config_probe(FW_CONFIG(FP, FP_PRESENT))) + GPIO_CONFIGURE_PADS(pre_mem_fp_enable_pads); + +} + +void fw_config_gpio_padbased_override(struct pad_config *padbased_table) +{ + if (!fw_config_is_provisioned()) { + printk(BIOS_WARNING, "FW_CONFIG is not provisioned, Exiting\n"); + return; + } + + if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME_GEN4))) { + GPIO_PADBASED_OVERRIDE(padbased_table, gen4_ssd_pads); + } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME_GEN5))) { + GPIO_PADBASED_OVERRIDE(padbased_table, gen5_ssd_pads); + } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UFS))) { + GPIO_PADBASED_OVERRIDE(padbased_table, ufs_enable_pads); + } else if (fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UNKNOWN))) { + GPIO_PADBASED_OVERRIDE(padbased_table, gen4_ssd_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, gen5_ssd_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, ufs_enable_pads); + } + + if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_NONE))) { + GPIO_PADBASED_OVERRIDE(padbased_table, audio_disable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); + } else if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_MAX98360_ALC5682I_I2S))) { + printk(BIOS_INFO, "Configure GPIOs for I2S MAX98360 ALC5682 audio.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, i2s_enable_pads); + printk(BIOS_INFO, "Configure GPIOs for BT offload mode.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_enable_pads); + } else if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_MAX98373_ALC5682_SNDW))) { + GPIO_PADBASED_OVERRIDE(padbased_table, sndw_external_codec_enable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); + } else if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_ALC722_SNDW)) || + fw_config_probe(FW_CONFIG(AUDIO, AUDIO_ALC721_SNDW))) { + printk(BIOS_INFO, "Configure GPIOs for Soundwire audio.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, sndw_alc722_enable_pads); + printk(BIOS_INFO, "Configure GPIOs for BT offload mode.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_enable_pads); + } else if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_ALC256_HDA))) { + printk(BIOS_INFO, "Configure GPIOs for HDA ALC 256 mode.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, hda_enable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); + } + + if (fw_config_probe(FW_CONFIG(WIFI, WIFI_PCIE_6)) || + fw_config_probe(FW_CONFIG(WIFI, WIFI_PCIE_7))) { + GPIO_PADBASED_OVERRIDE(padbased_table, pcie_wlan_enable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, cnvi_disable_pads); + } else if (fw_config_probe(FW_CONFIG(WIFI, WIFI_CNVI_6)) || + fw_config_probe(FW_CONFIG(WIFI, WIFI_CNVI_7))) { + GPIO_PADBASED_OVERRIDE(padbased_table, cnvi_enable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, pcie_wlan_disable_pads); + } + + if (fw_config_probe(FW_CONFIG(CELLULAR, CELLULAR_PCIE)) || + fw_config_probe(FW_CONFIG(CELLULAR, CELLULAR_USB))) { + GPIO_PADBASED_OVERRIDE(padbased_table, wwan_pwr_seq3_pads); + } else { + GPIO_PADBASED_OVERRIDE(padbased_table, wwan_disable_pads); + } + + if (fw_config_probe(FW_CONFIG(SD, SD_NONE))) + GPIO_PADBASED_OVERRIDE(padbased_table, x1slot_disable_pads); + else + GPIO_PADBASED_OVERRIDE(padbased_table, x1slot_pads); + + if (fw_config_probe(FW_CONFIG(TOUCHPAD, TOUCHPAD_LPSS_I2C))) + GPIO_PADBASED_OVERRIDE(padbased_table, touchpad_lpss_i2c_enable_pads); + else if (fw_config_probe(FW_CONFIG(TOUCHPAD, TOUCHPAD_THC_I2C))) + GPIO_PADBASED_OVERRIDE(padbased_table, touchpad_thc_i2c_enable_pads); + else + GPIO_PADBASED_OVERRIDE(padbased_table, touchpad_i2c_disable_pads); + + if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_LPSS_I2C))) + GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_lpss_i2c_enable_pads); + else if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_THC_I2C))) + GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_thc_i2c_enable_pads); + else if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_GSPI))) + GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_gspi_enable_pads); + else if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_THC_SPI))) + GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_thc_spi_enable_pads); + else + GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_disable_pads); + + if (fw_config_probe(FW_CONFIG(ISH, ISH_DISABLE))) + GPIO_PADBASED_OVERRIDE(padbased_table, ish_disable_pads); + else + GPIO_PADBASED_OVERRIDE(padbased_table, ish_enable_pads); + + /* NOTE: disable PEG (x8 slot) and x4 slot wake for now */ + GPIO_PADBASED_OVERRIDE(padbased_table, peg_x4slot_wake_disable_pads); + + if (fw_config_probe(FW_CONFIG(FP, FP_PRESENT))) + GPIO_CONFIGURE_PADS(fp_enable_pads); + else + GPIO_CONFIGURE_PADS(fp_disable_pads); +} diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c new file mode 100644 index 0000000000..1accd4d597 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c @@ -0,0 +1,419 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +/* Pad configuration in ramstage*/ +static const struct pad_config gpio_table[] = { + /* GPP_A00: ESPI_IO0_EC_R */ + /* GPP_A00 : GPP_A00 ==> ESPI_IO0_EC_R configured on reset, do not touch */ + + /* GPP_A01: ESPI_IO1_EC_R */ + /* GPP_A01 : GPP_A01 ==> ESPI_IO1_EC_R configured on reset, do not touch */ + + /* GPP_A02: ESPI_IO2_EC_R */ + /* GPP_A02 : GPP_A02 ==> ESPI_IO2_EC_R configured on reset, do not touch */ + + /* GPP_A03: ESPI_IO3_EC_R */ + /* GPP_A03 : GPP_A03 ==> ESPI_IO3_EC_R configured on reset, do not touch */ + + /* GPP_A04: ESPI_CS0_EC_R_N */ + /* GPP_A04 : GPP_A04 ==> ESPI_CS0_HDR_L configured on reset, do not touch */ + + /* GPP_A05: ESPI_CLK_EC_R */ + /* GPP_A05 : GPP_A05 ==> ESPI_CLK_HDR configured on reset, do not touch */ + + /* GPP_A06: ESPI_RST_EC_R_N */ + /* GPP_A06 : GPP_A06 ==> ESPI_RST_HDR configured on reset, do not touch */ + + /* GPP_A09: M.2_WWAN_FCP_OFF_N */ + PAD_CFG_GPO(GPP_A09, 1, PLTRST), + /* GPP_A10: M.2_WWAN_DISABLE_N */ + PAD_CFG_GPO(GPP_A10, 1, PLTRST), + /* GPP_A11: WLAN_RST_N */ + PAD_CFG_GPO(GPP_A11, 1, PLTRST), + /* GPP_A12: WIFI_WAKE_N */ + PAD_CFG_GPI_SCI_LOW(GPP_A12, NONE, DEEP, LEVEL), + /* GPP_A15: GPP_A15_DNX_FORCE_RELOAD */ + PAD_CFG_NF(GPP_A15, NONE, DEEP, NF1), + /* GPP_A16: BT_RF_KILL_N */ + PAD_CFG_GPO(GPP_A16, 1, DEEP), + /* GPP_A17: WIFI_RF_KILL_N */ + PAD_CFG_GPO(GPP_A17, 1, DEEP), + + /* GPP_B00: USBC_SML_CLK_PD */ + PAD_CFG_NF(GPP_B00, NONE, DEEP, NF1), + /* GPP_B01: USBC_SML_DATA_PD */ + PAD_CFG_NF(GPP_B01, NONE, DEEP, NF1), + /* GPP_B02: ISH_I2C0_SDA_SNSR_HDR */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_B02, NONE, DEEP, NF3), + /* GPP_B03: ISH_I2C0_SCL_SNSR_HDR */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_B03, NONE, DEEP, NF3), + /* GPP_B04: ISH_GP_0_SNSR_HDR */ + PAD_CFG_NF(GPP_B04, NONE, DEEP, NF4), + /* GPP_B05: ISH_GP_1_SNSR_HDR */ + PAD_CFG_NF(GPP_B05, NONE, DEEP, NF4), + /* GPP_B06: ISH_GP_2_SNSR_HDR */ + PAD_CFG_NF(GPP_B06, NONE, DEEP, NF4), + /* GPP_B07: ISH_GP_3_SNSR_HDR */ + PAD_CFG_NF(GPP_B07, NONE, DEEP, NF4), + /* GPP_B08: ISH_GP_4_SNSR_HDR */ + PAD_CFG_NF(GPP_B08, NONE, DEEP, NF4), + /* GPP_B09: M2_GEN4_SSD_RESET_N */ + PAD_CFG_GPO(GPP_B09, 1, PLTRST), + /* GPP_B10: GEN4_SSD_PWREN */ + PAD_CFG_GPO(GPP_B10, 1, PLTRST), + /* GPP_B11: MOD_TCSS1_DISP_HPD3 */ + PAD_CFG_NF(GPP_B11, NONE, DEEP, NF2), + /* GPP_B12: PM_SLP_S0_N */ + PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1), + /* GPP_B13: PLT_RST_N */ + PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), + /* GPP_B14: MOD_TCSS2_DISP_HPD4 */ + PAD_CFG_NF(GPP_B14, NONE, DEEP, NF2), + /* GPP_B15: MOD_TCSS_USB_TYP_A_OC3_N */ + PAD_CFG_NF(GPP_B15, NONE, DEEP, NF1), + /* GPP_B16: GEN5_SSD_PWREN */ + PAD_CFG_GPO(GPP_B16, 1, PLTRST), + /* GPP_B17: Not used */ + PAD_NC(GPP_B17, NONE), + /* GPP_B18: ISH_I2C2_SDA_SNSR_HDR */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_B18, NONE, DEEP, NF1), + /* GPP_B19: ISH_I2C2_SCL_SNSR_HDR */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_B19, NONE, DEEP, NF1), + /* GPP_B20: M.2_WWAN_RST_N */ + PAD_CFG_GPO(GPP_B20, 1, PLTRST), + /* GPP_B21: TCP_RETIMER_FORCE_PWR */ + PAD_CFG_GPO(GPP_B21, 0, DEEP), + /* GPP_B22: ISH_GP_5_SNSR_HDR */ + PAD_CFG_NF(GPP_B22, NONE, DEEP, NF4), + /* GPP_B23: ISH_GP_6_SNSR_HDR */ + PAD_CFG_NF(GPP_B23, NONE, DEEP, NF4), + /* GPP_B24: ESPI_ALERT0_EC_R_N */ + PAD_NC(GPP_B24, NONE), + + /* GPP_C00: GPP_C0_SMBCLK */ + PAD_CFG_NF(GPP_C00, NONE, DEEP, NF1), + /* GPP_C01: GPP_C1_SMBDATA */ + PAD_CFG_NF(GPP_C01, NONE, DEEP, NF1), + /* GPP_C02: Not used */ + PAD_NC(GPP_C02, NONE), + /* GPP_C03: TCP_LAN_SML0_SCL_R */ + PAD_CFG_NF(GPP_C03, NONE, DEEP, NF1), + /* GPP_C04: TCP_LAN_SML0_SDA_R */ + PAD_CFG_NF(GPP_C04, NONE, DEEP, NF1), + /* GPP_C06: SML1_CLK */ + PAD_CFG_NF(GPP_C06, NONE, DEEP, NF1), + /* GPP_C07: SML1_DATA */ + PAD_CFG_NF(GPP_C07, NONE, DEEP, NF1), + /* GPP_C09: CLKREQ0_X8_GEN5_DT_CEM_SLOT_N */ + PAD_CFG_NF(GPP_C09, NONE, DEEP, NF1), + /* GPP_C10: CLKREQ1_X4_GEN5_M2_SSD_N */ + PAD_CFG_NF(GPP_C10, NONE, DEEP, NF1), + /* GPP_C11: CLKREQ2_X1_GEN4_DT_CEM_SLOT_N */ + PAD_CFG_NF(GPP_C11, NONE, DEEP, NF1), + /* GPP_C12: CLKREQ3_X1_GEN1_GBE_LAN_N */ + PAD_CFG_NF(GPP_C12, NONE, DEEP, NF1), + /* GPP_C13: CLKREQ4_X1_GEN4_M2_WLAN_N */ + PAD_CFG_NF(GPP_C13, NONE, DEEP, NF1), + /* GPP_C14: CLKREQ5_X1_GEN4_M2_WWAN_N */ + PAD_CFG_NF(GPP_C14, NONE, DEEP, NF1), + /* GPP_C16: TBT_LSX0_TXD */ + PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1), + /* GPP_C17: TBT_LSX0_RXD */ + PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1), + /* GPP_C18: TBT_LSX1_TXD */ + PAD_CFG_NF(GPP_C18, NONE, DEEP, NF1), + /* GPP_C19: TBT_LSX1_RXD */ + PAD_CFG_NF(GPP_C19, NONE, DEEP, NF1), + /* GPP_C20: MOD_TCSS1_LS_TX_DDC_SCL */ + PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), + /* GPP_C21: MOD_TCSS1_LS_RX_DDC_SDA */ + PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), + /* GPP_C22: MOD_TCSS2_LS_TX_DDC_SCL */ + PAD_CFG_NF(GPP_C22, NONE, DEEP, NF2), + /* GPP_C23: MOD_TCSS2_LS_RX_DDC_SDA */ + PAD_CFG_NF(GPP_C23, NONE, DEEP, NF2), + + /* GPP_D00: IMGCLKOUT_1 */ + PAD_CFG_NF(GPP_D00, NONE, DEEP, NF1), + /* GPP_D02: Not used */ + PAD_NC(GPP_D02, NONE), + /* GPP_D03: M.2_WWAN_PERST_GPIO_N */ + PAD_CFG_GPO(GPP_D03, 1, PLTRST), + /* GPP_D04: IMGCLKOUT_0 */ + PAD_CFG_NF(GPP_D04, NONE, DEEP, NF1), + /* GPP_D05: disable ISH_UART0_RXD */ + PAD_NC(GPP_D05, NONE), + /* GPP_D07: NC */ + PAD_NC(GPP_D07, NONE), + /* GPP_D08: NC */ + PAD_NC(GPP_D08, NONE), + /* GPP_D09: PEG_SLOT_RST_N */ + PAD_CFG_GPO(GPP_D09, 1, PLTRST), + /* GPP_D10: HDA_BCLK */ + PAD_CFG_NF(GPP_D10, NONE, DEEP, NF1), + /* GPP_D11: HDA_SYNC */ + PAD_CFG_NF(GPP_D11, NONE, DEEP, NF1), + /* GPP_D12: HDA_SDO */ + PAD_CFG_NF(GPP_D12, NONE, DEEP, NF1), + /* GPP_D13: HDA_SDI0 */ + PAD_CFG_NF(GPP_D13, NONE, DEEP, NF1), + /* GPP_D14: COINLESS_MODE_SELECT */ + PAD_CFG_GPI_TRIG_OWN(GPP_D14, NONE, PLTRST, LEVEL, ACPI), + /* GPP_D15: SPI_TPM_INT_N */ + PAD_CFG_GPI_APIC_LOCK(GPP_D15, NONE, LEVEL, INVERT, LOCK_CONFIG), + /* GPP_D16: HDA_RST_N_HDR */ + PAD_CFG_NF(GPP_D16, NONE, DEEP, NF1), + /* GPP_D17: HDA_SDI1_HDR */ + PAD_CFG_NF(GPP_D17, NONE, DEEP, NF1), + /* GPP_D18: CLKREQ6_X4_GEN4_M2_SSD_N */ + PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), + /* GPP_D20: CSE_EARLY_SW */ + PAD_CFG_GPI_SCI_HIGH(GPP_D20, NONE, DEEP, LEVEL), + /* GPP_D21: NC */ + PAD_NC(GPP_D21, NONE), + /* GPP_D22: BPKI3C_SDA */ + PAD_CFG_NF(GPP_D22, NONE, DEEP, NF1), + /* GPP_D23: BPKI3C_SCL */ + PAD_CFG_NF(GPP_D23, NONE, DEEP, NF1), + /* GPP_D24: PEG_SLOT_WAKE_N */ + PAD_CFG_GPI_SCI_LOW(GPP_D24, NONE, DEEP, LEVEL), + /* GPP_D25: X4_SLOT_WAKE_N */ + PAD_CFG_GPI_SCI_LOW(GPP_D25, NONE, DEEP, LEVEL), + + /* GPP_E01: CRD2_RST_N */ + PAD_CFG_GPO(GPP_E01, 1, PLTRST), + /* GPP_E02: WWAN_WAKE_GPIO_N */ + PAD_CFG_GPI_SCI_LOW(GPP_E02, NONE, DEEP, LEVEL), + /* GPP_E03: M2_GEN5_SSD_RESET_N */ + PAD_CFG_GPO(GPP_E03, 1, PLTRST), + /* GPP_E06: SECURE_CAM_SW */ + PAD_CFG_GPI_TRIG_OWN(GPP_E06, NONE, PLTRST, LEVEL, ACPI), + /* GPP_E07: Not used */ + PAD_NC(GPP_E07, NONE), + /* GPP_E08: Not used */ + PAD_NC(GPP_E08, NONE), + /* GPP_E09: USB_RD_FP_CONN_12_OC0_N */ + PAD_CFG_NF(GPP_E09, NONE, DEEP, NF1), + /* GPP_E10: CRD1_RST_N */ + PAD_CFG_GPO(GPP_E10, 1, PLTRST), + /* GPP_E11: THC0_SPI1_CLK_TCH_PNL1 */ + PAD_CFG_NF(GPP_E11, NONE, DEEP, NF3), + /* GPP_E12: THC0_SPI1_IO_0_I2C4_SCL_TCH_PNL1 */ + PAD_CFG_NF(GPP_E12, NONE, DEEP, NF3), + /* GPP_E13: THC0_SPI1_IO_1_I2C4_SDA_TCH_PNL1 */ + PAD_CFG_NF(GPP_E13, NONE, DEEP, NF3), + /* GPP_E14: THC0_SPI1_IO_2_TCH_PNL1 */ + PAD_CFG_NF(GPP_E14, NONE, DEEP, NF3), + /* GPP_E15: THC0_SPI1_IO_3_TCH_PNL1 */ + PAD_CFG_NF(GPP_E15, NONE, DEEP, NF3), + /* GPP_E16: THC0_SPI1_RST_N_TCH_PNL1 */ + /* THC NOTE: use GPO instead of GPO for THC0 Rst */ + PAD_CFG_GPO(GPP_E16, 1, DEEP), + /* GPP_E17: THC0_SPI1_CS0_N_TCH_PNL1 */ + PAD_CFG_NF(GPP_E17, NONE, DEEP, NF3), + /* GPP_E18: THC0_SPI1_INT_N_TCH_PNL1 */ + PAD_CFG_NF(GPP_E18, NONE, DEEP, NF3), + /* GPP_E21: I2C_PMC_PD_INT_N */ + PAD_CFG_NF(GPP_E21, NONE, DEEP, NF1), + /* GPP_E22: THC0_SPI1_DSYNC */ + PAD_CFG_NF(GPP_E22, NONE, DEEP, NF3), + + /* GPP_F00: M.2_CNV_BRI_DT_BT_UART2_RTS_N */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F00, NONE, DEEP, NF1), + /* GPP_F01: M.2_CNV_BRI_RSP_BT_UART2_RXD */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F01, NONE, DEEP, NF1), + /* GPP_F02: M.2_CNV_RGI_DT_BT_UART2_TXD */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F02, NONE, DEEP, NF1), + /* GPP_F03: M.2_CNV_RGI_RSP_BT_UART2_CTS_N */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F03, NONE, DEEP, NF1), + /* GPP_F04: CNV_RF_RESET_R_N */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F04, NONE, DEEP, NF1), + /* GPP_F05: CRF_CLKREQ_R */ + /* NOTE: IOSSTAGE: 'Ignore' for S0ix */ + PAD_CFG_NF_IOSTANDBY_IGNORE(GPP_F05, NONE, DEEP, NF3), + /* GPP_F06: WLAN_WWAN_COEX3 */ + PAD_CFG_NF(GPP_F06, NONE, DEEP, NF1), + /* GPP_F07: IMGCLKOUT_2 */ + PAD_CFG_NF(GPP_F07, NONE, DEEP, NF2), + /* GPP_F08: TCH_PNL1_PWR_EN */ + PAD_CFG_GPO(GPP_F08, 1, PLTRST), + /* GPP_F09: NC */ + PAD_NC(GPP_F09, NONE), + /* GPP_F10: PEG_SLOT_PWR_EN_N */ + PAD_CFG_GPO(GPP_F10, 0, PLTRST), + /* GPP_F11: MOD_TCSS2_TYP_A_VBUS_EN */ + PAD_CFG_GPO(GPP_F11, 1, DEEP), + /* GPP_F12: THC_I2C1_SCL_TCH_PAD */ + PAD_CFG_NF(GPP_F12, NONE, DEEP, NF8), + /* GPP_F13: THC_I2C1_SDA_TCH_PAD */ + PAD_CFG_NF(GPP_F13, NONE, DEEP, NF8), + /* GPP_F17: Not used */ + PAD_CFG_GPI_INT(GPP_F17, NONE, PLTRST, EDGE_BOTH), + /* GPP_F19: GPP_PRIVACY_LED_CAM2 */ + PAD_CFG_GPO(GPP_F19, 0, PLTRST), + /* GPP_F20: GPP_PRIVACY_LED_CAM1_CVS_HST_WAKE */ + PAD_CFG_GPO(GPP_F20, 0, PLTRST), + /* GPP_F22: THC1_SPI2_DSYNC */ + PAD_CFG_NF(GPP_F22, NONE, DEEP, NF3), + + /* GPP_H00: Not used */ + PAD_NC(GPP_H00, NONE), + /* GPP_H01: CRD_CAM_STROBE */ + PAD_CFG_GPO(GPP_H01, 0, PLTRST), + /* GPP_H02: DEBUG_TRACE_PNP */ + PAD_CFG_GPO(GPP_H02, 1, PLTRST), + /* GPP_H03: MIC MUTE */ + PAD_CFG_NF(GPP_H03, NONE, DEEP, NF1), + /* GPP_H04: I2C2_SDA_CAM_FLSH */ + PAD_CFG_NF(GPP_H04, NONE, DEEP, NF1), + /* GPP_H05: I2C2_SCL_CAM_FLSH */ + PAD_CFG_NF(GPP_H05, NONE, DEEP, NF1), + /* GPP_H06: I2C3_SDA_PSS */ + PAD_CFG_NF(GPP_H06, NONE, DEEP, NF1), + /* GPP_H07: I2C3_SCL_PSS */ + PAD_CFG_NF(GPP_H07, NONE, DEEP, NF1), + /* GPP_H08: UART0_BUF_RXD */ + PAD_CFG_NF(GPP_H08, NONE, DEEP, NF1), + /* GPP_H09: UART0_BUF_TXD */ + PAD_CFG_NF(GPP_H09, NONE, DEEP, NF1), + /* GPP_H10: UART0_BUF_RTS */ + PAD_CFG_NF(GPP_H10, NONE, DEEP, NF1), + /* GPP_H11: UART0_BUF_CTS */ + PAD_CFG_NF(GPP_H11, NONE, DEEP, NF1), + /* GPP_H13: CPU_C10_GATE_N_R */ + PAD_CFG_NF(GPP_H13, NONE, DEEP, NF1), + /* GPP_H14: NC */ + PAD_NC(GPP_H14, NONE), + /* GPP_H15: NC */ + PAD_NC(GPP_H15, NONE), + /* GPP_H16: WWAN_PWREN */ + PAD_CFG_GPO(GPP_H16, 1, PLTRST), + /* GPP_H17: MIC MUTE LED */ + PAD_CFG_NF(GPP_H17, NONE, DEEP, NF1), + /* GPP_H19: I3C0_SDA_HDR */ + PAD_CFG_NF(GPP_H19, NONE, DEEP, NF2), + /* GPP_H20: I3C0_SCL_HDR */ + PAD_CFG_NF(GPP_H20, NONE, DEEP, NF2), + /* GPP_H21: I2C1_SDA_I3C1_SDA_CAM_FLSH_CVS */ + PAD_CFG_NF(GPP_H21, NONE, DEEP, NF1), + /* GPP_H22: I2C1_SCL_I3C1_SCL_CAM_FLSH_CVS */ + PAD_CFG_NF(GPP_H22, NONE, DEEP, NF1), + + /* GPP_S00: SNDW3_CLK_CODEC */ + PAD_CFG_NF(GPP_S00, NONE, DEEP, NF1), + /* GPP_S01: SNDW3_DATA0_CODEC */ + PAD_CFG_NF(GPP_S01, NONE, DEEP, NF1), + /* GPP_S02: SNDW3_DATA1_CODEC */ + PAD_CFG_NF(GPP_S02, NONE, DEEP, NF1), + /* GPP_S03: SNDW3_DATA2_CODEC */ + PAD_CFG_NF(GPP_S03, NONE, DEEP, NF1), + /* GPP_S04: SNDW2_CLK */ + PAD_CFG_NF(GPP_S04, NONE, DEEP, NF2), + /* GPP_S05: SNDW2_DATA0 */ + PAD_CFG_NF(GPP_S05, NONE, DEEP, NF2), + /* GPP_S06: SNDW1_CLK */ + PAD_CFG_NF(GPP_S06, NONE, DEEP, NF3), + /* GPP_S07: SNDW1_DATA0 */ + PAD_CFG_NF(GPP_S07, NONE, DEEP, NF3), + + /* GPP_V00: PM_BATLOW_N */ + PAD_CFG_NF(GPP_V00, NONE, DEEP, NF1), + /* GPP_V01: BC_ACOK_MCP */ + PAD_CFG_NF(GPP_V01, NONE, DEEP, NF1), + /* GPP_V02: LANWAKE_N_R */ + PAD_CFG_NF(GPP_V02, NONE, DEEP, NF1), + /* GPP_V03: PWRBTN_MCP_N */ + PAD_CFG_NF(GPP_V03, NONE, DEEP, NF1), + /* GPP_V04: PM_SLP_S3_N */ + PAD_CFG_NF(GPP_V04, NONE, DEEP, NF1), + /* GPP_V05: PM_SLP_S4_N */ + PAD_CFG_NF(GPP_V05, NONE, DEEP, NF1), + /* GPP_V06: PM_SLP_A_N */ + PAD_CFG_NF(GPP_V06, NONE, DEEP, NF1), + /* GPP_V07: Not used */ + PAD_NC(GPP_V07, NONE), + /* GPP_V08: SLP_WLAN_N */ + PAD_CFG_NF(GPP_V08, NONE, DEEP, NF1), + /* GPP_V09: PM_SLP_S5_N */ + PAD_CFG_NF(GPP_V09, NONE, DEEP, NF1), + /* GPP_V10: LANPHYPC_R_N */ + PAD_CFG_NF(GPP_V10, NONE, DEEP, NF1), + /* GPP_V11: PM_SLP_LAN_N */ + PAD_CFG_NF(GPP_V11, NONE, DEEP, NF1), + /* GPP_V12: WAKE_N */ + PAD_CFG_NF(GPP_V12, NONE, DEEP, NF1), + /* GPP_V13: GPP_V13_CATERR_N */ + PAD_CFG_NF(GPP_V13, NONE, DEEP, NF1), + /* GPP_V14: GPP_V14_FORCEPR_N */ + PAD_CFG_NF(GPP_V14, NONE, DEEP, NF1), + /* GPP_V15: GPP_V15_THERMTRIP_N */ + PAD_CFG_NF(GPP_V15, NONE, DEEP, NF1), + /* GPP_V16: GPP_V16_VCCST_EN */ + PAD_CFG_NF(GPP_V16, NONE, DEEP, NF1), + /* GPP_V17: TCP_RT_S0IX_ENTRY_EXIT_N */ + PAD_CFG_GPO(GPP_V17, 1, DEEP), +}; + +/* Early pad configuration in bootblock */ +static const struct pad_config early_gpio_table[] = { + /* GPP_H08: UART0_BUF_RXD */ + PAD_CFG_NF(GPP_H08, NONE, DEEP, NF1), + /* GPP_H09: UART0_BUF_TXD */ + PAD_CFG_NF(GPP_H09, NONE, DEEP, NF1), + + /* GPP_H06: I2C3_SDA_PSS */ + PAD_CFG_NF(GPP_H06, NONE, DEEP, NF1), + /* GPP_H07: I2C3_SCL_PSS */ + PAD_CFG_NF(GPP_H07, NONE, DEEP, NF1), + /* GPP_D15: SPI_TPM_INT_N */ + PAD_CFG_GPI_APIC(GPP_D15, NONE, PLTRST, LEVEL, INVERT), +}; + +/* Pad configuration in romstage */ +static const struct pad_config romstage_gpio_table[] = { + /* GPP_C00: GPP_C0_SMBCLK */ + PAD_CFG_NF(GPP_C00, NONE, DEEP, NF1), + /* GPP_C01: GPP_C1_SMBDATA */ + PAD_CFG_NF(GPP_C01, NONE, DEEP, NF1), +}; + +const struct pad_config *variant_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(gpio_table); + return gpio_table; +} + +const struct pad_config *variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} + +/* Create the stub for romstage gpio, typically use for power sequence */ +const struct pad_config *variant_romstage_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(romstage_gpio_table); + return romstage_gpio_table; +} + +static const struct cros_gpio cros_gpios[] = { + CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE0_NAME), + CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE1_NAME), + CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE2_NAME), + CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE3_NAME), +}; + +DECLARE_CROS_GPIOS(cros_gpios); diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/hda_verb.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/hda_verb.c new file mode 100644 index 0000000000..2f703b78ee --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/hda_verb.c @@ -0,0 +1,126 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +const u32 cim_verb_data[] = { + /* coreboot specific header */ + 0x10ec0256, /* Codec Vendor / Device ID: Realtek ALC256 */ + 0x10ec12ac, /* Subsystem ID */ + 0x00000013, /* Number of jacks (NID entries) */ + + AZALIA_RESET(0x1), + /* NID 0x01, HDA Codec Subsystem ID Verb Table */ + AZALIA_SUBVENDOR(0, 0x10ec12ac), + + /* Pin Widget Verb Table */ + /* + * DMIC + * Requirement is to use PCH DMIC. Hence, + * commented out codec's Internal DMIC. + * AZALIA_PIN_CFG(0, 0x12, 0x90A60130), + * AZALIA_PIN_CFG(0, 0x13, 0x40000000), + */ + /* Pin widget 0x14 - Front (Port-D) */ + AZALIA_PIN_CFG(0, 0x14, 0x90170110), + /* Pin widget 0x18 - NPC */ + AZALIA_PIN_CFG(0, 0x18, 0x411111F0), + /* Pin widget 0x19 - MIC2 (Port-F) */ + AZALIA_PIN_CFG(0, 0x19, 0x04A11040), + /* Pin widget 0x1A - LINE1 (Port-C) */ + AZALIA_PIN_CFG(0, 0x1a, 0x411111F0), + /* Pin widget 0x1B - NPC */ + AZALIA_PIN_CFG(0, 0x1b, 0x411111F0), + /* Pin widget 0x1D - BEEP-IN */ + AZALIA_PIN_CFG(0, 0x1d, 0x40610041), + /* Pin widget 0x1E - NPC */ + AZALIA_PIN_CFG(0, 0x1e, 0x411111F0), + /* Pin widget 0x21 - HP1-OUT (Port-I) */ + AZALIA_PIN_CFG(0, 0x21, 0x04211020), + /* + * Widget node 0x20 - 1 + * Codec hidden reset and speaker power 2W/4ohm + */ + 0x0205001A, + 0x0204C003, + 0x02050038, + 0x02047901, + /* + * Widget node 0x20 - 2 + * Class D power on Reset + */ + 0x0205003C, + 0x02040354, + 0x0205003C, + 0x02040314, + /* + * Widget node 0x20 - 3 + * Disable AGC and set AGC limit to -1.5dB + */ + 0x02050016, + 0x02040C50, + 0x02050012, + 0x0204EBC1, + /* + * Widget node 0x20 - 4 + * Set AGC Post gain +1.5dB then Enable AGC + */ + 0x02050013, + 0x02044023, + 0x02050016, + 0x02040E50, + /* + * Widget node 0x20 - 5 + * Silence detector enabling + Set EAPD to verb control + */ + 0x02050037, + 0x0204FE15, + 0x02050010, + 0x02040020, + /* + * Widget node 0x20 - 6 + * Silence data mode Threshold (-90dB) + */ + 0x02050030, + 0x0204A000, + 0x0205001B, + 0x02040A4B, + /* + * Widget node 0x20 - 7 + * Default setting-1 + */ + 0x05750003, + 0x05740DA3, + 0x02050046, + 0x02040004, + /* + * Widget node 0x20 - 8 + * support 1 pin detect two port + */ + 0x02050009, + 0x0204E003, + 0x0205000A, + 0x02047770, + /* + * Widget node 0x20 - 9 + * To set LDO1/LDO2 as default + */ + 0x02050008, + 0x02046A0C, + 0x02050008, + 0x02046A0C, +}; + +const u32 pc_beep_verbs[] = { + /* Dos beep path - 1 */ + 0x01470C00, + 0x02050036, + 0x02047151, + 0x01470740, + /* Dos beep path - 2 */ + 0x0143b000, + 0x01470C02, + 0x01470C02, + 0x01470C02, +}; + +AZALIA_ARRAY_SIZES; diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/ec.h b/src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/ec.h new file mode 100644 index 0000000000..4fc0622f15 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/ec.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef MAINBOARD_EC_H +#define MAINBOARD_EC_H + +#include + +#endif /* MAINBOARD_GPIO_H */ diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/gpio.h b/src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/gpio.h new file mode 100644 index 0000000000..238a99e0ed --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/include/variant/gpio.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __MAINBOARD_GPIO_H__ +#define __MAINBOARD_GPIO_H__ + +#include + +/* TODO: Add GPIO as per ptlrvp board */ +/* EC wake is LAN_WAKE# which is a special DeepSX wake pin */ +#define GPE_EC_WAKE GPE0_LAN_WAK + +#endif /* __MAINBOARD_GPIO_H__ */ diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c new file mode 100644 index 0000000000..e0908adabd --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include + +static const struct mb_cfg lp5_mem_config = { + .type = MEM_TYPE_LP5X, + + .lpx_dq_map = { + .ddr0 = { + .dq0 = { 13, 14, 12, 15, 11, 10, 8, 9, }, + .dq1 = { 7, 5, 4, 6, 0, 3, 1, 2 }, + }, + .ddr1 = { + .dq0 = { 1, 3, 0, 2, 7, 4, 6, 5, }, + .dq1 = { 12, 13, 14, 15, 11, 10, 9, 8 }, + }, + .ddr2 = { + .dq0 = { 0, 2, 1, 3, 6, 4, 7, 5 }, + .dq1 = { 14, 13, 15, 12, 8, 11, 10, 9, }, + }, + .ddr3 = { + .dq0 = { 6, 5, 7, 4, 2, 3, 1, 0, }, + .dq1 = { 10, 8, 11, 9, 12, 15, 13, 14 }, + }, + .ddr4 = { + .dq0 = { 2, 1, 3, 0, 4, 7, 5, 6 }, + .dq1 = { 15, 14, 12, 13, 9, 11, 10, 8, }, + }, + .ddr5 = { + .dq0 = { 6, 5, 7, 4, 3, 1, 0, 2, }, + .dq1 = { 10, 9, 11, 8, 13, 14, 12, 15 }, + }, + .ddr6 = { + .dq0 = { 9, 10, 11, 8, 14, 12, 13, 15, }, + .dq1 = { 0, 1, 2, 3, 5, 7, 4, 6 }, + }, + .ddr7 = { + .dq0 = { 0, 1, 2, 3, 7, 5, 6, 4, }, + .dq1 = { 14, 13, 15, 12, 10, 8, 11, 9 }, + }, + }, + + .lpx_dqs_map = { + .ddr0 = { .dqs0 = 1, .dqs1 = 0 }, + .ddr1 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr2 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr3 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr4 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr5 = { .dqs0 = 0, .dqs1 = 1 }, + .ddr6 = { .dqs0 = 1, .dqs1 = 0 }, + .ddr7 = { .dqs0 = 0, .dqs1 = 1 } + }, + + .ect = true, /* Early Command Training */ + + .lp_ddr_dq_dqs_re_training = 1, + + .user_bd = BOARD_TYPE_ULT_ULX, + + .lp5x_config = { + .ccc_config = 0xFF, + }, +}; + +const struct mb_cfg *variant_memory_params(void) +{ + return &lp5_mem_config; +} + +void variant_get_spd_info(struct mem_spd *spd_info) +{ + spd_info->topo = MEM_TOPO_MEMORY_DOWN; + spd_info->cbfs_index = 0; +} diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk new file mode 100644 index 0000000000..14126ce67d --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# This is an auto-generated file. Do not edit!! +# Generated by: +# ./util/spd_tools/bin/part_id_gen PTL lp5 src/mainboard/intel/ptlrvp/variants/ptlrvp/memory src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt + +SPD_SOURCES = +SPD_SOURCES += spd/lp5/set-0/spd-7.hex # ID = 0(0b0000) Parts = H58G56BK7BX068 diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt new file mode 100644 index 0000000000..21082111da --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# This is an auto-generated file. Do not edit!! +# Generated by: +# ./util/spd_tools/bin/part_id_gen PTL lp5 src/mainboard/intel/ptlrvp/variants/ptlrvp/memory src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt + +DRAM Part Name ID to assign +H58G56BK7BX068 0 (0000) diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt new file mode 100644 index 0000000000..17ee7efc60 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt @@ -0,0 +1,12 @@ +# This is a CSV file containing a list of memory parts used by this variant. +# One part per line with an optional fixed ID in column 2. +# Only include a fixed ID if it is required for legacy reasons! +# Generated IDs are dependent on the order of parts in this file, +# so new parts must always be added at the end of the file! +# +# Generate an updated Makefile.mk and dram_id.generated.txt by running the +# part_id_gen tool from util/spd_tools. +# See util/spd_tools/README.md for more details and instructions. + +# Part Name +H58G56BK7BX068 diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/overridetree.cb b/src/mainboard/intel/ptlrvp/variants/ptlrvp/overridetree.cb new file mode 100644 index 0000000000..cb4c21a1f7 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/overridetree.cb @@ -0,0 +1,890 @@ +fw_config + field AUDIO 0 3 + option AUDIO_NONE 0 + option AUDIO_MAX98373_ALC5682_SNDW 1 + option AUDIO_ALC722_SNDW 2 + option AUDIO_ALC256_HDA 3 + option AUDIO_MAX98360_ALC5682I_I2S 4 + option AUDIO_ALC721_SNDW 5 + end + field WIFI 4 5 + option WIFI_CNVI_6 0 + option WIFI_CNVI_7 1 + option WIFI_PCIE_6 2 + option WIFI_PCIE_7 3 + end + field CELLULAR 6 7 + option CELLULAR_ABSENT 0 + option CELLULAR_USB 1 + option CELLULAR_PCIE 2 + end + field TOUCHSCREEN 8 10 + option TOUCHSCREEN_NONE 0 + option TOUCHSCREEN_LPSS_I2C 1 + option TOUCHSCREEN_GSPI 2 + option TOUCHSCREEN_THC_SPI 3 + option TOUCHSCREEN_THC_I2C 4 + end + field TOUCHPAD 11 12 + option TOUCHPAD_NONE 0 + option TOUCHPAD_THC_I2C 1 + option TOUCHPAD_LPSS_I2C 2 + end + field SD 13 14 + option SD_NONE 0 + option SD_GENSYS 1 + option SD_BAYHUB 2 + end + field STORAGE 15 16 + option STORAGE_UNKNOWN 0 + option STORAGE_NVME_GEN4 1 + option STORAGE_NVME_GEN5 2 + option STORAGE_UFS 3 + end + field FP 17 + option FP_ABSENT 0 + option FP_PRESENT 1 + end + field DISPLAY 18 + option DISPLAY_ABSENT 0 + option DISPLAY_PRESENT 1 + end + field KB 19 + option KB_ABSENT 0 + option KB_PRESENT 1 + end + field UFC 20 21 + option UFC_ABSENT 0 + option UFC_MIPI 1 + option UFC_USB 2 + end + field WFC 22 23 + option WFC_ABSENT 0 + option WFC_MIPI 1 + option WFC_USB 2 + end + field ISH 24 + option ISH_DISABLE 0 + option ISH_ENABLE 1 + end +end + +chip soc/intel/pantherlake + + register "usb2_ports[0]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C0 + register "usb2_ports[1]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C1 + register "usb2_ports[2]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C2 + register "usb2_ports[3]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C3 + register "usb2_ports[4]" = "USB2_PORT_MID(OC0)" # Type-A Port A0 + register "usb2_ports[5]" = "USB2_PORT_MID(OC0)" # Type-A Port A1 / WWAN with rework + register "usb2_ports[7]" = "USB2_PORT_MID(OC_SKIP)" # CNVi BT or discrete BT + + register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC0)" # USB3.2 x1 Type-A Con #1 + register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC0)" # USB3.2 x1 Type-A Con #2 / M.2 WWAN with rework + + register "tcss_ports[0]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + register "tcss_ports[1]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + register "tcss_ports[2]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + register "tcss_ports[3]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + + register "tcss_cap_policy[0]" = "TCSS_TYPE_C_PORT_FULL_FUN" + register "tcss_cap_policy[1]" = "TCSS_TYPE_C_PORT_FULL_FUN" + register "tcss_cap_policy[2]" = "TCSS_TYPE_C_PORT_FULL_FUN" + register "tcss_cap_policy[3]" = "TCSS_TYPE_C_PORT_FULL_FUN" + + # Enable EDP in PortA + register "ddi_port_A_config" = "1" + register "ddi_ports_config" = "{ + [DDI_PORT_A] = DDI_ENABLE_HPD, + }" + + register "serial_io_i2c_mode" = "{ + [PchSerialIoIndexI2C0] = PchSerialIoPci, + [PchSerialIoIndexI2C1] = PchSerialIoPci, + [PchSerialIoIndexI2C2] = PchSerialIoPci, + [PchSerialIoIndexI2C3] = PchSerialIoPci, + [PchSerialIoIndexI2C4] = PchSerialIoPci, + [PchSerialIoIndexI2C5] = PchSerialIoPci, + }" + + register "serial_io_gspi_mode" = "{ + [PchSerialIoIndexGSPI0] = PchSerialIoPci, + [PchSerialIoIndexGSPI1] = PchSerialIoDisabled, + [PchSerialIoIndexGSPI0A] = PchSerialIoDisabled, + }" + + # Intel Common SoC Config + #+-------------------+---------------------------+ + #| Field | Value | + #+-------------------+---------------------------+ + #| I2C1 | Camera(CRD1) | + #| I2C2 | Camera(CRD2) | + #| I2C3 | Audio, TPM(cr50) | + #| I2C4 | Touchscreen | + #| I2C5 | Touchpad | + #+-------------------+---------------------------+ + register "common_soc_config" = "{ + .chipset_lockdown = CHIPSET_LOCKDOWN_COREBOOT, + .i2c[1] = { + .speed = I2C_SPEED_FAST, + }, + .i2c[2] = { + .speed = I2C_SPEED_FAST, + }, + .i2c[3] = { + .early_init = 1, + .speed = I2C_SPEED_FAST, + }, + .i2c[4] = { + .speed = I2C_SPEED_FAST, + }, + .i2c[5] = { + .speed = I2C_SPEED_FAST, + }, + }" + + device domain 0 on + device ref igpu on + probe DISPLAY DISPLAY_PRESENT + chip drivers/gfx/generic + register "device_count" = "5" + # DDIA for eDP + register "device[0].name" = ""LCD0"" + register "device[0].type" = "panel" + # DDIB for HDMI + # If HDMI is not enumerated in the kernel, then no GFX device should be added for DDIB + register "device[1].name" = ""DD01"" + # TCP0 (DP-1) for port C0 + register "device[2].name" = ""DD02"" + register "device[2].use_pld" = "true" + register "device[2].pld" = "ACPI_PLD_TYPE_C(LEFT, LEFT, ACPI_PLD_GROUP(1, 1))" + # TCP1 (DP-2) for port C1 + register "device[3].name" = ""DD03"" + register "device[3].use_pld" = "true" + register "device[3].pld" = "ACPI_PLD_TYPE_C(LEFT, RIGHT, ACPI_PLD_GROUP(2, 1))" + # TCP2 (DP-3) for port C2 + register "device[4].name" = ""DD04"" + register "device[4].use_pld" = "true" + register "device[4].pld" = "ACPI_PLD_TYPE_C(RIGHT, LEFT, ACPI_PLD_GROUP(3, 1))" + device generic 0 on end + end + end + + device ref dtt on + chip drivers/intel/dptf + ## sensor information + register "options.tsr[0].desc" = ""DDR_SOC"" + register "options.tsr[1].desc" = ""Ambient"" + register "options.tsr[2].desc" = ""Charger"" + register "options.tsr[3].desc" = ""wwan"" + + ## Active Policy + # FIXME: below values are initial reference values only + register "policies.active" = "{ + [0] = { + .target = DPTF_TEMP_SENSOR_0, + .thresholds = { + TEMP_PCT(70, 97), + TEMP_PCT(65, 90), + TEMP_PCT(60, 80), + TEMP_PCT(55, 75), + TEMP_PCT(50, 65), + TEMP_PCT(45, 45), + TEMP_PCT(43, 30), + } + }, + [1] = { + .target = DPTF_TEMP_SENSOR_1, + .thresholds = { + TEMP_PCT(70, 97), + TEMP_PCT(65, 90), + TEMP_PCT(60, 80), + TEMP_PCT(55, 75), + TEMP_PCT(50, 65), + TEMP_PCT(45, 45), + TEMP_PCT(43, 30), + } + }, + [2] = { + .target = DPTF_TEMP_SENSOR_2, + .thresholds = { + TEMP_PCT(75, 90), + TEMP_PCT(70, 80), + TEMP_PCT(65, 70), + TEMP_PCT(60, 50), + } + }, + [3] = { + .target = DPTF_TEMP_SENSOR_3, + .thresholds = { + TEMP_PCT(75, 90), + TEMP_PCT(70, 80), + TEMP_PCT(65, 70), + TEMP_PCT(60, 60), + TEMP_PCT(55, 50), + TEMP_PCT(50, 40), + TEMP_PCT(45, 30), + } + } + }" + + ## Passive Policy + # TODO: below values are initial reference values only + register "policies.passive" = "{ + [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 80, 5000), + [2] = DPTF_PASSIVE(CPU, TEMP_SENSOR_1, 80, 5000), + [3] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_2, 75, 5000), + [4] = DPTF_PASSIVE(CPU, TEMP_SENSOR_3, 80, 5000), + }" + + ## Critical Policy + # TODO: below values are initial reference values only + register "policies.critical" = "{ + [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), + [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 85, SHUTDOWN), + [4] = DPTF_CRITICAL(TEMP_SENSOR_3, 85, SHUTDOWN), + }" + + ## Power Limits Control + register "controls.power_limits" = "{ + .pl1 = { + .min_power = 25000, + .max_power = 25000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 200, + }, + .pl2 = { + .min_power = 95000, + .max_power = 95000, + .time_window_min = 28 * MSECS_PER_SEC, + .time_window_max = 32 * MSECS_PER_SEC, + .granularity = 1000, + } + }" + + ## Charger Performance Control (Control, mA) + register "controls.charger_perf" = "{ + [0] = { 255, 3000 }, + [1] = { 24, 1500 }, + [2] = { 16, 1000 }, + [3] = { 8, 500 } + }" + + ## Fan Performance Control (Percent, Speed, Noise, Power) + register "controls.fan_perf" = "{ + [0] = { 90, 6700, 220, 2200, }, + [1] = { 80, 5800, 180, 1800, }, + [2] = { 70, 5000, 145, 1450, }, + [3] = { 60, 4900, 115, 1150, }, + [4] = { 50, 3838, 90, 900, }, + [5] = { 40, 2904, 55, 550, }, + [6] = { 30, 2337, 30, 300, }, + [7] = { 20, 1608, 15, 150, }, + [8] = { 10, 800, 10, 100, }, + [9] = { 0, 0, 0, 50, } + }" + + ## Fan options + register "options.fan.fine_grained_control" = "true" + register "options.fan.step_size" = "2" + + device generic 0 alias dptf_policy on end + end + end + + device ref ipu on + chip drivers/intel/mipi_camera + register "acpi_uid" = "0x50000" + register "acpi_name" = ""IPU0"" + register "device_type" = "INTEL_ACPI_CAMERA_CIO2" + register "cio2_num_ports" = "2" + register "cio2_lanes_used" = "{4,2}" # 4 and 2 CSI Camera lanes are used + register "cio2_lane_endpoint[0]" = ""^I2C1.CAM0"" + register "cio2_lane_endpoint[1]" = ""^I2C2.CAM1"" + register "cio2_prt[0]" = "0" + register "cio2_prt[1]" = "2" + device generic 0 on + probe UFC UFC_MIPI + probe WFC WFC_MIPI + end + end + end + + device ref iaa off end + + device ref thc0 on + probe TOUCHSCREEN TOUCHSCREEN_THC_SPI + probe TOUCHSCREEN TOUCHSCREEN_THC_I2C + # THC0 is function 0; hence it needs to be enabled when THC1 is to be enabled. + probe TOUCHPAD TOUCHPAD_THC_I2C + end + device ref thc1 on + probe TOUCHPAD TOUCHPAD_THC_I2C + end + + device ref tbt_pcie_rp0 on end + device ref tbt_pcie_rp1 on end + device ref tbt_pcie_rp2 on end + device ref tbt_pcie_rp3 on end + device ref tcss_xhci on + chip drivers/usb/acpi + device ref tcss_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C0"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(4, 2)" + device ref tcss_usb3_port0 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C1"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(3, 2)" + device ref tcss_usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C2"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(2, 2)" + device ref tcss_usb3_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-C Port C3"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(1, 2)" + device ref tcss_usb3_port3 on end + end + end + end + end + + device ref tcss_dma0 on + chip drivers/intel/usb4/retimer + register "dfp[0].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)" + use tcss_usb3_port0 as dfp[0].typec_port + device generic 0 on end + end + chip drivers/intel/usb4/retimer + register "dfp[1].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)" + use tcss_usb3_port1 as dfp[1].typec_port + device generic 0 on end + end + end + device ref tcss_dma1 on + chip drivers/intel/usb4/retimer + register "dfp[0].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)" + use tcss_usb3_port2 as dfp[0].typec_port + device generic 0 on end + end + chip drivers/intel/usb4/retimer + register "dfp[1].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)" + use tcss_usb3_port3 as dfp[1].typec_port + device generic 0 on end + end + end + + device ref ish on + probe ISH ISH_ENABLE + probe FP FP_PRESENT + chip drivers/intel/ish + register "add_acpi_dma_property" = "true" + device generic 0 on end + end + end + + device ref xhci on + chip drivers/usb/acpi + device ref xhci_root_hub on + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C0"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(1, 1)" + device ref usb2_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C1"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(2, 1)" + device ref usb2_port2 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C2"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(3, 1)" + device ref usb2_port3 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-C Port C3"" + register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" + register "group" = "ACPI_PLD_GROUP(4, 1)" + device ref usb2_port4 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port 1"" + register "type" = "UPC_TYPE_A" + register "group" = "ACPI_PLD_GROUP(5, 1)" + device ref usb2_port5 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port 2"" + register "type" = "UPC_TYPE_A" + register "group" = "ACPI_PLD_GROUP(6, 1)" + device ref usb2_port6 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Type-A Port 3"" + register "type" = "UPC_TYPE_A" + register "group" = "ACPI_PLD_GROUP(7, 1)" + device ref usb2_port7 on end + end + chip drivers/usb/acpi + register "desc" = ""USB2 Bluetooth"" + register "type" = "UPC_TYPE_INTERNAL" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A16)" + device ref usb2_port8 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port 1"" + register "type" = "UPC_TYPE_USB3_A" + register "group" = "ACPI_PLD_GROUP(1, 2)" + device ref usb3_port1 on end + end + chip drivers/usb/acpi + register "desc" = ""USB3 Type-A Port 2"" + register "type" = "UPC_TYPE_USB3_A" + register "group" = "ACPI_PLD_GROUP(2, 2)" + device ref usb3_port2 on end + end + end + end + end + + device ref ufs on + probe STORAGE STORAGE_UFS + probe STORAGE STORAGE_UNKNOWN + end + + device ref pcie_rp2 on + probe CELLULAR CELLULAR_PCIE + register "pcie_rp[PCIE_RP(2)]" = "{ + .clk_src = 5, + .clk_req = 5, + .flags = PCIE_RP_CLK_REQ_DETECT | PCIE_RP_LTR | PCIE_RP_AER, + }" + chip soc/intel/common/block/pcie/rtd3 + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D03)" + register "reset_off_delay_ms" = "20" + register "srcclk_pin" = "5" + register "ext_pm_support" = "ACPI_PCIE_RP_EMIT_ALL" + register "skip_on_off_support" = "true" + register "use_rp_mutex" = "true" + device generic 0 alias rp2_rtd3 on end + end + chip drivers/wwan/fm + register "fcpo_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A09)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_B20)" + register "perst_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D03)" + register "wake_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E02)" + register "add_acpi_dma_property" = "true" + use rp2_rtd3 as rtd3dev + device generic 0 on end + end + end # WWAN + device ref pcie_rp3 on + probe SD SD_GENSYS + probe SD SD_BAYHUB + # Enable PCH PCIE x1 slot using CLK 3 + register "pcie_rp[PCIE_RP(3)]" = "{ + .clk_src = 2, + .clk_req = 2, + .flags = PCIE_RP_CLK_REQ_DETECT | PCIE_RP_LTR | PCIE_RP_AER, + }" + chip soc/intel/common/block/pcie/rtd3 + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_A08)" + register "enable_delay_ms" = "100" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D19)" + register "reset_delay_ms" = "20" + register "srcclk_pin" = "2" + device generic 0 on end + end + end # PCIE x1 slot + device ref pcie_rp4 on + probe WIFI WIFI_PCIE_6 + probe WIFI WIFI_PCIE_7 + register "pcie_rp[PCH_RP(4)]" = "{ + .clk_src = 4, + .clk_req = 4, + .flags = PCIE_RP_CLK_REQ_DETECT | PCIE_RP_LTR | PCIE_RP_AER, + }" + chip soc/intel/common/block/pcie/rtd3 + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A11)" + register "srcclk_pin" = "4" + device pci 00.0 on end + end + chip drivers/wifi/generic + register "add_acpi_dma_property" = "true" + register "wake" = "GPE0_DW0_12" # GPP_A12 + use usb2_port7 as bluetooth_companion + device pci 00.0 on end + end + end # discrete WLAN + device ref pcie_rp5 on + probe STORAGE STORAGE_NVME_GEN4 + probe STORAGE STORAGE_UNKNOWN + register "pcie_rp[PCIE_RP(5)]" = "{ + .clk_src = 6, + .clk_req = 6, + .flags = PCIE_RP_CLK_REQ_DETECT | PCIE_RP_LTR | PCIE_RP_AER, + }" + chip soc/intel/common/block/pcie/rtd3 + register "is_storage" = "true" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B10)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_B09)" + register "srcclk_pin" = "6" + device generic 0 on end + end + end # Gen4 M.2 SSD + device ref pcie_rp9 on + probe STORAGE STORAGE_NVME_GEN5 + probe STORAGE STORAGE_UNKNOWN + register "pcie_rp[PCIE_RP(9)]" = "{ + .clk_src = 1, + .clk_req = 1, + .flags = PCIE_RP_CLK_REQ_DETECT | PCIE_RP_LTR | PCIE_RP_AER, + }" + chip soc/intel/common/block/pcie/rtd3 + register "is_storage" = "true" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B16)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E03)" + register "srcclk_pin" = "1" + device generic 0 on end + end + end # Gen5 M.2 SSD + device ref cnvi_wifi on + probe WIFI WIFI_CNVI_6 + probe WIFI WIFI_CNVI_7 + chip drivers/wifi/generic + register "wake" = "GPE0_PME_B0" + register "add_acpi_dma_property" = "true" + register "enable_cnvi_ddr_rfim" = "true" + device generic 0 on end + end + end # CNVi + # NOTE: i2c0 is function 0; hence it needs to be enabled when any of i2c1-5 is enabled. + # TPM device is under i2c3. Therefore, i2c0 needs to be enabled anyways. + device ref i2c0 on end + device ref i2c1 on + chip drivers/intel/mipi_camera + register "acpi_hid" = ""OVTIDB10"" + register "acpi_uid" = "0" + register "acpi_name" = ""CAM0"" + register "chip_name" = ""Ov 13b10 Camera"" + register "device_type" = "INTEL_ACPI_CAMERA_SENSOR" + + register "ssdb.vcm_type" = "0x0C" + register "vcm_name" = ""VCM1"" + + register "ssdb.lanes_used" = "4" + register "num_freq_entries" = "1" + register "link_freq[0]" = "560 * MHz" # 560 MHz + register "remote_name" = ""IPU0"" + register "max_dstate_for_probe" = "ACPI_DEVICE_SLEEP_D3_COLD" + + register "has_power_resource" = "true" + #Controls + register "clk_panel.clks[0].clknum" = "0" # IMGCLKOUT_0 + register "clk_panel.clks[0].freq" = "1" #19.2 Mhz + register "gpio_panel.gpio[0].gpio_num" = "GPP_C05" #power_enable + register "gpio_panel.gpio[1].gpio_num" = "GPP_E10" #reset + + #_ON + register "on_seq.ops_cnt" = "4" + register "on_seq.ops[0]" = "SEQ_OPS_CLK_ENABLE(0, 0)" + register "on_seq.ops[1]" = "SEQ_OPS_GPIO_ENABLE(0, 2)" + register "on_seq.ops[2]" = "SEQ_OPS_GPIO_DISABLE(1, 1)" + register "on_seq.ops[3]" = "SEQ_OPS_GPIO_ENABLE(1, 1)" + + #_OFF + register "off_seq.ops_cnt" = "3" + register "off_seq.ops[0]" = "SEQ_OPS_CLK_DISABLE(0, 0)" + register "off_seq.ops[1]" = "SEQ_OPS_GPIO_DISABLE(1, 0)" + register "off_seq.ops[2]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 36 on + probe WFC WFC_MIPI + end + end + chip drivers/intel/mipi_camera + register "acpi_uid" = "3" + register "acpi_name" = ""VCM1"" + register "chip_name" = ""DW AF VCM"" + register "device_type" = "INTEL_ACPI_CAMERA_VCM" + + register "vcm_compat" = ""dongwoon,dw9714"" + + register "max_dstate_for_probe" = "ACPI_DEVICE_SLEEP_D0" + + register "has_power_resource" = "true" + + #Controls + register "gpio_panel.gpio[0].gpio_num" = "GPP_C05" #power_enable + + #_ON + register "on_seq.ops_cnt" = "1" + register "on_seq.ops[0]" = "SEQ_OPS_GPIO_ENABLE(0, 0)" + + #_OFF + register "off_seq.ops_cnt" = "1" + register "off_seq.ops[0]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 0C on + probe WFC WFC_MIPI + end + end + chip drivers/intel/mipi_camera + register "acpi_uid" = "1" + register "acpi_name" = ""NVM1"" + register "chip_name" = ""BRCA016GWZ"" + register "device_type" = "INTEL_ACPI_CAMERA_NVM" + + register "nvm_compat" = ""atmel,24c16"" + + register "nvm_size" = "0x800" + register "nvm_pagesize" = "0x01" + register "nvm_readonly" = "0x01" + register "nvm_width" = "0x08" + + register "max_dstate_for_probe" = "ACPI_DEVICE_SLEEP_D0" + + register "has_power_resource" = "true" + + #Controls + register "gpio_panel.gpio[0].gpio_num" = "GPP_C05" #power_enable + + #_ON + register "on_seq.ops_cnt" = "1" + register "on_seq.ops[0]" = "SEQ_OPS_GPIO_ENABLE(0, 0)" + + #_OFF + register "off_seq.ops_cnt" = "1" + register "off_seq.ops[0]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 50 on + probe WFC WFC_MIPI + end + end + end # I2C1 + device ref i2c2 on + chip drivers/intel/mipi_camera + register "acpi_hid" = ""OVTIDB10"" + register "acpi_uid" = "0" + register "acpi_name" = ""CAM1"" + register "chip_name" = ""Ov 13b10 Camera"" + register "device_type" = "INTEL_ACPI_CAMERA_SENSOR" + + register "ssdb.vcm_type" = "0x0C" + register "vcm_name" = ""VCM1"" + + register "ssdb.lanes_used" = "2" + register "num_freq_entries" = "1" + register "link_freq[0]" = "560 * MHz" # 560 MHz + register "remote_name" = ""IPU0"" + register "max_dstate_for_probe" = "ACPI_DEVICE_SLEEP_D3_COLD" + + register "has_power_resource" = "true" + #Controls + register "clk_panel.clks[0].clknum" = "1" # IMGCLKOUT_1 + register "clk_panel.clks[0].freq" = "1" #19.2 Mhz + register "gpio_panel.gpio[0].gpio_num" = "GPP_C08" #power_enable + register "gpio_panel.gpio[1].gpio_num" = "GPP_E01" #reset + + #_ON + register "on_seq.ops_cnt" = "4" + register "on_seq.ops[0]" = "SEQ_OPS_CLK_ENABLE(0, 0)" + register "on_seq.ops[1]" = "SEQ_OPS_GPIO_ENABLE(0, 2)" + register "on_seq.ops[2]" = "SEQ_OPS_GPIO_DISABLE(1, 1)" + register "on_seq.ops[3]" = "SEQ_OPS_GPIO_ENABLE(1, 1)" + + #_OFF + register "off_seq.ops_cnt" = "3" + register "off_seq.ops[0]" = "SEQ_OPS_CLK_DISABLE(0, 0)" + register "off_seq.ops[1]" = "SEQ_OPS_GPIO_DISABLE(1, 0)" + register "off_seq.ops[2]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 36 on + probe UFC UFC_MIPI + end + end + chip drivers/intel/mipi_camera + register "acpi_uid" = "3" + register "acpi_name" = ""VCM1"" + register "chip_name" = ""DW AF VCM"" + register "device_type" = "INTEL_ACPI_CAMERA_VCM" + + register "vcm_compat" = ""dongwoon,dw9714"" + + register "max_dstate_for_probe" = "ACPI_DEVICE_SLEEP_D0" + + register "has_power_resource" = "true" + + #Controls + register "gpio_panel.gpio[0].gpio_num" = "GPP_C08" #power_enable + + #_ON + register "on_seq.ops_cnt" = "1" + register "on_seq.ops[0]" = "SEQ_OPS_GPIO_ENABLE(0, 0)" + + #_OFF + register "off_seq.ops_cnt" = "1" + register "off_seq.ops[0]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 0C on + probe UFC UFC_MIPI + end + end + chip drivers/intel/mipi_camera + register "acpi_uid" = "1" + register "acpi_name" = ""NVM1"" + register "chip_name" = ""BRCA016GWZ"" + register "device_type" = "INTEL_ACPI_CAMERA_NVM" + + register "nvm_compat" = ""atmel,24c16"" + + register "nvm_size" = "0x800" + register "nvm_pagesize" = "0x01" + register "nvm_readonly" = "0x01" + register "nvm_width" = "0x08" + + register "max_dstate_for_probe" = "ACPI_DEVICE_SLEEP_D0" + + register "has_power_resource" = "true" + + #Controls + register "gpio_panel.gpio[0].gpio_num" = "GPP_C08" #power_enable + + #_ON + register "on_seq.ops_cnt" = "1" + register "on_seq.ops[0]" = "SEQ_OPS_GPIO_ENABLE(0, 0)" + + #_OFF + register "off_seq.ops_cnt" = "1" + register "off_seq.ops[0]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" + + device i2c 50 on + probe UFC UFC_MIPI + end + end + end # I2C2 + device ref i2c3 on + chip drivers/i2c/generic + register "hid" = ""RTL5682"" + register "name" = ""RT58"" + register "desc" = ""Headset Codec"" + register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_F17)" + # Set the jd_src to RT5668_JD1 for jack detection + register "property_count" = "1" + register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER" + register "property_list[0].name" = ""realtek,jd-src"" + register "property_list[0].integer" = "1" + device i2c 1a on + probe AUDIO AUDIO_MAX98360_ALC5682I_I2S + end + end + chip drivers/i2c/tpm + register "hid" = ""GOOG0005"" + register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_D15_IRQ)" + device i2c 50 on end + end + end # I2C3 + device ref i2c4 on + chip drivers/i2c/hid + register "generic.hid" = ""ELAN6918"" + register "generic.desc" = ""ELAN Touchscreen"" + register "generic.irq" = "ACPI_IRQ_LEVEL_LOW(GPP_E18_IRQ)" + register "generic.probed" = "1" + register "generic.reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E16)" + register "generic.reset_delay_ms" = "20" + register "generic.reset_off_delay_ms" = "2" + register "generic.enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F08)" + register "generic.enable_delay_ms" = "1" + register "generic.has_power_resource" = "1" + register "hid_desc_reg_offset" = "0x01" + device i2c 16 on + probe TOUCHSCREEN TOUCHSCREEN_LPSS_I2C + end + end + end # I2C4 + device ref i2c5 on + chip drivers/i2c/hid + register "generic.hid" = ""HFW68H"" + register "generic.desc" = ""Hynitron TOUCHPAD"" + register "generic.irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A13_IRQ)" + register "generic.wake" = "GPE0_DW0_13" + register "generic.uid" = "5" + register "generic.detect" = "1" + register "hid_desc_reg_offset" = "0x20" + device i2c 2c on + probe TOUCHPAD TOUCHPAD_LPSS_I2C + end + end + end # I2C5 + + device ref gspi0 on + chip drivers/spi/acpi + register "name" = ""CRFP"" + register "hid" = "ACPI_DT_NAMESPACE_HID" + register "uid" = "1" + register "compat_string" = ""google,cros-ec-spi"" + register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_D01_IRQ)" + register "wake" = "GPE0_DW1_01" + register "has_power_resource" = "true" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_C15)" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E19)" + register "enable_delay_ms" = "3" + device spi 0 on + probe FP FP_PRESENT + end + end # FPMCU + end + + device ref smbus on end + device ref npk on end + device ref hda on + chip drivers/intel/soundwire + device generic 0 on + chip drivers/soundwire/alc711 + register "desc" = ""Headset Codec"" + register "alc711_address.version" = "SOUNDWIRE_VERSION_1_2" + register "alc711_address.class" = "MIPI_CLASS_SDCA" + register "alc711_address.part_id" = "MIPI_DEV_ID_REALTEK_ALC722" + # SoundWire Link 1 ID 1 + device generic 1.1 on + probe AUDIO AUDIO_ALC722_SNDW + end + end + chip drivers/soundwire/alc711 + register "desc" = ""Headset Codec"" + register "alc711_address.version" = "SOUNDWIRE_VERSION_1_2" + register "alc711_address.class" = "MIPI_CLASS_SDCA" + register "alc711_address.part_id" = "MIPI_DEV_ID_REALTEK_ALC721" + # SoundWire Link 3 ID 1 + device generic 3.1 on + probe AUDIO AUDIO_ALC721_SNDW + end + end + end + end + chip drivers/generic/max98357a + register "hid" = ""MX98360A"" + register "sdmode_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E19)" + register "sdmode_delay" = "5" + device generic 0 on + probe AUDIO AUDIO_MAX98360_ALC5682I_I2S + end + end + end + end +end diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/variant.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/variant.c new file mode 100644 index 0000000000..c7aa7aa605 --- /dev/null +++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/variant.c @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +const char *get_wifi_sar_cbfs_filename(void) +{ + return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI)); +} + +void variant_update_soc_chip_config(struct soc_intel_pantherlake_config *config) +{ + config->cnvi_wifi_core = false; + config->cnvi_bt_core = false; + /* CNVi */ + if (fw_config_probe(FW_CONFIG(WIFI, WIFI_CNVI_6)) || + fw_config_probe(FW_CONFIG(WIFI, WIFI_CNVI_7))) { + config->cnvi_wifi_core = true; + config->cnvi_bt_core = true; + + if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_MAX98360_ALC5682I_I2S)) || + fw_config_probe(FW_CONFIG(AUDIO, AUDIO_ALC722_SNDW)) || + fw_config_probe(FW_CONFIG(AUDIO, AUDIO_ALC721_SNDW))) { + printk(BIOS_INFO, "BT audio offload configured.\n"); + config->cnvi_bt_audio_offload = true; + } + } +} From 5e491f613f5c7afe30bd967041d03580aa5785e6 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 27 Feb 2025 11:23:20 -0600 Subject: [PATCH 0232/3886] soc/intel/meteorlake: Allow boards to disable INTEL_TME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow boards to disable TME (total memory encryption) by guarding selection of TME_KEY_REGENERATION_ON_WARM_BOOT on INTEL_TME. This way, boards can set INTEL_TME to n in their Kconfig without generating an unmet dependencies error. The default behavior/Kconfig selections are unmodified with this change. Change-Id: I0df1437798e7cafa228ca0e5ae0c32eff774ed09 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/86621 Reviewed-by: Subrata Banik Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) --- src/soc/intel/meteorlake/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/soc/intel/meteorlake/Kconfig b/src/soc/intel/meteorlake/Kconfig index bc0183d442..d5b4a065a8 100644 --- a/src/soc/intel/meteorlake/Kconfig +++ b/src/soc/intel/meteorlake/Kconfig @@ -99,7 +99,7 @@ config SOC_INTEL_METEORLAKE select SOC_INTEL_MEM_MAPPED_PM_CONFIGURATION select SSE2 select SUPPORT_CPU_UCODE_IN_CBFS - select TME_KEY_REGENERATION_ON_WARM_BOOT + select TME_KEY_REGENERATION_ON_WARM_BOOT if INTEL_TME select TSC_MONOTONIC_TIMER select UDELAY_TSC select UDK_202302_BINDING From 8303a71a9192755a2a5586af4c27aad18a1d12c3 Mon Sep 17 00:00:00 2001 From: Weimin Wu Date: Fri, 28 Feb 2025 10:47:08 +0800 Subject: [PATCH 0233/3886] mb/google/fatcat/var/felino: Enable Type-C Ports and TBT Test with PDC fw 19.16.3. BUG=b:397313651 TEST= 1. FW_NAME=felino emerge-fatcat coreboot-private-files-baseboard-fatcat coreboot chromeos-bootimage 2. Type-C Ports and TBT work fine. Change-Id: Icbed4d16911665e820382a483607e6dae44b7f8c Signed-off-by: Weimin Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86633 Reviewed-by: Tongtong Pan Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- .../google/fatcat/variants/felino/gpio.c | 6 +-- .../fatcat/variants/felino/overridetree.cb | 37 ++++++++++++------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/mainboard/google/fatcat/variants/felino/gpio.c b/src/mainboard/google/fatcat/variants/felino/gpio.c index e5ca754dea..a32d44b7d5 100644 --- a/src/mainboard/google/fatcat/variants/felino/gpio.c +++ b/src/mainboard/google/fatcat/variants/felino/gpio.c @@ -68,7 +68,7 @@ static const struct pad_config gpio_table[] = { /* GPP_B09: NC */ PAD_NC(GPP_B09, NONE), /* GPP_B10: SOC_DP1_HDMI_HPD */ - PAD_CFG_NF(GPP_B10, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_B10, NONE, DEEP, NF2), /* GPP_B11: PD1_OC_P0_P1_N */ PAD_NC(GPP_B11, NONE), /* GPP_B12: SLP_S0_SOC_N */ @@ -137,9 +137,9 @@ static const struct pad_config gpio_table[] = { /* GPP_C17: NC */ PAD_NC(GPP_C17, NONE), /* GPP_C18: TCP3_DDC_SCL */ - PAD_CFG_NF(GPP_C18, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C18, NONE, DEEP, NF2), /* GPP_C19: TCP3_DDC_SDA */ - PAD_CFG_NF(GPP_C19, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_C19, NONE, DEEP, NF2), /* GPP_C20: TBT_LSX1_TXD */ PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), /* GPP_C21: TBT_LSX1_RXD */ diff --git a/src/mainboard/google/fatcat/variants/felino/overridetree.cb b/src/mainboard/google/fatcat/variants/felino/overridetree.cb index 6b4d32e0a0..c13aa43a91 100644 --- a/src/mainboard/google/fatcat/variants/felino/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/felino/overridetree.cb @@ -34,11 +34,17 @@ chip soc/intel/pantherlake register "usb2_ports[0]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C0 register "usb2_ports[1]" = "USB2_PORT_TYPE_C(OC_SKIP)" # USB2_C1 register "usb2_ports[4]" = "USB2_PORT_MID(OC_SKIP)" # Type-A Port A0 # USB HUB (USB2 Camera) - register "usb2_ports[5]" = "USB2_PORT_MID(OC3)" # Type-A Port A1 / + register "usb2_ports[5]" = "USB2_PORT_LONG(OC3)" # Type-A Port A1 / register "usb2_ports[7]" = "USB2_PORT_MID(OC_SKIP)" # CNVi BT or discrete BT register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB3.2 x1 Type-A Con #2 / + register "tcss_ports[2]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + register "tcss_ports[3]" = "TCSS_PORT_DEFAULT(OC_SKIP)" + + register "tcss_cap_policy[2]" = "TCSS_TYPE_C_PORT_FULL_FUN" + register "tcss_cap_policy[3]" = "TCSS_TYPE_C_PORT_FULL_FUN" + #gpe configuration register "pmc_gpe0_dw0" = "GPP_A" register "pmc_gpe0_dw1" = "GPP_D" @@ -83,6 +89,9 @@ chip soc/intel/pantherlake device ref iaa off end +device ref tbt_pcie_rp0 on end + device ref tbt_pcie_rp2 on end + device ref tbt_pcie_rp3 on end device ref tcss_xhci on chip drivers/usb/acpi device ref tcss_root_hub on @@ -93,7 +102,7 @@ chip soc/intel/pantherlake device ref tcss_usb3_port2 on end end chip drivers/usb/acpi - register "desc" = ""USB3 Type-C Port C3"" + register "desc" = ""USB3 Type-C Port C1"" register "type" = "UPC_TYPE_C_USB2_SS_SWITCH" register "group" = "ACPI_PLD_GROUP(1, 2)" device ref tcss_usb3_port3 on end @@ -102,6 +111,19 @@ chip soc/intel/pantherlake end end + device ref tcss_dma1 on + chip drivers/intel/usb4/retimer + register "dfp[0].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F11)" + use tcss_usb3_port3 as dfp[0].typec_port + device generic 0 on end + end + chip drivers/intel/usb4/retimer + register "dfp[1].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F11)" + use tcss_usb3_port2 as dfp[1].typec_port + device generic 0 on end + end + end + device ref xhci on chip drivers/usb/acpi device ref xhci_root_hub on @@ -145,17 +167,6 @@ chip soc/intel/pantherlake end end - device ref tcss_dma1 on - chip drivers/intel/usb4/retimer - use tcss_usb3_port2 as dfp[0].typec_port - device generic 0 on end - end - chip drivers/intel/usb4/retimer - use tcss_usb3_port3 as dfp[1].typec_port - device generic 0 on end - end - end - device ref pcie_rp1 on # Enable PCH PCIE x1 slot using CLK 2 register "pcie_rp[PCIE_RP(3)]" = "{ From c3273e3896948586c0b8d9fbed4981b288058674 Mon Sep 17 00:00:00 2001 From: Tongtong Pan Date: Thu, 27 Feb 2025 15:40:34 +0800 Subject: [PATCH 0234/3886] mb/google/fatcat/var/felino: Add Fn key scancode The Fn key on felino emits a scancode of 94 (0x5e). BUG=b:395822961 TEST=Flash Felino, boot to Linux kernel, and verify that KEY_FN is generated when pressed using `evtest`. Change-Id: I297cc3dea577acff6c85804ba1f7e5778fc63736 Signed-off-by: Tongtong Pan Reviewed-on: https://review.coreboot.org/c/coreboot/+/86613 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/mainboard/google/fatcat/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mainboard/google/fatcat/Kconfig b/src/mainboard/google/fatcat/Kconfig index 13d791a812..a425d7ee66 100644 --- a/src/mainboard/google/fatcat/Kconfig +++ b/src/mainboard/google/fatcat/Kconfig @@ -80,6 +80,7 @@ config BOARD_GOOGLE_FATCATITE config BOARD_GOOGLE_FELINO select BOARD_GOOGLE_BASEBOARD_FATCAT + select MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD config BOARD_GOOGLE_FRANCKA select BOARD_GOOGLE_BASEBOARD_FATCAT From 2d2343308a86f7b5f211679cedd9def101193a10 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 27 Feb 2025 19:49:09 +0000 Subject: [PATCH 0235/3886] soc/intel/meteorlake: Don't generate a TME on S3 exit Generate a new TME key will cause S3 exit to fail, so don't do it. Change-Id: Ie19cb7f11ad633405a9fc3c1faf1c3cc53113f51 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86625 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/soc/intel/meteorlake/romstage/fsp_params.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/meteorlake/romstage/fsp_params.c b/src/soc/intel/meteorlake/romstage/fsp_params.c index dd9d2b54c6..8e49afa101 100644 --- a/src/soc/intel/meteorlake/romstage/fsp_params.c +++ b/src/soc/intel/meteorlake/romstage/fsp_params.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include #include @@ -190,7 +191,7 @@ static void fill_fspm_cpu_params(FSP_M_CONFIG *m_cfg, static void fill_tme_params(FSP_M_CONFIG *m_cfg) { m_cfg->TmeEnable = CONFIG(INTEL_TME) && is_tme_supported(); - if (!m_cfg->TmeEnable) + if (!m_cfg->TmeEnable || acpi_is_wakeup_s3()) return; m_cfg->GenerateNewTmeKey = CONFIG(TME_KEY_REGENERATION_ON_WARM_BOOT) && CONFIG(SOC_INTEL_COMMON_BASECODE_RAMTOP); From f114b018b03501ea466f485d1484e6569e87335b Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Fri, 28 Feb 2025 12:30:51 +0000 Subject: [PATCH 0236/3886] mb/starlabs/starbook/mtl: Don't reconfigure GPIOs in ramstage GPP_H08 and GPP_H09 are configured in the bootblock, so remove the configuration in ramstage to allow the serial output in ramstage. Change-Id: I4b813370cf259fb1ca138dd1922c16f801b40cc4 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86650 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/starlabs/starbook/variants/mtl/gpio.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c index f95109418f..7a8e660c75 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c @@ -267,10 +267,6 @@ const struct pad_config gpio_table[] = { PAD_NC(GPP_H06, NONE), /* H07: M.2_CPU_SSD_PWREN */ PAD_CFG_GPO(GPP_H07, 1, DEEP), - /* H08: */ - PAD_NC(GPP_H08, NONE), - /* H09: */ - PAD_NC(GPP_H09, NONE), /* H10: */ PAD_NC(GPP_H10, NONE), /* H11: */ From f0f66be2c345b4f92f7eb4d0a4852e3702b81397 Mon Sep 17 00:00:00 2001 From: Pranava Y N Date: Fri, 28 Feb 2025 16:11:46 +0530 Subject: [PATCH 0237/3886] mb/google/brya/bujia: Enable RTD3 for SSD Add PCIe RTD3 support so NVMe gets placed into D3 state when entering S0ix. Some SSDs block the CPU from reaching C10 during the S0ix suspend without the RTD3 configuration. BUG=b:391612392 TEST=Run suspend_stress_test on Bujia and verify that the device suspends to S0ix. Change-Id: Idee14e7d4df0a9cf8b06b33a52016c1b9228e459 Signed-off-by: Pranava Y N Reviewed-on: https://review.coreboot.org/c/coreboot/+/86644 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/mainboard/google/brya/variants/bujia/overridetree.cb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mainboard/google/brya/variants/bujia/overridetree.cb b/src/mainboard/google/brya/variants/bujia/overridetree.cb index 6db60acb67..370c0520c6 100644 --- a/src/mainboard/google/brya/variants/bujia/overridetree.cb +++ b/src/mainboard/google/brya/variants/bujia/overridetree.cb @@ -119,6 +119,13 @@ chip soc/intel/alderlake .clk_src = 0, .flags = PCIE_RP_LTR | PCIE_RP_AER, }" + chip soc/intel/common/block/pcie/rtd3 + register "is_storage" = "true" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F14)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_B4)" + register "srcclk_pin" = "0" + device generic 0 on end + end end #NVME device ref tbt_pcie_rp0 off end device ref tbt_pcie_rp1 off end From dc9d6fdee3dc3d291838f09cf05596a9830700fe Mon Sep 17 00:00:00 2001 From: Pranava Y N Date: Fri, 28 Feb 2025 17:03:46 +0530 Subject: [PATCH 0238/3886] mb/google/brya/lisbon: Enable RTD3 for SSD Add PCIe RTD3 support so NVMe gets placed into D3 state when entering S0ix. Some SSDs block the CPU from reaching C10 during the S0ix suspend without the RTD3 configuration. BUG=b:391612392 TEST=Run suspend_stress_test on lisbon and verify that the device suspends to S0ix. Change-Id: I124b63061650c85ed84324f3e1558a583a1875e0 Signed-off-by: Pranava Y N Reviewed-on: https://review.coreboot.org/c/coreboot/+/86645 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/mainboard/google/brya/variants/lisbon/overridetree.cb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mainboard/google/brya/variants/lisbon/overridetree.cb b/src/mainboard/google/brya/variants/lisbon/overridetree.cb index 4c3fffff6f..6c3eaf952a 100644 --- a/src/mainboard/google/brya/variants/lisbon/overridetree.cb +++ b/src/mainboard/google/brya/variants/lisbon/overridetree.cb @@ -149,6 +149,13 @@ chip soc/intel/alderlake .clk_src = 0, .flags = PCIE_RP_LTR | PCIE_RP_AER, }" + chip soc/intel/common/block/pcie/rtd3 + register "is_storage" = "true" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F14)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_B4)" + register "srcclk_pin" = "0" + device generic 0 on end + end probe STORAGE STORAGE_NVME end #NVMe device ref tbt_pcie_rp0 off end From 172853a8ceddb90e8305bade0e9c600443cc2cad Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Fri, 28 Feb 2025 14:18:19 +0000 Subject: [PATCH 0239/3886] mb/starlabs/starbook/mtl: Don't configure MUX pins These were incorrectly copied from Alder Lake so remove them as they are not correct nor needed. Change-Id: I70708212c4652ed77c875242340c30edf5b935a1 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86651 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- .../starlabs/starbook/variants/mtl/Makefile.mk | 1 - .../starlabs/starbook/variants/mtl/ramstage.c | 14 -------------- 2 files changed, 15 deletions(-) delete mode 100644 src/mainboard/starlabs/starbook/variants/mtl/ramstage.c diff --git a/src/mainboard/starlabs/starbook/variants/mtl/Makefile.mk b/src/mainboard/starlabs/starbook/variants/mtl/Makefile.mk index 9abc069b38..2a505c35c7 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/Makefile.mk +++ b/src/mainboard/starlabs/starbook/variants/mtl/Makefile.mk @@ -7,4 +7,3 @@ romstage-y += romstage.c ramstage-y += devtree.c ramstage-y += gpio.c ramstage-y += hda_verb.c -ramstage-y += ramstage.c diff --git a/src/mainboard/starlabs/starbook/variants/mtl/ramstage.c b/src/mainboard/starlabs/starbook/variants/mtl/ramstage.c deleted file mode 100644 index c01c4dd10f..0000000000 --- a/src/mainboard/starlabs/starbook/variants/mtl/ramstage.c +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include -#include - -void mainboard_silicon_init_params(FSP_S_CONFIG *supd) -{ - /* - * FSP defaults to pins that are used for LPC; given that - * coreboot only supports eSPI, set these pins accordingly. - */ - supd->PchSerialIoI2cSdaPinMux[0] = 0x1947c404; // GPP_H4 - supd->PchSerialIoI2cSclPinMux[0] = 0x1947a405; // GPP_H5 -} From b8a88f851ea8f567d9fc571815f58722589a2f16 Mon Sep 17 00:00:00 2001 From: Shuo Liu Date: Thu, 27 Feb 2025 19:12:39 +0800 Subject: [PATCH 0240/3886] Kconfig: Update prompt and help text for CBFS_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kconfig item CBFS_SIZE is actually indicating the host firmware size, a.k.a. coreboot owned flash region size, covering CBFS, FMAP, console, MRC cache, VPD, etc. Revise the prompt and help documentation to reflect recent usage updates. Change-Id: I762042fae6357ee368b22a47b8e1168902041675 Signed-off-by: Shuo Liu Reviewed-on: https://review.coreboot.org/c/coreboot/+/86571 Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) --- src/Kconfig | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Kconfig b/src/Kconfig index e4c8467f21..58c2e07ea9 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -634,18 +634,19 @@ config FMDFILE When an fmd is specified, it overrides the default format. config CBFS_SIZE - hex "Size of CBFS filesystem in ROM" + hex "Size of coreboot owned area in ROM" depends on FMDFILE = "" # Default value set at the end of the file help - This is the part of the ROM actually managed by CBFS, located at the - end of the ROM (passed through cbfstool -o) on x86 and at the start - of the ROM (passed through cbfstool -s) everywhere else. It defaults - to span the whole ROM on all but Intel systems that use an Intel Firmware - Descriptor. It can be overridden to make coreboot live alongside other - components like ChromeOS's vboot/FMAP or Intel's IFD / ME / TXE - binaries. This symbol should only be used to generate a default FMAP and - is unused when a non-default fmd file is provided via CONFIG_FMDFILE. + This is the part of ROM (Read-Only Memory) actually managed by coreboot, + located at the end of the ROM on x86 systems and at the start of the ROM + everywhere else. It defaults to span the whole ROM on all systems except for + Intel systems that use an Intel Flash Descriptor. It can be overridden to + make coreboot live alongside other vendor blobs like Intel's IFD (Intel + Flash Descriptor), ME (Management Engine), and TXE (Trusted Execution + Engine) binaries. This symbol is only used to generate a default FMAP + (Flash Memory Map) and is unused when a .fmd file is provided + via CONFIG_FMDFILE. endmenu From 927f16085a4080a58b73c7ca3f1cc3124f37ad88 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 27 Feb 2025 10:00:09 +0000 Subject: [PATCH 0241/3886] mb/starlabs/starbook/mtl: Correct GPP_D21 configuration This GPIO is used for clock request 5, which is NF2. Change-Id: Ic5712090339a39a269aa1aefca9f54da11cb6528 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86654 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/starbook/variants/mtl/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c index 7a8e660c75..d330400fc2 100644 --- a/src/mainboard/starlabs/starbook/variants/mtl/gpio.c +++ b/src/mainboard/starlabs/starbook/variants/mtl/gpio.c @@ -490,7 +490,7 @@ const struct pad_config gpio_table[] = { PAD_CFG_NF(GPP_D20, NONE, DEEP, NF1), /* D21: CLKREQ5 * WLAN */ - PAD_CFG_NF(GPP_D21, NONE, DEEP, NF1), + PAD_CFG_NF(GPP_D21, NONE, DEEP, NF2), /* D22: */ PAD_NC(GPP_D22, NONE), /* D23: */ From fe107c1ad217243d68e55d7e238fc59c15d30d70 Mon Sep 17 00:00:00 2001 From: Naresh Solanki Date: Sat, 23 Nov 2024 18:07:48 +0530 Subject: [PATCH 0242/3886] soc/amd/cpu: smbios: Set external clock to 100 MHz Set external clock to 100MHz. source: PPR #57254 Change-Id: I99f73695019612d58b0c78c6985370d23c78b729 Signed-off-by: Naresh Solanki Reviewed-on: https://review.coreboot.org/c/coreboot/+/85636 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- src/soc/amd/glinda/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/soc/amd/glinda/cpu.c b/src/soc/amd/glinda/cpu.c index a7161270d2..26380077f2 100644 --- a/src/soc/amd/glinda/cpu.c +++ b/src/soc/amd/glinda/cpu.c @@ -7,11 +7,16 @@ #include #include #include +#include #include _Static_assert(CONFIG_MAX_CPUS == 24, "Do not override MAX_CPUS. To reduce the number of " "available cores, use the downcore_mode and disable_smt devicetree settings instead."); +unsigned int smbios_processor_external_clock(void) +{ + return 100; // 100 MHz +} static void zen_2_3_init(struct device *dev) { check_mca(); From 00b4a61dc53c68b47d1452c387409f2eadf32c93 Mon Sep 17 00:00:00 2001 From: Naresh Solanki Date: Wed, 27 Nov 2024 01:41:40 +0530 Subject: [PATCH 0243/3886] soc/amd/glinda/cpu: Update smbios parameters Update smbios parameters for cache type, operation mode & error correction type. source: UEFI reference BIOS Change-Id: If8eaa54c9a0086f4d397a7ddb01009acfd3f1aee Signed-off-by: Naresh Solanki Reviewed-on: https://review.coreboot.org/c/coreboot/+/85637 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- src/soc/amd/glinda/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/soc/amd/glinda/cpu.c b/src/soc/amd/glinda/cpu.c index 26380077f2..680b0957d3 100644 --- a/src/soc/amd/glinda/cpu.c +++ b/src/soc/amd/glinda/cpu.c @@ -17,6 +17,22 @@ unsigned int smbios_processor_external_clock(void) { return 100; // 100 MHz } + +unsigned int smbios_cache_error_correction_type(u8 level) +{ + return SMBIOS_CACHE_ERROR_CORRECTION_MULTI_BIT; +} + +unsigned int smbios_cache_conf_operation_mode(u8 level) +{ + return SMBIOS_CACHE_OP_MODE_WRITE_BACK; +} + +unsigned int smbios_cache_sram_type(void) +{ + return SMBIOS_CACHE_SRAM_TYPE_PIPELINE_BURST; +} + static void zen_2_3_init(struct device *dev) { check_mca(); From 3794f9f94a9363d618ed9bad4ba22b0a37b5bea2 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Mon, 23 Sep 2024 21:10:57 +0300 Subject: [PATCH 0244/3886] drivers/efi/capsules.c: fix recording capsule size As mentioned in comments on CB:83422, size of the current data block (which is also the last block of a capsule) was incorrectly used in place of the capsule size: - when publishing a capsule in CBMEM (this worked in practice because CapsuleApp.efi allocates a continuous physical memory) - when aligning target address (which could move output pointer past previously allocated buffer by up to 7 bytes per capsule block) Change-Id: I97a528e2611fcd711c555d0f01e9aadcd2031217 Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/84542 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- src/drivers/efi/capsules.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/drivers/efi/capsules.c b/src/drivers/efi/capsules.c index 38178c618e..e8078bbd48 100644 --- a/src/drivers/efi/capsules.c +++ b/src/drivers/efi/capsules.c @@ -596,6 +596,7 @@ static void coalesce_capsules(struct block_descr block_chain, uint8_t *target) { struct block_descr block = block_chain; uint8_t *capsule_start = NULL; + uint32_t capsule_size = 0; uint32_t size_left = 0; /* No safety checks in this function, as all of them were done earlier. */ @@ -610,8 +611,10 @@ static void coalesce_capsules(struct block_descr block_chain, uint8_t *target) if (size_left == 0) { const EFI_CAPSULE_HEADER *capsule_hdr = map_range(block.addr, sizeof(*capsule_hdr)); - size_left = capsule_hdr->CapsuleImageSize; + capsule_size = capsule_hdr->CapsuleImageSize; capsule_start = target; + + size_left = capsule_size; } uint64_t addr = block.addr; @@ -641,13 +644,14 @@ static void coalesce_capsules(struct block_descr block_chain, uint8_t *target) } uefi_capsules[uefi_capsule_count].base = (uintptr_t)capsule_start; - uefi_capsules[uefi_capsule_count].len = block.len; + uefi_capsules[uefi_capsule_count].len = capsule_size; uefi_capsule_count++; /* This is to align start of the next capsule (assumes that initial value of target was suitably aligned). */ - if (!IS_ALIGNED(block.len, CAPSULE_ALIGNMENT)) - target += ALIGN_UP(block.len, CAPSULE_ALIGNMENT) - block.len; + if (!IS_ALIGNED(capsule_size, CAPSULE_ALIGNMENT)) + target += ALIGN_UP(capsule_size, CAPSULE_ALIGNMENT) - + capsule_size; } } From e90fc546e75ecf272920481266c1249de6cf17d5 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Thu, 24 Oct 2024 19:01:59 +0200 Subject: [PATCH 0245/3886] cpu/intel/haswell: Usee boolean for haswell_is_ult() haswell_is_ult() returns CONFIG(INTEL_LYNXPOINT_LP) which is a boolean, so use boolean instead of int. Change-Id: I3c98ee819fc937ed6da9ee1340c2af10cec19eb3 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/84857 Tested-by: build bot (Jenkins) Reviewed-by: Nicholas Chin --- src/cpu/intel/haswell/haswell.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpu/intel/haswell/haswell.h b/src/cpu/intel/haswell/haswell.h index 5697d0f36e..f63b0ef4b3 100644 --- a/src/cpu/intel/haswell/haswell.h +++ b/src/cpu/intel/haswell/haswell.h @@ -4,6 +4,7 @@ #define _CPU_INTEL_HASWELL_H #include +#include #include /* CPU types without stepping */ @@ -181,7 +182,7 @@ static inline u32 cpu_stepping(void) return cpuid_eax(1) & 0xf; } -static inline int haswell_is_ult(void) +static inline bool haswell_is_ult(void) { return CONFIG(INTEL_LYNXPOINT_LP); } From 362232d2365064286c4202ff2d2777fd8e855c24 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Thu, 27 Feb 2025 21:30:43 +0100 Subject: [PATCH 0246/3886] soc/amd/glinda/Kconfig: Increase APOB NV size A glinda based platform reports: [WARN] RAM APOB data is too large (3b3b0 + 8) > 1e000 APOB NV size is not enough on recent platforms to cache memory training, which causes the same amount of boot time on subsequent boots as on the first boot. Signed-off-by: Maximilian Brune Change-Id: I8cc1f1e4f8d6f99c8e2b717926b66a5a683bffdc Reviewed-on: https://review.coreboot.org/c/coreboot/+/86624 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/mainboard/amd/birman/board_glinda.fmd | 2 +- src/mainboard/amd/birman/chromeos_glinda.fmd | 2 +- src/mainboard/amd/birman_plus/board_glinda.fmd | 2 +- src/mainboard/amd/birman_plus/chromeos_glinda.fmd | 2 +- src/soc/amd/glinda/Kconfig | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mainboard/amd/birman/board_glinda.fmd b/src/mainboard/amd/birman/board_glinda.fmd index 756709044e..bc09fe75d5 100644 --- a/src/mainboard/amd/birman/board_glinda.fmd +++ b/src/mainboard/amd/birman/board_glinda.fmd @@ -4,6 +4,6 @@ FLASH@0xFF000000 16M { FMAP 4K COREBOOT(CBFS) EC_BODY@15872K 256K - RW_MRC_CACHE 120K + RW_MRC_CACHE 256K } } diff --git a/src/mainboard/amd/birman/chromeos_glinda.fmd b/src/mainboard/amd/birman/chromeos_glinda.fmd index 66227c2778..420ed6e6d4 100644 --- a/src/mainboard/amd/birman/chromeos_glinda.fmd +++ b/src/mainboard/amd/birman/chromeos_glinda.fmd @@ -30,6 +30,6 @@ FLASH@0xFF000000 16M { SMMSTORE(PRESERVE) 256K RW_LEGACY(CBFS) EC_BODY@15872K 256K - RW_MRC_CACHE(PRESERVE) 120K + RW_MRC_CACHE(PRESERVE) 256K } } diff --git a/src/mainboard/amd/birman_plus/board_glinda.fmd b/src/mainboard/amd/birman_plus/board_glinda.fmd index b9465768be..96e1e8d8f0 100644 --- a/src/mainboard/amd/birman_plus/board_glinda.fmd +++ b/src/mainboard/amd/birman_plus/board_glinda.fmd @@ -5,6 +5,6 @@ FLASH 64M { COREBOOT(CBFS) SMMSTORE(PRESERVE) 256K EC_BODY@15872K 256K - RW_MRC_CACHE 120K + RW_MRC_CACHE 256K } } diff --git a/src/mainboard/amd/birman_plus/chromeos_glinda.fmd b/src/mainboard/amd/birman_plus/chromeos_glinda.fmd index 66227c2778..420ed6e6d4 100644 --- a/src/mainboard/amd/birman_plus/chromeos_glinda.fmd +++ b/src/mainboard/amd/birman_plus/chromeos_glinda.fmd @@ -30,6 +30,6 @@ FLASH@0xFF000000 16M { SMMSTORE(PRESERVE) 256K RW_LEGACY(CBFS) EC_BODY@15872K 256K - RW_MRC_CACHE(PRESERVE) 120K + RW_MRC_CACHE(PRESERVE) 256K } } diff --git a/src/soc/amd/glinda/Kconfig b/src/soc/amd/glinda/Kconfig index 70bdb69d6d..1bd5b2f179 100644 --- a/src/soc/amd/glinda/Kconfig +++ b/src/soc/amd/glinda/Kconfig @@ -123,7 +123,7 @@ config PSP_APOB_DRAM_ADDRESS config PSP_APOB_DRAM_SIZE hex - default 0x1E000 + default 0x40000 config PSP_SHAREDMEM_BASE hex From 118b3941374992def5b784f8a6d03b9972e48891 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Thu, 24 Oct 2024 19:16:45 +0200 Subject: [PATCH 0247/3886] sb/intel/lynxpoint/pch: Use boolean for pch_is_lp() pch_is_lp() returns CONFIG(INTEL_LYNXPOINT_LP) which is a boolean, so use boolean instead of int. Change-Id: Ic7bf801f549077cbd493e0a53ba7eff7a72728fb Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/84859 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/southbridge/intel/lynxpoint/pch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/southbridge/intel/lynxpoint/pch.h b/src/southbridge/intel/lynxpoint/pch.h index 07f4b9dc16..c64b3e3e10 100644 --- a/src/southbridge/intel/lynxpoint/pch.h +++ b/src/southbridge/intel/lynxpoint/pch.h @@ -100,7 +100,7 @@ struct usb3_port_config { extern const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS]; extern const struct usb3_port_config mainboard_usb3_ports[MAX_USB3_PORTS]; -static inline int pch_is_lp(void) +static inline bool pch_is_lp(void) { return CONFIG(INTEL_LYNXPOINT_LP); } From 1ce69c9db008c0f31e761855ad7d2d729833c5fe Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Thu, 24 Nov 2022 23:54:40 +0300 Subject: [PATCH 0248/3886] util/intelp2m: Drop multi-template support Exclude the template to parse gpio.h, since coreboot no longer has such files with raw DW register values. The new GPIO config should be generated using inteltool.log only. TEST: make test = PASS Change-Id: I07124cca487f11641c4e107134efb8cfc29c6731 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/70307 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- util/intelp2m/config/config.go | 63 ++++++++++----------------- util/intelp2m/main.go | 10 ----- util/intelp2m/parser/parser.go | 40 +++++++---------- util/intelp2m/parser/template.go | 56 +----------------------- util/intelp2m/parser/template_test.go | 2 +- util/intelp2m/platforms/adl/macro.go | 17 +++----- util/intelp2m/platforms/cnl/macro.go | 26 +++++------ util/intelp2m/platforms/ebg/macro.go | 20 ++++----- util/intelp2m/platforms/jsl/macro.go | 26 +++++------ util/intelp2m/platforms/lbg/macro.go | 15 +++---- util/intelp2m/platforms/mtl/macro.go | 25 +++++------ util/intelp2m/platforms/snr/macro.go | 22 ++++------ util/intelp2m/platforms/tgl/macro.go | 18 +++----- util/intelp2m/version.txt | 2 +- 14 files changed, 111 insertions(+), 231 deletions(-) diff --git a/util/intelp2m/config/config.go b/util/intelp2m/config/config.go index 5578a05853..7b4486b3be 100644 --- a/util/intelp2m/config/config.go +++ b/util/intelp2m/config/config.go @@ -3,36 +3,15 @@ package config import "os" const ( - TempInteltool int = 0 - TempGpioh int = 1 - TempSpec int = 2 -) - -var template int = 0 - -func TemplateSet(temp int) bool { - if temp > TempSpec { - return false - } else { - template = temp - return true - } -} - -func TemplateGet() int { - return template -} - -const ( - SunriseType uint8 = 0 - LewisburgType uint8 = 1 - ApolloType uint8 = 2 - CannonType uint8 = 3 - TigerType uint8 = 4 - AlderType uint8 = 5 - JasperType uint8 = 6 - MeteorType uint8 = 7 - EmmitsburgType uint8 = 8 + SunriseType uint8 = 0 + LewisburgType uint8 = 1 + ApolloType uint8 = 2 + CannonType uint8 = 3 + TigerType uint8 = 4 + AlderType uint8 = 5 + JasperType uint8 = 6 + MeteorType uint8 = 7 + EmmitsburgType uint8 = 8 ) var key uint8 = SunriseType @@ -48,6 +27,7 @@ var platform = map[string]uint8{ "mtl": MeteorType, "ebg": EmmitsburgType, } + func PlatformSet(name string) int { if platformType, valid := platform[name]; valid { key = platformType @@ -90,6 +70,7 @@ var InputRegDumpFile *os.File = nil var OutputGenFile *os.File = nil var ignoredFieldsFormat bool = false + func IgnoredFieldsFlagSet(flag bool) { ignoredFieldsFormat = flag } @@ -98,6 +79,7 @@ func AreFieldsIgnored() bool { } var nonCheckingFlag bool = false + func NonCheckingFlagSet(flag bool) { nonCheckingFlag = flag } @@ -105,8 +87,8 @@ func IsNonCheckingFlagUsed() bool { return nonCheckingFlag } - var infolevel int = 0 + func InfoLevelSet(lvl int) { infolevel = lvl } @@ -115,17 +97,20 @@ func InfoLevelGet() int { } var fldstyle uint8 = CbFlds + const ( - NoFlds uint8 = 0 - CbFlds uint8 = 1 // coreboot style - FspFlds uint8 = 2 // FSP/edk2 style - RawFlds uint8 = 3 // raw DW0/1 values + NoFlds uint8 = 0 + CbFlds uint8 = 1 // coreboot style + FspFlds uint8 = 2 // FSP/edk2 style + RawFlds uint8 = 3 // raw DW0/1 values ) + var fldstylemap = map[string]uint8{ - "none" : NoFlds, - "cb" : CbFlds, - "fsp" : FspFlds, - "raw" : RawFlds} + "none": NoFlds, + "cb": CbFlds, + "fsp": FspFlds, + "raw": RawFlds} + func FldStyleSet(name string) int { if style, valid := fldstylemap[name]; valid { fldstyle = style diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go index 5e17721187..25ae03aaef 100644 --- a/util/intelp2m/main.go +++ b/util/intelp2m/main.go @@ -61,11 +61,6 @@ func main() { flag.Bool("iiii", false, "Show target PAD_CFG() macro in the comments"), } - template := flag.Int("t", 0, "template type number\n"+ - "\t0 - inteltool.log (default)\n"+ - "\t1 - gpio.h\n"+ - "\t2 - your template\n\t") - platform := flag.String("p", "snr", "set platform:\n"+ "\tsnr - Sunrise PCH or Skylake/Kaby Lake SoC\n"+ "\tlbg - Lewisburg PCH with Xeon SP\n"+ @@ -96,11 +91,6 @@ func main() { } } - if !config.TemplateSet(*template) { - fmt.Printf("Error! Unknown template format of input file!\n") - os.Exit(1) - } - if valid := config.PlatformSet(*platform); valid != 0 { fmt.Printf("Error: invalid platform -%s!\n", *platform) os.Exit(1) diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index c30c69547d..54cadce5df 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -61,12 +61,10 @@ type ParserData struct { // return the host software ownership form the parser struct func (parser *ParserData) hostOwnershipGet(id string) uint8 { var ownership uint8 = 0 - status, group := parser.platform.GroupNameExtract(id) - if config.TemplateGet() == config.TempInteltool && status { - numder, _ := strconv.Atoi(strings.TrimLeft(id, group)) - if (parser.ownership[group] & (1 << uint8(numder))) != 0 { - ownership = 1 - } + _, group := parser.platform.GroupNameExtract(id) + numder, _ := strconv.Atoi(strings.TrimLeft(id, group)) + if (parser.ownership[group] & (1 << uint8(numder))) != 0 { + ownership = 1 } return ownership } @@ -76,22 +74,17 @@ func (parser *ParserData) hostOwnershipGet(id string) uint8 { func (parser *ParserData) padInfoExtract() int { var function, id string var dw0, dw1 uint32 - var template = map[int]template{ - config.TempInteltool: UseInteltoolLogTemplate, - config.TempGpioh: useGpioHTemplate, - config.TempSpec: useYourTemplate, + if rc := UseTemplate(parser.line, &function, &id, &dw0, &dw1); rc != 0 { + return rc } - if template[config.TemplateGet()](parser.line, &function, &id, &dw0, &dw1) == 0 { - pad := padInfo{id: id, - function: function, - dw0: dw0, - dw1: dw1, - ownership: parser.hostOwnershipGet(id)} - parser.padmap = append(parser.padmap, pad) - return 0 - } - fmt.Printf("This template (%d) does not match!\n", config.TemplateGet()) - return -1 + pad := padInfo{id: id, + function: function, + dw0: dw0, + dw1: dw1, + ownership: parser.hostOwnershipGet(id)} + parser.padmap = append(parser.padmap, pad) + return 0 + } // communityGroupExtract @@ -143,8 +136,7 @@ func (parser *ParserData) Register(nameTemplate string) ( offset uint32, value uint32, ) { - if strings.Contains(parser.line, nameTemplate) && - config.TemplateGet() == config.TempInteltool { + if strings.Contains(parser.line, nameTemplate) { if registerInfoTemplate(parser.line, &name, &offset, &value) == 0 { fmt.Printf("\n\t/* %s : 0x%x : 0x%x */\n", name, offset, value) return true, name, offset, value @@ -173,7 +165,7 @@ func (parser *ParserData) padOwnershipExtract() bool { // information from the inteltool log was successfully parsed. func (parser *ParserData) padConfigurationExtract() bool { // Only for Sunrise or CannonLake, and only for inteltool.log file template - if config.TemplateGet() != config.TempInteltool || config.IsPlatformApollo() { + if config.IsPlatformApollo() { return false } return parser.padOwnershipExtract() diff --git a/util/intelp2m/parser/template.go b/util/intelp2m/parser/template.go index fc67e73cd7..e7efa734e7 100644 --- a/util/intelp2m/parser/template.go +++ b/util/intelp2m/parser/template.go @@ -32,7 +32,7 @@ func tokenCheck(c rune) bool { return c != '_' && c != '#' && !unicode.IsLetter(c) && !unicode.IsNumber(c) } -// useGpioHTemplate +// UseTemplate // line : string from file with pad config map // *function : the string that means the pad function // *id : pad id string @@ -40,9 +40,7 @@ func tokenCheck(c rune) bool { // *dw1 : DW1 register value // return // error status -func UseInteltoolLogTemplate(line string, function *string, - id *string, dw0 *uint32, dw1 *uint32) int { - +func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *uint32) int { var val uint64 // 0x0520: 0x0000003c44000600 GPP_B12 SLP_S0# // 0x0438: 0xffffffffffffffff GPP_C7 RESERVED @@ -64,56 +62,6 @@ func UseInteltoolLogTemplate(line string, function *string, return 0 } -// useGpioHTemplate -// line : string from file with pad config map -// *function : the string that means the pad function -// *id : pad id string -// *dw0 : DW0 register value -// *dw1 : DW1 register value -// return -// error status -func useGpioHTemplate(line string, function *string, - id *string, dw0 *uint32, dw1 *uint32) int { - - // /* RCIN# */ _PAD_CFG_STRUCT(GPP_A0, 0x44000702, 0x00000000), - // _PAD_CFG_STRUCT(GPP_A0, 0x44000702, 0x00000000), /* RCIN# */ - // _PAD_CFG_STRUCT(GPP_A0, 0x44000702, 0x00000000) - fields := strings.FieldsFunc(line, tokenCheck) - for i, field := range fields { - if field == "_PAD_CFG_STRUCT" { - if len(fields) < 4 { - /* the number of definitions does not match the format */ - return -1 - } - - if !strings.Contains(fields[i+2], "0x") || !strings.Contains(fields[i+3], "0x") { - /* definitions inside the macro do not match the pattern */ - return -1 - } - *id = fields[i+1] - fmt.Sscanf(fields[i+2], "0x%x", dw0) - fmt.Sscanf(fields[i+3], "0x%x", dw1) - *function = extractPadFuncFromComment(line) - return 0 - } - } - return -1 -} - -// useYourTemplate -func useYourTemplate(line string, function *string, - id *string, dw0 *uint32, dw1 *uint32) int { - - // ADD YOUR TEMPLATE HERE - *function = "" - *id = "" - *dw0 = 0 - *dw1 = 0 - - fmt.Printf("ADD YOUR TEMPLATE!\n") - return -1 -} - // registerInfoTemplate // line : (in) string from file with pad config map // *name : (out) register name diff --git a/util/intelp2m/parser/template_test.go b/util/intelp2m/parser/template_test.go index 98ccb3fc0a..95f8ebf546 100644 --- a/util/intelp2m/parser/template_test.go +++ b/util/intelp2m/parser/template_test.go @@ -20,7 +20,7 @@ func TestTemp(t *testing.T) { dw0, dw1 uint32 ) line := fmt.Sprintf("0x0520: 0x%08x%08x %s %s", ref_dw1, ref_dw0, ref_id, ref_fn) - _ = parser.UseInteltoolLogTemplate(line, &fn, &id, &dw0, &dw1) + _ = parser.UseTemplate(line, &fn, &id, &dw0, &dw1) if fn != ref_fn { t.Errorf("function from '%s':\nExpects: '%s'\nActually: '%s'\n\n", line, ref_fn, fn) diff --git a/util/intelp2m/platforms/adl/macro.go b/util/intelp2m/platforms/adl/macro.go index d7b1f58f0b..2c4b5d81cf 100644 --- a/util/intelp2m/platforms/adl/macro.go +++ b/util/intelp2m/platforms/adl/macro.go @@ -1,14 +1,13 @@ package adl import ( - "strings" "fmt" + "strings" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/config" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" ) const ( @@ -37,10 +36,6 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } if strings.Contains(macro.PadIdGet(), "GPD") { // See reset map for the Alderlake GPD Group in the Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/alderlake/gpio.c#L21 @@ -51,9 +46,9 @@ func (PlatformSpecific) RemmapRstSrc() { dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, - 3: common.RST_PWROK << common.PadRstCfgShift, + 3: common.RST_PWROK << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { @@ -61,7 +56,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } diff --git a/util/intelp2m/platforms/cnl/macro.go b/util/intelp2m/platforms/cnl/macro.go index ae568d5096..6aa6140ef9 100644 --- a/util/intelp2m/platforms/cnl/macro.go +++ b/util/intelp2m/platforms/cnl/macro.go @@ -1,12 +1,12 @@ package cnl import ( - "strings" "fmt" + "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/config" "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -35,13 +35,9 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } if strings.Contains(macro.PadIdGet(), "GPP_A") || - strings.Contains(macro.PadIdGet(), "GPP_B") || - strings.Contains(macro.PadIdGet(), "GPP_G") { + strings.Contains(macro.PadIdGet(), "GPP_B") || + strings.Contains(macro.PadIdGet(), "GPP_G") { // See reset map for the Cannonlake Groups the Community 0: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/cannonlake/gpio.c#L14 // remmap is not required because it is the same as common. @@ -51,7 +47,7 @@ func (PlatformSpecific) RemmapRstSrc() { dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] @@ -60,7 +56,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -85,9 +81,9 @@ func (PlatformSpecific) Pull() { if !valid { str = "INVALID" fmt.Println("Error", - macro.PadIdGet(), - " invalid TERM value = ", - int(dw1.GetTermination())) + macro.PadIdGet(), + " invalid TERM value = ", + int(dw1.GetTermination())) } macro.Separator().Add(str) } @@ -146,7 +142,7 @@ func (PlatformSpecific) GpiMacroAdd() { macro := common.GetMacro() var ids []string macro.Set("PAD_CFG_GPI") - for routeid, isRoute := range map[string]func() (bool) { + for routeid, isRoute := range map[string]func() bool{ "IOAPIC": ioApicRoute, "SCI": sciRoute, "SMI": smiRoute, @@ -204,7 +200,7 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // return: string of macro // error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { - macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro : snr.PlatformSpecific{}}, + macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}}, fields.InterfaceGet()) macro.Clear() macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index 64d6f32409..1fb0a3273a 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -3,11 +3,10 @@ package ebg import ( "fmt" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - "review.coreboot.org/coreboot.git/util/intelp2m/config" "review.coreboot.org/coreboot.git/util/intelp2m/fields" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( @@ -37,14 +36,10 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] @@ -53,7 +48,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -88,12 +83,13 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ - InheritanceMacro : cnl.PlatformSpecific{ - InheritanceMacro : snr.PlatformSpecific{}, + InheritanceMacro: cnl.PlatformSpecific{ + InheritanceMacro: snr.PlatformSpecific{}, }, }, fields.InterfaceGet(), diff --git a/util/intelp2m/platforms/jsl/macro.go b/util/intelp2m/platforms/jsl/macro.go index 89cf2f0cc7..42c254b190 100644 --- a/util/intelp2m/platforms/jsl/macro.go +++ b/util/intelp2m/platforms/jsl/macro.go @@ -1,14 +1,13 @@ package jsl import ( - "strings" "fmt" + "strings" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/config" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" ) const ( @@ -37,15 +36,11 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } if strings.Contains(macro.PadIdGet(), "GPP_F") || - strings.Contains(macro.PadIdGet(), "GPP_B") || - strings.Contains(macro.PadIdGet(), "GPP_A") || - strings.Contains(macro.PadIdGet(), "GPP_S") || - strings.Contains(macro.PadIdGet(), "GPP_R") { + strings.Contains(macro.PadIdGet(), "GPP_B") || + strings.Contains(macro.PadIdGet(), "GPP_A") || + strings.Contains(macro.PadIdGet(), "GPP_S") || + strings.Contains(macro.PadIdGet(), "GPP_R") { // See reset map for the Jasper Lake Community 0: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/jasperlake/gpio.c#L21 // remmap is not required because it is the same as common. @@ -55,7 +50,7 @@ func (PlatformSpecific) RemmapRstSrc() { dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] @@ -64,7 +59,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -99,7 +94,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ diff --git a/util/intelp2m/platforms/lbg/macro.go b/util/intelp2m/platforms/lbg/macro.go index 3c71ca87dc..8a706e3d5d 100644 --- a/util/intelp2m/platforms/lbg/macro.go +++ b/util/intelp2m/platforms/lbg/macro.go @@ -3,9 +3,8 @@ package lbg import ( "fmt" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - "review.coreboot.org/coreboot.git/util/intelp2m/config" "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -36,14 +35,10 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] @@ -52,7 +47,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -91,8 +86,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() { func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { // The GPIO controller architecture in Lewisburg and Sunrise are very similar, // so we will inherit some platform-dependent functions from Sunrise. - macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro : snr.PlatformSpecific{}}, - fields.InterfaceGet()) + macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}}, + fields.InterfaceGet()) macro.Clear() macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) diff --git a/util/intelp2m/platforms/mtl/macro.go b/util/intelp2m/platforms/mtl/macro.go index 512dd719e3..06d05996c3 100644 --- a/util/intelp2m/platforms/mtl/macro.go +++ b/util/intelp2m/platforms/mtl/macro.go @@ -1,14 +1,13 @@ package mtl import ( - "strings" "fmt" + "strings" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/config" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" ) const ( @@ -37,23 +36,19 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } if strings.Contains(macro.PadIdGet(), "GPD") { // See reset map for the MeteorLake GPD group at - // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/meteorlake/gpio.c#L10 - // remmap is not required because it is the same as common. + // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/meteorlake/gpio.c#L10 + // remmap is not required because it is the same as common. return } dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, - 3: common.RST_PWROK << common.PadRstCfgShift, + 3: common.RST_PWROK << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { @@ -61,7 +56,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -92,12 +87,12 @@ func (platform PlatformSpecific) NoConnMacroAdd() { platform.InheritanceMacro.NoConnMacroAdd() } - // GenMacro - generate pad macro // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ diff --git a/util/intelp2m/platforms/snr/macro.go b/util/intelp2m/platforms/snr/macro.go index 382616c6a3..d96e83e2e2 100644 --- a/util/intelp2m/platforms/snr/macro.go +++ b/util/intelp2m/platforms/snr/macro.go @@ -1,12 +1,12 @@ package snr import ( - "strings" "fmt" + "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/config" "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) const ( @@ -20,15 +20,11 @@ const ( MAX_DW_NUM = common.MAX_DW_NUM ) -type PlatformSpecific struct {} +type PlatformSpecific struct{} // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } if strings.Contains(macro.PadIdGet(), "GPD") { // See reset map for the Sunrise GPD Group in the Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/skylake/gpio.c#L15 @@ -39,7 +35,7 @@ func (PlatformSpecific) RemmapRstSrc() { dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] @@ -48,7 +44,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -73,9 +69,9 @@ func (PlatformSpecific) Pull() { if !valid { str = "INVALID" fmt.Println("Error", - macro.PadIdGet(), - " invalid TERM value = ", - int(dw1.GetTermination())) + macro.PadIdGet(), + " invalid TERM value = ", + int(dw1.GetTermination())) } macro.Separator().Add(str) } @@ -146,7 +142,7 @@ func (PlatformSpecific) GpiMacroAdd() { macro := common.GetMacro() var ids []string macro.Set("PAD_CFG_GPI") - for routeid, isRoute := range map[string]func() (bool) { + for routeid, isRoute := range map[string]func() bool{ "IOAPIC": ioApicRoute, "SCI": sciRoute, "SMI": smiRoute, diff --git a/util/intelp2m/platforms/tgl/macro.go b/util/intelp2m/platforms/tgl/macro.go index 3b436ee3bb..c925eeb30c 100644 --- a/util/intelp2m/platforms/tgl/macro.go +++ b/util/intelp2m/platforms/tgl/macro.go @@ -1,14 +1,13 @@ package tgl import ( - "strings" "fmt" + "strings" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/config" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" ) const ( @@ -37,10 +36,6 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - if config.TemplateGet() != config.TempInteltool { - // Use reset source remapping only if the input file is inteltool.log dump - return - } if strings.Contains(macro.PadIdGet(), "GPD") { // See reset map for the TigerLake Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/tigerlake/gpio.c#L21 @@ -51,7 +46,7 @@ func (PlatformSpecific) RemmapRstSrc() { dw0 := macro.Register(PAD_CFG_DW0) var remapping = map[uint8]uint32{ 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, + 1: common.RST_DEEP << common.PadRstCfgShift, 2: common.RST_PLTRST << common.PadRstCfgShift, } resetsrc, valid := remapping[dw0.GetResetConfig()] @@ -60,7 +55,7 @@ func (PlatformSpecific) RemmapRstSrc() { ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] dw0.ValueSet(ResetConfigFieldVal) } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet()) + fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } dw0.CntrMaskFieldsClear(common.PadRstCfgMask) } @@ -95,7 +90,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ diff --git a/util/intelp2m/version.txt b/util/intelp2m/version.txt index 9459d4ba2a..5625e59da8 100644 --- a/util/intelp2m/version.txt +++ b/util/intelp2m/version.txt @@ -1 +1 @@ -1.1 +1.2 From 5fe0b88b157222191c0b8b9c3a9973a888449de7 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Sat, 26 Nov 2022 00:14:17 +0300 Subject: [PATCH 0249/3886] util/intelp2m/config: Rework configuration package - Reduce the number of methods for updating settings and redefine types to make the code cleaner and more readable. - Move the configuration to the p2m package to add settings from new utilities based on the intelp2m code. - Make some code style fixes. TEST: make test = PASS Change-Id: Ia1b19ae3122bcf6ec740ae4683d62f31570670b1 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/70308 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune Reviewed-by: David Hendricks --- util/intelp2m/config/config.go | 135 -------------------- util/intelp2m/config/p2m/config.go | 83 ++++++++++++ util/intelp2m/fields/cb/cb.go | 142 +++++++++++---------- util/intelp2m/fields/fields.go | 18 +-- util/intelp2m/main.go | 93 ++++++-------- util/intelp2m/parser/parser.go | 32 ++--- util/intelp2m/parser/parser_test.go | 20 ++- util/intelp2m/platforms/apl/macro.go | 46 +++---- util/intelp2m/platforms/cnl/macro.go | 9 +- util/intelp2m/platforms/common/macro.go | 51 ++++---- util/intelp2m/platforms/common/register.go | 13 +- util/intelp2m/platforms/snr/macro.go | 9 +- util/intelp2m/platforms/test/suite.go | 14 +- 13 files changed, 306 insertions(+), 359 deletions(-) delete mode 100644 util/intelp2m/config/config.go create mode 100644 util/intelp2m/config/p2m/config.go diff --git a/util/intelp2m/config/config.go b/util/intelp2m/config/config.go deleted file mode 100644 index 7b4486b3be..0000000000 --- a/util/intelp2m/config/config.go +++ /dev/null @@ -1,135 +0,0 @@ -package config - -import "os" - -const ( - SunriseType uint8 = 0 - LewisburgType uint8 = 1 - ApolloType uint8 = 2 - CannonType uint8 = 3 - TigerType uint8 = 4 - AlderType uint8 = 5 - JasperType uint8 = 6 - MeteorType uint8 = 7 - EmmitsburgType uint8 = 8 -) - -var key uint8 = SunriseType - -var platform = map[string]uint8{ - "snr": SunriseType, - "lbg": LewisburgType, - "apl": ApolloType, - "cnl": CannonType, - "tgl": TigerType, - "adl": AlderType, - "jsl": JasperType, - "mtl": MeteorType, - "ebg": EmmitsburgType, -} - -func PlatformSet(name string) int { - if platformType, valid := platform[name]; valid { - key = platformType - return 0 - } - return -1 -} -func PlatformGet() uint8 { - return key -} -func IsPlatform(platformType uint8) bool { - return platformType == key -} -func IsPlatformApollo() bool { - return IsPlatform(ApolloType) -} -func IsPlatformSunrise() bool { - return IsPlatform(SunriseType) -} -func IsPlatformLewisburg() bool { - return IsPlatform(LewisburgType) -} -func IsPlatformCannonLake() bool { - return IsPlatform(CannonType) -} -func IsPlatformTigerLake() bool { - return IsPlatform(TigerType) -} -func IsPlatformAlderLakeH() bool { - return IsPlatform(AlderType) -} -func IsPlatformMeteorLake() bool { - return IsPlatform(MeteorType) -} -func IsPlatformEmmitsburg() bool { - return IsPlatform(EmmitsburgType) -} - -var InputRegDumpFile *os.File = nil -var OutputGenFile *os.File = nil - -var ignoredFieldsFormat bool = false - -func IgnoredFieldsFlagSet(flag bool) { - ignoredFieldsFormat = flag -} -func AreFieldsIgnored() bool { - return ignoredFieldsFormat -} - -var nonCheckingFlag bool = false - -func NonCheckingFlagSet(flag bool) { - nonCheckingFlag = flag -} -func IsNonCheckingFlagUsed() bool { - return nonCheckingFlag -} - -var infolevel int = 0 - -func InfoLevelSet(lvl int) { - infolevel = lvl -} -func InfoLevelGet() int { - return infolevel -} - -var fldstyle uint8 = CbFlds - -const ( - NoFlds uint8 = 0 - CbFlds uint8 = 1 // coreboot style - FspFlds uint8 = 2 // FSP/edk2 style - RawFlds uint8 = 3 // raw DW0/1 values -) - -var fldstylemap = map[string]uint8{ - "none": NoFlds, - "cb": CbFlds, - "fsp": FspFlds, - "raw": RawFlds} - -func FldStyleSet(name string) int { - if style, valid := fldstylemap[name]; valid { - fldstyle = style - return 0 - } - return -1 -} -func FldStyleGet() uint8 { - return fldstyle -} -func IsFieldsMacroUsed() bool { - return FldStyleGet() != NoFlds -} -func IsCbStyleMacro() bool { - return FldStyleGet() == CbFlds -} -func IsFspStyleMacro() bool { - return FldStyleGet() == FspFlds -} -func IsRawFields() bool { - return FldStyleGet() == RawFlds -} diff --git a/util/intelp2m/config/p2m/config.go b/util/intelp2m/config/p2m/config.go new file mode 100644 index 0000000000..ce03ee0c36 --- /dev/null +++ b/util/intelp2m/config/p2m/config.go @@ -0,0 +1,83 @@ +package p2m + +import ( + "fmt" + "os" +) + +type PlatformType int +type FieldType int + +const ( + Sunrise PlatformType = iota + Lewisburg + Apollo + Cannon + Alder + Jasper + Tiger + Meteor + Emmitsburg +) + +const ( + NoFlds FieldType = iota + CbFlds // coreboot style + FspFlds // FSP/edk2 style + RawFlds // raw DW0/1 values +) + +var platforms = map[string]PlatformType{ + "snr": Sunrise, + "lbg": Lewisburg, + "apl": Apollo, + "cnl": Cannon, + "tgl": Tiger, + "adl": Alder, + "jsl": Jasper, + "mtl": Meteor, + "ebg": Emmitsburg, +} + +var fields = map[string]FieldType{ + "none": NoFlds, + "cb": CbFlds, + "fsp": FspFlds, + "raw": RawFlds, +} + +type Settings struct { + Version string + Platform PlatformType + Field FieldType + InputFile *os.File + OutputFile *os.File + IgnoredFields bool + AutoCheck bool + GenLevel int +} + +var Config = Settings{ + Version: "unknown", + Platform: Sunrise, + Field: CbFlds, + IgnoredFields: false, + AutoCheck: true, + GenLevel: 0, +} + +func SetPlatformType(format string) error { + if _, exist := platforms[format]; !exist { + return fmt.Errorf("unknown platform type %s", format) + } + Config.Platform = platforms[format] + return nil +} + +func SetFieldType(format string) error { + if _, exist := fields[format]; !exist { + return fmt.Errorf("unknown field type %s", format) + } + Config.Field = fields[format] + return nil +} diff --git a/util/intelp2m/fields/cb/cb.go b/util/intelp2m/fields/cb/cb.go index a70b2a63a8..efc80184f6 100644 --- a/util/intelp2m/fields/cb/cb.go +++ b/util/intelp2m/fields/cb/cb.go @@ -1,11 +1,11 @@ package cb import ( - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) -type FieldMacros struct {} +type FieldMacros struct{} // field - data structure for creating a new bitfield macro object // PAD_FUNC(NF3) @@ -42,7 +42,9 @@ func generate(fields ...*field) { } } } - if allhidden { macro.Add("0") } + if allhidden { + macro.Add("0") + } } // DecodeDW0 - decode value of DW0 register @@ -50,80 +52,80 @@ func (FieldMacros) DecodeDW0() { macro := common.GetMacro() dw0 := macro.Register(common.PAD_CFG_DW0) generate( - &field { - prefix : "PAD_FUNC", + &field{ + prefix: "PAD_FUNC", // TODO: Find another way to hide PAD_FUNC(GPIO) in the comment with // ignored fields - unhide : config.InfoLevelGet() < 3 || dw0.GetPadMode() != 0, - configurator : func() { macro.Padfn() }, + unhide: p2m.Config.GenLevel < 3 || dw0.GetPadMode() != 0, + configurator: func() { macro.Padfn() }, }, - &field { - prefix : "PAD_RESET", - unhide : dw0.GetResetConfig() != 0, - configurator : func() { macro.Rstsrc() }, + &field{ + prefix: "PAD_RESET", + unhide: dw0.GetResetConfig() != 0, + configurator: func() { macro.Rstsrc() }, }, - &field { - prefix : "PAD_TRIG", - unhide : dw0.GetRXLevelEdgeConfiguration() != 0, - configurator : func() { macro.Trig() }, + &field{ + prefix: "PAD_TRIG", + unhide: dw0.GetRXLevelEdgeConfiguration() != 0, + configurator: func() { macro.Trig() }, }, - &field { - prefix : "PAD_IRQ_ROUTE", - name : "IOAPIC", - unhide : dw0.GetGPIOInputRouteIOxAPIC() != 0, + &field{ + prefix: "PAD_IRQ_ROUTE", + name: "IOAPIC", + unhide: dw0.GetGPIOInputRouteIOxAPIC() != 0, }, - &field { - prefix : "PAD_IRQ_ROUTE", - name : "SCI", - unhide : dw0.GetGPIOInputRouteSCI() != 0, + &field{ + prefix: "PAD_IRQ_ROUTE", + name: "SCI", + unhide: dw0.GetGPIOInputRouteSCI() != 0, }, - &field { - prefix : "PAD_IRQ_ROUTE", - name : "SMI", - unhide : dw0.GetGPIOInputRouteSMI() != 0, + &field{ + prefix: "PAD_IRQ_ROUTE", + name: "SMI", + unhide: dw0.GetGPIOInputRouteSMI() != 0, }, - &field { - prefix : "PAD_IRQ_ROUTE", - name : "NMI", - unhide : dw0.GetGPIOInputRouteNMI() != 0, + &field{ + prefix: "PAD_IRQ_ROUTE", + name: "NMI", + unhide: dw0.GetGPIOInputRouteNMI() != 0, }, - &field { - prefix : "PAD_RX_POL", - unhide : dw0.GetRxInvert() != 0, - configurator : func() { macro.Invert() }, + &field{ + prefix: "PAD_RX_POL", + unhide: dw0.GetRxInvert() != 0, + configurator: func() { macro.Invert() }, }, - &field { - prefix : "PAD_BUF", - unhide : dw0.GetGPIORxTxDisableStatus() != 0, - configurator : func() { macro.Bufdis() }, + &field{ + prefix: "PAD_BUF", + unhide: dw0.GetGPIORxTxDisableStatus() != 0, + configurator: func() { macro.Bufdis() }, }, - &field { - name : "(1 << 29)", - unhide : dw0.GetRXPadStateSelect() != 0, + &field{ + name: "(1 << 29)", + unhide: dw0.GetRXPadStateSelect() != 0, }, - &field { - name : "(1 << 28)", - unhide : dw0.GetRXRawOverrideStatus() != 0, + &field{ + name: "(1 << 28)", + unhide: dw0.GetRXRawOverrideStatus() != 0, }, - &field { - name : "(1 << 1)", - unhide : dw0.GetGPIORXState() != 0, + &field{ + name: "(1 << 1)", + unhide: dw0.GetGPIORXState() != 0, }, - &field { - name : "1", - unhide : dw0.GetGPIOTXState() != 0, + &field{ + name: "1", + unhide: dw0.GetGPIOTXState() != 0, }, ) } @@ -133,33 +135,33 @@ func (FieldMacros) DecodeDW1() { macro := common.GetMacro() dw1 := macro.Register(common.PAD_CFG_DW1) generate( - &field { - name : "PAD_CFG1_TOL_1V8", - unhide : dw1.GetPadTol() != 0, + &field{ + name: "PAD_CFG1_TOL_1V8", + unhide: dw1.GetPadTol() != 0, }, - &field { - prefix : "PAD_PULL", - unhide : dw1.GetTermination() != 0, - configurator : func() { macro.Pull() }, + &field{ + prefix: "PAD_PULL", + unhide: dw1.GetTermination() != 0, + configurator: func() { macro.Pull() }, }, - &field { - prefix : "PAD_IOSSTATE", - unhide : dw1.GetIOStandbyState() != 0, - configurator : func() { macro.IOSstate() }, + &field{ + prefix: "PAD_IOSSTATE", + unhide: dw1.GetIOStandbyState() != 0, + configurator: func() { macro.IOSstate() }, }, - &field { - prefix : "PAD_IOSTERM", - unhide : dw1.GetIOStandbyTermination() != 0, - configurator : func() { macro.IOTerm() }, + &field{ + prefix: "PAD_IOSTERM", + unhide: dw1.GetIOStandbyTermination() != 0, + configurator: func() { macro.IOTerm() }, }, - &field { - prefix : "PAD_CFG_OWN_GPIO", - unhide : macro.IsOwnershipDriver(), - configurator : func() { macro.Own() }, + &field{ + prefix: "PAD_CFG_OWN_GPIO", + unhide: macro.IsOwnershipDriver(), + configurator: func() { macro.Own() }, }, ) } diff --git a/util/intelp2m/fields/fields.go b/util/intelp2m/fields/fields.go index 4f14c815d2..4e41aff4ca 100644 --- a/util/intelp2m/fields/fields.go +++ b/util/intelp2m/fields/fields.go @@ -1,21 +1,21 @@ package fields import ( - "review.coreboot.org/coreboot.git/util/intelp2m/config" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/fsp" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields/cb" + "review.coreboot.org/coreboot.git/util/intelp2m/fields/fsp" "review.coreboot.org/coreboot.git/util/intelp2m/fields/raw" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) // InterfaceSet - set the interface for decoding configuration // registers DW0 and DW1. func InterfaceGet() common.Fields { - var fldstylemap = map[uint8]common.Fields{ - config.NoFlds : cb.FieldMacros{}, // analyze fields using cb macros - config.CbFlds : cb.FieldMacros{}, - config.FspFlds : fsp.FieldMacros{}, - config.RawFlds : raw.FieldMacros{}, + var fldstylemap = map[p2m.FieldType]common.Fields{ + p2m.NoFlds: cb.FieldMacros{}, // analyze fields using cb macros + p2m.CbFlds: cb.FieldMacros{}, + p2m.FspFlds: fsp.FieldMacros{}, + p2m.RawFlds: raw.FieldMacros{}, } - return fldstylemap[config.FldStyleGet()] + return fldstylemap[p2m.Config.Field] } diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go index 25ae03aaef..f0e2203c3f 100644 --- a/util/intelp2m/main.go +++ b/util/intelp2m/main.go @@ -4,22 +4,23 @@ import ( "flag" "fmt" "os" + "path/filepath" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/parser" ) type Printer struct{} func (Printer) Linef(lvl int, format string, args ...interface{}) { - if config.InfoLevelGet() >= lvl { - fmt.Fprintf(config.OutputGenFile, format, args...) + if p2m.Config.GenLevel >= lvl { + fmt.Fprintf(p2m.Config.OutputFile, format, args...) } } func (Printer) Line(lvl int, str string) { - if config.InfoLevelGet() >= lvl { - fmt.Fprint(config.OutputGenFile, str) + if p2m.Config.GenLevel >= lvl { + fmt.Fprint(p2m.Config.OutputFile, str) } } @@ -36,25 +37,22 @@ func printVersion() { // main func main() { // Command line arguments - inputFileName := flag.String("file", - "inteltool.log", + inputFilePath := flag.String("file", "inteltool.log", "the path to the inteltool log file\n") - outputFileName := flag.String("o", + outputFilePath := flag.String("o", "generate/gpio.h", "the path to the generated file with GPIO configuration\n") - ignFlag := flag.Bool("ign", - false, + ignored := flag.Bool("ign", false, "exclude fields that should be ignored from advanced macros\n") - nonCheckFlag := flag.Bool("n", - false, + unchecking := flag.Bool("n", false, "Generate macros without checking.\n"+ "\tIn this case, some fields of the configuration registers\n"+ "\tDW0 will be ignored.\n") - infoLevels := []*bool{ + levels := []*bool{ flag.Bool("i", false, "Show pads function in the comments"), flag.Bool("ii", false, "Show DW0/DW1 value in the comments"), flag.Bool("iii", false, "Show ignored bit fields in the comments"), @@ -72,63 +70,55 @@ func main() { "\tmtl - MeteorLake SoC\n"+ "\tebg - Emmitsburg PCH with Xeon SP\n") - fieldstyle := flag.String("fld", "none", "set fields macros style:\n"+ + field := flag.String("fld", "none", "set fields macros style:\n"+ "\tcb - use coreboot style for bit fields macros\n"+ "\tfsp - use fsp style\n"+ "\traw - do not convert, print as is\n") - printVersion() flag.Parse() + printVersion() - config.IgnoredFieldsFlagSet(*ignFlag) - config.NonCheckingFlagSet(*nonCheckFlag) - - for level, flag := range infoLevels { - if *flag { - config.InfoLevelSet(level + 1) + // settings + p2m.Config.Version = Version + p2m.Config.IgnoredFields = *ignored + p2m.Config.AutoCheck = !(*unchecking) + for level, set := range levels { + if *set { + p2m.Config.GenLevel = level + 1 fmt.Printf("Info level: Use level %d!\n", level+1) break } } - if valid := config.PlatformSet(*platform); valid != 0 { - fmt.Printf("Error: invalid platform -%s!\n", *platform) + if err := p2m.SetPlatformType(*platform); err != nil { + fmt.Printf("Error: %v\n", err) os.Exit(1) } - fmt.Println("Log file:", *inputFileName) - fmt.Println("Output generated file:", *outputFileName) - - inputRegDumpFile, err := os.Open(*inputFileName) - if err != nil { - fmt.Printf("Error: inteltool log file was not found!\n") + if err := p2m.SetFieldType(*field); err != nil { + fmt.Printf("Error: %v\n", err) os.Exit(1) } - if config.FldStyleSet(*fieldstyle) != 0 { - fmt.Printf("Error! Unknown bit fields style option -%s!\n", *fieldstyle) + if file, err := os.Open(*inputFilePath); err != nil { + fmt.Printf("input file error: %v", err) + os.Exit(1) + } else { + p2m.Config.InputFile = file + } + defer p2m.Config.InputFile.Close() + + if err := os.MkdirAll(filepath.Dir(*outputFilePath), os.ModePerm); err != nil { + fmt.Printf("failed to create output directory: %v", err) os.Exit(1) } - - // create dir for output files - err = os.MkdirAll("generate", os.ModePerm) - if err != nil { - fmt.Printf("Error! Can not create a directory for the generated files!\n") + if file, err := os.Create(*outputFilePath); err != nil { + fmt.Printf("failed to create output file: %v", err) os.Exit(1) + } else { + p2m.Config.OutputFile = file } - - // create empty gpio.h file - outputGenFile, err := os.Create(*outputFileName) - if err != nil { - fmt.Printf("Error: unable to generate GPIO config file!\n") - os.Exit(1) - } - - defer inputRegDumpFile.Close() - defer outputGenFile.Close() - - config.OutputGenFile = outputGenFile - config.InputRegDumpFile = inputRegDumpFile + defer p2m.Config.OutputFile.Close() prs := parser.ParserData{} prs.Parse() @@ -146,15 +136,16 @@ func main() { /* Pad configuration was generated automatically using intelp2m %s */ static const struct pad_config gpio_table[] = {`, Version) - config.OutputGenFile.WriteString(header + "\n") + p2m.Config.OutputFile.WriteString(header + "\n") // Add the pads map if err := generator.Run(); err != nil { fmt.Printf("Error: %v", err) os.Exit(1) } - config.OutputGenFile.WriteString(`}; + p2m.Config.OutputFile.WriteString(`}; #endif /* CFG_GPIO_H */ `) + os.Exit(0) } diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index 54cadce5df..f2756107bf 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" @@ -96,28 +96,28 @@ func (parser *ParserData) communityGroupExtract() { // PlatformSpecificInterfaceSet - specific interface for the platform selected // in the configuration func (parser *ParserData) PlatformSpecificInterfaceSet() { - var platform = map[uint8]PlatformSpecific{ - config.SunriseType: snr.PlatformSpecific{}, + platform := map[p2m.PlatformType]PlatformSpecific{ + p2m.Sunrise: snr.PlatformSpecific{}, // See platforms/lbg/macro.go - config.LewisburgType: lbg.PlatformSpecific{ + p2m.Lewisburg: lbg.PlatformSpecific{ InheritanceTemplate: snr.PlatformSpecific{}, }, - config.ApolloType: apl.PlatformSpecific{}, - config.CannonType: cnl.PlatformSpecific{ + p2m.Apollo: apl.PlatformSpecific{}, + p2m.Cannon: cnl.PlatformSpecific{ InheritanceTemplate: snr.PlatformSpecific{}, }, - config.TigerType: tgl.PlatformSpecific{}, - config.AlderType: adl.PlatformSpecific{}, - config.JasperType: jsl.PlatformSpecific{}, - config.MeteorType: mtl.PlatformSpecific{}, + p2m.Tiger: tgl.PlatformSpecific{}, + p2m.Alder: adl.PlatformSpecific{}, + p2m.Jasper: jsl.PlatformSpecific{}, + p2m.Meteor: mtl.PlatformSpecific{}, // See platforms/ebg/macro.go - config.EmmitsburgType: ebg.PlatformSpecific{ + p2m.Emmitsburg: ebg.PlatformSpecific{ InheritanceTemplate: cnl.PlatformSpecific{ InheritanceTemplate: snr.PlatformSpecific{}, }, }, } - parser.platform = platform[config.PlatformGet()] + parser.platform = platform[p2m.Config.Platform] } // Register - read specific platform registers (32 bits) @@ -164,8 +164,7 @@ func (parser *ParserData) padOwnershipExtract() bool { // // information from the inteltool log was successfully parsed. func (parser *ParserData) padConfigurationExtract() bool { - // Only for Sunrise or CannonLake, and only for inteltool.log file template - if config.IsPlatformApollo() { + if p2m.Config.Platform == p2m.Apollo { return false } return parser.padOwnershipExtract() @@ -183,7 +182,8 @@ func (parser *ParserData) Parse() { // map of thepad ownership registers for the GPIO controller parser.ownership = make(map[string]uint32) - scanner := bufio.NewScanner(config.InputRegDumpFile) + file := p2m.Config.InputFile + scanner := bufio.NewScanner(file) for scanner.Scan() { parser.line = scanner.Text() isIncluded, _ := common.KeywordsCheck(parser.line, "GPIO Community", "GPIO Group") @@ -234,7 +234,7 @@ func (g Generator) Run() error { g.Linef(2, "\n\t/* %s - %s */\n\t/* DW0: 0x%0.8x, DW1: 0x%0.8x */\n", pad.id, pad.function, pad.dw0, pad.dw1) g.Linef(0, "\t%s", macro) - if config.InfoLevelGet() == 1 { + if p2m.Config.GenLevel == 1 { g.Linef(1, "\t/* %s */", pad.function) } g.Line(0, "\n") diff --git a/util/intelp2m/parser/parser_test.go b/util/intelp2m/parser/parser_test.go index 4f0e4523d1..5e59ade566 100644 --- a/util/intelp2m/parser/parser_test.go +++ b/util/intelp2m/parser/parser_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/parser" ) @@ -16,19 +16,20 @@ type Printer struct { } func (p *Printer) Linef(lvl int, format string, args ...interface{}) { - if config.InfoLevelGet() >= lvl { + if p2m.Config.GenLevel >= lvl { p.lines = append(p.lines, fmt.Sprintf(format, args...)) } } func (p *Printer) Line(lvl int, str string) { - if config.InfoLevelGet() >= lvl { + if p2m.Config.GenLevel >= lvl { p.lines = append(p.lines, str) } } func TestParser(t *testing.T) { t.Run("PARSER/PARSE-INTELTOOL-FILE", func(t *testing.T) { + var err error reference := []string{ "\n\t/* ------- GPIO Community 0 ------- */\n", "\n\t/* ------- GPIO Group GPP_A ------- */\n", @@ -62,18 +63,15 @@ func TestParser(t *testing.T) { "\tPAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1),", "\t/* DDPC_HPD1 */", "\n", "\tPAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1),", "\t/* DDPD_HPD2 */", "\n", } - - input, err := os.Open(testLogFilePath) - if err != nil { + if p2m.Config.InputFile, err = os.Open(testLogFilePath); err != nil { t.Errorf("Something is wrong with the test file - %s!\n", testLogFilePath) os.Exit(1) } - defer input.Close() + defer p2m.Config.InputFile.Close() - config.InputRegDumpFile = input - config.FldStyleSet("none") - config.NonCheckingFlagSet(true) - config.InfoLevelSet(1) + p2m.Config.AutoCheck = false + p2m.Config.Field = p2m.NoFlds + p2m.Config.GenLevel = 1 prs := parser.ParserData{} prs.Parse() diff --git a/util/intelp2m/platforms/apl/macro.go b/util/intelp2m/platforms/apl/macro.go index 31972777d3..e5ac7c2a49 100644 --- a/util/intelp2m/platforms/apl/macro.go +++ b/util/intelp2m/platforms/apl/macro.go @@ -4,9 +4,9 @@ import ( "fmt" "strconv" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) const ( @@ -21,18 +21,18 @@ const ( ) const ( - PULL_NONE = 0x0 // 0 000: none - PULL_DN_5K = 0x2 // 0 010: 5k wpd (Only available on SMBus GPIOs) - PULL_DN_20K = 0x4 // 0 100: 20k wpd + PULL_NONE = 0x0 // 0 000: none + PULL_DN_5K = 0x2 // 0 010: 5k wpd (Only available on SMBus GPIOs) + PULL_DN_20K = 0x4 // 0 100: 20k wpd // PULL_NONE = 0x8 // 1 000: none - PULL_UP_1K = 0x9 // 1 001: 1k wpu (Only available on I2C GPIOs) - PULL_UP_2K = 0xb // 1 011: 2k wpu (Only available on I2C GPIOs) - PULL_UP_20K = 0xc // 1 100: 20k wpu - PULL_UP_667 = 0xd // 1 101: 1k & 2k wpu (Only available on I2C GPIOs) - PULL_NATIVE = 0xf // 1 111: (optional) Native controller selected by Pad Mode + PULL_UP_1K = 0x9 // 1 001: 1k wpu (Only available on I2C GPIOs) + PULL_UP_2K = 0xb // 1 011: 2k wpu (Only available on I2C GPIOs) + PULL_UP_20K = 0xc // 1 100: 20k wpu + PULL_UP_667 = 0xd // 1 101: 1k & 2k wpu (Only available on I2C GPIOs) + PULL_NATIVE = 0xf // 1 111: (optional) Native controller selected by Pad Mode ) -type PlatformSpecific struct {} +type PlatformSpecific struct{} // RemmapRstSrc - remmap Pad Reset Source Config // remmap is not required because it is the same as common. @@ -52,7 +52,6 @@ func (PlatformSpecific) Pull() { PULL_UP_20K: "UP_20K", PULL_UP_667: "UP_667", PULL_NATIVE: "NATIVE", - } terminationFieldValue := dw1.GetTermination() str, valid := pull[terminationFieldValue] @@ -107,7 +106,7 @@ func sciRoute() bool { // PAD_CFG_GPI_SCI_IOS(GPIO_141, NONE, DEEP, EDGE_SINGLE, INVERT, IGNORE, DISPUPD), macro.Add("_SCI_IOS") macro.Add("(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() - } else if dw0.GetRXLevelEdgeConfiguration() & 0x1 != 0 { + } else if dw0.GetRXLevelEdgeConfiguration()&0x1 != 0 { // e.g. PAD_CFG_GPI_ACPI_SCI(GPP_G2, NONE, DEEP, YES), macro.Add("_ACPI_SCI").Add("(").Id().Pull().Rstsrc().Invert() } else { @@ -130,7 +129,7 @@ func smiRoute() bool { // PAD_CFG_GPI_SMI_IOS(GPIO_41, UP_20K, DEEP, EDGE_SINGLE, NONE, IGNORE, SAME), macro.Add("_SMI_IOS") macro.Add("(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() - } else if dw0.GetRXLevelEdgeConfiguration() & 0x1 != 0 { + } else if dw0.GetRXLevelEdgeConfiguration()&0x1 != 0 { // e.g. PAD_CFG_GPI_ACPI_SMI(GPP_I3, NONE, DEEP, YES), macro.Add("_ACPI_SMI").Add("(").Id().Pull().Rstsrc().Invert() } else { @@ -143,10 +142,11 @@ func smiRoute() bool { // Generate macro for GPI port func (PlatformSpecific) GpiMacroAdd() { - macro := common.GetMacro() var ids []string + + macro := common.GetMacro() macro.Set("PAD_CFG_GPI") - for routeid, isRoute := range map[string]func() (bool) { + for routeid, isRoute := range map[string]func() bool{ "IOAPIC": ioApicRoute, "SCI": sciRoute, "SMI": smiRoute, @@ -157,7 +157,7 @@ func (PlatformSpecific) GpiMacroAdd() { } } - switch argc := len(ids); argc { + switch config, argc := p2m.Config, len(ids); argc { case 0: dw1 := macro.Register(PAD_CFG_DW1) isIOStandbyStateUsed := dw1.GetIOStandbyState() != 0 @@ -176,14 +176,14 @@ func (PlatformSpecific) GpiMacroAdd() { } case 1: // GPI with IRQ route - if config.AreFieldsIgnored() { + if config.IgnoredFields { macro.SetPadOwnership(common.PAD_OWN_ACPI) } case 2: // PAD_CFG_GPI_DUAL_ROUTE(pad, pull, rst, trig, inv, route1, route2) macro.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() macro.Add(", " + ids[0] + ", " + ids[1] + "),") - if config.AreFieldsIgnored() { + if config.IgnoredFields { macro.SetPadOwnership(common.PAD_OWN_ACPI) } default: @@ -193,12 +193,11 @@ func (PlatformSpecific) GpiMacroAdd() { } } - // Adds PAD_CFG_GPO macro with arguments func (PlatformSpecific) GpoMacroAdd() { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - dw1 := macro.Register(PAD_CFG_DW1) + dw0 := macro.Register(PAD_CFG_DW0) + dw1 := macro.Register(PAD_CFG_DW1) term := dw1.GetTermination() macro.Set("PAD_CFG") @@ -291,7 +290,8 @@ func (PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro(PlatformSpecific{}, fields.InterfaceGet()) // use platform-specific interface in Macro struct diff --git a/util/intelp2m/platforms/cnl/macro.go b/util/intelp2m/platforms/cnl/macro.go index 6aa6140ef9..19fee99cb9 100644 --- a/util/intelp2m/platforms/cnl/macro.go +++ b/util/intelp2m/platforms/cnl/macro.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" @@ -159,7 +159,7 @@ func (PlatformSpecific) GpiMacroAdd() { macro.Add("_TRIG_OWN").Add("(").Id().Pull().Rstsrc().Trig().Own().Add("),") case 1: // GPI with IRQ route - if config.AreFieldsIgnored() { + if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode macro.SetPadOwnership(common.PAD_OWN_ACPI) } @@ -168,7 +168,7 @@ func (PlatformSpecific) GpiMacroAdd() { // PAD_CFG_GPI_DUAL_ROUTE(pad, pull, rst, trig, inv, route1, route2) macro.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() macro.Add(", " + ids[0] + ", " + ids[1] + "),") - if config.AreFieldsIgnored() { + if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode macro.SetPadOwnership(common.PAD_OWN_ACPI) } @@ -198,7 +198,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}}, fields.InterfaceGet()) diff --git a/util/intelp2m/platforms/common/macro.go b/util/intelp2m/platforms/common/macro.go index ddb612a9a9..853fcf2489 100644 --- a/util/intelp2m/platforms/common/macro.go +++ b/util/intelp2m/platforms/common/macro.go @@ -4,7 +4,7 @@ import ( "strconv" "sync" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" ) type Fields interface { @@ -33,9 +33,9 @@ const ( ) const ( - IOSTERM_SAME = 0x0 - IOSTERM_DISPUPD = 0x1 - IOSTERM_ENPD = 0x2 + IOSTERM_SAME = 0x0 + IOSTERM_DISPUPD = 0x1 + IOSTERM_ENPD = 0x2 IOSTERM_ENPU = 0x3 ) @@ -77,13 +77,13 @@ type Macro struct { Fields } -var instanceMacro *Macro -var once sync.Once +var instanceMacro *Macro +var once sync.Once // GetInstance returns singleton func GetInstanceMacro(p PlatformSpecific, f Fields) *Macro { once.Do(func() { - instanceMacro = &Macro{ Platform : p, Fields : f } + instanceMacro = &Macro{Platform: p, Fields: f} }) return instanceMacro } @@ -159,7 +159,7 @@ func (macro *Macro) Separator() *Macro { // return: Macro func (macro *Macro) Rstsrc() *Macro { dw0 := macro.Register(PAD_CFG_DW0) - var resetsrc = map[uint8]string { + var resetsrc = map[uint8]string{ 0: "PWROK", 1: "DEEP", 2: "PLTRST", @@ -199,7 +199,7 @@ func (macro *Macro) Trig() *Macro { // return: Macro func (macro *Macro) Invert() *Macro { macro.Separator() - if macro.Register(PAD_CFG_DW0).GetRxInvert() !=0 { + if macro.Register(PAD_CFG_DW0).GetRxInvert() != 0 { return macro.Add("INVERT") } return macro.Add("NONE") @@ -227,8 +227,8 @@ func (macro *Macro) Own() *Macro { return macro.Separator().Add("ACPI") } -//Adds pad native function (PMODE) as a new argument -//return: Macro +// Adds pad native function (PMODE) as a new argument +// return: Macro func (macro *Macro) Padfn() *Macro { dw0 := macro.Register(PAD_CFG_DW0) nfnum := int(dw0.GetPadMode()) @@ -287,22 +287,21 @@ func (macro *Macro) check() *Macro { // or - Set " | " if its needed func (macro *Macro) Or() *Macro { - - if str := macro.Get(); str[len(str) - 1] == ')' { - macro.Add(" | ") - } - return macro + if str := macro.Get(); str[len(str)-1] == ')' { + macro.Add(" | ") + } + return macro } // DecodeIgnored - Add info about ignored field mask // reg : PAD_CFG_DW0 or PAD_CFG_DW1 register func (macro *Macro) DecodeIgnored(reg uint8) *Macro { - var decode = map[uint8]func() { + var decode = map[uint8]func(){ PAD_CFG_DW0: macro.Fields.DecodeDW0, PAD_CFG_DW1: macro.Fields.DecodeDW1, } decodefn, valid := decode[reg] - if !valid || config.IsFspStyleMacro() { + if !valid || p2m.Config.Field == p2m.FspFlds { return macro } dw := macro.Register(reg) @@ -328,21 +327,21 @@ func (macro *Macro) GenerateFields() *Macro { dw0Ignored := dw0.IgnoredFieldsGet() dw1Ignored := dw1.IgnoredFieldsGet() - if config.InfoLevelGet() != 4 { + if p2m.Config.GenLevel != 4 { macro.Clear() } - if config.InfoLevelGet() >= 3 { + if p2m.Config.GenLevel >= 3 { // Add string of reference macro as a comment reference := macro.Get() macro.Clear() /* DW0 : PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */ macro.DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1) - if config.InfoLevelGet() >= 4 { + if p2m.Config.GenLevel >= 4 { /* PAD_CFG_NF(GPP_B23, 20K_PD, PLTRST, NF2), */ macro.Add("/* ").Add(reference).Add(" */\n\t") } } - if config.AreFieldsIgnored() { + if p2m.Config.IgnoredFields { // Consider bit fields that should be ignored when regenerating // advansed macros var tempVal uint32 = dw0.ValueGet() & ^dw0Ignored @@ -404,17 +403,17 @@ func (macro *Macro) Generate() string { macro.Platform.NativeFunctionMacroAdd() } - if config.IsFieldsMacroUsed() { + if p2m.Config.Field != p2m.NoFlds { // Clear control mask to generate advanced macro only return macro.GenerateFields().Get() } - if config.IsNonCheckingFlagUsed() { + if !p2m.Config.AutoCheck { body := macro.Get() - if config.InfoLevelGet() >= 3 { + if p2m.Config.GenLevel >= 3 { macro.Clear().DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1) comment := macro.Get() - if config.InfoLevelGet() >= 4 { + if p2m.Config.GenLevel >= 4 { macro.Clear().Add("/* ") macro.Fields.GenerateString() macro.Add(" */\n\t") diff --git a/util/intelp2m/platforms/common/register.go b/util/intelp2m/platforms/common/register.go index 2aa51b92e9..2596b8d2cb 100644 --- a/util/intelp2m/platforms/common/register.go +++ b/util/intelp2m/platforms/common/register.go @@ -85,7 +85,7 @@ func (reg *Register) ReadOnlyFieldsGet() uint32 { // Returns true if the macro is generated correctly func (reg *Register) MaskCheck() bool { mask := ^(reg.mask | reg.roFileds) - return reg.value&mask == 0 + return (reg.value & mask) == 0 } // getResetConfig - get Reset Configuration from PADRSTCFG field in PAD_CFG_DW0_GPx register @@ -97,14 +97,17 @@ func (reg *Register) getFieldVal(mask uint32, shift uint8) uint8 { // CntrMaskFieldsClear - clear filed in control mask // fieldMask - mask of the field to be cleared func (reg *Register) CntrMaskFieldsClear(fieldMask uint32) { - reg.mask &= ^fieldMask; + reg.mask &= ^fieldMask } // IgnoredFieldsGet - return mask of unchecked (ignored) fields. -// These bit fields were not read when the macro was -// generated. +// +// These bit fields were not read when the macro was +// generated. +// // return -// mask of ignored bit field +// +// mask of ignored bit field func (reg *Register) IgnoredFieldsGet() uint32 { mask := reg.mask | reg.roFileds return reg.value & ^mask diff --git a/util/intelp2m/platforms/snr/macro.go b/util/intelp2m/platforms/snr/macro.go index d96e83e2e2..aa3be5d9bb 100644 --- a/util/intelp2m/platforms/snr/macro.go +++ b/util/intelp2m/platforms/snr/macro.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) @@ -159,7 +159,7 @@ func (PlatformSpecific) GpiMacroAdd() { macro.Add("_TRIG_OWN").Add("(").Id().Pull().Rstsrc().Trig().Own().Add("),") case 1: // GPI with IRQ route - if config.AreFieldsIgnored() { + if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode macro.SetPadOwnership(common.PAD_OWN_ACPI) } @@ -168,7 +168,7 @@ func (PlatformSpecific) GpiMacroAdd() { // PAD_CFG_GPI_DUAL_ROUTE(pad, pull, rst, trig, inv, route1, route2) macro.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() macro.Add(", " + ids[0] + ", " + ids[1] + "),") - if config.AreFieldsIgnored() { + if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode macro.SetPadOwnership(common.PAD_OWN_ACPI) } @@ -246,7 +246,8 @@ func (PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// error +// +// error func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { macro := common.GetInstanceMacro(PlatformSpecific{}, fields.InterfaceGet()) macro.Clear() diff --git a/util/intelp2m/platforms/test/suite.go b/util/intelp2m/platforms/test/suite.go index 8ec4886357..0b5074a0d9 100644 --- a/util/intelp2m/platforms/test/suite.go +++ b/util/intelp2m/platforms/test/suite.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/config" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" ) type ( @@ -29,14 +29,18 @@ type ( ) func (p Pad) toShortMacro(platform PlatformSpecificIf) string { - config.FldStyleSet("none") - config.NonCheckingFlagSet(true) + if err := p2m.SetFieldType("none"); err != nil { + panic(err) + } + p2m.Config.AutoCheck = false return platform.GenMacro(p.ID, p.DW0, p.DW1, p.Ownership) } func (p Pad) toLongMacro(platform PlatformSpecificIf) string { - config.FldStyleSet("cb") - config.NonCheckingFlagSet(false) + if err := p2m.SetFieldType("cb"); err != nil { + panic(err) + } + p2m.Config.AutoCheck = true return platform.GenMacro(p.ID, p.DW0, p.DW1, p.Ownership) } From a581660031a0e18931fedccc0dba2da7536e759a Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Sun, 27 Nov 2022 00:46:28 +0300 Subject: [PATCH 0250/3886] util/intelp2m/register: Rework package code Split all methods between DW0 and DW1 to avoid the mistake of using any DW0 method with DW1 receiver and make the code safer. Also make some code style fixes. TEST: make test = PASS Change-Id: Id64e2a5e29f1d561597004ac83d32e3c80c16ebd Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/70309 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/fields/cb/cb.go | 4 +- util/intelp2m/fields/fsp/fsp.go | 94 ++++--- util/intelp2m/fields/raw/raw.go | 11 +- util/intelp2m/fields/test/suite.go | 8 +- util/intelp2m/parser/template.go | 4 +- util/intelp2m/parser/template_test.go | 4 +- util/intelp2m/platforms/adl/adl_test.go | 8 +- util/intelp2m/platforms/adl/macro.go | 46 +-- util/intelp2m/platforms/apl/macro.go | 94 ++++--- util/intelp2m/platforms/cnl/cnl_test.go | 8 +- util/intelp2m/platforms/cnl/macro.go | 74 ++--- util/intelp2m/platforms/common/macro.go | 250 ++++++++--------- util/intelp2m/platforms/common/register.go | 265 ------------------ .../platforms/common/register/bits/bits.go | 92 ++++++ .../intelp2m/platforms/common/register/dw0.go | 97 +++++++ .../intelp2m/platforms/common/register/dw1.go | 51 ++++ .../platforms/common/register/register.go | 45 +++ util/intelp2m/platforms/ebg/ebg_test.go | 8 +- util/intelp2m/platforms/ebg/macro.go | 44 +-- util/intelp2m/platforms/jsl/jsl_test.go | 8 +- util/intelp2m/platforms/jsl/macro.go | 45 +-- util/intelp2m/platforms/lbg/macro.go | 55 ++-- util/intelp2m/platforms/mtl/macro.go | 46 +-- util/intelp2m/platforms/mtl/mtl_test.go | 8 +- util/intelp2m/platforms/snr/macro.go | 90 +++--- util/intelp2m/platforms/tgl/macro.go | 44 +-- util/intelp2m/platforms/tgl/tgl_test.go | 8 +- 27 files changed, 779 insertions(+), 732 deletions(-) delete mode 100644 util/intelp2m/platforms/common/register.go create mode 100644 util/intelp2m/platforms/common/register/bits/bits.go create mode 100644 util/intelp2m/platforms/common/register/dw0.go create mode 100644 util/intelp2m/platforms/common/register/dw1.go create mode 100644 util/intelp2m/platforms/common/register/register.go diff --git a/util/intelp2m/fields/cb/cb.go b/util/intelp2m/fields/cb/cb.go index efc80184f6..f6a1411356 100644 --- a/util/intelp2m/fields/cb/cb.go +++ b/util/intelp2m/fields/cb/cb.go @@ -50,7 +50,7 @@ func generate(fields ...*field) { // DecodeDW0 - decode value of DW0 register func (FieldMacros) DecodeDW0() { macro := common.GetMacro() - dw0 := macro.Register(common.PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() generate( &field{ prefix: "PAD_FUNC", @@ -133,7 +133,7 @@ func (FieldMacros) DecodeDW0() { // DecodeDW1 - decode value of DW1 register func (FieldMacros) DecodeDW1() { macro := common.GetMacro() - dw1 := macro.Register(common.PAD_CFG_DW1) + dw1 := macro.GetRegisterDW1() generate( &field{ name: "PAD_CFG1_TOL_1V8", diff --git a/util/intelp2m/fields/fsp/fsp.go b/util/intelp2m/fields/fsp/fsp.go index b6224cd03c..db6b4ad294 100644 --- a/util/intelp2m/fields/fsp/fsp.go +++ b/util/intelp2m/fields/fsp/fsp.go @@ -2,16 +2,16 @@ package fsp import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -type FieldMacros struct {} +type FieldMacros struct{} // field - data structure for creating a new bitfield macro object // configmap : map to select the current configuration // value : the key value in the configmap // override : overrides the function to generate the current bitfield macro type field struct { - configmap map[uint8]string - value uint8 - override func(configuration map[uint8]string, value uint8) + configmap map[uint32]string + value uint32 + override func(configuration map[uint32]string, value uint32) } // generate - wrapper for generating bitfield macros string @@ -37,16 +37,18 @@ func generate(fields ...*field) { // DecodeDW0 - decode value of DW0 register func (FieldMacros) DecodeDW0() { macro := common.GetMacro() - dw0 := macro.Register(common.PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() - ownershipStatus := func() uint8 { - if macro.IsOwnershipDriver() { return 1 } + ownershipStatus := func() uint32 { + if macro.IsOwnershipDriver() { + return 1 + } return 0 } generate( - &field { - configmap : map[uint8]string{ + &field{ + configmap: map[uint32]string{ 0: "GpioPadModeGpio", 1: "GpioPadModeNative1", 2: "GpioPadModeNative2", @@ -54,79 +56,79 @@ func (FieldMacros) DecodeDW0() { 4: "GpioPadModeNative4", 5: "GpioPadModeNative5", }, - value : dw0.GetPadMode(), + value: dw0.GetPadMode(), }, - &field { - configmap : map[uint8]string { + &field{ + configmap: map[uint32]string{ 0: "GpioHostOwnAcpi", 1: "GpioHostOwnGpio", }, - value : ownershipStatus(), + value: ownershipStatus(), }, - &field { - configmap : map[uint8]string { - 0: "GpioDirInOut", - 1: "GpioDirIn", - 2: "GpioDirOut", - 3: "GpioDirNone", - 1 << 4 | 0: "GpioDirInInvOut", - 1 << 4 | 1: "GpioDirInInv", + &field{ + configmap: map[uint32]string{ + 0: "GpioDirInOut", + 1: "GpioDirIn", + 2: "GpioDirOut", + 3: "GpioDirNone", + (1 << 4): "GpioDirInInvOut", + (1 << 4) | 1: "GpioDirInInv", }, - value : dw0.GetRxInvert() << 4 | dw0.GetGPIORxTxDisableStatus(), + value: dw0.GetRxInvert()<<4 | dw0.GetGPIORxTxDisableStatus(), }, - &field { - configmap : map[uint8]string { + &field{ + configmap: map[uint32]string{ 0: "GpioOutLow", 1: "GpioOutHigh", }, - value : dw0.GetGPIOTXState(), + value: dw0.GetGPIOTXState(), }, - &field { - configmap : map[uint8]string { + &field{ + configmap: map[uint32]string{ 1 << 0: "GpioIntNmi", 1 << 1: "GpioIntSmi", 1 << 2: "GpioIntSci", 1 << 3: "GpioIntApic", }, - override : func(configmap map[uint8]string, value uint8) { - mask := dw0.GetGPIOInputRouteIOxAPIC() << 3 | - dw0.GetGPIOInputRouteSCI() << 2 | - dw0.GetGPIOInputRouteSMI() << 1 | - dw0.GetGPIOInputRouteNMI() + override: func(configmap map[uint32]string, value uint32) { + mask := dw0.GetGPIOInputRouteIOxAPIC()<<3 | + dw0.GetGPIOInputRouteSCI()<<2 | + dw0.GetGPIOInputRouteSMI()<<1 | + dw0.GetGPIOInputRouteNMI() if mask == 0 { macro.Add("GpioIntDis | ") return } for bit, fieldmacro := range configmap { - if mask & bit != 0 { + if mask&bit != 0 { macro.Add(fieldmacro).Add(" | ") } } }, }, - &field { - configmap : map[uint8]string { + &field{ + configmap: map[uint32]string{ 0: "GpioIntLevel", 1: "GpioIntEdge", 2: "GpioIntLvlEdgDis", 3: "GpioIntBothEdge", }, - value : dw0.GetRXLevelEdgeConfiguration(), + value: dw0.GetRXLevelEdgeConfiguration(), }, - &field { - configmap : map[uint8]string { - 0: "GpioResetPwrGood", // TODO: Has multiple values (to GPP and GPD) + &field{ + configmap: map[uint32]string{ + 0: "GpioResetPwrGood", // TODO: Has multiple values (to GPP and GPD) 1: "GpioHostDeepReset", 2: "GpioPlatformReset", 3: "GpioResumeReset", }, - value : dw0.GetResetConfig(), + value: dw0.GetResetConfig(), }, ) } @@ -134,18 +136,18 @@ func (FieldMacros) DecodeDW0() { // DecodeDW1 - decode value of DW1 register func (FieldMacros) DecodeDW1() { macro := common.GetMacro() - dw1 := macro.Register(common.PAD_CFG_DW1) + dw1 := macro.GetRegisterDW1() generate( - &field { - override : func(configmap map[uint8]string, value uint8) { + &field{ + override: func(configmap map[uint32]string, value uint32) { if dw1.GetPadTol() != 0 { macro.Add("GpioTolerance1v8 | ") } }, }, - &field { - configmap : map[uint8]string { + &field{ + configmap: map[uint32]string{ 0x0: "GpioTermNone", 0x2: "GpioTermWpd5K", 0x4: "GpioTermWpd20K", @@ -156,7 +158,7 @@ func (FieldMacros) DecodeDW1() { 0xd: "GpioTermWpu1K2K", 0xf: "GpioTermNative", }, - value : dw1.GetTermination(), + value: dw1.GetTermination(), }, ) } diff --git a/util/intelp2m/fields/raw/raw.go b/util/intelp2m/fields/raw/raw.go index fbac5b53d0..4efccd5c5e 100644 --- a/util/intelp2m/fields/raw/raw.go +++ b/util/intelp2m/fields/raw/raw.go @@ -1,22 +1,21 @@ package raw import ( - "fmt" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) -type FieldMacros struct {} +type FieldMacros struct{} func (FieldMacros) DecodeDW0() { macro := common.GetMacro() - // Do not decode, print as is. - macro.Add(fmt.Sprintf("0x%0.8x", macro.Register(common.PAD_CFG_DW0).ValueGet())) + dw0 := macro.GetRegisterDW0() + macro.Add(dw0.String()) } func (FieldMacros) DecodeDW1() { macro := common.GetMacro() - // Do not decode, print as is. - macro.Add(fmt.Sprintf("0x%0.8x", macro.Register(common.PAD_CFG_DW1).ValueGet())) + dw1 := macro.GetRegisterDW1() + macro.Add(dw1.String()) } // GenerateString - generates the entire string of bitfield macros. diff --git a/util/intelp2m/fields/test/suite.go b/util/intelp2m/fields/test/suite.go index a61062e130..3041de2136 100644 --- a/util/intelp2m/fields/test/suite.go +++ b/util/intelp2m/fields/test/suite.go @@ -29,13 +29,13 @@ func (suite Suite) Run(t *testing.T, label string, decoderIf common.Fields) { t.Run(label, func(t *testing.T) { platform := snr.PlatformSpecific{} macro := common.GetInstanceMacro(platform, decoderIf) - dw0 := macro.Register(common.PAD_CFG_DW0) - dw1 := macro.Register(common.PAD_CFG_DW1) + dw0 := macro.GetRegisterDW0() + dw1 := macro.GetRegisterDW1() for _, tc := range suite { macro.Clear() macro.PadIdSet("").SetPadOwnership(tc.Ownership) - dw0.ValueSet(tc.DW0) - dw1.ValueSet(tc.DW1) + dw0.Value = tc.DW0 + dw1.Value = tc.DW1 macro.Fields.GenerateString() if err := tc.Check(macro.Get()); err != nil { t.Errorf("Test failed: %v", err) diff --git a/util/intelp2m/parser/template.go b/util/intelp2m/parser/template.go index e7efa734e7..49b938fd56 100644 --- a/util/intelp2m/parser/template.go +++ b/util/intelp2m/parser/template.go @@ -6,7 +6,7 @@ import ( "unicode" ) -const INTSEL_MASK uint32 = 0xffffff00 +const IntSelMask uint32 = 0xffffff00 type template func(string, *string, *string, *uint32, *uint32) int @@ -57,7 +57,7 @@ func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *ui *function += "/" + fields[i] } // clear RO Interrupt Select (INTSEL) - *dw1 &= INTSEL_MASK + *dw1 &= IntSelMask } return 0 } diff --git a/util/intelp2m/parser/template_test.go b/util/intelp2m/parser/template_test.go index 95f8ebf546..9abdd72f83 100644 --- a/util/intelp2m/parser/template_test.go +++ b/util/intelp2m/parser/template_test.go @@ -30,9 +30,9 @@ func TestTemp(t *testing.T) { } else if dw0 != ref_dw0 { t.Errorf("dw0 from '%s':\nExpects: '0x%08x'\nActually: '0x%08x'\n\n", line, ref_dw0, dw0) - } else if dw1 != (ref_dw1 & parser.INTSEL_MASK) { + } else if dw1 != (ref_dw1 & parser.IntSelMask) { t.Errorf("dw1 from '%s':\nExpects: '0x%08x'\nActually: '0x%08x'\n\n", - line, (ref_dw1 & parser.INTSEL_MASK), dw1) + line, (ref_dw1 & parser.IntSelMask), dw1) } }) } diff --git a/util/intelp2m/platforms/adl/adl_test.go b/util/intelp2m/platforms/adl/adl_test.go index 36bd645cc5..1f2400a710 100644 --- a/util/intelp2m/platforms/adl/adl_test.go +++ b/util/intelp2m/platforms/adl/adl_test.go @@ -51,7 +51,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E5, UP_2K, PWROK, NF3),", - Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { @@ -65,14 +65,14 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_G7, INVALID, PLTRST, NF6),", - Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { Pad: test.Pad{ID: "GPP_H8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_H8, UP_667, DEEP, NF5),", - Long: "_PAD_CFG_STRUCT(GPP_H8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU)),", + Long: "_PAD_CFG_STRUCT(GPP_H8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", alderlake) @@ -82,7 +82,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_I9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_I9, UP_20K, RSMRST, NF4),", - Long: "_PAD_CFG_STRUCT(GPP_I9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_I9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { diff --git a/util/intelp2m/platforms/adl/macro.go b/util/intelp2m/platforms/adl/macro.go index 2c4b5d81cf..7c4f4357bb 100644 --- a/util/intelp2m/platforms/adl/macro.go +++ b/util/intelp2m/platforms/adl/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -15,12 +16,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { Pull() GpiMacroAdd() @@ -43,22 +38,22 @@ func (PlatformSpecific) RemmapRstSrc() { return } - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, - 3: common.RST_PWROK << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + remapping := map[uint32]uint32{ + 0: (bits.RstCfgRSMRST << bits.DW0PadRstCfg), + 1: (bits.RstCfgDEEP << bits.DW0PadRstCfg), + 2: (bits.RstCfgPLTRST << bits.DW0PadRstCfg), + 3: (bits.RstCfgPWROK << bits.DW0PadRstCfg), } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + dw0.CntrMaskFieldsClear(0b11 << bits.DW0PadRstCfg) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro @@ -88,11 +83,11 @@ func (platform PlatformSpecific) NoConnMacroAdd() { } // GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value +// dw0Val : DW0 config register value +// dw1Val : DW1 config register value // return: string of macro // error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { +func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ InheritanceMacro: cnl.PlatformSpecific{ @@ -102,10 +97,17 @@ func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership ui fields.InterfaceGet(), ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/apl/macro.go b/util/intelp2m/platforms/apl/macro.go index e5ac7c2a49..3e5bf74603 100644 --- a/util/intelp2m/platforms/apl/macro.go +++ b/util/intelp2m/platforms/apl/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) const ( @@ -14,12 +15,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfffc00ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - const ( PULL_NONE = 0x0 // 0 000: none PULL_DN_5K = 0x2 // 0 010: 5k wpd (Only available on SMBus GPIOs) @@ -42,8 +37,8 @@ func (PlatformSpecific) RemmapRstSrc() {} // return: macro func (PlatformSpecific) Pull() { macro := common.GetMacro() - dw1 := macro.Register(PAD_CFG_DW1) - var pull = map[uint8]string{ + dw1 := macro.GetRegisterDW1() + var pull = map[uint32]string{ PULL_NONE: "NONE", PULL_DN_5K: "DN_5K", PULL_DN_20K: "DN_20K", @@ -53,10 +48,9 @@ func (PlatformSpecific) Pull() { PULL_UP_667: "UP_667", PULL_NATIVE: "NATIVE", } - terminationFieldValue := dw1.GetTermination() - str, valid := pull[terminationFieldValue] - if !valid { - str = strconv.Itoa(int(terminationFieldValue)) + str, exist := pull[dw1.GetTermination()] + if !exist { + str = strconv.Itoa(int(dw1.GetTermination())) fmt.Println("Error", macro.PadIdGet(), " invalid TERM value = ", str) } macro.Separator().Add(str) @@ -65,8 +59,8 @@ func (PlatformSpecific) Pull() { // Generate macro to cause peripheral IRQ when configured in GPIO input mode func ioApicRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - dw1 := macro.Register(PAD_CFG_DW1) + dw0 := macro.GetRegisterDW0() + dw1 := macro.GetRegisterDW1() if dw0.GetGPIOInputRouteIOxAPIC() == 0 { return false } @@ -86,7 +80,7 @@ func ioApicRoute() bool { // Generate macro to cause NMI when configured in GPIO input mode func nmiRoute() bool { macro := common.GetMacro() - if macro.Register(PAD_CFG_DW0).GetGPIOInputRouteNMI() == 0 { + if macro.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { return false } // e.g. PAD_CFG_GPI_NMI(GPIO_24, UP_20K, DEEP, LEVEL, INVERT), @@ -97,8 +91,8 @@ func nmiRoute() bool { // Generate macro to cause SCI when configured in GPIO input mode func sciRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - dw1 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() + dw1 := macro.GetRegisterDW1() if dw0.GetGPIOInputRouteSCI() == 0 { return false } @@ -120,8 +114,8 @@ func sciRoute() bool { // Generate macro to cause SMI when configured in GPIO input mode func smiRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - dw1 := macro.Register(PAD_CFG_DW1) + dw0 := macro.GetRegisterDW0() + dw1 := macro.GetRegisterDW1() if dw0.GetGPIOInputRouteSMI() == 0 { return false } @@ -159,7 +153,7 @@ func (PlatformSpecific) GpiMacroAdd() { switch config, argc := p2m.Config, len(ids); argc { case 0: - dw1 := macro.Register(PAD_CFG_DW1) + dw1 := macro.GetRegisterDW1() isIOStandbyStateUsed := dw1.GetIOStandbyState() != 0 isIOStandbyTerminationUsed := dw1.GetIOStandbyTermination() != 0 if isIOStandbyStateUsed && !isIOStandbyTerminationUsed { @@ -189,15 +183,15 @@ func (PlatformSpecific) GpiMacroAdd() { default: // Clear the control mask so that the check fails and "Advanced" macro is // generated - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) + macro.GetRegisterDW0().CntrMaskFieldsClear(bits.All32) } } // Adds PAD_CFG_GPO macro with arguments func (PlatformSpecific) GpoMacroAdd() { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - dw1 := macro.Register(PAD_CFG_DW1) + dw0 := macro.GetRegisterDW0() + dw1 := macro.GetRegisterDW1() term := dw1.GetTermination() macro.Set("PAD_CFG") @@ -219,22 +213,22 @@ func (PlatformSpecific) GpoMacroAdd() { } macro.Add("),") - if dw0.GetRXLevelEdgeConfiguration() != common.TRIG_OFF { + if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { // ignore if trig = OFF is not set - dw0.CntrMaskFieldsClear(common.RxLevelEdgeConfigurationMask) + dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0RxLevelEdgeConfiguration]) } } // Adds PAD_CFG_NF macro with arguments func (PlatformSpecific) NativeFunctionMacroAdd() { macro := common.GetMacro() - dw1 := macro.Register(PAD_CFG_DW1) + dw1 := macro.GetRegisterDW1() isIOStandbyStateUsed := dw1.GetIOStandbyState() != 0 isIOStandbyTerminationUsed := dw1.GetIOStandbyTermination() != 0 macro.Set("PAD_CFG_NF") if !isIOStandbyTerminationUsed && isIOStandbyStateUsed { - if dw1.GetIOStandbyState() == common.StandbyIgnore { + if dw1.GetIOStandbyState() == bits.IOStateStandbyIgnore { // PAD_CFG_NF_IOSTANDBY_IGNORE(PMU_SLP_S0_B, NONE, DEEP, NF1), macro.Add("_IOSTANDBY_IGNORE(").Id().Pull().Rstsrc().Padfn() } else { @@ -250,27 +244,26 @@ func (PlatformSpecific) NativeFunctionMacroAdd() { } macro.Add("),") - if dw0 := macro.Register(PAD_CFG_DW0); dw0.GetGPIORxTxDisableStatus() != 0 { + if dw0 := macro.GetRegisterDW0(); dw0.GetGPIORxTxDisableStatus() != 0 { // Since the bufbis parameter will be ignored for NF, we should clear // the corresponding bits in the control mask. - dw0.CntrMaskFieldsClear(common.RxTxBufDisableMask) + dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0RxTxBufDisable]) } } // Adds PAD_NC macro func (PlatformSpecific) NoConnMacroAdd() { macro := common.GetMacro() - dw1 := macro.Register(PAD_CFG_DW1) - if dw1.GetIOStandbyState() == common.TxDRxE { - dw0 := macro.Register(PAD_CFG_DW0) + dw0, dw1 := macro.GetRegisterDW0(), macro.GetRegisterDW1() + if dw1.GetIOStandbyState() == bits.IOStateTxDRxE { // See comments in sunrise/macro.go : NoConnMacroAdd() - if dw0.GetRXLevelEdgeConfiguration() != common.TRIG_OFF { - dw0.CntrMaskFieldsClear(common.RxLevelEdgeConfigurationMask) + if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { + dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0RxLevelEdgeConfiguration]) } if dw0.GetResetConfig() != 1 { // 1 = RST_DEEP - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0PadRstCfg]) } // PAD_NC(OSC_CLK_OUT_1, DN_20K) @@ -287,18 +280,27 @@ func (PlatformSpecific) NoConnMacroAdd() { } // GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value +// dw0Val : DW0 config register value +// dw1Val : DW1 config register value // return: string of macro -// -// error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { - macro := common.GetInstanceMacro(PlatformSpecific{}, fields.InterfaceGet()) - // use platform-specific interface in Macro struct +func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { + macro := common.GetInstanceMacro( + PlatformSpecific{}, + fields.InterfaceGet(), + ) + macro.Clear() + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/cnl/cnl_test.go b/util/intelp2m/platforms/cnl/cnl_test.go index ad2b65ef64..e7fe0d546f 100644 --- a/util/intelp2m/platforms/cnl/cnl_test.go +++ b/util/intelp2m/platforms/cnl/cnl_test.go @@ -48,7 +48,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_F5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_F5, UP_2K, RSMRST, NF3),", - Long: "_PAD_CFG_STRUCT(GPP_F5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_F5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { @@ -62,14 +62,14 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPD7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPD7, INVALID, PLTRST, NF6),", - Long: "_PAD_CFG_STRUCT(GPD7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPD7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { Pad: test.Pad{ID: "GPP_C8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_C8, UP_667, DEEP, NF5),", - Long: "_PAD_CFG_STRUCT(GPP_C8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU)),", + Long: "_PAD_CFG_STRUCT(GPP_C8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", cannonlake) @@ -79,7 +79,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_E9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E9, UP_20K, RSMRST, NF4),", - Long: "_PAD_CFG_STRUCT(GPP_E9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_E9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { diff --git a/util/intelp2m/platforms/cnl/macro.go b/util/intelp2m/platforms/cnl/macro.go index 19fee99cb9..ab524f5e15 100644 --- a/util/intelp2m/platforms/cnl/macro.go +++ b/util/intelp2m/platforms/cnl/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -15,12 +16,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { GpoMacroAdd() NativeFunctionMacroAdd() @@ -44,29 +39,30 @@ func (PlatformSpecific) RemmapRstSrc() { return } - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + var remapping = map[uint32]uint32{ + 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro // as a new argument func (PlatformSpecific) Pull() { macro := common.GetMacro() - dw1 := macro.Register(PAD_CFG_DW1) - var pull = map[uint8]string{ + dw1 := macro.GetRegisterDW1() + var pull = map[uint32]string{ 0x0: "NONE", 0x2: "DN_5K", 0x4: "DN_20K", @@ -91,7 +87,7 @@ func (PlatformSpecific) Pull() { // Generate macro to cause peripheral IRQ when configured in GPIO input mode func ioApicRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() if dw0.GetGPIOInputRouteIOxAPIC() == 0 { return false } @@ -105,7 +101,7 @@ func ioApicRoute() bool { // Generate macro to cause NMI when configured in GPIO input mode func nmiRoute() bool { macro := common.GetMacro() - if macro.Register(PAD_CFG_DW0).GetGPIOInputRouteNMI() == 0 { + if macro.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { return false } // PAD_CFG_GPI_NMI(GPIO_24, UP_20K, DEEP, LEVEL, INVERT), @@ -116,8 +112,7 @@ func nmiRoute() bool { // Generate macro to cause SCI when configured in GPIO input mode func sciRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - if dw0.GetGPIOInputRouteSCI() == 0 { + if macro.GetRegisterDW0().GetGPIOInputRouteSCI() == 0 { return false } // PAD_CFG_GPI_SCI(pad, pull, rst, trig, inv) @@ -128,8 +123,8 @@ func sciRoute() bool { // Generate macro to cause SMI when configured in GPIO input mode func smiRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - if dw0.GetGPIOInputRouteSMI() == 0 { + + if macro.GetRegisterDW0().GetGPIOInputRouteSMI() == 0 { return false } // PAD_CFG_GPI_SMI(pad, pull, rst, trig, inv) @@ -175,7 +170,7 @@ func (PlatformSpecific) GpiMacroAdd() { default: // Clear the control mask so that the check fails and "Advanced" macro is // generated - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) + macro.GetRegisterDW0().CntrMaskFieldsClear(bits.All32) } } @@ -195,19 +190,30 @@ func (platform PlatformSpecific) NoConnMacroAdd() { } // GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value +// dw0Val : DW0 config register value +// dw1Val : DW1 config register value // return: string of macro -// -// error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { - macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}}, - fields.InterfaceGet()) +func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { + macro := common.GetInstanceMacro( + PlatformSpecific{ + InheritanceMacro: snr.PlatformSpecific{}, + }, + fields.InterfaceGet(), + ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/common/macro.go b/util/intelp2m/platforms/common/macro.go index 853fcf2489..782a61e5b7 100644 --- a/util/intelp2m/platforms/common/macro.go +++ b/util/intelp2m/platforms/common/macro.go @@ -1,10 +1,13 @@ package common import ( + "fmt" "strconv" "sync" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) type Fields interface { @@ -18,41 +21,6 @@ const ( PAD_OWN_DRIVER = 1 ) -const ( - TxLASTRxE = 0x0 - Tx0RxDCRx0 = 0x1 - Tx0RxDCRx1 = 0x2 - Tx1RxDCRx0 = 0x3 - Tx1RxDCRx1 = 0x4 - Tx0RxE = 0x5 - Tx1RxE = 0x6 - HIZCRx0 = 0x7 - HIZCRx1 = 0x8 - TxDRxE = 0x9 - StandbyIgnore = 0xf -) - -const ( - IOSTERM_SAME = 0x0 - IOSTERM_DISPUPD = 0x1 - IOSTERM_ENPD = 0x2 - IOSTERM_ENPU = 0x3 -) - -const ( - TRIG_LEVEL = 0 - TRIG_EDGE_SINGLE = 1 - TRIG_OFF = 2 - TRIG_EDGE_BOTH = 3 -) - -const ( - RST_PWROK = 0 - RST_DEEP = 1 - RST_PLTRST = 2 - RST_RSMRST = 3 -) - // PlatformSpecific - platform-specific interface type PlatformSpecific interface { RemmapRstSrc() @@ -70,7 +38,8 @@ type PlatformSpecific interface { // Reg : structure of configuration register values and their masks type Macro struct { Platform PlatformSpecific - Reg [MAX_DW_NUM]Register + DW0 register.DW0 + DW1 register.DW1 padID string str string ownership uint8 @@ -110,10 +79,12 @@ func (macro *Macro) IsOwnershipDriver() bool { return macro.ownership == PAD_OWN_DRIVER } -// returns data configuration structure -// number : register number -func (macro *Macro) Register(number uint8) *Register { - return ¯o.Reg[number] +func (macro *Macro) GetRegisterDW0() *register.DW0 { + return ¯o.DW0 +} + +func (macro *Macro) GetRegisterDW1() *register.DW1 { + return ¯o.DW1 } // add a string to macro @@ -158,14 +129,18 @@ func (macro *Macro) Separator() *Macro { // Adds the PADRSTCFG parameter from DW0 to the macro as a new argument // return: Macro func (macro *Macro) Rstsrc() *Macro { - dw0 := macro.Register(PAD_CFG_DW0) - var resetsrc = map[uint8]string{ - 0: "PWROK", - 1: "DEEP", - 2: "PLTRST", - 3: "RSMRST", + dw0 := macro.GetRegisterDW0() + resetsrc := map[uint32]string{ + 0b00: "PWROK", + 0b01: "DEEP", + 0b10: "PLTRST", + 0b11: "RSMRST", } - return macro.Separator().Add(resetsrc[dw0.GetResetConfig()]) + source, exist := resetsrc[dw0.GetResetConfig()] + if !exist { + source = "ERROR" + } + return macro.Separator().Add(source) } // Adds The Pad Termination (TERM) parameter from DW1 to the macro as a new argument @@ -178,44 +153,51 @@ func (macro *Macro) Pull() *Macro { // Adds Pad GPO value to macro string as a new argument // return: Macro func (macro *Macro) Val() *Macro { - dw0 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() return macro.Separator().Add(strconv.Itoa(int(dw0.GetGPIOTXState()))) } // Adds Pad GPO value to macro string as a new argument // return: Macro func (macro *Macro) Trig() *Macro { - dw0 := macro.Register(PAD_CFG_DW0) - var trig = map[uint8]string{ - 0x0: "LEVEL", - 0x1: "EDGE_SINGLE", - 0x2: "OFF", - 0x3: "EDGE_BOTH", + dw0 := macro.GetRegisterDW0() + trig := map[uint32]string{ + 0b00: "LEVEL", + 0b01: "EDGE_SINGLE", + 0b10: "OFF", + 0b11: "EDGE_BOTH", } - return macro.Separator().Add(trig[dw0.GetRXLevelEdgeConfiguration()]) + level, exist := trig[dw0.GetRXLevelEdgeConfiguration()] + if !exist { + level = "ERROR" + } + return macro.Separator().Add(level) } // Adds Pad Polarity Inversion Stage (RXINV) to macro string as a new argument // return: Macro func (macro *Macro) Invert() *Macro { - macro.Separator() - if macro.Register(PAD_CFG_DW0).GetRxInvert() != 0 { - return macro.Add("INVERT") + if macro.GetRegisterDW0().GetRxInvert() != 0 { + return macro.Separator().Add("INVERT") } - return macro.Add("NONE") + return macro.Separator().Add("NONE") } // Adds input/output buffer state // return: Macro func (macro *Macro) Bufdis() *Macro { - var buffDisStat = map[uint8]string{ - 0x0: "NO_DISABLE", // both buffers are enabled - 0x1: "TX_DISABLE", // output buffer is disabled - 0x2: "RX_DISABLE", // input buffer is disabled - 0x3: "TX_RX_DISABLE", // both buffers are disabled + dw0 := macro.GetRegisterDW0() + states := map[uint32]string{ + 0b00: "NO_DISABLE", // both buffers are enabled + 0b01: "TX_DISABLE", // output buffer is disabled + 0b10: "RX_DISABLE", // input buffer is disabled + 0b11: "TX_RX_DISABLE", // both buffers are disabled } - state := macro.Register(PAD_CFG_DW0).GetGPIORxTxDisableStatus() - return macro.Separator().Add(buffDisStat[state]) + state, exist := states[dw0.GetGPIORxTxDisableStatus()] + if !exist { + state = "ERROR" + } + return macro.Separator().Add(state) } // Adds macro to set the host software ownership @@ -230,10 +212,9 @@ func (macro *Macro) Own() *Macro { // Adds pad native function (PMODE) as a new argument // return: Macro func (macro *Macro) Padfn() *Macro { - dw0 := macro.Register(PAD_CFG_DW0) - nfnum := int(dw0.GetPadMode()) - if nfnum != 0 { - return macro.Separator().Add("NF" + strconv.Itoa(nfnum)) + dw0 := macro.GetRegisterDW0() + if number := dw0.GetPadMode(); number != 0 { + return macro.Separator().Add(fmt.Sprintf("NF%d", number)) } // GPIO used only for PAD_FUNC(x) macro return macro.Add("GPIO") @@ -242,44 +223,49 @@ func (macro *Macro) Padfn() *Macro { // Add a line to the macro that defines IO Standby State // return: macro func (macro *Macro) IOSstate() *Macro { - var stateMacro = map[uint8]string{ - TxLASTRxE: "TxLASTRxE", - Tx0RxDCRx0: "Tx0RxDCRx0", - Tx0RxDCRx1: "Tx0RxDCRx1", - Tx1RxDCRx0: "Tx1RxDCRx0", - Tx1RxDCRx1: "Tx1RxDCRx1", - Tx0RxE: "Tx0RxE", - Tx1RxE: "Tx1RxE", - HIZCRx0: "HIZCRx0", - HIZCRx1: "HIZCRx1", - TxDRxE: "TxDRxE", - StandbyIgnore: "IGNORE", + states := map[uint32]string{ + bits.IOStateTxLASTRxE: "TxLASTRxE", + bits.IOStateTx0RxDCRx0: "Tx0RxDCRx0", + bits.IOStateTx0RxDCRx1: "Tx0RxDCRx1", + bits.IOStateTx1RxDCRx0: "Tx1RxDCRx0", + bits.IOStateTx1RxDCRx1: "Tx1RxDCRx1", + bits.IOStateTx0RxE: "Tx0RxE", + bits.IOStateTx1RxE: "Tx1RxE", + bits.IOStateHIZCRx0: "HIZCRx0", + bits.IOStateHIZCRx1: "HIZCRx1", + bits.IOStateTxDRxE: "TxDRxE", + bits.IOStateStandbyIgnore: "IGNORE", } - dw1 := macro.Register(PAD_CFG_DW1) - str, valid := stateMacro[dw1.GetIOStandbyState()] - if !valid { + dw1 := macro.GetRegisterDW1() + state, exist := states[dw1.GetIOStandbyState()] + if !exist { // ignore setting for incorrect value - str = "IGNORE" + state = "ERROR" } - return macro.Separator().Add(str) + return macro.Separator().Add(state) } // Add a line to the macro that defines IO Standby Termination // return: macro func (macro *Macro) IOTerm() *Macro { - var ioTermMacro = map[uint8]string{ - IOSTERM_SAME: "SAME", - IOSTERM_DISPUPD: "DISPUPD", - IOSTERM_ENPD: "ENPD", - IOSTERM_ENPU: "ENPU", + dw1 := macro.GetRegisterDW1() + terminations := map[uint32]string{ + bits.IOTermSAME: "SAME", + bits.IOTermDISPUPD: "DISPUPD", + bits.IOTermENPD: "ENPD", + bits.IOTermENPU: "ENPU", } - dw1 := macro.Register(PAD_CFG_DW1) - return macro.Separator().Add(ioTermMacro[dw1.GetIOStandbyTermination()]) + termination, exist := terminations[dw1.GetIOStandbyTermination()] + if !exist { + termination = "ERROR" + } + return macro.Separator().Add(termination) } // Check created macro func (macro *Macro) check() *Macro { - if !macro.Register(PAD_CFG_DW0).MaskCheck() { + dw0 := macro.GetRegisterDW0() + if !dw0.MaskCheck() { return macro.GenerateFields() } return macro @@ -293,35 +279,42 @@ func (macro *Macro) Or() *Macro { return macro } -// DecodeIgnored - Add info about ignored field mask -// reg : PAD_CFG_DW0 or PAD_CFG_DW1 register -func (macro *Macro) DecodeIgnored(reg uint8) *Macro { - var decode = map[uint8]func(){ - PAD_CFG_DW0: macro.Fields.DecodeDW0, - PAD_CFG_DW1: macro.Fields.DecodeDW1, - } - decodefn, valid := decode[reg] - if !valid || p2m.Config.Field == p2m.FspFlds { +func (macro *Macro) DecodeIgnoredFieldsDW0() *Macro { + if p2m.Config.Field == p2m.FspFlds { return macro } - dw := macro.Register(reg) - ignored := dw.IgnoredFieldsGet() - if ignored != 0 { - temp := dw.ValueGet() - dw.ValueSet(ignored) - regnum := strconv.Itoa(int(reg)) - macro.Add("/* DW" + regnum + ": ") - decodefn() + dw0 := macro.GetRegisterDW0() + if ignored := dw0.IgnoredFieldsGet(); ignored != 0 { + saved := dw0.Value + dw0.Value = ignored + macro.Add("/* DW0: ") + macro.Fields.DecodeDW0() macro.Add(" - IGNORED */\n\t") - dw.ValueSet(temp) + dw0.Value = saved + } + return macro +} + +func (macro *Macro) DecodeIgnoredFieldsDW1() *Macro { + if p2m.Config.Field == p2m.FspFlds { + return macro + } + dw1 := macro.GetRegisterDW1() + if ignored := dw1.IgnoredFieldsGet(); ignored != 0 { + saved := dw1.Value + dw1.Value = ignored + macro.Add("/* DW0: ") + macro.DecodeDW1() + macro.Add(" - IGNORED */\n\t") + dw1.Value = saved } return macro } // GenerateFields - generate bitfield macros func (macro *Macro) GenerateFields() *Macro { - dw0 := macro.Register(PAD_CFG_DW0) - dw1 := macro.Register(PAD_CFG_DW1) + dw0 := macro.GetRegisterDW0() + dw1 := macro.GetRegisterDW1() // Get mask of ignored bit fields. dw0Ignored := dw0.IgnoredFieldsGet() @@ -335,7 +328,8 @@ func (macro *Macro) GenerateFields() *Macro { reference := macro.Get() macro.Clear() /* DW0 : PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */ - macro.DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1) + macro.DecodeIgnoredFieldsDW0() + macro.DecodeIgnoredFieldsDW1() if p2m.Config.GenLevel >= 4 { /* PAD_CFG_NF(GPP_B23, 20K_PD, PLTRST, NF2), */ macro.Add("/* ").Add(reference).Add(" */\n\t") @@ -344,11 +338,11 @@ func (macro *Macro) GenerateFields() *Macro { if p2m.Config.IgnoredFields { // Consider bit fields that should be ignored when regenerating // advansed macros - var tempVal uint32 = dw0.ValueGet() & ^dw0Ignored - dw0.ValueSet(tempVal) + tempVal := dw0.Value & ^dw0Ignored + dw0.Value = tempVal - tempVal = dw1.ValueGet() & ^dw1Ignored - dw1.ValueSet(tempVal) + tempVal = dw1.Value & ^dw1Ignored + dw1.Value = tempVal } macro.Fields.GenerateString() @@ -357,7 +351,7 @@ func (macro *Macro) GenerateFields() *Macro { // Generate macro for bi-directional GPIO port func (macro *Macro) Bidirection() { - dw1 := macro.Register(PAD_CFG_DW1) + dw1 := macro.GetRegisterDW1() ios := dw1.GetIOStandbyState() != 0 || dw1.GetIOStandbyTermination() != 0 macro.Set("PAD_CFG_GPIO_BIDIRECT") if ios { @@ -372,19 +366,15 @@ func (macro *Macro) Bidirection() { macro.Own().Add("),") } -const ( - rxDisable uint8 = 0x2 - txDisable uint8 = 0x1 -) - // Gets base string of current macro // return: string of macro func (macro *Macro) Generate() string { - dw0 := macro.Register(PAD_CFG_DW0) + const rxDisable uint32 = 0x2 + const txDisable uint32 = 0x1 macro.Platform.RemmapRstSrc() macro.Set("PAD_CFG") - if dw0.GetPadMode() == 0 { + if dw0 := macro.GetRegisterDW0(); dw0.GetPadMode() == 0 { // GPIO switch dw0.GetGPIORxTxDisableStatus() { case txDisable: @@ -411,7 +401,9 @@ func (macro *Macro) Generate() string { if !p2m.Config.AutoCheck { body := macro.Get() if p2m.Config.GenLevel >= 3 { - macro.Clear().DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1) + macro.Clear() + macro.DecodeIgnoredFieldsDW0() + macro.DecodeIgnoredFieldsDW1() comment := macro.Get() if p2m.Config.GenLevel >= 4 { macro.Clear().Add("/* ") diff --git a/util/intelp2m/platforms/common/register.go b/util/intelp2m/platforms/common/register.go deleted file mode 100644 index 2596b8d2cb..0000000000 --- a/util/intelp2m/platforms/common/register.go +++ /dev/null @@ -1,265 +0,0 @@ -package common - -// Bit field constants for PAD_CFG_DW0 register -const ( - AllFields uint32 = 0xffffffff - - PadRstCfgShift uint8 = 30 - PadRstCfgMask uint32 = 0x3 << PadRstCfgShift - - RxPadStateSelectShift uint8 = 29 - RxPadStateSelectMask uint32 = 0x1 << RxPadStateSelectShift - - RxRawOverrideTo1Shift uint8 = 28 - RxRawOverrideTo1Mask uint32 = 0x1 << RxRawOverrideTo1Shift - - RxLevelEdgeConfigurationShift uint8 = 25 - RxLevelEdgeConfigurationMask uint32 = 0x3 << RxLevelEdgeConfigurationShift - - RxInvertShift uint8 = 23 - RxInvertMask uint32 = 0x1 << RxInvertShift - - RxTxEnableConfigShift uint8 = 21 - RxTxEnableConfigMask uint32 = 0x3 << RxTxEnableConfigShift - - InputRouteIOxApicShift uint8 = 20 - InputRouteIOxApicMask uint32 = 0x1 << InputRouteIOxApicShift - - InputRouteSCIShift uint8 = 19 - InputRouteSCIMask uint32 = 0x1 << InputRouteSCIShift - - InputRouteSMIShift uint8 = 18 - InputRouteSMIMask uint32 = 0x1 << InputRouteSMIShift - - InputRouteNMIShift uint8 = 17 - InputRouteNMIMask uint32 = 0x1 << InputRouteNMIShift - - PadModeShift uint8 = 10 - PadModeMask uint32 = 0x7 << PadModeShift - - RxTxBufDisableShift uint8 = 8 - RxTxBufDisableMask uint32 = 0x3 << RxTxBufDisableShift - - RxStateShift uint8 = 1 - RxStateMask uint32 = 0x1 << RxStateShift - - TxStateMask uint32 = 0x1 -) - -// config DW registers -const ( - PAD_CFG_DW0 = 0 - PAD_CFG_DW1 = 1 - MAX_DW_NUM = 2 -) - -// Register - configuration data structure based on DW0/1 dw value -// value : register value -// mask : bit fileds mask -// roFileds : read only fields mask -type Register struct { - value uint32 - mask uint32 - roFileds uint32 -} - -func (reg *Register) ValueSet(value uint32) *Register { - reg.value = value - return reg -} - -func (reg *Register) ValueGet() uint32 { - return reg.value -} - -func (reg *Register) ReadOnlyFieldsSet(fileldMask uint32) *Register { - reg.roFileds = fileldMask - return reg -} - -func (reg *Register) ReadOnlyFieldsGet() uint32 { - return reg.roFileds -} - -// Check the mask of the new macro -// Returns true if the macro is generated correctly -func (reg *Register) MaskCheck() bool { - mask := ^(reg.mask | reg.roFileds) - return (reg.value & mask) == 0 -} - -// getResetConfig - get Reset Configuration from PADRSTCFG field in PAD_CFG_DW0_GPx register -func (reg *Register) getFieldVal(mask uint32, shift uint8) uint8 { - reg.mask |= mask - return uint8((reg.value & mask) >> shift) -} - -// CntrMaskFieldsClear - clear filed in control mask -// fieldMask - mask of the field to be cleared -func (reg *Register) CntrMaskFieldsClear(fieldMask uint32) { - reg.mask &= ^fieldMask -} - -// IgnoredFieldsGet - return mask of unchecked (ignored) fields. -// -// These bit fields were not read when the macro was -// generated. -// -// return -// -// mask of ignored bit field -func (reg *Register) IgnoredFieldsGet() uint32 { - mask := reg.mask | reg.roFileds - return reg.value & ^mask -} - -// getResetConfig - returns type reset source for corresponding pad -// PADRSTCFG field in PAD_CFG_DW0 register -func (reg *Register) GetResetConfig() uint8 { - return reg.getFieldVal(PadRstCfgMask, PadRstCfgShift) -} - -// getRXPadStateSelect - returns RX Pad State (RXINV) -// 0 = Raw RX pad state directly from RX buffer -// 1 = Internal RX pad state -func (reg *Register) GetRXPadStateSelect() uint8 { - return reg.getFieldVal(RxPadStateSelectMask, RxPadStateSelectShift) -} - -// getRXRawOverrideStatus - returns 1 if the selected pad state is being -// overridden to '1' (RXRAW1 field) -func (reg *Register) GetRXRawOverrideStatus() uint8 { - return reg.getFieldVal(RxRawOverrideTo1Mask, RxRawOverrideTo1Shift) -} - -// getRXLevelEdgeConfiguration - returns RX Level/Edge Configuration (RXEVCFG) -// 0h = Level, 1h = Edge, 2h = Drive '0', 3h = Reserved (implement as setting 0h) -func (reg *Register) GetRXLevelEdgeConfiguration() uint8 { - return reg.getFieldVal(RxLevelEdgeConfigurationMask, RxLevelEdgeConfigurationShift) -} - -// GetRxInvert - returns RX Invert state (RXINV) -// 1 - Inversion, 0 - No inversion -func (reg *Register) GetRxInvert() uint8 { - return reg.getFieldVal(RxInvertMask, RxInvertShift) -} - -// getRxTxEnableConfig - returns RX/TX Enable Config (RXTXENCFG) -// 0 = Function defined in Pad Mode controls TX and RX Enables -// 1 = Function controls TX Enable and RX Disabled with RX drive 0 internally -// 2 = Function controls TX Enable and RX Disabled with RX drive 1 internally -// 3 = Function controls TX Enabled and RX is always enabled -func (reg *Register) GetRxTxEnableConfig() uint8 { - return reg.getFieldVal(RxTxEnableConfigMask, RxTxEnableConfigShift) -} - -// getGPIOInputRouteIOxAPIC - returns 1 if the pad can be routed to cause -// peripheral IRQ when configured in GPIO input mode. -func (reg *Register) GetGPIOInputRouteIOxAPIC() uint8 { - return reg.getFieldVal(InputRouteIOxApicMask, InputRouteIOxApicShift) -} - -// getGPIOInputRouteSCI - returns 1 if the pad can be routed to cause SCI when -// configured in GPIO input mode. -func (reg *Register) GetGPIOInputRouteSCI() uint8 { - return reg.getFieldVal(InputRouteSCIMask, InputRouteSCIShift) -} - -// getGPIOInputRouteSMI - returns 1 if the pad can be routed to cause SMI when -// configured in GPIO input mode -func (reg *Register) GetGPIOInputRouteSMI() uint8 { - return reg.getFieldVal(InputRouteSMIMask, InputRouteSMIShift) -} - -// getGPIOInputRouteNMI - returns 1 if the pad can be routed to cause NMI when -// configured in GPIO input mode -func (reg *Register) GetGPIOInputRouteNMI() uint8 { - return reg.getFieldVal(InputRouteNMIMask, InputRouteNMIShift) -} - -// getPadMode - reutrns pad mode or one of the native functions -// 0h = GPIO control the Pad. -// 1h = native function 1, if applicable, controls the Pad -// 2h = native function 2, if applicable, controls the Pad -// 3h = native function 3, if applicable, controls the Pad -// 4h = enable GPIO blink/PWM capability if applicable -func (reg *Register) GetPadMode() uint8 { - return reg.getFieldVal(PadModeMask, PadModeShift) -} - -// getGPIORxTxDisableStatus - returns GPIO RX/TX buffer state (GPIORXDIS | GPIOTXDIS) -// 0 - both are enabled, 1 - TX Disable, 2 - RX Disable, 3 - both are disabled -func (reg *Register) GetGPIORxTxDisableStatus() uint8 { - return reg.getFieldVal(RxTxBufDisableMask, RxTxBufDisableShift) -} - -// getGPIORXState - returns GPIO RX State (GPIORXSTATE) -func (reg *Register) GetGPIORXState() uint8 { - return reg.getFieldVal(RxStateMask, RxStateShift) -} - -// getGPIOTXState - returns GPIO TX State (GPIOTXSTATE) -func (reg *Register) GetGPIOTXState() uint8 { - return reg.getFieldVal(TxStateMask, 0) -} - -// Bit field constants for PAD_CFG_DW1 register -const ( - PadTolShift uint8 = 25 - PadTolMask uint32 = 0x1 << PadTolShift - - IOStandbyStateShift uint8 = 14 - IOStandbyStateMask uint32 = 0xF << IOStandbyStateShift - - TermShift uint8 = 10 - TermMask uint32 = 0xF << TermShift - - IOStandbyTerminationShift uint8 = 8 - IOStandbyTerminationMask uint32 = 0x3 << IOStandbyTerminationShift - - InterruptSelectMask uint32 = 0xFF -) - -// GetPadTol -func (reg *Register) GetPadTol() uint8 { - return reg.getFieldVal(PadTolMask, PadTolShift) -} - -// getIOStandbyState - return IO Standby State (IOSSTATE) -// 0 = Tx enabled driving last value driven, Rx enabled -// 1 = Tx enabled driving 0, Rx disabled and Rx driving 0 back to its controller internally -// 2 = Tx enabled driving 0, Rx disabled and Rx driving 1 back to its controller internally -// 3 = Tx enabled driving 1, Rx disabled and Rx driving 0 back to its controller internally -// 4 = Tx enabled driving 1, Rx disabled and Rx driving 1 back to its controller internally -// 5 = Tx enabled driving 0, Rx enabled -// 6 = Tx enabled driving 1, Rx enabled -// 7 = Hi-Z, Rx driving 0 back to its controller internally -// 8 = Hi-Z, Rx driving 1 back to its controller internally -// 9 = Tx disabled, Rx enabled -// 15 = IO-Standby is ignored for this pin (same as functional mode) -// Others reserved -func (reg *Register) GetIOStandbyState() uint8 { - return reg.getFieldVal(IOStandbyStateMask, IOStandbyStateShift) -} - -// getIOStandbyTermination - return IO Standby Termination (IOSTERM) -// 0 = Same as functional mode (no change) -// 1 = Disable Pull-up and Pull-down (no on-die termination) -// 2 = Enable Pull-down -// 3 = Enable Pull-up -func (reg *Register) GetIOStandbyTermination() uint8 { - return reg.getFieldVal(IOStandbyTerminationMask, IOStandbyTerminationShift) -} - -// getTermination - returns the pad termination state defines the different weak -// pull-up and pull-down settings that are supported by the buffer -// 0000 = none; 0010 = 5k PD; 0100 = 20k PD; 1010 = 5k PU; 1100 = 20k PU; -// 1111 = Native controller selected -func (reg *Register) GetTermination() uint8 { - return reg.getFieldVal(TermMask, TermShift) -} - -// getInterruptSelect - returns Interrupt Line number from the GPIO controller -func (reg *Register) GetInterruptSelect() uint8 { - return reg.getFieldVal(InterruptSelectMask, 0) -} diff --git a/util/intelp2m/platforms/common/register/bits/bits.go b/util/intelp2m/platforms/common/register/bits/bits.go new file mode 100644 index 0000000000..a156e20147 --- /dev/null +++ b/util/intelp2m/platforms/common/register/bits/bits.go @@ -0,0 +1,92 @@ +package bits + +type Offset uint8 + +const All32 uint32 = 0b11111111111111111111111111111111 + +const ( + DW0PadRstCfg Offset = 30 + DW0RxPadStateSelect Offset = 29 + DW0RxRawOverrideTo1 Offset = 28 + DW0RxLevelEdgeConfiguration Offset = 25 + DW0RxInvert Offset = 23 + DW0RxTxEnableConfig Offset = 21 + DW0InputRouteIOxApic Offset = 20 + DW0InputRouteSCI Offset = 19 + DW0InputRouteSMI Offset = 18 + DW0InputRouteNMI Offset = 17 + DW0PadMode Offset = 10 + DW0RxTxBufDisable Offset = 8 + DW0RxState Offset = 1 + DW0TxState Offset = 0 +) + +const ( + RstCfgPWROK = 0b00 + RstCfgDEEP = 0b01 + RstCfgPLTRST = 0b10 + RstCfgRSMRST = 0b11 +) + +const ( + TrigLEVEL = 0b00 + TrigEDGE_SINGLE = 0b01 + TrigOFF = 0b10 + TrigEDGE_BOTH = 0b11 +) + +type Fields map[Offset]uint32 + +var DW0 = Fields{ + DW0PadRstCfg: 0b11 << DW0PadRstCfg, + DW0RxPadStateSelect: 0b1 << DW0RxPadStateSelect, + DW0RxRawOverrideTo1: 0b1 << DW0RxRawOverrideTo1, + DW0RxLevelEdgeConfiguration: 0b11 << DW0RxLevelEdgeConfiguration, + DW0RxInvert: 0b1 << DW0RxInvert, + DW0RxTxEnableConfig: 0b11 << DW0RxTxEnableConfig, + DW0InputRouteIOxApic: 0b1 << DW0InputRouteIOxApic, + DW0InputRouteSCI: 0b1 << DW0InputRouteSCI, + DW0InputRouteSMI: 0b1 << DW0InputRouteSMI, + DW0InputRouteNMI: 0b1 << DW0InputRouteNMI, + DW0PadMode: 0b111 << DW0PadMode, + DW0RxTxBufDisable: 0b11 << DW0RxTxBufDisable, + DW0RxState: 0b1 << DW0RxState, + DW0TxState: 0b1 << DW0TxState, +} + +const ( + DW1PadTol Offset = 25 + DW1IOStandbyState Offset = 14 + DW1Term Offset = 10 + DW1IOStandbyTermination Offset = 8 + DW1InterruptSelect Offset = 0 +) + +const ( + IOStateTxLASTRxE = 0b0000 + IOStateTx0RxDCRx0 = 0b0001 + IOStateTx0RxDCRx1 = 0b0010 + IOStateTx1RxDCRx0 = 0b0011 + IOStateTx1RxDCRx1 = 0b0100 + IOStateTx0RxE = 0b0101 + IOStateTx1RxE = 0b0110 + IOStateHIZCRx0 = 0b0111 + IOStateHIZCRx1 = 0b1000 + IOStateTxDRxE = 0b1001 + IOStateStandbyIgnore = 0b1111 +) + +const ( + IOTermSAME = 0b00 + IOTermDISPUPD = 0b01 + IOTermENPD = 0b10 + IOTermENPU = 0b11 +) + +var DW1 = Fields{ + DW1PadTol: 0b1 << DW1PadTol, + DW1IOStandbyState: 0b1111 << DW1IOStandbyState, + DW1Term: 0b1111 << DW1Term, + DW1IOStandbyTermination: 0b11 << DW1IOStandbyTermination, + DW1InterruptSelect: 0b11111111 << DW1InterruptSelect, +} diff --git a/util/intelp2m/platforms/common/register/dw0.go b/util/intelp2m/platforms/common/register/dw0.go new file mode 100644 index 0000000000..8cf23841e4 --- /dev/null +++ b/util/intelp2m/platforms/common/register/dw0.go @@ -0,0 +1,97 @@ +package register + +import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" + +type DW0 struct { + Register +} + +// getResetConfig() returns type reset source for corresponding pad +// PADRSTCFG field in PAD_CFG_DW0 register +func (dw0 *DW0) GetResetConfig() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0PadRstCfg) +} + +// getRXPadStateSelect() returns RX Pad State (RXINV) +// 0 = Raw RX pad state directly from RX buffer +// 1 = Internal RX pad state +func (dw0 *DW0) GetRXPadStateSelect() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxPadStateSelect) +} + +// getRXRawOverrideStatus() returns 1 if the selected pad state is being +// overridden to '1' (RXRAW1 field) +func (dw0 *DW0) GetRXRawOverrideStatus() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxRawOverrideTo1) +} + +// getRXLevelEdgeConfiguration() returns RX Level/Edge Configuration (RXEVCFG) +// 0h = Level, 1h = Edge, 2h = Drive '0', 3h = Reserved (implement as setting 0h) +func (dw0 *DW0) GetRXLevelEdgeConfiguration() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxLevelEdgeConfiguration) +} + +// GetRxInvert() returns RX Invert state (RXINV) +// 1 - Inversion, 0 - No inversion +func (dw0 *DW0) GetRxInvert() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxInvert) +} + +// getRxTxEnableConfig() returns RX/TX Enable Config (RXTXENCFG) +// 0 = Function defined in Pad Mode controls TX and RX Enables +// 1 = Function controls TX Enable and RX Disabled with RX drive 0 internally +// 2 = Function controls TX Enable and RX Disabled with RX drive 1 internally +// 3 = Function controls TX Enabled and RX is always enabled +func (dw0 *DW0) GetRxTxEnableConfig() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxTxEnableConfig) +} + +// getGPIOInputRouteIOxAPIC() returns 1 if the pad can be routed to cause +// peripheral IRQ when configured in GPIO input mode. +func (dw0 *DW0) GetGPIOInputRouteIOxAPIC() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0InputRouteIOxApic) +} + +// getGPIOInputRouteSCI() returns 1 if the pad can be routed to cause SCI when +// configured in GPIO input mode. +func (dw0 *DW0) GetGPIOInputRouteSCI() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0InputRouteSCI) +} + +// getGPIOInputRouteSMI() returns 1 if the pad can be routed to cause SMI when +// configured in GPIO input mode +func (dw0 *DW0) GetGPIOInputRouteSMI() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0InputRouteSMI) +} + +// getGPIOInputRouteNMI() returns 1 if the pad can be routed to cause NMI when +// configured in GPIO input mode +func (dw0 *DW0) GetGPIOInputRouteNMI() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0InputRouteNMI) +} + +// getPadMode() reutrns pad mode or one of the native functions +// 0h = GPIO control the Pad. +// 1h = native function 1, if applicable, controls the Pad +// 2h = native function 2, if applicable, controls the Pad +// 3h = native function 3, if applicable, controls the Pad +// 4h = enable GPIO blink/PWM capability if applicable +func (dw0 *DW0) GetPadMode() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0PadMode) +} + +// getGPIORxTxDisableStatus() returns GPIO RX/TX buffer state (GPIORXDIS | GPIOTXDIS) +// 0 - both are enabled, 1 - TX Disable, 2 - RX Disable, 3 - both are disabled +func (dw0 *DW0) GetGPIORxTxDisableStatus() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxTxBufDisable) +} + +// getGPIORXState() returns GPIO RX State (GPIORXSTATE) +func (dw0 *DW0) GetGPIORXState() uint32 { + return dw0.GetFieldVal(bits.DW0, bits.DW0RxState) +} + +// getGPIOTXState() returns GPIO TX State (GPIOTXSTATE) +func (dw0 *DW0) GetGPIOTXState() uint32 { + return dw0.GetFieldVal(bits.DW0, 0) +} diff --git a/util/intelp2m/platforms/common/register/dw1.go b/util/intelp2m/platforms/common/register/dw1.go new file mode 100644 index 0000000000..0336562bc6 --- /dev/null +++ b/util/intelp2m/platforms/common/register/dw1.go @@ -0,0 +1,51 @@ +package register + +import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" + +type DW1 struct { + Register +} + +// GetPadTol() +func (dw1 *DW1) GetPadTol() uint32 { + return dw1.GetFieldVal(bits.DW1, bits.DW1PadTol) +} + +// GetIOStandbyState() returns IO Standby State (IOSSTATE) +// 0 = Tx enabled driving last value driven, Rx enabled +// 1 = Tx enabled driving 0, Rx disabled and Rx driving 0 back to its controller internally +// 2 = Tx enabled driving 0, Rx disabled and Rx driving 1 back to its controller internally +// 3 = Tx enabled driving 1, Rx disabled and Rx driving 0 back to its controller internally +// 4 = Tx enabled driving 1, Rx disabled and Rx driving 1 back to its controller internally +// 5 = Tx enabled driving 0, Rx enabled +// 6 = Tx enabled driving 1, Rx enabled +// 7 = Hi-Z, Rx driving 0 back to its controller internally +// 8 = Hi-Z, Rx driving 1 back to its controller internally +// 9 = Tx disabled, Rx enabled +// 15 = IO-Standby is ignored for this pin (same as functional mode) +// Others reserved +func (dw1 *DW1) GetIOStandbyState() uint32 { + return dw1.GetFieldVal(bits.DW1, bits.DW1IOStandbyState) +} + +// GetIOStandbyTermination() returns IO Standby Termination (IOSTERM) +// 0 = Same as functional mode (no change) +// 1 = Disable Pull-up and Pull-down (no on-die termination) +// 2 = Enable Pull-down +// 3 = Enable Pull-up +func (dw1 *DW1) GetIOStandbyTermination() uint32 { + return dw1.GetFieldVal(bits.DW1, bits.DW1IOStandbyTermination) +} + +// GetTermination() returns the pad termination state defines the different weak +// pull-up and pull-down settings that are supported by the buffer +// 0000 = none; 0010 = 5k PD; 0100 = 20k PD; 1010 = 5k PU; 1100 = 20k PU; +// 1111 = Native controller selected +func (dw1 *DW1) GetTermination() uint32 { + return dw1.GetFieldVal(bits.DW1, bits.DW1Term) +} + +// GetInterruptSelect() returns Interrupt Line number from the GPIO controller +func (dw1 *DW1) GetInterruptSelect() uint32 { + return dw1.GetFieldVal(bits.DW1, bits.DW1InterruptSelect) +} diff --git a/util/intelp2m/platforms/common/register/register.go b/util/intelp2m/platforms/common/register/register.go new file mode 100644 index 0000000000..48cc240092 --- /dev/null +++ b/util/intelp2m/platforms/common/register/register.go @@ -0,0 +1,45 @@ +package register + +import ( + "fmt" + + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" +) + +type Register struct { + Value uint32 + Mask uint32 + ReadOnly uint32 +} + +// MaskCheck() checks the mask of the new macro +// Returns true if the macro is generated correctly +func (r Register) MaskCheck() bool { + mask := ^(r.Mask | r.ReadOnly) + return (r.Value & mask) == 0 +} + +// GetFieldVal() gets the value of the register bit field +func (r *Register) GetFieldVal(bitfields bits.Fields, offset bits.Offset) uint32 { + mask := bitfields[offset] + r.Mask |= mask + return (r.Value & mask) >> offset +} + +// CntrMaskFieldsClear() clears filed in control mask +// fieldMask : bitfields mask to be cleared +func (r *Register) CntrMaskFieldsClear(fieldMask uint32) { + r.Mask &= ^fieldMask +} + +// IgnoredFieldsGet() returns mask of unchecked (ignored) fields. +// These bit fields were not read when the macro was generated. +// return : mask of ignored bit field +func (r Register) IgnoredFieldsGet() uint32 { + mask := r.Mask | r.ReadOnly + return r.Value & ^mask +} + +func (r Register) String() string { + return fmt.Sprintf("0x%0.8x", r.Value) +} diff --git a/util/intelp2m/platforms/ebg/ebg_test.go b/util/intelp2m/platforms/ebg/ebg_test.go index bed3cb65f6..13e977a063 100644 --- a/util/intelp2m/platforms/ebg/ebg_test.go +++ b/util/intelp2m/platforms/ebg/ebg_test.go @@ -51,7 +51,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E5, UP_2K, RSMRST, NF3),", - Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { @@ -65,14 +65,14 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_J7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_J7, INVALID, PLTRST, NF6),", - Long: "_PAD_CFG_STRUCT(GPP_J7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_J7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { Pad: test.Pad{ID: "GPP_I8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_I8, UP_667, DEEP, NF5),", - Long: "_PAD_CFG_STRUCT(GPP_I8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU)),", + Long: "_PAD_CFG_STRUCT(GPP_I8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, }.Run(t, "INTEL-EMMITSBURG-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", emmitsburg) @@ -82,7 +82,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_L9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_L9, UP_20K, RSMRST, NF4),", - Long: "_PAD_CFG_STRUCT(GPP_L9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_L9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index 1fb0a3273a..9dba566907 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -6,6 +6,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -14,12 +15,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { Pull() GpiMacroAdd() @@ -36,21 +31,22 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + var remapping = map[uint32]uint32{ + 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro @@ -83,9 +79,7 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// -// error -func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { +func (platform PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ InheritanceMacro: cnl.PlatformSpecific{ @@ -95,10 +89,18 @@ func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, own fields.InterfaceGet(), ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/jsl/jsl_test.go b/util/intelp2m/platforms/jsl/jsl_test.go index d090ea79c3..143617fb9a 100644 --- a/util/intelp2m/platforms/jsl/jsl_test.go +++ b/util/intelp2m/platforms/jsl/jsl_test.go @@ -51,7 +51,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E5, UP_2K, RSMRST, NF3),", - Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { @@ -65,14 +65,14 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_G7, INVALID, PLTRST, NF6),", - Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { Pad: test.Pad{ID: "GPP_H8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_H8, UP_667, DEEP, NF5),", - Long: "_PAD_CFG_STRUCT(GPP_H8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU)),", + Long: "_PAD_CFG_STRUCT(GPP_H8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", jasperlake) @@ -82,7 +82,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_R9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_R9, UP_20K, PWROK, NF4),", - Long: "_PAD_CFG_STRUCT(GPP_R9, PAD_FUNC(NF4) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_R9, PAD_FUNC(NF4) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { diff --git a/util/intelp2m/platforms/jsl/macro.go b/util/intelp2m/platforms/jsl/macro.go index 42c254b190..d21eda151a 100644 --- a/util/intelp2m/platforms/jsl/macro.go +++ b/util/intelp2m/platforms/jsl/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -15,12 +16,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xdfffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { Pull() GpiMacroAdd() @@ -47,21 +42,22 @@ func (PlatformSpecific) RemmapRstSrc() { return } - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + var remapping = map[uint32]uint32{ + 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro @@ -94,9 +90,7 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// -// error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { +func (PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ InheritanceMacro: cnl.PlatformSpecific{ @@ -106,10 +100,19 @@ func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership ui fields.InterfaceGet(), ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + macro.Clear() + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/lbg/macro.go b/util/intelp2m/platforms/lbg/macro.go index 8a706e3d5d..9cbd4f0570 100644 --- a/util/intelp2m/platforms/lbg/macro.go +++ b/util/intelp2m/platforms/lbg/macro.go @@ -5,6 +5,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -13,12 +14,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { Pull() GpiMacroAdd() @@ -35,21 +30,22 @@ type PlatformSpecific struct { // RemmapRstSrc - remmap Pad Reset Source Config func (PlatformSpecific) RemmapRstSrc() { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + remapping := map[uint32]uint32{ + 0: (bits.RstCfgRSMRST << bits.DW0PadRstCfg), + 1: (bits.RstCfgDEEP << bits.DW0PadRstCfg), + 2: (bits.RstCfgPLTRST << bits.DW0PadRstCfg), } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro @@ -79,20 +75,31 @@ func (platform PlatformSpecific) NoConnMacroAdd() { } // GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value +// dw0val : DW0 config register value +// dw1val : DW1 config register value // return: string of macro -// error -func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { +func (platform PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { // The GPIO controller architecture in Lewisburg and Sunrise are very similar, // so we will inherit some platform-dependent functions from Sunrise. - macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}}, - fields.InterfaceGet()) + macro := common.GetInstanceMacro( + PlatformSpecific{ + InheritanceMacro: snr.PlatformSpecific{}, + }, + fields.InterfaceGet(), + ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/mtl/macro.go b/util/intelp2m/platforms/mtl/macro.go index 06d05996c3..d672752b5b 100644 --- a/util/intelp2m/platforms/mtl/macro.go +++ b/util/intelp2m/platforms/mtl/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -15,12 +16,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { Pull() GpiMacroAdd() @@ -43,22 +38,23 @@ func (PlatformSpecific) RemmapRstSrc() { return } - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, - 3: common.RST_PWROK << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + var remapping = map[uint32]uint32{ + 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + 3: bits.RstCfgPWROK << bits.RstCfgPWROK, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro @@ -91,9 +87,7 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// -// error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { +func (PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ InheritanceMacro: cnl.PlatformSpecific{ @@ -103,10 +97,18 @@ func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership ui fields.InterfaceGet(), ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/mtl/mtl_test.go b/util/intelp2m/platforms/mtl/mtl_test.go index 07bb99b191..11f8727883 100644 --- a/util/intelp2m/platforms/mtl/mtl_test.go +++ b/util/intelp2m/platforms/mtl/mtl_test.go @@ -51,7 +51,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_H5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_H5, UP_2K, PWROK, NF3),", - Long: "_PAD_CFG_STRUCT(GPP_H5, PAD_FUNC(NF3) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_H5, PAD_FUNC(NF3) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { @@ -65,14 +65,14 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_S7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_S7, INVALID, PLTRST, NF6),", - Long: "_PAD_CFG_STRUCT(GPP_S7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_S7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { Pad: test.Pad{ID: "GPP_B8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_B8, UP_667, DEEP, NF5),", - Long: "_PAD_CFG_STRUCT(GPP_B8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU)),", + Long: "_PAD_CFG_STRUCT(GPP_B8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", meteorlake) @@ -82,7 +82,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_D9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_D9, UP_20K, RSMRST, NF4),", - Long: "_PAD_CFG_STRUCT(GPP_D9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_D9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { diff --git a/util/intelp2m/platforms/snr/macro.go b/util/intelp2m/platforms/snr/macro.go index aa3be5d9bb..7eee4bf351 100644 --- a/util/intelp2m/platforms/snr/macro.go +++ b/util/intelp2m/platforms/snr/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) const ( @@ -14,12 +15,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type PlatformSpecific struct{} // RemmapRstSrc - remmap Pad Reset Source Config @@ -32,29 +27,30 @@ func (PlatformSpecific) RemmapRstSrc() { return } - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + remapping := map[uint32]uint32{ + 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro // as a new argument func (PlatformSpecific) Pull() { macro := common.GetMacro() - dw1 := macro.Register(PAD_CFG_DW1) - var pull = map[uint8]string{ + dw1 := macro.GetRegisterDW1() + var pull = map[uint32]string{ 0x0: "NONE", 0x2: "DN_5K", 0x4: "DN_20K", @@ -79,13 +75,13 @@ func (PlatformSpecific) Pull() { // Generate macro to cause peripheral IRQ when configured in GPIO input mode func ioApicRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() if dw0.GetGPIOInputRouteIOxAPIC() == 0 { return false } macro.Add("_APIC") - if dw0.GetRXLevelEdgeConfiguration() == common.TRIG_LEVEL { + if dw0.GetRXLevelEdgeConfiguration() == bits.TrigLEVEL { if dw0.GetRxInvert() != 0 { // PAD_CFG_GPI_APIC_LOW(pad, pull, rst) macro.Add("_LOW") @@ -105,7 +101,7 @@ func ioApicRoute() bool { // Generate macro to cause NMI when configured in GPIO input mode func nmiRoute() bool { macro := common.GetMacro() - if macro.Register(PAD_CFG_DW0).GetGPIOInputRouteNMI() == 0 { + if macro.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { return false } // PAD_CFG_GPI_NMI(GPIO_24, UP_20K, DEEP, LEVEL, INVERT), @@ -116,7 +112,7 @@ func nmiRoute() bool { // Generate macro to cause SCI when configured in GPIO input mode func sciRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() if dw0.GetGPIOInputRouteSCI() == 0 { return false } @@ -128,7 +124,7 @@ func sciRoute() bool { // Generate macro to cause SMI when configured in GPIO input mode func smiRoute() bool { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() if dw0.GetGPIOInputRouteSMI() == 0 { return false } @@ -175,23 +171,24 @@ func (PlatformSpecific) GpiMacroAdd() { default: // Clear the control mask so that the check fails and "Advanced" macro is // generated - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) + macro.GetRegisterDW0().CntrMaskFieldsClear(bits.All32) } } // Adds PAD_CFG_GPO macro with arguments func (PlatformSpecific) GpoMacroAdd() { macro := common.GetMacro() - dw0 := macro.Register(PAD_CFG_DW0) - term := macro.Register(PAD_CFG_DW1).GetTermination() + dw0 := macro.GetRegisterDW0() + term := macro.GetRegisterDW1().GetTermination() // #define PAD_CFG_GPO(pad, val, rst) \ // _PAD_CFG_STRUCT(pad, \ // PAD_FUNC(GPIO) | PAD_RESET(rst) | \ // PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | !!val, \ // PAD_PULL(NONE) | PAD_IOSSTATE(TxLASTRxE)) - if dw0.GetRXLevelEdgeConfiguration() != common.TRIG_OFF { - dw0.CntrMaskFieldsClear(common.RxLevelEdgeConfigurationMask) + if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { + mask := bits.DW0[bits.DW0RxLevelEdgeConfiguration] + dw0.CntrMaskFieldsClear(mask) } macro.Set("PAD_CFG") if macro.IsOwnershipDriver() { @@ -215,7 +212,7 @@ func (PlatformSpecific) NativeFunctionMacroAdd() { macro := common.GetMacro() // e.g. PAD_CFG_NF(GPP_D23, NONE, DEEP, NF1) macro.Set("PAD_CFG_NF") - if macro.Register(PAD_CFG_DW1).GetPadTol() != 0 { + if macro.GetRegisterDW1().GetPadTol() != 0 { macro.Add("_1V8") } macro.Add("(").Id().Pull().Rstsrc().Padfn().Add("),") @@ -228,33 +225,44 @@ func (PlatformSpecific) NoConnMacroAdd() { // _PAD_CFG_STRUCT(pad, // PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), // PAD_PULL(pull) | PAD_IOSSTATE(TxDRxE)), - dw0 := macro.Register(PAD_CFG_DW0) + dw0 := macro.GetRegisterDW0() // Some fields of the configuration registers are hidden inside the macros, // we should check them to update the corresponding bits in the control mask. - if dw0.GetRXLevelEdgeConfiguration() != common.TRIG_OFF { - dw0.CntrMaskFieldsClear(common.RxLevelEdgeConfigurationMask) + if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { + mask := bits.DW0[bits.DW0RxLevelEdgeConfiguration] + dw0.CntrMaskFieldsClear(mask) } if dw0.GetResetConfig() != 1 { // 1 = RST_DEEP - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } macro.Set("PAD_NC").Add("(").Id().Pull().Add("),") } // GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value +// dw0Val : DW0 config register value +// dw1Val : DW1 config register value // return: string of macro -// -// error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { - macro := common.GetInstanceMacro(PlatformSpecific{}, fields.InterfaceGet()) +func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { + macro := common.GetInstanceMacro( + PlatformSpecific{}, + fields.InterfaceGet(), + ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/tgl/macro.go b/util/intelp2m/platforms/tgl/macro.go index c925eeb30c..fdd324fcdd 100644 --- a/util/intelp2m/platforms/tgl/macro.go +++ b/util/intelp2m/platforms/tgl/macro.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) @@ -15,12 +16,6 @@ const ( PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff ) -const ( - PAD_CFG_DW0 = common.PAD_CFG_DW0 - PAD_CFG_DW1 = common.PAD_CFG_DW1 - MAX_DW_NUM = common.MAX_DW_NUM -) - type InheritanceMacro interface { Pull() GpiMacroAdd() @@ -43,21 +38,22 @@ func (PlatformSpecific) RemmapRstSrc() { return } - dw0 := macro.Register(PAD_CFG_DW0) - var remapping = map[uint8]uint32{ - 0: common.RST_RSMRST << common.PadRstCfgShift, - 1: common.RST_DEEP << common.PadRstCfgShift, - 2: common.RST_PLTRST << common.PadRstCfgShift, + dw0 := macro.GetRegisterDW0() + var remapping = map[uint32]uint32{ + 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } resetsrc, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.ValueSet(ResetConfigFieldVal) + ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] + dw0.Value = ResetConfigFieldVal } else { fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) } - dw0.CntrMaskFieldsClear(common.PadRstCfgMask) + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro @@ -90,9 +86,7 @@ func (platform PlatformSpecific) NoConnMacroAdd() { // dw0 : DW0 config register value // dw1 : DW1 config register value // return: string of macro -// -// error -func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string { +func (PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { macro := common.GetInstanceMacro( PlatformSpecific{ InheritanceMacro: cnl.PlatformSpecific{ @@ -102,10 +96,18 @@ func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership ui fields.InterfaceGet(), ) macro.Clear() - macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields) - macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields) + + dw0 := macro.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) + + dw1 := macro.GetRegisterDW1() + dw1.CntrMaskFieldsClear(bits.All32) + + dw0.Value = dw0Val + dw1.Value = dw1Val + dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS + dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS + macro.PadIdSet(id).SetPadOwnership(ownership) - macro.Register(PAD_CFG_DW0).ValueSet(dw0).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS) - macro.Register(PAD_CFG_DW1).ValueSet(dw1).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS) return macro.Generate() } diff --git a/util/intelp2m/platforms/tgl/tgl_test.go b/util/intelp2m/platforms/tgl/tgl_test.go index e37567e4fa..a968f96fab 100644 --- a/util/intelp2m/platforms/tgl/tgl_test.go +++ b/util/intelp2m/platforms/tgl/tgl_test.go @@ -51,7 +51,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_C5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_C5, UP_2K, RSMRST, NF3),", - Long: "_PAD_CFG_STRUCT(GPP_C5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_C5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { @@ -65,14 +65,14 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_G7, INVALID, PLTRST, NF6),", - Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { Pad: test.Pad{ID: "GPD8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPD8, UP_667, DEEP, NF5),", - Long: "_PAD_CFG_STRUCT(GPD8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU)),", + Long: "_PAD_CFG_STRUCT(GPD8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", tigerlake) @@ -82,7 +82,7 @@ func TestGenMacro(t *testing.T) { Pad: test.Pad{ID: "GPP_E9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E9, UP_20K, RSMRST, NF4),", - Long: "_PAD_CFG_STRUCT(GPP_E9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", + Long: "_PAD_CFG_STRUCT(GPP_E9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { From 2e9dd0ade2e310203a299e02e80f99393118635f Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Sat, 3 Dec 2022 22:41:42 +0300 Subject: [PATCH 0251/3886] util/intelp2m: Update cli options - Redesign the options format. - Add automatic completion of arguments for bash. [complete -C `pwd`/intelp2m ./intelp2m] to enable TEST: make test = PASS Change-Id: I08ff379b99b018b1099aa5d70fea47026bc84045 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/70310 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/cli/completion.go | 22 +++ util/intelp2m/cli/options.go | 232 +++++++++++++++++++++++++++++ util/intelp2m/config/p2m/config.go | 4 +- util/intelp2m/main.go | 91 ++--------- util/intelp2m/version.txt | 2 +- 5 files changed, 270 insertions(+), 81 deletions(-) create mode 100644 util/intelp2m/cli/completion.go create mode 100644 util/intelp2m/cli/options.go diff --git a/util/intelp2m/cli/completion.go b/util/intelp2m/cli/completion.go new file mode 100644 index 0000000000..b322a87d10 --- /dev/null +++ b/util/intelp2m/cli/completion.go @@ -0,0 +1,22 @@ +package cli + +import ( + "flag" + "fmt" + "os" + "strings" +) + +func UseComplete() bool { + if _, ok := os.LookupEnv("COMP_LINE"); ok { + argument := os.Args[2] + argument = strings.TrimLeft(argument, "-") + flag.VisitAll(func(f *flag.Flag) { + if argument == "" || strings.HasPrefix(f.Name, argument) { + fmt.Println("-" + f.Name) + } + }) + return true + } + return false +} diff --git a/util/intelp2m/cli/options.go b/util/intelp2m/cli/options.go new file mode 100644 index 0000000000..c6adbcffd8 --- /dev/null +++ b/util/intelp2m/cli/options.go @@ -0,0 +1,232 @@ +package cli + +import ( + "flag" + "fmt" + "os" + "path/filepath" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" +) + +var name = filepath.Base(os.Args[0]) + +const usagePlatform = `usage: -platform + type: adl | apl | cnl | ebg | jsl | lbg | mtl | snr | tgl | ? + adl - Alder Lake PCH + apl - Apollo Lake SoC + cnl - CannonLake-LP or Whiskeylake/Coffeelake/Cometlake-U SoC + ebg - Emmitsburg PCH with Xeon SP + jsl - Jasper Lake SoC + lbg - Lewisburg PCH with Xeon SP + mtl - MeteorLake SoC + snr - Sunrise PCH or Skylake/Kaby Lake SoC + tgl - TigerLake-H SoC + ? - show details +` +const usageFields = `usage: -fields + type: cb | fsp | raw | ? + cb - coreboot style + fsp - Intel FSP style + raw - raw register value (don't convert, print as is) + ? - show details +` +const usageExclude = `usage: -e | -exclude + Exclude fields that should be ignored to generate "short" macro. + Details: + The utility should ignore "PAD_TRIG(OFF)" field in the "_PAD_CFG_STRUCT(GPP_I12, + PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1, 0)" + "long" macro to generate the "PAD_CFG_GPO(GPP_I12, 1, PLTRST)" macro. + + The utility with this option generates the "long" macro with only those fields that are + required to create the "short" one (in thia case without the "PAD_TRIG(OFF)" field): + "_PAD_CFG_STRUCT(GPP_I12, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_BUF(RX_DISABLE) | 1, 0)" +` + +const usageUnchecked = `usage: -u | -unchecked + Disable automatic bitfield checking before generating. + Details: + The utility automatically checks the bit fields of the DW registers before generating + the macro. If a bit is set in the register and it is not used in the "short" macro, the + utility will generate the "long" one instead of the first one. + + This option is used to disable automatic verification. In this case, all macros are + generated in the "short" format: + PAD_NC(GPP_F18, NONE), + PAD_CFG_NF(GPP_F19, NONE, PLTRST, NF1), + ... +` + +const usageInfo = `usage: -i | -ii | -iii | -iiii + Generate additional information about macros. + Level 1 information (-i): + _PAD_CFG_STRUCT(GPP_A4, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | (1 << 1), 0), /* LAD3 */ + + Level 2 information (-ii): + /* GPP_A4 - LAD3 */ + /* DW0: 0x80000402, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_A4, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | (1 << 1), 0), + + Level 3 information (-iii): + /* GPP_A3 - LAD2 */ + /* DW0: 0x80000402, DW1: 0x00000000 */ + /* DW0: (1 << 1) - IGNORED */ + _PAD_CFG_STRUCT(GPP_A3, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | (1 << 1), 0), + + Level 4 information (-iiii): + /* GPP_A4 - LAD3 */ + /* DW0: 0x80000402, DW1: 0x00000000 */ + /* DW0: (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_A4, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_A4, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | (1 << 1), 0), +` + +const usage = ` +basic functions: + -h | -help Print help + -v | -version Print version + -file Set path to the inteltool file. by default + -out Set path to the generated file. by default + -p | -platform Set the PCH platform type. by default + (enter ? to show datails) + +generation of long composite macros with bit field definitions: + -f | -fields Set the bitfield type for the generated long macro + (enter ? to show datails) + +control flags: + -e | -exclude Exclude fields that should be ignored to generate short macro + -u | -unchecked Disable automatic bitfield checking before generating + (enter ? to show datails) + +generate additional information: + -i Add function to the comments + -ii Add DW0/DW1 register value to the comments + -iii Add ignored bitfields to the comments + -iiii Add target PAD_CFG() macro to the comments + (enter ? to show datails) +` + +func Usage() { + fmt.Printf(`usage: %s %s`, name, usage) +} + +func cbOptionsPlatform(value string) error { + if value == "?" { + fmt.Printf("%s", usagePlatform) + os.Exit(0) + } + + if err := p2m.SetPlatformType(value); err != nil { + fmt.Printf("error: %v\n%s", err, usagePlatform) + os.Exit(0) + } + + return nil +} + +func cbOptionsFields(value string) error { + if value == "?" { + fmt.Printf("%s", usageFields) + os.Exit(0) + } + + if err := p2m.SetFieldType(value); err != nil { + fmt.Printf("error: %v\n%s", err, usageFields) + os.Exit(0) + } + + return nil +} + +func cbOptionsExclude(_ string) error { + if numArgs := flag.NArg(); numArgs == 1 { + if flag.Arg(0) == "?" { + fmt.Printf("%s", usageExclude) + } + Usage() + os.Exit(0) + } + p2m.Config.IgnoredFields = true + return nil +} + +func cbOptionsUnchecked(_ string) error { + if numArgs := flag.NArg(); numArgs == 1 { + if flag.Arg(0) == "?" { + fmt.Printf("%s", usageUnchecked) + } + Usage() + os.Exit(0) + } + p2m.Config.AutoCheck = false + return nil +} + +func cbOptionsInfo(_ string) error { + if numArgs := flag.NArg(); numArgs == 1 { + if flag.Arg(0) == "?" { + fmt.Printf("%s", usageInfo) + os.Exit(0) + } + Usage() + os.Exit(0) + } + + table := map[string]int{ + "-i": 1, + "-ii": 2, + "-iii": 3, + "-iiii": 4, + } + for _, arg := range os.Args { + if level, exist := table[arg]; exist { + p2m.Config.GenLevel = level + return nil + } + } + Usage() + return nil +} + +func ParseOptions() { + flag.Usage = Usage + flag.StringVar(&p2m.Config.InputPath, "file", "inteltool.log", "") + flag.StringVar(&p2m.Config.OutputPath, "out", "generate/gpio.h", "") + help := flag.Bool("help", false, "") + + vers, v := flag.Bool("version", false, ""), flag.Bool("v", false, "") + + flag.Func("platform", usagePlatform, cbOptionsPlatform) + flag.Func("p", usagePlatform, cbOptionsPlatform) + + flag.Func("fields", usageFields, cbOptionsFields) + flag.Func("f", usageFields, cbOptionsFields) + + flag.BoolFunc("exclude", usageExclude, cbOptionsExclude) + flag.BoolFunc("e", usageExclude, cbOptionsExclude) + + flag.BoolFunc("unchecked", usageUnchecked, cbOptionsUnchecked) + flag.BoolFunc("u", usageUnchecked, cbOptionsUnchecked) + + flag.BoolFunc("i", usageInfo, cbOptionsInfo) + flag.BoolFunc("ii", usageInfo, cbOptionsInfo) + flag.BoolFunc("iii", usageInfo, cbOptionsInfo) + flag.BoolFunc("iiii", usageInfo, cbOptionsInfo) + + if UseComplete() { + os.Exit(0) + } + + flag.Parse() + + if *help { + Usage() + os.Exit(0) + } + + if *vers || *v { + fmt.Println(p2m.Config.Version) + os.Exit(0) + } +} diff --git a/util/intelp2m/config/p2m/config.go b/util/intelp2m/config/p2m/config.go index ce03ee0c36..07efb5b7bb 100644 --- a/util/intelp2m/config/p2m/config.go +++ b/util/intelp2m/config/p2m/config.go @@ -50,6 +50,8 @@ type Settings struct { Version string Platform PlatformType Field FieldType + InputPath string + OutputPath string InputFile *os.File OutputFile *os.File IgnoredFields bool @@ -60,7 +62,7 @@ type Settings struct { var Config = Settings{ Version: "unknown", Platform: Sunrise, - Field: CbFlds, + Field: NoFlds, IgnoredFields: false, AutoCheck: true, GenLevel: 0, diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go index f0e2203c3f..47a1516c98 100644 --- a/util/intelp2m/main.go +++ b/util/intelp2m/main.go @@ -1,11 +1,11 @@ package main import ( - "flag" "fmt" "os" "path/filepath" + "review.coreboot.org/coreboot.git/util/intelp2m/cli" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/parser" ) @@ -24,101 +24,34 @@ func (Printer) Line(lvl int, str string) { } } -var ( - // Version is injected into main during project build - Version string = "Unknown" -) - -// printVersion - print the utility version in the console -func printVersion() { - fmt.Printf("[ intelp2m ] Version: %s\n", Version) -} +// Version is injected into main during project build +var Version string = "Unknown" // main func main() { - // Command line arguments - inputFilePath := flag.String("file", "inteltool.log", - "the path to the inteltool log file\n") - - outputFilePath := flag.String("o", - "generate/gpio.h", - "the path to the generated file with GPIO configuration\n") - - ignored := flag.Bool("ign", false, - "exclude fields that should be ignored from advanced macros\n") - - unchecking := flag.Bool("n", false, - "Generate macros without checking.\n"+ - "\tIn this case, some fields of the configuration registers\n"+ - "\tDW0 will be ignored.\n") - - levels := []*bool{ - flag.Bool("i", false, "Show pads function in the comments"), - flag.Bool("ii", false, "Show DW0/DW1 value in the comments"), - flag.Bool("iii", false, "Show ignored bit fields in the comments"), - flag.Bool("iiii", false, "Show target PAD_CFG() macro in the comments"), - } - - platform := flag.String("p", "snr", "set platform:\n"+ - "\tsnr - Sunrise PCH or Skylake/Kaby Lake SoC\n"+ - "\tlbg - Lewisburg PCH with Xeon SP\n"+ - "\tapl - Apollo Lake SoC\n"+ - "\tcnl - CannonLake-LP or Whiskeylake/Coffeelake/Cometlake-U SoC\n"+ - "\ttgl - TigerLake-H SoC\n"+ - "\tadl - AlderLake PCH\n"+ - "\tjsl - Jasper Lake SoC\n"+ - "\tmtl - MeteorLake SoC\n"+ - "\tebg - Emmitsburg PCH with Xeon SP\n") - - field := flag.String("fld", "none", "set fields macros style:\n"+ - "\tcb - use coreboot style for bit fields macros\n"+ - "\tfsp - use fsp style\n"+ - "\traw - do not convert, print as is\n") - - flag.Parse() - printVersion() - - // settings p2m.Config.Version = Version - p2m.Config.IgnoredFields = *ignored - p2m.Config.AutoCheck = !(*unchecking) - for level, set := range levels { - if *set { - p2m.Config.GenLevel = level + 1 - fmt.Printf("Info level: Use level %d!\n", level+1) - break - } - } - if err := p2m.SetPlatformType(*platform); err != nil { - fmt.Printf("Error: %v\n", err) - os.Exit(1) - } + cli.ParseOptions() - if err := p2m.SetFieldType(*field); err != nil { - fmt.Printf("Error: %v\n", err) - os.Exit(1) - } - - if file, err := os.Open(*inputFilePath); err != nil { - fmt.Printf("input file error: %v", err) + if file, err := os.Open(p2m.Config.InputPath); err != nil { + fmt.Printf("input file error: %v\n", err) os.Exit(1) } else { p2m.Config.InputFile = file + defer file.Close() } - defer p2m.Config.InputFile.Close() - if err := os.MkdirAll(filepath.Dir(*outputFilePath), os.ModePerm); err != nil { - fmt.Printf("failed to create output directory: %v", err) + if err := os.MkdirAll(filepath.Dir(p2m.Config.OutputPath), os.ModePerm); err != nil { + fmt.Printf("failed to create output directory: %v\n", err) os.Exit(1) } - if file, err := os.Create(*outputFilePath); err != nil { - fmt.Printf("failed to create output file: %v", err) + if file, err := os.Create(p2m.Config.OutputPath); err != nil { + fmt.Printf("failed to create output file: %v\n", err) os.Exit(1) } else { p2m.Config.OutputFile = file + defer file.Close() } - defer p2m.Config.OutputFile.Close() prs := parser.ParserData{} prs.Parse() diff --git a/util/intelp2m/version.txt b/util/intelp2m/version.txt index 5625e59da8..7e32cd5698 100644 --- a/util/intelp2m/version.txt +++ b/util/intelp2m/version.txt @@ -1 +1 @@ -1.2 +1.3 From be7eb061310e560e48e9c77cd4d006282f0df1cf Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Mon, 5 Dec 2022 11:41:51 +0300 Subject: [PATCH 0252/3886] util/intelp2m: Add logger Add logging to a file, ./logs.txt by default. --logs option is used to override this path. Error messages are duplicated to the console. Change-Id: I97aba146b6d8866a7fa46bac80c27c0896b26cf7 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/70542 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/.gitignore | 2 +- util/intelp2m/cli/options.go | 3 ++ util/intelp2m/config/p2m/config.go | 1 + util/intelp2m/logs/logs.go | 50 ++++++++++++++++++++++++++++++ util/intelp2m/main.go | 11 +++++++ util/intelp2m/version.txt | 2 +- 6 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 util/intelp2m/logs/logs.go diff --git a/util/intelp2m/.gitignore b/util/intelp2m/.gitignore index c973792029..e4ad107438 100644 --- a/util/intelp2m/.gitignore +++ b/util/intelp2m/.gitignore @@ -1,2 +1,2 @@ intelp2m -generate/gpio.h +gpio.h diff --git a/util/intelp2m/cli/options.go b/util/intelp2m/cli/options.go index c6adbcffd8..6001039966 100644 --- a/util/intelp2m/cli/options.go +++ b/util/intelp2m/cli/options.go @@ -87,6 +87,7 @@ basic functions: -v | -version Print version -file Set path to the inteltool file. by default -out Set path to the generated file. by default + -logs Override the log file path. by default -p | -platform Set the PCH platform type. by default (enter ? to show datails) @@ -193,6 +194,8 @@ func ParseOptions() { flag.Usage = Usage flag.StringVar(&p2m.Config.InputPath, "file", "inteltool.log", "") flag.StringVar(&p2m.Config.OutputPath, "out", "generate/gpio.h", "") + flag.StringVar(&p2m.Config.LogsPath, "logs", "logs.txt", "") + help := flag.Bool("help", false, "") vers, v := flag.Bool("version", false, ""), flag.Bool("v", false, "") diff --git a/util/intelp2m/config/p2m/config.go b/util/intelp2m/config/p2m/config.go index 07efb5b7bb..6fe9a00f3f 100644 --- a/util/intelp2m/config/p2m/config.go +++ b/util/intelp2m/config/p2m/config.go @@ -52,6 +52,7 @@ type Settings struct { Field FieldType InputPath string OutputPath string + LogsPath string InputFile *os.File OutputFile *os.File IgnoredFields bool diff --git a/util/intelp2m/logs/logs.go b/util/intelp2m/logs/logs.go new file mode 100644 index 0000000000..579ac818de --- /dev/null +++ b/util/intelp2m/logs/logs.go @@ -0,0 +1,50 @@ +package logs + +import ( + "fmt" + "log" + "os" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" +) + +var ( + linfo *log.Logger + lwarning *log.Logger + lerror *log.Logger +) + +func Init() (*os.File, error) { + + flags := os.O_RDWR | os.O_CREATE | os.O_APPEND + file, err := os.OpenFile(p2m.Config.LogsPath, flags, 0666) + if err != nil { + fmt.Printf("logs: error opening %s file: %v", p2m.Config.LogsPath, err) + return nil, err + } + + attributes := log.Lshortfile + linfo = log.New(file, "INFO: ", attributes) + lwarning = log.New(file, "WARNING: ", attributes) + lerror = log.New(file, "ERROR: ", attributes) + return file, nil +} + +func Infof(format string, v ...any) { + if linfo != nil { + linfo.Output(2, fmt.Sprintf(format, v...)) + } +} + +func Warnf(format string, v ...any) { + if lwarning != nil { + lwarning.Output(2, fmt.Sprintf(format, v...)) + } +} + +func Errorf(format string, v ...any) { + if lerror != nil { + lerror.Output(2, fmt.Sprintf(format, v...)) + } + log.Output(2, fmt.Sprintf(format, v...)) +} diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go index 47a1516c98..a4b4b22941 100644 --- a/util/intelp2m/main.go +++ b/util/intelp2m/main.go @@ -7,6 +7,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/cli" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/parser" ) @@ -33,6 +34,13 @@ func main() { cli.ParseOptions() + if file, err := logs.Init(); err != nil { + fmt.Printf("logs init error: %v\n", err) + os.Exit(1) + } else { + defer file.Close() + } + if file, err := os.Open(p2m.Config.InputPath); err != nil { fmt.Printf("input file error: %v\n", err) os.Exit(1) @@ -53,6 +61,8 @@ func main() { defer file.Close() } + logs.Infof("start %s", os.Args[0]) + prs := parser.ParserData{} prs.Parse() @@ -80,5 +90,6 @@ static const struct pad_config gpio_table[] = {`, Version) #endif /* CFG_GPIO_H */ `) + logs.Infof("exit from %s\n", os.Args[0]) os.Exit(0) } diff --git a/util/intelp2m/version.txt b/util/intelp2m/version.txt index 7e32cd5698..c068b2447c 100644 --- a/util/intelp2m/version.txt +++ b/util/intelp2m/version.txt @@ -1 +1 @@ -1.3 +1.4 From 2c2e92f7f7e939668a2435c088647aa7634254b1 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Tue, 6 Dec 2022 14:29:42 +0300 Subject: [PATCH 0253/3886] util/intelp2m: Drop non-DWx register analysis support The utility can parse the value of non-DWx registers, if they are present in the inteltool dump. However, the functions that allow the inteltool utility to print the value of such registers have not been added to the master branch, and it makes no sense to support such functions in intelp2m, besides, their implementation is far from ideal. Remove this unused functionality. This will be restored in the future in a different form and after corresponding changes in inteltool. TEST: make test = PASS Change-Id: If5c77ff942a620897c085be4135cb879a0d40a00 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/56887 Reviewed-by: Angel Pons Reviewed-by: Matt DeVillier Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/parser/parser.go | 77 +------------------------ util/intelp2m/parser/template.go | 22 +------ util/intelp2m/platforms/adl/template.go | 19 ++---- util/intelp2m/platforms/apl/template.go | 12 +--- util/intelp2m/platforms/cnl/template.go | 14 +---- util/intelp2m/platforms/ebg/macro.go | 1 - util/intelp2m/platforms/ebg/template.go | 21 ++----- util/intelp2m/platforms/jsl/template.go | 17 ++---- util/intelp2m/platforms/lbg/template.go | 15 ++--- util/intelp2m/platforms/mtl/template.go | 17 ++---- util/intelp2m/platforms/snr/template.go | 18 ++---- util/intelp2m/platforms/tgl/template.go | 21 ++----- util/intelp2m/version.txt | 2 +- 13 files changed, 40 insertions(+), 216 deletions(-) diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index f2756107bf..4fd15a357d 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -4,8 +4,6 @@ import ( "bufio" "errors" "fmt" - "strconv" - "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" @@ -23,7 +21,6 @@ import ( // PlatformSpecific - platform-specific interface type PlatformSpecific interface { GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string - GroupNameExtract(line string) (bool, string) KeywordCheck(line string) bool } @@ -55,20 +52,6 @@ type ParserData struct { ownership map[string]uint32 } -// hostOwnershipGet - get the host software ownership value for the corresponding -// pad ID -// id : pad ID string -// return the host software ownership form the parser struct -func (parser *ParserData) hostOwnershipGet(id string) uint8 { - var ownership uint8 = 0 - _, group := parser.platform.GroupNameExtract(id) - numder, _ := strconv.Atoi(strings.TrimLeft(id, group)) - if (parser.ownership[group] & (1 << uint8(numder))) != 0 { - ownership = 1 - } - return ownership -} - // padInfoExtract - adds a new entry to pad info map // return error status func (parser *ParserData) padInfoExtract() int { @@ -81,7 +64,7 @@ func (parser *ParserData) padInfoExtract() int { function: function, dw0: dw0, dw1: dw1, - ownership: parser.hostOwnershipGet(id)} + ownership: 0} parser.padmap = append(parser.padmap, pad) return 0 @@ -111,65 +94,11 @@ func (parser *ParserData) PlatformSpecificInterfaceSet() { p2m.Jasper: jsl.PlatformSpecific{}, p2m.Meteor: mtl.PlatformSpecific{}, // See platforms/ebg/macro.go - p2m.Emmitsburg: ebg.PlatformSpecific{ - InheritanceTemplate: cnl.PlatformSpecific{ - InheritanceTemplate: snr.PlatformSpecific{}, - }, - }, + p2m.Emmitsburg: ebg.PlatformSpecific{}, } parser.platform = platform[p2m.Config.Platform] } -// Register - read specific platform registers (32 bits) -// line : string from file with pad config map -// nameTemplate : register name femplate to filter parsed lines -// return -// -// valid : true if the dump of the register in intertool.log is set in accordance -// with the template -// name : full register name -// offset : register offset relative to the base address -// value : register value -func (parser *ParserData) Register(nameTemplate string) ( - valid bool, - name string, - offset uint32, - value uint32, -) { - if strings.Contains(parser.line, nameTemplate) { - if registerInfoTemplate(parser.line, &name, &offset, &value) == 0 { - fmt.Printf("\n\t/* %s : 0x%x : 0x%x */\n", name, offset, value) - return true, name, offset, value - } - } - return false, "ERROR", 0, 0 -} - -// padOwnershipExtract - extract Host Software Pad Ownership from inteltool dump -// -// return true if success -func (parser *ParserData) padOwnershipExtract() bool { - var group string - status, name, offset, value := parser.Register("HOSTSW_OWN_GPP_") - if status { - _, group = parser.platform.GroupNameExtract(parser.line) - parser.ownership[group] = value - fmt.Printf("\n\t/* padOwnershipExtract: [offset 0x%x] %s = 0x%x */\n", - offset, name, parser.ownership[group]) - } - return status -} - -// padConfigurationExtract - reads GPIO configuration registers and returns true if the -// -// information from the inteltool log was successfully parsed. -func (parser *ParserData) padConfigurationExtract() bool { - if p2m.Config.Platform == p2m.Apollo { - return false - } - return parser.padOwnershipExtract() -} - // Parse pads groupe information in the inteltool log file // ConfigFile : name of inteltool log file func (parser *ParserData) Parse() { @@ -189,7 +118,7 @@ func (parser *ParserData) Parse() { isIncluded, _ := common.KeywordsCheck(parser.line, "GPIO Community", "GPIO Group") if isIncluded { parser.communityGroupExtract() - } else if !parser.padConfigurationExtract() && parser.platform.KeywordCheck(parser.line) { + } else if parser.platform.KeywordCheck(parser.line) { if parser.padInfoExtract() != 0 { fmt.Println("...error!") } diff --git a/util/intelp2m/parser/template.go b/util/intelp2m/parser/template.go index 49b938fd56..7d3e1aa819 100644 --- a/util/intelp2m/parser/template.go +++ b/util/intelp2m/parser/template.go @@ -38,8 +38,9 @@ func tokenCheck(c rune) bool { // *id : pad id string // *dw0 : DW0 register value // *dw1 : DW1 register value +// // return -// error status +// error status func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *uint32) int { var val uint64 // 0x0520: 0x0000003c44000600 GPP_B12 SLP_S0# @@ -61,22 +62,3 @@ func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *ui } return 0 } - -// registerInfoTemplate -// line : (in) string from file with pad config map -// *name : (out) register name -// *offset : (out) offset name -// *value : (out) register value -// return -// error status -func registerInfoTemplate(line string, name *string, offset *uint32, value *uint32) int { - // 0x0088: 0x00ffffff (HOSTSW_OWN_GPP_F) - // 0x0100: 0x00000000 (GPI_IS_GPP_A) - if fields := strings.FieldsFunc(line, tokenCheck); len(fields) == 3 { - *name = fields[2] - fmt.Sscanf(fields[1], "0x%x", value) - fmt.Sscanf(fields[0], "0x%x", offset) - return 0 - } - return -1 -} diff --git a/util/intelp2m/platforms/adl/template.go b/util/intelp2m/platforms/adl/template.go index 672be84070..1642670144 100644 --- a/util/intelp2m/platforms/adl/template.go +++ b/util/intelp2m/platforms/adl/template.go @@ -2,22 +2,13 @@ package adl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", - "GPP_H", "GPP_I", "GPP_J", "GPP_K", "GPP_R", "GPP_S", "GPP_T", - "GPD", "VGPIO_USB", "VGPIO_PCIE") - -} +// Group : "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", +// "GPP_H", "GPP_I", "GPP_J", "GPP_K", "GPP_R", "GPP_S", "GPP_T", +// "GPD", "VGPIO_USB", "VGPIO_PCIE" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/platforms/apl/template.go b/util/intelp2m/platforms/apl/template.go index 05d505f786..36040cab96 100644 --- a/util/intelp2m/platforms/apl/template.go +++ b/util/intelp2m/platforms/apl/template.go @@ -2,18 +2,8 @@ package apl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - // Not supported - return false, "" -} - // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. +// returns true if the keyword is contained in the line. // line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, diff --git a/util/intelp2m/platforms/cnl/template.go b/util/intelp2m/platforms/cnl/template.go index b38d9689f4..886a59a920 100644 --- a/util/intelp2m/platforms/cnl/template.go +++ b/util/intelp2m/platforms/cnl/template.go @@ -1,23 +1,13 @@ package cnl -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - type InheritanceTemplate interface { KeywordCheck(line string) bool } -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPD", "GPP_C", "GPP_E") -} +// Group: "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPD", "GPP_C", "GPP_E" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. +// returns true if the keyword is contained in the line. // line : string from the configuration file func (platform PlatformSpecific) KeywordCheck(line string) bool { return platform.InheritanceTemplate.KeywordCheck(line) diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index 9dba566907..8026a2d484 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -25,7 +25,6 @@ type InheritanceMacro interface { type PlatformSpecific struct { InheritanceMacro - InheritanceTemplate } // RemmapRstSrc - remmap Pad Reset Source Config diff --git a/util/intelp2m/platforms/ebg/template.go b/util/intelp2m/platforms/ebg/template.go index 0ec9bc31a8..32ba246ec9 100644 --- a/util/intelp2m/platforms/ebg/template.go +++ b/util/intelp2m/platforms/ebg/template.go @@ -2,25 +2,12 @@ package ebg import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -type InheritanceTemplate interface { - GroupNameExtract(line string) (bool, string) - KeywordCheck(line string) bool -} - -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (platform PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPPC_A", "GPPC_B", "GPPC_S", "GPPC_C", "GPP_D", "GPP_E", "GPPC_H", "GPP_J", - "GPP_I", "GPP_L", "GPP_M", "GPP_N") -} +// Group : "GPPC_A", "GPPC_B", "GPPC_S", "GPPC_C", "GPP_D", "GPP_E", "GPPC_H", "GPP_J", +// "GPP_I", "GPP_L", "GPP_M", "GPP_N" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (platform PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPPC_") return isIncluded diff --git a/util/intelp2m/platforms/jsl/template.go b/util/intelp2m/platforms/jsl/template.go index 203b27ebdc..ec6e9c91a9 100644 --- a/util/intelp2m/platforms/jsl/template.go +++ b/util/intelp2m/platforms/jsl/template.go @@ -2,21 +2,12 @@ package jsl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", - "GPP_H", "GPP_R", "GPP_S", "GPP_T", "GPD", "HVMOS", "VGPIO5") - -} +// Group : "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", "GPP_H", "GPP_R", +// "GPP_S", "GPP_T", "GPD", "HVMOS", "VGPIO5" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/platforms/lbg/template.go b/util/intelp2m/platforms/lbg/template.go index 74c39efadf..d76f2cdef3 100644 --- a/util/intelp2m/platforms/lbg/template.go +++ b/util/intelp2m/platforms/lbg/template.go @@ -1,22 +1,15 @@ package lbg type InheritanceTemplate interface { - GroupNameExtract(line string) (bool, string) KeywordCheck(line string) bool } -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (platform PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return platform.InheritanceTemplate.GroupNameExtract(line) -} +// Group: "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", +// "GPP_K", "GPP_G", "GPP_H", "GPP_L" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (platform PlatformSpecific) KeywordCheck(line string) bool { return platform.InheritanceTemplate.KeywordCheck(line) } diff --git a/util/intelp2m/platforms/mtl/template.go b/util/intelp2m/platforms/mtl/template.go index 76a65f3f18..3f44928909 100644 --- a/util/intelp2m/platforms/mtl/template.go +++ b/util/intelp2m/platforms/mtl/template.go @@ -2,21 +2,12 @@ package mtl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", - "GPP_B", "GPP_D", "GPD", "VGPIO_USB", "VGPIO_PCIE") - -} +// Group : "GPP_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", "GPP_B", "GPP_D", +// "GPD", "VGPIO_USB", "VGPIO_PCIE" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/platforms/snr/template.go b/util/intelp2m/platforms/snr/template.go index 2a5dfc3643..4d02743463 100644 --- a/util/intelp2m/platforms/snr/template.go +++ b/util/intelp2m/platforms/snr/template.go @@ -2,22 +2,14 @@ package snr import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", - "GPP_K", "GPP_G", "GPP_H", "GPP_L") -} +// Group: "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", +// "GPP_K", "GPP_G", "GPP_H", "GPP_L" // KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. +// returns true if the keyword is contained in the line. // line : string from the configuration file // Returns false if no word was found, or true otherwise func (PlatformSpecific) KeywordCheck(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD") - return isIncluded + included, _ := common.KeywordsCheck(line, "GPP_", "GPD") + return included } diff --git a/util/intelp2m/platforms/tgl/template.go b/util/intelp2m/platforms/tgl/template.go index 5a93aee06b..4e9a2ba069 100644 --- a/util/intelp2m/platforms/tgl/template.go +++ b/util/intelp2m/platforms/tgl/template.go @@ -2,23 +2,12 @@ package tgl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_A", "GPP_R", "GPP_B", "GPP_D", "GPP_C", "GPP_S", "GPP_G", - "GPD", "GPP_E", "GPP_F", "GPP_H", "GPP_J", "GPP_K", "GPP_I", - "VGPIO_USB", "VGPIO_PCIE") +// Group : "GPP_A", "GPP_R", "GPP_B", "GPP_D", "GPP_C", "GPP_S", "GPP_G", "GPD", "GPP_E", +// "GPP_F", "GPP_H", "GPP_J", "GPP_K", "GPP_I", "VGPIO_USB", "VGPIO_PCIE" -} - -// KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file +// KeywordCheck - This function is used to filter parsed lines of the configuration file +// and returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/version.txt b/util/intelp2m/version.txt index c068b2447c..c239c60cba 100644 --- a/util/intelp2m/version.txt +++ b/util/intelp2m/version.txt @@ -1 +1 @@ -1.4 +1.5 From e91324707ed2e94279c60d87c83a38ec884c84e4 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Thu, 8 Dec 2022 10:44:46 +0300 Subject: [PATCH 0254/3886] util/intelp2m: Rewrite parser - Split the parser code into several packages to make its testing of its functions more convenient and detailed. This also makes embedding the parser in third-party applications more flexible - there is no need to use all the functionality of the parser. - Clean up code and remove unnecessary objects to make intelp2m simpler and more readable. - Change the common macro format to be consistent with the new parser. - Rename the results directory containing gpio.h to output to avoid confusion with the generator package directory. - At the moment there is no mechanism for setting the Ownership flag. This will be added in later versions. Tests: - make test = PASS - gpio.h for Apollo Lake before and after the patch is the same Change-Id: I9a29322dd31faf9ae100165f08f207360cbf9f80 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/70543 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- util/intelp2m/Makefile | 2 +- util/intelp2m/cli/options.go | 3 +- util/intelp2m/config/p2m/config.go | 11 +- util/intelp2m/generator/generator.go | 64 +++++ util/intelp2m/generator/generator_test.go | 63 +++++ util/intelp2m/generator/header/header.go | 30 +++ util/intelp2m/generator/printer/printer.go | 35 +++ .../generator/testsuites/i0nocomments.go | 46 ++++ .../generator/testsuites/i1comments.go | 46 ++++ .../generator/testsuites/i2AutoCheck.go | 97 +++++++ .../generator/testsuites/i3Uncheck.go | 111 ++++++++ .../testsuites/i4ExcludeUnusedCbFlds.go | 127 +++++++++ util/intelp2m/main.go | 79 ++---- util/intelp2m/parser/parser.go | 245 +++++++----------- util/intelp2m/parser/parser_test.go | 88 +------ util/intelp2m/parser/template.go | 64 ----- util/intelp2m/parser/template/template.go | 48 ++++ .../parser/{ => template}/template_test.go | 22 +- util/intelp2m/parser/test/suite.go | 152 +++++++++++ .../{test => testlog}/inteltool_test.log | 0 util/intelp2m/platforms/common/macro.go | 8 +- util/intelp2m/platforms/interfaces.go | 38 +++ 22 files changed, 1014 insertions(+), 365 deletions(-) create mode 100644 util/intelp2m/generator/generator.go create mode 100644 util/intelp2m/generator/generator_test.go create mode 100644 util/intelp2m/generator/header/header.go create mode 100644 util/intelp2m/generator/printer/printer.go create mode 100644 util/intelp2m/generator/testsuites/i0nocomments.go create mode 100644 util/intelp2m/generator/testsuites/i1comments.go create mode 100644 util/intelp2m/generator/testsuites/i2AutoCheck.go create mode 100644 util/intelp2m/generator/testsuites/i3Uncheck.go create mode 100644 util/intelp2m/generator/testsuites/i4ExcludeUnusedCbFlds.go delete mode 100644 util/intelp2m/parser/template.go create mode 100644 util/intelp2m/parser/template/template.go rename util/intelp2m/parser/{ => template}/template_test.go (60%) create mode 100644 util/intelp2m/parser/test/suite.go rename util/intelp2m/parser/{test => testlog}/inteltool_test.log (100%) create mode 100644 util/intelp2m/platforms/interfaces.go diff --git a/util/intelp2m/Makefile b/util/intelp2m/Makefile index 5f6bc29261..cb1ce43c1b 100644 --- a/util/intelp2m/Makefile +++ b/util/intelp2m/Makefile @@ -5,7 +5,7 @@ THIS_FILE := $(lastword $(MAKEFILE_LIST)) THIS_DIR := $(abspath $(dir $(THIS_FILE))) SCRIPTS_DIR := $(THIS_DIR)/scripts/linux -OUTPUT_DIR := $(THIS_DIR)/generate +OUTPUT_DIR := $(THIS_DIR)/output VERSION ?= $(shell $(SCRIPTS_DIR)/version.sh) LDFLAGS = "-X main.Version=$(VERSION)" diff --git a/util/intelp2m/cli/options.go b/util/intelp2m/cli/options.go index 6001039966..1d4e5ec030 100644 --- a/util/intelp2m/cli/options.go +++ b/util/intelp2m/cli/options.go @@ -192,8 +192,9 @@ func cbOptionsInfo(_ string) error { func ParseOptions() { flag.Usage = Usage + flag.StringVar(&p2m.Config.InputPath, "file", "inteltool.log", "") - flag.StringVar(&p2m.Config.OutputPath, "out", "generate/gpio.h", "") + flag.StringVar(&p2m.Config.OutputPath, "out", "output/gpio.h", "") flag.StringVar(&p2m.Config.LogsPath, "logs", "logs.txt", "") help := flag.Bool("help", false, "") diff --git a/util/intelp2m/config/p2m/config.go b/util/intelp2m/config/p2m/config.go index 6fe9a00f3f..4271200c09 100644 --- a/util/intelp2m/config/p2m/config.go +++ b/util/intelp2m/config/p2m/config.go @@ -2,7 +2,6 @@ package p2m import ( "fmt" - "os" ) type PlatformType int @@ -53,14 +52,12 @@ type Settings struct { InputPath string OutputPath string LogsPath string - InputFile *os.File - OutputFile *os.File IgnoredFields bool AutoCheck bool GenLevel int } -var Config = Settings{ +var defaultConfig = Settings{ Version: "unknown", Platform: Sunrise, Field: NoFlds, @@ -69,6 +66,12 @@ var Config = Settings{ GenLevel: 0, } +var Config = defaultConfig + +func SettingsReset() { + Config = defaultConfig +} + func SetPlatformType(format string) error { if _, exist := platforms[format]; !exist { return fmt.Errorf("unknown platform type %s", format) diff --git a/util/intelp2m/generator/generator.go b/util/intelp2m/generator/generator.go new file mode 100644 index 0000000000..906e9458e3 --- /dev/null +++ b/util/intelp2m/generator/generator.go @@ -0,0 +1,64 @@ +package generator + +import ( + "fmt" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" + "review.coreboot.org/coreboot.git/util/intelp2m/parser" +) + +type collector []string + +func (c *collector) Line(str string) { + *c = append(*c, str) +} + +func (c *collector) Linef(format string, args ...interface{}) { + *c = append(*c, fmt.Sprintf(format, args...)) +} + +// Run() generates strings with macros +func Run(entries []parser.Entry) ([]string, error) { + if len(entries) == 0 { + err := fmt.Errorf("entries array is empty") + logs.Errorf("%v", err) + return nil, err + } + collection := make(collector, 0) + logs.Infof("run") + for _, entry := range entries { + switch entry.EType { + case parser.EntryGroup: + collection.Line("\n") + collection.Linef("\t/* %s */\n", entry.Function) + + case parser.EntryReserved: + if p2m.Config.GenLevel >= 2 { + collection.Line("\n") + } + collection.Linef("\t/* %s - %s */\n", entry.ID, entry.Function) + + case parser.EntryPad: + if p2m.Config.GenLevel >= 2 { + collection.Line("\n") + collection.Linef("\t/* %s - %s */\n", entry.ID, entry.Function) + collection.Linef("\t/* DW0: 0x%0.8x, DW1: 0x%0.8x */\n", entry.DW0, entry.DW1) + } + lines := entry.ToMacro() + if p2m.Config.GenLevel == 1 && len(lines) != 0 { + collection.Linef("\t%s\t/* %s */\n", lines[0], entry.Function) + break + } + + for i := range lines { + collection.Linef("\t%s\n", lines[i]) + } + + default: + logs.Errorf("unknown entry type: %d", int(entry.EType)) + } + } + logs.Infof("successfully completed: %d rows", len(collection)) + return collection, nil +} diff --git a/util/intelp2m/generator/generator_test.go b/util/intelp2m/generator/generator_test.go new file mode 100644 index 0000000000..56bf9d4c47 --- /dev/null +++ b/util/intelp2m/generator/generator_test.go @@ -0,0 +1,63 @@ +package generator_test + +import ( + "strings" + "testing" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/generator" + "review.coreboot.org/coreboot.git/util/intelp2m/generator/testsuites" + parsertest "review.coreboot.org/coreboot.git/util/intelp2m/parser/test" +) + +func do(t *testing.T, reference string) { + actually, err := generator.Run(parsertest.Suite) + if err != nil { + t.Errorf("failed to run generator: %v", err) + } + + expects := strings.SplitAfter(reference, "\n") + for i := range actually { + if expects[i] != actually[i] { + t.Errorf("row number %d:\n\tExpects: <%s>\n\tActually <%s>", + i, expects[i], actually[i]) + } + } +} + +func TestGenerator(t *testing.T) { + t.Run("GENERATOR/I0-NO-COMMENTS", func(t *testing.T) { + p2m.SettingsReset() + p2m.Config.AutoCheck = false + do(t, testsuites.ReferenceI0NoComments) + }) + + t.Run("GENERATOR/I1-WITH-COMMENTS", func(t *testing.T) { + p2m.SettingsReset() + p2m.Config.AutoCheck = false + p2m.Config.GenLevel = 1 + do(t, testsuites.ReferenceI1Comments) + }) + + t.Run("GENERATOR/I2-AUTO-CHECK", func(t *testing.T) { + p2m.SettingsReset() + p2m.Config.GenLevel = 2 + do(t, testsuites.ReferenceI2AutoCheck) + }) + + t.Run("GENERATOR/I3-UNCHECK", func(t *testing.T) { + p2m.SettingsReset() + p2m.Config.AutoCheck = false + p2m.Config.IgnoredFields = true + p2m.Config.GenLevel = 3 + do(t, testsuites.ReferenceI3Uncheck) + }) + + t.Run("GENERATOR/I4-EXCLUDE-UNUSED-CB-FIELDS", func(t *testing.T) { + p2m.SettingsReset() + p2m.Config.IgnoredFields = true + p2m.Config.Field = p2m.CbFlds + p2m.Config.GenLevel = 4 + do(t, testsuites.ReferenceI4ExcludeUnusedCbFlds) + }) +} diff --git a/util/intelp2m/generator/header/header.go b/util/intelp2m/generator/header/header.go new file mode 100644 index 0000000000..4383e055b6 --- /dev/null +++ b/util/intelp2m/generator/header/header.go @@ -0,0 +1,30 @@ +package header + +import ( + "fmt" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" +) + +const fileHeader string = `/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef CFG_GPIO_H +#define CFG_GPIO_H + +#include + +/* Pad configuration was generated automatically using intelp2m %s */ +static const struct pad_config gpio_table[] = {` + +const completion string = `}; + +#endif /* CFG_GPIO_H */ +` + +func Add(lines []string) []string { + wrapper := make([]string, 0) + wrapper = append(wrapper, fmt.Sprintf(fileHeader, p2m.Config.Version)) + wrapper = append(wrapper, lines...) + wrapper = append(wrapper, completion) + return wrapper +} diff --git a/util/intelp2m/generator/printer/printer.go b/util/intelp2m/generator/printer/printer.go new file mode 100644 index 0000000000..4c5856a8c1 --- /dev/null +++ b/util/intelp2m/generator/printer/printer.go @@ -0,0 +1,35 @@ +package printer + +import ( + "fmt" + "os" + "path/filepath" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" +) + +func Do(rows []string) error { + path := p2m.Config.OutputPath + if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil { + logs.Errorf("failed to create output directory: %v", err) + return err + } + + file, err := os.Create(path) + if err != nil { + logs.Errorf("failed to create output file: %v", err) + return err + } + defer file.Close() + + logs.Infof("write lines to file %s", path) + for i := range rows { + if _, err := fmt.Fprint(file, rows[i]); err != nil { + logs.Errorf("failed to write: %v", err) + return err + } + } + logs.Infof("successfully completed: %d rows", len(rows)) + return nil +} diff --git a/util/intelp2m/generator/testsuites/i0nocomments.go b/util/intelp2m/generator/testsuites/i0nocomments.go new file mode 100644 index 0000000000..7333468c24 --- /dev/null +++ b/util/intelp2m/generator/testsuites/i0nocomments.go @@ -0,0 +1,46 @@ +package testsuites + +const ReferenceI0NoComments = ` + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + PAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1), + PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1), + PAD_CFG_GPI_TRIG_OWN(GPP_A23, NONE, PLTRST, OFF, ACPI), + + /* ------- GPIO Group GPP_B ------- */ + /* GPP_C1 - RESERVED */ + PAD_CFG_GPI_TRIG_OWN(GPP_B0, NONE, PLTRST, OFF, ACPI), + PAD_CFG_NF(GPP_B23, DN_20K, PLTRST, NF2), + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_C ------- */ + PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), + PAD_CFG_GPI_TRIG_OWN(GPP_C5, NONE, PLTRST, OFF, ACPI), + /* GPP_C6 - RESERVED */ + /* GPP_C7 - RESERVED */ + PAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1), + + /* ------- GPIO Group GPP_D ------- */ + + /* ------- GPIO Group GPP_E ------- */ + PAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1), + + /* ------- GPIO Group GPP_G ------- */ + PAD_CFG_NF(GPP_G19, NONE, PLTRST, NF1), + + /* ------- GPIO Community 2 ------- */ + + /* -------- GPIO Group GPD -------- */ + PAD_CFG_NF(GPD9, NONE, PWROK, NF1), + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_I ------- */ + PAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1), + PAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1), +` diff --git a/util/intelp2m/generator/testsuites/i1comments.go b/util/intelp2m/generator/testsuites/i1comments.go new file mode 100644 index 0000000000..ca082ed120 --- /dev/null +++ b/util/intelp2m/generator/testsuites/i1comments.go @@ -0,0 +1,46 @@ +package testsuites + +const ReferenceI1Comments = ` + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + PAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1), /* RCIN# */ + PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1), /* LAD0 */ + PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1), /* LFRAME# */ + PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1), /* SUSWARN#/SUSPWRDNACK */ + PAD_CFG_GPI_TRIG_OWN(GPP_A23, NONE, PLTRST, OFF, ACPI), /* GPIO */ + + /* ------- GPIO Group GPP_B ------- */ + /* GPP_C1 - RESERVED */ + PAD_CFG_GPI_TRIG_OWN(GPP_B0, NONE, PLTRST, OFF, ACPI), /* GPIO */ + PAD_CFG_NF(GPP_B23, DN_20K, PLTRST, NF2), /* PCHHOT# */ + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_C ------- */ + PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), /* SMBCLK */ + PAD_CFG_GPI_TRIG_OWN(GPP_C5, NONE, PLTRST, OFF, ACPI), /* GPIO */ + /* GPP_C6 - RESERVED */ + /* GPP_C7 - RESERVED */ + PAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1), /* UART2_RTS# */ + + /* ------- GPIO Group GPP_D ------- */ + + /* ------- GPIO Group GPP_E ------- */ + PAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1), /* SATAXPCIE0 */ + + /* ------- GPIO Group GPP_G ------- */ + PAD_CFG_NF(GPP_G19, NONE, PLTRST, NF1), /* SMI# */ + + /* ------- GPIO Community 2 ------- */ + + /* -------- GPIO Group GPD -------- */ + PAD_CFG_NF(GPD9, NONE, PWROK, NF1), /* SLP_WLAN# */ + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_I ------- */ + PAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1), /* DDPB_HPD0 */ + PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1), /* DDPC_HPD1 */ + PAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1), /* DDPD_HPD2 */ +` diff --git a/util/intelp2m/generator/testsuites/i2AutoCheck.go b/util/intelp2m/generator/testsuites/i2AutoCheck.go new file mode 100644 index 0000000000..514cc57eef --- /dev/null +++ b/util/intelp2m/generator/testsuites/i2AutoCheck.go @@ -0,0 +1,97 @@ +package testsuites + +const ReferenceI2AutoCheck string = ` + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + + /* GPP_A0 - RCIN# */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_A0, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0), + + /* GPP_A1 - LAD0 */ + /* DW0: 0x84000402, DW1: 0x00003000 */ + _PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | (1 << 1), PAD_PULL(UP_20K)), + + /* GPP_A5 - LFRAME# */ + /* DW0: 0x84000600, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_A5, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0), + + /* GPP_A13 - SUSWARN#/SUSPWRDNACK */ + /* DW0: 0x44000600, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_A13, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0), + + /* GPP_A23 - GPIO */ + /* DW0: 0x84000102, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_A23, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0), + + /* ------- GPIO Group GPP_B ------- */ + + /* GPP_C1 - RESERVED */ + + /* GPP_B0 - GPIO */ + /* DW0: 0x84000100, DW1: 0x00000000 */ + PAD_CFG_GPI_TRIG_OWN(GPP_B0, NONE, PLTRST, OFF, ACPI), + + /* GPP_B23 - PCHHOT# */ + /* DW0: 0x84000a01, DW1: 0x00001000 */ + _PAD_CFG_STRUCT(GPP_B23, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1, PAD_PULL(DN_20K)), + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_C ------- */ + + /* GPP_C0 - SMBCLK */ + /* DW0: 0x44000502, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_C0, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0), + + /* GPP_C5 - GPIO */ + /* DW0: 0x84000100, DW1: 0x00000000 */ + PAD_CFG_GPI_TRIG_OWN(GPP_C5, NONE, PLTRST, OFF, ACPI), + + /* GPP_C6 - RESERVED */ + + /* GPP_C7 - RESERVED */ + + /* GPP_C22 - UART2_RTS# */ + /* DW0: 0x84000600, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_C22, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0), + + /* ------- GPIO Group GPP_D ------- */ + + /* ------- GPIO Group GPP_E ------- */ + + /* GPP_E0 - SATAXPCIE0 */ + /* DW0: 0x84000502, DW1: 0x00003000 */ + _PAD_CFG_STRUCT(GPP_E0, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K)), + + /* ------- GPIO Group GPP_G ------- */ + + /* GPP_G19 - SMI# */ + /* DW0: 0x84000500, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_G19, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0), + + /* ------- GPIO Community 2 ------- */ + + /* -------- GPIO Group GPD -------- */ + + /* GPD9 - SLP_WLAN# */ + /* DW0: 0x04000600, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPD9, PAD_FUNC(NF1) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0), + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_I ------- */ + + /* GPP_I0 - DDPB_HPD0 */ + /* DW0: 0x84000500, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_I0, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0), + + /* GPP_I1 - DDPC_HPD1 */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_I1, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0), + + /* GPP_I2 - DDPD_HPD2 */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + _PAD_CFG_STRUCT(GPP_I2, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0), +` diff --git a/util/intelp2m/generator/testsuites/i3Uncheck.go b/util/intelp2m/generator/testsuites/i3Uncheck.go new file mode 100644 index 0000000000..26f505eee7 --- /dev/null +++ b/util/intelp2m/generator/testsuites/i3Uncheck.go @@ -0,0 +1,111 @@ +package testsuites + +const ReferenceI3Uncheck string = ` + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + + /* GPP_A0 - RCIN# */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + PAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1), + + /* GPP_A1 - LAD0 */ + /* DW0: 0x84000402, DW1: 0x00003000 */ + /* DW0: PAD_TRIG(OFF) | (1 << 1) - IGNORED */ + PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1), + + /* GPP_A5 - LFRAME# */ + /* DW0: 0x84000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1), + + /* GPP_A13 - SUSWARN#/SUSPWRDNACK */ + /* DW0: 0x44000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1), + + /* GPP_A23 - GPIO */ + /* DW0: 0x84000102, DW1: 0x00000000 */ + /* DW0: (1 << 1) - IGNORED */ + PAD_CFG_GPI_TRIG_OWN(GPP_A23, NONE, PLTRST, OFF, ACPI), + + /* ------- GPIO Group GPP_B ------- */ + + /* GPP_C1 - RESERVED */ + + /* GPP_B0 - GPIO */ + /* DW0: 0x84000100, DW1: 0x00000000 */ + PAD_CFG_GPI_TRIG_OWN(GPP_B0, NONE, PLTRST, OFF, ACPI), + + /* GPP_B23 - PCHHOT# */ + /* DW0: 0x84000a01, DW1: 0x00001000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */ + PAD_CFG_NF(GPP_B23, DN_20K, PLTRST, NF2), + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_C ------- */ + + /* GPP_C0 - SMBCLK */ + /* DW0: 0x44000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), + + /* GPP_C5 - GPIO */ + /* DW0: 0x84000100, DW1: 0x00000000 */ + PAD_CFG_GPI_TRIG_OWN(GPP_C5, NONE, PLTRST, OFF, ACPI), + + /* GPP_C6 - RESERVED */ + + /* GPP_C7 - RESERVED */ + + /* GPP_C22 - UART2_RTS# */ + /* DW0: 0x84000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + PAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1), + + /* ------- GPIO Group GPP_D ------- */ + + /* ------- GPIO Group GPP_E ------- */ + + /* GPP_E0 - SATAXPCIE0 */ + /* DW0: 0x84000502, DW1: 0x00003000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + PAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1), + + /* ------- GPIO Group GPP_G ------- */ + + /* GPP_G19 - SMI# */ + /* DW0: 0x84000500, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) - IGNORED */ + PAD_CFG_NF(GPP_G19, NONE, PLTRST, NF1), + + /* ------- GPIO Community 2 ------- */ + + /* -------- GPIO Group GPD -------- */ + + /* GPD9 - SLP_WLAN# */ + /* DW0: 0x04000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + PAD_CFG_NF(GPD9, NONE, PWROK, NF1), + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_I ------- */ + + /* GPP_I0 - DDPB_HPD0 */ + /* DW0: 0x84000500, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) - IGNORED */ + PAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1), + + /* GPP_I1 - DDPC_HPD1 */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1), + + /* GPP_I2 - DDPD_HPD2 */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + PAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1), +` diff --git a/util/intelp2m/generator/testsuites/i4ExcludeUnusedCbFlds.go b/util/intelp2m/generator/testsuites/i4ExcludeUnusedCbFlds.go new file mode 100644 index 0000000000..46f09995fc --- /dev/null +++ b/util/intelp2m/generator/testsuites/i4ExcludeUnusedCbFlds.go @@ -0,0 +1,127 @@ +package testsuites + +const ReferenceI4ExcludeUnusedCbFlds string = ` + /* ------- GPIO Community 0 ------- */ + + /* ------- GPIO Group GPP_A ------- */ + + /* GPP_A0 - RCIN# */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_A0, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), + + /* GPP_A1 - LAD0 */ + /* DW0: 0x84000402, DW1: 0x00003000 */ + /* DW0: PAD_TRIG(OFF) | (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF1) | PAD_RESET(PLTRST), PAD_PULL(UP_20K)), + + /* GPP_A5 - LFRAME# */ + /* DW0: 0x84000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + /* PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_A5, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), + + /* GPP_A13 - SUSWARN#/SUSPWRDNACK */ + /* DW0: 0x44000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + /* PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1), */ + _PAD_CFG_STRUCT(GPP_A13, PAD_FUNC(NF1) | PAD_RESET(DEEP), 0), + + /* GPP_A23 - GPIO */ + /* DW0: 0x84000102, DW1: 0x00000000 */ + /* DW0: (1 << 1) - IGNORED */ + /* PAD_CFG_GPI_TRIG_OWN(GPP_A23, NONE, PLTRST, OFF, ACPI), */ + _PAD_CFG_STRUCT(GPP_A23, PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0), + + /* ------- GPIO Group GPP_B ------- */ + + /* GPP_C1 - RESERVED */ + + /* GPP_B0 - GPIO */ + /* DW0: 0x84000100, DW1: 0x00000000 */ + /* PAD_CFG_GPI_TRIG_OWN(GPP_B0, NONE, PLTRST, OFF, ACPI), */ + _PAD_CFG_STRUCT(GPP_B0, PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0), + + /* GPP_B23 - PCHHOT# */ + /* DW0: 0x84000a01, DW1: 0x00001000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */ + /* PAD_CFG_NF(GPP_B23, DN_20K, PLTRST, NF2), */ + _PAD_CFG_STRUCT(GPP_B23, PAD_FUNC(NF2) | PAD_RESET(PLTRST), PAD_PULL(DN_20K)), + + /* ------- GPIO Community 1 ------- */ + + /* ------- GPIO Group GPP_C ------- */ + + /* GPP_C0 - SMBCLK */ + /* DW0: 0x44000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), */ + _PAD_CFG_STRUCT(GPP_C0, PAD_FUNC(NF1) | PAD_RESET(DEEP), 0), + + /* GPP_C5 - GPIO */ + /* DW0: 0x84000100, DW1: 0x00000000 */ + /* PAD_CFG_GPI_TRIG_OWN(GPP_C5, NONE, PLTRST, OFF, ACPI), */ + _PAD_CFG_STRUCT(GPP_C5, PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0), + + /* GPP_C6 - RESERVED */ + + /* GPP_C7 - RESERVED */ + + /* GPP_C22 - UART2_RTS# */ + /* DW0: 0x84000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + /* PAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_C22, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), + + /* ------- GPIO Group GPP_D ------- */ + + /* ------- GPIO Group GPP_E ------- */ + + /* GPP_E0 - SATAXPCIE0 */ + /* DW0: 0x84000502, DW1: 0x00003000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_E0, PAD_FUNC(NF1) | PAD_RESET(PLTRST), PAD_PULL(UP_20K)), + + /* ------- GPIO Group GPP_G ------- */ + + /* GPP_G19 - SMI# */ + /* DW0: 0x84000500, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) - IGNORED */ + /* PAD_CFG_NF(GPP_G19, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_G19, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), + + /* ------- GPIO Community 2 ------- */ + + /* -------- GPIO Group GPD -------- */ + + /* GPD9 - SLP_WLAN# */ + /* DW0: 0x04000600, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) - IGNORED */ + /* PAD_CFG_NF(GPD9, NONE, PWROK, NF1), */ + _PAD_CFG_STRUCT(GPD9, PAD_FUNC(NF1), 0), + + /* ------- GPIO Community 3 ------- */ + + /* ------- GPIO Group GPP_I ------- */ + + /* GPP_I0 - DDPB_HPD0 */ + /* DW0: 0x84000500, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) - IGNORED */ + /* PAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_I0, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), + + /* GPP_I1 - DDPC_HPD1 */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_I1, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), + + /* GPP_I2 - DDPD_HPD2 */ + /* DW0: 0x84000502, DW1: 0x00000000 */ + /* DW0: PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) - IGNORED */ + /* PAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1), */ + _PAD_CFG_STRUCT(GPP_I2, PAD_FUNC(NF1) | PAD_RESET(PLTRST), 0), +` diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go index a4b4b22941..84227a7b8d 100644 --- a/util/intelp2m/main.go +++ b/util/intelp2m/main.go @@ -3,28 +3,17 @@ package main import ( "fmt" "os" - "path/filepath" + "time" "review.coreboot.org/coreboot.git/util/intelp2m/cli" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/generator" + "review.coreboot.org/coreboot.git/util/intelp2m/generator/header" + "review.coreboot.org/coreboot.git/util/intelp2m/generator/printer" "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/parser" ) -type Printer struct{} - -func (Printer) Linef(lvl int, format string, args ...interface{}) { - if p2m.Config.GenLevel >= lvl { - fmt.Fprintf(p2m.Config.OutputFile, format, args...) - } -} - -func (Printer) Line(lvl int, str string) { - if p2m.Config.GenLevel >= lvl { - fmt.Fprint(p2m.Config.OutputFile, str) - } -} - // Version is injected into main during project build var Version string = "Unknown" @@ -41,55 +30,29 @@ func main() { defer file.Close() } - if file, err := os.Open(p2m.Config.InputPath); err != nil { - fmt.Printf("input file error: %v\n", err) - os.Exit(1) - } else { - p2m.Config.InputFile = file - defer file.Close() - } + year, month, day := time.Now().Date() + hour, min, sec := time.Now().Clock() + logs.Infof("%d-%d-%d %d:%d:%d", year, month, day, hour, min, sec) + logs.Infof("============ start ============") - if err := os.MkdirAll(filepath.Dir(p2m.Config.OutputPath), os.ModePerm); err != nil { - fmt.Printf("failed to create output directory: %v\n", err) + entries, err := parser.Run() + if err != nil { + fmt.Print("failed to run parser") os.Exit(1) } - if file, err := os.Create(p2m.Config.OutputPath); err != nil { - fmt.Printf("failed to create output file: %v\n", err) - os.Exit(1) - } else { - p2m.Config.OutputFile = file - defer file.Close() - } - logs.Infof("start %s", os.Args[0]) - - prs := parser.ParserData{} - prs.Parse() - - generator := parser.Generator{ - PrinterIf: Printer{}, - Data: &prs, - } - header := fmt.Sprintf(`/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef CFG_GPIO_H -#define CFG_GPIO_H - -#include - -/* Pad configuration was generated automatically using intelp2m %s */ -static const struct pad_config gpio_table[] = {`, Version) - p2m.Config.OutputFile.WriteString(header + "\n") - // Add the pads map - - if err := generator.Run(); err != nil { - fmt.Printf("Error: %v", err) + lines, err := generator.Run(entries) + if err != nil { + fmt.Print("failed to run generator") os.Exit(1) } - p2m.Config.OutputFile.WriteString(`}; + lines = header.Add(lines) -#endif /* CFG_GPIO_H */ -`) - logs.Infof("exit from %s\n", os.Args[0]) + if err := printer.Do(lines); err != nil { + fmt.Print("printer error") + os.Exit(1) + } + + logs.Infof("========== completed ==========") os.Exit(0) } diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index 4fd15a357d..b410912128 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -2,172 +2,127 @@ package parser import ( "bufio" - "errors" "fmt" + "os" + "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" + "review.coreboot.org/coreboot.git/util/intelp2m/parser/template" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/ebg" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/jsl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/lbg" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/mtl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/tgl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) -// PlatformSpecific - platform-specific interface -type PlatformSpecific interface { - GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string - KeywordCheck(line string) bool +type EntryType int + +const ( + EntryEmpty EntryType = iota + EntryPad + EntryGroup + EntryReserved +) + +// Parser entry +// ID : pad id string +// Function : the string that means the pad function +// DW0 : DW0 register struct +// DW1 : DW1 register struct +// 0wnership : host software ownership +type Entry struct { + EType EntryType + ID string + Function string + DW0 uint32 + DW1 uint32 + Ownership uint8 } -// padInfo - information about pad -// id : pad id string -// offset : the offset of the register address relative to the base -// function : the string that means the pad function -// dw0 : DW0 register value -// dw1 : DW1 register value -// ownership : host software ownership -type padInfo struct { - id string - offset uint16 - function string - dw0 uint32 - dw1 uint32 - ownership uint8 +func (e *Entry) ToMacro() []string { + platform := platforms.GetSpecificInterface() + line := platform.GenMacro(e.ID, e.DW0, e.DW1, e.Ownership) + slices := strings.Split(line, "\n") + return slices } -// ParserData - global data -// line : string from the configuration file -// padmap : pad info map -// RawFmt : flag for generating pads config file with DW0/1 reg raw values -// Template : structure template type of ConfigFile -type ParserData struct { - platform PlatformSpecific - line string - padmap []padInfo - ownership map[string]uint32 -} - -// padInfoExtract - adds a new entry to pad info map -// return error status -func (parser *ParserData) padInfoExtract() int { - var function, id string - var dw0, dw1 uint32 - if rc := UseTemplate(parser.line, &function, &id, &dw0, &dw1); rc != 0 { - return rc +// extractPad() extracts pad information from a string +func extractPad(line string) (Entry, error) { + function, id, dw0, dw1, err := template.Apply(line) + if err != nil { + logs.Errorf("%v", err) + return Entry{EType: EntryEmpty}, err } - pad := padInfo{id: id, - function: function, - dw0: dw0, - dw1: dw1, - ownership: 0} - parser.padmap = append(parser.padmap, pad) - return 0 -} - -// communityGroupExtract -func (parser *ParserData) communityGroupExtract() { - pad := padInfo{function: parser.line} - parser.padmap = append(parser.padmap, pad) -} - -// PlatformSpecificInterfaceSet - specific interface for the platform selected -// in the configuration -func (parser *ParserData) PlatformSpecificInterfaceSet() { - platform := map[p2m.PlatformType]PlatformSpecific{ - p2m.Sunrise: snr.PlatformSpecific{}, - // See platforms/lbg/macro.go - p2m.Lewisburg: lbg.PlatformSpecific{ - InheritanceTemplate: snr.PlatformSpecific{}, - }, - p2m.Apollo: apl.PlatformSpecific{}, - p2m.Cannon: cnl.PlatformSpecific{ - InheritanceTemplate: snr.PlatformSpecific{}, - }, - p2m.Tiger: tgl.PlatformSpecific{}, - p2m.Alder: adl.PlatformSpecific{}, - p2m.Jasper: jsl.PlatformSpecific{}, - p2m.Meteor: mtl.PlatformSpecific{}, - // See platforms/ebg/macro.go - p2m.Emmitsburg: ebg.PlatformSpecific{}, + pad := Entry{ + EType: EntryPad, + Function: function, + ID: id, + DW0: dw0, + DW1: dw1, + Ownership: 0, } - parser.platform = platform[p2m.Config.Platform] + + if dw0 == bits.All32 { + pad.EType = EntryReserved + } + + return pad, nil } -// Parse pads groupe information in the inteltool log file -// ConfigFile : name of inteltool log file -func (parser *ParserData) Parse() { - // Read all lines from inteltool log file - fmt.Println("Parse IntelTool Log File...") +// extractGroup() extracts information about the pad group from the string +func extractGroup(line string) Entry { + group := Entry{ + EType: EntryGroup, + Function: line, + } + return group +} - // determine the platform type and set the interface for it - parser.PlatformSpecificInterfaceSet() +// Extract() extracts pad information from a string +func Extract(line string, platform platforms.SpecificIf) Entry { + if included, _ := common.KeywordsCheck(line, "GPIO Community", "GPIO Group"); included { + return extractGroup(line) + } - // map of thepad ownership registers for the GPIO controller - parser.ownership = make(map[string]uint32) + if platform.KeywordCheck(line) { + pad, err := extractPad(line) + if err != nil { + logs.Errorf("extract pad info from %s: %v", line, err) + return Entry{EType: EntryEmpty} + } + return pad + } + logs.Infof("skip line <%s>", line) + return Entry{EType: EntryEmpty} +} - file := p2m.Config.InputFile +// Run() starts the file parsing process +func Run() ([]Entry, error) { + entries := make([]Entry, 0) + + platform := platforms.GetSpecificInterface() + if platform == nil { + return nil, fmt.Errorf("unknown platform") + } + + file, err := os.Open(p2m.Config.InputPath) + if err != nil { + err = fmt.Errorf("input file error: %v", err) + logs.Errorf("%v", err) + return nil, err + } + defer file.Close() + + logs.Infof("parse %s file", p2m.Config.InputPath) scanner := bufio.NewScanner(file) for scanner.Scan() { - parser.line = scanner.Text() - isIncluded, _ := common.KeywordsCheck(parser.line, "GPIO Community", "GPIO Group") - if isIncluded { - parser.communityGroupExtract() - } else if parser.platform.KeywordCheck(parser.line) { - if parser.padInfoExtract() != 0 { - fmt.Println("...error!") - } + line := scanner.Text() + entry := Extract(line, platform) + if entry.EType != EntryEmpty { + entries = append(entries, entry) } } - fmt.Println("...done!") -} -type PrinterIf interface { - Linef(lvl int, format string, args ...interface{}) - Line(lvl int, str string) -} - -type Generator struct { - Data *ParserData // information from the parser - PrinterIf // interface for printing -} - -// Run - generate a new gpio file based on the information from the parser -func (g Generator) Run() error { - if g.PrinterIf == nil && g.Data == nil { - return errors.New("Generator: Incorrect initialization") - } - for _, pad := range g.Data.padmap { - switch pad.dw0 { - case 0x00000000: - // titleFprint - print GPIO group title to file - // /* ------- GPIO Group GPP_L ------- */ - g.Linef(0, "\n\t/* %s */\n", pad.function) - case 0xffffffff: - // reservedFprint - print reserved GPIO to file as comment - // /* GPP_H17 - RESERVED */ - g.Line(2, "\n") - // small comment about reserved port - g.Linef(0, "\t/* %s - %s */\n", pad.id, pad.function) - default: - // padInfoMacroFprint - print information about current pad to file using - // special macros: - // PAD_CFG_NF(GPP_F1, 20K_PU, PLTRST, NF1), /* SATAXPCIE4 */ - platform := g.Data.platform - macro := platform.GenMacro(pad.id, pad.dw0, pad.dw1, pad.ownership) - g.Linef(2, "\n\t/* %s - %s */\n\t/* DW0: 0x%0.8x, DW1: 0x%0.8x */\n", - pad.id, pad.function, pad.dw0, pad.dw1) - g.Linef(0, "\t%s", macro) - if p2m.Config.GenLevel == 1 { - g.Linef(1, "\t/* %s */", pad.function) - } - g.Line(0, "\n") - } - } - return nil + logs.Infof("successfully completed: %d entries", len(entries)) + return entries, nil } diff --git a/util/intelp2m/parser/parser_test.go b/util/intelp2m/parser/parser_test.go index 5e59ade566..a628c673ea 100644 --- a/util/intelp2m/parser/parser_test.go +++ b/util/intelp2m/parser/parser_test.go @@ -1,102 +1,32 @@ package parser_test import ( - "fmt" - "os" "testing" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/parser" + "review.coreboot.org/coreboot.git/util/intelp2m/parser/test" ) -const testLogFilePath = "test/inteltool_test.log" - -type Printer struct { - lines []string -} - -func (p *Printer) Linef(lvl int, format string, args ...interface{}) { - if p2m.Config.GenLevel >= lvl { - p.lines = append(p.lines, fmt.Sprintf(format, args...)) - } -} - -func (p *Printer) Line(lvl int, str string) { - if p2m.Config.GenLevel >= lvl { - p.lines = append(p.lines, str) - } -} +const TestLogFilePath = "./testlog/inteltool_test.log" func TestParser(t *testing.T) { t.Run("PARSER/PARSE-INTELTOOL-FILE", func(t *testing.T) { - var err error - reference := []string{ - "\n\t/* ------- GPIO Community 0 ------- */\n", - "\n\t/* ------- GPIO Group GPP_A ------- */\n", - "\tPAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1),", "\t/* RCIN# */", "\n", - "\tPAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1),", "\t/* LAD0 */", "\n", - "\tPAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1),", "\t/* LFRAME# */", "\n", - "\tPAD_CFG_NF(GPP_A13, NONE, DEEP, NF1),", "\t/* SUSWARN#/SUSPWRDNACK */", "\n", - "\tPAD_CFG_GPI_TRIG_OWN(GPP_A23, NONE, PLTRST, OFF, ACPI),", "\t/* GPIO */", "\n", - "\n\t/* ------- GPIO Group GPP_B ------- */\n", - "\t/* GPP_C1 - RESERVED */\n", - "\tPAD_CFG_GPI_TRIG_OWN(GPP_B0, NONE, PLTRST, OFF, ACPI),", "\t/* GPIO */", "\n", - "\tPAD_CFG_NF(GPP_B23, DN_20K, PLTRST, NF2),", "\t/* PCHHOT# */", "\n", - "\n\t/* ------- GPIO Community 1 ------- */\n", - "\n\t/* ------- GPIO Group GPP_C ------- */\n", - "\tPAD_CFG_NF(GPP_C0, NONE, DEEP, NF1),", "\t/* SMBCLK */", "\n", - "\tPAD_CFG_GPI_TRIG_OWN(GPP_C5, NONE, PLTRST, OFF, ACPI),", "\t/* GPIO */", "\n", - "\t/* GPP_C6 - RESERVED */\n", - "\t/* GPP_C7 - RESERVED */\n", - "\tPAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1),", "\t/* UART2_RTS# */", "\n", - "\n\t/* ------- GPIO Group GPP_D ------- */\n", - "\n\t/* ------- GPIO Group GPP_E ------- */\n", - "\tPAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1),", "\t/* SATAXPCIE0 */", "\n", - "\n\t/* ------- GPIO Group GPP_G ------- */\n", - "\tPAD_CFG_NF(GPP_G19, NONE, PLTRST, NF1),", "\t/* SMI# */", "\n", - "\n\t/* ------- GPIO Community 2 ------- */\n", - "\n\t/* -------- GPIO Group GPD -------- */\n", - "\tPAD_CFG_NF(GPD9, NONE, PWROK, NF1),", "\t/* SLP_WLAN# */", "\n", - "\n\t/* ------- GPIO Community 3 ------- */\n", - "\n\t/* ------- GPIO Group GPP_I ------- */\n", - "\tPAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1),", "\t/* DDPB_HPD0 */", "\n", - "\tPAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1),", "\t/* DDPC_HPD1 */", "\n", - "\tPAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1),", "\t/* DDPD_HPD2 */", "\n", - } - if p2m.Config.InputFile, err = os.Open(testLogFilePath); err != nil { - t.Errorf("Something is wrong with the test file - %s!\n", testLogFilePath) - os.Exit(1) - } - defer p2m.Config.InputFile.Close() p2m.Config.AutoCheck = false p2m.Config.Field = p2m.NoFlds p2m.Config.GenLevel = 1 + p2m.Config.InputPath = TestLogFilePath - prs := parser.ParserData{} - prs.Parse() - - printer := Printer{lines: make([]string, 0)} - generator := parser.Generator{ - PrinterIf: &printer, - Data: &prs, + entries, err := parser.Run() + if err != nil { + t.Errorf("failed to run parser: %v", err) } - if err := generator.Run(); err != nil { - t.Errorf("Generator: %v", err) - os.Exit(1) - } - - if len(printer.lines) == len(reference) { - for i := range printer.lines { - if printer.lines[i] != reference[i] { - t.Errorf("\nExpects: '%s'\nActually: '%s'\n\n", reference[i], printer.lines[i]) - return - } + for i := range test.Suite { + if entries[i] != test.Suite[i] { + t.Errorf("\nExpects: '%v'\nActually: '%v'\n\n", test.Suite[i], entries[i]) } - } else { - t.Errorf("%d does not match the reference slice len - %d!", - len(reference), len(printer.lines)) } }) } diff --git a/util/intelp2m/parser/template.go b/util/intelp2m/parser/template.go deleted file mode 100644 index 7d3e1aa819..0000000000 --- a/util/intelp2m/parser/template.go +++ /dev/null @@ -1,64 +0,0 @@ -package parser - -import ( - "fmt" - "strings" - "unicode" -) - -const IntSelMask uint32 = 0xffffff00 - -type template func(string, *string, *string, *uint32, *uint32) int - -// extractPadFuncFromComment -// line : string from file with pad config map -// return : pad function string -func extractPadFuncFromComment(line string) string { - if !strings.Contains(line, "/*") && !strings.Contains(line, "*/") { - return "" - } - - fields := strings.Fields(line) - for i, field := range fields { - if field == "/*" && len(fields) >= i+2 { - return fields[i+1] - } - } - return "" -} - -// tokenCheck -func tokenCheck(c rune) bool { - return c != '_' && c != '#' && !unicode.IsLetter(c) && !unicode.IsNumber(c) -} - -// UseTemplate -// line : string from file with pad config map -// *function : the string that means the pad function -// *id : pad id string -// *dw0 : DW0 register value -// *dw1 : DW1 register value -// -// return -// error status -func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *uint32) int { - var val uint64 - // 0x0520: 0x0000003c44000600 GPP_B12 SLP_S0# - // 0x0438: 0xffffffffffffffff GPP_C7 RESERVED - if fields := strings.FieldsFunc(line, tokenCheck); len(fields) >= 4 { - fmt.Sscanf(fields[1], "0x%x", &val) - *dw0 = uint32(val & 0xffffffff) - *dw1 = uint32(val >> 32) - *id = fields[2] - *function = fields[3] - // Sometimes the configuration file contains compound functions such as - // SUSWARN#/SUSPWRDNACK. Since the template does not take this into account, - // need to collect all parts of the pad function back into a single word - for i := 4; i < len(fields); i++ { - *function += "/" + fields[i] - } - // clear RO Interrupt Select (INTSEL) - *dw1 &= IntSelMask - } - return 0 -} diff --git a/util/intelp2m/parser/template/template.go b/util/intelp2m/parser/template/template.go new file mode 100644 index 0000000000..95dfa4272d --- /dev/null +++ b/util/intelp2m/parser/template/template.go @@ -0,0 +1,48 @@ +package template + +import ( + "fmt" + "strings" + "unicode" + + "review.coreboot.org/coreboot.git/util/intelp2m/logs" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" +) + +func token(c rune) bool { + return c != '_' && c != '#' && !unicode.IsLetter(c) && !unicode.IsNumber(c) +} + +// Apply +// line : string from file with pad config map +// return +// function : the string that means the pad function +// id : pad id string +// dw0 : DW0 register value +// dw1 : DW1 register value +// err : error +func Apply(line string) (function string, id string, dw0 uint32, dw1 uint32, err error) { + // 0x0520: 0x0000003c44000600 GPP_B12 SLP_S0# + // 0x0438: 0xffffffffffffffff GPP_C7 RESERVED + slices := strings.FieldsFunc(line, token) + number := len(slices) + if number >= 4 { + var val uint64 + fmt.Sscanf(slices[1], "0x%x", &val) + dw0 = uint32(val & 0xffffffff) + dw1 = uint32(val >> 32) + id = slices[2] + function = slices[3] + // Sometimes the configuration file contains compound functions such as + // SUSWARN#/SUSPWRDNACK. Since the template does not take this into account, + // need to collect all parts of the pad function back into a single word + for i := 4; i < len(slices); i++ { + function += "/" + slices[i] + } + // clear RO Interrupt Select (INTSEL) + dw1 &^= bits.DW1[bits.DW1InterruptSelect] + return function, id, dw0, dw1, nil + } + logs.Errorf("template: more than %d elements are needed", number) + return "", "", 0, 0, fmt.Errorf("template error") +} diff --git a/util/intelp2m/parser/template_test.go b/util/intelp2m/parser/template/template_test.go similarity index 60% rename from util/intelp2m/parser/template_test.go rename to util/intelp2m/parser/template/template_test.go index 9abdd72f83..76fe98ab09 100644 --- a/util/intelp2m/parser/template_test.go +++ b/util/intelp2m/parser/template/template_test.go @@ -1,26 +1,30 @@ -package parser_test +package template_test import ( "fmt" "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/parser" + "review.coreboot.org/coreboot.git/util/intelp2m/parser/template" ) func TestTemp(t *testing.T) { t.Run("TEMPLATE/INTELTOOL-LINE", func(t *testing.T) { const ( - ref_fn string = "SLP_S0#" - ref_id string = "GPP_B12" - ref_dw0 uint32 = 0x44000600 - ref_dw1 uint32 = 0x0000003c + IntSelMask uint32 = 0xffffff00 + ref_fn string = "SLP_S0#" + ref_id string = "GPP_B12" + ref_dw0 uint32 = 0x44000600 + ref_dw1 uint32 = 0x0000003c ) var ( fn, id string dw0, dw1 uint32 ) line := fmt.Sprintf("0x0520: 0x%08x%08x %s %s", ref_dw1, ref_dw0, ref_id, ref_fn) - _ = parser.UseTemplate(line, &fn, &id, &dw0, &dw1) + fn, id, dw0, dw1, err := template.Apply(line) + if err != nil { + t.Errorf("template application failure: %d", err) + } if fn != ref_fn { t.Errorf("function from '%s':\nExpects: '%s'\nActually: '%s'\n\n", line, ref_fn, fn) @@ -30,9 +34,9 @@ func TestTemp(t *testing.T) { } else if dw0 != ref_dw0 { t.Errorf("dw0 from '%s':\nExpects: '0x%08x'\nActually: '0x%08x'\n\n", line, ref_dw0, dw0) - } else if dw1 != (ref_dw1 & parser.IntSelMask) { + } else if dw1 != (ref_dw1 & IntSelMask) { t.Errorf("dw1 from '%s':\nExpects: '0x%08x'\nActually: '0x%08x'\n\n", - line, (ref_dw1 & parser.IntSelMask), dw1) + line, (ref_dw1 & IntSelMask), dw1) } }) } diff --git a/util/intelp2m/parser/test/suite.go b/util/intelp2m/parser/test/suite.go new file mode 100644 index 0000000000..1a96b4fa41 --- /dev/null +++ b/util/intelp2m/parser/test/suite.go @@ -0,0 +1,152 @@ +package test + +import ( + "review.coreboot.org/coreboot.git/util/intelp2m/parser" +) + +var Suite = []parser.Entry{ + // {2 ------- GPIO Community 0 ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Community 0 -------"}, + // {2 ------- GPIO Group GPP_A ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_A -------"}, + { // {1 GPP_A0 RCIN# 84000502 00000000 0} + EType: parser.EntryPad, + Function: "RCIN#", + ID: "GPP_A0", + DW0: 0x84000502, + }, + { // {1 GPP_A1 LAD0 84000402 00003000 0} + EType: parser.EntryPad, + Function: "LAD0", + ID: "GPP_A1", + DW0: 0x84000402, + DW1: 0x00003000, + }, + { // {1 GPP_A5 LFRAME# 84000600 00000000 0} + EType: parser.EntryPad, + Function: "LFRAME#", + ID: "GPP_A5", + DW0: 0x84000600, + }, + { // {1 GPP_A13 SUSWARN#/SUSPWRDNACK 44000600 00000000 0} + EType: parser.EntryPad, + Function: "SUSWARN#/SUSPWRDNACK", + ID: "GPP_A13", + DW0: 0x44000600, + }, + { // {1 GPP_A23 GPIO 84000102 00000000 0} + EType: parser.EntryPad, + Function: "GPIO", + ID: "GPP_A23", + DW0: 0x84000102, + }, + // {2 ------- GPIO Group GPP_B ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_B -------"}, + { // {3 GPP_C1 RESERVED ffffffff ffffff00 0} + EType: parser.EntryReserved, + Function: "RESERVED", + ID: "GPP_C1", + DW0: 0xffffffff, + DW1: 0xffffff00, + }, + { // {1 GPP_B0 GPIO 84000100 00000000 0} + EType: parser.EntryPad, + Function: "GPIO", + ID: "GPP_B0", + DW0: 0x84000100, + }, + { // {1 GPP_B23 PCHHOT# 84000a01 00001000 0} + EType: parser.EntryPad, + Function: "PCHHOT#", + ID: "GPP_B23", + DW0: 0x84000a01, + DW1: 0x00001000, + }, + // {2 ------- GPIO Community 1 ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Community 1 -------"}, + // {2 ------- GPIO Group GPP_C ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_C -------"}, + { // {1 GPP_C0 SMBCLK 44000502 00000000 0} + EType: parser.EntryPad, + Function: "SMBCLK", + ID: "GPP_C0", + DW0: 0x44000502, + }, + { // {1 GPP_C5 GPIO 84000100 00000000 0} + EType: parser.EntryPad, + Function: "GPIO", + ID: "GPP_C5", + DW0: 0x84000100, + }, + { // {3 GPP_C6 RESERVED ffffffff ffffff00 0} + EType: parser.EntryReserved, + Function: "RESERVED", + ID: "GPP_C6", + DW0: 0xffffffff, + DW1: 0xffffff00, + }, + { // {3 GPP_C7 RESERVED ffffffff ffffff00 0} + EType: parser.EntryReserved, + Function: "RESERVED", + ID: "GPP_C7", + DW0: 0xffffffff, + DW1: 0xffffff00, + }, + { // {1 GPP_C22 UART2_RTS# 84000600 00000000 0} + EType: parser.EntryPad, + Function: "UART2_RTS#", + ID: "GPP_C22", + DW0: 0x84000600, + }, + // {2 ------- GPIO Group GPP_D ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_D -------"}, + // {2 ------- GPIO Group GPP_E ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_E -------"}, + { // {1 GPP_E0 SATAXPCIE0 84000502 00003000 0} + EType: parser.EntryPad, + Function: "SATAXPCIE0", + ID: "GPP_E0", + DW0: 0x84000502, + DW1: 0x00003000, + }, + // {2 ------- GPIO Group GPP_G ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_G -------"}, + { // {1 GPP_G19 SMI# 84000500 00000000 0} + EType: parser.EntryPad, + Function: "SMI#", + ID: "GPP_G19", + DW0: 0x84000500, + }, + // {2 ------- GPIO Community 2 ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Community 2 -------"}, + // {2 -------- GPIO Group GPD -------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "-------- GPIO Group GPD --------"}, + { // {1 GPD9 SLP_WLAN# 04000600 00000000 0} + EType: parser.EntryPad, + Function: "SLP_WLAN#", + ID: "GPD9", + DW0: 0x04000600, + }, + // {2 ------- GPIO Community 3 ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Community 3 -------"}, + // {2 ------- GPIO Group GPP_I ------- 00000000 00000000 0} + {EType: parser.EntryGroup, Function: "------- GPIO Group GPP_I -------"}, + { // {1 GPP_I0 DDPB_HPD0 84000500 00000000 0} + EType: parser.EntryPad, + Function: "DDPB_HPD0", + ID: "GPP_I0", + DW0: 0x84000500, + }, + { // {1 GPP_I1 DDPC_HPD1 84000502 00000000 0} + EType: parser.EntryPad, + Function: "DDPC_HPD1", + ID: "GPP_I1", + DW0: 0x84000502, + }, + { // {1 GPP_I2 DDPD_HPD2 84000502 00000000 0} + EType: parser.EntryPad, + Function: "DDPD_HPD2", + ID: "GPP_I2", + DW0: 0x84000502, + }, +} diff --git a/util/intelp2m/parser/test/inteltool_test.log b/util/intelp2m/parser/testlog/inteltool_test.log similarity index 100% rename from util/intelp2m/parser/test/inteltool_test.log rename to util/intelp2m/parser/testlog/inteltool_test.log diff --git a/util/intelp2m/platforms/common/macro.go b/util/intelp2m/platforms/common/macro.go index 782a61e5b7..56b147cee2 100644 --- a/util/intelp2m/platforms/common/macro.go +++ b/util/intelp2m/platforms/common/macro.go @@ -289,7 +289,7 @@ func (macro *Macro) DecodeIgnoredFieldsDW0() *Macro { dw0.Value = ignored macro.Add("/* DW0: ") macro.Fields.DecodeDW0() - macro.Add(" - IGNORED */\n\t") + macro.Add(" - IGNORED */\n") dw0.Value = saved } return macro @@ -305,7 +305,7 @@ func (macro *Macro) DecodeIgnoredFieldsDW1() *Macro { dw1.Value = ignored macro.Add("/* DW0: ") macro.DecodeDW1() - macro.Add(" - IGNORED */\n\t") + macro.Add(" - IGNORED */\n") dw1.Value = saved } return macro @@ -332,7 +332,7 @@ func (macro *Macro) GenerateFields() *Macro { macro.DecodeIgnoredFieldsDW1() if p2m.Config.GenLevel >= 4 { /* PAD_CFG_NF(GPP_B23, 20K_PD, PLTRST, NF2), */ - macro.Add("/* ").Add(reference).Add(" */\n\t") + macro.Add("/* ").Add(reference).Add(" */\n") } } if p2m.Config.IgnoredFields { @@ -408,7 +408,7 @@ func (macro *Macro) Generate() string { if p2m.Config.GenLevel >= 4 { macro.Clear().Add("/* ") macro.Fields.GenerateString() - macro.Add(" */\n\t") + macro.Add(" */\n") comment += macro.Get() } return comment + body diff --git a/util/intelp2m/platforms/interfaces.go b/util/intelp2m/platforms/interfaces.go new file mode 100644 index 0000000000..455da26cd7 --- /dev/null +++ b/util/intelp2m/platforms/interfaces.go @@ -0,0 +1,38 @@ +package platforms + +import ( + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/lbg" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" +) + +type SpecificIf interface { + GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string + KeywordCheck(line string) bool +} + +func GetSpecificInterface() SpecificIf { + platforms := map[p2m.PlatformType]SpecificIf{ + p2m.Alder: adl.PlatformSpecific{}, + p2m.Apollo: apl.PlatformSpecific{}, + p2m.Sunrise: snr.PlatformSpecific{}, + p2m.Cannon: cnl.PlatformSpecific{ + InheritanceTemplate: snr.PlatformSpecific{}, + InheritanceMacro: snr.PlatformSpecific{}, + }, + p2m.Lewisburg: lbg.PlatformSpecific{ + InheritanceTemplate: snr.PlatformSpecific{}, + InheritanceMacro: snr.PlatformSpecific{}, + }, + } + platform, exist := platforms[p2m.Config.Platform] + if !exist { + logs.Errorf("unknown platform type %d", int(p2m.Config.Platform)) + return nil + } + return platform +} From 85054dbccb2cd38b4a40b04819cebbf6ab50b333 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Tue, 20 Dec 2022 21:00:45 +0300 Subject: [PATCH 0255/3886] util/intelp2m: Rework platforms and fields packages - embed the base platform and redefine its methods if they differ; - separate the macro structures from the platform; - move more functions to common; - undo use of a single global instance of the microstructure. TEST: 1) 'make test' = PASS 2) './intelp2m -p cnl -iiii -file inteltool.log' = gpio.h before and after the commit is the same. Change-Id: I2e0aa56efa2430ac6524c6977f8b6fd13113edf9 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/71167 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/fields/cb/cb.go | 32 +- util/intelp2m/fields/cb/cb_test.go | 6 +- util/intelp2m/fields/fields.go | 12 +- util/intelp2m/fields/fsp/fsp.go | 55 +-- util/intelp2m/fields/fsp/fsp_test.go | 6 +- util/intelp2m/fields/raw/raw.go | 33 +- util/intelp2m/fields/raw/raw_test.go | 6 +- util/intelp2m/fields/test/suite.go | 28 +- util/intelp2m/parser/parser.go | 31 +- util/intelp2m/platforms/adl/adl_test.go | 41 +- util/intelp2m/platforms/adl/macro.go | 112 ++--- util/intelp2m/platforms/adl/template.go | 14 +- util/intelp2m/platforms/apl/apl_test.go | 53 +- util/intelp2m/platforms/apl/macro.go | 256 +++++----- util/intelp2m/platforms/apl/template.go | 7 +- util/intelp2m/platforms/cnl/cnl_test.go | 38 +- util/intelp2m/platforms/cnl/macro.go | 200 +++----- util/intelp2m/platforms/cnl/template.go | 17 +- util/intelp2m/platforms/common/common.go | 25 + util/intelp2m/platforms/common/macro.go | 453 +++++++++--------- .../platforms/common/register/helper.go | 5 + util/intelp2m/platforms/ebg/ebg_test.go | 41 +- util/intelp2m/platforms/ebg/macro.go | 108 +---- util/intelp2m/platforms/ebg/template.go | 4 +- util/intelp2m/platforms/interfaces.go | 38 -- util/intelp2m/platforms/jsl/jsl_test.go | 41 +- util/intelp2m/platforms/jsl/macro.go | 118 ++--- util/intelp2m/platforms/jsl/template.go | 4 +- util/intelp2m/platforms/lbg/lbg_test.go | 56 +-- util/intelp2m/platforms/lbg/macro.go | 105 +--- util/intelp2m/platforms/lbg/template.go | 19 +- util/intelp2m/platforms/mtl/macro.go | 111 ++--- util/intelp2m/platforms/mtl/mtl_test.go | 41 +- util/intelp2m/platforms/mtl/template.go | 4 +- util/intelp2m/platforms/platforms.go | 62 +++ util/intelp2m/platforms/snr/macro.go | 231 ++++----- util/intelp2m/platforms/snr/snr_test.go | 65 +-- util/intelp2m/platforms/snr/template.go | 13 +- util/intelp2m/platforms/test/suite.go | 46 +- util/intelp2m/platforms/tgl/macro.go | 109 +---- util/intelp2m/platforms/tgl/template.go | 4 +- util/intelp2m/platforms/tgl/tgl_test.go | 45 +- 42 files changed, 1126 insertions(+), 1569 deletions(-) create mode 100644 util/intelp2m/platforms/common/common.go create mode 100644 util/intelp2m/platforms/common/register/helper.go delete mode 100644 util/intelp2m/platforms/interfaces.go create mode 100644 util/intelp2m/platforms/platforms.go diff --git a/util/intelp2m/fields/cb/cb.go b/util/intelp2m/fields/cb/cb.go index f6a1411356..80dceafce2 100644 --- a/util/intelp2m/fields/cb/cb.go +++ b/util/intelp2m/fields/cb/cb.go @@ -5,7 +5,7 @@ import ( "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) -type FieldMacros struct{} +type FieldCollection struct{} // field - data structure for creating a new bitfield macro object // PAD_FUNC(NF3) @@ -22,8 +22,7 @@ type field struct { // generate - wrapper for generating bitfield macros string // fields : field structure -func generate(fields ...*field) { - macro := common.GetMacro() +func generate(macro *common.Macro, fields ...*field) { var allhidden bool = true for _, field := range fields { if field.unhide { @@ -48,10 +47,9 @@ func generate(fields ...*field) { } // DecodeDW0 - decode value of DW0 register -func (FieldMacros) DecodeDW0() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - generate( +func (FieldCollection) DecodeDW0(macro *common.Macro) *common.Macro { + dw0 := macro.Platform.GetRegisterDW0() + generate(macro, &field{ prefix: "PAD_FUNC", // TODO: Find another way to hide PAD_FUNC(GPIO) in the comment with @@ -128,13 +126,13 @@ func (FieldMacros) DecodeDW0() { unhide: dw0.GetGPIOTXState() != 0, }, ) + return macro } // DecodeDW1 - decode value of DW1 register -func (FieldMacros) DecodeDW1() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() - generate( +func (FieldCollection) DecodeDW1(macro *common.Macro) *common.Macro { + dw1 := macro.Platform.GetRegisterDW1() + generate(macro, &field{ name: "PAD_CFG1_TOL_1V8", unhide: dw1.GetPadTol() != 0, @@ -164,14 +162,12 @@ func (FieldMacros) DecodeDW1() { configurator: func() { macro.Own() }, }, ) + return macro } -// GenerateString - generates the entire string of bitfield macros. -func (bitfields FieldMacros) GenerateString() { - macro := common.GetMacro() +// GenerateMacro generates the field macro collection +func (f FieldCollection) GenerateMacro(macro *common.Macro) *common.Macro { macro.Add("_PAD_CFG_STRUCT(").Id().Add(", ") - bitfields.DecodeDW0() - macro.Add(", ") - bitfields.DecodeDW1() - macro.Add("),") + f.DecodeDW0(macro).Add(", ") + return f.DecodeDW1(macro).Add("),") } diff --git a/util/intelp2m/fields/cb/cb_test.go b/util/intelp2m/fields/cb/cb_test.go index 64d735e2b7..e553551199 100644 --- a/util/intelp2m/fields/cb/cb_test.go +++ b/util/intelp2m/fields/cb/cb_test.go @@ -3,13 +3,15 @@ package cb_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/cb" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields/test" ) // sliding-one func TestCbFields(t *testing.T) { + p2m.SettingsReset() + p2m.Config.Field = p2m.CbFlds referenceSlice := []string{ "_PAD_CFG_STRUCT(, PAD_FUNC(GPIO) | PAD_RESET(PLTRST), 0),", "_PAD_CFG_STRUCT(, PAD_FUNC(GPIO) | PAD_RESET(DEEP), 0),", @@ -44,5 +46,5 @@ func TestCbFields(t *testing.T) { "_PAD_CFG_STRUCT(, PAD_FUNC(GPIO) | (1 << 1), 0),", "_PAD_CFG_STRUCT(, PAD_FUNC(GPIO) | 1, 0),", } - test.SlidingOneTestSuiteCreate(referenceSlice).Run(t, "SLIDING-ONE-TEST", cb.FieldMacros{}) + test.SlidingOneTestSuiteCreate(referenceSlice).Run(t, "SLIDING-ONE-TEST") } diff --git a/util/intelp2m/fields/fields.go b/util/intelp2m/fields/fields.go index 4e41aff4ca..19074f9ad1 100644 --- a/util/intelp2m/fields/fields.go +++ b/util/intelp2m/fields/fields.go @@ -10,12 +10,12 @@ import ( // InterfaceSet - set the interface for decoding configuration // registers DW0 and DW1. -func InterfaceGet() common.Fields { - var fldstylemap = map[p2m.FieldType]common.Fields{ - p2m.NoFlds: cb.FieldMacros{}, // analyze fields using cb macros - p2m.CbFlds: cb.FieldMacros{}, - p2m.FspFlds: fsp.FieldMacros{}, - p2m.RawFlds: raw.FieldMacros{}, +func Get() common.FieldsIf { + var fldstylemap = map[p2m.FieldType]common.FieldsIf{ + p2m.NoFlds: cb.FieldCollection{}, // analyze fields using cb macros + p2m.CbFlds: cb.FieldCollection{}, + p2m.FspFlds: fsp.FieldCollection{}, + p2m.RawFlds: raw.FieldCollection{}, } return fldstylemap[p2m.Config.Field] } diff --git a/util/intelp2m/fields/fsp/fsp.go b/util/intelp2m/fields/fsp/fsp.go index db6b4ad294..e8d140af07 100644 --- a/util/intelp2m/fields/fsp/fsp.go +++ b/util/intelp2m/fields/fsp/fsp.go @@ -2,7 +2,7 @@ package fsp import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -type FieldMacros struct{} +type FieldCollection struct{} // field - data structure for creating a new bitfield macro object // configmap : map to select the current configuration @@ -14,10 +14,8 @@ type field struct { override func(configuration map[uint32]string, value uint32) } -// generate - wrapper for generating bitfield macros string -// fields : field structure -func generate(fields ...*field) { - macro := common.GetMacro() +// generate() generates bitfield macro data struct +func generate(macro *common.Macro, fields ...*field) { for _, field := range fields { if field.override != nil { // override if necessary @@ -35,9 +33,8 @@ func generate(fields ...*field) { } // DecodeDW0 - decode value of DW0 register -func (FieldMacros) DecodeDW0() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() +func (FieldCollection) DecodeDW0(macro *common.Macro) *common.Macro { + dw0 := macro.Platform.GetRegisterDW0() ownershipStatus := func() uint32 { if macro.IsOwnershipDriver() { @@ -46,7 +43,7 @@ func (FieldMacros) DecodeDW0() { return 0 } - generate( + generate(macro, &field{ configmap: map[uint32]string{ 0: "GpioPadModeGpio", @@ -131,13 +128,13 @@ func (FieldMacros) DecodeDW0() { value: dw0.GetResetConfig(), }, ) + return macro } -// DecodeDW1 - decode value of DW1 register -func (FieldMacros) DecodeDW1() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() - generate( +// DecodeDW1() decodes DW1 register value and adds it to the macro string +func (FieldCollection) DecodeDW1(macro *common.Macro) *common.Macro { + dw1 := macro.Platform.GetRegisterDW1() + generate(macro, &field{ override: func(configmap map[uint32]string, value uint32) { if dw1.GetPadTol() != 0 { @@ -145,29 +142,27 @@ func (FieldMacros) DecodeDW1() { } }, }, - &field{ configmap: map[uint32]string{ - 0x0: "GpioTermNone", - 0x2: "GpioTermWpd5K", - 0x4: "GpioTermWpd20K", - 0x9: "GpioTermWpu1K", - 0xa: "GpioTermWpu5K", - 0xb: "GpioTermWpu2K", - 0xc: "GpioTermWpu20K", - 0xd: "GpioTermWpu1K2K", - 0xf: "GpioTermNative", + 0b0000: "GpioTermNone", + 0b0010: "GpioTermWpd5K", + 0b0100: "GpioTermWpd20K", + 0b1001: "GpioTermWpu1K", + 0b1010: "GpioTermWpu5K", + 0b1011: "GpioTermWpu2K", + 0b1100: "GpioTermWpu20K", + 0b1101: "GpioTermWpu1K2K", + 0b1111: "GpioTermNative", }, value: dw1.GetTermination(), }, ) + return macro } -// GenerateString - generates the entire string of bitfield macros. -func (bitfields FieldMacros) GenerateString() { - macro := common.GetMacro() +// GenerateMacro() generates the field macro collection and adds it to the macro string +func (f FieldCollection) GenerateMacro(macro *common.Macro) *common.Macro { macro.Add("{ GPIO_SKL_H_").Id().Add(", { ") - bitfields.DecodeDW0() - bitfields.DecodeDW1() - macro.Add(" GpioPadConfigLock } },") // TODO: configure GpioPadConfigLock + f.DecodeDW0(macro) + return f.DecodeDW1(macro).Add(" GpioPadConfigLock } },") // TODO: configure GpioPadConfigLock } diff --git a/util/intelp2m/fields/fsp/fsp_test.go b/util/intelp2m/fields/fsp/fsp_test.go index 90bbc0e884..3b6d8c6650 100644 --- a/util/intelp2m/fields/fsp/fsp_test.go +++ b/util/intelp2m/fields/fsp/fsp_test.go @@ -3,11 +3,13 @@ package fsp_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/fsp" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields/test" ) func TestFSPFields(t *testing.T) { + p2m.SettingsReset() + p2m.Config.Field = p2m.FspFlds referenceSlice := []string{ "{ GPIO_SKL_H_, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInOut, GpioOutLow, GpioIntDis | GpioIntLevel, GpioPlatformReset, GpioTermNone, GpioPadConfigLock } },", "{ GPIO_SKL_H_, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInOut, GpioOutLow, GpioIntDis | GpioIntLevel, GpioHostDeepReset, GpioTermNone, GpioPadConfigLock } },", @@ -42,5 +44,5 @@ func TestFSPFields(t *testing.T) { "{ GPIO_SKL_H_, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInOut, GpioOutLow, GpioIntDis | GpioIntLevel, GpioResetPwrGood, GpioTermNone, GpioPadConfigLock } },", "{ GPIO_SKL_H_, { GpioPadModeGpio, GpioHostOwnAcpi, GpioDirInOut, GpioOutHigh, GpioIntDis | GpioIntLevel, GpioResetPwrGood, GpioTermNone, GpioPadConfigLock } },", } - test.SlidingOneTestSuiteCreate(referenceSlice).Run(t, "SLIDING-ONE-TEST", fsp.FieldMacros{}) + test.SlidingOneTestSuiteCreate(referenceSlice).Run(t, "SLIDING-ONE-TEST") } diff --git a/util/intelp2m/fields/raw/raw.go b/util/intelp2m/fields/raw/raw.go index 4efccd5c5e..12338a0adb 100644 --- a/util/intelp2m/fields/raw/raw.go +++ b/util/intelp2m/fields/raw/raw.go @@ -1,29 +1,24 @@ package raw -import ( - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -) +import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -type FieldMacros struct{} +type FieldCollection struct{} -func (FieldMacros) DecodeDW0() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - macro.Add(dw0.String()) +// DecodeDW0() decodes DW0 register value and adds it to the macro string +func (FieldCollection) DecodeDW0(macro *common.Macro) *common.Macro { + dw0 := macro.Platform.GetRegisterDW0() + return macro.Add(dw0.String()) } -func (FieldMacros) DecodeDW1() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() - macro.Add(dw1.String()) +// DecodeDW1() decodes DW1 register value and adds it to the macro string +func (FieldCollection) DecodeDW1(macro *common.Macro) *common.Macro { + dw1 := macro.Platform.GetRegisterDW1() + return macro.Add(dw1.String()) } -// GenerateString - generates the entire string of bitfield macros. -func (bitfields FieldMacros) GenerateString() { - macro := common.GetMacro() +// GenerateMacro() generates the field macro collection and adds it to the macro string +func (f FieldCollection) GenerateMacro(macro *common.Macro) *common.Macro { macro.Add("_PAD_CFG_STRUCT(").Id().Add(", ") - bitfields.DecodeDW0() - macro.Add(", ") - bitfields.DecodeDW1() - macro.Add("),") + f.DecodeDW0(macro).Add(", ") + return f.DecodeDW1(macro).Add("),") } diff --git a/util/intelp2m/fields/raw/raw_test.go b/util/intelp2m/fields/raw/raw_test.go index 8cab698ab7..067f6aa5ac 100644 --- a/util/intelp2m/fields/raw/raw_test.go +++ b/util/intelp2m/fields/raw/raw_test.go @@ -3,11 +3,13 @@ package raw_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/raw" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/fields/test" ) func TestRAWFields(t *testing.T) { + p2m.SettingsReset() + p2m.Config.Field = p2m.RawFlds referenceSlice := []string{ "_PAD_CFG_STRUCT(, 0x80000000, 0x80000000),", "_PAD_CFG_STRUCT(, 0x40000000, 0x40000000),", @@ -42,5 +44,5 @@ func TestRAWFields(t *testing.T) { "_PAD_CFG_STRUCT(, 0x00000002, 0x00000002),", "_PAD_CFG_STRUCT(, 0x00000001, 0x00000001),", } - test.SlidingOneTestSuiteCreate(referenceSlice).Run(t, "SLIDING-ONE-TEST", raw.FieldMacros{}) + test.SlidingOneTestSuiteCreate(referenceSlice).Run(t, "SLIDING-ONE-TEST") } diff --git a/util/intelp2m/fields/test/suite.go b/util/intelp2m/fields/test/suite.go index 3041de2136..816a3a8105 100644 --- a/util/intelp2m/fields/test/suite.go +++ b/util/intelp2m/fields/test/suite.go @@ -4,8 +4,9 @@ import ( "fmt" "testing" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) type TestCase struct { @@ -16,7 +17,7 @@ type TestCase struct { func (tc TestCase) Check(actuallyMacro string) error { if actuallyMacro != tc.Reference { - return fmt.Errorf(`TestCase: DW0 = %d, DW1 = %d, Ownership = %d: + return fmt.Errorf(`TestCase: DW0 = 0x%x, DW1 = 0x%x, Ownership = %d: Expects: '%s' Actually: '%s'`, tc.DW0, tc.DW1, tc.Ownership, tc.Reference, actuallyMacro) } @@ -25,19 +26,20 @@ Actually: '%s'`, tc.DW0, tc.DW1, tc.Ownership, tc.Reference, actuallyMacro) type Suite []TestCase -func (suite Suite) Run(t *testing.T, label string, decoderIf common.Fields) { +func (suite Suite) Run(t *testing.T, label string) { t.Run(label, func(t *testing.T) { - platform := snr.PlatformSpecific{} - macro := common.GetInstanceMacro(platform, decoderIf) - dw0 := macro.GetRegisterDW0() - dw1 := macro.GetRegisterDW1() for _, tc := range suite { - macro.Clear() - macro.PadIdSet("").SetPadOwnership(tc.Ownership) - dw0.Value = tc.DW0 - dw1.Value = tc.DW1 - macro.Fields.GenerateString() - if err := tc.Check(macro.Get()); err != nil { + constructor, err := platforms.GetConstructor() + if err != nil { + panic(err) + } + macro := common.CreateFrom( + "", + tc.Ownership == 1, + constructor(tc.DW0, tc.DW1), + fields.Get(), + ) + if err := tc.Check(macro.Fields.GenerateMacro(¯o).String()); err != nil { t.Errorf("Test failed: %v", err) } } diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index b410912128..4575549544 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -7,6 +7,7 @@ import ( "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/parser/template" "review.coreboot.org/coreboot.git/util/intelp2m/platforms" @@ -35,13 +36,16 @@ type Entry struct { Function string DW0 uint32 DW1 uint32 - Ownership uint8 + Ownership bool } func (e *Entry) ToMacro() []string { - platform := platforms.GetSpecificInterface() - line := platform.GenMacro(e.ID, e.DW0, e.DW1, e.Ownership) - slices := strings.Split(line, "\n") + constructor, err := platforms.GetConstructor() + if err != nil { + panic(err) + } + macro := common.CreateFrom(e.ID, e.Ownership, constructor(e.DW0, e.DW1), fields.Get()) + slices := strings.Split(macro.Generate(), "\n") return slices } @@ -49,7 +53,7 @@ func (e *Entry) ToMacro() []string { func extractPad(line string) (Entry, error) { function, id, dw0, dw1, err := template.Apply(line) if err != nil { - logs.Errorf("%v", err) + logs.Errorf("extraction error: %v", err) return Entry{EType: EntryEmpty}, err } @@ -59,7 +63,7 @@ func extractPad(line string) (Entry, error) { ID: id, DW0: dw0, DW1: dw1, - Ownership: 0, + Ownership: common.Acpi, } if dw0 == bits.All32 { @@ -79,12 +83,14 @@ func extractGroup(line string) Entry { } // Extract() extracts pad information from a string -func Extract(line string, platform platforms.SpecificIf) Entry { +func Extract(line string) Entry { if included, _ := common.KeywordsCheck(line, "GPIO Community", "GPIO Group"); included { return extractGroup(line) } - - if platform.KeywordCheck(line) { + if checkKeyword := platforms.GetKeywordChekingAction(); checkKeyword == nil { + logs.Errorf("information extraction error: skip line <%s>", line) + return Entry{EType: EntryEmpty} + } else if checkKeyword(line) { pad, err := extractPad(line) if err != nil { logs.Errorf("extract pad info from %s: %v", line, err) @@ -100,11 +106,6 @@ func Extract(line string, platform platforms.SpecificIf) Entry { func Run() ([]Entry, error) { entries := make([]Entry, 0) - platform := platforms.GetSpecificInterface() - if platform == nil { - return nil, fmt.Errorf("unknown platform") - } - file, err := os.Open(p2m.Config.InputPath) if err != nil { err = fmt.Errorf("input file error: %v", err) @@ -117,7 +118,7 @@ func Run() ([]Entry, error) { scanner := bufio.NewScanner(file) for scanner.Scan() { line := scanner.Text() - entry := Extract(line, platform) + entry := Extract(line) if entry.EType != EntryEmpty { entries = append(entries, entry) } diff --git a/util/intelp2m/platforms/adl/adl_test.go b/util/intelp2m/platforms/adl/adl_test.go index 1f2400a710..68b118781a 100644 --- a/util/intelp2m/platforms/adl/adl_test.go +++ b/util/intelp2m/platforms/adl/adl_test.go @@ -3,108 +3,103 @@ package adl_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - alderlake := adl.PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - } + p2m.Config.Platform = p2m.Alder test.Suite{ { - Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A1, DN_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(DN_20K) | PAD_IOSSTATE(Tx1RxDCRx1) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(GPP_B2, 0, INVALID, RSMRST),", Long: "_PAD_CFG_STRUCT(GPP_B2, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_C3", DW0: 0x44444444, DW1: 0x44444444, Ownership: 1}, + Pad: test.Pad{ID: "GPP_C3", DW0: 0x44444444, DW1: 0x44444444, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_C3, INVALID, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_C3, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SMI), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx0RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_D4, DN_5K, PLTRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_D4, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT), PAD_PULL(DN_5K) | PAD_IOSSTATE(Tx0RxDCRx1)),", }, }, - }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST", alderlake) + }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E5, UP_2K, PWROK, NF3),", Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_F6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_F6, INVALID, PWROK, NF7),", Long: "_PAD_CFG_STRUCT(GPP_F6, PAD_FUNC(NF7) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx0) | PAD_IOSTERM(DISPUPD)),", }, }, { - Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, + Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_G7, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_H8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, + Pad: test.Pad{ID: "GPP_H8", DW0: 0x77777777, DW1: 0x77777777, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_H8, UP_667, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPP_H8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, - }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", alderlake) + }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_I9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, + Pad: test.Pad{ID: "GPP_I9", DW0: 0x33333333, DW1: 0x33333333, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_I9, UP_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_I9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_J10", DW0: 0x66666666, DW1: 0x66666666, Ownership: 0}, + Pad: test.Pad{ID: "GPP_J10", DW0: 0x66666666, DW1: 0x66666666, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_J10, UP_1K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_J10, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_1K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_K11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: 1}, + Pad: test.Pad{ID: "GPP_K11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_K11, INVALID, PWROK, NF3),", Long: "_PAD_CFG_STRUCT(GPP_K11, PAD_FUNC(NF3) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_R12", DW0: 0x99999999, DW1: 0x99999999, Ownership: 0}, + Pad: test.Pad{ID: "GPP_R12", DW0: 0x99999999, DW1: 0x99999999, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_R12, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_R12, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxE) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST", alderlake) + }.Run(t, "INTEL-ALDER-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST") } diff --git a/util/intelp2m/platforms/adl/macro.go b/util/intelp2m/platforms/adl/macro.go index 7c4f4357bb..19e9bd20e5 100644 --- a/util/intelp2m/platforms/adl/macro.go +++ b/util/intelp2m/platforms/adl/macro.go @@ -1,113 +1,57 @@ package adl import ( - "fmt" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask uint32 = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask uint32 = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Cannon Lake platform + cnl.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{cnl.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - if strings.Contains(macro.PadIdGet(), "GPD") { +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override BasePlatform.RemapRstSrc() +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the Alderlake GPD Group in the Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/alderlake/gpio.c#L21 // remmap is not required because it is the same as common. return } - dw0 := macro.GetRegisterDW0() remapping := map[uint32]uint32{ - 0: (bits.RstCfgRSMRST << bits.DW0PadRstCfg), - 1: (bits.RstCfgDEEP << bits.DW0PadRstCfg), - 2: (bits.RstCfgPLTRST << bits.DW0PadRstCfg), - 3: (bits.RstCfgPWROK << bits.DW0PadRstCfg), + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + 0b11: bits.RstCfgPWROK << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + dw0 := p.GetRegisterDW0() + source, valid := remapping[dw0.GetResetConfig()] if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } - dw0.CntrMaskFieldsClear(0b11 << bits.DW0PadRstCfg) -} - -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (platform PlatformSpecific) Pull() { - platform.InheritanceMacro.Pull() -} - -// Adds PAD_CFG_GPI macro with arguments -func (platform PlatformSpecific) GpiMacroAdd() { - platform.InheritanceMacro.GpiMacroAdd() -} - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0Val : DW0 config register value -// dw1Val : DW1 config register value -// return: string of macro -// error -func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - }, - fields.InterfaceGet(), - ) - macro.Clear() - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() + mask := bits.DW0[bits.DW0PadRstCfg] + dw0.CntrMaskFieldsClear(mask) } diff --git a/util/intelp2m/platforms/adl/template.go b/util/intelp2m/platforms/adl/template.go index 1642670144..4af499dbab 100644 --- a/util/intelp2m/platforms/adl/template.go +++ b/util/intelp2m/platforms/adl/template.go @@ -2,14 +2,12 @@ package adl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// Group : "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", -// "GPP_H", "GPP_I", "GPP_J", "GPP_K", "GPP_R", "GPP_S", "GPP_T", -// "GPD", "VGPIO_USB", "VGPIO_PCIE" - -// KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func (PlatformSpecific) KeywordCheck(line string) bool { +// CheckKeyword() parses lines of the configuration file and returns true if the keyword is +// contained in the line +// "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", +// "GPP_H", "GPP_I", "GPP_J", "GPP_K", "GPP_R", "GPP_S", "GPP_T", +// "GPD", "VGPIO_USB", "VGPIO_PCIE" +func CheckKeyword(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded } diff --git a/util/intelp2m/platforms/apl/apl_test.go b/util/intelp2m/platforms/apl/apl_test.go index 42d15ba4eb..1735346505 100644 --- a/util/intelp2m/platforms/apl/apl_test.go +++ b/util/intelp2m/platforms/apl/apl_test.go @@ -3,165 +3,166 @@ package apl_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - apollolake := apl.PlatformSpecific{} + p2m.Config.Platform = p2m.Apollo test.Suite{ { /* GPIO_0 - GPIO */ - Pad: test.Pad{ID: "GPIO_0", DW0: 0x44000300, DW1: 0x1003d000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_0", DW0: 0x44000300, DW1: 0x1003d000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_HI_Z(GPIO_0, DN_20K, DEEP, IGNORE, SAME),", Long: "_PAD_CFG_STRUCT(GPIO_0, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), PAD_PULL(DN_20K) | PAD_IOSSTATE(IGNORE)),", }, }, { /* GPIO_15 - GPIO */ - Pad: test.Pad{ID: "GPIO_15", DW0: 0x44000000, DW1: 0x10001000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_15", DW0: 0x44000000, DW1: 0x10001000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPIO_15, 0, DN_20K, DEEP, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPIO_15, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(DN_20K)),", }, }, { /* GPIO_16 - GPIO */ - Pad: test.Pad{ID: "GPIO_16", DW0: 0x44000003, DW1: 0x10003000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_16", DW0: 0x44000003, DW1: 0x10003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPIO_16, 1, UP_20K, DEEP, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPIO_16, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | (1 << 1) | 1, PAD_PULL(UP_20K)),", }, }, { /* GPIO_18 - GPIO */ - Pad: test.Pad{ID: "GPIO_18", DW0: 0x44000102, DW1: 0x10003000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_18", DW0: 0x44000102, DW1: 0x10003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPIO_18, UP_20K, DEEP, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPIO_18, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K)),", }, }, { /* GPIO_21 - GPIO */ - Pad: test.Pad{ID: "GPIO_21", DW0: 0x44000102, DW1: 0x10027000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_21", DW0: 0x44000102, DW1: 0x10027000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_IOSSTATE_OWN(GPIO_21, UP_20K, DEEP, OFF, TxDRxE, ACPI),", Long: "_PAD_CFG_STRUCT(GPIO_21, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K) | PAD_IOSSTATE(TxDRxE)),", }, }, { /* GPIO_22 - GPIO */ - Pad: test.Pad{ID: "GPIO_22", DW0: 0x44800102, DW1: 0x10024100, Ownership: 1}, + Pad: test.Pad{ID: "GPIO_22", DW0: 0x44800102, DW1: 0x10024100, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_IOS_OWN(GPIO_22, NONE, DEEP, OFF, TxDRxE, DISPUPD, DRIVER),", Long: "_PAD_CFG_STRUCT(GPIO_22, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPIO_25 - GPIO */ - Pad: test.Pad{ID: "GPIO_25", DW0: 0x40880102, DW1: 0x00027100, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_25", DW0: 0x40880102, DW1: 0x00027100, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_SCI_IOS(GPIO_25, UP_20K, DEEP, LEVEL, INVERT, TxDRxE, DISPUPD),", Long: "_PAD_CFG_STRUCT(GPIO_25, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(DISPUPD)),", }, }, { /* GPIO_26 - SATA_LEDN */ - Pad: test.Pad{ID: "GPIO_26", DW0: 0x44001400, DW1: 0x00003c00, Ownership: 1}, + Pad: test.Pad{ID: "GPIO_26", DW0: 0x44001400, DW1: 0x00003c00, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPIO_26, NATIVE, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPIO_26, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(NATIVE) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPIO_27 - GPIO */ - Pad: test.Pad{ID: "GPIO_27", DW0: 0x42880102, DW1: 0x00024100, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_27", DW0: 0x42880102, DW1: 0x00024100, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_SCI_IOS(GPIO_27, NONE, DEEP, EDGE_SINGLE, INVERT, TxDRxE, DISPUPD),", Long: "_PAD_CFG_STRUCT(GPIO_27, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(DISPUPD)),", }, }, { /* TDI - JTAG_TDI */ - Pad: test.Pad{ID: "TDI", DW0: 0x44000700, DW1: 0x00c00000, Ownership: 0}, + Pad: test.Pad{ID: "TDI", DW0: 0x44000700, DW1: 0x00c00000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(TDI, NONE, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(TDI, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), 0),", }, }, { /* CNV_BRI_DT - GPIO */ - Pad: test.Pad{ID: "CNV_BRI_DT", DW0: 0x44000100, DW1: 0x1003d000, Ownership: 0}, + Pad: test.Pad{ID: "CNV_BRI_DT", DW0: 0x44000100, DW1: 0x1003d000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_IOSSTATE_OWN(CNV_BRI_DT, DN_20K, DEEP, OFF, IGNORE, ACPI),", Long: "_PAD_CFG_STRUCT(CNV_BRI_DT, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), PAD_PULL(DN_20K) | PAD_IOSSTATE(IGNORE)),", }, }, { /* CNV_BRI_RSP - GPIO */ - Pad: test.Pad{ID: "CNV_BRI_RSP", DW0: 0x44000201, DW1: 0x10003000, Ownership: 0}, + Pad: test.Pad{ID: "CNV_BRI_RSP", DW0: 0x44000201, DW1: 0x10003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(CNV_BRI_RSP, 1, UP_20K, DEEP),", Long: "_PAD_CFG_STRUCT(CNV_BRI_RSP, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1, PAD_PULL(UP_20K)),", }, }, { /* GPIO_188 - DDI0_DDC_SCL */ - Pad: test.Pad{ID: "GPIO_188", DW0: 0x44000400, DW1: 0x0003fc00, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_188", DW0: 0x44000400, DW1: 0x0003fc00, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_IOSTANDBY_IGNORE(GPIO_188, NATIVE, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPIO_188, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(NATIVE) | PAD_IOSSTATE(IGNORE)),", }, }, { /* GPIO_172 - SDCARD_CLK */ - Pad: test.Pad{ID: "GPIO_172", DW0: 0x44000400, DW1: 0x00021100, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_172", DW0: 0x44000400, DW1: 0x00021100, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_172, DN_20K, DEEP, NF1, HIZCRx1, DISPUPD),", Long: "_PAD_CFG_STRUCT(GPIO_172, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(DN_20K) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(DISPUPD)),", }, }, { /* GPIO_176 - SDCARD_D3 */ - Pad: test.Pad{ID: "GPIO_176", DW0: 0x44000400, DW1: 0x00021000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_176", DW0: 0x44000400, DW1: 0x00021000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_IOSSTATE(GPIO_176, DN_20K, DEEP, NF1, HIZCRx1),", Long: "_PAD_CFG_STRUCT(GPIO_176, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(DN_20K) | PAD_IOSSTATE(HIZCRx1)),", }, }, { /* GPIO_177 - GPIO */ - Pad: test.Pad{ID: "GPIO_177", DW0: 0x46000102, DW1: 0x10027000, Ownership: 1}, + Pad: test.Pad{ID: "GPIO_177", DW0: 0x46000102, DW1: 0x10027000, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_IOSSTATE_OWN(GPIO_177, UP_20K, DEEP, EDGE_BOTH, TxDRxE, DRIVER),", Long: "_PAD_CFG_STRUCT(GPIO_177, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K) | PAD_IOSSTATE(TxDRxE) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPIO_186 - SDCARD_LVL_WP */ - Pad: test.Pad{ID: "GPIO_186", DW0: 0x44000402, DW1: 0x00003000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_186", DW0: 0x44000402, DW1: 0x00003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPIO_186, UP_20K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPIO_186, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | (1 << 1), PAD_PULL(UP_20K)),", }, }, { /* GPIO_182 - EMMC_RCLK */ - Pad: test.Pad{ID: "GPIO_182", DW0: 0x44000400, DW1: 0x0001d000, Ownership: 0}, + Pad: test.Pad{ID: "GPIO_182", DW0: 0x44000400, DW1: 0x0001d000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_IOSSTATE(GPIO_182, DN_20K, DEEP, NF1, HIZCRx0),", Long: "_PAD_CFG_STRUCT(GPIO_182, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(DN_20K) | PAD_IOSSTATE(HIZCRx0)),", }, }, { /* LPC_CLKOUT0 - LPC_CLKOUT0 */ - Pad: test.Pad{ID: "LPC_CLKOUT0", DW0: 0x44000400, DW1: 0x00020100, Ownership: 0}, + Pad: test.Pad{ID: "LPC_CLKOUT0", DW0: 0x44000400, DW1: 0x00020100, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_IOSSTATE_IOSTERM(LPC_CLKOUT0, NONE, DEEP, NF1, HIZCRx1, DISPUPD),", Long: "_PAD_CFG_STRUCT(LPC_CLKOUT0, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-APOLLO-PCH/PAD-MAP", apollolake) + }.Run(t, "INTEL-APOLLO-PCH/PAD-MAP") test.Suite{ { - Pad: test.Pad{ID: "GPP_1xx", DW0: 0xBFFFFFFF, DW1: 0xFFFFFFFF, Ownership: 1}, + Pad: test.Pad{ID: "GPP_1xx", DW0: 0xBFFFFFFF, DW1: 0xFFFFFFFF, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_IOSSTATE_IOSTERM(GPP_1xx, NATIVE, PLTRST, NF7, IGNORE, ENPU),", Long: "_PAD_CFG_STRUCT(GPP_1xx, PAD_FUNC(NF7) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(NATIVE) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, - }.Run(t, "INTEL-APOLLO-PCH/MASK", apollolake) + }.Run(t, "INTEL-APOLLO-PCH/MASK") test.Suite{ { - Pad: test.Pad{ID: "GPP_2xx", DW0: 0x00000000, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_2xx", DW0: 0x00000000, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPP_2xx, 0, NONE, PWROK, LEVEL, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_2xx, PAD_FUNC(GPIO), 0),", }, }, - }.Run(t, "INTEL-APOLLO-PCH/EMRTY", apollolake) + }.Run(t, "INTEL-APOLLO-PCH/EMRTY") } diff --git a/util/intelp2m/platforms/apl/macro.go b/util/intelp2m/platforms/apl/macro.go index 3e5bf74603..f20acc46a3 100644 --- a/util/intelp2m/platforms/apl/macro.go +++ b/util/intelp2m/platforms/apl/macro.go @@ -1,43 +1,47 @@ package apl import ( - "fmt" - "strconv" - "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfffc00ff + DW0Mask uint32 = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask uint32 = 0b11111111111111000000000011111111 ) -const ( - PULL_NONE = 0x0 // 0 000: none - PULL_DN_5K = 0x2 // 0 010: 5k wpd (Only available on SMBus GPIOs) - PULL_DN_20K = 0x4 // 0 100: 20k wpd - // PULL_NONE = 0x8 // 1 000: none - PULL_UP_1K = 0x9 // 1 001: 1k wpu (Only available on I2C GPIOs) - PULL_UP_2K = 0xb // 1 011: 2k wpu (Only available on I2C GPIOs) - PULL_UP_20K = 0xc // 1 100: 20k wpu - PULL_UP_667 = 0xd // 1 101: 1k & 2k wpu (Only available on I2C GPIOs) - PULL_NATIVE = 0xf // 1 111: (optional) Native controller selected by Pad Mode -) +type BasePlatform struct { + common.BasePlatform +} -type PlatformSpecific struct{} +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{common.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} +} -// RemmapRstSrc - remmap Pad Reset Source Config -// remmap is not required because it is the same as common. -func (PlatformSpecific) RemmapRstSrc() {} +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// RemapRstSrc() remaps Pad Reset Source Config +func (p *BasePlatform) RemapRstSrc(m *common.Macro) {} + +// Pull() adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro +func (p *BasePlatform) Pull(m *common.Macro) { + const ( + PULL_NONE = 0b0000 // 0 000: none + PULL_DN_5K = 0b0010 // 0 010: 5k wpd (Only available on SMBus GPIOs) + PULL_DN_20K = 0b0100 // 0 100: 20k wpd + // PULL_NONE = 0b1000 // 1 000: none + PULL_UP_1K = 0b1001 // 1 001: 1k wpu (Only available on I2C GPIOs) + PULL_UP_2K = 0b1011 // 1 011: 2k wpu (Only available on I2C GPIOs) + PULL_UP_20K = 0b1100 // 1 100: 20k wpu + PULL_UP_667 = 0b1101 // 1 101: 1k & 2k wpu (Only available on I2C GPIOs) + PULL_NATIVE = 0b1111 // 1 111: (optional) Native controller selected by Pad Mode + ) -// Adds The Pad Termination (TERM) parameter from DW1 to the macro as a new argument -// return: macro -func (PlatformSpecific) Pull() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() var pull = map[uint32]string{ PULL_NONE: "NONE", PULL_DN_5K: "DN_5K", @@ -48,259 +52,221 @@ func (PlatformSpecific) Pull() { PULL_UP_667: "UP_667", PULL_NATIVE: "NATIVE", } - str, exist := pull[dw1.GetTermination()] + dw1 := p.GetRegisterDW1() + term, exist := pull[dw1.GetTermination()] if !exist { - str = strconv.Itoa(int(dw1.GetTermination())) - fmt.Println("Error", macro.PadIdGet(), " invalid TERM value = ", str) + term = "INVALID" + logs.Errorf("%s: DW1 %s: invalid termination value 0b%b", + dw1, m.GetPadId(), dw1.GetTermination()) } - macro.Separator().Add(str) + m.Separator().Add(term) } // Generate macro to cause peripheral IRQ when configured in GPIO input mode -func ioApicRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - dw1 := macro.GetRegisterDW1() - if dw0.GetGPIOInputRouteIOxAPIC() == 0 { +func ioApicRoute(p *BasePlatform, m *common.Macro) bool { + if dw0 := p.GetRegisterDW0(); dw0.GetGPIOInputRouteIOxAPIC() == 0 { return false } - macro.Add("_APIC") + m.Add("_APIC") + dw1 := p.GetRegisterDW1() if dw1.GetIOStandbyState() != 0 || dw1.GetIOStandbyTermination() != 0 { // e.g. H1_PCH_INT_ODL // PAD_CFG_GPI_APIC_IOS(GPIO_63, NONE, DEEP, LEVEL, INVERT, TxDRxE, DISPUPD), - macro.Add("_IOS(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() + m.Add("_IOS(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() } else { // PAD_CFG_GPI_APIC(pad, pull, rst, trig, inv) - macro.Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") } - macro.Add("),") + m.Add("),") return true } // Generate macro to cause NMI when configured in GPIO input mode -func nmiRoute() bool { - macro := common.GetMacro() - if macro.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { +func nmiRoute(p *BasePlatform, m *common.Macro) bool { + if dw0 := p.GetRegisterDW0(); dw0.GetGPIOInputRouteNMI() == 0 { return false } // e.g. PAD_CFG_GPI_NMI(GPIO_24, UP_20K, DEEP, LEVEL, INVERT), - macro.Add("_NMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_NMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } // Generate macro to cause SCI when configured in GPIO input mode -func sciRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - dw1 := macro.GetRegisterDW1() +func sciRoute(p *BasePlatform, m *common.Macro) bool { + dw0 := p.GetRegisterDW0() if dw0.GetGPIOInputRouteSCI() == 0 { return false } + + dw1 := p.GetRegisterDW1() if dw1.GetIOStandbyState() != 0 || dw1.GetIOStandbyTermination() != 0 { // PAD_CFG_GPI_SCI_IOS(GPIO_141, NONE, DEEP, EDGE_SINGLE, INVERT, IGNORE, DISPUPD), - macro.Add("_SCI_IOS") - macro.Add("(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() + m.Add("_SCI_IOS") + m.Add("(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() } else if dw0.GetRXLevelEdgeConfiguration()&0x1 != 0 { // e.g. PAD_CFG_GPI_ACPI_SCI(GPP_G2, NONE, DEEP, YES), - macro.Add("_ACPI_SCI").Add("(").Id().Pull().Rstsrc().Invert() + m.Add("_ACPI_SCI").Add("(").Id().Pull().Rstsrc().Invert() } else { // e.g. PAD_CFG_GPI_SCI(GPP_B18, UP_20K, PLTRST, LEVEL, INVERT), - macro.Add("_SCI").Add("(").Id().Pull().Rstsrc().Trig().Invert() + m.Add("_SCI").Add("(").Id().Pull().Rstsrc().Trig().Invert() } - macro.Add("),") + m.Add("),") return true } // Generate macro to cause SMI when configured in GPIO input mode -func smiRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - dw1 := macro.GetRegisterDW1() +func smiRoute(p *BasePlatform, m *common.Macro) bool { + dw0 := p.GetRegisterDW0() if dw0.GetGPIOInputRouteSMI() == 0 { return false } + dw1 := p.GetRegisterDW1() if dw1.GetIOStandbyState() != 0 || dw1.GetIOStandbyTermination() != 0 { // PAD_CFG_GPI_SMI_IOS(GPIO_41, UP_20K, DEEP, EDGE_SINGLE, NONE, IGNORE, SAME), - macro.Add("_SMI_IOS") - macro.Add("(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() + m.Add("_SMI_IOS") + m.Add("(").Id().Pull().Rstsrc().Trig().Invert().IOSstate().IOTerm() } else if dw0.GetRXLevelEdgeConfiguration()&0x1 != 0 { // e.g. PAD_CFG_GPI_ACPI_SMI(GPP_I3, NONE, DEEP, YES), - macro.Add("_ACPI_SMI").Add("(").Id().Pull().Rstsrc().Invert() + m.Add("_ACPI_SMI").Add("(").Id().Pull().Rstsrc().Invert() } else { // e.g. PAD_CFG_GPI_SMI(GPP_E3, NONE, PLTRST, EDGE_SINGLE, NONE), - macro.Add("_SMI").Add("(").Id().Pull().Rstsrc().Trig().Invert() + m.Add("_SMI").Add("(").Id().Pull().Rstsrc().Trig().Invert() } - macro.Add("),") + m.Add("),") return true } -// Generate macro for GPI port -func (PlatformSpecific) GpiMacroAdd() { +// AddGpiMacro() adds PAD_CFG_GPI macro with arguments +func (p *BasePlatform) AddGpiMacro(m *common.Macro) { var ids []string - macro := common.GetMacro() - macro.Set("PAD_CFG_GPI") - for routeid, isRoute := range map[string]func() bool{ + m.Set("PAD_CFG_GPI") + for routeid, isRoute := range map[string]func(*BasePlatform, *common.Macro) bool{ "IOAPIC": ioApicRoute, "SCI": sciRoute, "SMI": smiRoute, "NMI": nmiRoute, } { - if isRoute() { + if isRoute(p, m) { ids = append(ids, routeid) } } switch config, argc := p2m.Config, len(ids); argc { case 0: - dw1 := macro.GetRegisterDW1() + dw1 := p.GetRegisterDW1() isIOStandbyStateUsed := dw1.GetIOStandbyState() != 0 isIOStandbyTerminationUsed := dw1.GetIOStandbyTermination() != 0 if isIOStandbyStateUsed && !isIOStandbyTerminationUsed { - macro.Add("_TRIG_IOSSTATE_OWN(") + m.Add("_TRIG_IOSSTATE_OWN(") // PAD_CFG_GPI_TRIG_IOSSTATE_OWN(pad, pull, rst, trig, iosstate, own) - macro.Id().Pull().Rstsrc().Trig().IOSstate().Own().Add("),") + m.Id().Pull().Rstsrc().Trig().IOSstate().Own().Add("),") } else if isIOStandbyTerminationUsed { - macro.Add("_TRIG_IOS_OWN(") + m.Add("_TRIG_IOS_OWN(") // PAD_CFG_GPI_TRIG_IOS_OWN(pad, pull, rst, trig, iosstate, iosterm, own) - macro.Id().Pull().Rstsrc().Trig().IOSstate().IOTerm().Own().Add("),") + m.Id().Pull().Rstsrc().Trig().IOSstate().IOTerm().Own().Add("),") } else { // PAD_CFG_GPI_TRIG_OWN(pad, pull, rst, trig, own) - macro.Add("_TRIG_OWN(").Id().Pull().Rstsrc().Trig().Own().Add("),") + m.Add("_TRIG_OWN(").Id().Pull().Rstsrc().Trig().Own().Add("),") } case 1: // GPI with IRQ route if config.IgnoredFields { - macro.SetPadOwnership(common.PAD_OWN_ACPI) + m.SetOwnershipAcpi() } case 2: // PAD_CFG_GPI_DUAL_ROUTE(pad, pull, rst, trig, inv, route1, route2) - macro.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() - macro.Add(", " + ids[0] + ", " + ids[1] + "),") + m.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() + m.Add(", " + ids[0] + ", " + ids[1] + "),") if config.IgnoredFields { - macro.SetPadOwnership(common.PAD_OWN_ACPI) + m.SetOwnershipAcpi() } default: // Clear the control mask so that the check fails and "Advanced" macro is // generated - macro.GetRegisterDW0().CntrMaskFieldsClear(bits.All32) + dw0 := p.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) } } -// Adds PAD_CFG_GPO macro with arguments -func (PlatformSpecific) GpoMacroAdd() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - dw1 := macro.GetRegisterDW1() - term := dw1.GetTermination() - - macro.Set("PAD_CFG") +// AddGpoMacro() adds PAD_CFG_GPO macro with arguments +func (p *BasePlatform) AddGpoMacro(m *common.Macro) { + m.Set("PAD_CFG") + dw1 := p.GetRegisterDW1() if dw1.GetIOStandbyState() != 0 || dw1.GetIOStandbyTermination() != 0 { // PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_91, 0, DEEP, NONE, Tx0RxDCRx0, DISPUPD), // PAD_CFG_GPO_IOSSTATE_IOSTERM(pad, val, rst, pull, iosstate, ioterm) - macro.Add("_GPO_IOSSTATE_IOSTERM(").Id().Val().Rstsrc().Pull().IOSstate().IOTerm() + m.Add("_GPO_IOSSTATE_IOSTERM(").Id().Val().Rstsrc().Pull().IOSstate().IOTerm() } else { + term := dw1.GetTermination() if term != 0 { // e.g. PAD_CFG_TERM_GPO(GPP_B23, 1, DN_20K, DEEP), // PAD_CFG_TERM_GPO(pad, val, pull, rst) - macro.Add("_TERM") + m.Add("_TERM") } - macro.Add("_GPO(").Id().Val() + m.Add("_GPO(").Id().Val() if term != 0 { - macro.Pull() + m.Pull() } - macro.Rstsrc() + m.Rstsrc() } - macro.Add("),") + m.Add("),") - if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { + if dw0 := p.GetRegisterDW0(); dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { // ignore if trig = OFF is not set dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0RxLevelEdgeConfiguration]) } } -// Adds PAD_CFG_NF macro with arguments -func (PlatformSpecific) NativeFunctionMacroAdd() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() +// AddNativeFunctionMacro() adds PAD_CFG_NF macro with arguments +func (p *BasePlatform) AddNativeFunctionMacro(m *common.Macro) { + m.Set("PAD_CFG_NF") + dw1 := p.GetRegisterDW1() isIOStandbyStateUsed := dw1.GetIOStandbyState() != 0 isIOStandbyTerminationUsed := dw1.GetIOStandbyTermination() != 0 - - macro.Set("PAD_CFG_NF") if !isIOStandbyTerminationUsed && isIOStandbyStateUsed { if dw1.GetIOStandbyState() == bits.IOStateStandbyIgnore { // PAD_CFG_NF_IOSTANDBY_IGNORE(PMU_SLP_S0_B, NONE, DEEP, NF1), - macro.Add("_IOSTANDBY_IGNORE(").Id().Pull().Rstsrc().Padfn() + m.Add("_IOSTANDBY_IGNORE(").Id().Pull().Rstsrc().Padfn() } else { // PAD_CFG_NF_IOSSTATE(GPIO_22, UP_20K, DEEP, NF2, TxDRxE), - macro.Add("_IOSSTATE(").Id().Pull().Rstsrc().Padfn().IOSstate() + m.Add("_IOSSTATE(").Id().Pull().Rstsrc().Padfn().IOSstate() } } else if isIOStandbyTerminationUsed { // PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_103, NATIVE, DEEP, NF1, MASK, SAME), - macro.Add("_IOSSTATE_IOSTERM(").Id().Pull().Rstsrc().Padfn().IOSstate().IOTerm() + m.Add("_IOSSTATE_IOSTERM(").Id().Pull().Rstsrc().Padfn().IOSstate().IOTerm() } else { // e.g. PAD_CFG_NF(GPP_D23, NONE, DEEP, NF1) - macro.Add("(").Id().Pull().Rstsrc().Padfn() + m.Add("(").Id().Pull().Rstsrc().Padfn() } - macro.Add("),") + m.Add("),") - if dw0 := macro.GetRegisterDW0(); dw0.GetGPIORxTxDisableStatus() != 0 { + if dw0 := p.GetRegisterDW0(); dw0.GetGPIORxTxDisableStatus() != 0 { // Since the bufbis parameter will be ignored for NF, we should clear // the corresponding bits in the control mask. dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0RxTxBufDisable]) } } -// Adds PAD_NC macro -func (PlatformSpecific) NoConnMacroAdd() { - macro := common.GetMacro() - - dw0, dw1 := macro.GetRegisterDW0(), macro.GetRegisterDW1() - if dw1.GetIOStandbyState() == bits.IOStateTxDRxE { - - // See comments in sunrise/macro.go : NoConnMacroAdd() +// AddNoConnMacro() adds PAD_NC macro +func (p *BasePlatform) AddNoConnMacro(m *common.Macro) { + if dw1 := p.GetRegisterDW1(); dw1.GetIOStandbyState() == bits.IOStateTxDRxE { + dw0 := p.GetRegisterDW0() + // See comments in sunrise/m.go : AddNoConnMacro() if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0RxLevelEdgeConfiguration]) } if dw0.GetResetConfig() != 1 { // 1 = RST_DEEP dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0PadRstCfg]) } - // PAD_NC(OSC_CLK_OUT_1, DN_20K) - macro.Set("PAD_NC").Add("(").Id().Pull().Add("),") + m.Set("PAD_NC").Add("(").Id().Pull().Add("),") return } // PAD_CFG_GPIO_HI_Z(GPIO_81, UP_20K, DEEP, HIZCRx0, DISPUPD), - macro.Set("PAD_CFG_GPIO_") - if macro.IsOwnershipDriver() { + if m.Set("PAD_CFG_GPIO_"); m.IsOwnershipDriver() { // PAD_CFG_GPIO_DRIVER_HI_Z(GPIO_55, UP_20K, DEEP, HIZCRx1, ENPU), - macro.Add("DRIVER_") + m.Add("DRIVER_") } - macro.Add("HI_Z(").Id().Pull().Rstsrc().IOSstate().IOTerm().Add("),") -} - -// GenMacro - generate pad macro -// dw0Val : DW0 config register value -// dw1Val : DW1 config register value -// return: string of macro -func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{}, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() + m.Add("HI_Z(").Id().Pull().Rstsrc().IOSstate().IOTerm().Add("),") } diff --git a/util/intelp2m/platforms/apl/template.go b/util/intelp2m/platforms/apl/template.go index 36040cab96..014431d18a 100644 --- a/util/intelp2m/platforms/apl/template.go +++ b/util/intelp2m/platforms/apl/template.go @@ -2,10 +2,9 @@ package apl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func (PlatformSpecific) KeywordCheck(line string) bool { +// CheckKeyword() parses lines of the configuration file and returns true if the keyword is +// contained in the line +func CheckKeyword(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPIO_", "TCK", "TRST_B", "TMS", "TDI", "CX_PMODE", "CX_PREQ_B", "JTAGX", "CX_PRDY_B", "TDO", "CNV_BRI_DT", "CNV_BRI_RSP", "CNV_RGI_DT", "CNV_RGI_RSP", "SVID0_ALERT_B", diff --git a/util/intelp2m/platforms/cnl/cnl_test.go b/util/intelp2m/platforms/cnl/cnl_test.go index e7fe0d546f..8efaedf117 100644 --- a/util/intelp2m/platforms/cnl/cnl_test.go +++ b/util/intelp2m/platforms/cnl/cnl_test.go @@ -3,105 +3,103 @@ package cnl_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - cannonlake := cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - } + p2m.Config.Platform = p2m.Cannon test.Suite{ { - Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A1, DN_20K, PWROK, NF4),", Long: "_PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF4) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(DN_20K) | PAD_IOSSTATE(Tx1RxDCRx1) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(GPP_B2, 0, INVALID, PWROK),", Long: "_PAD_CFG_STRUCT(GPP_B2, PAD_FUNC(GPIO) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_G3", DW0: 0x44444444, DW1: 0x44444444, Ownership: 1}, + Pad: test.Pad{ID: "GPP_G3", DW0: 0x44444444, DW1: 0x44444444, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_G3, INVALID, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_G3, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SMI), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx0RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_D4, DN_5K, PLTRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_D4, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT), PAD_PULL(DN_5K) | PAD_IOSSTATE(Tx0RxDCRx1)),", }, }, - }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST", cannonlake) + }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_F5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, + Pad: test.Pad{ID: "GPP_F5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_F5, UP_2K, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_F5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_H6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: 0}, + Pad: test.Pad{ID: "GPP_H6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_H6, INVALID, RSMRST, NF7),", Long: "_PAD_CFG_STRUCT(GPP_H6, PAD_FUNC(NF7) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx0) | PAD_IOSTERM(DISPUPD)),", }, }, { - Pad: test.Pad{ID: "GPD7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, + Pad: test.Pad{ID: "GPD7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPD7, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPD7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_C8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C8", DW0: 0x77777777, DW1: 0x77777777, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_C8, UP_667, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPP_C8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, - }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", cannonlake) + }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_E9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E9", DW0: 0x33333333, DW1: 0x33333333, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E9, UP_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_E9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_A10", DW0: 0x66666666, DW1: 0x66666666, Ownership: 0}, + Pad: test.Pad{ID: "GPP_A10", DW0: 0x66666666, DW1: 0x66666666, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_A10, UP_1K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_A10, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_1K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_B11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: 1}, + Pad: test.Pad{ID: "GPP_B11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_B11, INVALID, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_B11, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_G12", DW0: 0x99999999, DW1: 0x99999999, Ownership: 0}, + Pad: test.Pad{ID: "GPP_G12", DW0: 0x99999999, DW1: 0x99999999, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_G12, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_G12, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxE) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST", cannonlake) + }.Run(t, "INTEL-CANNON-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST") } diff --git a/util/intelp2m/platforms/cnl/macro.go b/util/intelp2m/platforms/cnl/macro.go index ab524f5e15..7f5421510c 100644 --- a/util/intelp2m/platforms/cnl/macro.go +++ b/util/intelp2m/platforms/cnl/macro.go @@ -1,149 +1,140 @@ package cnl import ( - "fmt" "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask uint32 = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask uint32 = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Sunrise platform + snr.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro - InheritanceTemplate +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{snr.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - if strings.Contains(macro.PadIdGet(), "GPP_A") || - strings.Contains(macro.PadIdGet(), "GPP_B") || - strings.Contains(macro.PadIdGet(), "GPP_G") { +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override BasePlatform.RemapRstSrc() +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + if strings.Contains(m.GetPadId(), "GPP_A") || + strings.Contains(m.GetPadId(), "GPP_B") || + strings.Contains(m.GetPadId(), "GPP_G") { // See reset map for the Cannonlake Groups the Community 0: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/cannonlake/gpio.c#L14 // remmap is not required because it is the same as common. return } - dw0 := macro.GetRegisterDW0() - var remapping = map[uint32]uint32{ - 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + dw0 := p.GetRegisterDW0() + remapping := map[uint32]uint32{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + source, valid := remapping[dw0.GetResetConfig()] if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (PlatformSpecific) Pull() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() +// Override BasePlatform.Pull() +func (p *BasePlatform) Pull(m *common.Macro) { + dw1 := p.GetRegisterDW1() var pull = map[uint32]string{ - 0x0: "NONE", - 0x2: "DN_5K", - 0x4: "DN_20K", - 0x9: "UP_1K", - 0xa: "UP_5K", - 0xb: "UP_2K", - 0xc: "UP_20K", - 0xd: "UP_667", - 0xf: "NATIVE", + 0b0000: "NONE", + 0b0010: "DN_5K", + 0b0100: "DN_20K", + 0b1001: "UP_1K", + 0b1010: "UP_5K", + 0b1011: "UP_2K", + 0b1100: "UP_20K", + 0b1101: "UP_667", + 0b1111: "NATIVE", } - str, valid := pull[dw1.GetTermination()] + term, valid := pull[dw1.GetTermination()] if !valid { - str = "INVALID" - fmt.Println("Error", - macro.PadIdGet(), - " invalid TERM value = ", - int(dw1.GetTermination())) + term = "INVALID" + logs.Errorf("%s: DW1 %s: invalid termination value 0b%b", + dw1, m.GetPadId(), dw1.GetTermination()) } - macro.Separator().Add(str) + m.Separator().Add(term) } -// Generate macro to cause peripheral IRQ when configured in GPIO input mode -func ioApicRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() +// ioApicRoute() generate macro to cause peripheral IRQ when configured in GPIO input mode +func ioApicRoute(p *BasePlatform, m *common.Macro) bool { + dw0 := p.GetRegisterDW0() if dw0.GetGPIOInputRouteIOxAPIC() == 0 { return false } - macro.Add("_APIC") + m.Add("_APIC") // PAD_CFG_GPI_APIC(pad, pull, rst, trig, inv) - macro.Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Generate macro to cause NMI when configured in GPIO input mode -func nmiRoute() bool { - macro := common.GetMacro() - if macro.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { +// nmiRoute() generate macro to cause NMI when configured in GPIO input mode +func nmiRoute(p *BasePlatform, m *common.Macro) bool { + if dw0 := p.GetRegisterDW0(); dw0.GetGPIOInputRouteNMI() == 0 { return false } // PAD_CFG_GPI_NMI(GPIO_24, UP_20K, DEEP, LEVEL, INVERT), - macro.Add("_NMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_NMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Generate macro to cause SCI when configured in GPIO input mode -func sciRoute() bool { - macro := common.GetMacro() - if macro.GetRegisterDW0().GetGPIOInputRouteSCI() == 0 { +// sciRoute() generate macro to cause SCI when configured in GPIO input mode +func sciRoute(p *BasePlatform, m *common.Macro) bool { + if dw0 := p.GetRegisterDW0(); dw0.GetGPIOInputRouteSCI() == 0 { return false } // PAD_CFG_GPI_SCI(pad, pull, rst, trig, inv) - macro.Add("_SCI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_SCI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Generate macro to cause SMI when configured in GPIO input mode -func smiRoute() bool { - macro := common.GetMacro() - - if macro.GetRegisterDW0().GetGPIOInputRouteSMI() == 0 { +// smiRoute() generates macro to cause SMI when configured in GPIO input mode +func smiRoute(p *BasePlatform, m *common.Macro) bool { + if dw0 := p.GetRegisterDW0(); dw0.GetGPIOInputRouteSMI() == 0 { return false } // PAD_CFG_GPI_SMI(pad, pull, rst, trig, inv) - macro.Add("_SMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_SMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Adds PAD_CFG_GPI macro with arguments -func (PlatformSpecific) GpiMacroAdd() { - macro := common.GetMacro() +// Override BasePlatform.AddGpiMacro() +func (p *BasePlatform) AddGpiMacro(m *common.Macro) { var ids []string - macro.Set("PAD_CFG_GPI") - for routeid, isRoute := range map[string]func() bool{ + m.Set("PAD_CFG_GPI") + for routeid, isRoute := range map[string]func(*BasePlatform, *common.Macro) bool{ "IOAPIC": ioApicRoute, "SCI": sciRoute, "SMI": smiRoute, "NMI": nmiRoute, } { - if isRoute() { + if isRoute(p, m) { ids = append(ids, routeid) } } @@ -151,69 +142,26 @@ func (PlatformSpecific) GpiMacroAdd() { switch argc := len(ids); argc { case 0: // e.g. PAD_CFG_GPI_TRIG_OWN(pad, pull, rst, trig, own) - macro.Add("_TRIG_OWN").Add("(").Id().Pull().Rstsrc().Trig().Own().Add("),") + m.Add("_TRIG_OWN").Add("(").Id().Pull().Rstsrc().Trig().Own().Add("),") case 1: // GPI with IRQ route if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode - macro.SetPadOwnership(common.PAD_OWN_ACPI) + m.SetOwnershipAcpi() } case 2: // PAD_CFG_GPI_DUAL_ROUTE(pad, pull, rst, trig, inv, route1, route2) - macro.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() - macro.Add(", " + ids[0] + ", " + ids[1] + "),") + m.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() + m.Add(", " + ids[0] + ", " + ids[1] + "),") if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode - macro.SetPadOwnership(common.PAD_OWN_ACPI) + m.SetOwnershipAcpi() } default: // Clear the control mask so that the check fails and "Advanced" macro is // generated - macro.GetRegisterDW0().CntrMaskFieldsClear(bits.All32) + dw0 := p.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) } } - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0Val : DW0 config register value -// dw1Val : DW1 config register value -// return: string of macro -func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() -} diff --git a/util/intelp2m/platforms/cnl/template.go b/util/intelp2m/platforms/cnl/template.go index 886a59a920..4c4192d6cc 100644 --- a/util/intelp2m/platforms/cnl/template.go +++ b/util/intelp2m/platforms/cnl/template.go @@ -1,14 +1,11 @@ package cnl -type InheritanceTemplate interface { - KeywordCheck(line string) bool -} +import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// Group: "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPD", "GPP_C", "GPP_E" - -// KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func (platform PlatformSpecific) KeywordCheck(line string) bool { - return platform.InheritanceTemplate.KeywordCheck(line) +// CheckKeyword() parses lines of the configuration file and returns true if the keyword is +// contained in the line +// "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPD", "GPP_C", "GPP_E" +func CheckKeyword(line string) bool { + included, _ := common.KeywordsCheck(line, "GPP_", "GPD") + return included } diff --git a/util/intelp2m/platforms/common/common.go b/util/intelp2m/platforms/common/common.go new file mode 100644 index 0000000000..57719842ca --- /dev/null +++ b/util/intelp2m/platforms/common/common.go @@ -0,0 +1,25 @@ +package common + +import ( + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register" +) + +type BasePlatform struct { + dw0 register.DW0 + dw1 register.DW1 +} + +func InitBasePlatform(dw0, dw0Mask uint32, dw1, dw1Mask uint32) BasePlatform { + return BasePlatform{ + register.SetVal[register.DW0](dw0, dw0Mask), + register.SetVal[register.DW1](dw1, dw1Mask), + } +} + +func (p *BasePlatform) GetRegisterDW0() *register.DW0 { + return &p.dw0 +} + +func (p *BasePlatform) GetRegisterDW1() *register.DW1 { + return &p.dw1 +} diff --git a/util/intelp2m/platforms/common/macro.go b/util/intelp2m/platforms/common/macro.go index 56b147cee2..0f544acb08 100644 --- a/util/intelp2m/platforms/common/macro.go +++ b/util/intelp2m/platforms/common/macro.go @@ -3,133 +3,113 @@ package common import ( "fmt" "strconv" - "sync" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) -type Fields interface { - DecodeDW0() - DecodeDW1() - GenerateString() -} - const ( - PAD_OWN_ACPI = 0 - PAD_OWN_DRIVER = 1 + Driver bool = true + Acpi bool = false ) -// PlatformSpecific - platform-specific interface -type PlatformSpecific interface { - RemmapRstSrc() - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type FieldsIf interface { + DecodeDW0(*Macro) *Macro + DecodeDW1(*Macro) *Macro + GenerateMacro(*Macro) *Macro +} + +type PlatformIf interface { + RemapRstSrc(*Macro) + Pull(*Macro) + AddGpiMacro(*Macro) + AddGpoMacro(*Macro) + AddNativeFunctionMacro(*Macro) + AddNoConnMacro(*Macro) + GetRegisterDW0() *register.DW0 + GetRegisterDW1() *register.DW1 } -// Macro - contains macro information and methods -// Platform : platform-specific interface -// padID : pad ID string -// str : macro string entirely -// Reg : structure of configuration register values and their masks type Macro struct { - Platform PlatformSpecific - DW0 register.DW0 - DW1 register.DW1 - padID string - str string - ownership uint8 - Fields + line string + id string + ownership bool + Platform PlatformIf + Fields FieldsIf } -var instanceMacro *Macro -var once sync.Once - -// GetInstance returns singleton -func GetInstanceMacro(p PlatformSpecific, f Fields) *Macro { - once.Do(func() { - instanceMacro = &Macro{Platform: p, Fields: f} - }) - return instanceMacro -} - -func GetMacro() *Macro { - return GetInstanceMacro(nil, nil) -} - -func (macro *Macro) PadIdGet() string { - return macro.padID -} - -func (macro *Macro) PadIdSet(padid string) *Macro { - macro.padID = padid - return macro -} - -func (macro *Macro) SetPadOwnership(own uint8) *Macro { - macro.ownership = own - return macro -} - -func (macro *Macro) IsOwnershipDriver() bool { - return macro.ownership == PAD_OWN_DRIVER -} - -func (macro *Macro) GetRegisterDW0() *register.DW0 { - return ¯o.DW0 -} - -func (macro *Macro) GetRegisterDW1() *register.DW1 { - return ¯o.DW1 -} - -// add a string to macro -func (macro *Macro) Add(str string) *Macro { - macro.str += str - return macro -} - -// set a string in a macro instead of its previous contents -func (macro *Macro) Set(str string) *Macro { - macro.str = str - return macro -} - -// get macro string -func (macro *Macro) Get() string { - return macro.str -} - -// set a string in a macro instead of its previous contents -func (macro *Macro) Clear() *Macro { - macro.Set("") - return macro -} - -// Adds PAD Id to the macro as a new argument -// return: Macro -func (macro *Macro) Id() *Macro { - return macro.Add(macro.padID) -} - -// Add Separator to macro if needed -func (macro *Macro) Separator() *Macro { - str := macro.Get() - c := str[len(str)-1] - if c != '(' && c != '_' { - macro.Add(", ") +func CreateFrom(id string, ownership bool, pi PlatformIf, fi FieldsIf) Macro { + return Macro{ + id: id, + ownership: ownership, + Platform: pi, + Fields: fi, } - return macro } -// Adds the PADRSTCFG parameter from DW0 to the macro as a new argument -// return: Macro -func (macro *Macro) Rstsrc() *Macro { - dw0 := macro.GetRegisterDW0() +func (m *Macro) String() string { + return m.line +} + +func (m *Macro) GetPadId() string { + return m.id +} + +func (m Macro) IsOwnershipDriver() bool { + return m.ownership +} + +func (m *Macro) SetOwnershipAcpi() { + m.ownership = Acpi +} + +func (m *Macro) SetOwnershipDriver() { + m.ownership = Driver +} + +func (m *Macro) Add(str string) *Macro { + m.line += str + return m +} + +func (m *Macro) Set(str string) *Macro { + m.line = str + return m +} + +func (m *Macro) Clear() *Macro { + m.line = "" + return m +} + +// Id() adds Pad Id to the macro string +func (m *Macro) Id() *Macro { + return m.Add(m.id) +} + +// Separator() adds separator ", " to macro if needed +func (m *Macro) Separator() *Macro { + line := m.line + c := line[len(line)-1] + if c != '(' && c != '_' { + m.Add(", ") + } + return m +} + +// or - Set " | " if its needed +func (m *Macro) Or() *Macro { + if str := m.line; str[len(str)-1] == ')' { + m.Add(" | ") + } + return m +} + +// Rstsrc() adds PADRSTCFG parameter +func (m *Macro) Rstsrc() *Macro { + dw0 := m.Platform.GetRegisterDW0() resetsrc := map[uint32]string{ 0b00: "PWROK", 0b01: "DEEP", @@ -138,29 +118,28 @@ func (macro *Macro) Rstsrc() *Macro { } source, exist := resetsrc[dw0.GetResetConfig()] if !exist { + logs.Errorf("%s: ResetConfig error: map does not contain %d", + m.id, dw0.GetResetConfig()) source = "ERROR" } - return macro.Separator().Add(source) + return m.Separator().Add(source) } -// Adds The Pad Termination (TERM) parameter from DW1 to the macro as a new argument -// return: Macro -func (macro *Macro) Pull() *Macro { - macro.Platform.Pull() - return macro +// Pull() adds Pad Termination TERM parameter +func (m *Macro) Pull() *Macro { + m.Platform.Pull(m) + return m } -// Adds Pad GPO value to macro string as a new argument -// return: Macro -func (macro *Macro) Val() *Macro { - dw0 := macro.GetRegisterDW0() - return macro.Separator().Add(strconv.Itoa(int(dw0.GetGPIOTXState()))) +// Val() adds pad GPO value to macro string +func (m *Macro) Val() *Macro { + dw0 := m.Platform.GetRegisterDW0() + return m.Separator().Add(strconv.Itoa(int(dw0.GetGPIOTXState()))) } -// Adds Pad GPO value to macro string as a new argument -// return: Macro -func (macro *Macro) Trig() *Macro { - dw0 := macro.GetRegisterDW0() +// Trig() adds Pad GPO value to macro string +func (m *Macro) Trig() *Macro { + dw0 := m.Platform.GetRegisterDW0() trig := map[uint32]string{ 0b00: "LEVEL", 0b01: "EDGE_SINGLE", @@ -169,24 +148,24 @@ func (macro *Macro) Trig() *Macro { } level, exist := trig[dw0.GetRXLevelEdgeConfiguration()] if !exist { + logs.Errorf("%s: RXLevelEdgeConfig error: map does not contain %d", + m.id, dw0.GetRXLevelEdgeConfiguration()) level = "ERROR" } - return macro.Separator().Add(level) + return m.Separator().Add(level) } -// Adds Pad Polarity Inversion Stage (RXINV) to macro string as a new argument -// return: Macro -func (macro *Macro) Invert() *Macro { - if macro.GetRegisterDW0().GetRxInvert() != 0 { - return macro.Separator().Add("INVERT") +// Invert() adds Pad Polarity Inversion Stage (RXINV) to macro string +func (m *Macro) Invert() *Macro { + if dw0 := m.Platform.GetRegisterDW0(); dw0.GetRxInvert() != 0 { + return m.Separator().Add("INVERT") } - return macro.Separator().Add("NONE") + return m.Separator().Add("NONE") } -// Adds input/output buffer state -// return: Macro -func (macro *Macro) Bufdis() *Macro { - dw0 := macro.GetRegisterDW0() +// Bufdis() adds input/output buffer state +func (m *Macro) Bufdis() *Macro { + dw0 := m.Platform.GetRegisterDW0() states := map[uint32]string{ 0b00: "NO_DISABLE", // both buffers are enabled 0b01: "TX_DISABLE", // output buffer is disabled @@ -195,34 +174,33 @@ func (macro *Macro) Bufdis() *Macro { } state, exist := states[dw0.GetGPIORxTxDisableStatus()] if !exist { + logs.Errorf("%s: GPIORxTxDisableStatus error: map does not contain %d", + m.id, dw0.GetGPIORxTxDisableStatus()) state = "ERROR" } - return macro.Separator().Add(state) + return m.Separator().Add(state) } -// Adds macro to set the host software ownership -// return: Macro -func (macro *Macro) Own() *Macro { - if macro.IsOwnershipDriver() { - return macro.Separator().Add("DRIVER") +// Own() adds macro to set the host software ownership +func (m *Macro) Own() *Macro { + if m.IsOwnershipDriver() { + return m.Separator().Add("DRIVER") } - return macro.Separator().Add("ACPI") + return m.Separator().Add("ACPI") } -// Adds pad native function (PMODE) as a new argument -// return: Macro -func (macro *Macro) Padfn() *Macro { - dw0 := macro.GetRegisterDW0() +// Padfn() adds pad native function (PMODE) +func (m *Macro) Padfn() *Macro { + dw0 := m.Platform.GetRegisterDW0() if number := dw0.GetPadMode(); number != 0 { - return macro.Separator().Add(fmt.Sprintf("NF%d", number)) + return m.Separator().Add(fmt.Sprintf("NF%d", number)) } // GPIO used only for PAD_FUNC(x) macro - return macro.Add("GPIO") + return m.Add("GPIO") } -// Add a line to the macro that defines IO Standby State -// return: macro -func (macro *Macro) IOSstate() *Macro { +// IOSstate() adds a line to the macro that defines IO Standby State +func (m *Macro) IOSstate() *Macro { states := map[uint32]string{ bits.IOStateTxLASTRxE: "TxLASTRxE", bits.IOStateTx0RxDCRx0: "Tx0RxDCRx0", @@ -236,19 +214,19 @@ func (macro *Macro) IOSstate() *Macro { bits.IOStateTxDRxE: "TxDRxE", bits.IOStateStandbyIgnore: "IGNORE", } - dw1 := macro.GetRegisterDW1() + dw1 := m.Platform.GetRegisterDW1() state, exist := states[dw1.GetIOStandbyState()] if !exist { - // ignore setting for incorrect value + logs.Errorf("%s: IOStandbyState error: map does not contain %d", + m.id, dw1.GetIOStandbyState()) state = "ERROR" } - return macro.Separator().Add(state) + return m.Separator().Add(state) } -// Add a line to the macro that defines IO Standby Termination -// return: macro -func (macro *Macro) IOTerm() *Macro { - dw1 := macro.GetRegisterDW1() +// IOTerm() add a line to the macro that defines IO Standby Termination +func (m *Macro) IOTerm() *Macro { + dw1 := m.Platform.GetRegisterDW1() terminations := map[uint32]string{ bits.IOTermSAME: "SAME", bits.IOTermDISPUPD: "DISPUPD", @@ -257,87 +235,94 @@ func (macro *Macro) IOTerm() *Macro { } termination, exist := terminations[dw1.GetIOStandbyTermination()] if !exist { + logs.Errorf("%s: IOStandbyTermination error: map does not contain %d", + m.id, dw1.GetIOStandbyTermination()) termination = "ERROR" } - return macro.Separator().Add(termination) + return m.Separator().Add(termination) } // Check created macro -func (macro *Macro) check() *Macro { - dw0 := macro.GetRegisterDW0() +func (m *Macro) Check() *Macro { + dw0 := m.Platform.GetRegisterDW0() if !dw0.MaskCheck() { - return macro.GenerateFields() + return m.GenerateFields() } - return macro + return m } -// or - Set " | " if its needed -func (macro *Macro) Or() *Macro { - if str := macro.Get(); str[len(str)-1] == ')' { - macro.Add(" | ") - } - return macro -} - -func (macro *Macro) DecodeIgnoredFieldsDW0() *Macro { +func (m *Macro) DecodeIgnoredFieldsDW0() *Macro { if p2m.Config.Field == p2m.FspFlds { - return macro + logs.Infof("%s: decoding of extracted fields is not applied for fsp", m.id) + return m + } else if m.Fields == nil { + logs.Errorf("%s: field collection is not set in the macro structure", m.id) + return m } - dw0 := macro.GetRegisterDW0() + + dw0 := m.Platform.GetRegisterDW0() if ignored := dw0.IgnoredFieldsGet(); ignored != 0 { saved := dw0.Value dw0.Value = ignored - macro.Add("/* DW0: ") - macro.Fields.DecodeDW0() - macro.Add(" - IGNORED */\n") + m.Add("/* DW0: ").Fields.DecodeDW0(m).Add(" - IGNORED */\n") dw0.Value = saved } - return macro + + return m } -func (macro *Macro) DecodeIgnoredFieldsDW1() *Macro { +func (m *Macro) DecodeIgnoredFieldsDW1() *Macro { if p2m.Config.Field == p2m.FspFlds { - return macro + logs.Infof("%s: decoding of extracted fields is not applied for fsp", m.id) + return m + } else if m.Fields == nil { + logs.Errorf("%s: field collection is not set in the macro structure", m.id) + return m } - dw1 := macro.GetRegisterDW1() + + dw1 := m.Platform.GetRegisterDW1() if ignored := dw1.IgnoredFieldsGet(); ignored != 0 { saved := dw1.Value dw1.Value = ignored - macro.Add("/* DW0: ") - macro.DecodeDW1() - macro.Add(" - IGNORED */\n") + m.Add("/* DW1: ").Fields.DecodeDW1(m).Add(" - IGNORED */\n") dw1.Value = saved } - return macro + + return m } -// GenerateFields - generate bitfield macros -func (macro *Macro) GenerateFields() *Macro { - dw0 := macro.GetRegisterDW0() - dw1 := macro.GetRegisterDW1() +// GenerateFields() generates bitfield macros +func (m *Macro) GenerateFields() *Macro { + if m.Fields == nil { + logs.Errorf("%s: field collection is not set in the macro structure", m.id) + return m + } + + dw0 := m.Platform.GetRegisterDW0() + dw1 := m.Platform.GetRegisterDW1() // Get mask of ignored bit fields. dw0Ignored := dw0.IgnoredFieldsGet() dw1Ignored := dw1.IgnoredFieldsGet() if p2m.Config.GenLevel != 4 { - macro.Clear() + m.Clear() } if p2m.Config.GenLevel >= 3 { - // Add string of reference macro as a comment - reference := macro.Get() - macro.Clear() + // Add string of reference m as a comment + reference := m.line + m.Clear() /* DW0 : PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */ - macro.DecodeIgnoredFieldsDW0() - macro.DecodeIgnoredFieldsDW1() + m.DecodeIgnoredFieldsDW0() + m.DecodeIgnoredFieldsDW1() if p2m.Config.GenLevel >= 4 { /* PAD_CFG_NF(GPP_B23, 20K_PD, PLTRST, NF2), */ - macro.Add("/* ").Add(reference).Add(" */\n") + m.Add("/* ").Add(reference).Add(" */\n") } } if p2m.Config.IgnoredFields { // Consider bit fields that should be ignored when regenerating - // advansed macros + // advansed ms tempVal := dw0.Value & ^dw0Ignored dw0.Value = tempVal @@ -345,76 +330,72 @@ func (macro *Macro) GenerateFields() *Macro { dw1.Value = tempVal } - macro.Fields.GenerateString() - return macro + return m.Fields.GenerateMacro(m) } -// Generate macro for bi-directional GPIO port -func (macro *Macro) Bidirection() { - dw1 := macro.GetRegisterDW1() +// Bidirection() generates macro for bi-directional GPIO port +func (m *Macro) Bidirection() { + dw1 := m.Platform.GetRegisterDW1() ios := dw1.GetIOStandbyState() != 0 || dw1.GetIOStandbyTermination() != 0 - macro.Set("PAD_CFG_GPIO_BIDIRECT") + m.Set("PAD_CFG_GPIO_BIDIRECT") if ios { - macro.Add("_IOS") + m.Add("_IOS") } // PAD_CFG_GPIO_BIDIRECT(pad, val, pull, rst, trig, own) - macro.Add("(").Id().Val().Pull().Rstsrc().Trig() + m.Add("(").Id().Val().Pull().Rstsrc().Trig() if ios { // PAD_CFG_GPIO_BIDIRECT_IOS(pad, val, pull, rst, trig, iosstate, iosterm, own) - macro.IOSstate().IOTerm() + m.IOSstate().IOTerm() } - macro.Own().Add("),") + m.Own().Add("),") } -// Gets base string of current macro -// return: string of macro -func (macro *Macro) Generate() string { - const rxDisable uint32 = 0x2 - const txDisable uint32 = 0x1 - - macro.Platform.RemmapRstSrc() - macro.Set("PAD_CFG") - if dw0 := macro.GetRegisterDW0(); dw0.GetPadMode() == 0 { - // GPIO - switch dw0.GetGPIORxTxDisableStatus() { +// Generate() generates string of macro +func (m *Macro) Generate() string { + m.Platform.RemapRstSrc(m) + if dw0 := m.Platform.GetRegisterDW0(); dw0.GetPadMode() == 0 { + const txDisable uint32 = 0b01 + const rxDisable uint32 = 0b10 + switch m.Set("PAD_CFG"); dw0.GetGPIORxTxDisableStatus() { case txDisable: - macro.Platform.GpiMacroAdd() // GPI + m.Platform.AddGpiMacro(m) // GPI case rxDisable: - macro.Platform.GpoMacroAdd() // GPO + m.Platform.AddGpoMacro(m) // GPO case rxDisable | txDisable: - macro.Platform.NoConnMacroAdd() // NC + m.Platform.AddNoConnMacro(m) // NC default: - macro.Bidirection() + m.Bidirection() } } else { - macro.Platform.NativeFunctionMacroAdd() + m.Platform.AddNativeFunctionMacro(m) } if p2m.Config.Field != p2m.NoFlds { - // Clear control mask to generate advanced macro only - return macro.GenerateFields().Get() + // clear control mask to generate field collection macro + return m.GenerateFields().line } if !p2m.Config.AutoCheck { - body := macro.Get() + body := m.line if p2m.Config.GenLevel >= 3 { - macro.Clear() - macro.DecodeIgnoredFieldsDW0() - macro.DecodeIgnoredFieldsDW1() - comment := macro.Get() + if m.Fields == nil { + logs.Errorf("%s: field collection is not set in the macro structure", m.id) + return body + } + m.Clear() + m.DecodeIgnoredFieldsDW0() + m.DecodeIgnoredFieldsDW1() + comment := m.line if p2m.Config.GenLevel >= 4 { - macro.Clear().Add("/* ") - macro.Fields.GenerateString() - macro.Add(" */\n") - comment += macro.Get() + comment += m.Clear().Add("/* ").Fields.GenerateMacro(m).Add(" */\n").line } return comment + body } return body } - return macro.check().Get() + return m.Check().line } diff --git a/util/intelp2m/platforms/common/register/helper.go b/util/intelp2m/platforms/common/register/helper.go new file mode 100644 index 0000000000..9d3dee0c2c --- /dev/null +++ b/util/intelp2m/platforms/common/register/helper.go @@ -0,0 +1,5 @@ +package register + +func SetVal[T DW0 | DW1](value uint32, ro uint32) T { + return T{Register: Register{Value: value, ReadOnly: ro}} +} diff --git a/util/intelp2m/platforms/ebg/ebg_test.go b/util/intelp2m/platforms/ebg/ebg_test.go index 13e977a063..1dcdf25424 100644 --- a/util/intelp2m/platforms/ebg/ebg_test.go +++ b/util/intelp2m/platforms/ebg/ebg_test.go @@ -3,108 +3,103 @@ package ebg_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/ebg" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - emmitsburg := ebg.PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - } + p2m.Config.Platform = p2m.Emmitsburg test.Suite{ { - Pad: test.Pad{ID: "GPPC_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: 1}, + Pad: test.Pad{ID: "GPPC_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPPC_A1, DN_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPPC_A1, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(DN_20K) | PAD_IOSSTATE(Tx1RxDCRx1) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPPC_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: 0}, + Pad: test.Pad{ID: "GPPC_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(GPPC_B2, 0, INVALID, RSMRST),", Long: "_PAD_CFG_STRUCT(GPPC_B2, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPPC_C3", DW0: 0x44444444, DW1: 0x44444444, Ownership: 1}, + Pad: test.Pad{ID: "GPPC_C3", DW0: 0x44444444, DW1: 0x44444444, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPPC_C3, INVALID, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPPC_C3, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SMI), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx0RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_D4, DN_5K, PLTRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_D4, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT), PAD_PULL(DN_5K) | PAD_IOSSTATE(Tx0RxDCRx1)),", }, }, - }.Run(t, "INTEL-EMMITSBURG-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST", emmitsburg) + }.Run(t, "INTEL-EMMITSBURG-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E5, UP_2K, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPPC_H6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: 0}, + Pad: test.Pad{ID: "GPPC_H6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPPC_H6, INVALID, RSMRST, NF7),", Long: "_PAD_CFG_STRUCT(GPPC_H6, PAD_FUNC(NF7) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx0) | PAD_IOSTERM(DISPUPD)),", }, }, { - Pad: test.Pad{ID: "GPP_J7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, + Pad: test.Pad{ID: "GPP_J7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_J7, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_J7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_I8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, + Pad: test.Pad{ID: "GPP_I8", DW0: 0x77777777, DW1: 0x77777777, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_I8, UP_667, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPP_I8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, - }.Run(t, "INTEL-EMMITSBURG-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", emmitsburg) + }.Run(t, "INTEL-EMMITSBURG-PCH/SLIDING-ZERO-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_L9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, + Pad: test.Pad{ID: "GPP_L9", DW0: 0x33333333, DW1: 0x33333333, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_L9, UP_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_L9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_M10", DW0: 0x66666666, DW1: 0x66666666, Ownership: 0}, + Pad: test.Pad{ID: "GPP_M10", DW0: 0x66666666, DW1: 0x66666666, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_M10, UP_1K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_M10, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_1K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_N11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: 1}, + Pad: test.Pad{ID: "GPP_N11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_N11, INVALID, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_N11, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPPC_A12", DW0: 0x99999999, DW1: 0x99999999, Ownership: 0}, + Pad: test.Pad{ID: "GPPC_A12", DW0: 0x99999999, DW1: 0x99999999, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPPC_A12, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPPC_A12, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxE) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-EMMITSBURG-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST", emmitsburg) + }.Run(t, "INTEL-EMMITSBURG-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST") } diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index 8026a2d484..771d6df6cd 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -1,105 +1,47 @@ package ebg import ( - "fmt" - - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Cannon Lake platform + cnl.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{cnl.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - var remapping = map[uint32]uint32{ - 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override BasePlatform.RemapRstSrc() +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + remapping := map[uint32]uint32{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + dw0 := p.GetRegisterDW0() + source, valid := remapping[dw0.GetResetConfig()] if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } - -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (platform PlatformSpecific) Pull() { - platform.InheritanceMacro.Pull() -} - -// Adds PAD_CFG_GPI macro with arguments -func (platform PlatformSpecific) GpiMacroAdd() { - platform.InheritanceMacro.GpiMacroAdd() -} - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value -// return: string of macro -func (platform PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - }, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() -} diff --git a/util/intelp2m/platforms/ebg/template.go b/util/intelp2m/platforms/ebg/template.go index 32ba246ec9..451bd5dfdc 100644 --- a/util/intelp2m/platforms/ebg/template.go +++ b/util/intelp2m/platforms/ebg/template.go @@ -5,10 +5,10 @@ import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" // Group : "GPPC_A", "GPPC_B", "GPPC_S", "GPPC_C", "GPP_D", "GPP_E", "GPPC_H", "GPP_J", // "GPP_I", "GPP_L", "GPP_M", "GPP_N" -// KeywordCheck - This function is used to filter parsed lines of the configuration file and +// CheckKeyword - This function is used to filter parsed lines of the configuration file and // returns true if the keyword is contained in the line. // line : string from the configuration file -func (platform PlatformSpecific) KeywordCheck(line string) bool { +func CheckKeyword(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPPC_") return isIncluded } diff --git a/util/intelp2m/platforms/interfaces.go b/util/intelp2m/platforms/interfaces.go deleted file mode 100644 index 455da26cd7..0000000000 --- a/util/intelp2m/platforms/interfaces.go +++ /dev/null @@ -1,38 +0,0 @@ -package platforms - -import ( - "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/logs" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/lbg" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" -) - -type SpecificIf interface { - GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string - KeywordCheck(line string) bool -} - -func GetSpecificInterface() SpecificIf { - platforms := map[p2m.PlatformType]SpecificIf{ - p2m.Alder: adl.PlatformSpecific{}, - p2m.Apollo: apl.PlatformSpecific{}, - p2m.Sunrise: snr.PlatformSpecific{}, - p2m.Cannon: cnl.PlatformSpecific{ - InheritanceTemplate: snr.PlatformSpecific{}, - InheritanceMacro: snr.PlatformSpecific{}, - }, - p2m.Lewisburg: lbg.PlatformSpecific{ - InheritanceTemplate: snr.PlatformSpecific{}, - InheritanceMacro: snr.PlatformSpecific{}, - }, - } - platform, exist := platforms[p2m.Config.Platform] - if !exist { - logs.Errorf("unknown platform type %d", int(p2m.Config.Platform)) - return nil - } - return platform -} diff --git a/util/intelp2m/platforms/jsl/jsl_test.go b/util/intelp2m/platforms/jsl/jsl_test.go index 143617fb9a..444ba4cad9 100644 --- a/util/intelp2m/platforms/jsl/jsl_test.go +++ b/util/intelp2m/platforms/jsl/jsl_test.go @@ -3,108 +3,103 @@ package jsl_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/jsl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - jasperlake := jsl.PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - } + p2m.Config.Platform = p2m.Jasper test.Suite{ { - Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A1, DN_20K, PWROK, NF4),", Long: "_PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF4) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(DN_20K) | PAD_IOSSTATE(Tx1RxDCRx1) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B2", DW0: 0x22222222, DW1: 0x22222222, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(GPP_B2, 0, INVALID, PWROK),", Long: "_PAD_CFG_STRUCT(GPP_B2, PAD_FUNC(GPIO) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_C3", DW0: 0x44444444, DW1: 0x44444444, Ownership: 1}, + Pad: test.Pad{ID: "GPP_C3", DW0: 0x44444444, DW1: 0x44444444, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_C3, INVALID, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_C3, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SMI), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx0RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_D4, DN_5K, PLTRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_D4, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT), PAD_PULL(DN_5K) | PAD_IOSSTATE(Tx0RxDCRx1)),", }, }, - }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST", jasperlake) + }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E5, UP_2K, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_E5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_F6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_F6, INVALID, RSMRST, NF7),", Long: "_PAD_CFG_STRUCT(GPP_F6, PAD_FUNC(NF7) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx0) | PAD_IOSTERM(DISPUPD)),", }, }, { - Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, + Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_G7, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_H8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, + Pad: test.Pad{ID: "GPP_H8", DW0: 0x77777777, DW1: 0x77777777, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_H8, UP_667, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPP_H8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, - }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", jasperlake) + }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_R9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, + Pad: test.Pad{ID: "GPP_R9", DW0: 0x33333333, DW1: 0x33333333, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_R9, UP_20K, PWROK, NF4),", Long: "_PAD_CFG_STRUCT(GPP_R9, PAD_FUNC(NF4) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_S10", DW0: 0x66666666, DW1: 0x66666666, Ownership: 0}, + Pad: test.Pad{ID: "GPP_S10", DW0: 0x66666666, DW1: 0x66666666, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_S10, UP_1K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_S10, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_1K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_T11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: 1}, + Pad: test.Pad{ID: "GPP_T11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_T11, INVALID, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_T11, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPD12", DW0: 0x99999999, DW1: 0x99999999, Ownership: 0}, + Pad: test.Pad{ID: "GPD12", DW0: 0x99999999, DW1: 0x99999999, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPD12, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPD12, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxE) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST", jasperlake) + }.Run(t, "INTEL-JASPER-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST") } diff --git a/util/intelp2m/platforms/jsl/macro.go b/util/intelp2m/platforms/jsl/macro.go index d21eda151a..fa5cbedd7a 100644 --- a/util/intelp2m/platforms/jsl/macro.go +++ b/util/intelp2m/platforms/jsl/macro.go @@ -1,118 +1,60 @@ package jsl import ( - "fmt" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 18) | (0x3f << 11) | (0x3f << 2) | (0x1 << 1) - PAD_CFG_DW1_RO_FIELDS = 0xdfffc3ff + DW0Mask = (0b1 << 27) | (0b1 << 18) | (0b00111111 << 11) | (0b00111111 << 2) | (0b1 << 1) + DW1Mask = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Cannon Lake platform + cnl.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{cnl.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - if strings.Contains(macro.PadIdGet(), "GPP_F") || - strings.Contains(macro.PadIdGet(), "GPP_B") || - strings.Contains(macro.PadIdGet(), "GPP_A") || - strings.Contains(macro.PadIdGet(), "GPP_S") || - strings.Contains(macro.PadIdGet(), "GPP_R") { +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override the base platform method +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + if strings.Contains(m.GetPadId(), "GPP_F") || + strings.Contains(m.GetPadId(), "GPP_B") || + strings.Contains(m.GetPadId(), "GPP_A") || + strings.Contains(m.GetPadId(), "GPP_S") || + strings.Contains(m.GetPadId(), "GPP_R") { // See reset map for the Jasper Lake Community 0: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/jasperlake/gpio.c#L21 // remmap is not required because it is the same as common. return } - dw0 := macro.GetRegisterDW0() - var remapping = map[uint32]uint32{ - 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + remapping := map[uint32]uint32{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + dw0 := p.GetRegisterDW0() + source, valid := remapping[dw0.GetResetConfig()] if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } - -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (platform PlatformSpecific) Pull() { - platform.InheritanceMacro.Pull() -} - -// Adds PAD_CFG_GPI macro with arguments -func (platform PlatformSpecific) GpiMacroAdd() { - platform.InheritanceMacro.GpiMacroAdd() -} - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value -// return: string of macro -func (PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - }, - fields.InterfaceGet(), - ) - macro.Clear() - - macro.Clear() - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() -} diff --git a/util/intelp2m/platforms/jsl/template.go b/util/intelp2m/platforms/jsl/template.go index ec6e9c91a9..acf6a5ab70 100644 --- a/util/intelp2m/platforms/jsl/template.go +++ b/util/intelp2m/platforms/jsl/template.go @@ -5,10 +5,10 @@ import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" // Group : "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", "GPP_H", "GPP_R", // "GPP_S", "GPP_T", "GPD", "HVMOS", "VGPIO5" -// KeywordCheck - This function is used to filter parsed lines of the configuration file and +// CheckKeyword - This function is used to filter parsed lines of the configuration file and // returns true if the keyword is contained in the line. // line : string from the configuration file -func (PlatformSpecific) KeywordCheck(line string) bool { +func CheckKeyword(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded } diff --git a/util/intelp2m/platforms/lbg/lbg_test.go b/util/intelp2m/platforms/lbg/lbg_test.go index 62eba80404..b077c5c923 100644 --- a/util/intelp2m/platforms/lbg/lbg_test.go +++ b/util/intelp2m/platforms/lbg/lbg_test.go @@ -3,173 +3,173 @@ package lbg_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/lbg" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - lewisburg := lbg.PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}} + p2m.Config.Platform = p2m.Lewisburg test.Suite{ { /* GPP_A1 - ESPI_ALERT1# */ - Pad: test.Pad{ID: "GPP_A1", DW0: 0x44000c00, DW1: 0x00003000, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A1", DW0: 0x44000c00, DW1: 0x00003000, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A1, UP_20K, DEEP, NF3),", Long: "_PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF3) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPP_A12 - LFRAME# */ - Pad: test.Pad{ID: "GPP_A12", DW0: 0x80880102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_A12", DW0: 0x80880102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_SCI(GPP_A12, NONE, PLTRST, LEVEL, INVERT),", Long: "_PAD_CFG_STRUCT(GPP_A12, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_A16 - GPIO */ - Pad: test.Pad{ID: "GPP_A16", DW0: 0x44000201, DW1: 0x00000000, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A16", DW0: 0x44000201, DW1: 0x00000000, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_GPO_GPIO_DRIVER(GPP_A16, 1, DEEP, NONE),", Long: "_PAD_CFG_STRUCT(GPP_A16, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1, PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPP_A20 - GPIO */ - Pad: test.Pad{ID: "GPP_A20", DW0: 0x04000100, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_A20", DW0: 0x04000100, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_A20, NONE, RSMRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_A20, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0),", }, }, { /* GPP_B10 - GPIO */ - Pad: test.Pad{ID: "GPP_B10", DW0: 0x04000102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B10", DW0: 0x04000102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_B10, NONE, RSMRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_B10, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_B20 - GPIO */ - Pad: test.Pad{ID: "GPP_B20", DW0: 0x04000200, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B20", DW0: 0x04000200, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPO(GPP_B20, 0, RSMRST),", Long: "_PAD_CFG_STRUCT(GPP_B20, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPP_B23 - PCHHOT# */ - Pad: test.Pad{ID: "GPP_B23", DW0: 0x04000a00, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B23", DW0: 0x04000a00, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_B23, NONE, RSMRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_B23, PAD_FUNC(NF2) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPP_F0 - SATAXPCIE3 */ - Pad: test.Pad{ID: "GPP_F0", DW0: 0x04000502, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F0", DW0: 0x04000502, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_F0, NONE, RSMRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_F0, PAD_FUNC(NF1) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_C10 - GPIO */ - Pad: test.Pad{ID: "GPP_C10", DW0: 0x04000000, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C10", DW0: 0x04000000, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPP_C10, 0, NONE, RSMRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_C10, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(OFF), 0),", }, }, { /* GPP_C23 - GPIO */ - Pad: test.Pad{ID: "GPP_C23", DW0: 0x40880102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C23", DW0: 0x40880102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_SCI(GPP_C23, NONE, DEEP, LEVEL, INVERT),", Long: "_PAD_CFG_STRUCT(GPP_C23, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_D1 - GPIO */ - Pad: test.Pad{ID: "GPP_D1", DW0: 0x04000200, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D1", DW0: 0x04000200, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPO(GPP_D1, 0, RSMRST),", Long: "_PAD_CFG_STRUCT(GPP_D1, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPP_D16 - GPIO */ - Pad: test.Pad{ID: "GPP_D16", DW0: 0x84000100, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D16", DW0: 0x84000100, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_D16, NONE, PLTRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_D16, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0),", }, }, { /* GPP_E0 - SATAXPCIE0 */ - Pad: test.Pad{ID: "GPP_E0", DW0: 0x04000502, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_E0", DW0: 0x04000502, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_E0, NONE, RSMRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_E0, PAD_FUNC(NF1) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_E7 - GPIO */ - Pad: test.Pad{ID: "GPP_E7", DW0: 0x40840102, DW1: 0x00000000, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E7", DW0: 0x40840102, DW1: 0x00000000, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_GPI_SMI(GPP_E7, NONE, DEEP, LEVEL, INVERT),", Long: "_PAD_CFG_STRUCT(GPP_E7, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPP_F2 - GPIO */ - Pad: test.Pad{ID: "GPP_F2", DW0: 0x44000300, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F2", DW0: 0x44000300, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_NC(GPP_F2, NONE),", Long: "_PAD_CFG_STRUCT(GPP_F2, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), 0),", }, }, { /* GPP_F12 - GPIO */ - Pad: test.Pad{ID: "GPP_F12", DW0: 0x80900102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F12", DW0: 0x80900102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_APIC_LOW(GPP_F12, NONE, PLTRST),", Long: "_PAD_CFG_STRUCT(GPP_F12, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_F13 - GPIO */ - Pad: test.Pad{ID: "GPP_F13", DW0: 0x80100102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F13", DW0: 0x80100102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_APIC_HIGH(GPP_F13, NONE, PLTRST),", Long: "_PAD_CFG_STRUCT(GPP_F13, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_H10 - NC */ - Pad: test.Pad{ID: "GPP_H10", DW0: 0x44000300, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_H10", DW0: 0x44000300, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_NC(GPP_H10, NONE),", Long: "_PAD_CFG_STRUCT(GPP_H10, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), 0),", }, }, { /* GPP_L1 - CSME_INTR_OUT */ - Pad: test.Pad{ID: "GPP_L1", DW0: 0x44000700, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_L1", DW0: 0x44000700, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_L1, NONE, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_L1, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), 0),", }, }, { /* GPP_L19 - TESTCH1_CLK */ - Pad: test.Pad{ID: "GPP_L19", DW0: 0x04000600, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_L19", DW0: 0x04000600, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_L19, NONE, RSMRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_L19, PAD_FUNC(NF1) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, - }.Run(t, "INTEL-LEWISBURG-PCH/PAD-MAP", lewisburg) + }.Run(t, "INTEL-LEWISBURG-PCH/PAD-MAP") test.Suite{ { - Pad: test.Pad{ID: "GPP_Axx", DW0: 0xBFFFFFFF, DW1: 0xFFFFFFFF, Ownership: 1}, + Pad: test.Pad{ID: "GPP_Axx", DW0: 0xBFFFFFFF, DW1: 0xFFFFFFFF, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_Axx, NATIVE, PLTRST, NF7),", Long: "_PAD_CFG_STRUCT(GPP_Axx, PAD_FUNC(NF7) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(NATIVE) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, - }.Run(t, "INTEL-LEWISBURG-PCH/MASK", lewisburg) + }.Run(t, "INTEL-LEWISBURG-PCH/MASK") test.Suite{ { - Pad: test.Pad{ID: "GPP_Bxx", DW0: 0x00000000, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_Bxx", DW0: 0x00000000, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPP_Bxx, 0, NONE, RSMRST, LEVEL, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_Bxx, PAD_FUNC(GPIO) | PAD_RESET(RSMRST), 0),", }, }, - }.Run(t, "INTEL-LEWISBURG-PCH/EMRTY", lewisburg) + }.Run(t, "INTEL-LEWISBURG-PCH/EMRTY") } diff --git a/util/intelp2m/platforms/lbg/macro.go b/util/intelp2m/platforms/lbg/macro.go index 9cbd4f0570..d1b53501b7 100644 --- a/util/intelp2m/platforms/lbg/macro.go +++ b/util/intelp2m/platforms/lbg/macro.go @@ -1,105 +1,48 @@ package lbg import ( - "fmt" - - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask uint32 = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask uint32 = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Sunrise Point platform + snr.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro - InheritanceTemplate +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{snr.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override the base platform method +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + dw0 := p.GetRegisterDW0() remapping := map[uint32]uint32{ - 0: (bits.RstCfgRSMRST << bits.DW0PadRstCfg), - 1: (bits.RstCfgDEEP << bits.DW0PadRstCfg), - 2: (bits.RstCfgPLTRST << bits.DW0PadRstCfg), + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + source, valid := remapping[dw0.GetResetConfig()] if valid { // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } - -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (platform PlatformSpecific) Pull() { - platform.InheritanceMacro.Pull() -} - -// Adds PAD_CFG_GPI macro with arguments -func (platform PlatformSpecific) GpiMacroAdd() { - platform.InheritanceMacro.GpiMacroAdd() -} - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0val : DW0 config register value -// dw1val : DW1 config register value -// return: string of macro -func (platform PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { - // The GPIO controller architecture in Lewisburg and Sunrise are very similar, - // so we will inherit some platform-dependent functions from Sunrise. - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() -} diff --git a/util/intelp2m/platforms/lbg/template.go b/util/intelp2m/platforms/lbg/template.go index d76f2cdef3..f4600850df 100644 --- a/util/intelp2m/platforms/lbg/template.go +++ b/util/intelp2m/platforms/lbg/template.go @@ -1,15 +1,12 @@ package lbg -type InheritanceTemplate interface { - KeywordCheck(line string) bool -} +import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// Group: "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", -// "GPP_K", "GPP_G", "GPP_H", "GPP_L" - -// KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func (platform PlatformSpecific) KeywordCheck(line string) bool { - return platform.InheritanceTemplate.KeywordCheck(line) +// CheckKeyword() parses lines of the configuration file and returns true if the keyword is +// contained in the line +// "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", +// "GPP_K", "GPP_G", "GPP_H", "GPP_L" +func CheckKeyword(line string) bool { + included, _ := common.KeywordsCheck(line, "GPP_", "GPD") + return included } diff --git a/util/intelp2m/platforms/mtl/macro.go b/util/intelp2m/platforms/mtl/macro.go index d672752b5b..13a3f11043 100644 --- a/util/intelp2m/platforms/mtl/macro.go +++ b/util/intelp2m/platforms/mtl/macro.go @@ -1,114 +1,57 @@ package mtl import ( - "fmt" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Cannon Lake platform + cnl.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{cnl.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - if strings.Contains(macro.PadIdGet(), "GPD") { +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override the base platform method +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the MeteorLake GPD group at // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/meteorlake/gpio.c#L10 // remmap is not required because it is the same as common. return } - dw0 := macro.GetRegisterDW0() - var remapping = map[uint32]uint32{ - 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, - 3: bits.RstCfgPWROK << bits.RstCfgPWROK, + remapping := map[uint32]uint32{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + 0b11: bits.RstCfgPWROK << bits.RstCfgPWROK, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + dw0 := p.GetRegisterDW0() + source, valid := remapping[dw0.GetResetConfig()] if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } - -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (platform PlatformSpecific) Pull() { - platform.InheritanceMacro.Pull() -} - -// Adds PAD_CFG_GPI macro with arguments -func (platform PlatformSpecific) GpiMacroAdd() { - platform.InheritanceMacro.GpiMacroAdd() -} - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value -// return: string of macro -func (PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - }, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() -} diff --git a/util/intelp2m/platforms/mtl/mtl_test.go b/util/intelp2m/platforms/mtl/mtl_test.go index 11f8727883..268d0df336 100644 --- a/util/intelp2m/platforms/mtl/mtl_test.go +++ b/util/intelp2m/platforms/mtl/mtl_test.go @@ -3,108 +3,103 @@ package mtl_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/mtl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - meteorlake := mtl.PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - } + p2m.Config.Platform = p2m.Meteor test.Suite{ { - Pad: test.Pad{ID: "GPP_V1", DW0: 0x11111111, DW1: 0x11111111, Ownership: 1}, + Pad: test.Pad{ID: "GPP_V1", DW0: 0x11111111, DW1: 0x11111111, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_V1, DN_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_V1, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(DN_20K) | PAD_IOSSTATE(Tx1RxDCRx1) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_C2", DW0: 0x22222222, DW1: 0x22222222, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C2", DW0: 0x22222222, DW1: 0x22222222, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(GPP_C2, 0, INVALID, RSMRST),", Long: "_PAD_CFG_STRUCT(GPP_C2, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_A3", DW0: 0x44444444, DW1: 0x44444444, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A3", DW0: 0x44444444, DW1: 0x44444444, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A3, INVALID, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_A3, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SMI), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx0RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_E4", DW0: 0x88888888, DW1: 0x88888888, Ownership: 0}, + Pad: test.Pad{ID: "GPP_E4", DW0: 0x88888888, DW1: 0x88888888, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_E4, DN_5K, PLTRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_E4, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT), PAD_PULL(DN_5K) | PAD_IOSSTATE(Tx0RxDCRx1)),", }, }, - }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST", meteorlake) + }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_H5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, + Pad: test.Pad{ID: "GPP_H5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_H5, UP_2K, PWROK, NF3),", Long: "_PAD_CFG_STRUCT(GPP_H5, PAD_FUNC(NF3) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_F6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_F6, INVALID, PWROK, NF7),", Long: "_PAD_CFG_STRUCT(GPP_F6, PAD_FUNC(NF7) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx0) | PAD_IOSTERM(DISPUPD)),", }, }, { - Pad: test.Pad{ID: "GPP_S7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, + Pad: test.Pad{ID: "GPP_S7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_S7, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_S7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_B8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B8", DW0: 0x77777777, DW1: 0x77777777, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_B8, UP_667, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPP_B8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, - }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", meteorlake) + }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_D9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, + Pad: test.Pad{ID: "GPP_D9", DW0: 0x33333333, DW1: 0x33333333, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_D9, UP_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_D9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPD10", DW0: 0x66666666, DW1: 0x66666666, Ownership: 0}, + Pad: test.Pad{ID: "GPD10", DW0: 0x66666666, DW1: 0x66666666, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPD10, UP_1K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPD10, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_1K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_V11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: 1}, + Pad: test.Pad{ID: "GPP_V11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_V11, INVALID, PWROK, NF3),", Long: "_PAD_CFG_STRUCT(GPP_V11, PAD_FUNC(NF3) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_C12", DW0: 0x99999999, DW1: 0x99999999, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C12", DW0: 0x99999999, DW1: 0x99999999, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_C12, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_C12, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxE) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST", meteorlake) + }.Run(t, "INTEL-METEOR-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST") } diff --git a/util/intelp2m/platforms/mtl/template.go b/util/intelp2m/platforms/mtl/template.go index 3f44928909..27951fefb5 100644 --- a/util/intelp2m/platforms/mtl/template.go +++ b/util/intelp2m/platforms/mtl/template.go @@ -5,10 +5,10 @@ import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" // Group : "GPP_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", "GPP_B", "GPP_D", // "GPD", "VGPIO_USB", "VGPIO_PCIE" -// KeywordCheck - This function is used to filter parsed lines of the configuration file and +// CheckKeyword - This function is used to filter parsed lines of the configuration file and // returns true if the keyword is contained in the line. // line : string from the configuration file -func (PlatformSpecific) KeywordCheck(line string) bool { +func CheckKeyword(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded } diff --git a/util/intelp2m/platforms/platforms.go b/util/intelp2m/platforms/platforms.go new file mode 100644 index 0000000000..cb65903e8b --- /dev/null +++ b/util/intelp2m/platforms/platforms.go @@ -0,0 +1,62 @@ +package platforms + +import ( + "fmt" + + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/ebg" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/jsl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/lbg" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/mtl" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/tgl" +) + +type KeywordAction func(line string) bool + +type Constructor func(dw0, dw1 uint32) common.PlatformIf + +var platformConstructorMap = map[p2m.PlatformType]Constructor{ + p2m.Alder: adl.GetPlatform, + p2m.Apollo: apl.GetPlatform, + p2m.Cannon: cnl.GetPlatform, + p2m.Sunrise: snr.GetPlatform, + p2m.Tiger: tgl.GetPlatform, + p2m.Jasper: jsl.GetPlatform, + p2m.Meteor: mtl.GetPlatform, + p2m.Emmitsburg: ebg.GetPlatform, + p2m.Lewisburg: lbg.GetPlatform, +} + +func GetKeywordChekingAction() KeywordAction { + actions := map[p2m.PlatformType]KeywordAction{ + p2m.Alder: adl.CheckKeyword, + p2m.Apollo: apl.CheckKeyword, + p2m.Cannon: cnl.CheckKeyword, + p2m.Sunrise: snr.CheckKeyword, + p2m.Tiger: tgl.CheckKeyword, + p2m.Jasper: jsl.CheckKeyword, + p2m.Meteor: mtl.CheckKeyword, + p2m.Emmitsburg: ebg.CheckKeyword, + p2m.Lewisburg: lbg.CheckKeyword, + } + action, exist := actions[p2m.Config.Platform] + if !exist { + logs.Errorf("unregistered platform type %d", p2m.Config.Platform) + return nil + } + return action +} + +func GetConstructor() (Constructor, error) { + constructor, exist := platformConstructorMap[p2m.Config.Platform] + if !exist { + return nil, fmt.Errorf("unregistered platform type %d", p2m.Config.Platform) + } + return constructor, nil +} diff --git a/util/intelp2m/platforms/snr/macro.go b/util/intelp2m/platforms/snr/macro.go index 7eee4bf351..9a4ace4753 100644 --- a/util/intelp2m/platforms/snr/macro.go +++ b/util/intelp2m/platforms/snr/macro.go @@ -1,150 +1,149 @@ package snr import ( - "fmt" "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask uint32 = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask uint32 = 0b11111101111111111100001111111111 ) -type PlatformSpecific struct{} +type BasePlatform struct { + common.BasePlatform +} -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - if strings.Contains(macro.PadIdGet(), "GPD") { +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{common.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} +} + +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// RemmapRstSrc() remaps Pad Reset Source Config +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the Sunrise GPD Group in the Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/skylake/gpio.c#L15 // remmap is not required because it is the same as common. return } - dw0 := macro.GetRegisterDW0() + dw0 := p.GetRegisterDW0() remapping := map[uint32]uint32{ - 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] - if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + + if source, valid := remapping[dw0.GetResetConfig()]; valid { + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) + dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0PadRstCfg]) } -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (PlatformSpecific) Pull() { - macro := common.GetMacro() - dw1 := macro.GetRegisterDW1() +// Pull() adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro +func (p *BasePlatform) Pull(m *common.Macro) { + dw1 := p.GetRegisterDW1() var pull = map[uint32]string{ - 0x0: "NONE", - 0x2: "DN_5K", - 0x4: "DN_20K", - 0x9: "UP_1K", - 0xa: "UP_5K", - 0xb: "UP_2K", - 0xc: "UP_20K", - 0xd: "UP_667", - 0xf: "NATIVE", + 0b0000: "NONE", + 0b0010: "DN_5K", + 0b0100: "DN_20K", + 0b1001: "UP_1K", + 0b1010: "UP_5K", + 0b1011: "UP_2K", + 0b1100: "UP_20K", + 0b1101: "UP_667", + 0b1111: "NATIVE", } - str, valid := pull[dw1.GetTermination()] + term, valid := pull[dw1.GetTermination()] if !valid { - str = "INVALID" - fmt.Println("Error", - macro.PadIdGet(), - " invalid TERM value = ", - int(dw1.GetTermination())) + term = "INVALID" + logs.Errorf("%s: DW1 %s: invalid termination value 0b%b", + dw1, m.GetPadId(), dw1.GetTermination()) } - macro.Separator().Add(str) + m.Separator().Add(term) } -// Generate macro to cause peripheral IRQ when configured in GPIO input mode -func ioApicRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() +// ioApicRoute() generate macro to cause peripheral IRQ when configured in GPIO input mode +func ioApicRoute(p *BasePlatform, m *common.Macro) bool { + dw0 := p.GetRegisterDW0() if dw0.GetGPIOInputRouteIOxAPIC() == 0 { return false } - macro.Add("_APIC") + m.Add("_APIC") if dw0.GetRXLevelEdgeConfiguration() == bits.TrigLEVEL { if dw0.GetRxInvert() != 0 { // PAD_CFG_GPI_APIC_LOW(pad, pull, rst) - macro.Add("_LOW") + m.Add("_LOW") } else { // PAD_CFG_GPI_APIC_HIGH(pad, pull, rst) - macro.Add("_HIGH") + m.Add("_HIGH") } - macro.Add("(").Id().Pull().Rstsrc().Add("),") + m.Add("(").Id().Pull().Rstsrc().Add("),") return true } // e.g. PAD_CFG_GPI_APIC_IOS(pad, pull, rst, trig, inv, iosstate, iosterm) - macro.Add("_IOS(").Id().Pull().Rstsrc().Trig().Invert().Add(", TxLASTRxE, SAME),") + m.Add("_IOS(").Id().Pull().Rstsrc().Trig().Invert().Add(", TxLASTRxE, SAME),") return true } -// Generate macro to cause NMI when configured in GPIO input mode -func nmiRoute() bool { - macro := common.GetMacro() - if macro.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { +// nmiRoute() generate macro to cause NMI when configured in GPIO input mode +func nmiRoute(p *BasePlatform, m *common.Macro) bool { + if p.GetRegisterDW0().GetGPIOInputRouteNMI() == 0 { return false } // PAD_CFG_GPI_NMI(GPIO_24, UP_20K, DEEP, LEVEL, INVERT), - macro.Add("_NMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_NMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Generate macro to cause SCI when configured in GPIO input mode -func sciRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() +// sciRoute() generate macro to cause SCI when configured in GPIO input mode +func sciRoute(p *BasePlatform, m *common.Macro) bool { + dw0 := p.GetRegisterDW0() if dw0.GetGPIOInputRouteSCI() == 0 { return false } // PAD_CFG_GPI_SCI(GPP_B18, UP_20K, PLTRST, LEVEL, INVERT), - macro.Add("_SCI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_SCI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Generate macro to cause SMI when configured in GPIO input mode -func smiRoute() bool { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() +// smiRoute() generates macro to cause SMI when configured in GPIO input mode +func smiRoute(p *BasePlatform, m *common.Macro) bool { + dw0 := p.GetRegisterDW0() if dw0.GetGPIOInputRouteSMI() == 0 { return false } // PAD_CFG_GPI_SMI(GPP_E7, NONE, DEEP, LEVEL, NONE), - macro.Add("_SMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") + m.Add("_SMI").Add("(").Id().Pull().Rstsrc().Trig().Invert().Add("),") return true } -// Adds PAD_CFG_GPI macro with arguments -func (PlatformSpecific) GpiMacroAdd() { - macro := common.GetMacro() +// AddGpiMacro() adds PAD_CFG_GPI macro with arguments +func (p *BasePlatform) AddGpiMacro(m *common.Macro) { var ids []string - macro.Set("PAD_CFG_GPI") - for routeid, isRoute := range map[string]func() bool{ + m.Set("PAD_CFG_GPI") + for routeid, isRoute := range map[string]func(*BasePlatform, *common.Macro) bool{ "IOAPIC": ioApicRoute, "SCI": sciRoute, "SMI": smiRoute, "NMI": nmiRoute, } { - if isRoute() { + if isRoute(p, m) { ids = append(ids, routeid) } } @@ -152,80 +151,77 @@ func (PlatformSpecific) GpiMacroAdd() { switch argc := len(ids); argc { case 0: // e.g. PAD_CFG_GPI_TRIG_OWN(pad, pull, rst, trig, own) - macro.Add("_TRIG_OWN").Add("(").Id().Pull().Rstsrc().Trig().Own().Add("),") + m.Add("_TRIG_OWN").Add("(").Id().Pull().Rstsrc().Trig().Own().Add("),") case 1: // GPI with IRQ route if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode - macro.SetPadOwnership(common.PAD_OWN_ACPI) + m.SetOwnershipAcpi() } case 2: // PAD_CFG_GPI_DUAL_ROUTE(pad, pull, rst, trig, inv, route1, route2) - macro.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() - macro.Add(", " + ids[0] + ", " + ids[1] + "),") + m.Set("PAD_CFG_GPI_DUAL_ROUTE(").Id().Pull().Rstsrc().Trig().Invert() + m.Add(", " + ids[0] + ", " + ids[1] + "),") if p2m.Config.IgnoredFields { // Set Host Software Ownership to ACPI mode - macro.SetPadOwnership(common.PAD_OWN_ACPI) + m.SetOwnershipAcpi() } default: // Clear the control mask so that the check fails and "Advanced" macro is // generated - macro.GetRegisterDW0().CntrMaskFieldsClear(bits.All32) + dw0 := p.GetRegisterDW0() + dw0.CntrMaskFieldsClear(bits.All32) } } -// Adds PAD_CFG_GPO macro with arguments -func (PlatformSpecific) GpoMacroAdd() { - macro := common.GetMacro() - dw0 := macro.GetRegisterDW0() - term := macro.GetRegisterDW1().GetTermination() - +// AddGpoMacro() adds PAD_CFG_GPO macro with arguments +func (p *BasePlatform) AddGpoMacro(m *common.Macro) { // #define PAD_CFG_GPO(pad, val, rst) \ // _PAD_CFG_STRUCT(pad, \ // PAD_FUNC(GPIO) | PAD_RESET(rst) | \ // PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | !!val, \ // PAD_PULL(NONE) | PAD_IOSSTATE(TxLASTRxE)) - if dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { + if dw0 := p.GetRegisterDW0(); dw0.GetRXLevelEdgeConfiguration() != bits.TrigOFF { mask := bits.DW0[bits.DW0RxLevelEdgeConfiguration] dw0.CntrMaskFieldsClear(mask) } - macro.Set("PAD_CFG") - if macro.IsOwnershipDriver() { + m.Set("PAD_CFG") + if m.IsOwnershipDriver() { // PAD_CFG_GPO_GPIO_DRIVER(pad, val, rst, pull) - macro.Add("_GPO_GPIO_DRIVER").Add("(").Id().Val().Rstsrc().Pull().Add("),") + m.Add("_GPO_GPIO_DRIVER").Add("(").Id().Val().Rstsrc().Pull().Add("),") return } + dw1 := p.GetRegisterDW1() + term := dw1.GetTermination() if term != 0 { // e.g. PAD_CFG_TERM_GPO(GPP_B23, 1, DN_20K, DEEP), - macro.Add("_TERM") + m.Add("_TERM") } - macro.Add("_GPO").Add("(").Id().Val() + m.Add("_GPO").Add("(").Id().Val() if term != 0 { - macro.Pull() + m.Pull() } - macro.Rstsrc().Add("),") + m.Rstsrc().Add("),") } -// Adds PAD_CFG_NF macro with arguments -func (PlatformSpecific) NativeFunctionMacroAdd() { - macro := common.GetMacro() +// AddNativeFunctionMacro() adds PAD_CFG_NF macro with arguments +func (p *BasePlatform) AddNativeFunctionMacro(m *common.Macro) { // e.g. PAD_CFG_NF(GPP_D23, NONE, DEEP, NF1) - macro.Set("PAD_CFG_NF") - if macro.GetRegisterDW1().GetPadTol() != 0 { - macro.Add("_1V8") + m.Set("PAD_CFG_NF") + if p.GetRegisterDW1().GetPadTol() != 0 { + m.Add("_1V8") } - macro.Add("(").Id().Pull().Rstsrc().Padfn().Add("),") + m.Add("(").Id().Pull().Rstsrc().Padfn().Add("),") } -// Adds PAD_NC macro -func (PlatformSpecific) NoConnMacroAdd() { - macro := common.GetMacro() +// AddNoConnMacro() adds PAD_NC macro +func (p *BasePlatform) AddNoConnMacro(m *common.Macro) { // #define PAD_NC(pad, pull) // _PAD_CFG_STRUCT(pad, // PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), // PAD_PULL(pull) | PAD_IOSSTATE(TxDRxE)), - dw0 := macro.GetRegisterDW0() + dw0 := p.GetRegisterDW0() // Some fields of the configuration registers are hidden inside the macros, // we should check them to update the corresponding bits in the control mask. @@ -237,32 +233,5 @@ func (PlatformSpecific) NoConnMacroAdd() { mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } - - macro.Set("PAD_NC").Add("(").Id().Pull().Add("),") -} - -// GenMacro - generate pad macro -// dw0Val : DW0 config register value -// dw1Val : DW1 config register value -// return: string of macro -func (PlatformSpecific) GenMacro(id string, dw0Val uint32, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{}, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() + m.Set("PAD_NC").Add("(").Id().Pull().Add("),") } diff --git a/util/intelp2m/platforms/snr/snr_test.go b/util/intelp2m/platforms/snr/snr_test.go index 8a52396ece..935e8c2ae1 100644 --- a/util/intelp2m/platforms/snr/snr_test.go +++ b/util/intelp2m/platforms/snr/snr_test.go @@ -3,207 +3,208 @@ package snr_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" ) func TestGenMacro(t *testing.T) { - sunrise := snr.PlatformSpecific{} + p2m.Config.Platform = p2m.Sunrise test.Suite{ { /* GPP_A1 - LAD0 */ - Pad: test.Pad{ID: "GPP_A1", DW0: 0x84000402, DW1: 0x00003000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_A1", DW0: 0x84000402, DW1: 0x00003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | (1 << 1), PAD_PULL(UP_20K)),", }, }, { /* GPP_A5 - LFRAME# */ - Pad: test.Pad{ID: "GPP_A5", DW0: 0x84000600, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_A5", DW0: 0x84000600, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_A5, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPP_A22 - GPIO */ - Pad: test.Pad{ID: "GPP_A22", DW0: 0x84000102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_A22", DW0: 0x84000102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_A22, NONE, PLTRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_A22, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_B3 - GPIO */ - Pad: test.Pad{ID: "GPP_B3", DW0: 0x44000201, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B3", DW0: 0x44000201, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPO(GPP_B3, 1, DEEP),", Long: "_PAD_CFG_STRUCT(GPP_B3, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1, 0),", }, }, { /* GPP_B5 - GPIO */ - Pad: test.Pad{ID: "GPP_B5", DW0: 0x84000100, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B5", DW0: 0x84000100, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_B5, NONE, PLTRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_B5, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0),", }, }, { /* GPP_B8 - NC */ - Pad: test.Pad{ID: "GPP_B8", DW0: 0x44000300, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_B8", DW0: 0x44000300, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_NC(GPP_B8, NONE),", Long: "_PAD_CFG_STRUCT(GPP_B8, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), 0),", }, }, { /* GPP_C2 - GPIO */ - Pad: test.Pad{ID: "GPP_C2", DW0: 0x44000201, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C2", DW0: 0x44000201, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPO(GPP_C2, 1, DEEP),", Long: "_PAD_CFG_STRUCT(GPP_C2, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1, 0),", }, }, { /* GPP_C10 - GPIO */ - Pad: test.Pad{ID: "GPP_C10", DW0: 0x04000000, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C10", DW0: 0x04000000, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPP_C10, 0, NONE, RSMRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_C10, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(OFF), 0),", }, }, { /* GPP_C22 - UART2_RTS# */ - Pad: test.Pad{ID: "GPP_C22", DW0: 0x84000600, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C22", DW0: 0x84000600, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_C22, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPP_C23 - GPIO */ - Pad: test.Pad{ID: "GPP_C23", DW0: 0x40880102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_C23", DW0: 0x40880102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_SCI(GPP_C23, NONE, DEEP, LEVEL, INVERT),", Long: "_PAD_CFG_STRUCT(GPP_C23, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_D0 - GPIO */ - Pad: test.Pad{ID: "GPP_D0", DW0: 0x84000200, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D0", DW0: 0x84000200, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPO(GPP_D0, 0, PLTRST),", Long: "_PAD_CFG_STRUCT(GPP_D0, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPP_D16 - GPIO */ - Pad: test.Pad{ID: "GPP_D16", DW0: 0x84000100, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D16", DW0: 0x84000100, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_D16, NONE, PLTRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_D16, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), 0),", }, }, { /* GPP_E0 - SATAXPCIE0 */ - Pad: test.Pad{ID: "GPP_E0", DW0: 0x84000502, DW1: 0x00003000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_E0", DW0: 0x84000502, DW1: 0x00003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_E0, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K)),", }, }, { /* GPP_E7 - GPIO */ - Pad: test.Pad{ID: "GPP_E7", DW0: 0x84000102, DW1: 0x00000000, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E7", DW0: 0x84000102, DW1: 0x00000000, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPP_E7, NONE, PLTRST, OFF, DRIVER),", Long: "_PAD_CFG_STRUCT(GPP_E7, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { /* GPP_F2 - GPIO */ - Pad: test.Pad{ID: "GPP_F2", DW0: 0x44000300, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F2", DW0: 0x44000300, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_NC(GPP_F2, NONE),", Long: "_PAD_CFG_STRUCT(GPP_F2, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_BUF(TX_RX_DISABLE), 0),", }, }, { /* GPP_F12 - GPIO */ - Pad: test.Pad{ID: "GPP_F12", DW0: 0x80900102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F12", DW0: 0x80900102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_APIC_LOW(GPP_F12, NONE, PLTRST),", Long: "_PAD_CFG_STRUCT(GPP_F12, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_F13 - GPIO */ - Pad: test.Pad{ID: "GPP_F13", DW0: 0x80100102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F13", DW0: 0x80100102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_APIC_HIGH(GPP_F13, NONE, PLTRST),", Long: "_PAD_CFG_STRUCT(GPP_F13, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_F14 - GPIO */ - Pad: test.Pad{ID: "GPP_F14", DW0: 0x40900102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F14", DW0: 0x40900102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_APIC_LOW(GPP_F14, NONE, DEEP),", Long: "_PAD_CFG_STRUCT(GPP_F14, PAD_FUNC(GPIO) | PAD_RESET(DEEP) | PAD_IRQ_ROUTE(IOAPIC) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_H13 - GPIO */ - Pad: test.Pad{ID: "GPP_H13", DW0: 0x80100102, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_H13", DW0: 0x80100102, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_APIC_HIGH(GPP_H13, NONE, PLTRST),", Long: "_PAD_CFG_STRUCT(GPP_H13, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPD1 - GPIO */ - Pad: test.Pad{ID: "GPD1", DW0: 0x04000200, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPD1", DW0: 0x04000200, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPO(GPD1, 0, PWROK),", Long: "_PAD_CFG_STRUCT(GPD1, PAD_FUNC(GPIO) | PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE), 0),", }, }, { /* GPD2 - LAN_WAKE# */ - Pad: test.Pad{ID: "GPD2", DW0: 0x00080602, DW1: 0x00003c00, Ownership: 0}, + Pad: test.Pad{ID: "GPD2", DW0: 0x00080602, DW1: 0x00003c00, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPD2, NATIVE, PWROK, NF1),", Long: "_PAD_CFG_STRUCT(GPD2, PAD_FUNC(NF1) | PAD_IRQ_ROUTE(SCI) | PAD_BUF(RX_DISABLE) | (1 << 1), PAD_PULL(NATIVE)),", }, }, { /* GPD3 - PWRBTN# */ - Pad: test.Pad{ID: "GPD3", DW0: 0x04000502, DW1: 0x00003000, Ownership: 0}, + Pad: test.Pad{ID: "GPD3", DW0: 0x04000502, DW1: 0x00003000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPD3, UP_20K, PWROK, NF1),", Long: "_PAD_CFG_STRUCT(GPD3, PAD_FUNC(NF1) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), PAD_PULL(UP_20K)),", }, }, { /* GPD7 - GPIO */ - Pad: test.Pad{ID: "GPD7", DW0: 0x84000103, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPD7", DW0: 0x84000103, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPI_TRIG_OWN(GPD7, NONE, PLTRST, OFF, ACPI),", Long: "_PAD_CFG_STRUCT(GPD7, PAD_FUNC(GPIO) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1) | 1, 0),", }, }, { /* GPP_I1 - DDPC_HPD1 */ - Pad: test.Pad{ID: "GPP_I1", DW0: 0x84000502, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_I1", DW0: 0x84000502, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_I1, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE) | (1 << 1), 0),", }, }, { /* GPP_I8 - DDPC_CTRLDATA */ - Pad: test.Pad{ID: "GPP_I8", DW0: 0x84000500, DW1: 0x00001000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_I8", DW0: 0x84000500, DW1: 0x00001000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_I8, DN_20K, PLTRST, NF1),", Long: "_PAD_CFG_STRUCT(GPP_I8, PAD_FUNC(NF1) | PAD_RESET(PLTRST) | PAD_TRIG(OFF) | PAD_BUF(TX_DISABLE), PAD_PULL(DN_20K)),", }, }, - }.Run(t, "INTEL-SUNRISE-PCH/PAD-MAP", sunrise) + }.Run(t, "INTEL-SUNRISE-PCH/PAD-MAP") test.Suite{ { - Pad: test.Pad{ID: "GPP_Axx", DW0: 0xBFFFFFFF, DW1: 0xFFFFFFFF, Ownership: 1}, + Pad: test.Pad{ID: "GPP_Axx", DW0: 0xBFFFFFFF, DW1: 0xFFFFFFFF, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_Axx, NATIVE, PLTRST, NF7),", Long: "_PAD_CFG_STRUCT(GPP_Axx, PAD_FUNC(NF7) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(NATIVE) | PAD_IOSSTATE(IGNORE) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, - }.Run(t, "INTEL-SUNRISE-PCH/MASK", sunrise) + }.Run(t, "INTEL-SUNRISE-PCH/MASK") test.Suite{ { - Pad: test.Pad{ID: "GPP_Bxx", DW0: 0x00000000, DW1: 0x00000000, Ownership: 0}, + Pad: test.Pad{ID: "GPP_Bxx", DW0: 0x00000000, DW1: 0x00000000, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_GPIO_BIDIRECT(GPP_Bxx, 0, NONE, RSMRST, LEVEL, ACPI),", Long: "_PAD_CFG_STRUCT(GPP_Bxx, PAD_FUNC(GPIO) | PAD_RESET(RSMRST), 0),", }, }, - }.Run(t, "INTEL-SUNRISE-PCH/EMRTY", sunrise) + }.Run(t, "INTEL-SUNRISE-PCH/EMRTY") } diff --git a/util/intelp2m/platforms/snr/template.go b/util/intelp2m/platforms/snr/template.go index 4d02743463..22f477e62c 100644 --- a/util/intelp2m/platforms/snr/template.go +++ b/util/intelp2m/platforms/snr/template.go @@ -2,14 +2,11 @@ package snr import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// Group: "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", -// "GPP_K", "GPP_G", "GPP_H", "GPP_L" - -// KeywordCheck - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -// Returns false if no word was found, or true otherwise -func (PlatformSpecific) KeywordCheck(line string) bool { +// CheckKeyword() parses lines of the configuration file and returns true if the keyword is +// contained in the line +// "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", +// "GPP_K", "GPP_G", "GPP_H", "GPP_L" +func CheckKeyword(line string) bool { included, _ := common.KeywordsCheck(line, "GPP_", "GPD") return included } diff --git a/util/intelp2m/platforms/test/suite.go b/util/intelp2m/platforms/test/suite.go index 0b5074a0d9..aa14d04677 100644 --- a/util/intelp2m/platforms/test/suite.go +++ b/util/intelp2m/platforms/test/suite.go @@ -5,6 +5,9 @@ import ( "testing" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" ) type ( @@ -12,7 +15,7 @@ type ( ID string DW0 uint32 DW1 uint32 - Ownership uint8 + Ownership bool } Macro struct { Short string @@ -22,43 +25,60 @@ type ( Pad Macro } - PlatformSpecificIf interface { - GenMacro(string, uint32, uint32, uint8) string - } Suite []TestCase ) -func (p Pad) toShortMacro(platform PlatformSpecificIf) string { +func (p Pad) toShortMacro() string { if err := p2m.SetFieldType("none"); err != nil { panic(err) } p2m.Config.AutoCheck = false - return platform.GenMacro(p.ID, p.DW0, p.DW1, p.Ownership) + constructor, err := platforms.GetConstructor() + if err != nil { + panic(err) + } + macro := common.CreateFrom( + p.ID, + p.Ownership, + constructor(p.DW0, p.DW1), + fields.Get(), + ) + return macro.Generate() } -func (p Pad) toLongMacro(platform PlatformSpecificIf) string { +func (p Pad) toLongMacro() string { if err := p2m.SetFieldType("cb"); err != nil { panic(err) } p2m.Config.AutoCheck = true - return platform.GenMacro(p.ID, p.DW0, p.DW1, p.Ownership) + constructor, err := platforms.GetConstructor() + if err != nil { + panic(err) + } + macro := common.CreateFrom( + p.ID, + p.Ownership, + constructor(p.DW0, p.DW1), + fields.Get(), + ) + return macro.Generate() } -func (m *Macro) checkFor(platform PlatformSpecificIf, pad Pad) error { +func (m *Macro) check(pad Pad) error { var format string = "%s macro\nExpects: '%s'\nActually: '%s'\n\n" - if actually := pad.toLongMacro(platform); m.Long != "" && m.Long != actually { + if actually := pad.toLongMacro(); m.Long != "" && m.Long != actually { return fmt.Errorf(format, "LONG", m.Long, actually) } - if actually := pad.toShortMacro(platform); m.Short != "" && m.Short != actually { + if actually := pad.toShortMacro(); m.Short != "" && m.Short != actually { return fmt.Errorf(format, "SHORT", m.Short, actually) } return nil } -func (suite Suite) Run(t *testing.T, label string, platform PlatformSpecificIf) { +func (suite Suite) Run(t *testing.T, label string) { t.Run(label, func(t *testing.T) { for _, testcase := range suite { - if err := testcase.Macro.checkFor(platform, testcase.Pad); err != nil { + if err := testcase.Macro.check(testcase.Pad); err != nil { t.Errorf("Test failed for pad %s\n%v", testcase.Pad.ID, err) } } diff --git a/util/intelp2m/platforms/tgl/macro.go b/util/intelp2m/platforms/tgl/macro.go index fdd324fcdd..64ed9bb579 100644 --- a/util/intelp2m/platforms/tgl/macro.go +++ b/util/intelp2m/platforms/tgl/macro.go @@ -1,113 +1,56 @@ package tgl import ( - "fmt" "strings" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" + "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" ) const ( - PAD_CFG_DW0_RO_FIELDS = (0x1 << 27) | (0x1 << 24) | (0x3 << 21) | (0xf << 16) | 0xfc - PAD_CFG_DW1_RO_FIELDS = 0xfdffc3ff + DW0Mask = (0b1 << 27) | (0b1 << 24) | (0b11 << 21) | (0b1111 << 16) | 0b11111100 + DW1Mask = 0b11111101111111111100001111111111 ) -type InheritanceMacro interface { - Pull() - GpiMacroAdd() - GpoMacroAdd() - NativeFunctionMacroAdd() - NoConnMacroAdd() +type BasePlatform struct { + // based on the Cannon Lake platform + cnl.BasePlatform } -type PlatformSpecific struct { - InheritanceMacro +func InitBasePlatform(dw0, dw0mask uint32, dw1, dw1mask uint32) BasePlatform { + return BasePlatform{cnl.InitBasePlatform(dw0, dw0mask, dw1, dw1mask)} } -// RemmapRstSrc - remmap Pad Reset Source Config -func (PlatformSpecific) RemmapRstSrc() { - macro := common.GetMacro() - if strings.Contains(macro.PadIdGet(), "GPD") { +func GetPlatform(dw0, dw1 uint32) common.PlatformIf { + p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) + return &p +} + +// Override BasePlatform.RemapRstSrc() +func (p *BasePlatform) RemapRstSrc(m *common.Macro) { + if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the TigerLake Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/tigerlake/gpio.c#L21 // remmap is not required because it is the same as common. return } - dw0 := macro.GetRegisterDW0() - var remapping = map[uint32]uint32{ - 0: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 1: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 2: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + remapping := map[uint32]uint32{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, } - resetsrc, valid := remapping[dw0.GetResetConfig()] + dw0 := p.GetRegisterDW0() + source, valid := remapping[dw0.GetResetConfig()] if valid { - // dw0.SetResetConfig(resetsrc) - ResetConfigFieldVal := (dw0.Value & 0x3fffffff) | remapping[dw0.GetResetConfig()] - dw0.Value = ResetConfigFieldVal + dw0.Value &= 0x3fffffff + dw0.Value |= source } else { - fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet()) + logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", + m.GetPadId(), dw0, dw0.GetResetConfig()) } mask := bits.DW0[bits.DW0PadRstCfg] dw0.CntrMaskFieldsClear(mask) } - -// Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro -// as a new argument -func (platform PlatformSpecific) Pull() { - platform.InheritanceMacro.Pull() -} - -// Adds PAD_CFG_GPI macro with arguments -func (platform PlatformSpecific) GpiMacroAdd() { - platform.InheritanceMacro.GpiMacroAdd() -} - -// Adds PAD_CFG_GPO macro with arguments -func (platform PlatformSpecific) GpoMacroAdd() { - platform.InheritanceMacro.GpoMacroAdd() -} - -// Adds PAD_CFG_NF macro with arguments -func (platform PlatformSpecific) NativeFunctionMacroAdd() { - platform.InheritanceMacro.NativeFunctionMacroAdd() -} - -// Adds PAD_NC macro -func (platform PlatformSpecific) NoConnMacroAdd() { - platform.InheritanceMacro.NoConnMacroAdd() -} - -// GenMacro - generate pad macro -// dw0 : DW0 config register value -// dw1 : DW1 config register value -// return: string of macro -func (PlatformSpecific) GenMacro(id string, dw0Val, dw1Val uint32, ownership uint8) string { - macro := common.GetInstanceMacro( - PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - }, - fields.InterfaceGet(), - ) - macro.Clear() - - dw0 := macro.GetRegisterDW0() - dw0.CntrMaskFieldsClear(bits.All32) - - dw1 := macro.GetRegisterDW1() - dw1.CntrMaskFieldsClear(bits.All32) - - dw0.Value = dw0Val - dw1.Value = dw1Val - dw0.ReadOnly = PAD_CFG_DW0_RO_FIELDS - dw1.ReadOnly = PAD_CFG_DW1_RO_FIELDS - - macro.PadIdSet(id).SetPadOwnership(ownership) - return macro.Generate() -} diff --git a/util/intelp2m/platforms/tgl/template.go b/util/intelp2m/platforms/tgl/template.go index 4e9a2ba069..f6a0bcd4d0 100644 --- a/util/intelp2m/platforms/tgl/template.go +++ b/util/intelp2m/platforms/tgl/template.go @@ -5,10 +5,10 @@ import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" // Group : "GPP_A", "GPP_R", "GPP_B", "GPP_D", "GPP_C", "GPP_S", "GPP_G", "GPD", "GPP_E", // "GPP_F", "GPP_H", "GPP_J", "GPP_K", "GPP_I", "VGPIO_USB", "VGPIO_PCIE" -// KeywordCheck - This function is used to filter parsed lines of the configuration file +// CheckKeyword - This function is used to filter parsed lines of the configuration file // and returns true if the keyword is contained in the line. // line : string from the configuration file -func (PlatformSpecific) KeywordCheck(line string) bool { +func CheckKeyword(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded } diff --git a/util/intelp2m/platforms/tgl/tgl_test.go b/util/intelp2m/platforms/tgl/tgl_test.go index a968f96fab..e61f43d80e 100644 --- a/util/intelp2m/platforms/tgl/tgl_test.go +++ b/util/intelp2m/platforms/tgl/tgl_test.go @@ -3,108 +3,107 @@ package tgl_test import ( "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/test" - "review.coreboot.org/coreboot.git/util/intelp2m/platforms/tgl" ) func TestGenMacro(t *testing.T) { - tigerlake := tgl.PlatformSpecific{ - InheritanceMacro: cnl.PlatformSpecific{ - InheritanceMacro: snr.PlatformSpecific{}, - }, - } + p2m.Config.Platform = p2m.Tiger test.Suite{ { - Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: 1}, + Pad: test.Pad{ID: "GPP_A1", DW0: 0x11111111, DW1: 0x11111111, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_A1, DN_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_A1, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(DN_20K) | PAD_IOSSTATE(Tx1RxDCRx1) | PAD_IOSTERM(DISPUPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_R2", DW0: 0x22222222, DW1: 0x22222222, Ownership: 0}, + Pad: test.Pad{ID: "GPP_R2", DW0: 0x22222222, DW1: 0x22222222, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_TERM_GPO(GPP_R2, 0, INVALID, RSMRST),", Long: "_PAD_CFG_STRUCT(GPP_R2, PAD_FUNC(GPIO) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx1) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_B3", DW0: 0x44444444, DW1: 0x44444444, Ownership: 1}, + Pad: test.Pad{ID: "GPP_B3", DW0: 0x44444444, DW1: 0x44444444, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_B3, INVALID, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_B3, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SMI), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx0RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: 0}, + Pad: test.Pad{ID: "GPP_D4", DW0: 0x88888888, DW1: 0x88888888, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_D4, DN_5K, PLTRST, NF2),", Long: "_PAD_CFG_STRUCT(GPP_D4, PAD_FUNC(NF2) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT), PAD_PULL(DN_5K) | PAD_IOSSTATE(Tx0RxDCRx1)),", }, }, - }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST", tigerlake) + }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ONE-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_C5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: 1}, + + Pad: test.Pad{ID: "GPP_C5", DW0: 0xEEEEEEEE, DW1: 0xEEEEEEEE, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_C5, UP_2K, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_C5, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_2K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPD) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_S6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: 0}, + Pad: test.Pad{ID: "GPP_S6", DW0: 0xDDDDDDDD, DW1: 0xDDDDDDDD, Ownership: common.Acpi}, + Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_S6, INVALID, RSMRST, NF7),", Long: "_PAD_CFG_STRUCT(GPP_S6, PAD_FUNC(NF7) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(HIZCRx0) | PAD_IOSTERM(DISPUPD)),", }, }, { - Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: 1}, + Pad: test.Pad{ID: "GPP_G7", DW0: 0xBBBBBBBB, DW1: 0xBBBBBBBB, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_G7, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_G7, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(NMI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(INVALID) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPD8", DW0: 0x77777777, DW1: 0x77777777, Ownership: 0}, + + Pad: test.Pad{ID: "GPD8", DW0: 0x77777777, DW1: 0x77777777, Ownership: common.Acpi}, + Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPD8, UP_667, DEEP, NF5),", Long: "_PAD_CFG_STRUCT(GPD8, PAD_FUNC(NF5) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_667) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU)),", }, }, - }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST", tigerlake) + }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ZERO-IN-NIBBLE-TEST") test.Suite{ { - Pad: test.Pad{ID: "GPP_E9", DW0: 0x33333333, DW1: 0x33333333, Ownership: 1}, + Pad: test.Pad{ID: "GPP_E9", DW0: 0x33333333, DW1: 0x33333333, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_E9, UP_20K, RSMRST, NF4),", Long: "_PAD_CFG_STRUCT(GPP_E9, PAD_FUNC(NF4) | PAD_RESET(RSMRST) | PAD_TRIG(EDGE_SINGLE) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(TX_RX_DISABLE) | (1 << 29) | (1 << 28) | (1 << 1) | 1, PAD_CFG1_TOL_1V8PAD_PULL(UP_20K) | PAD_IOSSTATE(ERROR) | PAD_IOSTERM(ENPU) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_F10", DW0: 0x66666666, DW1: 0x66666666, Ownership: 0}, + Pad: test.Pad{ID: "GPP_F10", DW0: 0x66666666, DW1: 0x66666666, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF_1V8(GPP_F10, UP_1K, DEEP, NF1),", Long: "_PAD_CFG_STRUCT(GPP_F10, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(EDGE_BOTH) | PAD_IRQ_ROUTE(SMI) | PAD_IRQ_ROUTE(NMI) | PAD_BUF(RX_DISABLE) | (1 << 29) | (1 << 1), PAD_CFG1_TOL_1V8PAD_PULL(UP_1K) | PAD_IOSSTATE(TxDRxE) | PAD_IOSTERM(ENPD)),", }, }, { - Pad: test.Pad{ID: "GPP_H11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: 1}, + Pad: test.Pad{ID: "GPP_H11", DW0: 0xCCCCCCCC, DW1: 0xCCCCCCCC, Ownership: common.Driver}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_H11, INVALID, RSMRST, NF3),", Long: "_PAD_CFG_STRUCT(GPP_H11, PAD_FUNC(NF3) | PAD_RESET(RSMRST) | PAD_TRIG(OFF) | PAD_IRQ_ROUTE(SCI) | PAD_IRQ_ROUTE(SMI) | PAD_RX_POL(INVERT), PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxDCRx0) | PAD_CFG_OWN_GPIO(DRIVER)),", }, }, { - Pad: test.Pad{ID: "GPP_J12", DW0: 0x99999999, DW1: 0x99999999, Ownership: 0}, + Pad: test.Pad{ID: "GPP_J12", DW0: 0x99999999, DW1: 0x99999999, Ownership: common.Acpi}, Macro: test.Macro{ Short: "PAD_CFG_NF(GPP_J12, INVALID, PLTRST, NF6),", Long: "_PAD_CFG_STRUCT(GPP_J12, PAD_FUNC(NF6) | PAD_RESET(PLTRST) | PAD_IRQ_ROUTE(IOAPIC) | PAD_IRQ_ROUTE(SCI) | PAD_RX_POL(INVERT) | PAD_BUF(TX_DISABLE) | (1 << 28) | 1, PAD_PULL(INVALID) | PAD_IOSSTATE(Tx1RxE) | PAD_IOSTERM(DISPUPD)),", }, }, - }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST", tigerlake) + }.Run(t, "INTEL-TIGER-LAKE-PCH/SLIDING-ONE-ONE-IN-NIBBLE-TEST") } From d9c3e51a818abc49e1dafc115759984bbad26545 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Mon, 16 Dec 2024 17:19:15 +0300 Subject: [PATCH 0256/3886] util/intelp2m/platforms/cnl: Add missing VGPIO groups Change-Id: Ib7c807c343c71e8420feaa481b7f0536a5f36533 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/85608 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- util/intelp2m/platforms/cnl/template.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/util/intelp2m/platforms/cnl/template.go b/util/intelp2m/platforms/cnl/template.go index 4c4192d6cc..f1bb525a6d 100644 --- a/util/intelp2m/platforms/cnl/template.go +++ b/util/intelp2m/platforms/cnl/template.go @@ -2,10 +2,24 @@ package cnl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -// CheckKeyword() parses lines of the configuration file and returns true if the keyword is -// contained in the line -// "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPD", "GPP_C", "GPP_E" func CheckKeyword(line string) bool { - included, _ := common.KeywordsCheck(line, "GPP_", "GPD") + // "GPP_" : "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPP_C", "GPP_E" + included, _ := common.KeywordsCheck(line, "GPP_", "GPD", + "I2S1_TXD", "CNV_BTEN", "CNV_GNEN", "CNV_WFEN", "CNV_WCEN", "vCNV_GNSS_HOST_WAKE_B", + "vSD3_CD_B", "CNV_BT_HOST_WAKE_B", "CNV_BT_IF_SELECT", "vCNV_BT_UART_TXD", + "vCNV_BT_UART_RXD", "vCNV_BT_UART_CTS_B", "vCNV_BT_UART_RTS_B", "vCNV_MFUART1_TXD", + "vCNV_MFUART1_RXD", "vCNV_MFUART1_CTS_B", "vCNV_MFUART1_RTS_B", "vCNV_GNSS_UART_TXD", + "vCNV_GNSS_UART_RXD", "vCNV_GNSS_UART_CTS_B", "vCNV_GNSS_UART_RTS_B", "vUART0_TXD", + "vUART0_RXD", "vUART0_CTS_B", "vUART0_RTS_B", "vISH_UART0_TXD", "vISH_UART0_RXD", + "vISH_UART0_CTS_B", "vISH_UART0_RTS_B", "vISH_UART1_TXD", "vISH_UART1_RXD", + "vISH_UART1_CTS_B", "vISH_UART1_RTS_B", "vCNV_BT_I2S_BCLK", "vCNV_BT_I2S_WS_SYNC", + "vCNV_BT_I2S_SDO", "vCNV_BT_I2S_SDI", "vSSP2_SCLK", "vSSP2_SFRM", "vSSP2_TXD", + "vSSP2_RXD", "SLP_LAN_B", "SLP_SUS_B", "WAKE_B", "DRAM_RESET_B", "SPI0_IO_2", + "SPI0_IO_3", "SPI0_MISO", "SPI0_MOSI", "SPI0_CS2_B", "SPI0_CS0_B", "SPI0_CS1_B", + "SPI0_CLK", "SPI0_CLK_LOOPBK", "HDACPU_SDI", "HDACPU_SDO", "HDACPU_SCLK", "PM_SYNC", + "PECI", "CPUPWRGD", "THRMTRIP_B", "PLTRST_CPU_B", "PM_DOWN", "TRIGGER_IN", + "TRIGGER_OUT", "PCH_TDO", "PCH_JTAGX", "PROC_PRDY_B", "PROC_PREQ_B", "CPU_TRST_B", + "PCH_TDI", "PCH_TMS", "PCH_TCK", "ITP_PMODE", "SYS_PWROK", "SYS_RESET_B", "CL_RST_B", + "HDA_BCLK", "HDA_RST_B", "HDA_SYNC", "HDA_SDO", "HDA_SDI0", "HDA_SDI1", "I2S1_SFRM") return included } From e833b4661d1ec05e34c0232994c0fcdc2d7e895b Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Sun, 22 Dec 2024 12:50:47 +0300 Subject: [PATCH 0257/3886] util/intelp2m: Move remapping reset source to common TEST: 'make test' = PASS Change-Id: I315541b12f5f1fdf7c97c2ff8ddd305e30a447cc Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/85731 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- util/intelp2m/platforms/adl/macro.go | 30 +++++++++--------------- util/intelp2m/platforms/apl/macro.go | 4 ++-- util/intelp2m/platforms/cnl/macro.go | 28 ++++++++-------------- util/intelp2m/platforms/common/common.go | 22 +++++++++++++++++ util/intelp2m/platforms/common/macro.go | 4 ++-- util/intelp2m/platforms/ebg/macro.go | 27 ++++++++------------- util/intelp2m/platforms/jsl/macro.go | 28 ++++++++-------------- util/intelp2m/platforms/lbg/macro.go | 28 ++++++++-------------- util/intelp2m/platforms/mtl/macro.go | 30 +++++++++--------------- util/intelp2m/platforms/snr/macro.go | 25 +++++++------------- util/intelp2m/platforms/tgl/macro.go | 28 ++++++++-------------- 11 files changed, 107 insertions(+), 147 deletions(-) diff --git a/util/intelp2m/platforms/adl/macro.go b/util/intelp2m/platforms/adl/macro.go index 19e9bd20e5..63104d0ce8 100644 --- a/util/intelp2m/platforms/adl/macro.go +++ b/util/intelp2m/platforms/adl/macro.go @@ -14,6 +14,13 @@ const ( DW1Mask uint32 = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + 0b11: bits.RstCfgPWROK << bits.DW0PadRstCfg, +} + type BasePlatform struct { // based on the Cannon Lake platform cnl.BasePlatform @@ -28,30 +35,15 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override BasePlatform.RemapRstSrc() -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the Alderlake GPD Group in the Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/alderlake/gpio.c#L21 // remmap is not required because it is the same as common. return } - - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, - 0b11: bits.RstCfgPWROK << bits.DW0PadRstCfg, + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - dw0 := p.GetRegisterDW0() - source, valid := remapping[dw0.GetResetConfig()] - if valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } diff --git a/util/intelp2m/platforms/apl/macro.go b/util/intelp2m/platforms/apl/macro.go index f20acc46a3..614d0bebd6 100644 --- a/util/intelp2m/platforms/apl/macro.go +++ b/util/intelp2m/platforms/apl/macro.go @@ -25,8 +25,8 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// RemapRstSrc() remaps Pad Reset Source Config -func (p *BasePlatform) RemapRstSrc(m *common.Macro) {} +// RemapResetSource() remaps Pad Reset Source Config +func (p *BasePlatform) RemapResetSource(m *common.Macro) {} // Pull() adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro func (p *BasePlatform) Pull(m *common.Macro) { diff --git a/util/intelp2m/platforms/cnl/macro.go b/util/intelp2m/platforms/cnl/macro.go index 7f5421510c..625df0aa5f 100644 --- a/util/intelp2m/platforms/cnl/macro.go +++ b/util/intelp2m/platforms/cnl/macro.go @@ -15,6 +15,12 @@ const ( DW1Mask uint32 = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +} + type BasePlatform struct { // based on the Sunrise platform snr.BasePlatform @@ -29,8 +35,8 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override BasePlatform.RemapRstSrc() -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { if strings.Contains(m.GetPadId(), "GPP_A") || strings.Contains(m.GetPadId(), "GPP_B") || strings.Contains(m.GetPadId(), "GPP_G") { @@ -39,23 +45,9 @@ func (p *BasePlatform) RemapRstSrc(m *common.Macro) { // remmap is not required because it is the same as common. return } - - dw0 := p.GetRegisterDW0() - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - source, valid := remapping[dw0.GetResetConfig()] - if valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } // Override BasePlatform.Pull() diff --git a/util/intelp2m/platforms/common/common.go b/util/intelp2m/platforms/common/common.go index 57719842ca..9f4edce7c3 100644 --- a/util/intelp2m/platforms/common/common.go +++ b/util/intelp2m/platforms/common/common.go @@ -1,9 +1,14 @@ package common import ( + "fmt" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) +type ResetSources map[uint32]uint32 + type BasePlatform struct { dw0 register.DW0 dw1 register.DW1 @@ -23,3 +28,20 @@ func (p *BasePlatform) GetRegisterDW0() *register.DW0 { func (p *BasePlatform) GetRegisterDW1() *register.DW1 { return &p.dw1 } + +// UpdateResetSource() updates the Pad Reset configuration fields in the DW0 register according +// to the ResetSources{} map. Redefine this function for the corresponding platform if it has a +// difference in logic or register bits. +func (p *BasePlatform) UpdateResetSource(remapping ResetSources) error { + dw0 := p.GetRegisterDW0() + mask := bits.DW0[bits.DW0PadRstCfg] + source, valid := remapping[dw0.GetResetConfig()] + if !valid { + dw0.CntrMaskFieldsClear(mask) + return fmt.Errorf("invalid reset config source value 0b%b", dw0.GetResetConfig()) + } + dw0.Value &= ^mask + dw0.Value |= source + dw0.CntrMaskFieldsClear(mask) + return nil +} diff --git a/util/intelp2m/platforms/common/macro.go b/util/intelp2m/platforms/common/macro.go index 0f544acb08..76e76e81f5 100644 --- a/util/intelp2m/platforms/common/macro.go +++ b/util/intelp2m/platforms/common/macro.go @@ -22,7 +22,7 @@ type FieldsIf interface { } type PlatformIf interface { - RemapRstSrc(*Macro) + RemapResetSource(*Macro) Pull(*Macro) AddGpiMacro(*Macro) AddGpoMacro(*Macro) @@ -352,7 +352,7 @@ func (m *Macro) Bidirection() { // Generate() generates string of macro func (m *Macro) Generate() string { - m.Platform.RemapRstSrc(m) + m.Platform.RemapResetSource(m) if dw0 := m.Platform.GetRegisterDW0(); dw0.GetPadMode() == 0 { const txDisable uint32 = 0b01 const rxDisable uint32 = 0b10 diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index 771d6df6cd..f1a967ece4 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -12,6 +12,12 @@ const ( DW1Mask = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +} + type BasePlatform struct { // based on the Cannon Lake platform cnl.BasePlatform @@ -26,22 +32,9 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override BasePlatform.RemapRstSrc() -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - dw0 := p.GetRegisterDW0() - source, valid := remapping[dw0.GetResetConfig()] - if valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } diff --git a/util/intelp2m/platforms/jsl/macro.go b/util/intelp2m/platforms/jsl/macro.go index fa5cbedd7a..92cb66cf33 100644 --- a/util/intelp2m/platforms/jsl/macro.go +++ b/util/intelp2m/platforms/jsl/macro.go @@ -14,6 +14,12 @@ const ( DW1Mask = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +} + type BasePlatform struct { // based on the Cannon Lake platform cnl.BasePlatform @@ -28,8 +34,8 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override the base platform method -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { if strings.Contains(m.GetPadId(), "GPP_F") || strings.Contains(m.GetPadId(), "GPP_B") || strings.Contains(m.GetPadId(), "GPP_A") || @@ -40,21 +46,7 @@ func (p *BasePlatform) RemapRstSrc(m *common.Macro) { // remmap is not required because it is the same as common. return } - - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - dw0 := p.GetRegisterDW0() - source, valid := remapping[dw0.GetResetConfig()] - if valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } diff --git a/util/intelp2m/platforms/lbg/macro.go b/util/intelp2m/platforms/lbg/macro.go index d1b53501b7..b58c8a956a 100644 --- a/util/intelp2m/platforms/lbg/macro.go +++ b/util/intelp2m/platforms/lbg/macro.go @@ -12,6 +12,12 @@ const ( DW1Mask uint32 = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +} + type BasePlatform struct { // based on the Sunrise Point platform snr.BasePlatform @@ -26,23 +32,9 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override the base platform method -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { - dw0 := p.GetRegisterDW0() - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - source, valid := remapping[dw0.GetResetConfig()] - if valid { - // dw0.SetResetConfig(resetsrc) - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } diff --git a/util/intelp2m/platforms/mtl/macro.go b/util/intelp2m/platforms/mtl/macro.go index 13a3f11043..8740f5f783 100644 --- a/util/intelp2m/platforms/mtl/macro.go +++ b/util/intelp2m/platforms/mtl/macro.go @@ -14,6 +14,13 @@ const ( DW1Mask = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + 0b11: bits.RstCfgPWROK << bits.RstCfgPWROK, +} + type BasePlatform struct { // based on the Cannon Lake platform cnl.BasePlatform @@ -28,30 +35,15 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override the base platform method -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the MeteorLake GPD group at // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/meteorlake/gpio.c#L10 // remmap is not required because it is the same as common. return } - - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, - 0b11: bits.RstCfgPWROK << bits.RstCfgPWROK, + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - dw0 := p.GetRegisterDW0() - source, valid := remapping[dw0.GetResetConfig()] - if valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } diff --git a/util/intelp2m/platforms/snr/macro.go b/util/intelp2m/platforms/snr/macro.go index 9a4ace4753..7250608374 100644 --- a/util/intelp2m/platforms/snr/macro.go +++ b/util/intelp2m/platforms/snr/macro.go @@ -14,6 +14,12 @@ const ( DW1Mask uint32 = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +} + type BasePlatform struct { common.BasePlatform } @@ -28,29 +34,16 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { } // RemmapRstSrc() remaps Pad Reset Source Config -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { +func (p *BasePlatform) RemapResetSource(m *common.Macro) { if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the Sunrise GPD Group in the Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/skylake/gpio.c#L15 // remmap is not required because it is the same as common. return } - - dw0 := p.GetRegisterDW0() - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - - if source, valid := remapping[dw0.GetResetConfig()]; valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - dw0.CntrMaskFieldsClear(bits.DW0[bits.DW0PadRstCfg]) } // Pull() adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro diff --git a/util/intelp2m/platforms/tgl/macro.go b/util/intelp2m/platforms/tgl/macro.go index 64ed9bb579..6e63167b2a 100644 --- a/util/intelp2m/platforms/tgl/macro.go +++ b/util/intelp2m/platforms/tgl/macro.go @@ -14,6 +14,12 @@ const ( DW1Mask = 0b11111101111111111100001111111111 ) +var remapping = common.ResetSources{ + 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, + 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, + 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, +} + type BasePlatform struct { // based on the Cannon Lake platform cnl.BasePlatform @@ -28,29 +34,15 @@ func GetPlatform(dw0, dw1 uint32) common.PlatformIf { return &p } -// Override BasePlatform.RemapRstSrc() -func (p *BasePlatform) RemapRstSrc(m *common.Macro) { +// Override BasePlatform.RemapResetSource() +func (p *BasePlatform) RemapResetSource(m *common.Macro) { if strings.Contains(m.GetPadId(), "GPD") { // See reset map for the TigerLake Community 2: // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/tigerlake/gpio.c#L21 // remmap is not required because it is the same as common. return } - - remapping := map[uint32]uint32{ - 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, - 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, - 0b10: bits.RstCfgPLTRST << bits.DW0PadRstCfg, + if err := p.UpdateResetSource(remapping); err != nil { + logs.Errorf("remap reset source for %s: %v", m.GetPadId(), err) } - dw0 := p.GetRegisterDW0() - source, valid := remapping[dw0.GetResetConfig()] - if valid { - dw0.Value &= 0x3fffffff - dw0.Value |= source - } else { - logs.Errorf("%s: skip re-mapping: DW0 %s: invalid reset config source value 0b%b", - m.GetPadId(), dw0, dw0.GetResetConfig()) - } - mask := bits.DW0[bits.DW0PadRstCfg] - dw0.CntrMaskFieldsClear(mask) } From 9e50202e4c0beb5f68154c94c76bb6b7a3eb829d Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Mon, 23 Dec 2024 19:34:15 +0300 Subject: [PATCH 0258/3886] util/intelp2m: Move fields pakage to common According to the architecture, this is part of the common block. TEST: 'make test' = PASS Change-Id: I6390182ab00d9ebd787e8da6f341e3ef85572991 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/71235 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/parser/parser.go | 2 +- util/intelp2m/{ => platforms/common}/fields/cb/cb.go | 0 util/intelp2m/{ => platforms/common}/fields/cb/cb_test.go | 2 +- util/intelp2m/{ => platforms/common}/fields/fields.go | 6 +++--- util/intelp2m/{ => platforms/common}/fields/fsp/fsp.go | 0 util/intelp2m/{ => platforms/common}/fields/fsp/fsp_test.go | 2 +- util/intelp2m/{ => platforms/common}/fields/raw/raw.go | 0 util/intelp2m/{ => platforms/common}/fields/raw/raw_test.go | 2 +- util/intelp2m/{ => platforms/common}/fields/test/suite.go | 2 +- util/intelp2m/platforms/test/suite.go | 2 +- 10 files changed, 9 insertions(+), 9 deletions(-) rename util/intelp2m/{ => platforms/common}/fields/cb/cb.go (100%) rename util/intelp2m/{ => platforms/common}/fields/cb/cb_test.go (96%) rename util/intelp2m/{ => platforms/common}/fields/fields.go (70%) rename util/intelp2m/{ => platforms/common}/fields/fsp/fsp.go (100%) rename util/intelp2m/{ => platforms/common}/fields/fsp/fsp_test.go (98%) rename util/intelp2m/{ => platforms/common}/fields/raw/raw.go (100%) rename util/intelp2m/{ => platforms/common}/fields/raw/raw_test.go (95%) rename util/intelp2m/{ => platforms/common}/fields/test/suite.go (94%) diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index 4575549544..91428f83de 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -7,11 +7,11 @@ import ( "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/parser/template" "review.coreboot.org/coreboot.git/util/intelp2m/platforms" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/register/bits" ) diff --git a/util/intelp2m/fields/cb/cb.go b/util/intelp2m/platforms/common/fields/cb/cb.go similarity index 100% rename from util/intelp2m/fields/cb/cb.go rename to util/intelp2m/platforms/common/fields/cb/cb.go diff --git a/util/intelp2m/fields/cb/cb_test.go b/util/intelp2m/platforms/common/fields/cb/cb_test.go similarity index 96% rename from util/intelp2m/fields/cb/cb_test.go rename to util/intelp2m/platforms/common/fields/cb/cb_test.go index e553551199..f4fcba850e 100644 --- a/util/intelp2m/fields/cb/cb_test.go +++ b/util/intelp2m/platforms/common/fields/cb/cb_test.go @@ -4,7 +4,7 @@ import ( "testing" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/test" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields/test" ) // sliding-one diff --git a/util/intelp2m/fields/fields.go b/util/intelp2m/platforms/common/fields/fields.go similarity index 70% rename from util/intelp2m/fields/fields.go rename to util/intelp2m/platforms/common/fields/fields.go index 19074f9ad1..dc5f7bd7b4 100644 --- a/util/intelp2m/fields/fields.go +++ b/util/intelp2m/platforms/common/fields/fields.go @@ -2,10 +2,10 @@ package fields import ( "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/cb" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/fsp" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/raw" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields/cb" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields/fsp" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields/raw" ) // InterfaceSet - set the interface for decoding configuration diff --git a/util/intelp2m/fields/fsp/fsp.go b/util/intelp2m/platforms/common/fields/fsp/fsp.go similarity index 100% rename from util/intelp2m/fields/fsp/fsp.go rename to util/intelp2m/platforms/common/fields/fsp/fsp.go diff --git a/util/intelp2m/fields/fsp/fsp_test.go b/util/intelp2m/platforms/common/fields/fsp/fsp_test.go similarity index 98% rename from util/intelp2m/fields/fsp/fsp_test.go rename to util/intelp2m/platforms/common/fields/fsp/fsp_test.go index 3b6d8c6650..dd36e929c2 100644 --- a/util/intelp2m/fields/fsp/fsp_test.go +++ b/util/intelp2m/platforms/common/fields/fsp/fsp_test.go @@ -4,7 +4,7 @@ import ( "testing" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/test" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields/test" ) func TestFSPFields(t *testing.T) { diff --git a/util/intelp2m/fields/raw/raw.go b/util/intelp2m/platforms/common/fields/raw/raw.go similarity index 100% rename from util/intelp2m/fields/raw/raw.go rename to util/intelp2m/platforms/common/fields/raw/raw.go diff --git a/util/intelp2m/fields/raw/raw_test.go b/util/intelp2m/platforms/common/fields/raw/raw_test.go similarity index 95% rename from util/intelp2m/fields/raw/raw_test.go rename to util/intelp2m/platforms/common/fields/raw/raw_test.go index 067f6aa5ac..d33229dac6 100644 --- a/util/intelp2m/fields/raw/raw_test.go +++ b/util/intelp2m/platforms/common/fields/raw/raw_test.go @@ -4,7 +4,7 @@ import ( "testing" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields/test" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields/test" ) func TestRAWFields(t *testing.T) { diff --git a/util/intelp2m/fields/test/suite.go b/util/intelp2m/platforms/common/fields/test/suite.go similarity index 94% rename from util/intelp2m/fields/test/suite.go rename to util/intelp2m/platforms/common/fields/test/suite.go index 816a3a8105..7fed3f3bba 100644 --- a/util/intelp2m/fields/test/suite.go +++ b/util/intelp2m/platforms/common/fields/test/suite.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields" ) type TestCase struct { diff --git a/util/intelp2m/platforms/test/suite.go b/util/intelp2m/platforms/test/suite.go index aa14d04677..07085368a8 100644 --- a/util/intelp2m/platforms/test/suite.go +++ b/util/intelp2m/platforms/test/suite.go @@ -5,9 +5,9 @@ import ( "testing" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" - "review.coreboot.org/coreboot.git/util/intelp2m/fields" "review.coreboot.org/coreboot.git/util/intelp2m/platforms" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" + "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common/fields" ) type ( From da54bd60af60e1e6e1b92c272972f87c25f3234b Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Mon, 9 Jan 2023 23:48:04 +0300 Subject: [PATCH 0259/3886] Documentation: Update information about intelp2m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I80d5fb5d46b50193e8fecc647d9052a2e29af93f Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/71757 Tested-by: build bot (Jenkins) Reviewed-by: Filip Lewiński Reviewed-by: David Hendricks --- Documentation/util.md | 4 +- Documentation/util/intelp2m/gopackages.png | Bin 11594 -> 0 bytes Documentation/util/intelp2m/index.md | 359 ++++++++++++--------- util/README.md | 4 +- 4 files changed, 215 insertions(+), 152 deletions(-) delete mode 100644 Documentation/util/intelp2m/gopackages.png diff --git a/Documentation/util.md b/Documentation/util.md index f902ba4fdd..e6d1402c8a 100644 --- a/Documentation/util.md +++ b/Documentation/util.md @@ -70,8 +70,8 @@ into a format which can be used in coreboot's verb table `Go` `C` * __intelmetool__ - Dump interesting things about Management Engine even if hidden `C` -* __intelp2m__ - convert the configuration DW0/1 registers value from -an inteltool dump to coreboot macros. `go` +* __intelp2m__ - Convert the inteltool register dump to gpio.h with GPIO +configuration for porting coreboot to your motherboard. `Go` * __inteltool__ - Provides information about the Intel CPU/chipset hardware configuration (register contents, MSRs, etc). `C` * __intelvbttool__ - Parse VBT from VGA BIOS `C` diff --git a/Documentation/util/intelp2m/gopackages.png b/Documentation/util/intelp2m/gopackages.png deleted file mode 100644 index fb81a1ce1f38dc5e5bee584a103adeb0dc371907..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11594 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 inteltool.log +``` + +After this step, you can generate `gpio.h`: + +```bash +./intelp2m -file ../inteltool/inteltool.log +``` + +More details in the help: + +```bash ./intelp2m -h -./intelp2m -file /path/to/inteltool.log ``` ## Platforms -It is possible to use templates for parsing inteltool.log files. -To specify such a pattern, use the option `-t