prefetch_mod.h 1.7 KB
Newer Older
L
liqiang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright(c) 2019 Huawei Technologies Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 * Create: 2020-07-02
 * Author: Liqiang (liqiang9102@gitee)
 */
L
liqiang2020 已提交
16 17 18
#ifndef __PREFETCH_TUNING__
#define __PREFETCH_TUNING__

L
liqiang 已提交
19
enum {
L
liqiang 已提交
20
    DISABLE = 0,
L
liqiang 已提交
21 22 23
    ENABLE
};

L
liqiang 已提交
24
#define CACHE_READUNIQ_CTRL (1L << 40)
25 26 27 28 29 30
#define TB_L3T0_BASE		0x90180000
#define L3T_DYNAMIC_CTRL	0x400
#define TOTEM_OFFSET		0x8000000
#define REG_RANGE		0x5000
#define writel_reg(val, addr) (*(volatile unsigned int *)(addr) = (val))
#define readl_reg(addr) (*(volatile unsigned int*)(addr))
L
liqiang2020 已提交
31 32 33

#ifdef CONFIG_ARCH_HISI
typedef struct {
L
liqiang 已提交
34 35 36 37
    long cpuprefctrl_el1;
    long adps_lld_ddr_el1;
    long adpp_l1v_mop_el1;
    long adps_lld_l3_el1;
L
liqiang2020 已提交
38 39 40 41 42 43 44
} cfg_t;
#else
typedef long cfg_t;
#endif

extern void set_prefetch(void* dummy);
extern void get_prefetch(void* dummy);
L
liqiang 已提交
45 46
extern void read_unique_set(void *dummy);
extern void read_unique_get(void *dummy);
L
liqiang2020 已提交
47
extern void reset_prefetch(void* dummy);
48 49 50 51 52
extern void initial_cpu_info(void);
extern int iocapacity_limit_get(void *dummy);
extern void iocapacity_limit_set(void *dummy);
unsigned get_totem_num(void);
unsigned get_nr_skt(void);
L
liqiang2020 已提交
53

54
unsigned long get_skt_offset(void); 
L
liqiang2020 已提交
55 56 57 58
extern int prefetch_policy_num(void);
extern cfg_t *prefetch_policy(int policy);

#endif