Subrata Banik submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved Tim Wawrzynczak: Looks good to me, approved
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>
---
M src/device/device_const.c
M src/include/device/device.h
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/device/device_const.c b/src/device/device_const.c
index 20afe7e..7e7f2f1 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -397,3 +397,9 @@
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);
+}
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 623d337..afa6a40 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -192,6 +192,7 @@
bool dev_is_active_bridge(struct device *dev);
void add_more_links(struct device *dev, unsigned int total_links);
bool is_dev_enabled(const struct device *const dev);
+bool is_devfn_enabled(unsigned int devfn);

/* Option ROM helper functions */
void run_bios(struct device *dev, unsigned long addr);

To view, visit change 55278. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6aeba0da05b13b70155a991f69a6abf7eb48a78c
Gerrit-Change-Number: 55278
Gerrit-PatchSet: 5
Gerrit-Owner: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged