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 <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/1358
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Patrick Georgi 2012-07-26 19:48:23 +02:00
parent 8730bf8aad
commit efff733ad8
10 changed files with 103 additions and 332 deletions

View File

@ -220,38 +220,18 @@ static struct device_operations ht_ops = {
.ops_pci = &lops_pci,
};
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_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 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 = {
.ops = &ht_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_AMD_990FX_HT,
.devices= driver_ids,
};

View File

@ -659,50 +659,12 @@ static struct device_operations gma_func0_ops = {
.ops_pci = &gma_pci_ops,
};
static const unsigned short gma_ids[] = {
0x0102, 0x0106, 0x010a, 0x0112, 0x0116, 0x0122, 0x0126, 0x166,
0,
};
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 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 = {
.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,
};

View File

@ -1005,56 +1005,24 @@ static struct device_operations pcie_ops = {
/*
* We should list all of them here.
* */
static const unsigned short pcie_780_ids[] = {
PCI_DEVICE_ID_ATI_RS780_INT_GFX,
PCI_DEVICE_ID_ATI_RS780C_INT_GFX,
PCI_DEVICE_ID_ATI_RS780M_INT_GFX,
PCI_DEVICE_ID_ATI_RS780MC_INT_GFX,
PCI_DEVICE_ID_ATI_RS780E_INT_GFX,
PCI_DEVICE_ID_ATI_RS785G_INT_GFX,
PCI_DEVICE_ID_ATI_RS785C_INT_GFX,
PCI_DEVICE_ID_ATI_RS785M_INT_GFX,
PCI_DEVICE_ID_ATI_RS785MC_INT_GFX,
PCI_DEVICE_ID_ATI_RS785D_INT_GFX,
0
};
static const struct pci_driver pcie_driver_780 __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS780_INT_GFX,
};
static const struct pci_driver pcie_driver_780c __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS780C_INT_GFX,
};
static const struct pci_driver pcie_driver_780m __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS780M_INT_GFX,
};
static const struct pci_driver pcie_driver_780mc __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS780MC_INT_GFX,
};
static const struct pci_driver pcie_driver_780e __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS780E_INT_GFX,
};
static const struct pci_driver pcie_driver_785g __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS785G_INT_GFX,
};
static const struct pci_driver pcie_driver_785c __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS785C_INT_GFX,
};
static const struct pci_driver pcie_driver_785m __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS785M_INT_GFX,
};
static const struct pci_driver pcie_driver_785mc __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS785MC_INT_GFX,
};
static const struct pci_driver pcie_driver_785d __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_RS785D_INT_GFX,
.devices = pcie_780_ids,
};
/* step 12 ~ step 14 from rpr */

View File

@ -164,30 +164,19 @@ static struct device_operations usb_ops = {
.ops_pci = &lops_pci,
};
static const unsigned short usb_ids[] = {
PCI_DEVICE_ID_ATI_SB600_USB_0,
PCI_DEVICE_ID_ATI_SB600_USB_1,
PCI_DEVICE_ID_ATI_SB600_USB_2,
PCI_DEVICE_ID_ATI_SB600_USB_3,
PCI_DEVICE_ID_ATI_SB600_USB_4,
0,
};
static const struct pci_driver usb_0_driver __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_SB600_USB_0,
};
static const struct pci_driver usb_1_driver __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_SB600_USB_1,
};
static const struct pci_driver usb_2_driver __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_SB600_USB_2,
};
static const struct pci_driver usb_3_driver __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_SB600_USB_3,
};
static const struct pci_driver usb_4_driver __pci_driver = {
.ops = &usb_ops,
.vendor = PCI_VENDOR_ID_ATI,
.device = PCI_DEVICE_ID_ATI_SB600_USB_4,
.devices= usb_ids,
};
static struct device_operations usb_ops2 = {

View File

@ -121,44 +121,18 @@ static struct device_operations device_ops = {
.ops_pci = &pci_ops,
};
/* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
static const struct pci_driver i82801gx_pcie_port1 __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27d0,
static const unsigned short i82801gx_pcie_ids[] = {
0x27d0, /* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
0x27d2, /* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
0x27d4, /* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
0x27d6, /* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
0x27e0, /* 82801GR/GDH/GHM (ICH7R/ICH7DH/ICH7-M DH) */
0x27e2, /* 82801GR/GDH/GHM (ICH7R/ICH7DH/ICH7-M DH) */
0
};
/* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
static const struct pci_driver i82801gx_pcie_port2 __pci_driver = {
static const struct pci_driver i82801gx_pcie __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27d2,
};
/* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
static const struct pci_driver i82801gx_pcie_port3 __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27d4,
};
/* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */
static const struct pci_driver i82801gx_pcie_port4 __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27d6,
};
/* 82801GR/GDH/GHM (ICH7R/ICH7DH/ICH7-M DH) */
static const struct pci_driver i82801gx_pcie_port5 __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27e0,
};
/* 82801GR/GDH/GHM (ICH7R/ICH7DH/ICH7-M DH) */
static const struct pci_driver i82801gx_pcie_port6 __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27e2,
.devices= i82801gx_pcie_ids,
};

