123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- #ifndef _ADRENO_A6XX_H_
- #define _ADRENO_A6XX_H_
- #include <linux/delay.h>
- #include "a6xx_reg.h"
- #include "adreno_a6xx_gmu.h"
- #include "adreno_a6xx_rgmu.h"
- extern const struct adreno_power_ops a6xx_gmu_power_ops;
- extern const struct adreno_power_ops a6xx_rgmu_power_ops;
- extern const struct adreno_power_ops a630_gmu_power_ops;
- extern const struct adreno_power_ops a6xx_hwsched_power_ops;
- struct a6xx_gpudev {
- struct adreno_gpudev base;
- int (*hfi_probe)(struct adreno_device *adreno_dev);
- void (*hfi_remove)(struct adreno_device *adreno_dev);
- void (*handle_watchdog)(struct adreno_device *adreno_dev);
- };
- extern const struct a6xx_gpudev adreno_a630_gpudev;
- extern const struct a6xx_gpudev adreno_a6xx_gmu_gpudev;
- extern const struct a6xx_gpudev adreno_a6xx_hwsched_gpudev;
- struct a6xx_device {
-
- struct a6xx_gmu_device gmu;
-
- struct a6xx_rgmu_device rgmu;
-
- struct adreno_device adreno_dev;
- };
- struct adreno_a6xx_core {
-
- struct adreno_gpu_core base;
-
- u32 gmu_major;
-
- u32 gmu_minor;
-
- unsigned int prim_fifo_threshold;
-
- const char *sqefw_name;
-
- const char *gmufw_name;
-
- const char *zap_name;
-
- const struct kgsl_regmap_list *hwcg;
-
- u32 hwcg_count;
-
- const struct kgsl_regmap_list *vbif;
-
- u32 vbif_count;
-
- bool veto_fal10;
-
- bool pdc_in_aop;
-
- u32 hang_detect_cycles;
-
- const struct adreno_protected_regs *protected_regs;
-
- bool disable_tseskip;
-
- bool gx_cpr_toggle;
-
- u32 highest_bank_bit;
-
- u64 ctxt_record_size;
-
- u64 gmu_hub_clk_freq;
- };
- #define SPTPRAC_POWERON_CTRL_MASK 0x00778000
- #define SPTPRAC_POWEROFF_CTRL_MASK 0x00778001
- #define SPTPRAC_POWEROFF_STATUS_MASK BIT(2)
- #define SPTPRAC_POWERON_STATUS_MASK BIT(3)
- #define A6XX_RETAIN_FF_ENABLE_ENABLE_MASK BIT(11)
- #define CP_CLUSTER_FE 0x0
- #define CP_CLUSTER_SP_VS 0x1
- #define CP_CLUSTER_PC_VS 0x2
- #define CP_CLUSTER_GRAS 0x3
- #define CP_CLUSTER_SP_PS 0x4
- #define CP_CLUSTER_PS 0x5
- #define CP_CLUSTER_VPC_PS 0x6
- struct a6xx_cp_preemption_record {
- uint32_t magic;
- uint32_t info;
- uint32_t errno;
- uint32_t data;
- uint32_t cntl;
- uint32_t rptr;
- uint32_t wptr;
- uint32_t _pad28;
- uint64_t rptr_addr;
- uint64_t rbase;
- uint64_t counter;
- };
- struct a6xx_cp_smmu_info {
- uint32_t magic;
- uint32_t _pad4;
- uint64_t ttbr0;
- uint32_t asid;
- uint32_t context_idr;
- };
- #define A6XX_CP_SMMU_INFO_MAGIC_REF 0x241350D5UL
- #define A6XX_CP_CTXRECORD_MAGIC_REF 0xAE399D6EUL
- #define A6XX_CP_CTXRECORD_SIZE_IN_BYTES (2112 * 1024)
- #define A6XX_CP_CTXRECORD_USER_RESTORE_SIZE (192 * 1024)
- #define A6XX_CP_PERFCOUNTER_SAVE_RESTORE_SIZE (4 * 1024)
- #define A6XX_CP_RB_CNTL_DEFAULT (((ilog2(4) << 8) & 0x1F00) | \
- (ilog2(KGSL_RB_DWORDS >> 1) & 0x3F))
- #define A6XX_CP_INIT_DWORDS 11
- #define A6XX_INT_MASK \
- ((1 << A6XX_INT_CP_AHB_ERROR) | \
- (1 << A6XX_INT_ATB_ASYNCFIFO_OVERFLOW) | \
- (1 << A6XX_INT_RBBM_GPC_ERROR) | \
- (1 << A6XX_INT_CP_SW) | \
- (1 << A6XX_INT_CP_HW_ERROR) | \
- (1 << A6XX_INT_CP_IB2) | \
- (1 << A6XX_INT_CP_IB1) | \
- (1 << A6XX_INT_CP_RB) | \
- (1 << A6XX_INT_CP_CACHE_FLUSH_TS) | \
- (1 << A6XX_INT_RBBM_ATB_BUS_OVERFLOW) | \
- (1 << A6XX_INT_RBBM_HANG_DETECT) | \
- (1 << A6XX_INT_UCHE_OOB_ACCESS) | \
- (1 << A6XX_INT_UCHE_TRAP_INTR) | \
- (1 << A6XX_INT_TSB_WRITE_ERROR))
- #define A6XX_HWSCHED_INT_MASK \
- ((1 << A6XX_INT_CP_AHB_ERROR) | \
- (1 << A6XX_INT_ATB_ASYNCFIFO_OVERFLOW) | \
- (1 << A6XX_INT_RBBM_ATB_BUS_OVERFLOW) | \
- (1 << A6XX_INT_UCHE_OOB_ACCESS) | \
- (1 << A6XX_INT_UCHE_TRAP_INTR) | \
- (1 << A6XX_INT_TSB_WRITE_ERROR))
- static inline const struct adreno_a6xx_core *
- to_a6xx_core(struct adreno_device *adreno_dev)
- {
- const struct adreno_gpu_core *core = adreno_dev->gpucore;
- return container_of(core, struct adreno_a6xx_core, base);
- }
- void a6xx_preemption_trigger(struct adreno_device *adreno_dev, bool atomic);
- void a6xx_preemption_schedule(struct adreno_device *adreno_dev);
- void a6xx_preemption_start(struct adreno_device *adreno_dev);
- int a6xx_preemption_init(struct adreno_device *adreno_dev);
- u32 a6xx_preemption_post_ibsubmit(struct adreno_device *adreno_dev, u32 *cmds);
- u32 a6xx_preemption_pre_ibsubmit(struct adreno_device *adreno_dev,
- struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
- u32 *cmds);
- unsigned int a6xx_set_marker(unsigned int *cmds,
- enum adreno_cp_marker_type type);
- void a6xx_preemption_callback(struct adreno_device *adreno_dev, int bit);
- int a6xx_preemption_context_init(struct kgsl_context *context);
- void a6xx_preemption_context_destroy(struct kgsl_context *context);
- void a6xx_snapshot(struct adreno_device *adreno_dev,
- struct kgsl_snapshot *snapshot);
- void a6xx_crashdump_init(struct adreno_device *adreno_dev);
- int a6xx_gmu_sptprac_enable(struct adreno_device *adreno_dev);
- void a6xx_gmu_sptprac_disable(struct adreno_device *adreno_dev);
- bool a6xx_gmu_sptprac_is_on(struct adreno_device *adreno_dev);
- bool a619_holi_gx_is_on(struct adreno_device *adreno_dev);
- u64 a6xx_read_alwayson(struct adreno_device *adreno_dev);
- void a6xx_start(struct adreno_device *adreno_dev);
- int a6xx_init(struct adreno_device *adreno_dev);
- int a6xx_rb_start(struct adreno_device *adreno_dev);
- int a6xx_microcode_read(struct adreno_device *adreno_dev);
- int a6xx_probe_common(struct platform_device *pdev,
- struct adreno_device *adreno_dev, u32 chipid,
- const struct adreno_gpu_core *gpucore);
- bool a6xx_hw_isidle(struct adreno_device *adreno_dev);
- void a6xx_spin_idle_debug(struct adreno_device *adreno_dev,
- const char *str);
- int a6xx_perfcounter_update(struct adreno_device *adreno_dev,
- struct adreno_perfcount_register *reg, bool update_reg);
- int a6xx_ringbuffer_init(struct adreno_device *adreno_dev);
- extern const struct adreno_perfcounters adreno_a630_perfcounters;
- extern const struct adreno_perfcounters adreno_a6xx_perfcounters;
- extern const struct adreno_perfcounters adreno_a6xx_legacy_perfcounters;
- extern const struct adreno_perfcounters adreno_a6xx_hwsched_perfcounters;
- void a6xx_rdpm_mx_freq_update(struct a6xx_gmu_device *gmu, u32 freq);
- void a6xx_rdpm_cx_freq_update(struct a6xx_gmu_device *gmu, u32 freq);
- int a6xx_ringbuffer_addcmds(struct adreno_device *adreno_dev,
- struct adreno_ringbuffer *rb, struct adreno_context *drawctxt,
- u32 flags, u32 *in, u32 dwords, u32 timestamp,
- struct adreno_submit_time *time);
- int a6xx_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
- struct kgsl_drawobj_cmd *cmdobj, u32 flags,
- struct adreno_submit_time *time);
- int a6xx_fenced_write(struct adreno_device *adreno_dev, u32 offset,
- u32 value, u32 mask);
- int a6xx_ringbuffer_submit(struct adreno_ringbuffer *rb,
- struct adreno_submit_time *time, bool sync);
- void a6xx_cp_init_cmds(struct adreno_device *adreno_dev, u32 *cmds);
- int a6xx_gmu_hfi_probe(struct adreno_device *adreno_dev);
- static inline const struct a6xx_gpudev *
- to_a6xx_gpudev(const struct adreno_gpudev *gpudev)
- {
- return container_of(gpudev, struct a6xx_gpudev, base);
- }
- void a6xx_reset_preempt_records(struct adreno_device *adreno_dev);
- bool a6xx_irq_pending(struct adreno_device *adreno_dev);
- #ifdef CONFIG_QCOM_KGSL_CORESIGHT
- void a6xx_coresight_init(struct adreno_device *device);
- #else
- static inline void a6xx_coresight_init(struct adreno_device *device) { }
- #endif
- #endif
|