2 * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel@roe.ch>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice unmodified, this list of conditions, and the following
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 AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
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
28 #include <sys/cdefs.h>
29 __FBSDID("$FreeBSD$");
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/kernel.h>
34 #include <sys/socket.h>
35 #include <sys/selinfo.h>
37 #include <sys/mutex.h>
39 #include <sys/module.h>
42 #include <machine/bus.h>
43 #include <machine/resource.h>
46 #include <dev/cmx/cmxvar.h>
48 #include <dev/pccard/pccardvar.h>
49 #include <dev/pccard/pccard_cis.h>
51 #include "pccarddevs.h"
53 static const struct pccard_product cmx_pccard_products[] = {
54 PCMCIA_CARD(OMNIKEY, CM4040),
62 cmx_pccard_probe(device_t dev)
64 const struct pccard_product *pp;
65 if ((pp = pccard_product_lookup(dev, cmx_pccard_products,
66 sizeof(cmx_pccard_products[0]), NULL)) != NULL) {
67 if (pp->pp_name != NULL)
68 device_set_desc(dev, pp->pp_name);
75 * Attach to the pccard, and call bus independant attach and
76 * resource allocation routines.
79 cmx_pccard_attach(device_t dev)
84 if ((rv = cmx_alloc_resources(dev)) != 0) {
85 device_printf(dev, "cmx_alloc_resources() failed!\n");
86 cmx_release_resources(dev);
90 if ((rv = cmx_attach(dev)) != 0) {
91 device_printf(dev, "cmx_attach() failed!\n");
92 cmx_release_resources(dev);
96 device_printf(dev, "attached\n");
100 static device_method_t cmx_pccard_methods[] = {
101 DEVMETHOD(device_probe, cmx_pccard_probe),
102 DEVMETHOD(device_attach, cmx_pccard_attach),
103 DEVMETHOD(device_detach, cmx_detach),
108 static driver_t cmx_pccard_driver = {
111 sizeof(struct cmx_softc),
114 DRIVER_MODULE(cmx, pccard, cmx_pccard_driver, cmx_devclass, 0, 0);