pciexp_device: Join pciexp_find_(next_)extended_cap() APIs

Move the `offset` parameter into pciexp_find_extended_cap(). If it's
called with `0`, we start a new search. If it's an existing offset,
we continue the search.

This makes it easier to search for multiple occurences of a capa-
bility in a single loop.

Change-Id: I80115372a82523b90460d97f0fd0fa565c3f56cb
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66453
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Nico Huber
2022-08-05 12:58:18 +02:00
committed by Felix Held
parent d5ab24cd48
commit 5ffc2c8a3f
4 changed files with 27 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ static void lv2_enable_ltr(struct device *dev)
if (!pciexp_get_ltr_max_latencies(dev, &max_snoop, &max_nosnoop))
return;
const unsigned int ltr_cap = pciexp_find_extended_cap(dev, PCIE_EXT_CAP_LTR_ID);
const unsigned int ltr_cap = pciexp_find_extended_cap(dev, PCIE_EXT_CAP_LTR_ID, 0);
if (!ltr_cap)
return;