summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Singer <felix.singer@9elements.com>2019-11-10 11:04:08 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-11-22 10:47:43 +0000
commit7f8b0cd89c10621f456e3eebcd290d3946122d6d (patch)
tree018baa84262893975bd353807594d0d7f4052a4f /src
parent94146009a190383a581618fd969bf2276fb73585 (diff)
downloadcoreboot-7f8b0cd89c10621f456e3eebcd290d3946122d6d.tar.xz
sb/i82801ix: Use macros instead of hard-coded IDs
This patch replaces hard-coded PCI IDs with macros from pci_ids.h and cleans up some code. Change-Id: Ie6ea72ac49eb015ef5cbaa98ed2b3400072000b5 Signed-off-by: Felix Singer <felix.singer@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36705 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/include/device/pci_ids.h14
-rw-r--r--src/southbridge/intel/i82801ix/early_smbus.c4
-rw-r--r--src/southbridge/intel/i82801ix/hdaudio.c2
-rw-r--r--src/southbridge/intel/i82801ix/lpc.c12
-rw-r--r--src/southbridge/intel/i82801ix/pcie.c12
-rw-r--r--src/southbridge/intel/i82801ix/sata.c11
-rw-r--r--src/southbridge/intel/i82801ix/smbus.c4
-rw-r--r--src/southbridge/intel/i82801ix/thermal.c2
-rw-r--r--src/southbridge/intel/i82801ix/usb_ehci.c4
9 files changed, 36 insertions, 29 deletions
diff --git a/src/include/device/pci_ids.h b/src/include/device/pci_ids.h
index 18d6f601c1..c05640fe9c 100644
--- a/src/include/device/pci_ids.h
+++ b/src/include/device/pci_ids.h
@@ -2546,13 +2546,15 @@
#define PCI_DEVICE_ID_INTEL_82801HEM_LPC 0x2811
/* Intel 82801IB (ICH9) */
-#define PCI_DEVICE_ID_INTEL_82801IB_LPC 0x2918
+#define PCI_DEVICE_ID_INTEL_82801IB_LPC 0x2918 /* ICH9 */
#define PCI_DEVICE_ID_INTEL_82801IB_SATA_P0123 0x2920 /* Ports 0 - 3 */
#define PCI_DEVICE_ID_INTEL_82801IB_SATA_P01 0x2921 /* Ports 0 - 1 */
#define PCI_DEVICE_ID_INTEL_82801IB_SATA_AHCI1 0x2922 /* Ports 0 - 5 */
#define PCI_DEVICE_ID_INTEL_82801IB_SATA_AHCI2 0x2923 /* Ports 0, 1, 4, 5 */
#define PCI_DEVICE_ID_INTEL_82801IB_SATA_RAID 0x2822 /* RAID */
#define PCI_DEVICE_ID_INTEL_82801IB_SATA_P45 0x2926 /* Ports 4 - 5 */
+#define PCI_DEVICE_ID_INTEL_82801IBM_IEM_SATA_IDE_P01 0x2928 /* Ports 0 - 1 */
+#define PCI_DEVICE_ID_INTEL_82801IBM_IEM_SATA_AHCI_P0145 0x2929 /* Ports 0, 1, 4, 5 */
#define PCI_DEVICE_ID_INTEL_82801IB_SMB 0x2930
#define PCI_DEVICE_ID_INTEL_82801IB_THERMAL 0x2932
#define PCI_DEVICE_ID_INTEL_82801IB_PCI 0x244e /* DMI to PCI bridge */
@@ -2573,10 +2575,12 @@
#define PCI_DEVICE_ID_INTEL_82801IB_PCIE6 0x294a
#define PCI_DEVICE_ID_INTEL_82801IB_LAN 0x29c4
-/* Intel 82801IR/IH/IO (ICH9R/ICH9DH/ICH9DO), only difference to ICH9: LPC */
-#define PCI_DEVICE_ID_INTEL_82801IR_LPC 0x2916
-#define PCI_DEVICE_ID_INTEL_82801IO_LPC 0x2914
-#define PCI_DEVICE_ID_INTEL_82801IH_LPC 0x2912
+/* Only difference to ICH9: LPC */
+#define PCI_DEVICE_ID_INTEL_82801IH_LPC 0x2912 /* ICH9DH */
+#define PCI_DEVICE_ID_INTEL_82801IO_LPC 0x2914 /* ICH9DO */
+#define PCI_DEVICE_ID_INTEL_82801IR_LPC 0x2916 /* ICH9R */
+#define PCI_DEVICE_ID_INTEL_82801IEM_LPC 0x2917 /* ICH9M-E */
+#define PCI_DEVICE_ID_INTEL_82801IBM_LPC 0x2919 /* ICH9M */
#define PCI_DEVICE_ID_INTEL_CAVECREEK_LPC 0x2310
#define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41
diff --git a/src/southbridge/intel/i82801ix/early_smbus.c b/src/southbridge/intel/i82801ix/early_smbus.c
index 54ad3c369b..e686d48127 100644
--- a/src/southbridge/intel/i82801ix/early_smbus.c
+++ b/src/southbridge/intel/i82801ix/early_smbus.c
@@ -19,6 +19,7 @@
#include <device/pci_ops.h>
#include <console/console.h>
#include <device/pci_def.h>
+#include <device/pci_ids.h>
#include <southbridge/intel/common/smbus.h>
#include "i82801ix.h"
@@ -30,9 +31,8 @@ void enable_smbus(void)
dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Check to make sure we've got the right device. */
- if (pci_read_config16(dev, 0x2) != 0x2930) {
+ if (pci_read_config16(dev, 0x2) != PCI_DEVICE_ID_INTEL_82801IB_SMB)
die("SMBus controller not found!");
- }
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
diff --git a/src/southbridge/intel/i82801ix/hdaudio.c b/src/southbridge/intel/i82801ix/hdaudio.c
index f105a735f8..5099f167b9 100644
--- a/src/southbridge/intel/i82801ix/hdaudio.c
+++ b/src/southbridge/intel/i82801ix/hdaudio.c
@@ -305,5 +305,5 @@ static struct device_operations azalia_ops = {
static const struct pci_driver i82801ix_azalia __pci_driver = {
.ops = &azalia_ops,
.vendor = PCI_VENDOR_ID_INTEL,
- .device = 0x293e,
+ .device = PCI_DEVICE_ID_INTEL_82801IB_HD_AUDIO,
};
diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c
index 811b4b2820..d5417307e7 100644
--- a/src/southbridge/intel/i82801ix/lpc.c
+++ b/src/southbridge/intel/i82801ix/lpc.c
@@ -541,12 +541,12 @@ static struct device_operations device_ops = {
};
static const unsigned short pci_device_ids[] = {
- 0x2912, /* ICH9DH */
- 0x2914, /* ICH9DO */
- 0x2916, /* ICH9R */
- 0x2918, /* ICH9 */
- 0x2917, /* ICH9M-E */
- 0x2919, /* ICH9M */
+ PCI_DEVICE_ID_INTEL_82801IH_LPC, /* ICH9DH */
+ PCI_DEVICE_ID_INTEL_82801IO_LPC, /* ICH9DO */
+ PCI_DEVICE_ID_INTEL_82801IR_LPC, /* ICH9R */
+ PCI_DEVICE_ID_INTEL_82801IEM_LPC, /* ICH9M-E */
+ PCI_DEVICE_ID_INTEL_82801IB_LPC, /* ICH9 */
+ PCI_DEVICE_ID_INTEL_82801IBM_LPC, /* ICH9M */
0
};
diff --git a/src/southbridge/intel/i82801ix/pcie.c b/src/southbridge/intel/i82801ix/pcie.c
index b1d0ecc214..bdfc84db43 100644
--- a/src/southbridge/intel/i82801ix/pcie.c
+++ b/src/southbridge/intel/i82801ix/pcie.c
@@ -123,12 +123,12 @@ static struct device_operations device_ops = {
/* 82801Ix (ICH9DH/ICH9DO/ICH9R/ICH9/ICH9M-E/ICH9M) */
static const unsigned short pci_device_ids[] = {
- 0x2940, /* Port 1 */
- 0x2942, /* Port 2 */
- 0x2944, /* Port 3 */
- 0x2946, /* Port 4 */
- 0x2948, /* Port 5 */
- 0x294a, /* Port 6 */
+ PCI_DEVICE_ID_INTEL_82801IB_PCIE1, /* Port 1 */
+ PCI_DEVICE_ID_INTEL_82801IB_PCIE2, /* Port 2 */
+ PCI_DEVICE_ID_INTEL_82801IB_PCIE3, /* Port 3 */
+ PCI_DEVICE_ID_INTEL_82801IB_PCIE4, /* Port 4 */
+ PCI_DEVICE_ID_INTEL_82801IB_PCIE5, /* Port 5 */
+ PCI_DEVICE_ID_INTEL_82801IB_PCIE6, /* Port 6 */
0
};
static const struct pci_driver ich9_pcie __pci_driver = {
diff --git a/src/southbridge/intel/i82801ix/sata.c b/src/southbridge/intel/i82801ix/sata.c
index fa6c1df6b3..fcf4045baf 100644
--- a/src/southbridge/intel/i82801ix/sata.c
+++ b/src/southbridge/intel/i82801ix/sata.c
@@ -155,7 +155,8 @@ static void sata_init(struct device *const dev)
const config_t *const config = dev->chip_info;
const u16 devid = pci_read_config16(dev, PCI_DEVICE_ID);
- const int is_mobile = (devid == 0x2928) || (devid == 0x2929);
+ const int is_mobile = (devid == PCI_DEVICE_ID_INTEL_82801IBM_IEM_SATA_IDE_P01) ||
+ (devid == PCI_DEVICE_ID_INTEL_82801IBM_IEM_SATA_AHCI_P0145);
u8 sata_mode;
printk(BIOS_DEBUG, "i82801ix_sata: initializing...\n");
@@ -276,8 +277,12 @@ static struct device_operations sata_ops = {
};
static const unsigned short pci_device_ids[] = {
- 0x2920, 0x2921, 0x2922, 0x2923,
- 0x2928, 0x2929,
+ PCI_DEVICE_ID_INTEL_82801IB_SATA_P0123,
+ PCI_DEVICE_ID_INTEL_82801IB_SATA_P01,
+ PCI_DEVICE_ID_INTEL_82801IB_SATA_AHCI1,
+ PCI_DEVICE_ID_INTEL_82801IB_SATA_AHCI2,
+ PCI_DEVICE_ID_INTEL_82801IBM_IEM_SATA_IDE_P01,
+ PCI_DEVICE_ID_INTEL_82801IBM_IEM_SATA_AHCI_P0145,
0,
};
diff --git a/src/southbridge/intel/i82801ix/smbus.c b/src/southbridge/intel/i82801ix/smbus.c
index 9bab9b25de..b8e9cfd695 100644
--- a/src/southbridge/intel/i82801ix/smbus.c
+++ b/src/southbridge/intel/i82801ix/smbus.c
@@ -91,10 +91,8 @@ static struct device_operations smbus_ops = {
.ops_pci = &smbus_pci_ops,
};
-static const unsigned short pci_device_ids[] = { 0x2930, 0 };
-
static const struct pci_driver pch_smbus __pci_driver = {
.ops = &smbus_ops,
.vendor = PCI_VENDOR_ID_INTEL,
- .devices = pci_device_ids,
+ .device = PCI_DEVICE_ID_INTEL_82801IB_SMB,
};
diff --git a/src/southbridge/intel/i82801ix/thermal.c b/src/southbridge/intel/i82801ix/thermal.c
index 2deb84d4b2..8946b020d8 100644
--- a/src/southbridge/intel/i82801ix/thermal.c
+++ b/src/southbridge/intel/i82801ix/thermal.c
@@ -67,5 +67,5 @@ static struct device_operations device_ops = {
static const struct pci_driver ich9_thermal __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
- .device = 0x2932,
+ .device = PCI_DEVICE_ID_INTEL_82801IB_THERMAL,
};
diff --git a/src/southbridge/intel/i82801ix/usb_ehci.c b/src/southbridge/intel/i82801ix/usb_ehci.c
index 47254f94b9..4c875ad035 100644
--- a/src/southbridge/intel/i82801ix/usb_ehci.c
+++ b/src/southbridge/intel/i82801ix/usb_ehci.c
@@ -51,8 +51,8 @@ static void usb_ehci_set_subsystem(struct device *dev, unsigned int vendor,
}
static const unsigned short pci_device_ids[] = {
- 0x293a,
- 0x293c,
+ PCI_DEVICE_ID_INTEL_82801IB_EHCI1,
+ PCI_DEVICE_ID_INTEL_82801IB_EHCI2,
0
};