src/dpdk/drivers/net/qede/qede_debug.c
static u32 qed_grc_dump_phy(struct ecore_hwfn *p_hwfn,
			    struct ecore_ptt *p_ptt, u32 *dump_buf, bool dump)
{
	u32 offset = 0, tbus_lo_offset, tbus_hi_offset;
	char mem_name[32];
	u8 phy_id;

	for (phy_id = 0; phy_id < OSAL_ARRAY_SIZE(s_phy_defs); phy_id++) {
		u32 addr_lo_addr, addr_hi_addr, data_lo_addr, data_hi_addr;
		struct phy_defs *phy_defs;
		u8 *bytes_buf;

		phy_defs = &s_phy_defs[phy_id];
		addr_lo_addr = phy_defs->base_addr +
			       phy_defs->tbus_addr_lo_addr;
		addr_hi_addr = phy_defs->base_addr +
			       phy_defs->tbus_addr_hi_addr;
		data_lo_addr = phy_defs->base_addr +
			       phy_defs->tbus_data_lo_addr;
		data_hi_addr = phy_defs->base_addr +
			       phy_defs->tbus_data_hi_addr;

		if (snprintf(mem_name, sizeof(mem_name), "tbus_%s",
			     phy_defs->phy_name) < 0)
			DP_NOTICE(p_hwfn, false,
				  "Unexpected debug error: invalid PHY memory name\n");

		offset += qed_grc_dump_mem_hdr(p_hwfn,
					       dump_buf + offset,
					       dump,
					       mem_name,
					       0,
					       PHY_DUMP_SIZE_DWORDS,
					       16, true, mem_name, 0);

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

		bytes_buf = (u8 *)(dump_buf + offset);
		for (tbus_hi_offset = 0;
		     tbus_hi_offset < (NUM_PHY_TBUS_ADDRESSES >> 8);
		     tbus_hi_offset++) {
			ecore_wr(p_hwfn, p_ptt, addr_hi_addr, tbus_hi_offset);
			for (tbus_lo_offset = 0; tbus_lo_offset < 256;
			     tbus_lo_offset++) {
				ecore_wr(p_hwfn,
				       p_ptt, addr_lo_addr, tbus_lo_offset);
				*(bytes_buf++) = (u8)ecore_rd(p_hwfn,
							    p_ptt,
							    data_lo_addr);
				*(bytes_buf++) = (u8)ecore_rd(p_hwfn,
							    p_ptt,
							    data_hi_addr);
			}
		}

		offset += PHY_DUMP_SIZE_DWORDS;
	}

	return offset;
}
/* Dumps the tbus indirect memory for all PHYs.
 * Returns the dumped size in dwords.
 */
