linux/drivers/soc/qcom/llcc-qcom.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 */

#include <linux/bitfield.h>
#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/soc/qcom/llcc-qcom.h>

#define ACTIVATE
#define DEACTIVATE
#define ACT_CLEAR
#define ACT_COMPLETE
#define ACT_CTRL_OPCODE_ACTIVATE
#define ACT_CTRL_OPCODE_DEACTIVATE
#define ACT_CTRL_ACT_TRIG
#define ACT_CTRL_OPCODE_SHIFT
#define ATTR1_PROBE_TARGET_WAYS_SHIFT
#define ATTR1_FIXED_SIZE_SHIFT
#define ATTR1_PRIORITY_SHIFT
#define ATTR1_MAX_CAP_SHIFT
#define ATTR0_RES_WAYS_MASK
#define ATTR0_BONUS_WAYS_MASK
#define ATTR0_BONUS_WAYS_SHIFT
#define LLCC_STATUS_READ_DELAY

#define CACHE_LINE_SIZE_SHIFT

#define LLCC_LB_CNT_MASK
#define LLCC_LB_CNT_SHIFT

#define MAX_CAP_TO_BYTES(n)
#define LLCC_TRP_ACT_CTRLn(n)
#define LLCC_TRP_ACT_CLEARn(n)
#define LLCC_TRP_STATUSn(n)
#define LLCC_TRP_ATTR0_CFGn(n)
#define LLCC_TRP_ATTR1_CFGn(n)
#define LLCC_TRP_ATTR2_CFGn(n)

#define LLCC_TRP_SCID_DIS_CAP_ALLOC
#define LLCC_TRP_PCB_ACT
#define LLCC_TRP_ALGO_CFG1
#define LLCC_TRP_ALGO_CFG2
#define LLCC_TRP_ALGO_CFG3
#define LLCC_TRP_ALGO_CFG4
#define LLCC_TRP_ALGO_CFG5
#define LLCC_TRP_WRSC_EN
#define LLCC_TRP_ALGO_CFG6
#define LLCC_TRP_ALGO_CFG7
#define LLCC_TRP_WRSC_CACHEABLE_EN
#define LLCC_TRP_ALGO_CFG8

#define LLCC_VERSION_2_0_0_0
#define LLCC_VERSION_2_1_0_0
#define LLCC_VERSION_4_1_0_0

/**
 * struct llcc_slice_config - Data associated with the llcc slice
 * @usecase_id: Unique id for the client's use case
 * @slice_id: llcc slice id for each client
 * @max_cap: The maximum capacity of the cache slice provided in KB
 * @priority: Priority of the client used to select victim line for replacement
 * @fixed_size: Boolean indicating if the slice has a fixed capacity
 * @bonus_ways: Bonus ways are additional ways to be used for any slice,
 *		if client ends up using more than reserved cache ways. Bonus
 *		ways are allocated only if they are not reserved for some
 *		other client.
 * @res_ways: Reserved ways for the cache slice, the reserved ways cannot
 *		be used by any other client than the one its assigned to.
 * @cache_mode: Each slice operates as a cache, this controls the mode of the
 *             slice: normal or TCM(Tightly Coupled Memory)
 * @probe_target_ways: Determines what ways to probe for access hit. When
 *                    configured to 1 only bonus and reserved ways are probed.
 *                    When configured to 0 all ways in llcc are probed.
 * @dis_cap_alloc: Disable capacity based allocation for a client
 * @retain_on_pc: If this bit is set and client has maintained active vote
 *               then the ways assigned to this client are not flushed on power
 *               collapse.
 * @activate_on_init: Activate the slice immediately after it is programmed
 * @write_scid_en: Bit enables write cache support for a given scid.
 * @write_scid_cacheable_en: Enables write cache cacheable support for a
 *			     given scid (not supported on v2 or older hardware).
 * @stale_en: Bit enables stale.
 * @stale_cap_en: Bit enables stale only if current scid is over-cap.
 * @mru_uncap_en: Roll-over on reserved cache ways if current scid is
 *                under-cap.
 * @mru_rollover: Roll-over on reserved cache ways.
 * @alloc_oneway_en: Allways allocate one way on over-cap even if there's no
 *                   same-scid lines for replacement.
 * @ovcap_en: Once current scid is over-capacity, allocate other over-cap SCID.
 * @ovcap_prio: Once current scid is over-capacity, allocate other low priority
 *              over-cap scid. Depends on corresponding bit being set in
 *              ovcap_en.
 * @vict_prio: When current scid is under-capacity, allocate over other
 *             lower-than victim priority-line threshold scid.
 */
struct llcc_slice_config {};

struct qcom_llcc_config {};

struct qcom_sct_config {};

enum llcc_reg_offset {};

static const struct llcc_slice_config sa8775p_data[] =;

static const struct llcc_slice_config sc7180_data[] =;

static const struct llcc_slice_config sc7280_data[] =;

static const struct llcc_slice_config sc8180x_data[] =;

static const struct llcc_slice_config sc8280xp_data[] =;

static const struct llcc_slice_config sdm845_data[] =;

static const struct llcc_slice_config sm6350_data[] =;

static const struct llcc_slice_config sm7150_data[] =;

static const struct llcc_slice_config sm8150_data[] =;

static const struct llcc_slice_config sm8250_data[] =;

