162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2008-2009 ST-Ericsson AB
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Author: Rickard Andersson <rickard.andersson@stericsson.com>
762306a36Sopenharmony_ci * Author: Linus Walleij <linus.walleij@stericsson.com>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifndef __ASMARM_TCM_H
1062306a36Sopenharmony_ci#define __ASMARM_TCM_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifdef CONFIG_HAVE_TCM
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <linux/compiler.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Tag variables with this */
1762306a36Sopenharmony_ci#define __tcmdata __section(".tcm.data")
1862306a36Sopenharmony_ci/* Tag constants with this */
1962306a36Sopenharmony_ci#define __tcmconst __section(".tcm.rodata")
2062306a36Sopenharmony_ci/* Tag functions inside TCM called from outside TCM with this */
2162306a36Sopenharmony_ci#define __tcmfunc __attribute__((long_call)) __section(".tcm.text") noinline
2262306a36Sopenharmony_ci/* Tag function inside TCM called from inside TCM  with this */
2362306a36Sopenharmony_ci#define __tcmlocalfunc __section(".tcm.text")
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_civoid *tcm_alloc(size_t len);
2662306a36Sopenharmony_civoid tcm_free(void *addr, size_t len);
2762306a36Sopenharmony_cibool tcm_dtcm_present(void);
2862306a36Sopenharmony_cibool tcm_itcm_present(void);
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_civoid __init tcm_init(void);
3162306a36Sopenharmony_ci#else
3262306a36Sopenharmony_ci/* No TCM support, just blank inlines to be optimized out */
3362306a36Sopenharmony_cistatic inline void tcm_init(void)
3462306a36Sopenharmony_ci{
3562306a36Sopenharmony_ci}
3662306a36Sopenharmony_ci#endif
3762306a36Sopenharmony_ci#endif
38