Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31982
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
{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 --- M src/northbridge/intel/e7505/northbridge.c M src/northbridge/intel/fsp_rangeley/northbridge.c M src/northbridge/intel/gm45/gma.c M src/northbridge/intel/haswell/gma.c M src/northbridge/intel/haswell/minihd.c M src/northbridge/intel/haswell/northbridge.c M src/northbridge/intel/i945/gma.c M src/northbridge/intel/i945/northbridge.c M src/northbridge/intel/nehalem/gma.c M src/northbridge/intel/nehalem/northbridge.c M src/northbridge/intel/pineview/gma.c M src/northbridge/intel/sandybridge/gma.c M src/northbridge/intel/sandybridge/northbridge.c M src/northbridge/intel/x4x/gma.c M src/soc/intel/baytrail/chip.c M src/soc/intel/braswell/chip.c M src/soc/intel/broadwell/chip.c M src/soc/intel/broadwell/ehci.c M src/soc/intel/denverton_ns/chip.c M src/soc/intel/fsp_baytrail/chip.c M src/soc/intel/fsp_broadwell_de/chip.c M src/southbridge/intel/bd82x6x/azalia.c M src/southbridge/intel/bd82x6x/lpc.c M src/southbridge/intel/bd82x6x/me.c M src/southbridge/intel/bd82x6x/me_8.x.c M src/southbridge/intel/bd82x6x/sata.c M src/southbridge/intel/bd82x6x/smbus.c M src/southbridge/intel/bd82x6x/usb_ehci.c M src/southbridge/intel/bd82x6x/usb_xhci.c M src/southbridge/intel/fsp_rangeley/lpc.c M src/southbridge/intel/fsp_rangeley/sata.c M src/southbridge/intel/fsp_rangeley/smbus.c M src/southbridge/intel/i82801gx/ac97.c M src/southbridge/intel/i82801gx/azalia.c M src/southbridge/intel/i82801gx/ide.c M src/southbridge/intel/i82801gx/lpc.c M src/southbridge/intel/i82801gx/sata.c M src/southbridge/intel/i82801gx/smbus.c M src/southbridge/intel/i82801gx/usb.c M src/southbridge/intel/i82801gx/usb_ehci.c M src/southbridge/intel/i82801ix/hdaudio.c M src/southbridge/intel/i82801ix/lpc.c M src/southbridge/intel/i82801ix/sata.c M src/southbridge/intel/i82801ix/smbus.c M src/southbridge/intel/i82801ix/thermal.c M src/southbridge/intel/i82801ix/usb_ehci.c M src/southbridge/intel/i82801jx/hdaudio.c M src/southbridge/intel/i82801jx/lpc.c M src/southbridge/intel/i82801jx/sata.c M src/southbridge/intel/i82801jx/smbus.c M src/southbridge/intel/i82801jx/thermal.c M src/southbridge/intel/i82801jx/usb_ehci.c M src/southbridge/intel/ibexpeak/azalia.c M src/southbridge/intel/ibexpeak/lpc.c M src/southbridge/intel/ibexpeak/me.c M src/southbridge/intel/ibexpeak/sata.c M src/southbridge/intel/ibexpeak/smbus.c M src/southbridge/intel/ibexpeak/thermal.c M src/southbridge/intel/ibexpeak/usb_ehci.c M src/southbridge/intel/lynxpoint/azalia.c M src/southbridge/intel/lynxpoint/lpc.c M src/southbridge/intel/lynxpoint/me_9.x.c M src/southbridge/intel/lynxpoint/sata.c M src/southbridge/intel/lynxpoint/serialio.c M src/southbridge/intel/lynxpoint/smbus.c M src/southbridge/intel/lynxpoint/usb_ehci.c M src/southbridge/intel/lynxpoint/usb_xhci.c M src/southbridge/nvidia/mcp55/azalia.c 68 files changed, 68 insertions(+), 837 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/31982/1
diff --git a/src/northbridge/intel/e7505/northbridge.c b/src/northbridge/intel/e7505/northbridge.c index 8c31f7e..6773a72 100644 --- a/src/northbridge/intel/e7505/northbridge.c +++ b/src/northbridge/intel/e7505/northbridge.c @@ -74,15 +74,8 @@ assign_resources(dev->link_list); }
-static void intel_set_subsystem(struct device *dev, unsigned int vendor, - unsigned int device) -{ - pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, - ((device & 0xffff) << 16) | (vendor & 0xffff)); -} - static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations pci_domain_ops = { diff --git a/src/northbridge/intel/fsp_rangeley/northbridge.c b/src/northbridge/intel/fsp_rangeley/northbridge.c index cd900be..06d0fb2 100644 --- a/src/northbridge/intel/fsp_rangeley/northbridge.c +++ b/src/northbridge/intel/fsp_rangeley/northbridge.c @@ -172,18 +172,6 @@ pci_dev_set_resources(dev); }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void northbridge_init(struct device *dev) { } @@ -193,7 +181,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations pci_domain_ops = { diff --git a/src/northbridge/intel/gm45/gma.c b/src/northbridge/intel/gm45/gma.c index 648aa48..6e54208 100644 --- a/src/northbridge/intel/gm45/gma.c +++ b/src/northbridge/intel/gm45/gma.c @@ -221,19 +221,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -287,7 +274,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/haswell/gma.c b/src/northbridge/intel/haswell/gma.c index 0fd0228..1b2430f 100644 --- a/src/northbridge/intel/haswell/gma.c +++ b/src/northbridge/intel/haswell/gma.c @@ -499,18 +499,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -558,7 +546,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/haswell/minihd.c b/src/northbridge/intel/haswell/minihd.c index 9a1df0f..994296a 100644 --- a/src/northbridge/intel/haswell/minihd.c +++ b/src/northbridge/intel/haswell/minihd.c @@ -103,20 +103,8 @@ } }
-static void minihd_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations minihd_pci_ops = { - .set_subsystem = minihd_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations minihd_ops = { diff --git a/src/northbridge/intel/haswell/northbridge.c b/src/northbridge/intel/haswell/northbridge.c index ad4563b..63e4f93 100644 --- a/src/northbridge/intel/haswell/northbridge.c +++ b/src/northbridge/intel/haswell/northbridge.c @@ -468,18 +468,6 @@ pci_write_config32(host_dev, DEVEN, deven); }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void northbridge_init(struct device *dev) { u8 bios_reset_cpl, pair; @@ -510,7 +498,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c index 633b09d..ee656de 100644 --- a/src/northbridge/intel/i945/gma.c +++ b/src/northbridge/intel/i945/gma.c @@ -756,18 +756,6 @@ pci_write_config8(dev, 0xf4, 0xff); }
-static void gma_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -834,7 +822,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/i945/northbridge.c b/src/northbridge/intel/i945/northbridge.c index ce7d292..0b6542f 100644 --- a/src/northbridge/intel/i945/northbridge.c +++ b/src/northbridge/intel/i945/northbridge.c @@ -192,19 +192,8 @@ } }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/nehalem/gma.c b/src/northbridge/intel/nehalem/gma.c index 86fc583..0ed7192 100644 --- a/src/northbridge/intel/nehalem/gma.c +++ b/src/northbridge/intel/nehalem/gma.c @@ -624,19 +624,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - static void gma_read_resources(struct device *dev) { pci_dev_read_resources(dev); @@ -704,7 +691,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/nehalem/northbridge.c b/src/northbridge/intel/nehalem/northbridge.c index 8a4f64c..f3f14fd 100644 --- a/src/northbridge/intel/nehalem/northbridge.c +++ b/src/northbridge/intel/nehalem/northbridge.c @@ -190,19 +190,6 @@ pci_dev_set_resources(dev); }
-static void intel_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - static void northbridge_dmi_init(struct device *dev) { u32 reg32; @@ -304,7 +291,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/pineview/gma.c b/src/northbridge/intel/pineview/gma.c index 8bacc77..f41dc62 100644 --- a/src/northbridge/intel/pineview/gma.c +++ b/src/northbridge/intel/pineview/gma.c @@ -305,19 +305,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - const struct i915_gpu_controller_info *intel_gma_get_controller_info(void) { struct device *dev = pcidev_on_root(0x2, 0); @@ -361,7 +348,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index d302c52..a8ff773 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -654,18 +654,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -732,7 +720,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/sandybridge/northbridge.c b/src/northbridge/intel/sandybridge/northbridge.c index e58a0eb..1980d54 100644 --- a/src/northbridge/intel/sandybridge/northbridge.c +++ b/src/northbridge/intel/sandybridge/northbridge.c @@ -286,18 +286,6 @@ } }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void northbridge_dmi_init(struct device *dev) { u32 reg32; @@ -485,7 +473,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/x4x/gma.c b/src/northbridge/intel/x4x/gma.c index 8de568a..89046bb 100644 --- a/src/northbridge/intel/x4x/gma.c +++ b/src/northbridge/intel/x4x/gma.c @@ -96,19 +96,6 @@ pci_write_config16(dev_host, D0F0_GGC, ggc); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -160,7 +147,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { 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 348e1c0..623095c 100644 --- a/src/soc/intel/fsp_broadwell_de/chip.c +++ b/src/soc/intel/fsp_broadwell_de/chip.c @@ -89,18 +89,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/southbridge/intel/bd82x6x/azalia.c b/src/southbridge/intel/bd82x6x/azalia.c index 0cc9efa..8d424b8 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -336,20 +336,8 @@ return "HDEF"; }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index f22be9e..eda16da 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -694,17 +694,6 @@ pch_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -924,7 +913,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/bd82x6x/me.c b/src/southbridge/intel/bd82x6x/me.c index 5731b9b..1670091 100644 --- a/src/southbridge/intel/bd82x6x/me.c +++ b/src/southbridge/intel/bd82x6x/me.c @@ -735,19 +735,8 @@ } }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/bd82x6x/me_8.x.c b/src/southbridge/intel/bd82x6x/me_8.x.c index a6ffe89..9543536 100644 --- a/src/southbridge/intel/bd82x6x/me_8.x.c +++ b/src/southbridge/intel/bd82x6x/me_8.x.c @@ -738,19 +738,8 @@ } }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/bd82x6x/sata.c b/src/southbridge/intel/bd82x6x/sata.c index 3ee0a59..91c87bf 100644 --- a/src/southbridge/intel/bd82x6x/sata.c +++ b/src/southbridge/intel/bd82x6x/sata.c @@ -234,18 +234,6 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static const char *sata_acpi_name(const struct device *dev) { return "SATA"; @@ -258,7 +246,7 @@ }
static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/bd82x6x/smbus.c b/src/southbridge/intel/bd82x6x/smbus.c index 9083806..4fb7539 100644 --- a/src/southbridge/intel/bd82x6x/smbus.c +++ b/src/southbridge/intel/bd82x6x/smbus.c @@ -71,20 +71,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/bd82x6x/usb_ehci.c b/src/southbridge/intel/bd82x6x/usb_ehci.c index 6cf4c10..8fe3e41 100644 --- a/src/southbridge/intel/bd82x6x/usb_ehci.c +++ b/src/southbridge/intel/bd82x6x/usb_ehci.c @@ -84,13 +84,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/southbridge/intel/bd82x6x/usb_xhci.c b/src/southbridge/intel/bd82x6x/usb_xhci.c index 07d74e0..85e450d 100644 --- a/src/southbridge/intel/bd82x6x/usb_xhci.c +++ b/src/southbridge/intel/bd82x6x/usb_xhci.c @@ -56,20 +56,8 @@ return "XHC"; }
-static void xhci_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)); - } -} - static struct pci_operations xhci_pci_ops = { - .set_subsystem = xhci_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations usb_xhci_ops = { diff --git a/src/southbridge/intel/fsp_rangeley/lpc.c b/src/southbridge/intel/fsp_rangeley/lpc.c index 711778e..4118e5f 100644 --- a/src/southbridge/intel/fsp_rangeley/lpc.c +++ b/src/southbridge/intel/fsp_rangeley/lpc.c @@ -417,17 +417,6 @@ soc_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -448,7 +437,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/fsp_rangeley/sata.c b/src/southbridge/intel/fsp_rangeley/sata.c index 3f72a3d..58388a2 100644 --- a/src/southbridge/intel/fsp_rangeley/sata.c +++ b/src/southbridge/intel/fsp_rangeley/sata.c @@ -96,19 +96,8 @@ { }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/fsp_rangeley/smbus.c b/src/southbridge/intel/fsp_rangeley/smbus.c index 90b0420..83533f1 100644 --- a/src/southbridge/intel/fsp_rangeley/smbus.c +++ b/src/southbridge/intel/fsp_rangeley/smbus.c @@ -40,20 +40,8 @@ .read_byte = lsmbus_read_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void rangeley_smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801gx/ac97.c b/src/southbridge/intel/i82801gx/ac97.c index 582c962..f18aedb 100644 --- a/src/southbridge/intel/i82801gx/ac97.c +++ b/src/southbridge/intel/i82801gx/ac97.c @@ -247,20 +247,8 @@ } }
-static void ac97_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations ac97_pci_ops = { - .set_subsystem = ac97_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations ac97_audio_ops = { diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c index 7bf48ef..938dc4e 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -303,20 +303,8 @@ } }
-static void azalia_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/i82801gx/ide.c b/src/southbridge/intel/i82801gx/ide.c index e25eaae..a362372 100644 --- a/src/southbridge/intel/i82801gx/ide.c +++ b/src/southbridge/intel/i82801gx/ide.c @@ -92,20 +92,8 @@ printk(BIOS_DEBUG, "\n"); }
-static void ide_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations ide_pci_ops = { - .set_subsystem = ide_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations ide_ops = { diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c index 669648b..a1cc45a 100644 --- a/src/southbridge/intel/i82801gx/lpc.c +++ b/src/southbridge/intel/i82801gx/lpc.c @@ -676,18 +676,6 @@ outb(POST_OS_BOOT, 0x80); }
-static void 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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -728,7 +716,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801gx/sata.c b/src/southbridge/intel/i82801gx/sata.c index bf473f6..8514b6d 100644 --- a/src/southbridge/intel/i82801gx/sata.c +++ b/src/southbridge/intel/i82801gx/sata.c @@ -200,20 +200,8 @@ pci_write_config32(dev, SATA_IR, reg32); }
-static void sata_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/i82801gx/smbus.c b/src/southbridge/intel/i82801gx/smbus.c index 7e95beb..693c2dc 100644 --- a/src/southbridge/intel/i82801gx/smbus.c +++ b/src/southbridge/intel/i82801gx/smbus.c @@ -81,20 +81,8 @@ .block_write = lsmbus_block_write, };
-static void smbus_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801gx/usb.c b/src/southbridge/intel/i82801gx/usb.c index 307b5ac..cd43e03 100644 --- a/src/southbridge/intel/i82801gx/usb.c +++ b/src/southbridge/intel/i82801gx/usb.c @@ -43,20 +43,8 @@ printk(BIOS_DEBUG, "done.\n"); }
-static void usb_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations usb_pci_ops = { - .set_subsystem = usb_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations usb_ops = { diff --git a/src/southbridge/intel/i82801gx/usb_ehci.c b/src/southbridge/intel/i82801gx/usb_ehci.c index cbefe20..0a94d3b 100644 --- a/src/southbridge/intel/i82801gx/usb_ehci.c +++ b/src/southbridge/intel/i82801gx/usb_ehci.c @@ -69,13 +69,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/southbridge/intel/i82801ix/hdaudio.c b/src/southbridge/intel/i82801ix/hdaudio.c index e47f6e0..16350d5 100644 --- a/src/southbridge/intel/i82801ix/hdaudio.c +++ b/src/southbridge/intel/i82801ix/hdaudio.c @@ -287,20 +287,8 @@ } }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index 79a1a1d..ce47c59 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -527,17 +527,6 @@ res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -578,7 +567,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801ix/sata.c b/src/southbridge/intel/i82801ix/sata.c index 0e7f35bc..6155c15 100644 --- a/src/southbridge/intel/i82801ix/sata.c +++ b/src/southbridge/intel/i82801ix/sata.c @@ -258,20 +258,8 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/i82801ix/smbus.c b/src/southbridge/intel/i82801ix/smbus.c index c3d23ea..9bab9b2 100644 --- a/src/southbridge/intel/i82801ix/smbus.c +++ b/src/southbridge/intel/i82801ix/smbus.c @@ -64,20 +64,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801ix/thermal.c b/src/southbridge/intel/i82801ix/thermal.c index 7316f95..2deb84d 100644 --- a/src/southbridge/intel/i82801ix/thermal.c +++ b/src/southbridge/intel/i82801ix/thermal.c @@ -51,20 +51,8 @@ pci_write_config32(dev, 0x10, 0); }
-static void thermal_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)); - } -} - static struct pci_operations thermal_pci_ops = { - .set_subsystem = thermal_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801ix/usb_ehci.c b/src/southbridge/intel/i82801ix/usb_ehci.c index 8768e3e..f7d8b87 100644 --- a/src/southbridge/intel/i82801ix/usb_ehci.c +++ b/src/southbridge/intel/i82801ix/usb_ehci.c @@ -44,13 +44,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/southbridge/intel/i82801jx/hdaudio.c b/src/southbridge/intel/i82801jx/hdaudio.c index 1e852c0..c2a505b 100644 --- a/src/southbridge/intel/i82801jx/hdaudio.c +++ b/src/southbridge/intel/i82801jx/hdaudio.c @@ -287,20 +287,8 @@ } }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c index a365825..abfe665 100644 --- a/src/southbridge/intel/i82801jx/lpc.c +++ b/src/southbridge/intel/i82801jx/lpc.c @@ -684,17 +684,6 @@ } }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -734,7 +723,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801jx/sata.c b/src/southbridge/intel/i82801jx/sata.c index bd035de..8de2d74 100644 --- a/src/southbridge/intel/i82801jx/sata.c +++ b/src/southbridge/intel/i82801jx/sata.c @@ -253,20 +253,8 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/i82801jx/smbus.c b/src/southbridge/intel/i82801jx/smbus.c index f9e223f..d366703 100644 --- a/src/southbridge/intel/i82801jx/smbus.c +++ b/src/southbridge/intel/i82801jx/smbus.c @@ -91,20 +91,8 @@ .block_write = lsmbus_block_write, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801jx/thermal.c b/src/southbridge/intel/i82801jx/thermal.c index ac4c596..65d897f 100644 --- a/src/southbridge/intel/i82801jx/thermal.c +++ b/src/southbridge/intel/i82801jx/thermal.c @@ -51,20 +51,8 @@ pci_write_config32(dev, 0x10, 0); }
-static void thermal_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)); - } -} - static struct pci_operations thermal_pci_ops = { - .set_subsystem = thermal_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801jx/usb_ehci.c b/src/southbridge/intel/i82801jx/usb_ehci.c index 543ac57..a4f5a01 100644 --- a/src/southbridge/intel/i82801jx/usb_ehci.c +++ b/src/southbridge/intel/i82801jx/usb_ehci.c @@ -44,13 +44,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/southbridge/intel/ibexpeak/azalia.c b/src/southbridge/intel/ibexpeak/azalia.c index 3cec2a9..5b38ea7 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -313,20 +313,8 @@ pci_write_config8(dev, 0x43, reg8); }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index d440f65..fe1d84a 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -609,18 +609,6 @@ pch_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -807,7 +795,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/ibexpeak/me.c b/src/southbridge/intel/ibexpeak/me.c index df224d3..8d3ae02 100644 --- a/src/southbridge/intel/ibexpeak/me.c +++ b/src/southbridge/intel/ibexpeak/me.c @@ -610,20 +610,8 @@ } }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/ibexpeak/sata.c b/src/southbridge/intel/ibexpeak/sata.c index 2c24bbf..112445b 100644 --- a/src/southbridge/intel/ibexpeak/sata.c +++ b/src/southbridge/intel/ibexpeak/sata.c @@ -235,19 +235,6 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static void sata_fill_ssdt(struct device *dev) { config_t *config = dev->chip_info; @@ -255,7 +242,7 @@ }
static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/ibexpeak/smbus.c b/src/southbridge/intel/ibexpeak/smbus.c index 53ba9e2..dd3abfe 100644 --- a/src/southbridge/intel/ibexpeak/smbus.c +++ b/src/southbridge/intel/ibexpeak/smbus.c @@ -71,20 +71,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/ibexpeak/thermal.c b/src/southbridge/intel/ibexpeak/thermal.c index ca8492b..31b2cb6 100644 --- a/src/southbridge/intel/ibexpeak/thermal.c +++ b/src/southbridge/intel/ibexpeak/thermal.c @@ -45,21 +45,8 @@ printk(BIOS_DEBUG, "Thermal init done.\n"); }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations thermal_ops = { diff --git a/src/southbridge/intel/ibexpeak/usb_ehci.c b/src/southbridge/intel/ibexpeak/usb_ehci.c index 4eacd1b..95cac81 100644 --- a/src/southbridge/intel/ibexpeak/usb_ehci.c +++ b/src/southbridge/intel/ibexpeak/usb_ehci.c @@ -78,14 +78,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/southbridge/intel/lynxpoint/azalia.c b/src/southbridge/intel/lynxpoint/azalia.c index 5dd46b2..2deb929 100644 --- a/src/southbridge/intel/lynxpoint/azalia.c +++ b/src/southbridge/intel/lynxpoint/azalia.c @@ -154,20 +154,8 @@ } }
-static void azalia_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 94b3111..e8cad38 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -723,17 +723,6 @@ pch_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs; @@ -981,7 +970,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/lynxpoint/me_9.x.c b/src/southbridge/intel/lynxpoint/me_9.x.c index f5f94fe..09eeff2 100644 --- a/src/southbridge/intel/lynxpoint/me_9.x.c +++ b/src/southbridge/intel/lynxpoint/me_9.x.c @@ -874,20 +874,8 @@ */ }
-static void 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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void intel_me_enable(struct device *dev) diff --git a/src/southbridge/intel/lynxpoint/sata.c b/src/southbridge/intel/lynxpoint/sata.c index 97b55e1..fd611ea 100644 --- a/src/southbridge/intel/lynxpoint/sata.c +++ b/src/southbridge/intel/lynxpoint/sata.c @@ -323,20 +323,8 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/lynxpoint/serialio.c b/src/southbridge/intel/lynxpoint/serialio.c index f5c52ef..23d8125 100644 --- a/src/southbridge/intel/lynxpoint/serialio.c +++ b/src/southbridge/intel/lynxpoint/serialio.c @@ -237,20 +237,8 @@ } }
-static void serialio_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = serialio_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/lynxpoint/smbus.c b/src/southbridge/intel/lynxpoint/smbus.c index 307d7d4..c12b29e 100644 --- a/src/southbridge/intel/lynxpoint/smbus.c +++ b/src/southbridge/intel/lynxpoint/smbus.c @@ -70,20 +70,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/lynxpoint/usb_ehci.c b/src/southbridge/intel/lynxpoint/usb_ehci.c index b54e36b..bc86053 100644 --- a/src/southbridge/intel/lynxpoint/usb_ehci.c +++ b/src/southbridge/intel/lynxpoint/usb_ehci.c @@ -175,13 +175,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/southbridge/intel/lynxpoint/usb_xhci.c b/src/southbridge/intel/lynxpoint/usb_xhci.c index ee25e5c..ddba351 100644 --- a/src/southbridge/intel/lynxpoint/usb_xhci.c +++ b/src/southbridge/intel/lynxpoint/usb_xhci.c @@ -373,20 +373,8 @@ } }
-static void usb_xhci_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations lops_pci = { - .set_subsystem = &usb_xhci_set_subsystem, + .set_subsystem = &pci_dev_set_subsystem, };
static struct device_operations usb_xhci_ops = { diff --git a/src/southbridge/nvidia/mcp55/azalia.c b/src/southbridge/nvidia/mcp55/azalia.c index 86ab5b9..f393297 100644 --- a/src/southbridge/nvidia/mcp55/azalia.c +++ b/src/southbridge/nvidia/mcp55/azalia.c @@ -254,20 +254,8 @@ #endif }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = {
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 1:
(2 comments)
Looked good, just needs a decision if PCI SSID 0:0 is ever allowed.
https://review.coreboot.org/#/c/31982/1/src/northbridge/intel/fsp_rangeley/n... File src/northbridge/intel/fsp_rangeley/northbridge.c:
https://review.coreboot.org/#/c/31982/1/src/northbridge/intel/fsp_rangeley/n... PS1, Line 184: We might want to copy this into pci_dev_set_subsystem() as I believe it is incorrect to set SSID to 0000:0000. Wait for second opinion on this one before changing.
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c File src/soc/intel/baytrail/chip.c:
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c@76 PS1, Line 76: .set_subsystem = &pci_dev_set_subsystem, You could drop that '&' as redundant, but don't bother fixing it here.
We might change the callsites such that when dev->ops or dev->ops->set_subsystem are NULL, we would call pci_dev_set_subsystem() nevertheless. I am undecided about that.
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/#/c/31982/1/src/northbridge/intel/fsp_rangeley/n... File src/northbridge/intel/fsp_rangeley/northbridge.c:
https://review.coreboot.org/#/c/31982/1/src/northbridge/intel/fsp_rangeley/n... PS1, Line 184:
We might want to copy this into pci_dev_set_subsystem() as I believe it is incorrect to set SSID to […]
i guess thats better option as 0000 is not valid one and we don't have check
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c File src/soc/intel/baytrail/chip.c:
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c@76 PS1, Line 76: .set_subsystem = &pci_dev_set_subsystem,
You could drop that '&' as redundant, but don't bother fixing it here. […]
may be we can fix this in another CL?
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c File src/soc/intel/baytrail/chip.c:
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c@76 PS1, Line 76: .set_subsystem = &pci_dev_set_subsystem,
may be we can fix this in another CL?
No need to fix it here in this CL.
If we decide that we only use this field to override (the cases where we have lockbits), we can remove all these pci_ops that only initialise with .set_subsystem = pci_dev_set_subsystem().
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c File src/soc/intel/baytrail/chip.c:
https://review.coreboot.org/#/c/31982/1/src/soc/intel/baytrail/chip.c@76 PS1, Line 76: .set_subsystem = &pci_dev_set_subsystem,
No need to fix it here in this CL. […]
make sense.
Hello Kyösti Mälkki, Aaron Durbin, Patrick Rudolph, build bot (Jenkins), Lijian Zhao, Furquan Shaikh, Vanny E, Huang Jin, York Yang, Philipp Deppenwiese, Damien Zammit, David Guckian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31982
to look at the new patch set (#2).
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
{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 --- M src/device/pci_device.c M src/northbridge/intel/e7505/northbridge.c M src/northbridge/intel/fsp_rangeley/northbridge.c M src/northbridge/intel/gm45/gma.c M src/northbridge/intel/haswell/gma.c M src/northbridge/intel/haswell/minihd.c M src/northbridge/intel/haswell/northbridge.c M src/northbridge/intel/i945/gma.c M src/northbridge/intel/i945/northbridge.c M src/northbridge/intel/nehalem/gma.c M src/northbridge/intel/nehalem/northbridge.c M src/northbridge/intel/pineview/gma.c M src/northbridge/intel/sandybridge/gma.c M src/northbridge/intel/sandybridge/northbridge.c M src/northbridge/intel/x4x/gma.c M src/soc/intel/baytrail/chip.c M src/soc/intel/braswell/chip.c M src/soc/intel/broadwell/chip.c M src/soc/intel/broadwell/ehci.c M src/soc/intel/denverton_ns/chip.c M src/soc/intel/fsp_baytrail/chip.c M src/soc/intel/fsp_broadwell_de/chip.c M src/southbridge/intel/bd82x6x/azalia.c M src/southbridge/intel/bd82x6x/lpc.c M src/southbridge/intel/bd82x6x/me.c M src/southbridge/intel/bd82x6x/me_8.x.c M src/southbridge/intel/bd82x6x/sata.c M src/southbridge/intel/bd82x6x/smbus.c M src/southbridge/intel/bd82x6x/usb_ehci.c M src/southbridge/intel/bd82x6x/usb_xhci.c M src/southbridge/intel/fsp_rangeley/lpc.c M src/southbridge/intel/fsp_rangeley/sata.c M src/southbridge/intel/fsp_rangeley/smbus.c M src/southbridge/intel/i82801gx/ac97.c M src/southbridge/intel/i82801gx/azalia.c M src/southbridge/intel/i82801gx/ide.c M src/southbridge/intel/i82801gx/lpc.c M src/southbridge/intel/i82801gx/sata.c M src/southbridge/intel/i82801gx/smbus.c M src/southbridge/intel/i82801gx/usb.c M src/southbridge/intel/i82801gx/usb_ehci.c M src/southbridge/intel/i82801ix/hdaudio.c M src/southbridge/intel/i82801ix/lpc.c M src/southbridge/intel/i82801ix/sata.c M src/southbridge/intel/i82801ix/smbus.c M src/southbridge/intel/i82801ix/thermal.c M src/southbridge/intel/i82801ix/usb_ehci.c M src/southbridge/intel/i82801jx/hdaudio.c M src/southbridge/intel/i82801jx/lpc.c M src/southbridge/intel/i82801jx/sata.c M src/southbridge/intel/i82801jx/smbus.c M src/southbridge/intel/i82801jx/thermal.c M src/southbridge/intel/i82801jx/usb_ehci.c M src/southbridge/intel/ibexpeak/azalia.c M src/southbridge/intel/ibexpeak/lpc.c M src/southbridge/intel/ibexpeak/me.c M src/southbridge/intel/ibexpeak/sata.c M src/southbridge/intel/ibexpeak/smbus.c M src/southbridge/intel/ibexpeak/thermal.c M src/southbridge/intel/ibexpeak/usb_ehci.c M src/southbridge/intel/lynxpoint/azalia.c M src/southbridge/intel/lynxpoint/lpc.c M src/southbridge/intel/lynxpoint/me_9.x.c M src/southbridge/intel/lynxpoint/sata.c M src/southbridge/intel/lynxpoint/serialio.c M src/southbridge/intel/lynxpoint/smbus.c M src/southbridge/intel/lynxpoint/usb_ehci.c M src/southbridge/intel/lynxpoint/usb_xhci.c M src/southbridge/nvidia/mcp55/azalia.c 69 files changed, 75 insertions(+), 839 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/31982/2
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 2: Code-Review+1
David Guckian has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 2: Code-Review+1
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
Patch Set 2: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/31982 )
Change subject: {northbridge, soc, southbridge}/intel: Make use of pci_dev_set_subsystem() ......................................................................
{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 --- M src/device/pci_device.c M src/northbridge/intel/e7505/northbridge.c M src/northbridge/intel/fsp_rangeley/northbridge.c M src/northbridge/intel/gm45/gma.c M src/northbridge/intel/haswell/gma.c M src/northbridge/intel/haswell/minihd.c M src/northbridge/intel/haswell/northbridge.c M src/northbridge/intel/i945/gma.c M src/northbridge/intel/i945/northbridge.c M src/northbridge/intel/nehalem/gma.c M src/northbridge/intel/nehalem/northbridge.c M src/northbridge/intel/pineview/gma.c M src/northbridge/intel/sandybridge/gma.c M src/northbridge/intel/sandybridge/northbridge.c M src/northbridge/intel/x4x/gma.c M src/soc/intel/baytrail/chip.c M src/soc/intel/braswell/chip.c M src/soc/intel/broadwell/chip.c M src/soc/intel/broadwell/ehci.c M src/soc/intel/denverton_ns/chip.c M src/soc/intel/fsp_baytrail/chip.c M src/soc/intel/fsp_broadwell_de/chip.c M src/southbridge/intel/bd82x6x/azalia.c M src/southbridge/intel/bd82x6x/lpc.c M src/southbridge/intel/bd82x6x/me.c M src/southbridge/intel/bd82x6x/me_8.x.c M src/southbridge/intel/bd82x6x/sata.c M src/southbridge/intel/bd82x6x/smbus.c M src/southbridge/intel/bd82x6x/usb_ehci.c M src/southbridge/intel/bd82x6x/usb_xhci.c M src/southbridge/intel/fsp_rangeley/lpc.c M src/southbridge/intel/fsp_rangeley/sata.c M src/southbridge/intel/fsp_rangeley/smbus.c M src/southbridge/intel/i82801gx/ac97.c M src/southbridge/intel/i82801gx/azalia.c M src/southbridge/intel/i82801gx/ide.c M src/southbridge/intel/i82801gx/lpc.c M src/southbridge/intel/i82801gx/sata.c M src/southbridge/intel/i82801gx/smbus.c M src/southbridge/intel/i82801gx/usb.c M src/southbridge/intel/i82801gx/usb_ehci.c M src/southbridge/intel/i82801ix/hdaudio.c M src/southbridge/intel/i82801ix/lpc.c M src/southbridge/intel/i82801ix/sata.c M src/southbridge/intel/i82801ix/smbus.c M src/southbridge/intel/i82801ix/thermal.c M src/southbridge/intel/i82801ix/usb_ehci.c M src/southbridge/intel/i82801jx/hdaudio.c M src/southbridge/intel/i82801jx/lpc.c M src/southbridge/intel/i82801jx/sata.c M src/southbridge/intel/i82801jx/smbus.c M src/southbridge/intel/i82801jx/thermal.c M src/southbridge/intel/i82801jx/usb_ehci.c M src/southbridge/intel/ibexpeak/azalia.c M src/southbridge/intel/ibexpeak/lpc.c M src/southbridge/intel/ibexpeak/me.c M src/southbridge/intel/ibexpeak/sata.c M src/southbridge/intel/ibexpeak/smbus.c M src/southbridge/intel/ibexpeak/thermal.c M src/southbridge/intel/ibexpeak/usb_ehci.c M src/southbridge/intel/lynxpoint/azalia.c M src/southbridge/intel/lynxpoint/lpc.c M src/southbridge/intel/lynxpoint/me_9.x.c M src/southbridge/intel/lynxpoint/sata.c M src/southbridge/intel/lynxpoint/serialio.c M src/southbridge/intel/lynxpoint/smbus.c M src/southbridge/intel/lynxpoint/usb_ehci.c M src/southbridge/intel/lynxpoint/usb_xhci.c M src/southbridge/nvidia/mcp55/azalia.c 69 files changed, 75 insertions(+), 839 deletions(-)
Approvals: build bot (Jenkins): Verified Kyösti Mälkki: Looks good to me, but someone else must approve Furquan Shaikh: Looks good to me, approved David Guckian: Looks good to me, but someone else must approve
diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 86c72b8..fbe9d96 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -734,8 +734,13 @@ void pci_dev_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device) { - pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, - ((device & 0xffff) << 16) | (vendor & 0xffff)); + 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)); + } }
static int should_run_oprom(struct device *dev) diff --git a/src/northbridge/intel/e7505/northbridge.c b/src/northbridge/intel/e7505/northbridge.c index e3d3faf..7cb0b5b 100644 --- a/src/northbridge/intel/e7505/northbridge.c +++ b/src/northbridge/intel/e7505/northbridge.c @@ -74,15 +74,8 @@ assign_resources(dev->link_list); }
-static void intel_set_subsystem(struct device *dev, unsigned int vendor, - unsigned int device) -{ - pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, - ((device & 0xffff) << 16) | (vendor & 0xffff)); -} - static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations pci_domain_ops = { diff --git a/src/northbridge/intel/fsp_rangeley/northbridge.c b/src/northbridge/intel/fsp_rangeley/northbridge.c index 7663b26..edc623a3 100644 --- a/src/northbridge/intel/fsp_rangeley/northbridge.c +++ b/src/northbridge/intel/fsp_rangeley/northbridge.c @@ -172,18 +172,6 @@ pci_dev_set_resources(dev); }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void northbridge_init(struct device *dev) { } @@ -193,7 +181,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations pci_domain_ops = { diff --git a/src/northbridge/intel/gm45/gma.c b/src/northbridge/intel/gm45/gma.c index 648aa48..6e54208 100644 --- a/src/northbridge/intel/gm45/gma.c +++ b/src/northbridge/intel/gm45/gma.c @@ -221,19 +221,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -287,7 +274,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/haswell/gma.c b/src/northbridge/intel/haswell/gma.c index 0fd0228..1b2430f 100644 --- a/src/northbridge/intel/haswell/gma.c +++ b/src/northbridge/intel/haswell/gma.c @@ -499,18 +499,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -558,7 +546,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/haswell/minihd.c b/src/northbridge/intel/haswell/minihd.c index 9a1df0f..994296a 100644 --- a/src/northbridge/intel/haswell/minihd.c +++ b/src/northbridge/intel/haswell/minihd.c @@ -103,20 +103,8 @@ } }
-static void minihd_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations minihd_pci_ops = { - .set_subsystem = minihd_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations minihd_ops = { diff --git a/src/northbridge/intel/haswell/northbridge.c b/src/northbridge/intel/haswell/northbridge.c index 2b7afa8..2fd5959 100644 --- a/src/northbridge/intel/haswell/northbridge.c +++ b/src/northbridge/intel/haswell/northbridge.c @@ -468,18 +468,6 @@ pci_write_config32(host_dev, DEVEN, deven); }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void northbridge_init(struct device *dev) { u8 bios_reset_cpl, pair; @@ -510,7 +498,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c index 633b09d..ee656de 100644 --- a/src/northbridge/intel/i945/gma.c +++ b/src/northbridge/intel/i945/gma.c @@ -756,18 +756,6 @@ pci_write_config8(dev, 0xf4, 0xff); }
-static void gma_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -834,7 +822,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/i945/northbridge.c b/src/northbridge/intel/i945/northbridge.c index 82392f4..e9867d9 100644 --- a/src/northbridge/intel/i945/northbridge.c +++ b/src/northbridge/intel/i945/northbridge.c @@ -191,19 +191,8 @@ } }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/nehalem/gma.c b/src/northbridge/intel/nehalem/gma.c index 16f1c35..8c0117f 100644 --- a/src/northbridge/intel/nehalem/gma.c +++ b/src/northbridge/intel/nehalem/gma.c @@ -623,19 +623,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - static void gma_read_resources(struct device *dev) { pci_dev_read_resources(dev); @@ -703,7 +690,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/nehalem/northbridge.c b/src/northbridge/intel/nehalem/northbridge.c index 575c600..a9032ba 100644 --- a/src/northbridge/intel/nehalem/northbridge.c +++ b/src/northbridge/intel/nehalem/northbridge.c @@ -189,19 +189,6 @@ pci_dev_set_resources(dev); }
-static void intel_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - static void northbridge_dmi_init(struct device *dev) { u32 reg32; @@ -303,7 +290,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/pineview/gma.c b/src/northbridge/intel/pineview/gma.c index d6ece9d..019f764 100644 --- a/src/northbridge/intel/pineview/gma.c +++ b/src/northbridge/intel/pineview/gma.c @@ -304,19 +304,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - const struct i915_gpu_controller_info *intel_gma_get_controller_info(void) { struct device *dev = pcidev_on_root(0x2, 0); @@ -360,7 +347,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index 7f7ea0c..0d28d67 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -653,18 +653,6 @@ intel_gma_restore_opregion(); }
-static void gma_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -731,7 +719,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { diff --git a/src/northbridge/intel/sandybridge/northbridge.c b/src/northbridge/intel/sandybridge/northbridge.c index 477c26e..5aa06c8 100644 --- a/src/northbridge/intel/sandybridge/northbridge.c +++ b/src/northbridge/intel/sandybridge/northbridge.c @@ -285,18 +285,6 @@ } }
-static void intel_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void northbridge_dmi_init(struct device *dev) { u32 reg32; @@ -484,7 +472,7 @@ }
static struct pci_operations intel_pci_ops = { - .set_subsystem = intel_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations mc_ops = { diff --git a/src/northbridge/intel/x4x/gma.c b/src/northbridge/intel/x4x/gma.c index 2c045e6..c36a103 100644 --- a/src/northbridge/intel/x4x/gma.c +++ b/src/northbridge/intel/x4x/gma.c @@ -95,19 +95,6 @@ pci_write_config16(dev_host, D0F0_GGC, ggc); }
-static void gma_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 & 0xffff) << 16) | (vendor & - 0xffff)); - } -} - const struct i915_gpu_controller_info * intel_gma_get_controller_info(void) { @@ -159,7 +146,7 @@ }
static struct pci_operations gma_pci_ops = { - .set_subsystem = gma_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations gma_func0_ops = { 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, }; diff --git a/src/southbridge/intel/bd82x6x/azalia.c b/src/southbridge/intel/bd82x6x/azalia.c index 0cc9efa..8d424b8 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -336,20 +336,8 @@ return "HDEF"; }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index f22be9e..eda16da 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -694,17 +694,6 @@ pch_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -924,7 +913,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/bd82x6x/me.c b/src/southbridge/intel/bd82x6x/me.c index 5731b9b..1670091 100644 --- a/src/southbridge/intel/bd82x6x/me.c +++ b/src/southbridge/intel/bd82x6x/me.c @@ -735,19 +735,8 @@ } }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/bd82x6x/me_8.x.c b/src/southbridge/intel/bd82x6x/me_8.x.c index a6ffe89..9543536 100644 --- a/src/southbridge/intel/bd82x6x/me_8.x.c +++ b/src/southbridge/intel/bd82x6x/me_8.x.c @@ -738,19 +738,8 @@ } }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/bd82x6x/sata.c b/src/southbridge/intel/bd82x6x/sata.c index 3ee0a59..91c87bf 100644 --- a/src/southbridge/intel/bd82x6x/sata.c +++ b/src/southbridge/intel/bd82x6x/sata.c @@ -234,18 +234,6 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static const char *sata_acpi_name(const struct device *dev) { return "SATA"; @@ -258,7 +246,7 @@ }
static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/bd82x6x/smbus.c b/src/southbridge/intel/bd82x6x/smbus.c index 9083806..4fb7539 100644 --- a/src/southbridge/intel/bd82x6x/smbus.c +++ b/src/southbridge/intel/bd82x6x/smbus.c @@ -71,20 +71,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/bd82x6x/usb_ehci.c b/src/southbridge/intel/bd82x6x/usb_ehci.c index 6cf4c10..8fe3e41 100644 --- a/src/southbridge/intel/bd82x6x/usb_ehci.c +++ b/src/southbridge/intel/bd82x6x/usb_ehci.c @@ -84,13 +84,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/southbridge/intel/bd82x6x/usb_xhci.c b/src/southbridge/intel/bd82x6x/usb_xhci.c index 07d74e0..85e450d 100644 --- a/src/southbridge/intel/bd82x6x/usb_xhci.c +++ b/src/southbridge/intel/bd82x6x/usb_xhci.c @@ -56,20 +56,8 @@ return "XHC"; }
-static void xhci_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)); - } -} - static struct pci_operations xhci_pci_ops = { - .set_subsystem = xhci_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations usb_xhci_ops = { diff --git a/src/southbridge/intel/fsp_rangeley/lpc.c b/src/southbridge/intel/fsp_rangeley/lpc.c index 711778e..4118e5f 100644 --- a/src/southbridge/intel/fsp_rangeley/lpc.c +++ b/src/southbridge/intel/fsp_rangeley/lpc.c @@ -417,17 +417,6 @@ soc_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -448,7 +437,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/fsp_rangeley/sata.c b/src/southbridge/intel/fsp_rangeley/sata.c index 3f72a3d..58388a2 100644 --- a/src/southbridge/intel/fsp_rangeley/sata.c +++ b/src/southbridge/intel/fsp_rangeley/sata.c @@ -96,19 +96,8 @@ { }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/fsp_rangeley/smbus.c b/src/southbridge/intel/fsp_rangeley/smbus.c index 90b0420..83533f1 100644 --- a/src/southbridge/intel/fsp_rangeley/smbus.c +++ b/src/southbridge/intel/fsp_rangeley/smbus.c @@ -40,20 +40,8 @@ .read_byte = lsmbus_read_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void rangeley_smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801gx/ac97.c b/src/southbridge/intel/i82801gx/ac97.c index 582c962..f18aedb 100644 --- a/src/southbridge/intel/i82801gx/ac97.c +++ b/src/southbridge/intel/i82801gx/ac97.c @@ -247,20 +247,8 @@ } }
-static void ac97_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations ac97_pci_ops = { - .set_subsystem = ac97_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations ac97_audio_ops = { diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c index 7bf48ef..938dc4e 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -303,20 +303,8 @@ } }
-static void azalia_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/i82801gx/ide.c b/src/southbridge/intel/i82801gx/ide.c index e25eaae..a362372 100644 --- a/src/southbridge/intel/i82801gx/ide.c +++ b/src/southbridge/intel/i82801gx/ide.c @@ -92,20 +92,8 @@ printk(BIOS_DEBUG, "\n"); }
-static void ide_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations ide_pci_ops = { - .set_subsystem = ide_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations ide_ops = { diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c index 669648b..a1cc45a 100644 --- a/src/southbridge/intel/i82801gx/lpc.c +++ b/src/southbridge/intel/i82801gx/lpc.c @@ -676,18 +676,6 @@ outb(POST_OS_BOOT, 0x80); }
-static void 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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -728,7 +716,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801gx/sata.c b/src/southbridge/intel/i82801gx/sata.c index bf473f6..8514b6d 100644 --- a/src/southbridge/intel/i82801gx/sata.c +++ b/src/southbridge/intel/i82801gx/sata.c @@ -200,20 +200,8 @@ pci_write_config32(dev, SATA_IR, reg32); }
-static void sata_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/i82801gx/smbus.c b/src/southbridge/intel/i82801gx/smbus.c index 7e95beb..693c2dc 100644 --- a/src/southbridge/intel/i82801gx/smbus.c +++ b/src/southbridge/intel/i82801gx/smbus.c @@ -81,20 +81,8 @@ .block_write = lsmbus_block_write, };
-static void smbus_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801gx/usb.c b/src/southbridge/intel/i82801gx/usb.c index 307b5ac..cd43e03 100644 --- a/src/southbridge/intel/i82801gx/usb.c +++ b/src/southbridge/intel/i82801gx/usb.c @@ -43,20 +43,8 @@ printk(BIOS_DEBUG, "done.\n"); }
-static void usb_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations usb_pci_ops = { - .set_subsystem = usb_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations usb_ops = { diff --git a/src/southbridge/intel/i82801gx/usb_ehci.c b/src/southbridge/intel/i82801gx/usb_ehci.c index cbefe20..0a94d3b 100644 --- a/src/southbridge/intel/i82801gx/usb_ehci.c +++ b/src/southbridge/intel/i82801gx/usb_ehci.c @@ -69,13 +69,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/southbridge/intel/i82801ix/hdaudio.c b/src/southbridge/intel/i82801ix/hdaudio.c index e47f6e0..16350d5 100644 --- a/src/southbridge/intel/i82801ix/hdaudio.c +++ b/src/southbridge/intel/i82801ix/hdaudio.c @@ -287,20 +287,8 @@ } }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index 79a1a1d..ce47c59 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -527,17 +527,6 @@ res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -578,7 +567,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801ix/sata.c b/src/southbridge/intel/i82801ix/sata.c index 0e7f35bc..6155c15 100644 --- a/src/southbridge/intel/i82801ix/sata.c +++ b/src/southbridge/intel/i82801ix/sata.c @@ -258,20 +258,8 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/i82801ix/smbus.c b/src/southbridge/intel/i82801ix/smbus.c index c3d23ea..9bab9b2 100644 --- a/src/southbridge/intel/i82801ix/smbus.c +++ b/src/southbridge/intel/i82801ix/smbus.c @@ -64,20 +64,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801ix/thermal.c b/src/southbridge/intel/i82801ix/thermal.c index 7316f95..2deb84d 100644 --- a/src/southbridge/intel/i82801ix/thermal.c +++ b/src/southbridge/intel/i82801ix/thermal.c @@ -51,20 +51,8 @@ pci_write_config32(dev, 0x10, 0); }
-static void thermal_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)); - } -} - static struct pci_operations thermal_pci_ops = { - .set_subsystem = thermal_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801ix/usb_ehci.c b/src/southbridge/intel/i82801ix/usb_ehci.c index 8768e3e..f7d8b87 100644 --- a/src/southbridge/intel/i82801ix/usb_ehci.c +++ b/src/southbridge/intel/i82801ix/usb_ehci.c @@ -44,13 +44,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/southbridge/intel/i82801jx/hdaudio.c b/src/southbridge/intel/i82801jx/hdaudio.c index 1e852c0..c2a505b 100644 --- a/src/southbridge/intel/i82801jx/hdaudio.c +++ b/src/southbridge/intel/i82801jx/hdaudio.c @@ -287,20 +287,8 @@ } }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c index a365825..abfe665 100644 --- a/src/southbridge/intel/i82801jx/lpc.c +++ b/src/southbridge/intel/i82801jx/lpc.c @@ -684,17 +684,6 @@ } }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -734,7 +723,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801jx/sata.c b/src/southbridge/intel/i82801jx/sata.c index bd035de..8de2d74 100644 --- a/src/southbridge/intel/i82801jx/sata.c +++ b/src/southbridge/intel/i82801jx/sata.c @@ -253,20 +253,8 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/i82801jx/smbus.c b/src/southbridge/intel/i82801jx/smbus.c index f9e223f..d366703 100644 --- a/src/southbridge/intel/i82801jx/smbus.c +++ b/src/southbridge/intel/i82801jx/smbus.c @@ -91,20 +91,8 @@ .block_write = lsmbus_block_write, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/i82801jx/thermal.c b/src/southbridge/intel/i82801jx/thermal.c index ac4c596..65d897f 100644 --- a/src/southbridge/intel/i82801jx/thermal.c +++ b/src/southbridge/intel/i82801jx/thermal.c @@ -51,20 +51,8 @@ pci_write_config32(dev, 0x10, 0); }
-static void thermal_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)); - } -} - static struct pci_operations thermal_pci_ops = { - .set_subsystem = thermal_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/i82801jx/usb_ehci.c b/src/southbridge/intel/i82801jx/usb_ehci.c index 543ac57..a4f5a01 100644 --- a/src/southbridge/intel/i82801jx/usb_ehci.c +++ b/src/southbridge/intel/i82801jx/usb_ehci.c @@ -44,13 +44,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/southbridge/intel/ibexpeak/azalia.c b/src/southbridge/intel/ibexpeak/azalia.c index 3cec2a9..5b38ea7 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -313,20 +313,8 @@ pci_write_config8(dev, 0x43, reg8); }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index d440f65..fe1d84a 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -609,18 +609,6 @@ pch_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); @@ -807,7 +795,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/ibexpeak/me.c b/src/southbridge/intel/ibexpeak/me.c index df224d3..8d3ae02 100644 --- a/src/southbridge/intel/ibexpeak/me.c +++ b/src/southbridge/intel/ibexpeak/me.c @@ -610,20 +610,8 @@ } }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/ibexpeak/sata.c b/src/southbridge/intel/ibexpeak/sata.c index 2c24bbf..112445b 100644 --- a/src/southbridge/intel/ibexpeak/sata.c +++ b/src/southbridge/intel/ibexpeak/sata.c @@ -235,19 +235,6 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static void sata_fill_ssdt(struct device *dev) { config_t *config = dev->chip_info; @@ -255,7 +242,7 @@ }
static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/ibexpeak/smbus.c b/src/southbridge/intel/ibexpeak/smbus.c index 53ba9e2..dd3abfe 100644 --- a/src/southbridge/intel/ibexpeak/smbus.c +++ b/src/southbridge/intel/ibexpeak/smbus.c @@ -71,20 +71,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/ibexpeak/thermal.c b/src/southbridge/intel/ibexpeak/thermal.c index ca8492b..31b2cb6 100644 --- a/src/southbridge/intel/ibexpeak/thermal.c +++ b/src/southbridge/intel/ibexpeak/thermal.c @@ -45,21 +45,8 @@ printk(BIOS_DEBUG, "Thermal init done.\n"); }
-static void 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)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations thermal_ops = { diff --git a/src/southbridge/intel/ibexpeak/usb_ehci.c b/src/southbridge/intel/ibexpeak/usb_ehci.c index 4eacd1b..95cac81 100644 --- a/src/southbridge/intel/ibexpeak/usb_ehci.c +++ b/src/southbridge/intel/ibexpeak/usb_ehci.c @@ -78,14 +78,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/southbridge/intel/lynxpoint/azalia.c b/src/southbridge/intel/lynxpoint/azalia.c index 5dd46b2..2deb929 100644 --- a/src/southbridge/intel/lynxpoint/azalia.c +++ b/src/southbridge/intel/lynxpoint/azalia.c @@ -154,20 +154,8 @@ } }
-static void azalia_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = { diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 94b3111..e8cad38 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -723,17 +723,6 @@ pch_enable(dev); }
-static void 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)); - } -} - static void southbridge_inject_dsdt(struct device *dev) { global_nvs_t *gnvs; @@ -981,7 +970,7 @@ }
static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/lynxpoint/me_9.x.c b/src/southbridge/intel/lynxpoint/me_9.x.c index f5f94fe..09eeff2 100644 --- a/src/southbridge/intel/lynxpoint/me_9.x.c +++ b/src/southbridge/intel/lynxpoint/me_9.x.c @@ -874,20 +874,8 @@ */ }
-static void 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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void intel_me_enable(struct device *dev) diff --git a/src/southbridge/intel/lynxpoint/sata.c b/src/southbridge/intel/lynxpoint/sata.c index 97b55e1..fd611ea 100644 --- a/src/southbridge/intel/lynxpoint/sata.c +++ b/src/southbridge/intel/lynxpoint/sata.c @@ -323,20 +323,8 @@ pci_write_config16(dev, 0x90, map); }
-static void sata_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)); - } -} - static struct pci_operations sata_pci_ops = { - .set_subsystem = sata_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations sata_ops = { diff --git a/src/southbridge/intel/lynxpoint/serialio.c b/src/southbridge/intel/lynxpoint/serialio.c index f5c52ef..23d8125 100644 --- a/src/southbridge/intel/lynxpoint/serialio.c +++ b/src/southbridge/intel/lynxpoint/serialio.c @@ -237,20 +237,8 @@ } }
-static void serialio_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations pci_ops = { - .set_subsystem = serialio_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations device_ops = { diff --git a/src/southbridge/intel/lynxpoint/smbus.c b/src/southbridge/intel/lynxpoint/smbus.c index 307d7d4..c12b29e 100644 --- a/src/southbridge/intel/lynxpoint/smbus.c +++ b/src/southbridge/intel/lynxpoint/smbus.c @@ -70,20 +70,8 @@ .write_byte = lsmbus_write_byte, };
-static void smbus_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations smbus_pci_ops = { - .set_subsystem = smbus_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static void smbus_read_resources(struct device *dev) diff --git a/src/southbridge/intel/lynxpoint/usb_ehci.c b/src/southbridge/intel/lynxpoint/usb_ehci.c index b54e36b..bc86053 100644 --- a/src/southbridge/intel/lynxpoint/usb_ehci.c +++ b/src/southbridge/intel/lynxpoint/usb_ehci.c @@ -175,13 +175,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/southbridge/intel/lynxpoint/usb_xhci.c b/src/southbridge/intel/lynxpoint/usb_xhci.c index ee25e5c..ddba351 100644 --- a/src/southbridge/intel/lynxpoint/usb_xhci.c +++ b/src/southbridge/intel/lynxpoint/usb_xhci.c @@ -373,20 +373,8 @@ } }
-static void usb_xhci_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 & 0xffff) << 16) | (vendor & 0xffff)); - } -} - static struct pci_operations lops_pci = { - .set_subsystem = &usb_xhci_set_subsystem, + .set_subsystem = &pci_dev_set_subsystem, };
static struct device_operations usb_xhci_ops = { diff --git a/src/southbridge/nvidia/mcp55/azalia.c b/src/southbridge/nvidia/mcp55/azalia.c index 86ab5b9..f393297 100644 --- a/src/southbridge/nvidia/mcp55/azalia.c +++ b/src/southbridge/nvidia/mcp55/azalia.c @@ -254,20 +254,8 @@ #endif }
-static void azalia_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)); - } -} - static struct pci_operations azalia_pci_ops = { - .set_subsystem = azalia_set_subsystem, + .set_subsystem = pci_dev_set_subsystem, };
static struct device_operations azalia_ops = {