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:
committed by
Patrick Georgi
parent
94146009a1
commit
7f8b0cd89c
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user