summaryrefslogtreecommitdiffstats
path: root/fec_8xx.c
blob: 63352fca36b8d15cb1b731471c46dae15bc6629b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Copyright (C) 2004 Intracom S.A.
 * Pantelis Antoniou <panto@intracom.gr>
 */

#include <stdio.h>
#include <stdint.h>
#include <stddef.h>

#include "internal.h"

struct fec {
	uint32_t	addr_low;	/* lower 32 bits of station address	*/
	uint32_t	addr_high;	/* upper 16 bits of station address||0  */
	uint32_t	hash_table_high;/* upper 32-bits of hash table		*/
	uint32_t	hash_table_low;	/* lower 32-bits of hash table		*/
	uint32_t	r_des_start;	/* beginning of Rx descriptor ring	*/
	uint32_t	x_des_start;	/* beginning of Tx descriptor ring	*/
	uint32_t	r_buff_size;	/* Rx buffer size			*/
	uint32_t	res2[9];	/* reserved				*/
	uint32_t	ecntrl;		/* ethernet control register		*/
	uint32_t	ievent;		/* interrupt event register		*/
	uint32_t	imask;		/* interrupt mask register		*/
	uint32_t	ivec;		/* interrupt level and vector status	*/
	uint32_t	r_des_active;	/* Rx ring updated flag			*/
	uint32_t	x_des_active;	/* Tx ring updated flag			*/
	uint32_t	res3[10];	/* reserved				*/
	uint32_t	mii_data;	/* MII data register			*/
	uint32_t	mii_speed;	/* MII speed control register		*/
	uint32_t	res4[17];	/* reserved				*/
	uint32_t	r_bound;	/* end of RAM (read-only)		*/
	uint32_t	r_fstart;	/* Rx FIFO start address		*/
	uint32_t	res5[6];	/* reserved				*/
	uint32_t	x_fstart;	/* Tx FIFO start address		*/
	uint32_t	res6[17];	/* reserved				*/
	uint32_t	fun_code;	/* fec SDMA function code		*/
	uint32_t	res7[3];	/* reserved				*/
	uint32_t	r_cntrl;	/* Rx control register			*/
	uint32_t	r_hash;		/* Rx hash register			*/
	uint32_t	res8[14];	/* reserved				*/
	uint32_t	x_cntrl;	/* Tx control register			*/
	uint32_t	res9[0x1e];	/* reserved				*/
};

#define DUMP_REG(f, x)	fprintf(stdout, \
			"0x%04lx: %-16s 0x%08x\n", \
				(unsigned long)(offsetof(struct fec, x)), \
				#x, f->x)

int fec_8xx_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
		      struct ethtool_regs *regs)
{
	struct fec *f = (struct fec *)regs->data;

	fprintf(stdout, "Descriptor Registers\n");
	fprintf(stdout, "---------------------\n");

	DUMP_REG(f, addr_low);
	DUMP_REG(f, addr_high);
	DUMP_REG(f, hash_table_high);
	DUMP_REG(f, hash_table_low);
	DUMP_REG(f, r_des_start);
	DUMP_REG(f, x_des_start);
	DUMP_REG(f, r_buff_size);
	DUMP_REG(f, ecntrl);
	DUMP_REG(f, ievent);
	DUMP_REG(f, imask);
	DUMP_REG(f, ivec);
	DUMP_REG(f, r_des_active);
	DUMP_REG(f, x_des_active);
	DUMP_REG(f, mii_data);
	DUMP_REG(f, mii_speed);
	DUMP_REG(f, r_bound);
	DUMP_REG(f, r_fstart);
	DUMP_REG(f, x_fstart);
	DUMP_REG(f, fun_code);
	DUMP_REG(f, r_cntrl);
	DUMP_REG(f, r_hash);
	DUMP_REG(f, x_cntrl);

	return 0;
}