1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2017-2018 Intel Corporation
4 */
5
6#ifndef _INTEL_WOPCM_H_
7#define _INTEL_WOPCM_H_
8
9#include <linux/types.h>
10
11/**
12 * struct intel_wopcm - Overall WOPCM info and WOPCM regions.
13 * @size: Size of overall WOPCM.
14 * @guc: GuC WOPCM Region info.
15 * @guc.base: GuC WOPCM base which is offset from WOPCM base.
16 * @guc.size: Size of the GuC WOPCM region.
17 */
18struct intel_wopcm {
19 u32 size;
20 struct {
21 u32 base;
22 u32 size;
23 } guc;
24};
25
26/**
27 * intel_wopcm_guc_base()
28 * @wopcm: intel_wopcm structure
29 *
30 * Returns the base of the WOPCM shadowed region.
31 *
32 * Returns:
33 * 0 if GuC is not present or not in use.
34 * Otherwise, the GuC WOPCM base.
35 */
36static inline u32 intel_wopcm_guc_base(struct intel_wopcm *wopcm)
37{
38 return wopcm->guc.base;
39}
40
41/**
42 * intel_wopcm_guc_size()
43 * @wopcm: intel_wopcm structure
44 *
45 * Returns size of the WOPCM shadowed region.
46 *
47 * Returns:
48 * 0 if GuC is not present or not in use.
49 * Otherwise, the GuC WOPCM size.
50 */
51static inline u32 intel_wopcm_guc_size(struct intel_wopcm *wopcm)
52{
53 return wopcm->guc.size;
54}
55
56void intel_wopcm_init_early(struct intel_wopcm *wopcm);
57void intel_wopcm_init(struct intel_wopcm *wopcm);
58
59#endif
60