[PATCH v6 2/2] drm/xe/sysctrl: Add helper to check oCode firmware readiness
"Anoop, Vijay" <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
From: Anoop Vijay <[email protected]> Add xe_sysctrl_is_oobmsm_fw_ready(), a convenience wrapper around xe_sysctrl_check_app_status() to check oCode application readiness. Signed-off-by: Anoop Vijay <[email protected]> --- v6: - New patch — split oCode application readiness helper out of the original patch into its own commit --- drivers/gpu/drm/xe/xe_sysctrl.c | 19 +++++++++++++++++++ drivers/gpu/drm/xe/xe_sysctrl.h | 1 + drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c index 35b8b8b85a48..8eac58647265 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl.c +++ b/drivers/gpu/drm/xe/xe_sysctrl.c @@ -175,6 +175,25 @@ xe_sysctrl_check_app_status(struct xe_device *xe, enum xe_sysctrl_app_id app_id) return XE_SYSCTRL_FIRMWARE_APP_INITIALIZED; } +/** + * xe_sysctrl_is_oobmsm_fw_ready() - Check if oCode firmware is fully initialized + * @xe: xe device instance + * + * Returns true if oCode firmware has reached the initialized state, indicating + * it is ready to handle requests. Returns true also on platforms without System + * Controller support, as there is no firmware gate to wait on. + * + * Return: true if oCode is initialized or sysctrl is not present, false otherwise + */ +bool xe_sysctrl_is_oobmsm_fw_ready(struct xe_device *xe) +{ + enum xe_sysctrl_fw_status status = + xe_sysctrl_check_app_status(xe, XE_SYSCTRL_APP_OCODE); + + return status == XE_SYSCTRL_FIRMWARE_APP_INITIALIZED || + status == XE_SYSCTRL_FIRMWARE_APP_NOTSUPP; +} + /** * xe_sysctrl_is_diag_fw_ready() - Check if diag firmware is fully initialized * @xe: xe device instance diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h index 8dc576796890..b69a3f474236 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl.h +++ b/drivers/gpu/drm/xe/xe_sysctrl.h @@ -20,6 +20,7 @@ void xe_sysctrl_event(struct xe_sysctrl *sc); int xe_sysctrl_init(struct xe_device *xe); void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl); void xe_sysctrl_pm_resume(struct xe_device *xe); +bool xe_sysctrl_is_oobmsm_fw_ready(struct xe_device *xe); bool xe_sysctrl_is_diag_fw_ready(struct xe_device *xe); #endif diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h index 5e39d2a9c2b0..b507e1553cbb 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h @@ -95,9 +95,11 @@ enum xe_sysctrl_fw_status { /** * enum xe_sysctrl_app_id - Known System Controller application identifiers * + * @XE_SYSCTRL_APP_OCODE: oCode application (firmware ID 12) * @XE_SYSCTRL_APP_DIAG: diag application (firmware ID 13) */ enum xe_sysctrl_app_id { + XE_SYSCTRL_APP_OCODE = 0x0C, XE_SYSCTRL_APP_DIAG = 0x0D, }; -- 2.43.0