device: Use pcidev_path_behind()
Change-Id: Iac16f9412d0e6aac908d873c61a4de3935e5318a Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/26518 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
e7377556cc
commit
a144e4d6fa
|
@ -24,7 +24,6 @@ static void pci7xx1_enable(struct device *const dev)
|
||||||
{
|
{
|
||||||
printk(BIOS_DEBUG, "%s: TI PCI7xx1 media controller\n", __func__);
|
printk(BIOS_DEBUG, "%s: TI PCI7xx1 media controller\n", __func__);
|
||||||
if (PCI_FUNC(dev->path.pci.devfn) == 0) {
|
if (PCI_FUNC(dev->path.pci.devfn) == 0) {
|
||||||
const uint16_t secondary = dev->bus->secondary;
|
|
||||||
const unsigned slot = PCI_SLOT(dev->path.pci.devfn);
|
const unsigned slot = PCI_SLOT(dev->path.pci.devfn);
|
||||||
|
|
||||||
int fn;
|
int fn;
|
||||||
|
@ -33,7 +32,7 @@ static void pci7xx1_enable(struct device *const dev)
|
||||||
u16 gcr = pci_read_config16(dev, 0x86);
|
u16 gcr = pci_read_config16(dev, 0x86);
|
||||||
for (fn = 5; fn > 0; --fn) {
|
for (fn = 5; fn > 0; --fn) {
|
||||||
const struct device *const d =
|
const struct device *const d =
|
||||||
dev_find_slot(secondary, PCI_DEVFN(slot, fn));
|
pcidev_path_behind(dev->bus, PCI_DEVFN(slot, fn));
|
||||||
if (!d || d->enabled) continue;
|
if (!d || d->enabled) continue;
|
||||||
printk(BIOS_DEBUG,
|
printk(BIOS_DEBUG,
|
||||||
"%s: Hiding function #%d.\n", __func__, fn);
|
"%s: Hiding function #%d.\n", __func__, fn);
|
||||||
|
|
|
@ -30,7 +30,7 @@ void amd8111_enable(struct device *dev)
|
||||||
{
|
{
|
||||||
unsigned devfn;
|
unsigned devfn;
|
||||||
devfn = bus_dev->path.pci.devfn + (1 << 3);
|
devfn = bus_dev->path.pci.devfn + (1 << 3);
|
||||||
lpc_dev = dev_find_slot(bus_dev->bus->secondary, devfn);
|
lpc_dev = pcidev_path_behind(bus_dev->bus, devfn);
|
||||||
index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
|
index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
|
||||||
if (dev->path.pci.devfn == 2) { /* EHCI */
|
if (dev->path.pci.devfn == 2) { /* EHCI */
|
||||||
index = 16;
|
index = 16;
|
||||||
|
@ -38,7 +38,7 @@ void amd8111_enable(struct device *dev)
|
||||||
} else {
|
} else {
|
||||||
unsigned devfn;
|
unsigned devfn;
|
||||||
devfn = (dev->path.pci.devfn) & ~7;
|
devfn = (dev->path.pci.devfn) & ~7;
|
||||||
lpc_dev = dev_find_slot(dev->bus->secondary, devfn);
|
lpc_dev = pcidev_path_behind(dev->bus, devfn);
|
||||||
index = dev->path.pci.devfn & 7;
|
index = dev->path.pci.devfn & 7;
|
||||||
}
|
}
|
||||||
if ((!lpc_dev) || (index >= 17)) {
|
if ((!lpc_dev) || (index >= 17)) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ static struct device *find_sm_dev(struct device *dev, u32 devfn)
|
||||||
{
|
{
|
||||||
struct device *sm_dev;
|
struct device *sm_dev;
|
||||||
|
|
||||||
sm_dev = dev_find_slot(dev->bus->secondary, devfn);
|
sm_dev = pcidev_path_behind(dev->bus, devfn);
|
||||||
if (!sm_dev)
|
if (!sm_dev)
|
||||||
return sm_dev;
|
return sm_dev;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ static struct device *find_sm_dev(struct device *dev, u32 devfn)
|
||||||
{
|
{
|
||||||
struct device *sm_dev;
|
struct device *sm_dev;
|
||||||
|
|
||||||
sm_dev = dev_find_slot(dev->bus->secondary, devfn);
|
sm_dev = pcidev_path_behind(dev->bus, devfn);
|
||||||
if (!sm_dev)
|
if (!sm_dev)
|
||||||
return sm_dev;
|
return sm_dev;
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,15 @@ void bcm5785_enable(struct device *dev)
|
||||||
{
|
{
|
||||||
unsigned devfn;
|
unsigned devfn;
|
||||||
devfn = bus_dev->path.pci.devfn + (1 << 3);
|
devfn = bus_dev->path.pci.devfn + (1 << 3);
|
||||||
sb_pci_main_dev = dev_find_slot(bus_dev->bus->secondary, devfn);
|
sb_pci_main_dev = pcidev_path_behind(bus_dev->bus, devfn);
|
||||||
// index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
|
// index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
|
||||||
} else if ((bus_dev->vendor == PCI_VENDOR_ID_SERVERWORKS) &&
|
} else if ((bus_dev->vendor == PCI_VENDOR_ID_SERVERWORKS) &&
|
||||||
(bus_dev->device == 0x0104)) // device under PCI Bridge (under PCI-X)
|
(bus_dev->device == 0x0104)) // device under PCI Bridge (under PCI-X)
|
||||||
{
|
{
|
||||||
unsigned devfn;
|
unsigned devfn;
|
||||||
devfn = bus_dev->bus->dev->path.pci.devfn + (1 << 3);
|
devfn = bus_dev->bus->dev->path.pci.devfn + (1 << 3);
|
||||||
sb_pci_main_dev = dev_find_slot(bus_dev->bus->dev->bus->secondary, devfn);
|
sb_pci_main_dev = pcidev_path_behind(bus_dev->bus->dev->bus,
|
||||||
|
devfn);
|
||||||
// index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
|
// index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
|
||||||
}
|
}
|
||||||
else { // same bus
|
else { // same bus
|
||||||
|
@ -51,7 +52,7 @@ void bcm5785_enable(struct device *dev)
|
||||||
else if (dev->device == 0x0223) // USB
|
else if (dev->device == 0x0223) // USB
|
||||||
{ devfn -= (1<<3); }
|
{ devfn -= (1<<3); }
|
||||||
}
|
}
|
||||||
sb_pci_main_dev = dev_find_slot(dev->bus->secondary, devfn);
|
sb_pci_main_dev = pcidev_path_behind(dev->bus, devfn);
|
||||||
// index = dev->path.pci.devfn & 7;
|
// index = dev->path.pci.devfn & 7;
|
||||||
}
|
}
|
||||||
if (!sb_pci_main_dev) {
|
if (!sb_pci_main_dev) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ static struct device *find_lpc_dev(struct device *dev, unsigned devfn)
|
||||||
{
|
{
|
||||||
struct device *lpc_dev;
|
struct device *lpc_dev;
|
||||||
|
|
||||||
lpc_dev = dev_find_slot(dev->bus->secondary, devfn);
|
lpc_dev = pcidev_path_behind(dev->bus, devfn);
|
||||||
if (!lpc_dev)
|
if (!lpc_dev)
|
||||||
return lpc_dev;
|
return lpc_dev;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ static struct device *find_lpc_dev(struct device *dev, unsigned devfn)
|
||||||
{
|
{
|
||||||
struct device *lpc_dev;
|
struct device *lpc_dev;
|
||||||
|
|
||||||
lpc_dev = dev_find_slot(dev->bus->secondary, devfn);
|
lpc_dev = pcidev_path_behind(dev->bus, devfn);
|
||||||
|
|
||||||
if (!lpc_dev)
|
if (!lpc_dev)
|
||||||
return lpc_dev;
|
return lpc_dev;
|
||||||
|
@ -158,7 +158,7 @@ void mcp55_enable(struct device *dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (index2 != 0) {
|
if (index2 != 0) {
|
||||||
sm_dev = dev_find_slot(dev->bus->secondary, devfn + 1);
|
sm_dev = pcidev_path_behind(dev->bus, devfn + 1);
|
||||||
if (!sm_dev)
|
if (!sm_dev)
|
||||||
return;
|
return;
|
||||||
if (sm_dev) {
|
if (sm_dev) {
|
||||||
|
@ -187,7 +187,7 @@ void mcp55_enable(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == 16) {
|
if (index == 16) {
|
||||||
sm_dev = dev_find_slot(dev->bus->secondary, devfn + 1);
|
sm_dev = pcidev_path_behind(dev->bus, devfn + 1);
|
||||||
if (!sm_dev)
|
if (!sm_dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void mcp55_enable(struct device *dev)
|
||||||
|
|
||||||
/* NIC1 is the final, we need update final reg to 0xe8. */
|
/* NIC1 is the final, we need update final reg to 0xe8. */
|
||||||
if (index == 9) {
|
if (index == 9) {
|
||||||
sm_dev = dev_find_slot(dev->bus->secondary, devfn + 1);
|
sm_dev = pcidev_path_behind(dev->bus, devfn + 1);
|
||||||
if (!sm_dev)
|
if (!sm_dev)
|
||||||
return;
|
return;
|
||||||
reg_old = pci_read_config32(sm_dev, 0xe8);
|
reg_old = pci_read_config32(sm_dev, 0xe8);
|
||||||
|
|
Loading…
Reference in New Issue