brintos

brintos / linux-shallow public Read only

0
0
Text · 1.4 KiB · a257767 Raw
50 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2022 Intel Corporation4 */5 6#ifndef _XE_FORCE_WAKE_H_7#define _XE_FORCE_WAKE_H_8 9#include "xe_assert.h"10#include "xe_force_wake_types.h"11 12struct xe_gt;13 14void xe_force_wake_init_gt(struct xe_gt *gt,15			   struct xe_force_wake *fw);16void xe_force_wake_init_engines(struct xe_gt *gt,17				struct xe_force_wake *fw);18int xe_force_wake_get(struct xe_force_wake *fw,19		      enum xe_force_wake_domains domains);20int xe_force_wake_put(struct xe_force_wake *fw,21		      enum xe_force_wake_domains domains);22 23static inline int24xe_force_wake_ref(struct xe_force_wake *fw,25		  enum xe_force_wake_domains domain)26{27	xe_gt_assert(fw->gt, domain != XE_FORCEWAKE_ALL);28	return fw->domains[ffs(domain) - 1].ref;29}30 31/**32 * xe_force_wake_assert_held - asserts domain is awake33 * @fw : xe_force_wake structure34 * @domain: xe_force_wake_domains apart from XE_FORCEWAKE_ALL35 *36 * xe_force_wake_assert_held() is designed to confirm a particular37 * forcewake domain's wakefulness; it doesn't verify the wakefulness of38 * multiple domains. Make sure the caller doesn't input multiple39 * domains(XE_FORCEWAKE_ALL) as a parameter.40 */41static inline void42xe_force_wake_assert_held(struct xe_force_wake *fw,43			  enum xe_force_wake_domains domain)44{45	xe_gt_assert(fw->gt, domain != XE_FORCEWAKE_ALL);46	xe_gt_assert(fw->gt, fw->awake_domains & domain);47}48 49#endif50