1112790Smdodd/*-
2112790Smdodd * $FreeBSD$
3112790Smdodd */
4112790Smdodd
5112790Smdoddenum ie_hardware {
6112790Smdodd	IE_NONE,
7112790Smdodd        IE_STARLAN10,
8112790Smdodd        IE_EN100,
9112790Smdodd        IE_SLFIBER,
10112790Smdodd        IE_3C507,
11112790Smdodd        IE_NI5210,
12112790Smdodd        IE_EE16,
13112790Smdodd        IE_UNKNOWN
14112790Smdodd};
15112790Smdodd
16112790Smdodd/*
17112790Smdodd * Ethernet status, per interface.
18112790Smdodd */
19112790Smdoddstruct ie_softc {
20147256Sbrooks	struct	 ifnet *ifp;
21112790Smdodd	void	 (*ie_reset_586) (struct ie_softc *);
22112790Smdodd	void	 (*ie_chan_attn) (struct ie_softc *);
23112790Smdodd	enum	 ie_hardware hard_type;
24112790Smdodd	int	 hard_vers;
25147256Sbrooks	u_char	 enaddr[6];
26112790Smdodd
27112790Smdodd	device_t		dev;
28112790Smdodd
29112790Smdodd	struct resource *	io_res;
30112790Smdodd	int			io_rid;
31112790Smdodd	bus_space_tag_t		io_bt;
32112790Smdodd	bus_space_handle_t	io_bh;
33112790Smdodd
34112790Smdodd	struct resource	*	irq_res;
35112790Smdodd	int			irq_rid;
36112790Smdodd	void *			irq_ih;
37112790Smdodd
38112790Smdodd	struct resource *	mem_res;
39112790Smdodd	int			mem_rid;
40112790Smdodd	bus_space_tag_t		mem_bt;
41112790Smdodd	bus_space_handle_t	mem_bh;
42112790Smdodd
43118555Sbde	u_int	 port;		/* i/o base address for this interface */
44112790Smdodd	caddr_t	 iomem;		/* memory size */
45112790Smdodd	caddr_t	 iomembot;	/* memory base address */
46112790Smdodd	unsigned iosize;
47112790Smdodd	int	 bus_use;	/* 0 means 16bit, 1 means 8 bit adapter */
48112790Smdodd
49112790Smdodd	int	 want_mcsetup;
50112790Smdodd	int	 promisc;
51112790Smdodd	int	 nframes;
52112790Smdodd	int	 nrxbufs;
53112790Smdodd	int	 ntxbufs;
54112790Smdodd	volatile struct ie_int_sys_conf_ptr *iscp;
55112790Smdodd	volatile struct ie_sys_ctl_block *scb;
56112790Smdodd	volatile struct ie_recv_frame_desc **rframes;	/* nframes worth */
57112790Smdodd	volatile struct ie_recv_buf_desc **rbuffs;	/* nrxbufs worth */
58112790Smdodd	volatile u_char **cbuffs;			/* nrxbufs worth */
59112790Smdodd	int	 rfhead, rftail, rbhead, rbtail;
60112790Smdodd
61112790Smdodd	volatile struct ie_xmit_cmd **xmit_cmds;	/* ntxbufs worth */
62112790Smdodd	volatile struct ie_xmit_buf **xmit_buffs;	/* ntxbufs worth */
63112790Smdodd	volatile u_char	 **xmit_cbuffs;			/* ntxbufs worth */
64112790Smdodd	int	 xmit_count;
65112790Smdodd
66112790Smdodd	struct	 ie_en_addr mcast_addrs[MAXMCAST + 1];
67112790Smdodd	int	 mcast_count;
68112790Smdodd
69112790Smdodd	u_short	 irq_encoded;	/* encoded interrupt on IEE16 */
70179491Sjhb
71179491Sjhb	struct mtx	lock;
72112790Smdodd};
73112790Smdodd#define PORT(sc)	sc->port
74112790Smdodd#define MEM(sc)		sc->iomem
75112790Smdodd
76179491Sjhb#define	IE_LOCK(sc)		mtx_lock(&(sc)->lock)
77179491Sjhb#define	IE_UNLOCK(sc)		mtx_unlock(&(sc)->lock)
78179491Sjhb#define	IE_ASSERT_LOCKED(sc)	mtx_assert(&(sc)->lock, MA_OWNED)
79179491Sjhb
80112790Smdoddvoid            ie_intr			(void *);
81112790Smdoddint		ie_alloc_resources	(device_t);
82112790Smdoddvoid		ie_release_resources	(device_t);
83112790Smdoddint		ie_attach		(device_t);
84112790Smdoddint		ie_detach		(device_t);
85112790Smdodd
86112790Smdoddvoid		el_reset_586		(struct ie_softc *);
87112790Smdoddvoid		el_chan_attn		(struct ie_softc *);
88112790Smdodd
89112790Smdoddvoid		sl_reset_586		(struct ie_softc *);
90112790Smdoddvoid		sl_chan_attn		(struct ie_softc *);
91112790Smdodd
92112790Smdoddvoid		ee16_reset_586		(struct ie_softc *);
93112790Smdoddvoid		ee16_chan_attn		(struct ie_softc *);
94181134Sjhbvoid		ee16_shutdown		(struct ie_softc *);
95112790Smdodd
96112790Smdoddvoid		sl_read_ether		(struct ie_softc *, unsigned char *);
97112790Smdoddint		check_ie_present	(struct ie_softc *);
98112790Smdodd
99