mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
pcidev: Move pci_card_find() from internal to canonical place
Also rename to `pcidev_card_find()` in fitting with pcidev.c helpers. BUG=b:220950271 TEST=```sudo ./flashrom -p internal -r /tmp/bios <snip> Found Programmer flash chip "Opaque flash chip" (16384 kB, Programmer-specific) mapped at physical address 0x0000000000000000. Reading flash... done. ``` Change-Id: I026bfbecba114411728d4ad1ed8969b469fa7d2d Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/59279 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
parent
d69c30766e
commit
855b898331
@ -2645,14 +2645,14 @@ static const struct board_match *board_match_pci_ids(enum board_match_phase phas
|
||||
if (board->phase != phase)
|
||||
continue;
|
||||
|
||||
if (!pci_card_find(board->first_vendor, board->first_device,
|
||||
if (!pcidev_card_find(board->first_vendor, board->first_device,
|
||||
board->first_card_vendor,
|
||||
board->first_card_device))
|
||||
continue;
|
||||
|
||||
if (board->second_vendor) {
|
||||
if (board->second_card_vendor) {
|
||||
if (!pci_card_find(board->second_vendor,
|
||||
if (!pcidev_card_find(board->second_vendor,
|
||||
board->second_device,
|
||||
board->second_card_vendor,
|
||||
board->second_card_device))
|
||||
|
19
internal.c
19
internal.c
@ -45,25 +45,6 @@ struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
|
||||
return pcidev_scandev(&filter, NULL);
|
||||
}
|
||||
|
||||
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
||||
uint16_t card_vendor, uint16_t card_device)
|
||||
{
|
||||
struct pci_dev *temp = NULL;
|
||||
struct pci_filter filter;
|
||||
|
||||
pci_filter_init(NULL, &filter);
|
||||
filter.vendor = vendor;
|
||||
filter.device = device;
|
||||
|
||||
while ((temp = pcidev_scandev(&filter, temp))) {
|
||||
if ((card_vendor == pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID))
|
||||
&& (card_device == pci_read_word(temp, PCI_SUBSYSTEM_ID)))
|
||||
return temp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
void probe_superio(void)
|
||||
{
|
||||
|
19
pcidev.c
19
pcidev.c
@ -157,6 +157,25 @@ struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device,
|
||||
uint16_t card_vendor, uint16_t card_device)
|
||||
{
|
||||
struct pci_dev *temp = NULL;
|
||||
struct pci_filter filter;
|
||||
|
||||
pci_filter_init(NULL, &filter);
|
||||
filter.vendor = vendor;
|
||||
filter.device = device;
|
||||
|
||||
while ((temp = pcidev_scandev(&filter, temp))) {
|
||||
if ((card_vendor == pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID))
|
||||
&& (card_device == pci_read_word(temp, PCI_SUBSYSTEM_ID)))
|
||||
return temp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func)
|
||||
{
|
||||
#if !defined(OLD_PCI_GET_DEV)
|
||||
|
@ -128,6 +128,7 @@ struct pci_dev *pcidev_init(const struct dev_entry *devs, int bar);
|
||||
struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start);
|
||||
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func);
|
||||
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass);
|
||||
struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device);
|
||||
/* rpci_write_* are reversible writes. The original PCI config space register
|
||||
* contents will be restored on shutdown.
|
||||
* To clone the pci_dev instances internally, the `pacc` global
|
||||
@ -262,8 +263,6 @@ extern int superio_count;
|
||||
#endif
|
||||
#if NEED_PCI == 1
|
||||
struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
|
||||
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
||||
uint16_t card_vendor, uint16_t card_device);
|
||||
#endif
|
||||
#if CONFIG_INTERNAL == 1
|
||||
extern int is_laptop;
|
||||
|
Loading…
x
Reference in New Issue
Block a user