static const struct llcc_slice_config sm8350_data[] =;

static const struct llcc_slice_config sm8450_data[] =;

static const struct llcc_slice_config sm8550_data[] =;

static const struct llcc_slice_config sm8650_data[] =;

static const struct llcc_slice_config qdu1000_data_2ch[] =;

static const struct llcc_slice_config qdu1000_data_4ch[] =;

static const struct llcc_slice_config qdu1000_data_8ch[] =;

static const struct llcc_slice_config x1e80100_data[] =;

static const struct llcc_edac_reg_offset llcc_v1_edac_reg_offset =;

static const struct llcc_edac_reg_offset llcc_v2_1_edac_reg_offset =;

/* LLCC register offset starting from v1.0.0 */
static const u32 llcc_v1_reg_offset[] =;

/* LLCC register offset starting from v2.0.1 */
static const u32 llcc_v2_1_reg_offset[] =;

static const struct qcom_llcc_config qdu1000_cfg[] =;

static const struct qcom_llcc_config sa8775p_cfg[] =;

static const struct qcom_llcc_config sc7180_cfg[] =;

static const struct qcom_llcc_config sc7280_cfg[] =;

static const struct qcom_llcc_config sc8180x_cfg[] =;

static const struct qcom_llcc_config sc8280xp_cfg[] =;

static const struct qcom_llcc_config sdm845_cfg[] =;

static const struct qcom_llcc_config sm6350_cfg[] =;

static const struct qcom_llcc_config sm7150_cfg[] =;

static const struct qcom_llcc_config sm8150_cfg[] =;

static const struct qcom_llcc_config sm8250_cfg[] =;

static const struct qcom_llcc_config sm8350_cfg[] =;

static const struct qcom_llcc_config sm8450_cfg[] =;

static const struct qcom_llcc_config sm8550_cfg[] =;

static const struct qcom_llcc_config sm8650_cfg[] =;

static const struct qcom_llcc_config x1e80100_cfg[] =;

static const struct qcom_sct_config qdu1000_cfgs =;

static const struct qcom_sct_config sa8775p_cfgs =;

static const struct qcom_sct_config sc7180_cfgs =;

static const struct qcom_sct_config sc7280_cfgs =;

static const struct qcom_sct_config sc8180x_cfgs =;

static const struct qcom_sct_config sc8280xp_cfgs =;

static const struct qcom_sct_config sdm845_cfgs =;

static const struct qcom_sct_config sm6350_cfgs =;

static const struct qcom_sct_config sm7150_cfgs =;

static const struct qcom_sct_config sm8150_cfgs =;

static const struct qcom_sct_config sm8250_cfgs =;

static const struct qcom_sct_config sm8350_cfgs =;

static const struct qcom_sct_config sm8450_cfgs =;

static const struct qcom_sct_config sm8550_cfgs =;

static const struct qcom_sct_config sm8650_cfgs =;

static const struct qcom_sct_config x1e80100_cfgs =;

static struct llcc_drv_data *drv_data =;

/**
 * llcc_slice_getd - get llcc slice descriptor
 * @uid: usecase_id for the client
 *
 * A pointer to llcc slice descriptor will be returned on success
 * and error pointer is returned on failure
 */
struct llcc_slice_desc *llcc_slice_getd(u32 uid)
{}
EXPORT_SYMBOL_GPL();

/**
 * llcc_slice_putd - llcc slice descriptor
 * @desc: Pointer to llcc slice descriptor
 */
void llcc_slice_putd(struct llcc_slice_desc *desc)
{}
EXPORT_SYMBOL_GPL();

static int llcc_update_act_ctrl(u32 sid,
				u32 act_ctrl_reg_val, u32 status)
{}

/**
 * llcc_slice_activate - Activate the llcc slice
 * @desc: Pointer to llcc slice descriptor
 *
 * A value of zero will be returned on success and a negative errno will
 * be returned in error cases
 */
int llcc_slice_activate(struct llcc_slice_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * llcc_slice_deactivate - Deactivate the llcc slice
 * @desc: Pointer to llcc slice descriptor
 *
 * A value of zero will be returned on success and a negative errno will
 * be returned in error cases
 */
int llcc_slice_deactivate(struct llcc_slice_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * llcc_get_slice_id - return the slice id
 * @desc: Pointer to llcc slice descriptor
 */
int llcc_get_slice_id(struct llcc_slice_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * llcc_get_slice_size - return the slice id
 * @desc: Pointer to llcc slice descriptor
 */
size_t llcc_get_slice_size(struct llcc_slice_desc *desc)
{}
EXPORT_SYMBOL_GPL();

static int _qcom_llcc_cfg_program(const struct llcc_slice_config *config,
				  const struct qcom_llcc_config *cfg)
{}

static int qcom_llcc_cfg_program(struct platform_device *pdev,
				 const struct qcom_llcc_config *cfg)
{}

static int qcom_llcc_get_cfg_index(struct platform_device *pdev, u8 *cfg_index, int num_config)
{}

static void qcom_llcc_remove(struct platform_device *pdev)
{}

static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev, u8 index,
					  const char *name)
{}

static int qcom_llcc_probe(struct platform_device *pdev)
{}

static const struct of_device_id qcom_llcc_of_match[] =;
MODULE_DEVICE_TABLE(of, qcom_llcc_of_match);

static struct platform_driver qcom_llcc_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();