mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
Revert "pcidev: remove pcidev_getdevfn() function"
As Edward pointed out correctly this function does more than abstracting the different versions of `pci_get_dev()`. It also hide the usage of the global `struct pci_access pacc` from the caller. This reverts commit 0e8902f1ff2b927bb91a5e89e4fde3d8d71f6692. Change-Id: I0cd2f54cb6a6e35dc353476e0f5e502cbbd06cba Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73730 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
parent
0c774d6b6a
commit
e1cdbdbbfb
@ -1095,12 +1095,11 @@ static int nvidia_mcp_gpio_set(int gpio, int raise)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
|
dev = pcidev_getdevfn(dev, 1);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
msg_perr("MCP SMBus controller could not be found\n");
|
msg_perr("MCP SMBus controller could not be found\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pci_fill_info(dev, PCI_FILL_IDENT);
|
|
||||||
devclass = pci_read_word(dev, PCI_CLASS_DEVICE);
|
devclass = pci_read_word(dev, PCI_CLASS_DEVICE);
|
||||||
if (devclass != 0x0C05) {
|
if (devclass != 0x0C05) {
|
||||||
msg_perr("Unexpected device class %04x for SMBus"
|
msg_perr("Unexpected device class %04x for SMBus"
|
||||||
|
@ -125,6 +125,7 @@ int pci_init_common(void);
|
|||||||
uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
|
uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
|
||||||
struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
|
struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
|
||||||
struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start);
|
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_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);
|
struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device);
|
||||||
struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device);
|
struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device);
|
||||||
|
8
pcidev.c
8
pcidev.c
@ -190,6 +190,14 @@ struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device)
|
|||||||
return pcidev_scandev(&filter, NULL);
|
return pcidev_scandev(&filter, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func)
|
||||||
|
{
|
||||||
|
struct pci_dev *const new = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, func);
|
||||||
|
if (new)
|
||||||
|
pci_fill_info(new, PCI_FILL_IDENT);
|
||||||
|
return new;
|
||||||
|
}
|
||||||
|
|
||||||
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass)
|
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass)
|
||||||
{
|
{
|
||||||
struct pci_dev *temp = NULL;
|
struct pci_dev *temp = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user