com_ofisa_machdep.c revision 1.1.14.2 1 1.1.14.2 jdolecek /* $NetBSD: com_ofisa_machdep.c,v 1.1.14.2 2002/06/23 17:41:23 jdolecek Exp $ */
2 1.1.14.2 jdolecek
3 1.1.14.2 jdolecek /*
4 1.1.14.2 jdolecek * Copyright 1998
5 1.1.14.2 jdolecek * Digital Equipment Corporation. All rights reserved.
6 1.1.14.2 jdolecek *
7 1.1.14.2 jdolecek * This software is furnished under license and may be used and
8 1.1.14.2 jdolecek * copied only in accordance with the following terms and conditions.
9 1.1.14.2 jdolecek * Subject to these conditions, you may download, copy, install,
10 1.1.14.2 jdolecek * use, modify and distribute this software in source and/or binary
11 1.1.14.2 jdolecek * form. No title or ownership is transferred hereby.
12 1.1.14.2 jdolecek *
13 1.1.14.2 jdolecek * 1) Any source code used, modified or distributed must reproduce
14 1.1.14.2 jdolecek * and retain this copyright notice and list of conditions as
15 1.1.14.2 jdolecek * they appear in the source file.
16 1.1.14.2 jdolecek *
17 1.1.14.2 jdolecek * 2) No right is granted to use any trade name, trademark, or logo of
18 1.1.14.2 jdolecek * Digital Equipment Corporation. Neither the "Digital Equipment
19 1.1.14.2 jdolecek * Corporation" name nor any trademark or logo of Digital Equipment
20 1.1.14.2 jdolecek * Corporation may be used to endorse or promote products derived
21 1.1.14.2 jdolecek * from this software without the prior written permission of
22 1.1.14.2 jdolecek * Digital Equipment Corporation.
23 1.1.14.2 jdolecek *
24 1.1.14.2 jdolecek * 3) This software is provided "AS-IS" and any express or implied
25 1.1.14.2 jdolecek * warranties, including but not limited to, any implied warranties
26 1.1.14.2 jdolecek * of merchantability, fitness for a particular purpose, or
27 1.1.14.2 jdolecek * non-infringement are disclaimed. In no event shall DIGITAL be
28 1.1.14.2 jdolecek * liable for any damages whatsoever, and in particular, DIGITAL
29 1.1.14.2 jdolecek * shall not be liable for special, indirect, consequential, or
30 1.1.14.2 jdolecek * incidental damages or damages for lost profits, loss of
31 1.1.14.2 jdolecek * revenue or loss of use, whether such damages arise in contract,
32 1.1.14.2 jdolecek * negligence, tort, under statute, in equity, at law or otherwise,
33 1.1.14.2 jdolecek * even if advised of the possibility of such damage.
34 1.1.14.2 jdolecek */
35 1.1.14.2 jdolecek
36 1.1.14.2 jdolecek #include <sys/param.h>
37 1.1.14.2 jdolecek #include <sys/device.h>
38 1.1.14.2 jdolecek #include <sys/systm.h>
39 1.1.14.2 jdolecek #include <machine/bus.h>
40 1.1.14.2 jdolecek #include <machine/intr.h>
41 1.1.14.2 jdolecek
42 1.1.14.2 jdolecek #include <dev/ofw/openfirm.h>
43 1.1.14.2 jdolecek #include <dev/isa/isavar.h>
44 1.1.14.2 jdolecek #include <dev/ofisa/ofisavar.h>
45 1.1.14.2 jdolecek
46 1.1.14.2 jdolecek #ifdef COMPAT_OLD_OFW
47 1.1.14.2 jdolecek
48 1.1.14.2 jdolecek int
49 1.1.14.2 jdolecek com_ofisa_md_match(parent, cf, aux)
50 1.1.14.2 jdolecek struct device *parent;
51 1.1.14.2 jdolecek struct cfdata *cf;
52 1.1.14.2 jdolecek void *aux;
53 1.1.14.2 jdolecek {
54 1.1.14.2 jdolecek struct ofisa_attach_args *aa = aux;
55 1.1.14.2 jdolecek char type[8];
56 1.1.14.2 jdolecek char name[8];
57 1.1.14.2 jdolecek int rv;
58 1.1.14.2 jdolecek
59 1.1.14.2 jdolecek rv = 0;
60 1.1.14.2 jdolecek if (1) { /* XXX old firmware compat enabled */
61 1.1.14.2 jdolecek /* match type and name properties */
62 1.1.14.2 jdolecek /* At a minimum, must match type and name properties. */
63 1.1.14.2 jdolecek if (OF_getprop(aa->oba.oba_phandle, "device_type",
64 1.1.14.2 jdolecek type, sizeof(type)) > 0 &&
65 1.1.14.2 jdolecek strcmp(type, "serial") == 0 &&
66 1.1.14.2 jdolecek OF_getprop(aa->oba.oba_phandle, "name", name,
67 1.1.14.2 jdolecek sizeof(name)) > 0 &&
68 1.1.14.2 jdolecek strcmp(name, "serial") == 0)
69 1.1.14.2 jdolecek rv = 4;
70 1.1.14.2 jdolecek }
71 1.1.14.2 jdolecek return (rv);
72 1.1.14.2 jdolecek }
73 1.1.14.2 jdolecek
74 1.1.14.2 jdolecek int
75 1.1.14.2 jdolecek com_ofisa_md_intr_fixup(parent, self, aux, descp, ndescs, ndescsfilled)
76 1.1.14.2 jdolecek struct device *parent, *self;
77 1.1.14.2 jdolecek void *aux;
78 1.1.14.2 jdolecek struct ofisa_intr_desc *descp;
79 1.1.14.2 jdolecek int ndescs, ndescsfilled;
80 1.1.14.2 jdolecek {
81 1.1.14.2 jdolecek
82 1.1.14.2 jdolecek if (1) /* XXX old firmware compat enabled */
83 1.1.14.2 jdolecek if (ndescs > 0 && ndescsfilled > 0)
84 1.1.14.2 jdolecek descp[0].share = IST_LEVEL;
85 1.1.14.2 jdolecek return (ndescsfilled);
86 1.1.14.2 jdolecek }
87 1.1.14.2 jdolecek
88 1.1.14.2 jdolecek #endif /* COMPAT_OLD_OFW */
89