Deleted Added
full compact
if_plip.c (147256) if_plip.c (148887)
1/*-
2 * Copyright (c) 1997 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/ppbus/if_plip.c 147256 2005-06-10 16:49:24Z brooks $");
30__FBSDID("$FreeBSD: head/sys/dev/ppbus/if_plip.c 148887 2005-08-09 10:20:02Z rwatson $");
31
32/*
33 * Parallel port TCP/IP interfaces added. I looked at the driver from
34 * MACH but this is a complete rewrite, and btw. incompatible, and it
35 * should perform better too. I have never run the MACH driver though.
36 *
37 * This driver sends two bytes (0x08, 0x00) in front of each packet,
38 * to allow us to distinguish another format later.

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

316 case SIOCAIFADDR:
317 case SIOCSIFADDR:
318 if (ifa->ifa_addr->sa_family != AF_INET)
319 return EAFNOSUPPORT;
320
321 ifp->if_flags |= IFF_UP;
322 /* FALLTHROUGH */
323 case SIOCSIFFLAGS:
31
32/*
33 * Parallel port TCP/IP interfaces added. I looked at the driver from
34 * MACH but this is a complete rewrite, and btw. incompatible, and it
35 * should perform better too. I have never run the MACH driver though.
36 *
37 * This driver sends two bytes (0x08, 0x00) in front of each packet,
38 * to allow us to distinguish another format later.

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

316 case SIOCAIFADDR:
317 case SIOCSIFADDR:
318 if (ifa->ifa_addr->sa_family != AF_INET)
319 return EAFNOSUPPORT;
320
321 ifp->if_flags |= IFF_UP;
322 /* FALLTHROUGH */
323 case SIOCSIFFLAGS:
324 if ((!(ifp->if_flags & IFF_UP)) && (ifp->if_flags & IFF_RUNNING)) {
324 if ((!(ifp->if_flags & IFF_UP)) &&
325 (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
325
326 ppb_wctr(ppbus, 0x00);
326
327 ppb_wctr(ppbus, 0x00);
327 ifp->if_flags &= ~IFF_RUNNING;
328 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
328
329 /* IFF_UP is not set, try to release the bus anyway */
330 ppb_release_bus(ppbus, dev);
331 break;
332 }
329
330 /* IFF_UP is not set, try to release the bus anyway */
331 ppb_release_bus(ppbus, dev);
332 break;
333 }
333 if (((ifp->if_flags & IFF_UP)) && (!(ifp->if_flags & IFF_RUNNING))) {
334 if (((ifp->if_flags & IFF_UP)) &&
335 (!(ifp->if_drv_flags & IFF_DRV_RUNNING))) {
334
335 /* XXX
336 * Should the request be interruptible?
337 */
338 if ((error = ppb_request_bus(ppbus, dev, PPB_WAIT|PPB_INTR)))
339 return (error);
340
341 /* Now IFF_UP means that we own the bus */

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

357 /* attach our interrupt handler, later detached when the bus is released */
358 if ((error = BUS_SETUP_INTR(ppbus, dev, sc->res_irq,
359 INTR_TYPE_NET, lp_intr, dev, &ih))) {
360 ppb_release_bus(ppbus, dev);
361 return (error);
362 }
363
364 ppb_wctr(ppbus, IRQENABLE);
336
337 /* XXX
338 * Should the request be interruptible?
339 */
340 if ((error = ppb_request_bus(ppbus, dev, PPB_WAIT|PPB_INTR)))
341 return (error);
342
343 /* Now IFF_UP means that we own the bus */

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

359 /* attach our interrupt handler, later detached when the bus is released */
360 if ((error = BUS_SETUP_INTR(ppbus, dev, sc->res_irq,
361 INTR_TYPE_NET, lp_intr, dev, &ih))) {
362 ppb_release_bus(ppbus, dev);
363 return (error);
364 }
365
366 ppb_wctr(ppbus, IRQENABLE);
365 ifp->if_flags |= IFF_RUNNING;
367 ifp->if_drv_flags |= IFF_DRV_RUNNING;
366 }
367 break;
368
369 case SIOCSIFMTU:
370 ptr = sc->sc_ifbuf;
371 sc->sc_ifbuf = malloc(ifr->ifr_mtu+MLPIPHDRLEN, M_DEVBUF, M_NOWAIT);
372 if (!sc->sc_ifbuf) {
373 sc->sc_ifbuf = ptr;

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

572
573 /*
574 * We are not able to send receive anything for now,
575 * so stop wasting our time
576 */
577 if (sc->sc_iferrs > LPMAXERRS) {
578 printf("lp%d: Too many errors, Going off-line.\n", device_get_unit(dev));
579 ppb_wctr(ppbus, 0x00);
368 }
369 break;
370
371 case SIOCSIFMTU:
372 ptr = sc->sc_ifbuf;
373 sc->sc_ifbuf = malloc(ifr->ifr_mtu+MLPIPHDRLEN, M_DEVBUF, M_NOWAIT);
374 if (!sc->sc_ifbuf) {
375 sc->sc_ifbuf = ptr;

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

574
575 /*
576 * We are not able to send receive anything for now,
577 * so stop wasting our time
578 */
579 if (sc->sc_iferrs > LPMAXERRS) {
580 printf("lp%d: Too many errors, Going off-line.\n", device_get_unit(dev));
581 ppb_wctr(ppbus, 0x00);
580 sc->sc_ifp->if_flags &= ~IFF_RUNNING;
582 sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
581 sc->sc_iferrs=0;
582 }
583
584 done:
585 splx(s);
586 return;
587}
588

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

610 struct mbuf *mm;
611 u_char *cp = "\0\0";
612 u_char chksum = 0;
613 int count = 0;
614 int i, len, spin;
615
616 /* We need a sensible value if we abort */
617 cp++;
583 sc->sc_iferrs=0;
584 }
585
586 done:
587 splx(s);
588 return;
589}
590

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

612 struct mbuf *mm;
613 u_char *cp = "\0\0";
614 u_char chksum = 0;
615 int count = 0;
616 int i, len, spin;
617
618 /* We need a sensible value if we abort */
619 cp++;
618 ifp->if_flags |= IFF_RUNNING;
620 ifp->if_drv_flags |= IFF_DRV_RUNNING;
619
620 err = 1; /* assume we're aborting because of an error */
621
622 s = splhigh();
623
624 /* Suspend (on laptops) or receive-errors might have taken us offline */
625 ppb_wctr(ppbus, IRQENABLE);
626

--- 144 unchanged lines hidden ---
621
622 err = 1; /* assume we're aborting because of an error */
623
624 s = splhigh();
625
626 /* Suspend (on laptops) or receive-errors might have taken us offline */
627 ppb_wctr(ppbus, IRQENABLE);
628

--- 144 unchanged lines hidden ---