1dd08ebf6SMatthew Brost /* SPDX-License-Identifier: MIT */ 2dd08ebf6SMatthew Brost /* 3dd08ebf6SMatthew Brost * Copyright © 2022 Intel Corporation 4dd08ebf6SMatthew Brost */ 5dd08ebf6SMatthew Brost 6dd08ebf6SMatthew Brost #ifndef _XE_PCODE_H_ 7dd08ebf6SMatthew Brost #define _XE_PCODE_H_ 8dd08ebf6SMatthew Brost 9dd08ebf6SMatthew Brost #include <linux/types.h> 10dd08ebf6SMatthew Brost struct xe_gt; 11*933fd5ffSRiana Tauro struct xe_device; 12dd08ebf6SMatthew Brost 13*933fd5ffSRiana Tauro void xe_pcode_init(struct xe_gt *gt); 14*933fd5ffSRiana Tauro int xe_pcode_probe_early(struct xe_device *xe); 15*933fd5ffSRiana Tauro int xe_pcode_ready(struct xe_device *xe, bool locked); 16dd08ebf6SMatthew Brost int xe_pcode_init_min_freq_table(struct xe_gt *gt, u32 min_gt_freq, 17dd08ebf6SMatthew Brost u32 max_gt_freq); 18dd08ebf6SMatthew Brost int xe_pcode_read(struct xe_gt *gt, u32 mbox, u32 *val, u32 *val1); 19dd08ebf6SMatthew Brost int xe_pcode_write_timeout(struct xe_gt *gt, u32 mbox, u32 val, 20dd08ebf6SMatthew Brost int timeout_ms); 21dd08ebf6SMatthew Brost #define xe_pcode_write(gt, mbox, val) \ 22dd08ebf6SMatthew Brost xe_pcode_write_timeout(gt, mbox, val, 1) 23dd08ebf6SMatthew Brost 24dd08ebf6SMatthew Brost int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request, 25dd08ebf6SMatthew Brost u32 reply_mask, u32 reply, int timeout_ms); 26dd08ebf6SMatthew Brost 2792d44a42SBadal Nilawar #define PCODE_MBOX(mbcmd, param1, param2)\ 2892d44a42SBadal Nilawar (FIELD_PREP(PCODE_MB_COMMAND, mbcmd)\ 2992d44a42SBadal Nilawar | FIELD_PREP(PCODE_MB_PARAM1, param1)\ 3092d44a42SBadal Nilawar | FIELD_PREP(PCODE_MB_PARAM2, param2)) 3192d44a42SBadal Nilawar 32dd08ebf6SMatthew Brost #endif 33