treewide: use predicates to check for enabled pci devices

use functions to check for pci devices instead of open-coded
solution.

TEST: compiled and qemu run successfully

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Change-Id: Idb992904112db611119b2d33c8b1dd912b2c8539
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68102
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Fabio Aiuto 2022-09-30 11:25:28 +02:00 committed by Martin Roth
parent 4fce79f69c
commit d835da9155
10 changed files with 11 additions and 11 deletions

View File

@ -575,7 +575,7 @@ unsigned long __weak write_smp_table(unsigned long addr)
for (dev = all_devices; dev; dev = dev->next) { for (dev = all_devices; dev; dev = dev->next) {
if (dev->path.type != DEVICE_PATH_PCI || !dev->enabled) if (!is_enabled_pci(dev))
continue; continue;
have_fixed_entries = 0; have_fixed_entries = 0;

View File

@ -86,7 +86,7 @@ static void pch_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin = 0, int_line = 0; u8 int_pin = 0, int_line = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -436,7 +436,7 @@ void pch_pirq_init(void)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
uint8_t int_pin = 0, int_line = 0; uint8_t int_pin = 0, int_line = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(PCI_BDF(irq_dev), PCI_INTERRUPT_PIN); int_pin = pci_read_config8(PCI_BDF(irq_dev), PCI_INTERRUPT_PIN);

View File

@ -254,7 +254,7 @@ static u8 dnv_get_int_line(struct device *irq_dev)
int8_t original_int_pin = 0, new_int_pin = 0, swiz_int_pin = 0; int8_t original_int_pin = 0, new_int_pin = 0, swiz_int_pin = 0;
uint8_t int_line = 0xff; uint8_t int_line = 0xff;
if (irq_dev->path.type != DEVICE_PATH_PCI || !irq_dev->enabled) { if (!is_enabled_pci(irq_dev)) {
printk(BIOS_ERR, "%s for non pci device?\n", __func__); printk(BIOS_ERR, "%s for non pci device?\n", __func__);
goto dnv_get_int_line_done; goto dnv_get_int_line_done;
} }
@ -380,7 +380,7 @@ static void pch_pirq_init(struct device *dev)
int devfn = irq_dev->path.pci.devfn; int devfn = irq_dev->path.pci.devfn;
u8 int_pin = 0, int_line = 0; u8 int_pin = 0, int_line = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -104,7 +104,7 @@ static void pch_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin=0; u8 int_pin=0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -86,7 +86,7 @@ static void i82801gx_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin = 0, int_line = 0; u8 int_pin = 0, int_line = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -89,7 +89,7 @@ static void i82801ix_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin = 0, int_line = 0; u8 int_pin = 0, int_line = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -98,7 +98,7 @@ static void i82801jx_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin = 0; u8 int_pin = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -96,7 +96,7 @@ static void pch_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin=0; u8 int_pin=0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);

View File

@ -120,7 +120,7 @@ static void pch_pirq_init(struct device *dev)
for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
u8 int_pin = 0, int_line = 0; u8 int_pin = 0, int_line = 0;
if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) if (!is_enabled_pci(irq_dev))
continue; continue;
int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN); int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);