View File

@ -213,53 +213,19 @@ static struct device_operations sata_ops = {
.ops_pci = &sata_pci_ops,
};
/* Desktop Non-AHCI and Non-RAID Mode */
/* 82801GB/GR/GDH (ICH7/ICH7R/ICH7DH) */
static const struct pci_driver i82801gx_sata_normal_driver __pci_driver = {
.ops = &sata_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27c0,
static const unsigned short sata_ids[] = {
0x27c0, /* Desktop Non-AHCI and Non-RAID Mode: 82801GB/GR/GDH (ICH7/ICH7R/ICH7DH) */
0x27c4, /* Mobile Non-AHCI and Non-RAID Mode: 82801GBM/GHM (ICH7-M/ICH7-M DH) */
/* NOTE: Any of the below are not properly supported yet. */
0x27c1, /* Desktop AHCI Mode: 82801GB/GR/GDH (ICH7/ICH7R/ICH7DH) */
0x27c3, /* Desktop RAID mode: 82801GB/GR/GDH (ICH7/ICH7R/ICH7DH) */
0x27c5, /* Mobile AHCI Mode: 82801GBM/GHM (ICH7-M/ICH7-M DH) */
0x27c6, /* ICH7M DH Raid Mode: 82801GHM (ICH7-M DH) */
0
};
/* Mobile Non-AHCI and Non-RAID Mode */
/* 82801GBM/GHM (ICH7-M/ICH7-M DH) */
static const struct pci_driver i82801gx_sata_mobile_normal_driver __pci_driver = {
static const struct pci_driver i82801gx_sata_driver __pci_driver = {
.ops = &sata_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27c4,
};
/* NOTE: Any of the below are not properly supported yet. */
/* Desktop AHCI Mode */
/* 82801GB/GR/GDH (ICH7/ICH7R/ICH7DH) */
static const struct pci_driver i82801gx_sata_ahci_driver __pci_driver = {
.ops = &sata_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27c1,
};
/* Desktop RAID mode */
/* 82801GB/GR/GDH (ICH7/ICH7R/ICH7DH) */
static const struct pci_driver i82801gx_sata_raid_driver __pci_driver = {
.ops = &sata_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27c3,
};
/* Mobile AHCI Mode */
/* 82801GBM/GHM (ICH7-M/ICH7-M DH) */
static const struct pci_driver i82801gx_sata_mobile_ahci_driver __pci_driver = {
.ops = &sata_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27c5,
};
/* ICH7M DH Raid Mode */
/* 82801GHM (ICH7-M DH) */
static const struct pci_driver i82801gx_sata_ich7dh_raid_driver __pci_driver = {
.ops = &sata_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.device = 0x27c6,
.devices= sata_ids,
};

View File

@ -260,46 +260,20 @@ static struct device_operations lpc_ops = {
// .enable = mcp55_enable,
.ops_pci = &mcp55_pci_ops,
};
static const unsigned short lpc_ids[] = {
PCI_DEVICE_ID_NVIDIA_MCP55_LPC,
PCI_DEVICE_ID_NVIDIA_MCP55_PRO,
PCI_DEVICE_ID_NVIDIA_MCP55_LPC_2,
PCI_DEVICE_ID_NVIDIA_MCP55_LPC_3,
PCI_DEVICE_ID_NVIDIA_MCP55_LPC_4,
PCI_DEVICE_ID_NVIDIA_MCP55_LPC_5,
PCI_DEVICE_ID_NVIDIA_MCP55_LPC_6,
0
};
static const struct pci_driver lpc_driver __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC,
};
static const struct pci_driver lpc_driver_pro __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_PRO,
};
static const struct pci_driver lpc_driver_lpc2 __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_2,
};
static const struct pci_driver lpc_driver_lpc3 __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_3,
};
static const struct pci_driver lpc_driver_lpc4 __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_4,
};
static const struct pci_driver lpc_driver_lpc5 __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_5,
};
static const struct pci_driver lpc_driver_lpc6 __pci_driver = {
.ops = &lpc_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_6,
.devices = lpc_ids,
};
static struct device_operations lpc_slave_ops = {

View File

@ -50,29 +50,17 @@ static struct device_operations pcie_ops = {
// .enable = mcp55_enable,
};
static const unsigned short pcie_ids[] = {
PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_B_C,
PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_E,
PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_A,
PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_F,
PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_D,
0
};
static const struct pci_driver pciebc_driver __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_B_C,
.devices= pcie_ids,
};
static const struct pci_driver pciee_driver __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_E,
};
static const struct pci_driver pciea_driver __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_A,
};
static const struct pci_driver pcief_driver __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_F,
};
static const struct pci_driver pcied_driver __pci_driver = {
.ops = &pcie_ops,
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_D,
};

