ofisascr.c revision 1.1.2.3 1 1.1.2.3 nathanw /* $NetBSD: ofisascr.c,v 1.1.2.3 2002/10/18 02:39:47 nathanw Exp $ */
2 1.1.2.2 nathanw
3 1.1.2.2 nathanw /*
4 1.1.2.2 nathanw * Copyright 1997
5 1.1.2.2 nathanw * Digital Equipment Corporation. All rights reserved.
6 1.1.2.2 nathanw *
7 1.1.2.2 nathanw * This software is furnished under license and may be used and
8 1.1.2.2 nathanw * copied only in accordance with the following terms and conditions.
9 1.1.2.2 nathanw * Subject to these conditions, you may download, copy, install,
10 1.1.2.2 nathanw * use, modify and distribute this software in source and/or binary
11 1.1.2.2 nathanw * form. No title or ownership is transferred hereby.
12 1.1.2.2 nathanw *
13 1.1.2.2 nathanw * 1) Any source code used, modified or distributed must reproduce
14 1.1.2.2 nathanw * and retain this copyright notice and list of conditions as
15 1.1.2.2 nathanw * they appear in the source file.
16 1.1.2.2 nathanw *
17 1.1.2.2 nathanw * 2) No right is granted to use any trade name, trademark, or logo of
18 1.1.2.2 nathanw * Digital Equipment Corporation. Neither the "Digital Equipment
19 1.1.2.2 nathanw * Corporation" name nor any trademark or logo of Digital Equipment
20 1.1.2.2 nathanw * Corporation may be used to endorse or promote products derived
21 1.1.2.2 nathanw * from this software without the prior written permission of
22 1.1.2.2 nathanw * Digital Equipment Corporation.
23 1.1.2.2 nathanw *
24 1.1.2.2 nathanw * 3) This software is provided "AS-IS" and any express or implied
25 1.1.2.2 nathanw * warranties, including but not limited to, any implied warranties
26 1.1.2.2 nathanw * of merchantability, fitness for a particular purpose, or
27 1.1.2.2 nathanw * non-infringement are disclaimed. In no event shall DIGITAL be
28 1.1.2.2 nathanw * liable for any damages whatsoever, and in particular, DIGITAL
29 1.1.2.2 nathanw * shall not be liable for special, indirect, consequential, or
30 1.1.2.2 nathanw * incidental damages or damages for lost profits, loss of
31 1.1.2.2 nathanw * revenue or loss of use, whether such damages arise in contract,
32 1.1.2.2 nathanw * negligence, tort, under statute, in equity, at law or otherwise,
33 1.1.2.2 nathanw * even if advised of the possibility of such damage.
34 1.1.2.2 nathanw */
35 1.1.2.2 nathanw
36 1.1.2.2 nathanw /*
37 1.1.2.2 nathanw * OFW Glue for Smart Card Driver
38 1.1.2.2 nathanw */
39 1.1.2.2 nathanw
40 1.1.2.2 nathanw #include <sys/param.h>
41 1.1.2.2 nathanw #include <sys/device.h>
42 1.1.2.2 nathanw #include <sys/systm.h>
43 1.1.2.2 nathanw
44 1.1.2.2 nathanw #include <machine/intr.h>
45 1.1.2.2 nathanw
46 1.1.2.2 nathanw #include <dev/ofw/openfirm.h>
47 1.1.2.2 nathanw #include <dev/isa/isavar.h>
48 1.1.2.2 nathanw #include <shark/shark/sequoia.h>
49 1.1.2.2 nathanw
50 1.1.2.2 nathanw int ofisascrprobe __P((struct device *, struct cfdata *, void *));
51 1.1.2.2 nathanw void ofisascrattach __P((struct device *, struct device *, void *));
52 1.1.2.2 nathanw
53 1.1.2.2 nathanw
54 1.1.2.3 nathanw CFATTACH_DECL(ofisascr, sizeof(struct device),
55 1.1.2.3 nathanw ofisascrprobe, ofisascrattach, NULL, NULL);
56 1.1.2.2 nathanw
57 1.1.2.2 nathanw extern struct cfdriver ofisascr_cd;
58 1.1.2.2 nathanw
59 1.1.2.2 nathanw
60 1.1.2.2 nathanw int
61 1.1.2.2 nathanw ofisascrprobe(parent, cf, aux)
62 1.1.2.2 nathanw struct device *parent;
63 1.1.2.2 nathanw struct cfdata *cf;
64 1.1.2.2 nathanw void *aux;
65 1.1.2.2 nathanw {
66 1.1.2.2 nathanw struct ofbus_attach_args *oba = aux;
67 1.1.2.2 nathanw char type[64];
68 1.1.2.2 nathanw char name[64];
69 1.1.2.2 nathanw
70 1.1.2.2 nathanw /* At a minimum, must match type and name properties. */
71 1.1.2.2 nathanw if ( OF_getprop(oba->oba_phandle, "device_type", type,
72 1.1.2.2 nathanw sizeof(type)) < 0 || strcmp(type, "ISO7816") != 0 ||
73 1.1.2.2 nathanw OF_getprop(oba->oba_phandle, "name", name, sizeof(name)) < 0 ||
74 1.1.2.2 nathanw strcmp(name, "scr") != 0)
75 1.1.2.2 nathanw return 0;
76 1.1.2.2 nathanw
77 1.1.2.2 nathanw /* Match, we dont have models yet */
78 1.1.2.2 nathanw return 2;
79 1.1.2.2 nathanw }
80 1.1.2.2 nathanw
81 1.1.2.2 nathanw
82 1.1.2.2 nathanw void
83 1.1.2.2 nathanw ofisascrattach(parent, dev, aux)
84 1.1.2.2 nathanw struct device *parent, *dev;
85 1.1.2.2 nathanw void *aux;
86 1.1.2.2 nathanw {
87 1.1.2.2 nathanw struct ofbus_attach_args *oba = aux;
88 1.1.2.2 nathanw struct isa_attach_args ia;
89 1.1.2.2 nathanw struct isa_io ia_io[1];
90 1.1.2.2 nathanw
91 1.1.2.2 nathanw printf("\n");
92 1.1.2.2 nathanw
93 1.1.2.2 nathanw /* XXX - Hard-wire the ISA attach args for now. -JJK */
94 1.1.2.2 nathanw ia.ia_iot = &isa_io_bs_tag;
95 1.1.2.2 nathanw ia.ia_memt = &isa_mem_bs_tag;
96 1.1.2.2 nathanw ia.ia_ic = NULL; /* not used */
97 1.1.2.2 nathanw
98 1.1.2.2 nathanw ia.ia_nio = 1;
99 1.1.2.2 nathanw ia.ia_io = ia_io;
100 1.1.2.2 nathanw ia.ia_io[0].ir_addr = SEQUOIA_BASE;
101 1.1.2.2 nathanw ia.ia_io[0].ir_size = SEQUOIA_NPORTS;
102 1.1.2.2 nathanw
103 1.1.2.2 nathanw ia.ia_niomem = 0;
104 1.1.2.2 nathanw ia.ia_nirq = 0;
105 1.1.2.2 nathanw ia.ia_ndrq = 0;
106 1.1.2.2 nathanw
107 1.1.2.2 nathanw ia.ia_aux = (void *)oba->oba_phandle;
108 1.1.2.2 nathanw
109 1.1.2.2 nathanw config_found(dev, &ia, NULL);
110 1.1.2.2 nathanw }
111