2 * Device driver for Specialix I/O8+ multiport serial card.
4 * Copyright 2003 Frank Mayhar <frank@exit.com>
6 * Derived from the "si" driver by Peter Wemm <peter@netplex.com.au>, using
7 * lots of information from the Linux "specialix" driver by Roger Wolff
8 * <R.E.Wolff@BitWizard.nl> and from the Intel CD1865 "Intelligent Eight-
9 * Channel Communications Controller" datasheet. Roger was also nice
10 * enough to answer numerous questions about stuff specific to the I/O8+
11 * not covered by the CD1865 datasheet.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notices, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notices, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
25 * NO EVENT SHALL THE AUTHORS BE LIABLE.
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/kernel.h>
33 #include <sys/module.h>
36 #include <machine/resource.h>
37 #include <machine/bus.h>
38 #include <machine/clock.h>
41 #include <dev/sx/cd1865.h>
42 #include <dev/sx/sxvar.h>
43 #include <dev/sx/sx.h>
44 #include <dev/sx/sx_util.h>
46 #include <dev/pci/pcivar.h>
52 const char *desc = NULL;
54 switch (pci_get_devid(dev)) {
56 if (pci_get_subdevice(dev) == (uint16_t)0xb008) {
57 desc = "Specialix I/O8+ Multiport Serial Card";
62 device_set_desc(dev, desc);
63 return BUS_PROBE_DEFAULT;
69 sx_pci_attach(device_t dev)
77 sc = device_get_softc(dev);
80 sc->sc_io_res = bus_alloc_resource(dev,
86 device_printf(dev, "can't map I/O\n");
89 sc->sc_st = rman_get_bustag(sc->sc_io_res);
90 sc->sc_sh = rman_get_bushandle(sc->sc_io_res);
93 * Now that we have the bus handle, we can make certain that this
96 if (sx_probe_io8(dev)) {
97 device_printf(dev, "Oops! Device is not an I/O8+ board!\n");
101 /*sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_io_res);*/
102 /*sc->sc_maddr = rman_get_virtual(sc->sc_io_res);*/
105 sc->sc_irq_res = bus_alloc_resource(dev,
109 RF_ACTIVE | RF_SHAREABLE);
110 if (!sc->sc_irq_res) {
111 device_printf(dev, "Can't map interrupt\n");
114 sc->sc_irq = rman_get_start(sc->sc_irq_res);
115 error = bus_setup_intr(dev,
121 device_printf(dev, "Can't activate interrupt\n");
125 error = sxattach(dev);
128 return (0); /* success */
133 if (sc->sc_irq_res) {
135 bus_teardown_intr(dev, sc->sc_irq_res, ih);
136 bus_release_resource(dev,
143 bus_release_resource(dev,
152 static device_method_t sx_pci_methods[] = {
153 /* Device interface */
154 DEVMETHOD(device_probe, sx_pci_probe),
155 DEVMETHOD(device_attach, sx_pci_attach),
156 /* DEVMETHOD(device_detach, sx_pci_detach),*/
161 static driver_t sx_pci_driver = {
164 sizeof(struct sx_softc),
167 DRIVER_MODULE(sx, pci, sx_pci_driver, sx_devclass, 0, 0);