xref: /freebsd/sys/dev/etherswitch/etherswitch_if.m (revision 313376588638950ba1e93c403dd8c97bc52fd3a2)
1# $FreeBSD$
2
3#include <sys/bus.h>
4
5# Needed for ifreq/ifmediareq
6#include <sys/socket.h>
7#include <net/if.h>
8
9#include <dev/etherswitch/etherswitch.h>
10
11INTERFACE etherswitch;
12
13#
14# Default implementation
15#
16CODE {
17	static void
18	null_etherswitch_lock(device_t dev)
19	{
20	}
21
22	static void
23	null_etherswitch_unlock(device_t dev)
24	{
25	}
26
27	static int
28	null_etherswitch_getconf(device_t dev, etherswitch_conf_t *conf)
29	{
30		return (0);
31	}
32
33	static int
34	null_etherswitch_setconf(device_t dev, etherswitch_conf_t *conf)
35	{
36		return (0);
37	}
38};
39
40#
41# Return device info
42#
43METHOD etherswitch_info_t* getinfo {
44	device_t	dev;
45}
46
47#
48# Lock access to switch registers
49#
50METHOD void lock {
51	device_t	dev;
52} DEFAULT null_etherswitch_lock;
53
54#
55# Unlock access to switch registers
56#
57METHOD void unlock {
58	device_t	dev;
59} DEFAULT null_etherswitch_unlock;
60
61#
62# Read switch register
63#
64METHOD int readreg {
65	device_t	dev;
66	int		reg;
67};
68
69#
70# Write switch register
71#
72METHOD int writereg {
73	device_t	dev;
74	int		reg;
75	int		value;
76};
77
78#
79# Read PHY register
80#
81METHOD int readphyreg {
82	device_t	dev;
83	int		phy;
84	int		reg;
85};
86
87#
88# Write PHY register
89#
90METHOD int writephyreg {
91	device_t	dev;
92	int		phy;
93	int		reg;
94	int		value;
95};
96
97#
98# Get port configuration
99#
100METHOD int getport {
101	device_t	dev;
102	etherswitch_port_t *vg;
103}
104
105#
106# Set port configuration
107#
108METHOD int setport {
109	device_t	dev;
110	etherswitch_port_t *vg;
111}
112
113#
114# Get VLAN group configuration
115#
116METHOD int getvgroup {
117	device_t	dev;
118	etherswitch_vlangroup_t *vg;
119}
120
121#
122# Set VLAN group configuration
123#
124METHOD int setvgroup {
125	device_t	dev;
126	etherswitch_vlangroup_t *vg;
127}
128
129#
130# Get the Switch configuration
131#
132METHOD int getconf {
133	device_t	dev;
134	etherswitch_conf_t	*conf;
135} DEFAULT null_etherswitch_getconf;
136
137#
138# Set the Switch configuration
139#
140METHOD int setconf {
141	device_t	dev;
142	etherswitch_conf_t	*conf;
143} DEFAULT null_etherswitch_setconf;
144