digi.c (76323) | digi.c (76327) |
---|---|
1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Slawa Olhovchenkov 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Slawa Olhovchenkov 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/digi/digi.c 76323 2001-05-06 21:03:37Z brian $ | 27 * $FreeBSD: head/sys/dev/digi/digi.c 76327 2001-05-07 11:13:11Z brian $ |
28 */ 29 30/*- 31 * TODO: 32 * Allow altpin setups again 33 * Figure out what the con bios stuff is supposed to do 34 * Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem. 35 */ --- 36 unchanged lines hidden (view full) --- 72#include <dev/digi/digi.h> 73#include <dev/digi/digi_mod.h> 74#include <dev/digi/digi_pci.h> 75 76#include <machine/ipl.h> 77 78#define CDEV_MAJOR 162 79 | 28 */ 29 30/*- 31 * TODO: 32 * Allow altpin setups again 33 * Figure out what the con bios stuff is supposed to do 34 * Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem. 35 */ --- 36 unchanged lines hidden (view full) --- 72#include <dev/digi/digi.h> 73#include <dev/digi/digi_mod.h> 74#include <dev/digi/digi_pci.h> 75 76#include <machine/ipl.h> 77 78#define CDEV_MAJOR 162 79 |
80#ifdef SMP 81#include <sys/lock.h> 82#include <machine/smptests.h> /* USE_COMLOCK ? */ 83#ifdef USE_COMLOCK 84extern struct mtx com_mtx; 85#define COM_LOCK() mtx_lock_spin(&com_mtx) 86#define COM_UNLOCK() mtx_unlock_spin(&com_mtx) 87#else 88#define COM_LOCK() 89#define COM_UNLOCK() 90#endif /* USE_COMLOCK */ 91#else 92#define COM_LOCK() 93#define COM_UNLOCK() 94#endif /* SMP */ 95 96/*#define DIGI_INTERRUPT*/ 97 | |
98#define CTRL_DEV 0x800000 99#define CALLOUT_MASK 0x400000 100#define CONTROL_INIT_STATE 0x100000 101#define CONTROL_LOCK_STATE 0x200000 102#define CONTROL_MASK (CTRL_DEV|CONTROL_INIT_STATE|CONTROL_LOCK_STATE) 103#define UNIT_MASK 0x030000 104#define PORT_MASK 0x0000FF 105#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev))) 106#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK) 107#define MINOR_TO_UNIT(mynor) (((mynor) & UNIT_MASK)>>16) 108#define MINOR_TO_PORT(mynor) ((mynor) & PORT_MASK) 109 | 80#define CTRL_DEV 0x800000 81#define CALLOUT_MASK 0x400000 82#define CONTROL_INIT_STATE 0x100000 83#define CONTROL_LOCK_STATE 0x200000 84#define CONTROL_MASK (CTRL_DEV|CONTROL_INIT_STATE|CONTROL_LOCK_STATE) 85#define UNIT_MASK 0x030000 86#define PORT_MASK 0x0000FF 87#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev))) 88#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK) 89#define MINOR_TO_UNIT(mynor) (((mynor) & UNIT_MASK)>>16) 90#define MINOR_TO_PORT(mynor) ((mynor) & PORT_MASK) 91 |
110#ifdef SMP 111#define disable_intr() COM_DISABLE_INTR() 112#define enable_intr() COM_ENABLE_INTR() 113#endif /* SMP */ 114 | |
115static d_open_t digiopen; 116static d_close_t digiclose; 117static d_read_t digiread; 118static d_write_t digiwrite; 119static d_ioctl_t digiioctl; 120 121static void digistop(struct tty *tp, int rw); 122static int digimctl(struct digi_p *port, int bits, int how); --- 568 unchanged lines hidden (view full) --- 691 CALLOUT_MASK | CONTROL_INIT_STATE, UID_UUCP, GID_DIALER, 692 0660, "cuaiD%d.%d", sc->res.unit, i); 693 port->dev[5] = make_dev(&digi_sw, ((sc->res.unit << 16) + i) | 694 CALLOUT_MASK | CONTROL_LOCK_STATE, UID_UUCP, GID_DIALER, 695 0660, "cualD%d.%d", sc->res.unit, i); 696 } 697 698 sc->hidewin(sc); | 92static d_open_t digiopen; 93static d_close_t digiclose; 94static d_read_t digiread; 95static d_write_t digiwrite; 96static d_ioctl_t digiioctl; 97 98static void digistop(struct tty *tp, int rw); 99static int digimctl(struct digi_p *port, int bits, int how); --- 568 unchanged lines hidden (view full) --- 668 CALLOUT_MASK | CONTROL_INIT_STATE, UID_UUCP, GID_DIALER, 669 0660, "cuaiD%d.%d", sc->res.unit, i); 670 port->dev[5] = make_dev(&digi_sw, ((sc->res.unit << 16) + i) | 671 CALLOUT_MASK | CONTROL_LOCK_STATE, UID_UUCP, GID_DIALER, 672 0660, "cualD%d.%d", sc->res.unit, i); 673 } 674 675 sc->hidewin(sc); |
676#ifdef DIGI_LOCK_INTR 677 mtx_init(sc->intr_mutex, "digi interrupt mutex", MTX_DEF); 678#endif |
|
699 sc->inttest = timeout(digi_int_test, sc, hz); 700 /* fepcmd_w(&sc->ports[0], 0xff, 0, 0); */ 701 sc->status = DIGI_STATUS_ENABLED; 702 703 return (0); 704} 705 706static int --- 757 unchanged lines hidden (view full) --- 1464 int size, window; 1465 struct event { 1466 u_char pnum; 1467 u_char event; 1468 u_char mstat; 1469 u_char lstat; 1470 } event; 1471 | 679 sc->inttest = timeout(digi_int_test, sc, hz); 680 /* fepcmd_w(&sc->ports[0], 0xff, 0, 0); */ 681 sc->status = DIGI_STATUS_ENABLED; 682 683 return (0); 684} 685 686static int --- 757 unchanged lines hidden (view full) --- 1444 int size, window; 1445 struct event { 1446 u_char pnum; 1447 u_char event; 1448 u_char mstat; 1449 u_char lstat; 1450 } event; 1451 |
1472 COM_LOCK(); | |
1473 sc = vp; 1474 1475 if (sc->status != DIGI_STATUS_ENABLED) { 1476 DLOG(DIGIDB_IRQ, (sc->dev, "interrupt on disabled board !\n")); 1477 return; 1478 } | 1452 sc = vp; 1453 1454 if (sc->status != DIGI_STATUS_ENABLED) { 1455 DLOG(DIGIDB_IRQ, (sc->dev, "interrupt on disabled board !\n")); 1456 return; 1457 } |
1458 1459#ifdef DIGI_LOCK_INTR 1460 mtx_lock(sc->intr_mutex); 1461#endif 1462 |
|
1479#ifdef DIGI_INTERRUPT 1480 microtime(&sc->intr_timestamp); 1481#endif 1482 1483 window = sc->window; 1484 sc->setwin(sc, 0); 1485 1486 if (sc->model >= PCXEM && W(sc->vmem + 0xd00)) { --- 183 unchanged lines hidden (view full) --- 1670 } 1671 } 1672 sc->gdata->eout = etail; 1673eoi: 1674 if (sc->window != 0) 1675 sc->towin(sc, 0); 1676 if (window != 0) 1677 sc->towin(sc, window); | 1463#ifdef DIGI_INTERRUPT 1464 microtime(&sc->intr_timestamp); 1465#endif 1466 1467 window = sc->window; 1468 sc->setwin(sc, 0); 1469 1470 if (sc->model >= PCXEM && W(sc->vmem + 0xd00)) { --- 183 unchanged lines hidden (view full) --- 1654 } 1655 } 1656 sc->gdata->eout = etail; 1657eoi: 1658 if (sc->window != 0) 1659 sc->towin(sc, 0); 1660 if (window != 0) 1661 sc->towin(sc, window); |
1678 COM_UNLOCK(); | 1662#ifdef DIGI_LOCK_INTR 1663 mtx_unlock(sc->intr_mutex); 1664#endif |
1679} 1680 1681static void 1682digistart(struct tty *tp) 1683{ 1684 int unit; 1685 int pnum; 1686 struct digi_p *port; --- 189 unchanged lines hidden (view full) --- 1876 destroy_dev(sc->ports[i].dev[d]); 1877 1878 untimeout(digi_poll, sc, sc->callout); 1879 callout_handle_init(&sc->callout); 1880 untimeout(digi_int_test, sc, sc->inttest); 1881 callout_handle_init(&sc->inttest); 1882 1883 bus_teardown_intr(sc->dev, sc->res.irq, sc->res.irqHandler); | 1665} 1666 1667static void 1668digistart(struct tty *tp) 1669{ 1670 int unit; 1671 int pnum; 1672 struct digi_p *port; --- 189 unchanged lines hidden (view full) --- 1862 destroy_dev(sc->ports[i].dev[d]); 1863 1864 untimeout(digi_poll, sc, sc->callout); 1865 callout_handle_init(&sc->callout); 1866 untimeout(digi_int_test, sc, sc->inttest); 1867 callout_handle_init(&sc->inttest); 1868 1869 bus_teardown_intr(sc->dev, sc->res.irq, sc->res.irqHandler); |
1870#ifdef DIGI_LOCK_INTR 1871 mtx_destroy(sc->intr_mutex); 1872#endif |
|
1884#ifdef DIGI_INTERRUPT 1885 if (sc->res.irq != NULL) { 1886 bus_release_resource(dev, SYS_RES_IRQ, sc->res.irqrid, 1887 sc->res.irq); 1888 sc->res.irq = NULL; 1889 } 1890#endif 1891 if (sc->numports) { --- 51 unchanged lines hidden --- | 1873#ifdef DIGI_INTERRUPT 1874 if (sc->res.irq != NULL) { 1875 bus_release_resource(dev, SYS_RES_IRQ, sc->res.irqrid, 1876 sc->res.irq); 1877 sc->res.irq = NULL; 1878 } 1879#endif 1880 if (sc->numports) { --- 51 unchanged lines hidden --- |