soc/intel: Abstract the common block API for TCSS registers access

The existing TCSS registers access is through the REGBAR. There will be
future platforms which access the TCSS registers through the Sideband
interface. This change abstracts the common block API for TCSS access.

BUG=b:213574324
TEST=Build platforms coreboot images successfully.

Signed-off-by: John Zhao <john.zhao@intel.com>
Change-Id: I3e2696b117af24412d73b257f470efc40caa5022
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60989
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
John Zhao 2022-01-10 15:49:37 -08:00 committed by Felix Held
parent 0bc5d9dfff
commit 3c46371a51
7 changed files with 49 additions and 11 deletions

View File

@ -87,6 +87,7 @@ config CPU_SPECIFIC_OPTIONS
select SOC_INTEL_COMMON_BLOCK_SMM select SOC_INTEL_COMMON_BLOCK_SMM
select SOC_INTEL_COMMON_BLOCK_SMM_IO_TRAP select SOC_INTEL_COMMON_BLOCK_SMM_IO_TRAP
select SOC_INTEL_COMMON_BLOCK_TCSS select SOC_INTEL_COMMON_BLOCK_TCSS
select SOC_INTEL_COMMON_BLOCK_TCSS_REG_ACCESS_REGBAR
select SOC_INTEL_COMMON_BLOCK_THERMAL_BEHIND_PMC select SOC_INTEL_COMMON_BLOCK_THERMAL_BEHIND_PMC
select SOC_INTEL_COMMON_BLOCK_USB4 select SOC_INTEL_COMMON_BLOCK_USB4
select SOC_INTEL_COMMON_BLOCK_USB4_PCIE select SOC_INTEL_COMMON_BLOCK_USB4_PCIE

View File

@ -151,4 +151,7 @@ void tcss_configure(const struct typec_aux_bias_pads pads[MAX_TYPE_C_PORTS]);
*/ */
const struct tcss_port_map *tcss_get_port_info(size_t *num_ports); const struct tcss_port_map *tcss_get_port_info(size_t *num_ports);
/* Method to validate the Thunderbolt authentication */
uint32_t tcss_valid_tbt_auth(void);
#endif /* _TCSS_H_ */ #endif /* _TCSS_H_ */

View File

@ -9,3 +9,16 @@ config ENABLE_TCSS_DISPLAY_DETECTION
depends on SOC_INTEL_COMMON_BLOCK_TCSS && RUN_FSP_GOP depends on SOC_INTEL_COMMON_BLOCK_TCSS && RUN_FSP_GOP
help help
Enable displays to be detected over Type-C ports during boot. Enable displays to be detected over Type-C ports during boot.
config SOC_INTEL_COMMON_BLOCK_TCSS_REG_ACCESS_REGBAR
def_bool n
depends on SOC_INTEL_COMMON_BLOCK_TCSS
help
Enable TCSS registers access through REGBAR for platforms like
Tiger Lake and Alder Lake
config SOC_INTEL_COMMON_BLOCK_TCSS_REG_ACCESS_SBI
def_bool n
depends on SOC_INTEL_COMMON_BLOCK_TCSS
help
Enable TCSS registers access through Sideband interface on applicable SoC platforms

View File

