13 #include <linux/version.h>
14 #if defined(CONFIG_SMP) && ! defined(__SMP__)
19 #include <linux/netdevice.h>
20 #include <asm/uaccess.h>
24 #define BP_PROC_DIR "bypass"
29 #define GPIO6_SET_ENTRY_SD "gpio6_set"
30 #define GPIO6_CLEAR_ENTRY_SD "gpio6_clear"
32 #define GPIO7_SET_ENTRY_SD "gpio7_set"
33 #define GPIO7_CLEAR_ENTRY_SD "gpio7_clear"
35 #define PULSE_SET_ENTRY_SD "pulse_set"
36 #define ZERO_SET_ENTRY_SD "zero_set"
37 #define PULSE_GET1_ENTRY_SD "pulse_get1"
38 #define PULSE_GET2_ENTRY_SD "pulse_get2"
40 #define CMND_ON_ENTRY_SD "cmnd_on"
41 #define CMND_OFF_ENTRY_SD "cmnd_off"
42 #define RESET_CONT_ENTRY_SD "reset_cont"
45 #define BYPASS_INFO_ENTRY_SD "bypass_info"
46 #define BYPASS_SLAVE_ENTRY_SD "bypass_slave"
47 #define BYPASS_CAPS_ENTRY_SD "bypass_caps"
48 #define WD_SET_CAPS_ENTRY_SD "wd_set_caps"
49 #define BYPASS_ENTRY_SD "bypass"
50 #define BYPASS_CHANGE_ENTRY_SD "bypass_change"
51 #define BYPASS_WD_ENTRY_SD "bypass_wd"
52 #define WD_EXPIRE_TIME_ENTRY_SD "wd_expire_time"
53 #define RESET_BYPASS_WD_ENTRY_SD "reset_bypass_wd"
54 #define DIS_BYPASS_ENTRY_SD "dis_bypass"
55 #define BYPASS_PWUP_ENTRY_SD "bypass_pwup"
56 #define BYPASS_PWOFF_ENTRY_SD "bypass_pwoff"
57 #define STD_NIC_ENTRY_SD "std_nic"
58 #define STD_NIC_ENTRY_SD "std_nic"
59 #define TAP_ENTRY_SD "tap"
60 #define TAP_CHANGE_ENTRY_SD "tap_change"
61 #define DIS_TAP_ENTRY_SD "dis_tap"
62 #define TAP_PWUP_ENTRY_SD "tap_pwup"
63 #define TWO_PORT_LINK_ENTRY_SD "two_port_link"
64 #define WD_EXP_MODE_ENTRY_SD "wd_exp_mode"
65 #define WD_AUTORESET_ENTRY_SD "wd_autoreset"
66 #define TPL_ENTRY_SD "tpl"
67 #define WAIT_AT_PWUP_ENTRY_SD "wait_at_pwup"
68 #define HW_RESET_ENTRY_SD "hw_reset"
69 #define DISC_ENTRY_SD "disc"
70 #define DISC_CHANGE_ENTRY_SD "disc_change"
71 #define DIS_DISC_ENTRY_SD "dis_disc"
72 #define DISC_PWUP_ENTRY_SD "disc_pwup"
73 #endif //bypass_support
80 for (pde = pde->
subdir; pde; pde = pde->
next) {
105 strcpy(pfs_unit_curr->proc_name, proc_name);
110 if (pfs_unit_curr->proc_entry == 0) {
115 pfs_unit_curr->proc_entry->read_proc =
read_proc;
116 pfs_unit_curr->proc_entry->write_proc =
write_proc;
117 pfs_unit_curr->proc_entry->data =
data;
125 int *eof,
void *data)
130 len +=
sprintf(page,
"Name\t\t\t%s\n", pbp_device_block->bp_name);
132 sprintf(page + len,
"Firmware version\t0x%x\n",
141 int *eof,
void *data)
145 struct pci_dev *pci_slave_dev = pbp_device_block->bp_slave;
150 net_slave_dev = pci_get_drvdata(pci_slave_dev);
164 int *eof,
void *data)
168 int len = 0,
ret = 0;
182 int *eof,
void *data)
186 int len = 0,
ret = 0;
199 unsigned long count,
void *data)
205 int bypass_param = 0,
length = 0;
207 if (count > (
sizeof(kbuf) - 1))
216 if (kbuf[
length - 1] ==
'\n')
219 if (
strcmp(kbuf,
"on") == 0)
221 else if (
strcmp(kbuf,
"off") == 0)
231 unsigned long count,
void *data)
237 int tap_param = 0,
length = 0;
239 if (count > (
sizeof(kbuf) - 1))
248 if (kbuf[
length - 1] ==
'\n')
251 if (
strcmp(kbuf,
"on") == 0)
253 else if (
strcmp(kbuf,
"off") == 0)
263 unsigned long count,
void *data)
269 int tap_param = 0,
length = 0;
271 if (count > (
sizeof(kbuf) - 1))
280 if (kbuf[
length - 1] ==
'\n')
283 if (
strcmp(kbuf,
"on") == 0)
285 else if (
strcmp(kbuf,
"off") == 0)
295 int *eof,
void *data)
299 int len = 0,
ret = 0;
315 int *eof,
void *data)
319 int len = 0,
ret = 0;
335 int *eof,
void *data)
339 int len = 0,
ret = 0;
355 int *eof,
void *data)
359 int len = 0,
ret = 0;
375 int *eof,
void *data)
379 int len = 0,
ret = 0;
395 int *eof,
void *data)
399 int len = 0,
ret = 0;
415 unsigned long count,
void *data)
422 char *timeout_ptr = kbuf;
429 timeout = atoi(&timeout_ptr);
438 int *eof,
void *data)
442 int len = 0,
ret = 0, timeout = 0;
447 else if (timeout == -1)
448 len =
sprintf(page,
"unknown\n");
449 else if (timeout == 0)
450 len =
sprintf(page,
"disable\n");
452 len =
sprintf(page,
"%d\n", timeout);
460 int *eof,
void *data)
464 int len = 0,
ret = 0, timeout = 0;
469 else if (timeout == -1)
470 len =
sprintf(page,
"expire\n");
471 else if (timeout == 0)
472 len =
sprintf(page,
"disable\n");
475 len =
sprintf(page,
"%d\n", timeout);
482 int *eof,
void *data)
486 int len = 0,
ret = 0;
502 get_wait_at_pwup_pfs(
char *page,
char **start,
off_t off,
int count,
503 int *eof,
void *data)
507 int len = 0,
ret = 0;
522 get_hw_reset_pfs(
char *page,
char **start,
off_t off,
int count,
523 int *eof,
void *data)
527 int len = 0,
ret = 0;
545 int *eof,
void *data)
549 int len = 0,
ret = 0;
555 len =
sprintf(page,
"disable\n");
557 len =
sprintf(page,
"success\n");
565 unsigned long count,
void *data)
571 int bypass_param = 0,
length = 0;
579 if (kbuf[
length - 1] ==
'\n')
582 if (
strcmp(kbuf,
"on") == 0)
584 else if (
strcmp(kbuf,
"off") == 0)
594 unsigned long count,
void *data)
600 int tap_param = 0,
length = 0;
608 if (kbuf[
length - 1] ==
'\n')
611 if (
strcmp(kbuf,
"on") == 0)
613 else if (
strcmp(kbuf,
"off") == 0)
623 unsigned long count,
void *data)
629 int tap_param = 0,
length = 0;
637 if (kbuf[
length - 1] ==
'\n')
640 if (
strcmp(kbuf,
"on") == 0)
642 else if (
strcmp(kbuf,
"off") == 0)
652 int *eof,
void *data)
656 int len = 0,
ret = 0;
672 int *eof,
void *data)
676 int len = 0,
ret = 0;
692 int *eof,
void *data)
696 int len = 0,
ret = 0;
712 unsigned long count,
void *data)
718 int bypass_param = 0,
length = 0;
726 if (kbuf[
length - 1] ==
'\n')
729 if (
strcmp(kbuf,
"on") == 0)
731 else if (
strcmp(kbuf,
"off") == 0)
741 unsigned long count,
void *data)
747 int bypass_param = 0,
length = 0;
755 if (kbuf[
length - 1] ==
'\n')
758 if (
strcmp(kbuf,
"on") == 0)
760 else if (
strcmp(kbuf,
"off") == 0)
770 unsigned long count,
void *data)
776 int tap_param = 0,
length = 0;
784 if (kbuf[
length - 1] ==
'\n')
787 if (
strcmp(kbuf,
"on") == 0)
789 else if (
strcmp(kbuf,
"off") == 0)
799 unsigned long count,
void *data)
805 int tap_param = 0,
length = 0;
813 if (kbuf[
length - 1] ==
'\n')
816 if (
strcmp(kbuf,
"on") == 0)
818 else if (
strcmp(kbuf,
"off") == 0)
828 int *eof,
void *data)
832 int len = 0,
ret = 0;
848 int *eof,
void *data)
852 int len = 0,
ret = 0;
868 int *eof,
void *data)
872 int len = 0,
ret = 0;
888 int *eof,
void *data)
892 int len = 0,
ret = 0;
908 unsigned long count,
void *data)
914 int bypass_param = 0,
length = 0;
922 if (kbuf[
length - 1] ==
'\n')
925 if (
strcmp(kbuf,
"on") == 0)
927 else if (
strcmp(kbuf,
"off") == 0)
937 int *eof,
void *data)
941 int len = 0,
ret = 0;
957 int *eof,
void *data)
961 int len = 0,
ret = 0;
967 len =
sprintf(page,
"bypass\n");
980 unsigned long count,
void *data)
986 int bypass_param = 0,
length = 0;
988 if (count > (
sizeof(kbuf) - 1))
997 if (kbuf[
length - 1] ==
'\n')
1000 if (
strcmp(kbuf,
"tap") == 0)
1002 else if (
strcmp(kbuf,
"bypass") == 0)
1004 else if (
strcmp(kbuf,
"disc") == 0)
1014 int *eof,
void *data)
1018 int len = 0,
ret = 0;
1024 len =
sprintf(page,
"fail\n");
1032 unsigned long count,
void *data)
1037 char *timeout_ptr = kbuf;
1044 timeout = atoi(&timeout_ptr);
1052 set_tpl_pfs(
struct file *file,
const char *buffer,
1053 unsigned long count,
void *data)
1059 int tpl_param = 0,
length = 0;
1061 if (count > (
sizeof(kbuf) - 1))
1070 if (kbuf[
length - 1] ==
'\n')
1073 if (
strcmp(kbuf,
"on") == 0)
1075 else if (
strcmp(kbuf,
"off") == 0)
1085 set_wait_at_pwup_pfs(
struct file *file,
const char *buffer,
1086 unsigned long count,
void *data)
1092 int tpl_param = 0,
length = 0;
1094 if (count > (
sizeof(kbuf) - 1))
1103 if (kbuf[
length - 1] ==
'\n')
1106 if (
strcmp(kbuf,
"on") == 0)
1108 else if (
strcmp(kbuf,
"off") == 0)
1117 set_hw_reset_pfs(
struct file *file,
const char *buffer,
1118 unsigned long count,
void *data)
1124 int tpl_param = 0,
length = 0;
1126 if (count > (
sizeof(kbuf) - 1))
1135 if (kbuf[
length - 1] ==
'\n')
1138 if (
strcmp(kbuf,
"on") == 0)
1140 else if (
strcmp(kbuf,
"off") == 0)
1162 procfs_dir = proc_getdir(current_pfs->
dir_name, bp_procfs_dir);
1163 if (procfs_dir == 0) {
1172 procfs_dir, pbp_device_block))
1180 procfs_dir, pbp_device_block))
1185 procfs_dir, pbp_device_block))
1190 procfs_dir, pbp_device_block))
1194 procfs_dir, pbp_device_block))
1199 procfs_dir, pbp_device_block))
1204 procfs_dir, pbp_device_block))
1209 procfs_dir, pbp_device_block))
1300 procfs_dir, pbp_device_block))
1305 procfs_dir, pbp_device_block))
1309 procfs_dir, pbp_device_block))
1313 get_wait_at_pwup_pfs,
1314 procfs_dir, pbp_device_block))
1318 procfs_dir, pbp_device_block))
1338 for (pde = pde->
subdir; pde;) {