Dumps the tbus indirect memory for all PHYs.
Returns the dumped size in dwords.
Dumps the tbus indirect memory for all PHYs . Returns the dumped size in dwords .
static u32 qed_grc_dump_phy(struct ecore_hwfn *p_hwfn,
			    struct ecore_ptt *p_ptt, u32 *dump_buf, bool dump)
{
	u32 offset = 0, tbus_lo_offset, tbus_hi_offset;
	char mem_name[32];
	u8 phy_id;
	for (phy_id = 0; phy_id < OSAL_ARRAY_SIZE(s_phy_defs); phy_id++) {
		u32 addr_lo_addr, addr_hi_addr, data_lo_addr, data_hi_addr;
		struct phy_defs *phy_defs;
		u8 *bytes_buf;
		phy_defs = &s_phy_defs[phy_id];
		addr_lo_addr = phy_defs->base_addr +
			       phy_defs->tbus_addr_lo_addr;
		addr_hi_addr = phy_defs->base_addr +
			       phy_defs->tbus_addr_hi_addr;
		data_lo_addr = phy_defs->base_addr +
			       phy_defs->tbus_data_lo_addr;
		data_hi_addr = phy_defs->base_addr +
			       phy_defs->tbus_data_hi_addr;
		if (snprintf(mem_name, sizeof(mem_name), "tbus_%s",
			     phy_defs->phy_name) < 0)
			DP_NOTICE(p_hwfn, false,
				  "Unexpected debug error: invalid PHY memory name\n");
		offset += qed_grc_dump_mem_hdr(p_hwfn,
					       dump_buf + offset,
					       dump,
					       mem_name,
					       0,
					       PHY_DUMP_SIZE_DWORDS,
					       16, true, mem_name, 0);
		if (!dump) {
			offset += PHY_DUMP_SIZE_DWORDS;
			continue;
		}
		bytes_buf = (u8 *)(dump_buf + offset);
		for (tbus_hi_offset = 0;
		     tbus_hi_offset < (NUM_PHY_TBUS_ADDRESSES >> 8);
		     tbus_hi_offset++) {
			ecore_wr(p_hwfn, p_ptt, addr_hi_addr, tbus_hi_offset);
			for (tbus_lo_offset = 0; tbus_lo_offset < 256;
			     tbus_lo_offset++) {
				ecore_wr(p_hwfn,
				       p_ptt, addr_lo_addr, tbus_lo_offset);
				*(bytes_buf++) = (u8)ecore_rd(p_hwfn,
							    p_ptt,
							    data_lo_addr);
				*(bytes_buf++) = (u8)ecore_rd(p_hwfn,
							    p_ptt,
							    data_hi_addr);
			}
		}
		offset += PHY_DUMP_SIZE_DWORDS;
	}
	return offset;
}
static u32 qed_grc_dump_phy ( struct ecore_hwfn * p_hwfn , struct ecore_ptt * p_ptt , u32 * dump_buf , bool dump ) { u32 offset = 0 , tbus_lo_offset , tbus_hi_offset ; char mem_name [ 32 ] ; u8 phy_id ; for ( phy_id = 0 ; phy_id < OSAL_ARRAY_SIZE ( s_phy_defs ) ; phy_id ++ ) { u32 addr_lo_addr , addr_hi_addr , data_lo_addr , data_hi_addr ; struct phy_defs * phy_defs ; u8 * bytes_buf ; phy_defs = & s_phy_defs [ phy_id ] ; addr_lo_addr = phy_defs -> base_addr + phy_defs -> tbus_addr_lo_addr ; addr_hi_addr = phy_defs -> base_addr + phy_defs -> tbus_addr_hi_addr ; data_lo_addr = phy_defs -> base_addr + phy_defs -> tbus_data_lo_addr ; data_hi_addr = phy_defs -> base_addr + phy_defs -> tbus_data_hi_addr ; if ( snprintf ( mem_name , sizeof ( mem_name ) , " " , phy_defs -> phy_name ) < 0 ) DP_NOTICE ( p_hwfn , false , " \n " ) ; offset += qed_grc_dump_mem_hdr ( p_hwfn , dump_buf + offset , dump , mem_name , 0 , PHY_DUMP_SIZE_DWORDS , 16 , true , mem_name , 0 ) ; if ( ! dump ) { offset += PHY_DUMP_SIZE_DWORDS ; continue ; } bytes_buf = ( u8 * ) ( dump_buf + offset ) ; for ( tbus_hi_offset = 0 ; tbus_hi_offset < ( NUM_PHY_TBUS_ADDRESSES >> 8 ) ; tbus_hi_offset ++ ) { ecore_wr ( p_hwfn , p_ptt , addr_hi_addr , tbus_hi_offset ) ; for ( tbus_lo_offset = 0 ; tbus_lo_offset < 256 ; tbus_lo_offset ++ ) { ecore_wr ( p_hwfn , p_ptt , addr_lo_addr , tbus_lo_offset ) ; * ( bytes_buf ++ ) = ( u8 ) ecore_rd ( p_hwfn , p_ptt , data_lo_addr ) ; * ( bytes_buf ++ ) = ( u8 ) ecore_rd ( p_hwfn , p_ptt , data_hi_addr ) ; } } offset += PHY_DUMP_SIZE_DWORDS ; } return offset ; }
Dumps the tbus indirect memory for all PHYs.
Dumps the tbus indirect memory for all PHYs .