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