Deleted Added
full compact
if_ce.c (154899) if_ce.c (155065)
1/*
2 * Cronyx-Tau32-PCI adapter driver for FreeBSD.
3 *
4 * Copyright (C) 2003-2005 Cronyx Engineering.
5 * Copyright (C) 2003-2005 Kurakin Roman, <rik@FreeBSD.org>
6 *
7 * This software is distributed with NO WARRANTIES, not even the implied
8 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * Authors grant any other persons or organisations a permission to use,
11 * modify and redistribute this software in source and binary forms,
12 * as long as this message is kept with the software, all derivative
13 * works or modified versions.
14 *
15 * $Cronyx: if_ce.c,v 1.9.2.8 2005/11/21 14:17:44 rik Exp $
16 */
17
18#include <sys/cdefs.h>
1/*
2 * Cronyx-Tau32-PCI adapter driver for FreeBSD.
3 *
4 * Copyright (C) 2003-2005 Cronyx Engineering.
5 * Copyright (C) 2003-2005 Kurakin Roman, <rik@FreeBSD.org>
6 *
7 * This software is distributed with NO WARRANTIES, not even the implied
8 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * Authors grant any other persons or organisations a permission to use,
11 * modify and redistribute this software in source and binary forms,
12 * as long as this message is kept with the software, all derivative
13 * works or modified versions.
14 *
15 * $Cronyx: if_ce.c,v 1.9.2.8 2005/11/21 14:17:44 rik Exp $
16 */
17
18#include <sys/cdefs.h>
19__FBSDID("$FreeBSD: head/sys/dev/ce/if_ce.c 154899 2006-01-27 09:02:09Z rik $");
19__FBSDID("$FreeBSD: head/sys/dev/ce/if_ce.c 155065 2006-01-30 21:12:49Z rik $");
20
21#include <sys/param.h>
22
23#if __FreeBSD_version >= 500000
24# define NPCI 1
25#else
26# include "pci.h"
27#endif

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

251
252static ce_board_t *adapter [NBRD];
253static drv_t *channel [NBRD*NCHAN];
254static struct callout led_timo [NBRD];
255static struct callout timeout_handle;
256
257static int ce_destroy = 0;
258
20
21#include <sys/param.h>
22
23#if __FreeBSD_version >= 500000
24# define NPCI 1
25#else
26# include "pci.h"
27#endif

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

