Deleted Added
full compact
if_ce.c (276750) if_ce.c (283291)
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 276750 2015-01-06 12:59:37Z rwatson $");
19__FBSDID("$FreeBSD: head/sys/dev/ce/if_ce.c 283291 2015-05-22 17:05:21Z jkim $");
20
21#include <sys/param.h>
22
23#if __FreeBSD_version >= 500000
24# define NPCI 1
25#else
26# include "pci.h"
27#endif

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

99#define BUS_PROBE_DEFAULT 0
100#endif
101
102#define CE_DEBUG(d,s) ({if (d->chan->debug) {\
103 printf ("%s: ", d->name); printf s;}})
104#define CE_DEBUG2(d,s) ({if (d->chan->debug>1) {\
105 printf ("%s: ", d->name); printf s;}})
106
20
21#include <sys/param.h>
22
23#if __FreeBSD_version >= 500000
24# define NPCI 1
25#else
26# include "pci.h"
27#endif

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

99#define BUS_PROBE_DEFAULT 0
100#endif
101
102#define CE_DEBUG(d,s) ({if (d->chan->debug) {\
103 printf ("%s: ", d->name); printf s;}})
104#define CE_DEBUG2(d,s) ({if (d->chan->debug>1) {\
105 printf ("%s: ", d->name); printf s;}})
106
107#ifndef CALLOUT_MPSAFE
108#define CALLOUT_MPSAFE 0
109#endif
110
111#ifndef IF_DRAIN
112#define IF_DRAIN(ifq) do { \
113 struct mbuf *m; \
114 for (;;) { \
115 IF_DEQUEUE(ifq, m); \
116 if (m == NULL) \
117 break; \
118 m_freem(m); \

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

604 printf ("ce%d: cannot map interrupt\n", unit);
605 bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->ce_res);
606 ce_bus_dma_mem_free (&bd->dmamem);
607 free (b, M_DEVBUF);
608 splx (s);
609 return (ENXIO);
610 }
611#if __FreeBSD_version >= 500000
107#ifndef IF_DRAIN
108#define IF_DRAIN(ifq) do { \
109 struct mbuf *m; \
110 for (;;) { \
111 IF_DEQUEUE(ifq, m); \
112 if (m == NULL) \
113 break; \
114 m_freem(m); \

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

600 printf ("ce%d: cannot map interrupt\n", unit);
601 bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->ce_res);
602 ce_bus_dma_mem_free (&bd->dmamem);
603 free (b, M_DEVBUF);
604 splx (s);
605 return (ENXIO);
606 }
607#if __FreeBSD_version >= 500000
612 callout_init (&led_timo[unit], CALLOUT_MPSAFE);
608 callout_init (&led_timo[unit], 1);
613#else
614 callout_init (&led_timo[unit]);
615#endif
616 error = bus_setup_intr (dev, bd->ce_irq,
617#if __FreeBSD_version >= 500013
618 INTR_TYPE_NET|INTR_MPSAFE,
619#else
620 INTR_TYPE_NET,

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

656 c->sys = d;
657 }
658
659 for (c = b->chan; c < b->chan + NCHAN; ++c) {
660 if (c->sys == NULL)
661 continue;
662 d = c->sys;
663
609#else
610 callout_init (&led_timo[unit]);
611#endif
612 error = bus_setup_intr (dev, bd->ce_irq,
613#if __FreeBSD_version >= 500013
614 INTR_TYPE_NET|INTR_MPSAFE,
615#else
616 INTR_TYPE_NET,

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

652 c->sys = d;
653 }
654
655 for (c = b->chan; c < b->chan + NCHAN; ++c) {
656 if (c->sys == NULL)
657 continue;
658 d = c->sys;
659
664 callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
660 callout_init (&d->timeout_handle, 1);
665#ifdef NETGRAPH
666 if (ng_make_node_common (&typestruct, &d->node) != 0) {
667 printf ("%s: cannot make common node\n", d->name);
668 d->node = NULL;
669 continue;
670 }
671#if __FreeBSD_version >= 500000
672 NG_NODE_SET_PRIVATE (d->node, d);

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

2553 if (ng_newtype (&typestruct))
2554 printf ("Failed to register ng_ce\n");
2555#endif
2556 ++load_count;
2557#if __FreeBSD_version <= 500000
2558 cdevsw_add (&ce_cdevsw);
2559#endif
2560#if __FreeBSD_version >= 500000
661#ifdef NETGRAPH
662 if (ng_make_node_common (&typestruct, &d->node) != 0) {
663 printf ("%s: cannot make common node\n", d->name);
664 d->node = NULL;
665 continue;
666 }
667#if __FreeBSD_version >= 500000
668 NG_NODE_SET_PRIVATE (d->node, d);

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

2549 if (ng_newtype (&typestruct))
2550 printf ("Failed to register ng_ce\n");
2551#endif
2552 ++load_count;
2553#if __FreeBSD_version <= 500000
2554 cdevsw_add (&ce_cdevsw);
2555#endif
2556#if __FreeBSD_version >= 500000
2561 callout_init (&timeout_handle, CALLOUT_MPSAFE);
2557 callout_init (&timeout_handle, 1);
2562#else
2563 callout_init (&timeout_handle);
2564#endif
2565 callout_reset (&timeout_handle, hz*5, ce_timeout, 0);
2566 break;
2567 case MOD_UNLOAD:
2568 if (load_count == 1) {
2569 printf ("Removing device entry for Tau32-PCI\n");

--- 79 unchanged lines hidden ---
2558#else
2559 callout_init (&timeout_handle);
2560#endif
2561 callout_reset (&timeout_handle, hz*5, ce_timeout, 0);
2562 break;
2563 case MOD_UNLOAD:
2564 if (load_count == 1) {
2565 printf ("Removing device entry for Tau32-PCI\n");

--- 79 unchanged lines hidden ---