src/dpdk/drivers/net/qede/qede_debug.c
static u32 qed_grc_dump_static_debug(struct ecore_hwfn *p_hwfn,
				     struct ecore_ptt *p_ptt,
				     u32 *dump_buf, bool dump)
{
	struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
	u32 block_id, line_id, offset = 0, addr, len;

	/* Don't dump static debug if a debug bus recording is in progress */
	if (dump && ecore_rd(p_hwfn, p_ptt, DBG_REG_DBG_BLOCK_ON))
		return 0;

	if (dump) {
		/* Disable debug bus in all blocks */
		qed_bus_disable_blocks(p_hwfn, p_ptt);

		qed_bus_reset_dbg_block(p_hwfn, p_ptt);
		ecore_wr(p_hwfn,
		       p_ptt, DBG_REG_FRAMING_MODE, DBG_BUS_FRAME_MODE_8HW);
		ecore_wr(p_hwfn,
		       p_ptt, DBG_REG_DEBUG_TARGET, DBG_BUS_TARGET_ID_INT_BUF);
		ecore_wr(p_hwfn, p_ptt, DBG_REG_FULL_MODE, 1);
		qed_bus_enable_dbg_block(p_hwfn, p_ptt, true);
	}

	/* Dump all static debug lines for each relevant block */
	for (block_id = 0; block_id < MAX_BLOCK_ID; block_id++) {
		const struct dbg_block_chip *block_per_chip;
		const struct dbg_block *block;
		bool is_removed, has_dbg_bus;
		u16 modes_buf_offset;
		u32 block_dwords;

		block_per_chip =
		    qed_get_dbg_block_per_chip(p_hwfn, (enum block_id)block_id);
		is_removed = GET_FIELD(block_per_chip->flags,
				       DBG_BLOCK_CHIP_IS_REMOVED);
		has_dbg_bus = GET_FIELD(block_per_chip->flags,
					DBG_BLOCK_CHIP_HAS_DBG_BUS);

		/* read+clear for NWS parity is not working, skip NWS block */
		if (block_id == BLOCK_NWS)
			continue;

		if (!is_removed && has_dbg_bus &&
		    GET_FIELD(block_per_chip->dbg_bus_mode.data,
			      DBG_MODE_HDR_EVAL_MODE) > 0) {
			modes_buf_offset =
			    GET_FIELD(block_per_chip->dbg_bus_mode.data,
				      DBG_MODE_HDR_MODES_BUF_OFFSET);
			if (!qed_is_mode_match(p_hwfn, &modes_buf_offset))
				has_dbg_bus = false;
		}

		if (is_removed || !has_dbg_bus)
			continue;

		block_dwords = NUM_DBG_LINES(block_per_chip) *
			       STATIC_DEBUG_LINE_DWORDS;

		/* Dump static section params */
		block = get_dbg_block(p_hwfn, (enum block_id)block_id);
		offset += qed_grc_dump_mem_hdr(p_hwfn,
					       dump_buf + offset,
					       dump,
					       (const char *)block->name,
					       0,
					       block_dwords,
					       32, false, "STATIC", 0);

		if (!dump) {
			offset += block_dwords;
			continue;
		}

		/* If all lines are invalid - dump zeros */
		if (dev_data->block_in_reset[block_id]) {
			memset(dump_buf + offset, 0,
			       DWORDS_TO_BYTES(block_dwords));
			offset += block_dwords;
			continue;
		}

		/* Enable block's client */
		qed_bus_enable_clients(p_hwfn,
				       p_ptt,
				       OSAL_BIT(block_per_chip->dbg_client_id));

		addr = BYTES_TO_DWORDS(DBG_REG_CALENDAR_OUT_DATA);
		len = STATIC_DEBUG_LINE_DWORDS;
		for (line_id = 0; line_id < (u32)NUM_DBG_LINES(block_per_chip);
		     line_id++) {
			/* Configure debug line ID */
			qed_bus_config_dbg_line(p_hwfn,
						p_ptt,
						(enum block_id)block_id,
						(u8)line_id, 0xf, 0, 0, 0);

			/* Read debug line info */
			offset += qed_grc_dump_addr_range(p_hwfn,
							  p_ptt,
							  dump_buf + offset,
							  dump,
							  addr,
							  len,
							  true, SPLIT_TYPE_NONE,
							  0);
		}

		/* Disable block's client and debug output */
		qed_bus_enable_clients(p_hwfn, p_ptt, 0);
		qed_bus_config_dbg_line(p_hwfn, p_ptt,
					(enum block_id)block_id, 0, 0, 0, 0, 0);
	}

	if (dump) {
		qed_bus_enable_dbg_block(p_hwfn, p_ptt, false);
		qed_bus_enable_clients(p_hwfn, p_ptt, 0);
	}

	return offset;
}
/* Dumps Static Debug data. Returns the dumped size in dwords. */
Dumps Static Debug data. Returns the dumped size in dwords.
Dumps Static Debug data . Returns the dumped size in dwords .
static u32 qed_grc_dump_static_debug(struct ecore_hwfn *p_hwfn,
				     struct ecore_ptt *p_ptt,
				     u32 *dump_buf, bool dump)
{
	struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
	u32 block_id, line_id, offset = 0, addr, len;
	if (dump && ecore_rd(p_hwfn, p_ptt, DBG_REG_DBG_BLOCK_ON))
		return 0;
	if (dump) {
		qed_bus_disable_blocks(p_hwfn, p_ptt);
		qed_bus_reset_dbg_block(p_hwfn, p_ptt);
		ecore_wr(p_hwfn,
		       p_ptt, DBG_REG_FRAMING_MODE, DBG_BUS_FRAME_MODE_8HW);
		ecore_wr(p_hwfn,
		       p_ptt, DBG_REG_DEBUG_TARGET, DBG_BUS_TARGET_ID_INT_BUF);
		ecore_wr(p_hwfn, p_ptt, DBG_REG_FULL_MODE, 1);
		qed_bus_enable_dbg_block(p_hwfn, p_ptt, true);
	}
	for (block_id = 0; block_id < MAX_BLOCK_ID; block_id++) {
		const struct dbg_block_chip *block_per_chip;
		const struct dbg_block *block;
		bool is_removed, has_dbg_bus;
		u16 modes_buf_offset;
		u32 block_dwords;
		block_per_chip =
		    qed_get_dbg_block_per_chip(p_hwfn, (enum block_id)block_id);
		is_removed = GET_FIELD(block_per_chip->flags,
				       DBG_BLOCK_CHIP_IS_REMOVED);
		has_dbg_bus = GET_FIELD(block_per_chip->flags,
					DBG_BLOCK_CHIP_HAS_DBG_BUS);
		if (block_id == BLOCK_NWS)
			continue;
		if (!is_removed && has_dbg_bus &&
		    GET_FIELD(block_per_chip->dbg_bus_mode.data,
			      DBG_MODE_HDR_EVAL_MODE) > 0) {
			modes_buf_offset =
			    GET_FIELD(block_per_chip->dbg_bus_mode.data,
				      DBG_MODE_HDR_MODES_BUF_OFFSET);
			if (!qed_is_mode_match(p_hwfn, &modes_buf_offset))
				has_dbg_bus = false;
		}
		if (is_removed || !has_dbg_bus)
			continue;
		block_dwords = NUM_DBG_LINES(block_per_chip) *
			       STATIC_DEBUG_LINE_DWORDS;
		block = get_dbg_block(p_hwfn, (enum block_id)block_id);
		offset += qed_grc_dump_mem_hdr(p_hwfn,
					       dump_buf + offset,
					       dump,
					       (const char *)block->name,
					       0,
					       block_dwords,
					       32, false, "STATIC", 0);
		if (!dump) {
			offset += block_dwords;
			continue;
		}
		if (dev_data->block_in_reset[block_id]) {
			memset(dump_buf + offset, 0,
			       DWORDS_TO_BYTES(block_dwords));
			offset += block_dwords;
			continue;
		}
		qed_bus_enable_clients(p_hwfn,
				       p_ptt,
				       OSAL_BIT(block_per_chip->dbg_client_id));
		addr = BYTES_TO_DWORDS(DBG_REG_CALENDAR_OUT_DATA);
		len = STATIC_DEBUG_LINE_DWORDS;
		for (line_id = 0; line_id < (u32)NUM_DBG_LINES(block_per_chip);
		     line_id++) {
			qed_bus_config_dbg_line(p_hwfn,
						p_ptt,
						(enum block_id)block_id,
						(u8)line_id, 0xf, 0, 0, 0);
			offset += qed_grc_dump_addr_range(p_hwfn,
							  p_ptt,
							  dump_buf + offset,
							  dump,
							  addr,
							  len,
							  true, SPLIT_TYPE_NONE,
							  0);
		}
		qed_bus_enable_clients(p_hwfn, p_ptt, 0);
		qed_bus_config_dbg_line(p_hwfn, p_ptt,
					(enum block_id)block_id, 0, 0, 0, 0, 0);
	}
	if (dump) {
		qed_bus_enable_dbg_block(p_hwfn, p_ptt, false);
		qed_bus_enable_clients(p_hwfn, p_ptt, 0);
	}
	return offset;
}
static u32 qed_grc_dump_static_debug ( struct ecore_hwfn * p_hwfn , struct ecore_ptt * p_ptt , u32 * dump_buf , bool dump ) { struct dbg_tools_data * dev_data = & p_hwfn -> dbg_info ; u32 block_id , line_id , offset = 0 , addr , len ; if ( dump && ecore_rd ( p_hwfn , p_ptt , DBG_REG_DBG_BLOCK_ON ) ) return 0 ; if ( dump ) { qed_bus_disable_blocks ( p_hwfn , p_ptt ) ; qed_bus_reset_dbg_block ( p_hwfn , p_ptt ) ; ecore_wr ( p_hwfn , p_ptt , DBG_REG_FRAMING_MODE , DBG_BUS_FRAME_MODE_8HW ) ; ecore_wr ( p_hwfn , p_ptt , DBG_REG_DEBUG_TARGET , DBG_BUS_TARGET_ID_INT_BUF ) ; ecore_wr ( p_hwfn , p_ptt , DBG_REG_FULL_MODE , 1 ) ; qed_bus_enable_dbg_block ( p_hwfn , p_ptt , true ) ; } for ( block_id = 0 ; block_id < MAX_BLOCK_ID ; block_id ++ ) { const struct dbg_block_chip * block_per_chip ; const struct dbg_block * block ; bool is_removed , has_dbg_bus ; u16 modes_buf_offset ; u32 block_dwords ; block_per_chip = qed_get_dbg_block_per_chip ( p_hwfn , ( enum block_id ) block_id ) ; is_removed = GET_FIELD ( block_per_chip -> flags , DBG_BLOCK_CHIP_IS_REMOVED ) ; has_dbg_bus = GET_FIELD ( block_per_chip -> flags , DBG_BLOCK_CHIP_HAS_DBG_BUS ) ; if ( block_id == BLOCK_NWS ) continue ; if ( ! is_removed && has_dbg_bus && GET_FIELD ( block_per_chip -> dbg_bus_mode . data , DBG_MODE_HDR_EVAL_MODE ) > 0 ) { modes_buf_offset = GET_FIELD ( block_per_chip -> dbg_bus_mode . data , DBG_MODE_HDR_MODES_BUF_OFFSET ) ; if ( ! qed_is_mode_match ( p_hwfn , & modes_buf_offset ) ) has_dbg_bus = false ; } if ( is_removed || ! has_dbg_bus ) continue ; block_dwords = NUM_DBG_LINES ( block_per_chip ) * STATIC_DEBUG_LINE_DWORDS ; block = get_dbg_block ( p_hwfn , ( enum block_id ) block_id ) ; offset += qed_grc_dump_mem_hdr ( p_hwfn , dump_buf + offset , dump , ( const char * ) block -> name , 0 , block_dwords , 32 , false , " " , 0 ) ; if ( ! dump ) { offset += block_dwords ; continue ; } if ( dev_data -> block_in_reset [ block_id ] ) { memset ( dump_buf + offset , 0 , DWORDS_TO_BYTES ( block_dwords ) ) ; offset += block_dwords ; continue ; } qed_bus_enable_clients ( p_hwfn , p_ptt , OSAL_BIT ( block_per_chip -> dbg_client_id ) ) ; addr = BYTES_TO_DWORDS ( DBG_REG_CALENDAR_OUT_DATA ) ; len = STATIC_DEBUG_LINE_DWORDS ; for ( line_id = 0 ; line_id < ( u32 ) NUM_DBG_LINES ( block_per_chip ) ; line_id ++ ) { qed_bus_config_dbg_line ( p_hwfn , p_ptt , ( enum block_id ) block_id , ( u8 ) line_id , 0xf , 0 , 0 , 0 ) ; offset += qed_grc_dump_addr_range ( p_hwfn , p_ptt , dump_buf + offset , dump , addr , len , true , SPLIT_TYPE_NONE , 0 ) ; } qed_bus_enable_clients ( p_hwfn , p_ptt , 0 ) ; qed_bus_config_dbg_line ( p_hwfn , p_ptt , ( enum block_id ) block_id , 0 , 0 , 0 , 0 , 0 ) ; } if ( dump ) { qed_bus_enable_dbg_block ( p_hwfn , p_ptt , false ) ; qed_bus_enable_clients ( p_hwfn , p_ptt , 0 ) ; } return offset ; }
Dumps Static Debug data.
Dumps Static Debug data .
/* Don't dump static debug if a debug bus recording is in progress */ /* Disable debug bus in all blocks */ /* Dump all static debug lines for each relevant block */ /* read+clear for NWS parity is not working, skip NWS block */ /* Dump static section params */ /* If all lines are invalid - dump zeros */ /* Enable block's client */ /* Configure debug line ID */ /* Read debug line info */ /* Disable block's client and debug output */