You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.9 KiB
107 lines
2.9 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2016-2020. All rights reserved.
|
|
* Description: kapi header
|
|
* Author: BSP software
|
|
* Create: 2020-4-14
|
|
*/
|
|
|
|
#ifndef EXTUAPIH
|
|
#define EXTUAPIH
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct pcie_alloc_ctrl_t {
|
|
struct gen_pool *pool;
|
|
char *viraddr; /* virtual address */
|
|
phys_addr_t phyaddr; /* phy address */
|
|
size_t size;
|
|
};
|
|
|
|
#define HLKAPI_GET_RAM_SIZE 1
|
|
#define HLKAPI_GET_CMA_SIZE 2
|
|
#define HLKAPI_GET_MMZ_SIZE 3
|
|
/**
|
|
* get memory size information, such CMA size, RAM size.
|
|
*
|
|
* param:
|
|
* size specify size,
|
|
* flags what size you want get.
|
|
* HLKAPI_GET_RAM_SIZE - get ram size, unit is 1M
|
|
* HLKAPI_GET_CMA_SIZE - get cma size, unit is 1M
|
|
* HLKAPI_GET_MMZ_SIZE - get mmz size, unit is 1M
|
|
* retval:
|
|
* 0 success
|
|
* other fail.
|
|
*/
|
|
int get_mem_size(unsigned int *size, int flags);
|
|
|
|
/*
|
|
* get ddr size/start, unit is bytes
|
|
*/
|
|
unsigned long get_dram_size(void);
|
|
unsigned long get_dram_start(void);
|
|
|
|
/* reference man semctl */
|
|
long os_semctl(int semid, int semnum, int cmd, unsigned long arg);
|
|
|
|
/* reference man semget */
|
|
long os_semget(key_t key, int nsems, int semflg);
|
|
|
|
/* return sdk version to kernel */
|
|
const char *get_sdkversion(void);
|
|
|
|
/* ARBITRARY: SRAM allocations are multiples of this 2^N size */
|
|
#define SRAM_GRANULARITY 512
|
|
|
|
#ifdef CONFIG_SUPPORT_SRAM_MANAGER
|
|
void *sram_alloc(size_t len, dma_addr_t *dma);
|
|
void sram_free(void *addr, size_t len);
|
|
int sram_suspend(void);
|
|
void sram_resume(void);
|
|
#else
|
|
# define sram_alloc(_len, _dma) NULL
|
|
# define sram_free(_addr, _len)
|
|
# define sram_suspend() do { } while (0)
|
|
# define sram_resume() do { } while (0)
|
|
#endif
|
|
|
|
#ifdef CONFIG_HPCIE
|
|
void *pice_read_alloc(size_t len, dma_addr_t *dma, bool pcie0);
|
|
void pice_read_free(void *vaddr, size_t len, bool pcie0);
|
|
void *pice_write_alloc(size_t len, dma_addr_t *dma, bool pcie0);
|
|
void pice_write_free(void *vaddr, size_t len, bool pcie0);
|
|
#else
|
|
# define pice_read_alloc(_len, _dma, _pcie0) NULL
|
|
# define pice_read_free(_addr, _len, _pcie0) NULL
|
|
# define pice_write_alloc(_len, _dma, _pcie0) NULL
|
|
# define pice_write_free(_addr, _len, _pcie0) NULL
|
|
#endif
|
|
|
|
/*
|
|
* name param name
|
|
* buf param buffer pointer;
|
|
* buflen param length;
|
|
*
|
|
* return -1: not found this param;
|
|
* -2: input parameter bad;
|
|
* other: parameter real length;
|
|
*/
|
|
int get_param_data(const char *name, char *buf, unsigned int buflen);
|
|
int set_param_data(const char *name, char *buf, unsigned int buflen);
|
|
|
|
char *ultohstr(u64 size, char *str, int len);
|
|
|
|
int pdm_free_reserve_mem(u32 phyaddr, u32 size);
|
|
|
|
/* Convert phys io address to virt address */
|
|
void __iomem *io_address(unsigned long phys_addr);
|
|
|
|
int is_tee(void);
|
|
int scpu_enabled(void);
|
|
/******************************************************************************/
|
|
|
|
#include <linux/huanglong/utils/cputable.h>
|
|
|
|
|
|
#endif /* EXTUAPIH */
|