Deleted Added
full compact
if_cp.c (130971) if_cp.c (130985)
1/*
2 * Cronyx-Tau-PCI adapter driver for FreeBSD.
3 * Supports PPP/HDLC, Cisco/HDLC and FrameRelay protocol in synchronous mode,
4 * and asyncronous channels with full modem control.
5 * Keepalive protocol implemented in both Cisco and PPP modes.
6 *
7 * Copyright (C) 1999-2004 Cronyx Engineering.
8 * Author: Kurakin Roman, <rik@cronyx.ru>

--- 4 unchanged lines hidden (view full) ---

13 * This software is distributed with NO WARRANTIES, not even the implied
14 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * Authors grant any other persons or organisations a permission to use,
17 * modify and redistribute this software in source and binary forms,
18 * as long as this message is kept with the software, all derivative
19 * works or modified versions.
20 *
1/*
2 * Cronyx-Tau-PCI adapter driver for FreeBSD.
3 * Supports PPP/HDLC, Cisco/HDLC and FrameRelay protocol in synchronous mode,
4 * and asyncronous channels with full modem control.
5 * Keepalive protocol implemented in both Cisco and PPP modes.
6 *
7 * Copyright (C) 1999-2004 Cronyx Engineering.
8 * Author: Kurakin Roman, <rik@cronyx.ru>

--- 4 unchanged lines hidden (view full) ---

13 * This software is distributed with NO WARRANTIES, not even the implied
14 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * Authors grant any other persons or organisations a permission to use,
17 * modify and redistribute this software in source and binary forms,
18 * as long as this message is kept with the software, all derivative
19 * works or modified versions.
20 *
21 * $Cronyx: if_cp.c,v 1.1.2.32 2004/02/26 17:56:39 rik Exp $
21 * Cronyx Id: if_cp.c,v 1.1.2.41 2004/06/23 17:09:13 rik Exp $
22 */
23
24#include <sys/cdefs.h>
22 */
23
24#include <sys/cdefs.h>
25__FBSDID("$FreeBSD: head/sys/dev/cp/if_cp.c 130971 2004-06-23 11:23:54Z rik $");
25__FBSDID("$FreeBSD: head/sys/dev/cp/if_cp.c 130985 2004-06-23 18:13:10Z rik $");
26
27#include <sys/param.h>
28
29#if __FreeBSD_version >= 500000
30# define NPCI 1
31#else
32# include "pci.h"
33#endif

--- 27 unchanged lines hidden (view full) ---

61#include "opt_ng_cronyx.h"
62#ifdef NETGRAPH_CRONYX
63# include "opt_netgraph.h"
64# ifndef NETGRAPH
65# error #option NETGRAPH missed from configuration
66# endif
67# include <netgraph/ng_message.h>
68# include <netgraph/netgraph.h>
26
27#include <sys/param.h>
28
29#if __FreeBSD_version >= 500000
30# define NPCI 1
31#else
32# include "pci.h"
33#endif

--- 27 unchanged lines hidden (view full) ---

61#include "opt_ng_cronyx.h"
62#ifdef NETGRAPH_CRONYX
63# include "opt_netgraph.h"
64# ifndef NETGRAPH
65# error #option NETGRAPH missed from configuration
66# endif
67# include <netgraph/ng_message.h>
68# include <netgraph/netgraph.h>
69# if __FreeBSD_version >= 500000
70# include <dev/cp/ng_cp.h>
71# else
72# include <netgraph/ng_cp.h>
73# endif
69# include <dev/cp/ng_cp.h>
74#else
75# include <net/if_sppp.h>
76# define PP_CISCO IFF_LINK2
77# if __FreeBSD_version < 500000
78# include <bpf.h>
79# endif
80# include <net/bpf.h>
81# define NBPFILTER NBPF
82#endif
70#else
71# include <net/if_sppp.h>
72# define PP_CISCO IFF_LINK2
73# if __FreeBSD_version < 500000
74# include <bpf.h>
75# endif
76# include <net/bpf.h>
77# define NBPFILTER NBPF
78#endif
83#if __FreeBSD_version >= 500000
84#include <dev/cx/machdep.h>
85#include <dev/cp/cpddk.h>
79#include <dev/cx/machdep.h>
80#include <dev/cp/cpddk.h>
86#else
87#include <i386/isa/cronyx/machdep.h>
88#include <pci/cpddk.h>
89#endif
90#include <machine/cserial.h>
91#include <machine/resource.h>
92#include <machine/pmap.h>
93
94/* If we don't have Cronyx's sppp version, we don't have fr support via sppp */
95#ifndef PP_FR
96#define PP_FR 0
97#endif

