Attention is currently required from: Thomas Heijligen, Daniel Verkamp.

Nico Huber would like build bot (Jenkins), Daniel Verkamp and Thomas Heijligen to review this change.

View Change

pcidev: Always fetch ident info

As discovered earlier[1], the `vendor_id` and `device_id` fields are not
always automatically set. However, we use these fields throughout flash-
rom. To not lose track when we actually fetched them, let's always call
pci_fill_info(PCI_FILL_IDENT) before returning a `pci_dev` handle.

[1] Commit ca2e3bce0 (pcidev.c: populate IDs with pci_fill_info())

Signed-off-by: Nico Huber <nico.h@gmx.de>
Change-Id: Iae2511178bec44343cbe902722fdca9eda036059
Ticket: https://ticket.coreboot.org/issues/367
Reviewed-on: https://review.coreboot.org/c/flashrom/+/64573
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Thomas Heijligen <src@posteo.de>
---
M board_enable.c
M internal.c
2 files changed, 39 insertions(+), 6 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/45/67845/1
diff --git a/board_enable.c b/board_enable.c
index 3b6755e..97bb15a 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -1514,6 +1514,7 @@

/* First, look for a known LPC bridge */
for (dev = pacc->devices; dev; dev = dev->next) {
+ pci_fill_info(dev, PCI_FILL_IDENT);
uint16_t device_class;
/* libpci before version 2.2.4 does not store class info. */
device_class = pci_read_word(dev, PCI_CLASS_DEVICE);
diff --git a/internal.c b/internal.c
index cb02753..7628988 100644
--- a/internal.c
+++ b/internal.c
@@ -30,9 +30,12 @@
{
struct pci_dev *temp;

- for (temp = pacc->devices; temp; temp = temp->next)
- if (pci_filter_match(&filter, temp))
+ for (temp = pacc->devices; temp; temp = temp->next) {
+ if (pci_filter_match(&filter, temp)) {
+ pci_fill_info(temp, PCI_FILL_IDENT);
return temp;
+ }
+ }

return NULL;
}
@@ -50,8 +53,10 @@
if (pci_filter_match(&filter, temp)) {
/* Read PCI class */
tmp2 = pci_read_word(temp, 0x0a);
- if (tmp2 == devclass)
+ if (tmp2 == devclass) {
+ pci_fill_info(temp, PCI_FILL_IDENT);
return temp;
+ }
}

return NULL;
@@ -66,9 +71,12 @@
filter.vendor = vendor;
filter.device = device;

- for (temp = pacc->devices; temp; temp = temp->next)
- if (pci_filter_match(&filter, temp))
+ for (temp = pacc->devices; temp; temp = temp->next) {
+ if (pci_filter_match(&filter, temp)) {
+ pci_fill_info(temp, PCI_FILL_IDENT);
return temp;
+ }
+ }

return NULL;
}
@@ -88,8 +96,10 @@
if ((card_vendor ==
pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID))
&& (card_device ==
- pci_read_word(temp, PCI_SUBSYSTEM_ID)))
+ pci_read_word(temp, PCI_SUBSYSTEM_ID))) {
+ pci_fill_info(temp, PCI_FILL_IDENT);
return temp;
+ }
}

return NULL;

To view, visit change 67845. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-Change-Id: Iae2511178bec44343cbe902722fdca9eda036059
Gerrit-Change-Number: 67845
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Daniel Verkamp <dverkamp@chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: Thomas Heijligen <src@posteo.de>
Gerrit-Attention: Daniel Verkamp <dverkamp@chromium.org>
Gerrit-MessageType: newchange