diff --git a/src/soc/intel/common/block/include/intelblocks/p2sb.h b/src/soc/intel/common/block/include/intelblocks/p2sb.h index bf2fc670c6..e587a4d25e 100644 --- a/src/soc/intel/common/block/include/intelblocks/p2sb.h +++ b/src/soc/intel/common/block/include/intelblocks/p2sb.h @@ -37,6 +37,14 @@ void ioe_p2sb_enable_bar(void); uint32_t ioe_p2sb_sbi_read(uint8_t pid, uint16_t reg); void ioe_p2sb_sbi_write(uint8_t pid, uint16_t reg, uint32_t val); +/* + * Functions to access SoC P2SB2. + * pid argument: SBI port Id + */ +void p2sb2_enable_bar(void); +uint32_t p2sb2_sbi_read(uint8_t pid, uint16_t reg); +void p2sb2_sbi_write(uint8_t pid, uint16_t reg, uint32_t val); + union p2sb_bdf { struct { uint16_t fn : 3; diff --git a/src/soc/intel/common/block/p2sb/Kconfig b/src/soc/intel/common/block/p2sb/Kconfig index d67c968941..2e38932bc0 100644 --- a/src/soc/intel/common/block/p2sb/Kconfig +++ b/src/soc/intel/common/block/p2sb/Kconfig @@ -12,6 +12,13 @@ config SOC_INTEL_COMMON_BLOCK_P2SB help Intel Processor common P2SB driver for PCH or SoC die +config SOC_INTEL_COMMON_BLOCK_P2SB2 + bool + select SOC_INTEL_COMMON_BLOCK_BASE_P2SB + help + Intel Processor common driver for a second P2SB (Primary to + SideBand) interface to PCH or SoC die + config SOC_INTEL_COMMON_BLOCK_IOE_P2SB bool select SOC_INTEL_COMMON_BLOCK_BASE_P2SB diff --git a/src/soc/intel/common/block/p2sb/Makefile.mk b/src/soc/intel/common/block/p2sb/Makefile.mk index bcdd5a2752..dc425f0807 100644 --- a/src/soc/intel/common/block/p2sb/Makefile.mk +++ b/src/soc/intel/common/block/p2sb/Makefile.mk @@ -10,6 +10,12 @@ romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB) += p2sb.c ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB) += p2sb.c smm-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB) += p2sb.c +# p2sb2.c for SoC die P2SB2 IP +bootblock-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB2) += p2sb2.c +romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB2) += p2sb2.c +ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB2) += p2sb2.c +smm-$(CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB2) += p2sb2.c + # ioe_p2sb.c for IOE die P2SB IP bootblock-$(CONFIG_SOC_INTEL_COMMON_BLOCK_IOE_P2SB) += ioe_p2sb.c romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_IOE_P2SB) += ioe_p2sb.c diff --git a/src/soc/intel/common/block/p2sb/p2sb2.c b/src/soc/intel/common/block/p2sb/p2sb2.c new file mode 100644 index 0000000000..2627a7182c --- /dev/null +++ b/src/soc/intel/common/block/p2sb/p2sb2.c @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#define __SIMPLE_DEVICE__ + +#include +#include +#include +#include +#include +#include +#include + +uint32_t p2sb2_sbi_read(uint8_t pid, uint16_t reg) +{ + return p2sb_dev_sbi_read(PCI_DEV_P2SB2, pid, reg); +} + +void p2sb2_sbi_write(uint8_t pid, uint16_t reg, uint32_t val) +{ + p2sb_dev_sbi_write(PCI_DEV_P2SB2, pid, reg, val); +} + +void p2sb2_enable_bar(void) +{ + p2sb_dev_enable_bar(PCI_DEV_P2SB2, P2SB2_BAR); +} + +static void read_resources(struct device *dev) +{ + mmio_range(dev, PCI_BASE_ADDRESS_0, P2SB2_BAR, P2SB2_SIZE); +} + +struct device_operations p2sb2_ops = { + .read_resources = read_resources, + .set_resources = noop_set_resources, + .ops_pci = &pci_dev_ops_pci, +}; + +static const unsigned short pci_device_ids[] = { + PCI_DID_INTEL_WCL_P2SB2, + PCI_DID_INTEL_PTL_H_P2SB2, + PCI_DID_INTEL_PTL_U_H_P2SB2, + 0, +}; + +static const struct pci_driver p2sb2 __pci_driver = { + .ops = &p2sb2_ops, + .vendor = PCI_VID_INTEL, + .devices = pci_device_ids, +};