--- 13 unchanged lines hidden (view full) ---

111 /* Device interface */
112 DEVMETHOD(device_probe, cp_probe),
113 DEVMETHOD(device_attach, cp_attach),
114 DEVMETHOD(device_detach, cp_detach),
115
116 {0, 0}
117};
118
81#include <machine/cserial.h>
82#include <machine/resource.h>
83#include <machine/pmap.h>
84
85/* If we don't have Cronyx's sppp version, we don't have fr support via sppp */
86#ifndef PP_FR
87#define PP_FR 0
88#endif

--- 13 unchanged lines hidden (view full) ---

102 /* Device interface */
103 DEVMETHOD(device_probe, cp_probe),
104 DEVMETHOD(device_attach, cp_attach),
105 DEVMETHOD(device_detach, cp_detach),
106
107 {0, 0}
108};
109
119typedef struct _bdrv_t {
120 cp_board_t *board;
121 struct resource *cp_res;
122 struct resource *cp_irq;
123 void *cp_intrhand;
124} bdrv_t;
110typedef struct _cp_dma_mem_t {
111 unsigned long phys;
112 void *virt;
113 size_t size;
114#if __FreeBSD_version >= 500000
115 bus_dma_tag_t dmat;
116 bus_dmamap_t mapp;
117#endif
118} cp_dma_mem_t;
125
119
126static driver_t cp_driver = {
127 "cp",
128 cp_methods,
129 sizeof(bdrv_t),
130};
131
132static devclass_t cp_devclass;
133
134typedef struct _drv_t {
135 char name [8];
136 cp_chan_t *chan;
137 cp_board_t *board;
120typedef struct _drv_t {
121 char name [8];
122 cp_chan_t *chan;
123 cp_board_t *board;
138 cp_buf_t buf;
124 cp_dma_mem_t dmamem;
139 int running;
140#ifdef NETGRAPH
141 char nodename [NG_NODELEN+1];
142 hook_p hook;
143 hook_p debug_hook;
144 node_p node;
145 struct ifqueue queue;
146 struct ifqueue hi_queue;
147 short timeout;
148 struct callout_handle timeout_handle;
149#else
150 struct sppp pp;
151#endif
152 struct cdev *devt;
153} drv_t;
154
125 int running;
126#ifdef NETGRAPH
127 char nodename [NG_NODELEN+1];
128 hook_p hook;
129 hook_p debug_hook;
130 node_p node;
131 struct ifqueue queue;
132 struct ifqueue hi_queue;
133 short timeout;
134 struct callout_handle timeout_handle;
135#else
136 struct sppp pp;
137#endif
138 struct cdev *devt;
139} drv_t;
140
141typedef struct _bdrv_t {
142 cp_board_t *board;
143 struct resource *cp_res;
144 struct resource *cp_irq;
145 void *cp_intrhand;
146 cp_dma_mem_t dmamem;
147 drv_t channel [NCHAN];
148} bdrv_t;
149
150static driver_t cp_driver = {
151 "cp",
152 cp_methods,
153 sizeof(bdrv_t),
154};
155
156static devclass_t cp_devclass;
157
155static void cp_receive (cp_chan_t *c, unsigned char *data, int len);
156static void cp_transmit (cp_chan_t *c, void *attachment, int len);
157static void cp_error (cp_chan_t *c, int data);
158static void cp_up (drv_t *d);
159static void cp_start (drv_t *d);
160static void cp_down (drv_t *d);
161static void cp_watchdog (drv_t *d);
162#ifdef NETGRAPH

--- 4 unchanged lines hidden (view full) ---

