mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 07:02:34 +02:00
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()) Backported to older versions where pcidev handling was much more scattered. 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/67845 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
84982ce1f2
commit
e8eb2a6d28
@ -1514,6 +1514,7 @@ static int intel_ich_gpio_set(int gpio, int raise)
|
|||||||
|
|
||||||
/* First, look for a known LPC bridge */
|
/* First, look for a known LPC bridge */
|
||||||
for (dev = pacc->devices; dev; dev = dev->next) {
|
for (dev = pacc->devices; dev; dev = dev->next) {
|
||||||
|
pci_fill_info(dev, PCI_FILL_IDENT);
|
||||||
uint16_t device_class;
|
uint16_t device_class;
|
||||||
/* libpci before version 2.2.4 does not store class info. */
|
/* libpci before version 2.2.4 does not store class info. */
|
||||||
device_class = pci_read_word(dev, PCI_CLASS_DEVICE);
|
device_class = pci_read_word(dev, PCI_CLASS_DEVICE);
|
||||||
|
22
internal.c
22
internal.c
@ -30,9 +30,12 @@ struct pci_dev *pci_dev_find_filter(struct pci_filter filter)
|
|||||||
{
|
{
|
||||||
struct pci_dev *temp;
|
struct pci_dev *temp;
|
||||||
|
|
||||||
for (temp = pacc->devices; temp; temp = temp->next)
|
for (temp = pacc->devices; temp; temp = temp->next) {
|
||||||
if (pci_filter_match(&filter, temp))
|
if (pci_filter_match(&filter, temp)) {
|
||||||
|
pci_fill_info(temp, PCI_FILL_IDENT);
|
||||||
return temp;
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -50,8 +53,10 @@ struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t devclass)
|
|||||||
if (pci_filter_match(&filter, temp)) {
|
if (pci_filter_match(&filter, temp)) {
|
||||||
/* Read PCI class */
|
/* Read PCI class */
|
||||||
tmp2 = pci_read_word(temp, 0x0a);
|
tmp2 = pci_read_word(temp, 0x0a);
|
||||||
if (tmp2 == devclass)
|
if (tmp2 == devclass) {
|
||||||
|
pci_fill_info(temp, PCI_FILL_IDENT);
|
||||||
return temp;
|
return temp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -66,9 +71,12 @@ struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
|
|||||||
filter.vendor = vendor;
|
filter.vendor = vendor;
|
||||||
filter.device = device;
|
filter.device = device;
|
||||||
|
|
||||||
for (temp = pacc->devices; temp; temp = temp->next)
|
for (temp = pacc->devices; temp; temp = temp->next) {
|
||||||
if (pci_filter_match(&filter, temp))
|
if (pci_filter_match(&filter, temp)) {
|
||||||
|
pci_fill_info(temp, PCI_FILL_IDENT);
|
||||||
return temp;
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -88,8 +96,10 @@ struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
|||||||
if ((card_vendor ==
|
if ((card_vendor ==
|
||||||
pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID))
|
pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID))
|
||||||
&& (card_device ==
|
&& (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 temp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user