if_mn.c (70068) | if_mn.c (70159) |
---|---|
1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * --- 7 unchanged lines hidden (view full) --- 16 * The driver supports E1 mode with up to 31 channels. We send CRC4 but don't 17 * check it coming in. 18 * 19 * The FALC54 and MUNICH32X have far too many registers and weird modes for 20 * comfort, so I have not bothered typing it all into a "fooreg.h" file, 21 * you will (badly!) need the documentation anyway if you want to mess with 22 * this gadget. 23 * | 1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * --- 7 unchanged lines hidden (view full) --- 16 * The driver supports E1 mode with up to 31 channels. We send CRC4 but don't 17 * check it coming in. 18 * 19 * The FALC54 and MUNICH32X have far too many registers and weird modes for 20 * comfort, so I have not bothered typing it all into a "fooreg.h" file, 21 * you will (badly!) need the documentation anyway if you want to mess with 22 * this gadget. 23 * |
24 * $FreeBSD: head/sys/pci/if_mn.c 70068 2000-12-15 21:06:55Z bmilekic $ | 24 * $FreeBSD: head/sys/pci/if_mn.c 70159 2000-12-18 20:03:32Z julian $ |
25 */ 26 27/* 28 * Stuff to describe the MUNIC32X and FALC54 chips. 29 */ 30 31#define M32_CHAN 32 /* We have 32 channels */ 32#define M32_TS 32 /* We have 32 timeslots */ --- 149 unchanged lines hidden (view full) --- 182static ng_rcvmsg_t ngmn_rcvmsg; 183static ng_shutdown_t ngmn_shutdown; 184static ng_newhook_t ngmn_newhook; 185static ng_connect_t ngmn_connect; 186static ng_rcvdata_t ngmn_rcvdata; 187static ng_disconnect_t ngmn_disconnect; 188 189static struct ng_type mntypestruct = { | 25 */ 26 27/* 28 * Stuff to describe the MUNIC32X and FALC54 chips. 29 */ 30 31#define M32_CHAN 32 /* We have 32 channels */ 32#define M32_TS 32 /* We have 32 timeslots */ --- 149 unchanged lines hidden (view full) --- 182static ng_rcvmsg_t ngmn_rcvmsg; 183static ng_shutdown_t ngmn_shutdown; 184static ng_newhook_t ngmn_newhook; 185static ng_connect_t ngmn_connect; 186static ng_rcvdata_t ngmn_rcvdata; 187static ng_disconnect_t ngmn_disconnect; 188 189static struct ng_type mntypestruct = { |
190 NG_VERSION, | 190 NG_ABI_VERSION, |
191 NG_MN_NODE_TYPE, 192 NULL, 193 ngmn_constructor, 194 ngmn_rcvmsg, 195 ngmn_shutdown, 196 ngmn_newhook, 197 NULL, 198 ngmn_connect, --- 77 unchanged lines hidden (view full) --- 276static int 277ngmn_shutdown(node_p nodep) 278{ 279 280 return (EINVAL); 281} 282 283static int | 191 NG_MN_NODE_TYPE, 192 NULL, 193 ngmn_constructor, 194 ngmn_rcvmsg, 195 ngmn_shutdown, 196 ngmn_newhook, 197 NULL, 198 ngmn_connect, --- 77 unchanged lines hidden (view full) --- 276static int 277ngmn_shutdown(node_p nodep) 278{ 279 280 return (EINVAL); 281} 282 283static int |
284ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mesg **resp, hook_p lasthook) | 284ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, 285 struct ng_mesg **rptr, hook_p lasthook) |
285{ 286 struct softc *sc; | 286{ 287 struct softc *sc; |
288 struct ng_mesg *resp = NULL; |
|
287 struct schan *sch; 288 char *arg; 289 int pos, i; 290 291 sc = node->private; 292 293 if (msg->header.typecookie != NGM_GENERIC_COOKIE || | 289 struct schan *sch; 290 char *arg; 291 int pos, i; 292 293 sc = node->private; 294 295 if (msg->header.typecookie != NGM_GENERIC_COOKIE || |
296 rptr == NULL || /* temporary */ |
|
294 msg->header.cmd != NGM_TEXT_STATUS) { | 297 msg->header.cmd != NGM_TEXT_STATUS) { |
295 if (resp) 296 *resp = NULL; | 298 if (rptr) 299 *rptr = NULL; |
297 FREE(msg, M_NETGRAPH); 298 return (EINVAL); 299 } | 300 FREE(msg, M_NETGRAPH); 301 return (EINVAL); 302 } |
300 NG_MKRESPONSE(*resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, | 303 NG_MKRESPONSE(resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, |
301 M_NOWAIT); | 304 M_NOWAIT); |
302 if (*resp == NULL) { | 305 if (resp == NULL) { |
303 FREE(msg, M_NETGRAPH); 304 return (ENOMEM); 305 } | 306 FREE(msg, M_NETGRAPH); 307 return (ENOMEM); 308 } |
306 arg = (char *)(*resp)->data; | 309 arg = (char *)resp->data; |
307 pos = 0; 308 pos += sprintf(pos + arg,"Framer status %b;\n", sc->framer_state, "\20" 309 "\40LOS\37AIS\36LFA\35RRA" 310 "\34AUXP\33NMF\32LMFA\31frs0.0" 311 "\30frs1.7\27TS16RA\26TS16LOS\25TS16AIS" 312 "\24TS16LFA\23frs1.2\22XLS\21XLO" 313 "\20RS1\17rsw.6\16RRA\15RY0" 314 "\14RY1\13RY2\12RY3\11RY4" --- 51 unchanged lines hidden (view full) --- 366 pos += sprintf(arg + pos, " Overflow: %lu\n", sch->overflow_error); 367 368 pos += sprintf(arg + pos, " Last error: %b Prev error: %b\n", 369 sch->last_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN", 370 sch->prev_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN"); 371 pos += sprintf(arg + pos, " Xmit bytes pending %ld\n", 372 sch->tx_pending); 373 } | 310 pos = 0; 311 pos += sprintf(pos + arg,"Framer status %b;\n", sc->framer_state, "\20" 312 "\40LOS\37AIS\36LFA\35RRA" 313 "\34AUXP\33NMF\32LMFA\31frs0.0" 314 "\30frs1.7\27TS16RA\26TS16LOS\25TS16AIS" 315 "\24TS16LFA\23frs1.2\22XLS\21XLO" 316 "\20RS1\17rsw.6\16RRA\15RY0" 317 "\14RY1\13RY2\12RY3\11RY4" --- 51 unchanged lines hidden (view full) --- 369 pos += sprintf(arg + pos, " Overflow: %lu\n", sch->overflow_error); 370 371 pos += sprintf(arg + pos, " Last error: %b Prev error: %b\n", 372 sch->last_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN", 373 sch->prev_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN"); 374 pos += sprintf(arg + pos, " Xmit bytes pending %ld\n", 375 sch->tx_pending); 376 } |
374 (*resp)->header.arglen = pos + 1; | 377 resp->header.arglen = pos + 1; 378 379 /* Take care of synchronous response, if any */ 380 if (rptr) 381 *rptr = resp; 382 else if (resp) 383 FREE(resp, M_NETGRAPH); /* Will eventually send the hard way */ 384 |
375 FREE(msg, M_NETGRAPH); 376 return (0); 377} 378 379static int 380ngmn_newhook(node_p node, hook_p hook, const char *name) 381{ 382 u_int32_t ts, chan; --- 989 unchanged lines hidden --- | 385 FREE(msg, M_NETGRAPH); 386 return (0); 387} 388 389static int 390ngmn_newhook(node_p node, hook_p hook, const char *name) 391{ 392 u_int32_t ts, chan; --- 989 unchanged lines hidden --- |