167static void cp_tls (struct sppp *sp);
168static void cp_ifwatchdog (struct ifnet *ifp);
169static int cp_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);
170static void cp_initialize (void *softc);
171#endif
172
173static cp_board_t *adapter [NBRD];
174static drv_t *channel [NBRD*NCHAN];
158static void cp_receive (cp_chan_t *c, unsigned char *data, int len);
159static void cp_transmit (cp_chan_t *c, void *attachment, int len);
160static void cp_error (cp_chan_t *c, int data);
161static void cp_up (drv_t *d);
162static void cp_start (drv_t *d);
163static void cp_down (drv_t *d);
164static void cp_watchdog (drv_t *d);
165#ifdef NETGRAPH

--- 4 unchanged lines hidden (view full) ---

170static void cp_tls (struct sppp *sp);
171static void cp_ifwatchdog (struct ifnet *ifp);
172static int cp_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);
173static void cp_initialize (void *softc);
174#endif
175
176static cp_board_t *adapter [NBRD];
177static drv_t *channel [NBRD*NCHAN];
175static cp_qbuf_t *queue [NBRD];
176static struct callout_handle led_timo [NBRD];
177static struct callout_handle timeout_handle;
178
179static int cp_destroy = 0;
180
181/*
182 * Print the mbuf chain, for debug purposes only.
183 */

--- 109 unchanged lines hidden (view full) ---

293 /* Turn LED off 50 msec later. */
294 if (!led_timo[b->num].callout)
295 led_timo[b->num] = timeout (cp_led_off, b, hz/20);
296 splx (s);
297}
298
299extern struct cdevsw cp_cdevsw;
300
178static struct callout_handle led_timo [NBRD];
179static struct callout_handle timeout_handle;
180
181static int cp_destroy = 0;
182
183/*
184 * Print the mbuf chain, for debug purposes only.
185 */

--- 109 unchanged lines hidden (view full) ---

