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>
This commit is contained in:
Felix Singer 2019-11-10 11:04:08 +01:00 committed by Patrick Georgi
parent 94146009a1
commit 7f8b0cd89c
9 changed files with 36 additions and 29 deletions

View File

@ -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

View File

@ -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,

View File

@ -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,
};

View File

@ -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
};

View File

@ -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 = {

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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
};