]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/puc/puc_pccard.c
Optionally bind ktls threads to NUMA domains
[FreeBSD/FreeBSD.git] / sys / dev / puc / puc_pccard.c
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2002 Poul-Henning Kamp.  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:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice unmodified, this list of conditions, and the following
11  *    disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
31
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/kernel.h>
35 #include <sys/module.h>
36 #include <sys/bus.h>
37 #include <sys/conf.h>
38 #include <sys/malloc.h>
39 #include <sys/sysctl.h>
40
41 #include <machine/bus.h>
42 #include <machine/resource.h>
43 #include <sys/rman.h>
44
45 #include <dev/pccard/pccardvar.h>
46
47 #include <dev/puc/puc_cfg.h>
48 #include <dev/puc/puc_bfe.h>
49
50 /* http://www.argosy.com.tw/product/sp320.htm */
51 const struct puc_cfg puc_pccard_rscom = {
52         0, 0, 0, 0,
53         "ARGOSY SP320 Dual port serial PCMCIA",
54         DEFAULT_RCLK,
55         PUC_PORT_2S, 0, 1, 0,
56 };
57
58 static int
59 puc_pccard_probe(device_t dev)
60 {
61         const char *vendor, *product;
62         int error;
63
64         error = pccard_get_vendor_str(dev, &vendor);
65         if (error)
66                 return(error);
67         error = pccard_get_product_str(dev, &product);
68         if (error)
69                 return(error);
70         if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P"))
71                 return (puc_bfe_probe(dev, &puc_pccard_rscom));
72
73         return (ENXIO);
74 }
75
76 static int
77 puc_pccard_attach(device_t dev)
78 {
79         int error;
80
81         error = puc_bfe_attach(dev);
82         if (error == 0)
83                 gone_in_dev(dev, 13, "pccard removed");
84         return (error);
85 }
86
87 static device_method_t puc_pccard_methods[] = {
88     /* Device interface */
89     DEVMETHOD(device_probe,             puc_pccard_probe),
90     DEVMETHOD(device_attach,            puc_pccard_attach),
91     DEVMETHOD(device_detach,            puc_bfe_detach),
92
93     DEVMETHOD(bus_alloc_resource,       puc_bus_alloc_resource),
94     DEVMETHOD(bus_release_resource,     puc_bus_release_resource),
95     DEVMETHOD(bus_get_resource,         puc_bus_get_resource),
96     DEVMETHOD(bus_read_ivar,            puc_bus_read_ivar),
97     DEVMETHOD(bus_setup_intr,           puc_bus_setup_intr),
98     DEVMETHOD(bus_teardown_intr,        puc_bus_teardown_intr),
99     DEVMETHOD(bus_print_child,          puc_bus_print_child),
100     DEVMETHOD(bus_child_pnpinfo_str,    puc_bus_child_pnpinfo_str),
101     DEVMETHOD(bus_child_location_str,   puc_bus_child_location_str),
102
103     DEVMETHOD_END
104 };
105
106 static driver_t puc_pccard_driver = {
107         puc_driver_name,
108         puc_pccard_methods,
109         sizeof(struct puc_softc),
110 };
111
112 DRIVER_MODULE(puc, pccard, puc_pccard_driver, puc_devclass, 0, 0);