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