From efff733ad83acf8502561a9cadc9202c6974e510 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 26 Jul 2012 19:48:23 +0200 Subject: Refactor driver structs Our driver infrastructure became more flexible recently. Make use of it. These are the low hanging fruits (files with 5 device variants or more), but there are still lots of files with less potential for deduplication. Change-Id: If6b7be5046581f81485a511b150f99b029b95c3b Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/1358 Reviewed-by: Stefan Reinauer Reviewed-by: Alexandru Gagniuc Tested-by: build bot (Jenkins) --- src/northbridge/amd/cimx/rd890/late.c | 40 +++++++-------------------- src/northbridge/intel/sandybridge/gma.c | 48 ++++----------------------------- 2 files changed, 15 insertions(+), 73 deletions(-) (limited to 'src/northbridge') diff --git a/src/northbridge/amd/cimx/rd890/late.c b/src/northbridge/amd/cimx/rd890/late.c index 208e5f1d77..33da2b403a 100644 --- a/src/northbridge/amd/cimx/rd890/late.c +++ b/src/northbridge/amd/cimx/rd890/late.c @@ -220,38 +220,18 @@ static struct device_operations ht_ops = { .ops_pci = &lops_pci, }; -static const struct pci_driver ht_driver_sr5690 __pci_driver = { - .ops = &ht_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_AMD_SR5690_HT, -}; - -static const struct pci_driver ht_driver_sr5670 __pci_driver = { - .ops = &ht_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_AMD_SR5670_HT, -}; - -static const struct pci_driver ht_driver_sr5650 __pci_driver = { - .ops = &ht_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_AMD_SR5650_HT, -}; - -static const struct pci_driver ht_driver_rd890tv __pci_driver = { - .ops = &ht_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_AMD_RD890TV_HT, +static const unsigned short driver_ids[] = { + PCI_DEVICE_ID_AMD_SR5690_HT, + PCI_DEVICE_ID_AMD_SR5670_HT, + PCI_DEVICE_ID_AMD_SR5650_HT, + PCI_DEVICE_ID_AMD_RD890TV_HT, + PCI_DEVICE_ID_AMD_RD890_HT, + PCI_DEVICE_ID_AMD_990FX_HT, + 0 }; -static const struct pci_driver ht_driver_rd890 __pci_driver = { - .ops = &ht_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_AMD_RD890_HT, -}; - -static const struct pci_driver ht_driver_990fx __pci_driver = { +static const struct pci_driver ht_driver_sr5690 __pci_driver = { .ops = &ht_ops, .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_AMD_990FX_HT, + .devices= driver_ids, }; diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index 9a8b6317ef..c2bb2eae21 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -659,50 +659,12 @@ static struct device_operations gma_func0_ops = { .ops_pci = &gma_pci_ops, }; -static const struct pci_driver gma_gt1_desktop __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0102, -}; - -static const struct pci_driver gma_gt1_mobile __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0106, +static const unsigned short gma_ids[] = { + 0x0102, 0x0106, 0x010a, 0x0112, 0x0116, 0x0122, 0x0126, 0x166, + 0, }; - -static const struct pci_driver gma_gt1_server __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x010a, -}; - -static const struct pci_driver gma_gt2_desktop __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0112, -}; - -static const struct pci_driver gma_gt2_mobile __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0116, -}; - -static const struct pci_driver gma_gt2_desktop_fast __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0122, -}; - -static const struct pci_driver gma_gt2_mobile_fast __pci_driver = { +static const struct pci_driver gma_gt1_desktop __pci_driver = { .ops = &gma_func0_ops, .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0126, -}; - -static const struct pci_driver gma_func0_driver_3 __pci_driver = { - .ops = &gma_func0_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .device = 0x0166, + .devices= gma_ids, }; -- cgit v1.2.3