2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2001 M. Warner Losh. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #include <sys/cdefs.h>
28 __FBSDID("$FreeBSD$");
30 #include <sys/param.h>
31 #include <sys/systm.h>
34 #include <sys/kernel.h>
36 #include <sys/malloc.h>
37 #include <sys/mutex.h>
38 #include <sys/module.h>
40 #include <machine/bus.h>
41 #include <machine/resource.h>
42 #include <sys/timepps.h>
44 #include <dev/pccard/pccard_cis.h>
45 #include <dev/pccard/pccardvar.h>
47 #include <dev/sio/siovar.h>
49 static int sio_pccard_attach(device_t dev);
50 static int sio_pccard_probe(device_t dev);
52 static device_method_t sio_pccard_methods[] = {
53 /* Device interface */
54 DEVMETHOD(device_probe, sio_pccard_probe),
55 DEVMETHOD(device_attach, sio_pccard_attach),
56 DEVMETHOD(device_detach, siodetach),
61 static driver_t sio_pccard_driver = {
68 sio_pccard_probe(device_t dev)
71 u_int32_t fcn = PCCARD_FUNCTION_UNSPEC;
73 error = pccard_get_function(dev, &fcn);
78 * If a serial card, we are likely the right driver. However,
79 * some serial cards are better servered by other drivers, so
80 * allow other drivers to claim it, if they want.
82 if (fcn == PCCARD_FUNCTION_SERIAL)
88 sio_pccard_attach(device_t dev)
92 /* Do not probe IRQ - pccard doesn't turn on the interrupt line */
93 /* until bus_setup_intr */
94 if ((err = sioprobe(dev, 0, 0UL, 1)) > 0)
96 return (sioattach(dev, 0, 0UL));
99 DRIVER_MODULE(sio, pccard, sio_pccard_driver, sio_devclass, 0, 0);