1/*-
2 * $FreeBSD$
3 */
4
5enum ie_hardware {
6	IE_NONE,
7        IE_STARLAN10,
8        IE_EN100,
9        IE_SLFIBER,
10        IE_3C507,
11        IE_NI5210,
12        IE_EE16,
13        IE_UNKNOWN
14};
15
16/*
17 * Ethernet status, per interface.
18 */
19struct ie_softc {
20	struct	 ifnet *ifp;
21	void	 (*ie_reset_586) (struct ie_softc *);
22	void	 (*ie_chan_attn) (struct ie_softc *);
23	enum	 ie_hardware hard_type;
24	int	 hard_vers;
25	u_char	 enaddr[6];
26
27	device_t		dev;
28
29	struct resource *	io_res;
30	int			io_rid;
31	bus_space_tag_t		io_bt;
32	bus_space_handle_t	io_bh;
33
34	struct resource	*	irq_res;
35	int			irq_rid;
36	void *			irq_ih;
37
38	struct resource *	mem_res;
39	int			mem_rid;
40	bus_space_tag_t		mem_bt;
41	bus_space_handle_t	mem_bh;
42
43	u_int	 port;		/* i/o base address for this interface */
44	caddr_t	 iomem;		/* memory size */
45	caddr_t	 iomembot;	/* memory base address */
46	unsigned iosize;
47	int	 bus_use;	/* 0 means 16bit, 1 means 8 bit adapter */
48
49	int	 want_mcsetup;
50	int	 promisc;
51	int	 nframes;
52	int	 nrxbufs;
53	int	 ntxbufs;
54	volatile struct ie_int_sys_conf_ptr *iscp;
55	volatile struct ie_sys_ctl_block *scb;
56	volatile struct ie_recv_frame_desc **rframes;	/* nframes worth */
57	volatile struct ie_recv_buf_desc **rbuffs;	/* nrxbufs worth */
58	volatile u_char **cbuffs;			/* nrxbufs worth */
59	int	 rfhead, rftail, rbhead, rbtail;
60
61	volatile struct ie_xmit_cmd **xmit_cmds;	/* ntxbufs worth */
62	volatile struct ie_xmit_buf **xmit_buffs;	/* ntxbufs worth */
63	volatile u_char	 **xmit_cbuffs;			/* ntxbufs worth */
64	int	 xmit_count;
65
66	struct	 ie_en_addr mcast_addrs[MAXMCAST + 1];
67	int	 mcast_count;
68
69	u_short	 irq_encoded;	/* encoded interrupt on IEE16 */
70
71	struct mtx	lock;
72};
73#define PORT(sc)	sc->port
74#define MEM(sc)		sc->iomem
75
76#define	IE_LOCK(sc)		mtx_lock(&(sc)->lock)
77#define	IE_UNLOCK(sc)		mtx_unlock(&(sc)->lock)
78#define	IE_ASSERT_LOCKED(sc)	mtx_assert(&(sc)->lock, MA_OWNED)
79
80void            ie_intr			(void *);
81int		ie_alloc_resources	(device_t);
82void		ie_release_resources	(device_t);
83int		ie_attach		(device_t);
84int		ie_detach		(device_t);
85
86void		el_reset_586		(struct ie_softc *);
87void		el_chan_attn		(struct ie_softc *);
88
89void		sl_reset_586		(struct ie_softc *);
90void		sl_chan_attn		(struct ie_softc *);
91
92void		ee16_reset_586		(struct ie_softc *);
93void		ee16_chan_attn		(struct ie_softc *);
94void		ee16_shutdown		(struct ie_softc *);
95
96void		sl_read_ether		(struct ie_softc *, unsigned char *);
97int		check_ie_present	(struct ie_softc *);
98
99