mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
pcidev: Move pci_get_dev() logic into canonical place
BUG=b:220950271 TEST=```sudo ./flashrom -p internal --flash-size <snip> Found Programmer flash chip "Opaque flash chip" (16384 kB, Programmer-specific) mapped at physical address 0x0000000000000000. 16777216 ``` Change-Id: Id9ce055d5e5d347520ec5002b8c6548e60eaa0a7 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/59276 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
parent
12dbc4e045
commit
00194eadde
@ -1094,15 +1094,7 @@ static int nvidia_mcp_gpio_set(int gpio, int raise)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(OLD_PCI_GET_DEV)
|
dev = pcidev_getdevfn(dev, 1);
|
||||||
dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
|
|
||||||
#else
|
|
||||||
/* pciutils/libpci before version 2.2 is too old to support
|
|
||||||
* PCI domains. Such old machines usually don't have domains
|
|
||||||
* besides domain 0, so this is not a problem.
|
|
||||||
*/
|
|
||||||
dev = pci_get_dev(pacc, dev->bus, dev->dev, 1);
|
|
||||||
#endif
|
|
||||||
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;
|
||||||
|
13
pcidev.c
13
pcidev.c
@ -157,6 +157,19 @@ struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func)
|
||||||
|
{
|
||||||
|
#if !defined(OLD_PCI_GET_DEV)
|
||||||
|
return pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, func);
|
||||||
|
#else
|
||||||
|
/* pciutils/libpci before version 2.2 is too old to support
|
||||||
|
* PCI domains. Such old machines usually don't have domains
|
||||||
|
* besides domain 0, so this is not a problem.
|
||||||
|
*/
|
||||||
|
return pci_get_dev(pacc, dev->bus, dev->dev, func);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int pcidev_shutdown(void *data)
|
static int pcidev_shutdown(void *data)
|
||||||
{
|
{
|
||||||
if (pacc == NULL) {
|
if (pacc == NULL) {
|
||||||
|
@ -126,6 +126,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 dev_entry *devs, int bar);
|
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_scandev(struct pci_filter *filter, struct pci_dev *start);
|
||||||
|
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func);
|
||||||
/* rpci_write_* are reversible writes. The original PCI config space register
|
/* rpci_write_* are reversible writes. The original PCI config space register
|
||||||
* contents will be restored on shutdown.
|
* contents will be restored on shutdown.
|
||||||
* To clone the pci_dev instances internally, the `pacc` global
|
* To clone the pci_dev instances internally, the `pacc` global
|
||||||
|
Loading…
x
Reference in New Issue
Block a user