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 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: |
324 if ((!(ifp->if_flags & IFF_UP)) && 325 (ifp->if_drv_flags & IFF_DRV_RUNNING)) { |
326 327 ppb_wctr(ppbus, 0x00); |
328 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
329 330 /* IFF_UP is not set, try to release the bus anyway */ 331 ppb_release_bus(ppbus, dev); 332 break; 333 } |
334 if (((ifp->if_flags & IFF_UP)) && 335 (!(ifp->if_drv_flags & IFF_DRV_RUNNING))) { |
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); |
367 ifp->if_drv_flags |= IFF_DRV_RUNNING; |
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); |
582 sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
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++; |
620 ifp->if_drv_flags |= IFF_DRV_RUNNING; |
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 --- |