{northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem()
This patch removes local definitions of sub_system function and make use
of common function pci_dev_set_subsystem().
Change-Id: I91982597fdf586ab514bec3d8e4d09f2565fe56d
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31982
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: David Guckian
Reviewed-by: Furquan Shaikh <furquan@google.com>
diff --git a/src/soc/intel/baytrail/chip.c b/src/soc/intel/baytrail/chip.c
index 2102637..acac679 100644
--- a/src/soc/intel/baytrail/chip.c
+++ b/src/soc/intel/baytrail/chip.c
@@ -72,18 +72,6 @@
.init = soc_init,
};
-static void pci_set_subsystem(struct device *dev, unsigned vendor,
- unsigned device)
-{
- if (!vendor || !device) {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- } else {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- ((device & 0xffff) << 16) | (vendor & 0xffff));
- }
-}
-
struct pci_operations soc_pci_ops = {
- .set_subsystem = &pci_set_subsystem,
+ .set_subsystem = &pci_dev_set_subsystem,
};
diff --git a/src/soc/intel/braswell/chip.c b/src/soc/intel/braswell/chip.c
index e8fd9d1..7617d53 100644
--- a/src/soc/intel/braswell/chip.c
+++ b/src/soc/intel/braswell/chip.c
@@ -380,22 +380,8 @@
.init = soc_init,
};
-static void pci_set_subsystem(struct device *dev, unsigned int vendor,
- unsigned int device)
-{
- printk(BIOS_SPEW, "%s/%s (%s, 0x%04x, 0x%04x)\n",
- __FILE__, __func__, dev_name(dev), vendor, device);
- if (!vendor || !device) {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- } else {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- ((device & 0xffff) << 16) | (vendor & 0xffff));
- }
-}
-
struct pci_operations soc_pci_ops = {
- .set_subsystem = &pci_set_subsystem,
+ .set_subsystem = &pci_dev_set_subsystem,
};
/**
diff --git a/src/soc/intel/broadwell/chip.c b/src/soc/intel/broadwell/chip.c
index 6383e15..caff026 100644
--- a/src/soc/intel/broadwell/chip.c
+++ b/src/soc/intel/broadwell/chip.c
@@ -64,17 +64,6 @@
.init = &broadwell_init_pre_device,
};
-static void pci_set_subsystem(struct device *dev, unsigned int vendor,
- unsigned int device)
-{
- if (!vendor || !device)
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- else
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- (device << 16) | vendor);
-}
-
struct pci_operations broadwell_pci_ops = {
- .set_subsystem = &pci_set_subsystem
+ .set_subsystem = &pci_dev_set_subsystem
};
diff --git a/src/soc/intel/broadwell/ehci.c b/src/soc/intel/broadwell/ehci.c
index 53af617..f29c426 100644
--- a/src/soc/intel/broadwell/ehci.c
+++ b/src/soc/intel/broadwell/ehci.c
@@ -33,13 +33,7 @@
/* Enable writes to protected registers. */
pci_write_config8(dev, 0x80, access_cntl | 1);
- if (!vendor || !device) {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- } else {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- ((device & 0xffff) << 16) | (vendor & 0xffff));
- }
+ pci_dev_set_subsystem(dev, vendor, device);
/* Restore protection. */
pci_write_config8(dev, 0x80, access_cntl);
diff --git a/src/soc/intel/denverton_ns/chip.c b/src/soc/intel/denverton_ns/chip.c
index 68bd60c..b72bf28 100644
--- a/src/soc/intel/denverton_ns/chip.c
+++ b/src/soc/intel/denverton_ns/chip.c
@@ -129,21 +129,8 @@
.final = soc_final
};
-static void soc_set_subsystem(struct device *dev, uint32_t vendor,
- uint32_t device)
-{
- if (!vendor || !device) {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- } else {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- ((device & 0xffff) << 16) |
- (vendor & 0xffff));
- }
-}
-
struct pci_operations soc_pci_ops = {
- .set_subsystem = soc_set_subsystem,
+ .set_subsystem = pci_dev_set_subsystem,
};
/*
diff --git a/src/soc/intel/fsp_baytrail/chip.c b/src/soc/intel/fsp_baytrail/chip.c
index c74c847..9e86279 100644
--- a/src/soc/intel/fsp_baytrail/chip.c
+++ b/src/soc/intel/fsp_baytrail/chip.c
@@ -74,17 +74,6 @@
.init = soc_init,
};
-static void pci_set_subsystem(struct device *dev, unsigned vendor, unsigned device)
-{
- if (!vendor || !device) {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- } else {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- ((device & 0xffff) << 16) | (vendor & 0xffff));
- }
-}
-
struct pci_operations soc_pci_ops = {
- .set_subsystem = &pci_set_subsystem,
+ .set_subsystem = &pci_dev_set_subsystem,
};
diff --git a/src/soc/intel/fsp_broadwell_de/chip.c b/src/soc/intel/fsp_broadwell_de/chip.c
index 6b14845..ba825f4 100644
--- a/src/soc/intel/fsp_broadwell_de/chip.c
+++ b/src/soc/intel/fsp_broadwell_de/chip.c
@@ -88,18 +88,6 @@
.init = soc_init,
};
-static void pci_set_subsystem(struct device *dev, unsigned vendor,
- unsigned device)
-{
- if (!vendor || !device) {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- pci_read_config32(dev, PCI_VENDOR_ID));
- } else {
- pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
- ((device & 0xffff) << 16) | (vendor & 0xffff));
- }
-}
-
struct pci_operations soc_pci_ops = {
- .set_subsystem = &pci_set_subsystem,
+ .set_subsystem = &pci_dev_set_subsystem,
};