Lines Matching +full:mbox +full:-

1 // SPDX-License-Identifier: MIT
3 * Copyright © 2013-2021 Intel Corporation
10 static int gen6_check_mailbox_status(u32 mbox) in gen6_check_mailbox_status() argument
12 switch (mbox & GEN6_PCODE_ERROR_MASK) { in gen6_check_mailbox_status()
16 return -ENODEV; in gen6_check_mailbox_status()
18 return -ENXIO; in gen6_check_mailbox_status()
21 return -EOVERFLOW; in gen6_check_mailbox_status()
23 return -ETIMEDOUT; in gen6_check_mailbox_status()
25 MISSING_CASE(mbox & GEN6_PCODE_ERROR_MASK); in gen6_check_mailbox_status()
30 static int gen7_check_mailbox_status(u32 mbox) in gen7_check_mailbox_status() argument
32 switch (mbox & GEN6_PCODE_ERROR_MASK) { in gen7_check_mailbox_status()
36 return -ENXIO; in gen7_check_mailbox_status()
38 return -ETIMEDOUT; in gen7_check_mailbox_status()
40 return -EINVAL; in gen7_check_mailbox_status()
42 return -ENXIO; in gen7_check_mailbox_status()
44 return -EBUSY; in gen7_check_mailbox_status()
46 return -EACCES; in gen7_check_mailbox_status()
48 return -EOVERFLOW; in gen7_check_mailbox_status()
50 MISSING_CASE(mbox & GEN6_PCODE_ERROR_MASK); in gen7_check_mailbox_status()
55 static int __snb_pcode_rw(struct intel_uncore *uncore, u32 mbox, in __snb_pcode_rw() argument
60 lockdep_assert_held(&uncore->i915->sb_lock); in __snb_pcode_rw()
69 return -EAGAIN; in __snb_pcode_rw()
74 GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox); in __snb_pcode_rw()
81 &mbox)) in __snb_pcode_rw()
82 return -ETIMEDOUT; in __snb_pcode_rw()
89 if (GRAPHICS_VER(uncore->i915) > 6) in __snb_pcode_rw()
90 return gen7_check_mailbox_status(mbox); in __snb_pcode_rw()
92 return gen6_check_mailbox_status(mbox); in __snb_pcode_rw()
95 int snb_pcode_read(struct intel_uncore *uncore, u32 mbox, u32 *val, u32 *val1) in snb_pcode_read() argument
99 mutex_lock(&uncore->i915->sb_lock); in snb_pcode_read()
100 err = __snb_pcode_rw(uncore, mbox, val, val1, 500, 20, true); in snb_pcode_read()
101 mutex_unlock(&uncore->i915->sb_lock); in snb_pcode_read()
104 drm_dbg(&uncore->i915->drm, in snb_pcode_read()
105 "warning: pcode (read from mbox %x) mailbox access failed for %ps: %d\n", in snb_pcode_read()
106 mbox, __builtin_return_address(0), err); in snb_pcode_read()
112 int snb_pcode_write_timeout(struct intel_uncore *uncore, u32 mbox, u32 val, in snb_pcode_write_timeout() argument
117 mutex_lock(&uncore->i915->sb_lock); in snb_pcode_write_timeout()
118 err = __snb_pcode_rw(uncore, mbox, &val, NULL, in snb_pcode_write_timeout()
120 mutex_unlock(&uncore->i915->sb_lock); in snb_pcode_write_timeout()
123 drm_dbg(&uncore->i915->drm, in snb_pcode_write_timeout()
124 "warning: pcode (write of 0x%08x to mbox %x) mailbox access failed for %ps: %d\n", in snb_pcode_write_timeout()
125 val, mbox, __builtin_return_address(0), err); in snb_pcode_write_timeout()
131 static bool skl_pcode_try_request(struct intel_uncore *uncore, u32 mbox, in skl_pcode_try_request() argument
135 *status = __snb_pcode_rw(uncore, mbox, &request, NULL, 500, 0, true); in skl_pcode_try_request()
141 * skl_pcode_request - send PCODE request until acknowledgment
143 * @mbox: PCODE mailbox ID the request is targeted for
149 * Keep resending the @request to @mbox until PCODE acknowledges it, PCODE
156 * Returns 0 on success, %-ETIMEDOUT in case of a timeout, <0 in case of some
159 int skl_pcode_request(struct intel_uncore *uncore, u32 mbox, u32 request, in skl_pcode_request() argument
165 mutex_lock(&uncore->i915->sb_lock); in skl_pcode_request()
168 skl_pcode_try_request(uncore, mbox, request, reply_mask, reply, &status) in skl_pcode_request()
194 drm_dbg_kms(&uncore->i915->drm, in skl_pcode_request()
196 drm_WARN_ON_ONCE(&uncore->i915->drm, timeout_base_ms > 3); in skl_pcode_request()
202 mutex_unlock(&uncore->i915->sb_lock); in skl_pcode_request()
214 return -EPROBE_DEFER; in pcode_init_wait()
227 if (!IS_DGFX(uncore->i915)) in intel_pcode_init()
237 drm_notice(&uncore->i915->drm, in intel_pcode_init()
248 u32 mbox; in snb_pcode_read_p() local
251 mbox = REG_FIELD_PREP(GEN6_PCODE_MB_COMMAND, mbcmd) in snb_pcode_read_p()
255 with_intel_runtime_pm(uncore->rpm, wakeref) in snb_pcode_read_p()
256 err = snb_pcode_read(uncore, mbox, val, NULL); in snb_pcode_read_p()
264 u32 mbox; in snb_pcode_write_p() local
267 mbox = REG_FIELD_PREP(GEN6_PCODE_MB_COMMAND, mbcmd) in snb_pcode_write_p()
271 with_intel_runtime_pm(uncore->rpm, wakeref) in snb_pcode_write_p()
272 err = snb_pcode_write(uncore, mbox, val); in snb_pcode_write_p()