device: Add helper function is_devfn_enabled()

is_devfn_enabled() function helps to check if a device
is enabled based on given device function number. This
function internally called is_dev_enabled() to check
device state.

Change-Id: I6aeba0da05b13b70155a991f69a6abf7eb48a78c
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55278
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Subrata Banik
2021-06-08 00:55:04 +05:30
parent aced1f02cf
commit eca3e6278a
2 changed files with 7 additions and 0 deletions

View File

@ -397,3 +397,9 @@ bool is_dev_enabled(const struct device *dev)
return false;
return dev->enabled;
}
bool is_devfn_enabled(unsigned int devfn)
{
const struct device *dev = pcidev_path_on_root(devfn);
return is_dev_enabled(dev);
}