sio.c (64688) | sio.c (65131) |
---|---|
1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 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 --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 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 --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/dev/sio/sio.c 64688 2000-08-15 21:03:28Z peter $ | 33 * $FreeBSD: head/sys/dev/sio/sio.c 65131 2000-08-27 14:46:13Z phk $ |
34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 35 * from: i386/isa sio.c,v 1.234 36 */ 37 38#include "opt_comconsole.h" 39#include "opt_compat.h" 40#include "opt_ddb.h" 41#include "opt_sio.h" --- 232 unchanged lines hidden (view full) --- 274 u_long bytes_in; /* statistics */ 275 u_long bytes_out; 276 u_int delta_error_counts[CE_NTYPES]; 277 u_long error_counts[CE_NTYPES]; 278 279 struct resource *irqres; 280 struct resource *ioportres; 281 void *cookie; | 34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 35 * from: i386/isa sio.c,v 1.234 36 */ 37 38#include "opt_comconsole.h" 39#include "opt_compat.h" 40#include "opt_ddb.h" 41#include "opt_sio.h" --- 232 unchanged lines hidden (view full) --- 274 u_long bytes_in; /* statistics */ 275 u_long bytes_out; 276 u_int delta_error_counts[CE_NTYPES]; 277 u_long error_counts[CE_NTYPES]; 278 279 struct resource *irqres; 280 struct resource *ioportres; 281 void *cookie; |
282 dev_t devs[6]; |
|
282 283 /* 284 * Data area for output buffers. Someday we should build the output 285 * buffer queue without copying data. 286 */ 287 u_char obuf1[256]; 288 u_char obuf2[256]; 289}; --- 249 unchanged lines hidden (view full) --- 539 * and ensure that any driver entry points such as 540 * read and write do not hang. 541 */ 542static int 543sio_pccard_detach(dev) 544 device_t dev; 545{ 546 struct com_s *com; | 283 284 /* 285 * Data area for output buffers. Someday we should build the output 286 * buffer queue without copying data. 287 */ 288 u_char obuf1[256]; 289 u_char obuf2[256]; 290}; --- 249 unchanged lines hidden (view full) --- 540 * and ensure that any driver entry points such as 541 * read and write do not hang. 542 */ 543static int 544sio_pccard_detach(dev) 545 device_t dev; 546{ 547 struct com_s *com; |
548 int i; |
|
547 548 com = (struct com_s *) device_get_softc(dev); 549 if (com == NULL) { 550 device_printf(dev, "NULL com in siounload\n"); 551 return (0); 552 } 553 com->gone = 1; | 549 550 com = (struct com_s *) device_get_softc(dev); 551 if (com == NULL) { 552 device_printf(dev, "NULL com in siounload\n"); 553 return (0); 554 } 555 com->gone = 1; |
556 for (i = 0 ; i < 6; i++) 557 destroy_dev(com->devs[i]); |
|
554 if (com->irqres) { 555 bus_teardown_intr(dev, com->irqres, com->cookie); 556 bus_release_resource(dev, SYS_RES_IRQ, 0, com->irqres); 557 } 558 if (com->ioportres) 559 bus_release_resource(dev, SYS_RES_IOPORT, 0, com->ioportres); 560 if (com->tp && (com->tp->t_state & TS_ISOPEN)) { 561 device_printf(dev, "still open, forcing close\n"); --- 744 unchanged lines hidden (view full) --- 1306 if (COM_IIR_TXRDYBUG(flags)) 1307 printf(" with a bogus IIR_TXRDY register"); 1308 printf("\n"); 1309 1310 if (!sio_registered) { 1311 register_swi(SWI_TTY, siopoll); 1312 sio_registered = TRUE; 1313 } | 558 if (com->irqres) { 559 bus_teardown_intr(dev, com->irqres, com->cookie); 560 bus_release_resource(dev, SYS_RES_IRQ, 0, com->irqres); 561 } 562 if (com->ioportres) 563 bus_release_resource(dev, SYS_RES_IOPORT, 0, com->ioportres); 564 if (com->tp && (com->tp->t_state & TS_ISOPEN)) { 565 device_printf(dev, "still open, forcing close\n"); --- 744 unchanged lines hidden (view full) --- 1310 if (COM_IIR_TXRDYBUG(flags)) 1311 printf(" with a bogus IIR_TXRDY register"); 1312 printf("\n"); 1313 1314 if (!sio_registered) { 1315 register_swi(SWI_TTY, siopoll); 1316 sio_registered = TRUE; 1317 } |
1314 make_dev(&sio_cdevsw, unit, | 1318 com->devs[0] = make_dev(&sio_cdevsw, unit, |
1315 UID_ROOT, GID_WHEEL, 0600, "ttyd%r", unit); | 1319 UID_ROOT, GID_WHEEL, 0600, "ttyd%r", unit); |
1316 make_dev(&sio_cdevsw, unit | CONTROL_INIT_STATE, | 1320 com->devs[1] = make_dev(&sio_cdevsw, unit | CONTROL_INIT_STATE, |
1317 UID_ROOT, GID_WHEEL, 0600, "ttyid%r", unit); | 1321 UID_ROOT, GID_WHEEL, 0600, "ttyid%r", unit); |
1318 make_dev(&sio_cdevsw, unit | CONTROL_LOCK_STATE, | 1322 com->devs[2] = make_dev(&sio_cdevsw, unit | CONTROL_LOCK_STATE, |
1319 UID_ROOT, GID_WHEEL, 0600, "ttyld%r", unit); | 1323 UID_ROOT, GID_WHEEL, 0600, "ttyld%r", unit); |
1320 make_dev(&sio_cdevsw, unit | CALLOUT_MASK, | 1324 com->devs[3] = make_dev(&sio_cdevsw, unit | CALLOUT_MASK, |
1321 UID_UUCP, GID_DIALER, 0660, "cuaa%r", unit); | 1325 UID_UUCP, GID_DIALER, 0660, "cuaa%r", unit); |
1322 make_dev(&sio_cdevsw, unit | CALLOUT_MASK | CONTROL_INIT_STATE, | 1326 com->devs[4] = make_dev(&sio_cdevsw, 1327 unit | CALLOUT_MASK | CONTROL_INIT_STATE, |
1323 UID_UUCP, GID_DIALER, 0660, "cuaia%r", unit); | 1328 UID_UUCP, GID_DIALER, 0660, "cuaia%r", unit); |
1324 make_dev(&sio_cdevsw, unit | CALLOUT_MASK | CONTROL_LOCK_STATE, | 1329 com->devs[5] = make_dev(&sio_cdevsw, 1330 unit | CALLOUT_MASK | CONTROL_LOCK_STATE, |
1325 UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); 1326 com->flags = flags; 1327 com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; 1328 pps_init(&com->pps); 1329 1330 rid = 0; 1331 com->irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0ul, ~0ul, 1, 1332 RF_ACTIVE); --- 1961 unchanged lines hidden --- | 1331 UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); 1332 com->flags = flags; 1333 com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; 1334 pps_init(&com->pps); 1335 1336 rid = 0; 1337 com->irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0ul, ~0ul, 1, 1338 RF_ACTIVE); --- 1961 unchanged lines hidden --- |