2 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * This code is derived from software contributed to The NetBSD Foundation
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __KERNEL_RCSID(0, "$NetBSD: ioplanar.c,v 1.1 2007/12/17 19:09:40 garbled Exp $");
33 #include <sys/param.h>
34 #include <sys/device.h>
36 #include <machine/intr.h>
37 #include <machine/bus.h>
39 #include <dev/mca/mcavar.h>
40 #include <dev/mca/mcadevs.h>
42 #include <rs6000/ioplanar/ioplanarvar.h>
44 static int ioplanar_match(struct device
*, struct cfdata
*, void *);
45 static void ioplanar_attach(struct device
*, struct device
*, void *);
46 static int ioplanar_print(void *, const char *);
47 static int ioplanar_search(struct device
*, struct cfdata
*,
50 CFATTACH_DECL(ioplanar
, sizeof(struct ioplanar_softc
),
51 ioplanar_match
, ioplanar_attach
, NULL
, NULL
);
53 struct ioplanar_softc
*ioplanar_softc
;
54 extern struct cfdriver ioplanar_cd
;
56 #define RAINBOW_DEVS 7
57 int rainbow_map
[RAINBOW_DEVS
] =
58 { IOP_COM0
, IOP_COM1
, IOP_LPD
, IOP_KBD_2
,
59 IOP_TABLET_2
, IOP_MOUSE
, IOP_FDC_2
};
62 ioplanar_match(struct device
*parent
, struct cfdata
*cf
, void *aux
)
64 struct mca_attach_args
*ma
= aux
;
67 case MCA_PRODUCT_IBM_SIO_RAINBOW
:
75 ioplanar_attach(struct device
*parent
, struct device
*self
, void *aux
)
77 struct ioplanar_softc
*sc
= (struct ioplanar_softc
*)self
;
78 struct mca_attach_args
*ma
= aux
;
83 sc
->sc_ic
= ma
->ma_mc
;
84 sc
->sc_iot
= ma
->ma_iot
;
85 sc
->sc_memt
= ma
->ma_memt
;
86 sc
->sc_dmat
= ma
->ma_dmat
;
87 sc
->sc_devid
= ma
->ma_id
;
89 (void)config_search_ia(ioplanar_search
, self
, "ioplanar", aux
);
93 ioplanar_search(struct device
*parent
, struct cfdata
*cf
,
94 const int *ldesc
, void *aux
)
96 struct ioplanar_dev_attach_args idaa
;
97 struct mca_attach_args
*ma
= aux
;
100 idaa
.idaa_mc
= ma
->ma_mc
;
101 idaa
.idaa_iot
= ma
->ma_iot
;
102 idaa
.idaa_memt
= ma
->ma_memt
;
103 idaa
.idaa_dmat
= ma
->ma_dmat
;
104 idaa
.idaa_devid
= ma
->ma_id
;
107 case MCA_PRODUCT_IBM_SIO_RAINBOW
:
108 for (i
=0; i
< RAINBOW_DEVS
; i
++) {
109 idaa
.idaa_device
= rainbow_map
[i
];
110 if (config_match(parent
, cf
, &idaa
) > 0)
111 config_attach(parent
, cf
, &idaa
,
122 ioplanar_print(void *args
, const char *name
)
124 /*struct ioplanar_dev_attach_args *idaa = args;*/