@ -1,8 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SPDX-License-Identifier: GPL-2.0-or-later */
#define __SIMPLE_DEVICE__
#include <bootmode.h> #include <bootmode.h>
#include <console/console.h> #include <console/console.h>
#include <device/pci.h> #include <device/pci.h>
#include <intelblocks/p2sb.h>
#include <intelblocks/pcr.h>
#include <intelblocks/pmc_ipc.h> #include <intelblocks/pmc_ipc.h>
#include <intelblocks/systemagent.h> #include <intelblocks/systemagent.h>
#include <intelblocks/tcss.h> #include <intelblocks/tcss.h>
@ -351,8 +355,8 @@ static uint32_t calc_bias_ctrl_reg_value(gpio_t pad)
cpu_pid; cpu_pid;
} }
static void tcss_configure_aux_bias_pads( static void tcss_configure_aux_bias_pads_regbar(
const struct typec_aux_bias_pads pads[MAX_TYPE_C_PORTS]) const struct typec_aux_bias_pads *pads)
{ {
for (size_t i = 0; i < MAX_TYPE_C_PORTS; i++) { for (size_t i = 0; i < MAX_TYPE_C_PORTS; i++) {
if (pads[i].pad_auxn_dc && pads[i].pad_auxp_dc) { if (pads[i].pad_auxn_dc && pads[i].pad_auxp_dc) {
@ -364,6 +368,16 @@ static void tcss_configure_aux_bias_pads(
} }
} }
static void tcss_configure_aux_bias_pads(
const struct typec_aux_bias_pads *pads)
{
if (CONFIG(SOC_INTEL_COMMON_BLOCK_TCSS_REG_ACCESS_REGBAR))
tcss_configure_aux_bias_pads_regbar(pads);
else
printk(BIOS_ERR, "%s: Error: No TCSS configuration method is selected!\n",
__func__);
}
const struct tcss_port_map *tcss_get_port_info(size_t *num_ports) const struct tcss_port_map *tcss_get_port_info(size_t *num_ports)
{ {
static struct tcss_port_map port_map[MAX_TYPE_C_PORTS]; static struct tcss_port_map port_map[MAX_TYPE_C_PORTS];
@ -414,3 +428,14 @@ void tcss_configure(const struct typec_aux_bias_pads aux_bias_pads[MAX_TYPE_C_PO
if (CONFIG(ENABLE_TCSS_DISPLAY_DETECTION)) if (CONFIG(ENABLE_TCSS_DISPLAY_DETECTION))
tcss_configure_dp_mode(port_map, num_ports); tcss_configure_dp_mode(port_map, num_ports);
} }
uint32_t tcss_valid_tbt_auth(void)
{
if (CONFIG(SOC_INTEL_COMMON_BLOCK_TCSS_REG_ACCESS_REGBAR)) {
return REGBAR32(PID_IOM, IOM_CSME_IMR_TBT_STATUS) & TBT_VALID_AUTHENTICATION;
} else {
printk(BIOS_ERR, "%s: Error: No validation for Thunderbolt authentication!\n",
__func__);
return 0;
}
}

View File

@ -1,6 +1,7 @@
config SOC_INTEL_COMMON_BLOCK_USB4 config SOC_INTEL_COMMON_BLOCK_USB4
bool bool
default n default n
depends on SOC_INTEL_COMMON_BLOCK_TCSS
help help
Minimal PCI Driver for enabling SSDT generation for the DMA component Minimal PCI Driver for enabling SSDT generation for the DMA component
of Intel Thunderbolt/USB4 ports. of Intel Thunderbolt/USB4 ports.

View File

@ -6,10 +6,8 @@
#include <device/pci.h> #include <device/pci.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ids.h> #include <device/pci_ids.h>
#include <intelblocks/systemagent.h> #include <intelblocks/tcss.h>
#include <soc/pci_devs.h> #include <soc/pci_devs.h>
#include <soc/pcr_ids.h>
#include <soc/tcss.h>
#define INTEL_TBT_IMR_VALID_UUID "C44D002F-69F9-4E7D-A904-A7BAABDF43F7" #define INTEL_TBT_IMR_VALID_UUID "C44D002F-69F9-4E7D-A904-A7BAABDF43F7"
#define INTEL_TBT_WAKE_SUPPORTED_UUID "6C501103-C189-4296-BA72-9BF5A26EBE5D" #define INTEL_TBT_WAKE_SUPPORTED_UUID "6C501103-C189-4296-BA72-9BF5A26EBE5D"
@ -27,16 +25,11 @@ static const char *tbt_dma_acpi_name(const struct device *dev)
} }
} }
static int valid_tbt_auth(void)
{
return REGBAR32(PID_IOM, IOM_CSME_IMR_TBT_STATUS) & TBT_VALID_AUTHENTICATION;
}
static void tbt_dma_fill_ssdt(const struct device *dev) static void tbt_dma_fill_ssdt(const struct device *dev)
{ {
struct acpi_dp *dsd, *pkg; struct acpi_dp *dsd, *pkg;
if (!valid_tbt_auth()) if (!tcss_valid_tbt_auth())
return; return;
acpigen_write_scope(acpi_device_path(dev)); acpigen_write_scope(acpi_device_path(dev));

View File

@ -67,6 +67,8 @@ config CPU_SPECIFIC_OPTIONS
select SOC_INTEL_COMMON_BLOCK_SA select SOC_INTEL_COMMON_BLOCK_SA
select SOC_INTEL_COMMON_BLOCK_SMM select SOC_INTEL_COMMON_BLOCK_SMM
select SOC_INTEL_COMMON_BLOCK_SMM_IO_TRAP select SOC_INTEL_COMMON_BLOCK_SMM_IO_TRAP
select SOC_INTEL_COMMON_BLOCK_TCSS
select SOC_INTEL_COMMON_BLOCK_TCSS_REG_ACCESS_REGBAR
select SOC_INTEL_COMMON_BLOCK_USB4 select SOC_INTEL_COMMON_BLOCK_USB4
select SOC_INTEL_COMMON_BLOCK_USB4_PCIE select SOC_INTEL_COMMON_BLOCK_USB4_PCIE
select SOC_INTEL_COMMON_BLOCK_USB4_XHCI select SOC_INTEL_COMMON_BLOCK_USB4_XHCI