phantomas.c revision 1.1.10.2 1 1.1.10.2 tls /* $NetBSD: phantomas.c,v 1.1.10.2 2014/08/20 00:03:04 tls Exp $ */
2 1.1.10.2 tls /* $OpenBSD: phantomas.c,v 1.1 2002/12/18 23:52:45 mickey Exp $ */
3 1.1.10.2 tls
4 1.1.10.2 tls /*
5 1.1.10.2 tls * Copyright (c) 2002 Michael Shalayeff
6 1.1.10.2 tls * All rights reserved.
7 1.1.10.2 tls *
8 1.1.10.2 tls * Redistribution and use in source and binary forms, with or without
9 1.1.10.2 tls * modification, are permitted provided that the following conditions
10 1.1.10.2 tls * are met:
11 1.1.10.2 tls * 1. Redistributions of source code must retain the above copyright
12 1.1.10.2 tls * notice, this list of conditions and the following disclaimer.
13 1.1.10.2 tls * 2. Redistributions in binary form must reproduce the above copyright
14 1.1.10.2 tls * notice, this list of conditions and the following disclaimer in the
15 1.1.10.2 tls * documentation and/or other materials provided with the distribution.
16 1.1.10.2 tls *
17 1.1.10.2 tls * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.1.10.2 tls * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1.10.2 tls * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1.10.2 tls * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
21 1.1.10.2 tls * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 1.1.10.2 tls * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 1.1.10.2 tls * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1.10.2 tls * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 1.1.10.2 tls * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 1.1.10.2 tls * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 1.1.10.2 tls * THE POSSIBILITY OF SUCH DAMAGE.
28 1.1.10.2 tls */
29 1.1.10.2 tls
30 1.1.10.2 tls #include <sys/param.h>
31 1.1.10.2 tls #include <sys/systm.h>
32 1.1.10.2 tls #include <sys/device.h>
33 1.1.10.2 tls
34 1.1.10.2 tls #include <machine/iomod.h>
35 1.1.10.2 tls #include <machine/autoconf.h>
36 1.1.10.2 tls
37 1.1.10.2 tls #include <hppa/dev/cpudevs.h>
38 1.1.10.2 tls
39 1.1.10.2 tls struct phantomas_softc {
40 1.1.10.2 tls device_t sc_dev;
41 1.1.10.2 tls };
42 1.1.10.2 tls
43 1.1.10.2 tls int phantomasmatch(device_t, cfdata_t, void *);
44 1.1.10.2 tls void phantomasattach(device_t, device_t, void *);
45 1.1.10.2 tls static device_t phantomas_callback(device_t self, struct confargs *ca);
46 1.1.10.2 tls
47 1.1.10.2 tls CFATTACH_DECL_NEW(phantomas, sizeof(struct phantomas_softc),
48 1.1.10.2 tls phantomasmatch, phantomasattach, NULL, NULL);
49 1.1.10.2 tls
50 1.1.10.2 tls int
51 1.1.10.2 tls phantomasmatch(device_t parent, cfdata_t cfdata, void *aux)
52 1.1.10.2 tls {
53 1.1.10.2 tls struct confargs *ca = aux;
54 1.1.10.2 tls
55 1.1.10.2 tls if (ca->ca_type.iodc_type != HPPA_TYPE_BCPORT ||
56 1.1.10.2 tls ca->ca_type.iodc_sv_model != HPPA_BCPORT_PHANTOM) {
57 1.1.10.2 tls return (0);
58 1.1.10.2 tls }
59 1.1.10.2 tls return (1);
60 1.1.10.2 tls }
61 1.1.10.2 tls
62 1.1.10.2 tls void
63 1.1.10.2 tls phantomasattach(device_t parent, device_t self, void *aux)
64 1.1.10.2 tls {
65 1.1.10.2 tls struct phantomas_softc *sc = device_private(self);
66 1.1.10.2 tls struct confargs *ca = aux, nca;
67 1.1.10.2 tls
68 1.1.10.2 tls sc->sc_dev = self;
69 1.1.10.2 tls nca = *ca;
70 1.1.10.2 tls nca.ca_hpabase = 0;
71 1.1.10.2 tls nca.ca_nmodules = MAXMODBUS;
72 1.1.10.2 tls
73 1.1.10.2 tls aprint_normal("\n");
74 1.1.10.2 tls pdc_scanbus(self, &nca, phantomas_callback);
75 1.1.10.2 tls }
76 1.1.10.2 tls
77 1.1.10.2 tls static device_t
78 1.1.10.2 tls phantomas_callback(device_t self, struct confargs *ca)
79 1.1.10.2 tls {
80 1.1.10.2 tls
81 1.1.10.2 tls return config_found_sm_loc(self, "gedoens", NULL, ca, mbprint, mbsubmatch);
82 1.1.10.2 tls }
83