Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Thomas Horsten <thh@lasat.com> |
| 3 | * Copyright (C) 2000 LASAT Networks A/S. |
| 4 | * |
| 5 | * This program is free software; you can distribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License (Version 2) as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | * for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 17 | * |
| 18 | * Routines specific to the LASAT boards |
| 19 | */ |
| 20 | #include <linux/types.h> |
| 21 | #include <asm/lasat/lasat.h> |
| 22 | |
| 23 | #include <linux/module.h> |
| 24 | #include <linux/sysctl.h> |
| 25 | #include <linux/stddef.h> |
| 26 | #include <linux/init.h> |
| 27 | #include <linux/fs.h> |
| 28 | #include <linux/ctype.h> |
| 29 | #include <linux/string.h> |
| 30 | #include <linux/net.h> |
| 31 | #include <linux/inet.h> |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 32 | #include <linux/uaccess.h> |
| 33 | |
Ralf Baechle | 4b55048 | 2007-10-11 23:46:08 +0100 | [diff] [blame] | 34 | #include <asm/time.h> |
| 35 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 36 | #ifdef CONFIG_DS1603 |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 37 | #include "ds1603.h" |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 38 | #endif |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 39 | |
| 40 | /* Strategy function to write EEPROM after changing string entry */ |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 41 | int sysctl_lasatstring(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 42 | void *oldval, size_t *oldlenp, |
| 43 | void *newval, size_t newlen) |
| 44 | { |
| 45 | int r; |
| 46 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 47 | r = sysctl_string(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 48 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 49 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 50 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 51 | if (newval && newlen) |
| 52 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 53 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 54 | return 0; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | |
| 58 | /* And the same for proc */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 59 | int proc_dolasatstring(ctl_table *table, int write, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 60 | void *buffer, size_t *lenp, loff_t *ppos) |
| 61 | { |
| 62 | int r; |
| 63 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 64 | r = proc_dostring(table, write, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 65 | if ((!write) || r) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 66 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 67 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 68 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 69 | |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | /* proc function to write EEPROM after changing int entry */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 74 | int proc_dolasatint(ctl_table *table, int write, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 75 | void *buffer, size_t *lenp, loff_t *ppos) |
| 76 | { |
| 77 | int r; |
| 78 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 79 | r = proc_dointvec(table, write, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 80 | if ((!write) || r) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 81 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 82 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 83 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 88 | #ifdef CONFIG_DS1603 |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 89 | static int rtctmp; |
| 90 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 91 | /* proc function to read/write RealTime Clock */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 92 | int proc_dolasatrtc(ctl_table *table, int write, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 93 | void *buffer, size_t *lenp, loff_t *ppos) |
| 94 | { |
Martin Schwidefsky | d4f587c | 2009-08-14 15:47:31 +0200 | [diff] [blame] | 95 | struct timespec ts; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 96 | int r; |
| 97 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 98 | if (!write) { |
Martin Schwidefsky | d4f587c | 2009-08-14 15:47:31 +0200 | [diff] [blame] | 99 | read_persistent_clock(&ts); |
| 100 | rtctmp = ts.tv_sec; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 101 | /* check for time < 0 and set to 0 */ |
| 102 | if (rtctmp < 0) |
| 103 | rtctmp = 0; |
| 104 | } |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 105 | r = proc_dointvec(table, write, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 106 | if (r) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 107 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 108 | |
| 109 | if (write) |
| 110 | rtc_mips_set_mmss(rtctmp); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | #endif |
| 115 | |
| 116 | /* Sysctl for setting the IP addresses */ |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 117 | int sysctl_lasat_intvec(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 118 | void *oldval, size_t *oldlenp, |
| 119 | void *newval, size_t newlen) |
| 120 | { |
| 121 | int r; |
| 122 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 123 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 124 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 125 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 126 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 127 | if (newval && newlen) |
| 128 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 129 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 130 | return 0; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | #ifdef CONFIG_DS1603 |
| 134 | /* Same for RTC */ |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 135 | int sysctl_lasat_rtc(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 136 | void *oldval, size_t *oldlenp, |
| 137 | void *newval, size_t newlen) |
| 138 | { |
Martin Schwidefsky | d4f587c | 2009-08-14 15:47:31 +0200 | [diff] [blame] | 139 | struct timespec ts; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 140 | int r; |
| 141 | |
Martin Schwidefsky | d4f587c | 2009-08-14 15:47:31 +0200 | [diff] [blame] | 142 | read_persistent_clock(&ts); |
| 143 | rtctmp = ts.tv_sec; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 144 | if (rtctmp < 0) |
| 145 | rtctmp = 0; |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 146 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 147 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 148 | return r; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 149 | if (newval && newlen) |
Ralf Baechle | 4b55048 | 2007-10-11 23:46:08 +0100 | [diff] [blame] | 150 | rtc_mips_set_mmss(rtctmp); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 151 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 152 | return r; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 153 | } |
| 154 | #endif |
| 155 | |
| 156 | #ifdef CONFIG_INET |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 157 | int proc_lasat_ip(ctl_table *table, int write, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 158 | void *buffer, size_t *lenp, loff_t *ppos) |
| 159 | { |
| 160 | unsigned int ip; |
| 161 | char *p, c; |
| 162 | int len; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 163 | char ipbuf[32]; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 164 | |
| 165 | if (!table->data || !table->maxlen || !*lenp || |
| 166 | (*ppos && !write)) { |
| 167 | *lenp = 0; |
| 168 | return 0; |
| 169 | } |
| 170 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 171 | if (write) { |
| 172 | len = 0; |
| 173 | p = buffer; |
| 174 | while (len < *lenp) { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 175 | if (get_user(c, p++)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 176 | return -EFAULT; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 177 | if (c == 0 || c == '\n') |
| 178 | break; |
| 179 | len++; |
| 180 | } |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 181 | if (len >= sizeof(ipbuf)-1) |
| 182 | len = sizeof(ipbuf) - 1; |
| 183 | if (copy_from_user(ipbuf, buffer, len)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 184 | return -EFAULT; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 185 | ipbuf[len] = 0; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 186 | *ppos += *lenp; |
| 187 | /* Now see if we can convert it to a valid IP */ |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 188 | ip = in_aton(ipbuf); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 189 | *(unsigned int *)(table->data) = ip; |
| 190 | lasat_write_eeprom_info(); |
| 191 | } else { |
| 192 | ip = *(unsigned int *)(table->data); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 193 | sprintf(ipbuf, "%d.%d.%d.%d", |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 194 | (ip) & 0xff, |
| 195 | (ip >> 8) & 0xff, |
| 196 | (ip >> 16) & 0xff, |
| 197 | (ip >> 24) & 0xff); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 198 | len = strlen(ipbuf); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 199 | if (len > *lenp) |
| 200 | len = *lenp; |
| 201 | if (len) |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 202 | if (copy_to_user(buffer, ipbuf, len)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 203 | return -EFAULT; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 204 | if (len < *lenp) { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 205 | if (put_user('\n', ((char *) buffer) + len)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 206 | return -EFAULT; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 207 | len++; |
| 208 | } |
| 209 | *lenp = len; |
| 210 | *ppos += len; |
| 211 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 212 | |
| 213 | return 0; |
| 214 | } |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 215 | #endif |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 216 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 217 | static int sysctl_lasat_prid(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 218 | void *oldval, size_t *oldlenp, |
| 219 | void *newval, size_t newlen) |
| 220 | { |
| 221 | int r; |
| 222 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 223 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 224 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 225 | return r; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 226 | if (newval && newlen) { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 227 | lasat_board_info.li_eeprom_info.prid = *(int *)newval; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 228 | lasat_write_eeprom_info(); |
| 229 | lasat_init_board_info(); |
| 230 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 231 | return 0; |
| 232 | } |
| 233 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 234 | int proc_lasat_prid(ctl_table *table, int write, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 235 | void *buffer, size_t *lenp, loff_t *ppos) |
| 236 | { |
| 237 | int r; |
| 238 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame^] | 239 | r = proc_dointvec(table, write, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 240 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 241 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 242 | if (write) { |
| 243 | lasat_board_info.li_eeprom_info.prid = |
| 244 | lasat_board_info.li_prid; |
| 245 | lasat_write_eeprom_info(); |
| 246 | lasat_init_board_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 247 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | extern int lasat_boot_to_service; |
| 252 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 253 | static ctl_table lasat_table[] = { |
| 254 | { |
| 255 | .ctl_name = CTL_UNNUMBERED, |
| 256 | .procname = "cpu-hz", |
| 257 | .data = &lasat_board_info.li_cpu_hz, |
| 258 | .maxlen = sizeof(int), |
| 259 | .mode = 0444, |
| 260 | .proc_handler = &proc_dointvec, |
| 261 | .strategy = &sysctl_intvec |
| 262 | }, |
| 263 | { |
| 264 | .ctl_name = CTL_UNNUMBERED, |
| 265 | .procname = "bus-hz", |
| 266 | .data = &lasat_board_info.li_bus_hz, |
| 267 | .maxlen = sizeof(int), |
| 268 | .mode = 0444, |
| 269 | .proc_handler = &proc_dointvec, |
| 270 | .strategy = &sysctl_intvec |
| 271 | }, |
| 272 | { |
| 273 | .ctl_name = CTL_UNNUMBERED, |
| 274 | .procname = "bmid", |
| 275 | .data = &lasat_board_info.li_bmid, |
| 276 | .maxlen = sizeof(int), |
| 277 | .mode = 0444, |
| 278 | .proc_handler = &proc_dointvec, |
| 279 | .strategy = &sysctl_intvec |
| 280 | }, |
| 281 | { |
| 282 | .ctl_name = CTL_UNNUMBERED, |
| 283 | .procname = "prid", |
| 284 | .data = &lasat_board_info.li_prid, |
| 285 | .maxlen = sizeof(int), |
| 286 | .mode = 0644, |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 287 | .proc_handler = &proc_lasat_prid, |
| 288 | .strategy = &sysctl_lasat_prid |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 289 | }, |
| 290 | #ifdef CONFIG_INET |
| 291 | { |
| 292 | .ctl_name = CTL_UNNUMBERED, |
| 293 | .procname = "ipaddr", |
| 294 | .data = &lasat_board_info.li_eeprom_info.ipaddr, |
| 295 | .maxlen = sizeof(int), |
| 296 | .mode = 0644, |
| 297 | .proc_handler = &proc_lasat_ip, |
| 298 | .strategy = &sysctl_lasat_intvec |
| 299 | }, |
| 300 | { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 301 | .ctl_name = CTL_UNNUMBERED, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 302 | .procname = "netmask", |
| 303 | .data = &lasat_board_info.li_eeprom_info.netmask, |
| 304 | .maxlen = sizeof(int), |
| 305 | .mode = 0644, |
| 306 | .proc_handler = &proc_lasat_ip, |
| 307 | .strategy = &sysctl_lasat_intvec |
| 308 | }, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 309 | #endif |
| 310 | { |
| 311 | .ctl_name = CTL_UNNUMBERED, |
| 312 | .procname = "passwd_hash", |
| 313 | .data = &lasat_board_info.li_eeprom_info.passwd_hash, |
| 314 | .maxlen = |
| 315 | sizeof(lasat_board_info.li_eeprom_info.passwd_hash), |
| 316 | .mode = 0600, |
| 317 | .proc_handler = &proc_dolasatstring, |
| 318 | .strategy = &sysctl_lasatstring |
| 319 | }, |
| 320 | { |
| 321 | .ctl_name = CTL_UNNUMBERED, |
| 322 | .procname = "boot-service", |
| 323 | .data = &lasat_boot_to_service, |
| 324 | .maxlen = sizeof(int), |
| 325 | .mode = 0644, |
| 326 | .proc_handler = &proc_dointvec, |
| 327 | .strategy = &sysctl_intvec |
| 328 | }, |
| 329 | #ifdef CONFIG_DS1603 |
| 330 | { |
| 331 | .ctl_name = CTL_UNNUMBERED, |
| 332 | .procname = "rtc", |
| 333 | .data = &rtctmp, |
| 334 | .maxlen = sizeof(int), |
| 335 | .mode = 0644, |
| 336 | .proc_handler = &proc_dolasatrtc, |
| 337 | .strategy = &sysctl_lasat_rtc |
| 338 | }, |
| 339 | #endif |
| 340 | { |
| 341 | .ctl_name = CTL_UNNUMBERED, |
| 342 | .procname = "namestr", |
| 343 | .data = &lasat_board_info.li_namestr, |
| 344 | .maxlen = sizeof(lasat_board_info.li_namestr), |
| 345 | .mode = 0444, |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 346 | .proc_handler = &proc_dostring, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 347 | .strategy = &sysctl_string |
| 348 | }, |
| 349 | { |
| 350 | .ctl_name = CTL_UNNUMBERED, |
| 351 | .procname = "typestr", |
| 352 | .data = &lasat_board_info.li_typestr, |
| 353 | .maxlen = sizeof(lasat_board_info.li_typestr), |
| 354 | .mode = 0444, |
| 355 | .proc_handler = &proc_dostring, |
| 356 | .strategy = &sysctl_string |
| 357 | }, |
| 358 | {} |
| 359 | }; |
| 360 | |
| 361 | static ctl_table lasat_root_table[] = { |
| 362 | { |
| 363 | .ctl_name = CTL_UNNUMBERED, |
| 364 | .procname = "lasat", |
| 365 | .mode = 0555, |
| 366 | .child = lasat_table |
| 367 | }, |
| 368 | {} |
| 369 | }; |
| 370 | |
| 371 | static int __init lasat_register_sysctl(void) |
| 372 | { |
| 373 | struct ctl_table_header *lasat_table_header; |
| 374 | |
| 375 | lasat_table_header = |
| 376 | register_sysctl_table(lasat_root_table); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 377 | if (!lasat_table_header) { |
| 378 | printk(KERN_ERR "Unable to register LASAT sysctl\n"); |
| 379 | return -ENOMEM; |
| 380 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 381 | |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | __initcall(lasat_register_sysctl); |