18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * SPDX-License-Identifier: MIT
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright © 2017-2018 Intel Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _INTEL_WOPCM_H_
88c2ecf20Sopenharmony_ci#define _INTEL_WOPCM_H_
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/types.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/**
138c2ecf20Sopenharmony_ci * struct intel_wopcm - Overall WOPCM info and WOPCM regions.
148c2ecf20Sopenharmony_ci * @size: Size of overall WOPCM.
158c2ecf20Sopenharmony_ci * @guc: GuC WOPCM Region info.
168c2ecf20Sopenharmony_ci * @guc.base: GuC WOPCM base which is offset from WOPCM base.
178c2ecf20Sopenharmony_ci * @guc.size: Size of the GuC WOPCM region.
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_cistruct intel_wopcm {
208c2ecf20Sopenharmony_ci	u32 size;
218c2ecf20Sopenharmony_ci	struct {
228c2ecf20Sopenharmony_ci		u32 base;
238c2ecf20Sopenharmony_ci		u32 size;
248c2ecf20Sopenharmony_ci	} guc;
258c2ecf20Sopenharmony_ci};
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/**
288c2ecf20Sopenharmony_ci * intel_wopcm_guc_base()
298c2ecf20Sopenharmony_ci * @wopcm:	intel_wopcm structure
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * Returns the base of the WOPCM shadowed region.
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci * Returns:
348c2ecf20Sopenharmony_ci * 0 if GuC is not present or not in use.
358c2ecf20Sopenharmony_ci * Otherwise, the GuC WOPCM base.
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_cistatic inline u32 intel_wopcm_guc_base(struct intel_wopcm *wopcm)
388c2ecf20Sopenharmony_ci{
398c2ecf20Sopenharmony_ci	return wopcm->guc.base;
408c2ecf20Sopenharmony_ci}
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/**
438c2ecf20Sopenharmony_ci * intel_wopcm_guc_size()
448c2ecf20Sopenharmony_ci * @wopcm:	intel_wopcm structure
458c2ecf20Sopenharmony_ci *
468c2ecf20Sopenharmony_ci * Returns size of the WOPCM shadowed region.
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci * Returns:
498c2ecf20Sopenharmony_ci * 0 if GuC is not present or not in use.
508c2ecf20Sopenharmony_ci * Otherwise, the GuC WOPCM size.
518c2ecf20Sopenharmony_ci */
528c2ecf20Sopenharmony_cistatic inline u32 intel_wopcm_guc_size(struct intel_wopcm *wopcm)
538c2ecf20Sopenharmony_ci{
548c2ecf20Sopenharmony_ci	return wopcm->guc.size;
558c2ecf20Sopenharmony_ci}
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_civoid intel_wopcm_init_early(struct intel_wopcm *wopcm);
588c2ecf20Sopenharmony_civoid intel_wopcm_init(struct intel_wopcm *wopcm);
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif
61