251
252static ce_board_t *adapter [NBRD];
253static drv_t *channel [NBRD*NCHAN];
254static struct callout led_timo [NBRD];
255static struct callout timeout_handle;
256
257static int ce_destroy = 0;
258
259#if __FreeBSD_version < 500000
260static int ce_open (dev_t dev, int oflags, int devtype, struct proc *p);
261static int ce_close (dev_t dev, int fflag, int devtype, struct proc *p);
262static int ce_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p);
263#else
264static int ce_open (struct cdev *dev, int oflags, int devtype, struct thread *td);
265static int ce_close (struct cdev *dev, int fflag, int devtype, struct thread *td);
266static int ce_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td);
267#endif
268#if __FreeBSD_version < 500000
269static struct cdevsw ce_cdevsw = {
270 ce_open, ce_close, noread, nowrite,
271 ce_ioctl, nopoll, nommap, nostrategy,
272 "ce", CDEV_MAJOR, nodump, nopsize,
273 D_NAGGED, -1
274 };
275#elif __FreeBSD_version == 500000
276static struct cdevsw ce_cdevsw = {
277 ce_open, ce_close, noread, nowrite,
278 ce_ioctl, nopoll, nommap, nostrategy,
279 "ce", CDEV_MAJOR, nodump, nopsize,
280 D_NAGGED,
281 };
282#elif __FreeBSD_version <= 501000
283static struct cdevsw ce_cdevsw = {
284 .d_open = ce_open,
285 .d_close = ce_close,
286 .d_read = noread,
287 .d_write = nowrite,
288 .d_ioctl = ce_ioctl,
289 .d_poll = nopoll,
290 .d_mmap = nommap,
291 .d_strategy = nostrategy,
292 .d_name = "ce",
293 .d_maj = CDEV_MAJOR,
294 .d_dump = nodump,
295 .d_flags = D_NAGGED,
296};
297#elif __FreeBSD_version < 502103
298static struct cdevsw ce_cdevsw = {
299 .d_open = ce_open,
300 .d_close = ce_close,
301 .d_ioctl = ce_ioctl,
302 .d_name = "ce",
303 .d_maj = CDEV_MAJOR,
304 .d_flags = D_NAGGED,
305};
306#elif __FreeBSD_version < 600000
307static struct cdevsw ce_cdevsw = {
308 .d_version = D_VERSION,
309 .d_open = ce_open,
310 .d_close = ce_close,
311 .d_ioctl = ce_ioctl,
312 .d_name = "ce",
313 .d_maj = CDEV_MAJOR,
314 .d_flags = D_NEEDGIANT,
315};
316#else /* __FreeBSD_version >= 600000 */
317static struct cdevsw ce_cdevsw = {
318 .d_version = D_VERSION,
319 .d_open = ce_open,
320 .d_close = ce_close,
321 .d_ioctl = ce_ioctl,
322 .d_name = "ce",
323 .d_flags = D_NEEDGIANT,
324};
325#endif
326
259/*
260 * Print the mbuf chain, for debug purposes only.
261 */
262static void printmbuf (struct mbuf *m)
263{
264 printf ("mbuf:");
265 for (; m; m=m->m_next) {
266 if (m->m_flags & M_PKTHDR)

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

402 }
403#else
404 sppp_input (d->ifp, m);
405#endif
406 }
407 }
408}
409
327/*
328 * Print the mbuf chain, for debug purposes only.
329 */
330static void printmbuf (struct mbuf *m)
331{
332 printf ("mbuf:");
333 for (; m; m=m->m_next) {
334 if (m->m_flags & M_PKTHDR)

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

470 }
471#else
472 sppp_input (d->ifp, m);
473#endif
474 }
475 }
476}
477
410extern struct cdevsw ce_cdevsw;
411
412#if __FreeBSD_version >= 500000
413static void
414ce_bus_dmamap_addr (void *arg, bus_dma_segment_t *segs, int nseg, int error)
415{
416 unsigned long *addr;
417
418 if (error)
419 return;

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

1933
1934 case TIOCMGET: /* Get modem status */
1935 *(int*)data = ce_modem_status (c);
1936 return 0;
1937 }
1938 return ENOTTY;
1939}
1940
478#if __FreeBSD_version >= 500000
479static void
480ce_bus_dmamap_addr (void *arg, bus_dma_segment_t *segs, int nseg, int error)
481{
482 unsigned long *addr;
483
484 if (error)
485 return;

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

1999
2000 case TIOCMGET: /* Get modem status */
2001 *(int*)data = ce_modem_status (c);
2002 return 0;
2003 }
2004 return ENOTTY;
2005}
2006
1941#if __FreeBSD_version < 500000
1942static struct cdevsw ce_cdevsw = {
1943 ce_open, ce_close, noread, nowrite,
1944 ce_ioctl, nopoll, nommap, nostrategy,
1945 "ce", CDEV_MAJOR, nodump, nopsize,
1946 D_NAGGED, -1
1947 };
1948#elif __FreeBSD_version == 500000
1949static struct cdevsw ce_cdevsw = {
1950 ce_open, ce_close, noread, nowrite,
1951 ce_ioctl, nopoll, nommap, nostrategy,
1952 "ce", CDEV_MAJOR, nodump, nopsize,
1953 D_NAGGED,
1954 };
1955#elif __FreeBSD_version <= 501000
1956static struct cdevsw ce_cdevsw = {
1957 .d_open = ce_open,
1958 .d_close = ce_close,
1959 .d_read = noread,
1960 .d_write = nowrite,
1961 .d_ioctl = ce_ioctl,
1962 .d_poll = nopoll,
1963 .d_mmap = nommap,
1964 .d_strategy = nostrategy,
1965 .d_name = "ce",
1966 .d_maj = CDEV_MAJOR,
1967 .d_dump = nodump,
1968 .d_flags = D_NAGGED,
1969};
1970#elif __FreeBSD_version < 502103
1971static struct cdevsw ce_cdevsw = {
1972 .d_open = ce_open,
1973 .d_close = ce_close,
1974 .d_ioctl = ce_ioctl,
1975 .d_name = "ce",
1976 .d_maj = CDEV_MAJOR,
1977 .d_flags = D_NAGGED,
1978};
1979#elif __FreeBSD_version < 600000
1980static struct cdevsw ce_cdevsw = {
1981 .d_version = D_VERSION,
1982 .d_open = ce_open,
1983 .d_close = ce_close,
1984 .d_ioctl = ce_ioctl,
1985 .d_name = "ce",
1986 .d_maj = CDEV_MAJOR,
1987 .d_flags = D_NEEDGIANT,
1988};
1989#else /* __FreeBSD_version >= 600000 */
1990static struct cdevsw ce_cdevsw = {
1991 .d_version = D_VERSION,
1992 .d_open = ce_open,
1993 .d_close = ce_close,
1994 .d_ioctl = ce_ioctl,
1995 .d_name = "ce",
1996 .d_flags = D_NEEDGIANT,
1997};
1998#endif
1999
2000#ifdef NETGRAPH
2001#if __FreeBSD_version >= 500000
2002static int ng_ce_constructor (node_p node)
2003{
2004 drv_t *d = NG_NODE_PRIVATE (node);
2005#else
2006static int ng_ce_constructor (node_p *node)
2007{

--- 674 unchanged lines hidden ---
2007#ifdef NETGRAPH
2008#if __FreeBSD_version >= 500000
2009static int ng_ce_constructor (node_p node)
2010{
2011 drv_t *d = NG_NODE_PRIVATE (node);
2012#else
2013static int ng_ce_constructor (node_p *node)
2014{

--- 674 unchanged lines hidden ---