View File

@ -193,32 +193,17 @@ static const struct device_operations ctrl_ops = {
.ops_pci = &lops_pci,
};
static const unsigned short ctrl_ids[] = {
PCI_DEVICE_ID_VIA_K8T800_NB_SB_CTR,
PCI_DEVICE_ID_VIA_K8M800_NB_SB_CTR,
PCI_DEVICE_ID_VIA_K8T890CE_7,
PCI_DEVICE_ID_VIA_K8T890CF_7,
PCI_DEVICE_ID_VIA_K8M890CE_7,
0
};
static const struct pci_driver northbridge_driver_t800 __pci_driver = {
.ops = &ctrl_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8T800_NB_SB_CTR,
};
static const struct pci_driver northbridge_driver_m800 __pci_driver = {
.ops = &ctrl_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8M800_NB_SB_CTR,
};
static const struct pci_driver northbridge_driver_t890 __pci_driver = {
.ops = &ctrl_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8T890CE_7,
};
static const struct pci_driver northbridge_driver_t890cf __pci_driver = {
.ops = &ctrl_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8T890CF_7,
};
static const struct pci_driver northbridge_driver_m890 __pci_driver = {
.ops = &ctrl_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8M890CE_7,
.devices= ctrl_ids,
};

View File

@ -53,32 +53,17 @@ static const struct device_operations error_ops = {
.ops_pci = &lops_pci,
};
static const unsigned short error_ids[] = {
PCI_DEVICE_ID_VIA_K8T800_ERR,
PCI_DEVICE_ID_VIA_K8M800_ERR,
PCI_DEVICE_ID_VIA_K8T890CE_1,
PCI_DEVICE_ID_VIA_K8T890CF_1,
PCI_DEVICE_ID_VIA_K8M890CE_1,
0
};
static const struct pci_driver northbridge_driver_t800 __pci_driver = {
.ops = &error_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8T800_ERR,
};
static const struct pci_driver northbridge_driver_m800 __pci_driver = {
.ops = &error_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8M800_ERR,
};
static const struct pci_driver northbridge_driver_t890 __pci_driver = {
.ops = &error_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8T890CE_1,
};
static const struct pci_driver northbridge_driver_tcf __pci_driver = {
.ops = &error_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8T890CF_1,
};
static const struct pci_driver northbridge_driver_m __pci_driver = {
.ops = &error_ops,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8M890CE_1,
.devices= error_ids,
};