From 6bbc91a96468b97a3e19cdba4641d68e2f2a6f98 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 7 Dec 2017 14:55:51 +0530 Subject: soc/intel/common/block: Add option to have subsystem_id in common pci driver This patch ensures all Intel common PCI devices can have subsystem ID programmed along with PCI resource enabling (.enable_resources) as part of PCI enumeration process. TEST=Build and boot KBL/CNL/APL/GLK to ensure PCI subsystem ID getting programmed. Example: Enabling resources... PCI: 00:00.0 subsystem <- 8086/590c PCI: 00:00.0 cmd <- 06 PCI: 00:02.0 subsystem <- 8086/591e Change-Id: I46307b0db78c8864c85865bd0f3328d5141971be Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/22768 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/soc/intel/common/block/cse/cse.c | 1 + src/soc/intel/common/block/dsp/dsp.c | 1 + src/soc/intel/common/block/graphics/graphics.c | 1 + src/soc/intel/common/block/i2c/i2c.c | 1 + src/soc/intel/common/block/lpc/lpc.c | 15 ++++++++------- src/soc/intel/common/block/p2sb/p2sb.c | 1 + src/soc/intel/common/block/pcie/pcie.c | 10 ++++++++++ src/soc/intel/common/block/pmc/pmc.c | 1 + src/soc/intel/common/block/sata/sata.c | 5 +++-- src/soc/intel/common/block/scs/sd.c | 7 ++++--- src/soc/intel/common/block/smbus/smbus.c | 1 + src/soc/intel/common/block/spi/spi.c | 1 + src/soc/intel/common/block/sram/sram.c | 1 + src/soc/intel/common/block/systemagent/systemagent.c | 1 + src/soc/intel/common/block/uart/uart.c | 1 + src/soc/intel/common/block/xdci/xdci.c | 1 + src/soc/intel/common/block/xhci/xhci.c | 1 + 17 files changed, 38 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c index 77a9b631d9..370074e222 100644 --- a/src/soc/intel/common/block/cse/cse.c +++ b/src/soc/intel/common/block/cse/cse.c @@ -502,6 +502,7 @@ static struct device_operations cse_ops = { .read_resources = pci_dev_read_resources, .enable_resources = pci_dev_enable_resources, .init = pci_dev_init, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/dsp/dsp.c b/src/soc/intel/common/block/dsp/dsp.c index 5b4f9321b8..365fab7b17 100644 --- a/src/soc/intel/common/block/dsp/dsp.c +++ b/src/soc/intel/common/block/dsp/dsp.c @@ -22,6 +22,7 @@ static struct device_operations dsp_dev_ops = { .read_resources = &pci_dev_read_resources, .set_resources = &pci_dev_set_resources, .enable_resources = &pci_dev_enable_resources, + .ops_pci = &pci_dev_ops_pci, .scan_bus = &scan_static_bus, }; diff --git a/src/soc/intel/common/block/graphics/graphics.c b/src/soc/intel/common/block/graphics/graphics.c index 544ae96231..4a1e5579b0 100644 --- a/src/soc/intel/common/block/graphics/graphics.c +++ b/src/soc/intel/common/block/graphics/graphics.c @@ -99,6 +99,7 @@ static const struct device_operations graphics_ops = { .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, .init = graphics_soc_init, + .ops_pci = &pci_dev_ops_pci, .write_acpi_tables = graphics_soc_write_acpi_opregion, }; diff --git a/src/soc/intel/common/block/i2c/i2c.c b/src/soc/intel/common/block/i2c/i2c.c index c6f3be2206..3bb7d11309 100644 --- a/src/soc/intel/common/block/i2c/i2c.c +++ b/src/soc/intel/common/block/i2c/i2c.c @@ -172,6 +172,7 @@ static struct device_operations i2c_dev_ops = { .enable_resources = &pci_dev_enable_resources, .scan_bus = &scan_smbus, .ops_i2c_bus = &i2c_bus_ops, + .ops_pci = &pci_dev_ops_pci, .init = &lpss_i2c_dev_init, .acpi_fill_ssdt_generator = &lpss_i2c_acpi_fill_ssdt, }; diff --git a/src/soc/intel/common/block/lpc/lpc.c b/src/soc/intel/common/block/lpc/lpc.c index 9d54e11618..6b886e3fa4 100644 --- a/src/soc/intel/common/block/lpc/lpc.c +++ b/src/soc/intel/common/block/lpc/lpc.c @@ -89,13 +89,14 @@ static void set_resources(device_t dev) } static struct device_operations device_ops = { - .read_resources = soc_lpc_read_resources, - .set_resources = set_resources, - .enable_resources = pci_dev_enable_resources, - .write_acpi_tables = southbridge_write_acpi_tables, - .acpi_inject_dsdt_generator = southbridge_inject_dsdt, - .init = lpc_init, - .scan_bus = scan_lpc_bus, + .read_resources = soc_lpc_read_resources, + .set_resources = set_resources, + .enable_resources = pci_dev_enable_resources, + .write_acpi_tables = southbridge_write_acpi_tables, + .acpi_inject_dsdt_generator = southbridge_inject_dsdt, + .init = lpc_init, + .scan_bus = scan_lpc_bus, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/p2sb/p2sb.c b/src/soc/intel/common/block/p2sb/p2sb.c index 63b9c85613..6a9bd34668 100644 --- a/src/soc/intel/common/block/p2sb/p2sb.c +++ b/src/soc/intel/common/block/p2sb/p2sb.c @@ -64,6 +64,7 @@ static void read_resources(struct device *dev) static const struct device_operations device_ops = { .read_resources = read_resources, .set_resources = DEVICE_NOOP, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/pcie/pcie.c b/src/soc/intel/common/block/pcie/pcie.c index 19133f0b55..7d383fdfaa 100644 --- a/src/soc/intel/common/block/pcie/pcie.c +++ b/src/soc/intel/common/block/pcie/pcie.c @@ -24,6 +24,8 @@ #define PCIE_LTR_MAX_NO_SNOOP_LATENCY_VALUE 0x1003 /* Latency tolerance reporting, max snoop latency value 3.14ms */ #define PCIE_LTR_MAX_SNOOP_LATENCY_VALUE 0x1003 +/* PCI-E Sub-System ID */ +#define PCIE_SUBSYSTEM_VENDOR_ID 0x94 static void pch_pcie_init(struct device *dev) { @@ -69,8 +71,16 @@ static void pcie_set_L1_ss_max_latency(device_t dev, unsigned int offset) PCIE_LTR_MAX_SNOOP_LATENCY_VALUE); } +static void pcie_dev_set_subsystem(struct device *dev, + unsigned vendor, unsigned device) +{ + pci_write_config32(dev, PCIE_SUBSYSTEM_VENDOR_ID, + ((device & 0xffff) << 16) | (vendor & 0xffff)); +} + static struct pci_operations pcie_ops = { .set_L1_ss_latency = pcie_set_L1_ss_max_latency, + .set_subsystem = pcie_dev_set_subsystem, }; static struct device_operations device_ops = { diff --git a/src/soc/intel/common/block/pmc/pmc.c b/src/soc/intel/common/block/pmc/pmc.c index 708e70572a..e1efe4641f 100644 --- a/src/soc/intel/common/block/pmc/pmc.c +++ b/src/soc/intel/common/block/pmc/pmc.c @@ -99,6 +99,7 @@ static struct device_operations device_ops = { .set_resources = &pci_dev_set_resources, .enable_resources = &pci_dev_enable_resources, .init = &pmc_soc_init, + .ops_pci = &pci_dev_ops_pci, .scan_bus = &scan_lpc_bus, }; diff --git a/src/soc/intel/common/block/sata/sata.c b/src/soc/intel/common/block/sata/sata.c index f3006569d3..791510eda3 100644 --- a/src/soc/intel/common/block/sata/sata.c +++ b/src/soc/intel/common/block/sata/sata.c @@ -61,8 +61,9 @@ static void sata_final(device_t dev) static struct device_operations sata_ops = { .read_resources = &pci_dev_read_resources, .set_resources = &pci_dev_set_resources, - .enable_resources = &pci_dev_enable_resources, - .final = sata_final, + .enable_resources = &pci_dev_enable_resources, + .final = sata_final, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/scs/sd.c b/src/soc/intel/common/block/scs/sd.c index d6f48431bf..66eaddf5eb 100644 --- a/src/soc/intel/common/block/scs/sd.c +++ b/src/soc/intel/common/block/scs/sd.c @@ -55,12 +55,13 @@ static void sd_fill_ssdt(struct device *dev) #endif static struct device_operations dev_ops = { - .read_resources = &pci_dev_read_resources, - .set_resources = &pci_dev_set_resources, - .enable_resources = &pci_dev_enable_resources, + .read_resources = &pci_dev_read_resources, + .set_resources = &pci_dev_set_resources, + .enable_resources = &pci_dev_enable_resources, #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) .acpi_fill_ssdt_generator = &sd_fill_ssdt, #endif + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/smbus/smbus.c b/src/soc/intel/common/block/smbus/smbus.c index e526bafc79..880a0614e7 100644 --- a/src/soc/intel/common/block/smbus/smbus.c +++ b/src/soc/intel/common/block/smbus/smbus.c @@ -83,6 +83,7 @@ static struct device_operations smbus_ops = { .enable_resources = &pci_dev_enable_resources, .scan_bus = &scan_smbus, .init = &pch_smbus_init, + .ops_pci = &pci_dev_ops_pci, .ops_smbus_bus = &lops_smbus_bus, }; diff --git a/src/soc/intel/common/block/spi/spi.c b/src/soc/intel/common/block/spi/spi.c index 9a34044adb..3a514666f8 100644 --- a/src/soc/intel/common/block/spi/spi.c +++ b/src/soc/intel/common/block/spi/spi.c @@ -49,6 +49,7 @@ static struct device_operations spi_dev_ops = { .enable_resources = &pci_dev_enable_resources, .scan_bus = &scan_generic_bus, .ops_spi_bus = &spi_bus_ops, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/sram/sram.c b/src/soc/intel/common/block/sram/sram.c index 05fc5c736b..49367e196b 100644 --- a/src/soc/intel/common/block/sram/sram.c +++ b/src/soc/intel/common/block/sram/sram.c @@ -43,6 +43,7 @@ static const struct device_operations device_ops = { .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, .init = soc_sram_init, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c index 5be9fe1511..f6301ddc53 100644 --- a/src/soc/intel/common/block/systemagent/systemagent.c +++ b/src/soc/intel/common/block/systemagent/systemagent.c @@ -281,6 +281,7 @@ static struct device_operations systemagent_ops = { .set_resources = &pci_dev_set_resources, .enable_resources = &pci_dev_enable_resources, .init = soc_systemagent_init, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short systemagent_ids[] = { diff --git a/src/soc/intel/common/block/uart/uart.c b/src/soc/intel/common/block/uart/uart.c index 7685415d94..1be3a8736b 100644 --- a/src/soc/intel/common/block/uart/uart.c +++ b/src/soc/intel/common/block/uart/uart.c @@ -144,6 +144,7 @@ static struct device_operations device_ops = { .read_resources = &pch_uart_read_resources, .set_resources = &pci_dev_set_resources, .enable_resources = &uart_common_enable_resources, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/xdci/xdci.c b/src/soc/intel/common/block/xdci/xdci.c index 7b74b215d3..10e6f0d10a 100644 --- a/src/soc/intel/common/block/xdci/xdci.c +++ b/src/soc/intel/common/block/xdci/xdci.c @@ -27,6 +27,7 @@ static struct device_operations usb_xdci_ops = { .set_resources = &pci_dev_set_resources, .enable_resources = &pci_dev_enable_resources, .init = soc_xdci_init, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { diff --git a/src/soc/intel/common/block/xhci/xhci.c b/src/soc/intel/common/block/xhci/xhci.c index ac7bd580cb..49a51697bf 100644 --- a/src/soc/intel/common/block/xhci/xhci.c +++ b/src/soc/intel/common/block/xhci/xhci.c @@ -27,6 +27,7 @@ static struct device_operations usb_xhci_ops = { .set_resources = &pci_dev_set_resources, .enable_resources = &pci_dev_enable_resources, .init = soc_xhci_init, + .ops_pci = &pci_dev_ops_pci, }; static const unsigned short pci_device_ids[] = { -- cgit v1.2.3