Linux-libre 3.16.85-gnu
[librecmc/linux-libre.git] / drivers / staging / silicom / bp_ioctl.h
1 /******************************************************************************/
2 /*                                                                            */
3 /* Silicom Bypass Control Utility, Copyright (c) 2005-2007 Silicom            */
4 /* All rights reserved.                                                       */
5 /*                                                                            */
6 /* This program is free software; you can redistribute it and/or modify       */
7 /* it under the terms of the GNU General Public License as published by       */
8 /* the Free Software Foundation, located in the file LICENSE.                 */
9 /*                                                                            */
10 /*                                                                            */
11 /******************************************************************************/
12
13 #ifndef BP_IOCTL_H
14 #define BP_IOCTL_H
15
16 #define BP_CAP                   0x01   /* BIT_0 */
17 #define BP_STATUS_CAP            0x02
18 #define BP_STATUS_CHANGE_CAP     0x04
19 #define SW_CTL_CAP               0x08
20 #define BP_DIS_CAP               0x10
21 #define BP_DIS_STATUS_CAP        0x20
22 #define STD_NIC_CAP              0x40
23 #define BP_PWOFF_ON_CAP          0x80
24 #define BP_PWOFF_OFF_CAP         0x0100
25 #define BP_PWOFF_CTL_CAP         0x0200
26 #define BP_PWUP_ON_CAP           0x0400
27 #define BP_PWUP_OFF_CAP          0x0800
28 #define BP_PWUP_CTL_CAP          0x1000
29 #define WD_CTL_CAP               0x2000
30 #define WD_STATUS_CAP            0x4000
31 #define WD_TIMEOUT_CAP           0x8000
32 #define TX_CTL_CAP               0x10000
33 #define TX_STATUS_CAP            0x20000
34 #define TAP_CAP                  0x40000
35 #define TAP_STATUS_CAP           0x80000
36 #define TAP_STATUS_CHANGE_CAP    0x100000
37 #define TAP_DIS_CAP              0x200000
38 #define TAP_DIS_STATUS_CAP       0x400000
39 #define TAP_PWUP_ON_CAP          0x800000
40 #define TAP_PWUP_OFF_CAP         0x1000000
41 #define TAP_PWUP_CTL_CAP         0x2000000
42 #define NIC_CAP_NEG              0x4000000
43 #define TPL_CAP                  0x8000000
44 #define DISC_CAP                 0x10000000
45 #define DISC_DIS_CAP             0x20000000
46 #define DISC_PWUP_CTL_CAP        0x40000000
47
48 #define TPL2_CAP_EX              0x01
49 #define DISC_PORT_CAP_EX         0x02
50
51 #define WD_MIN_TIME_MASK(val)      (val & 0xf)
52 #define WD_STEP_COUNT_MASK(val)    ((val & 0xf) << 5)
53 #define WDT_STEP_TIME              0x10 /* BIT_4 */
54
55 #define WD_MIN_TIME_GET(desc)   (desc & 0xf)
56 #define WD_STEP_COUNT_GET(desc) ((desc>>5) & 0xf)
57
58 typedef enum {
59         IF_SCAN,
60         GET_DEV_NUM,
61         IS_BYPASS,
62         GET_BYPASS_SLAVE,
63         GET_BYPASS_CAPS,
64         GET_WD_SET_CAPS,
65         SET_BYPASS,
66         GET_BYPASS,
67         GET_BYPASS_CHANGE,
68         SET_BYPASS_WD,
69         GET_BYPASS_WD,
70         GET_WD_EXPIRE_TIME,
71         RESET_BYPASS_WD_TIMER,
72         SET_DIS_BYPASS,
73         GET_DIS_BYPASS,
74         SET_BYPASS_PWOFF,
75         GET_BYPASS_PWOFF,
76         SET_BYPASS_PWUP,
77         GET_BYPASS_PWUP,
78         SET_STD_NIC,
79         GET_STD_NIC,
80         SET_TX,
81         GET_TX,
82         SET_TAP,
83         GET_TAP,
84         GET_TAP_CHANGE,
85         SET_DIS_TAP,
86         GET_DIS_TAP,
87         SET_TAP_PWUP,
88         GET_TAP_PWUP,
89         SET_WD_EXP_MODE,
90         GET_WD_EXP_MODE,
91         SET_WD_AUTORESET,
92         GET_WD_AUTORESET,
93         SET_TPL,
94         GET_TPL,
95         SET_DISC,
96         GET_DISC,
97         GET_DISC_CHANGE,
98         SET_DIS_DISC,
99         GET_DIS_DISC,
100         SET_DISC_PWUP,
101         GET_DISC_PWUP,
102         GET_BYPASS_INFO = 100,
103         GET_BP_WAIT_AT_PWUP,
104         SET_BP_WAIT_AT_PWUP,
105         GET_BP_HW_RESET,
106         SET_BP_HW_RESET,
107         SET_DISC_PORT,
108         GET_DISC_PORT,
109         SET_DISC_PORT_PWUP,
110         GET_DISC_PORT_PWUP,
111         SET_BP_FORCE_LINK,
112         GET_BP_FORCE_LINK,
113 #ifdef BP_SELF_TEST
114         SET_BP_SELF_TEST = 200,
115         GET_BP_SELF_TEST,
116 #endif
117
118 } CMND_TYPE_SD;
119
120 /*
121 * The major device number. We can't rely on dynamic
122 * registration any more, because ioctls need to know
123 * it.
124 */
125
126 #define MAGIC_NUM 'J'
127
128 /* for passing single values */
129 struct bpctl_cmd {
130         int status;
131         int data[8];
132         int in_param[8];
133         int out_param[8];
134 };
135
136 #define IOCTL_TX_MSG(cmd) _IOWR(MAGIC_NUM, cmd, struct bpctl_cmd)
137
138 #define DEVICE_NAME "bpctl"
139
140 #endif