295 /* Turn LED off 50 msec later. */
296 if (!led_timo[b->num].callout)
297 led_timo[b->num] = timeout (cp_led_off, b, hz/20);
298 splx (s);
299}
300
301extern struct cdevsw cp_cdevsw;
302
303#if __FreeBSD_version >= 500000
304static void
305cp_bus_dmamap_addr (void *arg, bus_dma_segment_t *segs, int nseg, int error)
306{
307 unsigned long *addr;
308
309 if (error)
310 return;
311
312 KASSERT(nseg == 1, ("too many DMA segments, %d should be 1", nseg));
313 addr = arg;
314 *addr = segs->ds_addr;
315}
316
317static int
318cp_bus_dma_mem_alloc (int bnum, int cnum, cp_dma_mem_t *dmem)
319{
320 int error;
321
322 error = bus_dma_tag_create (NULL, 16, 0, BUS_SPACE_MAXADDR_32BIT,
323 BUS_SPACE_MAXADDR, NULL, NULL, dmem->size, 1,
324 dmem->size, 0, NULL, NULL, &dmem->dmat);
325 if (error) {
326 if (cnum >= 0) printf ("cp%d-%d: ", bnum, cnum);
327 else printf ("cp%d: ", bnum);
328 printf ("couldn't allocate tag for dma memory\n");
329 return 0;
330 }
331 error = bus_dmamem_alloc (dmem->dmat, (void **)&dmem->virt,
332 BUS_DMA_NOWAIT | BUS_DMA_ZERO, &dmem->mapp);
333 if (error) {
334 if (cnum >= 0) printf ("cp%d-%d: ", bnum, cnum);
335 else printf ("cp%d: ", bnum);
336 printf ("couldn't allocate mem for dma memory\n");
337 bus_dma_tag_destroy (dmem->dmat);
338 return 0;
339 }
340 error = bus_dmamap_load (dmem->dmat, dmem->mapp, dmem->virt,
341 dmem->size, cp_bus_dmamap_addr, &dmem->phys, 0);
342 if (error) {
343 if (cnum >= 0) printf ("cp%d-%d: ", bnum, cnum);
344 else printf ("cp%d: ", bnum);
345 printf ("couldn't load mem map for dma memory\n");
346 bus_dmamem_free (dmem->dmat, dmem->virt, dmem->mapp);
347 bus_dma_tag_destroy (dmem->dmat);
348 return 0;
349 }
350 return 1;
351}
352
353static void
354cp_bus_dma_mem_free (cp_dma_mem_t *dmem)
355{
356 bus_dmamap_unload (dmem->dmat, dmem->mapp);
357 bus_dmamem_free (dmem->dmat, dmem->virt, dmem->mapp);
358 bus_dma_tag_destroy (dmem->dmat);
359}
360#else
361static int
362cp_bus_dma_mem_alloc (int bnum, int cnum, cp_dma_mem_t *dmem)
363{
364 dmem->virt = contigmalloc (dmem->size, M_DEVBUF, M_WAITOK,
365 0x100000, 0xffffffff, 16, 0);
366 if (dmem->virt == NULL) {
367 if (cnum >= 0) printf ("cp%d-%d: ", bnum, cnum);
368 else printf ("cp%d: ", bnum);
369 printf ("couldn't allocate memory for dma memory\n", unit);
370 return 0;
371 }
372 dmem->phys = vtophys (dmem->virt);
373 return 1;
374}
375
376static void
377cp_bus_dma_mem_free (cp_dma_mem_t *dmem)
378{
379 contigfree (dmem->virt, dmem->size, M_DEVBUF);
380}
381#endif
382
301/*
302 * Called if the probe succeeded.
303 */
304static int cp_attach (device_t dev)
305{
306 bdrv_t *bd = device_get_softc (dev);
307 int unit = device_get_unit (dev);
383/*
384 * Called if the probe succeeded.
385 */
386static int cp_attach (device_t dev)
387{
388 bdrv_t *bd = device_get_softc (dev);
389 int unit = device_get_unit (dev);
308 int rid, error;
390 unsigned short res;
309 vm_offset_t vbase;
391 vm_offset_t vbase;
310 cp_board_t *b;
392 int rid, error;
393 cp_board_t *b;
311 cp_chan_t *c;
394 cp_chan_t *c;
312 drv_t *d;
313 unsigned short res;
395 drv_t *d;
314 int s = splimp ();
315
316 b = malloc (sizeof(cp_board_t), M_DEVBUF, M_WAITOK);
317 if (!b) {
318 printf ("cp%d: couldn't allocate memory\n", unit);
319 splx (s);
320 return (ENXIO);
321 }

--- 16 unchanged lines hidden (view full) ---

338 res = cp_init (b, unit, (u_char*) vbase);
339 if (res) {
340 printf ("cp%d: can't init, error code:%x\n", unit, res);
341 bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->cp_res);
342 free (b, M_DEVBUF);
343 splx (s);
344 return (ENXIO);
345 }
396 int s = splimp ();
397
398 b = malloc (sizeof(cp_board_t), M_DEVBUF, M_WAITOK);
399 if (!b) {
400 printf ("cp%d: couldn't allocate memory\n", unit);
401 splx (s);
402 return (ENXIO);
403 }

--- 16 unchanged lines hidden (view full) ---

420 res = cp_init (b, unit, (u_char*) vbase);
421 if (res) {
422 printf ("cp%d: can't init, error code:%x\n", unit, res);
423 bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->cp_res);
424 free (b, M_DEVBUF);
425 splx (s);
426 return (ENXIO);
427 }
346 queue[unit] = contigmalloc (sizeof(cp_qbuf_t), M_DEVBUF, M_WAITOK,
347 0x100000, 0xffffffff, 16, 0);
348 if (queue[unit] == NULL) {
349 printf ("cp%d: allocate memory for qbuf_t\n", unit);
428
429 bd->dmamem.size = sizeof(cp_qbuf_t);
430 if (! cp_bus_dma_mem_alloc (unit, -1, &bd->dmamem)) {
350 free (b, M_DEVBUF);
351 splx (s);
352 return (ENXIO);
353 }
431 free (b, M_DEVBUF);
432 splx (s);
433 return (ENXIO);
434 }
354 cp_reset (b, queue[unit], vtophys (queue[unit]));
435 cp_reset (b, bd->dmamem.virt, bd->dmamem.phys);
355
356 rid = 0;
357 bd->cp_irq = bus_alloc_resource (dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
358 RF_SHAREABLE | RF_ACTIVE);
359 if (! bd->cp_irq) {
360 printf ("cp%d: cannot map interrupt\n", unit);
361 bus_release_resource (dev, SYS_RES_MEMORY,
362 PCIR_BAR(0), bd->cp_res);

--- 12 unchanged lines hidden (view full) ---

375 splx (s);
376 return (ENXIO);
377 }
378 printf ("cp%d: %s, clock %ld MHz\n", unit, b->name, b->osc / 1000000);
379
380 for (c=b->chan; c<b->chan+NCHAN; ++c) {
381 if (! c->type)
382 continue;
436
437 rid = 0;
438 bd->cp_irq = bus_alloc_resource (dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
439 RF_SHAREABLE | RF_ACTIVE);
440 if (! bd->cp_irq) {
441 printf ("cp%d: cannot map interrupt\n", unit);
442 bus_release_resource (dev, SYS_RES_MEMORY,
443 PCIR_BAR(0), bd->cp_res);

--- 12 unchanged lines hidden (view full) ---

456 splx (s);
457 return (ENXIO);
458 }
459 printf ("cp%d: %s, clock %ld MHz\n", unit, b->name, b->osc / 1000000);
460
461 for (c=b->chan; c<b->chan+NCHAN; ++c) {
462 if (! c->type)
463 continue;
383 d = contigmalloc (sizeof(drv_t), M_DEVBUF, M_WAITOK,
384 0x100000, 0xffffffff, 16, 0);
385 if (d == NULL) {
386 printf ("cp%d-%d: cannot allocate memory for drv_t\n",
387 unit, c->num);
388 }
464 d = &bd->channel[c->num];
465 d->dmamem.size = sizeof(cp_buf_t);
466 if (! cp_bus_dma_mem_alloc (unit, c->num, &d->dmamem))
467 continue;
389 channel [b->num*NCHAN + c->num] = d;
468 channel [b->num*NCHAN + c->num] = d;
390 bzero (d, sizeof(drv_t));
391 sprintf (d->name, "cp%d.%d", b->num, c->num);
392 d->board = b;
393 d->chan = c;
394 c->sys = d;
395#ifdef NETGRAPH
396 if (ng_make_node_common (&typestruct, &d->node) != 0) {
397 printf ("%s: cannot make common node\n", d->name);
398 d->node = NULL;

--- 40 unchanged lines hidden (view full) ---

439 if_attach (&d->pp.pp_if);
440 d->pp.pp_tlf = cp_tlf;
441 d->pp.pp_tls = cp_tls;
442 /* If BPF is in the kernel, call the attach for it.
443 * The header size of PPP or Cisco/HDLC is 4 bytes. */
444 bpfattach (&d->pp.pp_if, DLT_PPP, 4);
445#endif /*NETGRAPH*/
446 cp_start_e1 (c);
469 sprintf (d->name, "cp%d.%d", b->num, c->num);
470 d->board = b;
471 d->chan = c;
472 c->sys = d;
473#ifdef NETGRAPH
474 if (ng_make_node_common (&typestruct, &d->node) != 0) {
475 printf ("%s: cannot make common node\n", d->name);
476 d->node = NULL;

--- 40 unchanged lines hidden (view full) ---

517 if_attach (&d->pp.pp_if);
518 d->pp.pp_tlf = cp_tlf;
519 d->pp.pp_tls = cp_tls;
520 /* If BPF is in the kernel, call the attach for it.
521 * The header size of PPP or Cisco/HDLC is 4 bytes. */
522 bpfattach (&d->pp.pp_if, DLT_PPP, 4);
523#endif /*NETGRAPH*/
524 cp_start_e1 (c);
447 cp_start_chan (c, 1, 1, &d->buf, vtophys (&d->buf));
525 cp_start_chan (c, 1, 1, d->dmamem.virt, d->dmamem.phys);
448
449 /* Register callback functions. */
450 cp_register_transmit (c, &cp_transmit);
451 cp_register_receive (c, &cp_receive);
452 cp_register_error (c, &cp_error);
453 d->devt = make_dev (&cp_cdevsw, b->num*NCHAN+c->num, UID_ROOT,
454 GID_WHEEL, 0600, "cp%d", b->num*NCHAN+c->num);
455 }

--- 87 unchanged lines hidden (view full) ---

543 s = splimp ();
544 for (c=b->chan; c<b->chan+NCHAN; ++c) {
545 drv_t *d = (drv_t*) c->sys;
546
547 if (! d || ! d->chan->type)
548 continue;
549 channel [b->num*NCHAN + c->num] = 0;
550 /* Deallocate buffers. */
526
527 /* Register callback functions. */
528 cp_register_transmit (c, &cp_transmit);
529 cp_register_receive (c, &cp_receive);
530 cp_register_error (c, &cp_error);
531 d->devt = make_dev (&cp_cdevsw, b->num*NCHAN+c->num, UID_ROOT,
532 GID_WHEEL, 0600, "cp%d", b->num*NCHAN+c->num);
533 }

--- 87 unchanged lines hidden (view full) ---

621 s = splimp ();
622 for (c=b->chan; c<b->chan+NCHAN; ++c) {
623 drv_t *d = (drv_t*) c->sys;
624
625 if (! d || ! d->chan->type)
626 continue;
627 channel [b->num*NCHAN + c->num] = 0;
628 /* Deallocate buffers. */
551 contigfree (d, sizeof (*d), M_DEVBUF);
629 cp_bus_dma_mem_free (&d->dmamem);
552 }
553 adapter [b->num] = 0;
630 }
631 adapter [b->num] = 0;
554 contigfree (queue[b->num], sizeof (cp_qbuf_t), M_DEVBUF);
632 cp_bus_dma_mem_free (&bd->dmamem);
555 free (b, M_DEVBUF);
556 splx (s);
557 return 0;
558}
559
560#ifndef NETGRAPH
561static void cp_ifstart (struct ifnet *ifp)
562{

--- 1758 unchanged lines hidden (view full) ---

2321 splx (s);
2322 }
2323 untimeout (ng_cp_watchdog, d, d->timeout_handle);
2324 }
2325 return 0;
2326}
2327#endif
2328
633 free (b, M_DEVBUF);
634 splx (s);
635 return 0;
636}
637
638#ifndef NETGRAPH
639static void cp_ifstart (struct ifnet *ifp)
640{

--- 1758 unchanged lines hidden (view full) ---

2399 splx (s);
2400 }
2401 untimeout (ng_cp_watchdog, d, d->timeout_handle);
2402 }
2403 return 0;
2404}
2405#endif
2406
2329
2330static int cp_modevent (module_t mod, int type, void *unused)
2331{
2332 struct cdev *dev;
2333 static int load_count = 0;
2334 struct cdevsw *cdsw;
2335
2336#if __FreeBSD_version >= 502103
2337 dev = findcdev (makedev(CDEV_MAJOR, 0));

--- 57 unchanged lines hidden (view full) ---

2395#else
2396MODULE_DEPEND (cp, sppp, 1, 1, 1);
2397#endif
2398#ifdef KLD_MODULE
2399DRIVER_MODULE (cpmod, pci, cp_driver, cp_devclass, cp_modevent, NULL);
2400#else
2401DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL);
2402#endif
2407static int cp_modevent (module_t mod, int type, void *unused)
2408{
2409 struct cdev *dev;
2410 static int load_count = 0;
2411 struct cdevsw *cdsw;
2412
2413#if __FreeBSD_version >= 502103
2414 dev = findcdev (makedev(CDEV_MAJOR, 0));

--- 57 unchanged lines hidden (view full) ---

2472#else
2473MODULE_DEPEND (cp, sppp, 1, 1, 1);
2474#endif
2475#ifdef KLD_MODULE
2476DRIVER_MODULE (cpmod, pci, cp_driver, cp_devclass, cp_modevent, NULL);
2477#else
2478DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL);
2479#endif
2403#elif __FreeBSD_version >= 400000
2480#elif __FreeBSD_version >= 400000
2404#ifdef NETGRAPH
2405DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, ng_mod_event, &typestruct);
2406#else
2407DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL);
2408#endif
2409#endif /* __FreeBSD_version >= 400000 */
2410#endif /* NPCI */
2481#ifdef NETGRAPH
2482DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, ng_mod_event, &typestruct);
2483#else
2484DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL);
2485#endif
2486#endif /* __FreeBSD_version >= 400000 */
2487#endif /* NPCI */