
Based on targets, in case of device crash, in place of complete memory dump, mini dump can be extracted. This commit adds changes in context utils for NRT devices and in ICP, JPEG drivers. CRs-Fixed: 2993116 Change-Id: I7c4af2cdf44713f741d3d772316080124e8a9a7f Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
188 linhas
4.8 KiB
C
188 linhas
4.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#ifndef _HFI_INTF_H_
|
|
#define _HFI_INTF_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define HFI_CMD_Q_MINI_DUMP_SIZE_IN_BYTES 4096
|
|
#define HFI_MSG_Q_MINI_DUMP_SIZE_IN_BYTES 4096
|
|
|
|
/**
|
|
* struct hfi_mem
|
|
* @len: length of memory
|
|
* @kva: kernel virtual address
|
|
* @iova: IO virtual address
|
|
* @reserved: reserved field
|
|
*/
|
|
struct hfi_mem {
|
|
uint64_t len;
|
|
uintptr_t kva;
|
|
uint32_t iova;
|
|
uint32_t reserved;
|
|
};
|
|
|
|
/**
|
|
* struct hfi_mem_info
|
|
* @qtbl: qtable hfi memory
|
|
* @cmd_q: command queue hfi memory for host to firmware communication
|
|
* @msg_q: message queue hfi memory for firmware to host communication
|
|
* @dbg_q: debug queue hfi memory for firmware debug information
|
|
* @sfr_buf: buffer for subsystem failure reason[SFR]
|
|
* @sec_heap: secondary heap hfi memory for firmware
|
|
* @qdss: qdss mapped memory for fw
|
|
* @io_mem: io memory info
|
|
* @io_mem2: 2nd io memory info
|
|
* @fw_uncached: FW uncached region info
|
|
*/
|
|
struct hfi_mem_info {
|
|
struct hfi_mem qtbl;
|
|
struct hfi_mem cmd_q;
|
|
struct hfi_mem msg_q;
|
|
struct hfi_mem dbg_q;
|
|
struct hfi_mem sfr_buf;
|
|
struct hfi_mem sec_heap;
|
|
struct hfi_mem shmem;
|
|
struct hfi_mem qdss;
|
|
struct hfi_mem io_mem;
|
|
struct hfi_mem io_mem2;
|
|
struct hfi_mem fw_uncached;
|
|
};
|
|
|
|
/**
|
|
* struct hfi_ops
|
|
* @irq_raise: called to raise H2ICP interrupt
|
|
* @irq_enable: called to enable interrupts from ICP
|
|
* @iface_addr: called to get interface registers base address
|
|
*/
|
|
struct hfi_ops {
|
|
void (*irq_raise)(void *data);
|
|
void (*irq_enable)(void *data);
|
|
void __iomem *(*iface_addr)(void *data);
|
|
};
|
|
|
|
/**
|
|
* struct hfi_mini_dump_info
|
|
* @cmd_q: cmd queue
|
|
* @msg_q: msg queue
|
|
* @msg_q_state: msg queue state
|
|
* @cmd_q_state: cmd queue state
|
|
*/
|
|
struct hfi_mini_dump_info {
|
|
uint32_t cmd_q[HFI_CMD_Q_MINI_DUMP_SIZE_IN_BYTES];
|
|
uint32_t msg_q[HFI_MSG_Q_MINI_DUMP_SIZE_IN_BYTES];
|
|
bool msg_q_state;
|
|
bool cmd_q_state;
|
|
};
|
|
/**
|
|
* hfi_write_cmd() - function for hfi write
|
|
* @cmd_ptr: pointer to command data for hfi write
|
|
*
|
|
* Returns success(zero)/failure(non zero)
|
|
*/
|
|
int hfi_write_cmd(void *cmd_ptr);
|
|
|
|
/**
|
|
* hfi_read_message() - function for hfi read
|
|
* @pmsg: buffer to place read message for hfi queue
|
|
* @q_id: queue id
|
|
* @words_read: total number of words read from the queue
|
|
* returned as output to the caller
|
|
*
|
|
* Returns success(zero)/failure(non zero)
|
|
*/
|
|
int hfi_read_message(uint32_t *pmsg, uint8_t q_id, uint32_t *words_read);
|
|
|
|
/**
|
|
* hfi_init() - function initialize hfi after firmware download
|
|
* @hfi_mem: hfi memory info
|
|
* @hfi_ops: processor-specific hfi ops
|
|
* @priv: device private data
|
|
* @event_driven_mode: event mode
|
|
*
|
|
* Returns success(zero)/failure(non zero)
|
|
*/
|
|
int cam_hfi_init(struct hfi_mem_info *hfi_mem, const struct hfi_ops *hfi_ops,
|
|
void *priv, uint8_t event_driven_mode);
|
|
|
|
/**
|
|
* hfi_get_hw_caps() - hardware capabilities from firmware
|
|
* @query_caps: holds query information from hfi
|
|
*
|
|
* Returns success(zero)/failure(non zero)
|
|
*/
|
|
int hfi_get_hw_caps(void *query_caps);
|
|
|
|
/**
|
|
* hfi_send_system_cmd() - send hfi system command to firmware
|
|
* @type: type of system command
|
|
* @data: command data
|
|
* @size: size of command data
|
|
*/
|
|
void hfi_send_system_cmd(uint32_t type, uint64_t data, uint32_t size);
|
|
|
|
/**
|
|
* cam_hfi_deinit() - cleanup HFI
|
|
*/
|
|
void cam_hfi_deinit(void);
|
|
/**
|
|
* hfi_set_debug_level() - set debug level
|
|
* @icp_dbg_type: 1 for debug_q & 2 for qdss
|
|
* @lvl: FW debug message level
|
|
*/
|
|
int hfi_set_debug_level(u64 icp_dbg_type, uint32_t lvl);
|
|
|
|
/**
|
|
* hfi_set_fw_dump_level() - set firmware dump level
|
|
* @lvl: level of firmware dump level
|
|
*/
|
|
int hfi_set_fw_dump_level(uint32_t lvl);
|
|
|
|
/**
|
|
* hfi_enable_ipe_bps_pc() - Enable interframe pc
|
|
* Host sends a command to firmware to enable interframe
|
|
* power collapse for IPE and BPS hardware.
|
|
*
|
|
* @enable: flag to enable/disable
|
|
* @core_info: Core information to firmware
|
|
*/
|
|
int hfi_enable_ipe_bps_pc(bool enable, uint32_t core_info);
|
|
|
|
/**
|
|
* hfi_cmd_ubwc_config_ext() - UBWC configuration to firmware
|
|
* @ubwc_ipe_cfg: UBWC ipe fetch/write configuration params
|
|
* @ubwc_bps_cfg: UBWC bps fetch/write configuration params
|
|
*/
|
|
int hfi_cmd_ubwc_config_ext(uint32_t *ubwc_ipe_cfg,
|
|
uint32_t *ubwc_bps_cfg);
|
|
|
|
/**
|
|
* hfi_cmd_ubwc_config() - UBWC configuration to firmware
|
|
* for older targets
|
|
* @ubwc_cfg: UBWC configuration parameters
|
|
*/
|
|
int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg);
|
|
|
|
/**
|
|
* cam_hfi_resume() - function to resume
|
|
* @hfi_mem: hfi memory info
|
|
*
|
|
* Returns success(zero)/failure(non zero)
|
|
*/
|
|
int cam_hfi_resume(struct hfi_mem_info *hfi_mem);
|
|
|
|
/**
|
|
* cam_hfi_queue_dump() - utility function to dump hfi queues
|
|
*/
|
|
void cam_hfi_queue_dump(void);
|
|
|
|
/**
|
|
* cam_hfi_mini_dump() - utility function for mini dump
|
|
*/
|
|
void cam_hfi_mini_dump(struct hfi_mini_dump_info *dst);
|
|
|
|
#endif /* _HFI_INTF_H_ */
|