xref: /titanic_51/usr/src/uts/i86pc/io/isa.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate /*
30*7c478bd9Sstevel@tonic-gate  *	ISA bus nexus driver
31*7c478bd9Sstevel@tonic-gate  */
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/conf.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/autoconf.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/errno.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/debug.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/kmem.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/ddidmareq.h>
42*7c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
43*7c478bd9Sstevel@tonic-gate #include <sys/dma_engine.h>
44*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
45*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
46*7c478bd9Sstevel@tonic-gate #include <sys/sunndi.h>
47*7c478bd9Sstevel@tonic-gate #include <sys/acpi/acpi_enum.h>
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate extern int isa_resource_setup(void);
50*7c478bd9Sstevel@tonic-gate static char USED_RESOURCES[] = "used-resources";
51*7c478bd9Sstevel@tonic-gate static void isa_alloc_nodes(dev_info_t *);
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * #define ISA_DEBUG 1
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate /*
57*7c478bd9Sstevel@tonic-gate  *      Local data
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate static ddi_dma_lim_t ISA_dma_limits = {
60*7c478bd9Sstevel@tonic-gate 	0,		/* address low				*/
61*7c478bd9Sstevel@tonic-gate 	0x00ffffff,	/* address high				*/
62*7c478bd9Sstevel@tonic-gate 	0,		/* counter max				*/
63*7c478bd9Sstevel@tonic-gate 	1,		/* burstsize				*/
64*7c478bd9Sstevel@tonic-gate 	DMA_UNIT_8,	/* minimum xfer				*/
65*7c478bd9Sstevel@tonic-gate 	0,		/* dma speed				*/
66*7c478bd9Sstevel@tonic-gate 	(uint_t)DMALIM_VER0, /* version				*/
67*7c478bd9Sstevel@tonic-gate 	0x0000ffff,	/* address register			*/
68*7c478bd9Sstevel@tonic-gate 	0x0000ffff,	/* counter register			*/
69*7c478bd9Sstevel@tonic-gate 	1,		/* sector size				*/
70*7c478bd9Sstevel@tonic-gate 	0x00000001,	/* scatter/gather list length		*/
71*7c478bd9Sstevel@tonic-gate 	(uint_t)0xffffffff /* request size			*/
72*7c478bd9Sstevel@tonic-gate };
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate static ddi_dma_attr_t ISA_dma_attr = {
75*7c478bd9Sstevel@tonic-gate 	DMA_ATTR_V0,
76*7c478bd9Sstevel@tonic-gate 	(unsigned long long)0,
77*7c478bd9Sstevel@tonic-gate 	(unsigned long long)0x00ffffff,
78*7c478bd9Sstevel@tonic-gate 	0x0000ffff,
79*7c478bd9Sstevel@tonic-gate 	1,
80*7c478bd9Sstevel@tonic-gate 	1,
81*7c478bd9Sstevel@tonic-gate 	1,
82*7c478bd9Sstevel@tonic-gate 	(unsigned long long)0xffffffff,
83*7c478bd9Sstevel@tonic-gate 	(unsigned long long)0x0000ffff,
84*7c478bd9Sstevel@tonic-gate 	1,
85*7c478bd9Sstevel@tonic-gate 	1,
86*7c478bd9Sstevel@tonic-gate 	0
87*7c478bd9Sstevel@tonic-gate };
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate /*
91*7c478bd9Sstevel@tonic-gate  * Config information
92*7c478bd9Sstevel@tonic-gate  */
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate static int
95*7c478bd9Sstevel@tonic-gate isa_dma_allochdl(dev_info_t *, dev_info_t *, ddi_dma_attr_t *,
96*7c478bd9Sstevel@tonic-gate     int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *);
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate static int
99*7c478bd9Sstevel@tonic-gate isa_dma_mctl(dev_info_t *, dev_info_t *, ddi_dma_handle_t, enum ddi_dma_ctlops,
100*7c478bd9Sstevel@tonic-gate     off_t *, size_t *, caddr_t *, uint_t);
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate static int
103*7c478bd9Sstevel@tonic-gate isa_ctlops(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, void *);
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate struct bus_ops isa_bus_ops = {
106*7c478bd9Sstevel@tonic-gate 	BUSO_REV,
107*7c478bd9Sstevel@tonic-gate 	i_ddi_bus_map,
108*7c478bd9Sstevel@tonic-gate 	NULL,
109*7c478bd9Sstevel@tonic-gate 	NULL,
110*7c478bd9Sstevel@tonic-gate 	NULL,
111*7c478bd9Sstevel@tonic-gate 	i_ddi_map_fault,
112*7c478bd9Sstevel@tonic-gate 	ddi_dma_map,
113*7c478bd9Sstevel@tonic-gate 	isa_dma_allochdl,
114*7c478bd9Sstevel@tonic-gate 	ddi_dma_freehdl,
115*7c478bd9Sstevel@tonic-gate 	ddi_dma_bindhdl,
116*7c478bd9Sstevel@tonic-gate 	ddi_dma_unbindhdl,
117*7c478bd9Sstevel@tonic-gate 	ddi_dma_flush,
118*7c478bd9Sstevel@tonic-gate 	ddi_dma_win,
119*7c478bd9Sstevel@tonic-gate 	isa_dma_mctl,
120*7c478bd9Sstevel@tonic-gate 	isa_ctlops,
121*7c478bd9Sstevel@tonic-gate 	ddi_bus_prop_op,
122*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_get_eventcookie)();	*/
123*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_add_eventcall)();	*/
124*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_remove_eventcall)();	*/
125*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_post_event)();		*/
126*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_intr_ctl)(); */
127*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_config)(); */
128*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_unconfig)(); */
129*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_fm_init)(); */
130*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_fm_fini)(); */
131*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_fm_access_enter)(); */
132*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_fm_access_exit)(); */
133*7c478bd9Sstevel@tonic-gate 	NULL,		/* (*bus_power)(); */
134*7c478bd9Sstevel@tonic-gate 	i_ddi_intr_ops	/* (*bus_intr_op)(); */
135*7c478bd9Sstevel@tonic-gate };
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate static int isa_attach(dev_info_t *devi, ddi_attach_cmd_t cmd);
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate /*
141*7c478bd9Sstevel@tonic-gate  * Internal isa ctlops support routines
142*7c478bd9Sstevel@tonic-gate  */
143*7c478bd9Sstevel@tonic-gate static int isa_initchild(dev_info_t *child);
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate struct dev_ops isa_ops = {
146*7c478bd9Sstevel@tonic-gate 	DEVO_REV,		/* devo_rev, */
147*7c478bd9Sstevel@tonic-gate 	0,			/* refcnt  */
148*7c478bd9Sstevel@tonic-gate 	ddi_no_info,		/* info */
149*7c478bd9Sstevel@tonic-gate 	nulldev,		/* identify */
150*7c478bd9Sstevel@tonic-gate 	nulldev,		/* probe */
151*7c478bd9Sstevel@tonic-gate 	isa_attach,		/* attach */
152*7c478bd9Sstevel@tonic-gate 	nodev,			/* detach */
153*7c478bd9Sstevel@tonic-gate 	nodev,			/* reset */
154*7c478bd9Sstevel@tonic-gate 	(struct cb_ops *)0,	/* driver operations */
155*7c478bd9Sstevel@tonic-gate 	&isa_bus_ops	/* bus operations */
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate };
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * Module linkage information for the kernel.
161*7c478bd9Sstevel@tonic-gate  */
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate static struct modldrv modldrv = {
164*7c478bd9Sstevel@tonic-gate 	&mod_driverops, /* Type of module.  This is ISA bus driver */
165*7c478bd9Sstevel@tonic-gate 	"isa nexus driver for 'ISA' %I%",
166*7c478bd9Sstevel@tonic-gate 	&isa_ops,	/* driver ops */
167*7c478bd9Sstevel@tonic-gate };
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate static struct modlinkage modlinkage = {
170*7c478bd9Sstevel@tonic-gate 	MODREV_1,
171*7c478bd9Sstevel@tonic-gate 	&modldrv,
172*7c478bd9Sstevel@tonic-gate 	NULL
173*7c478bd9Sstevel@tonic-gate };
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate int
176*7c478bd9Sstevel@tonic-gate _init(void)
177*7c478bd9Sstevel@tonic-gate {
178*7c478bd9Sstevel@tonic-gate 	return (mod_install(&modlinkage));
179*7c478bd9Sstevel@tonic-gate }
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate int
182*7c478bd9Sstevel@tonic-gate _fini(void)
183*7c478bd9Sstevel@tonic-gate {
184*7c478bd9Sstevel@tonic-gate 	return (mod_remove(&modlinkage));
185*7c478bd9Sstevel@tonic-gate }
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate int
188*7c478bd9Sstevel@tonic-gate _info(struct modinfo *modinfop)
189*7c478bd9Sstevel@tonic-gate {
190*7c478bd9Sstevel@tonic-gate 	return (mod_info(&modlinkage, modinfop));
191*7c478bd9Sstevel@tonic-gate }
192*7c478bd9Sstevel@tonic-gate 
193*7c478bd9Sstevel@tonic-gate static int
194*7c478bd9Sstevel@tonic-gate isa_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
195*7c478bd9Sstevel@tonic-gate {
196*7c478bd9Sstevel@tonic-gate 	int rval;
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate 	if (cmd != DDI_ATTACH)
199*7c478bd9Sstevel@tonic-gate 		return (DDI_FAILURE);
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate 	if ((rval = i_dmae_init(devi)) == DDI_SUCCESS) {
202*7c478bd9Sstevel@tonic-gate 		ddi_report_dev(devi);
203*7c478bd9Sstevel@tonic-gate 		/*
204*7c478bd9Sstevel@tonic-gate 		 * Enumerate children -- invoking ACPICA
205*7c478bd9Sstevel@tonic-gate 		 * This is normally in bus_config(), but we need this
206*7c478bd9Sstevel@tonic-gate 		 * to happen earlier to boot.
207*7c478bd9Sstevel@tonic-gate 		 */
208*7c478bd9Sstevel@tonic-gate 		isa_alloc_nodes(devi);
209*7c478bd9Sstevel@tonic-gate 	}
210*7c478bd9Sstevel@tonic-gate 	return (rval);
211*7c478bd9Sstevel@tonic-gate }
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate static int
214*7c478bd9Sstevel@tonic-gate isa_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *dma_attr,
215*7c478bd9Sstevel@tonic-gate     int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep)
216*7c478bd9Sstevel@tonic-gate {
217*7c478bd9Sstevel@tonic-gate 	ddi_dma_attr_merge(dma_attr, &ISA_dma_attr);
218*7c478bd9Sstevel@tonic-gate 	return (ddi_dma_allochdl(dip, rdip, dma_attr, waitfp, arg, handlep));
219*7c478bd9Sstevel@tonic-gate }
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate static int
222*7c478bd9Sstevel@tonic-gate isa_dma_mctl(dev_info_t *dip, dev_info_t *rdip,
223*7c478bd9Sstevel@tonic-gate     ddi_dma_handle_t handle, enum ddi_dma_ctlops request,
224*7c478bd9Sstevel@tonic-gate     off_t *offp, size_t *lenp, caddr_t *objp, uint_t flags)
225*7c478bd9Sstevel@tonic-gate {
226*7c478bd9Sstevel@tonic-gate 	int rval;
227*7c478bd9Sstevel@tonic-gate 	ddi_dma_lim_t defalt;
228*7c478bd9Sstevel@tonic-gate 	int arg = (int)(uintptr_t)objp;
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate 	switch (request) {
231*7c478bd9Sstevel@tonic-gate 
232*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_PROG:
233*7c478bd9Sstevel@tonic-gate 		return (i_dmae_prog(rdip, (struct ddi_dmae_req *)offp,
234*7c478bd9Sstevel@tonic-gate 		    (ddi_dma_cookie_t *)lenp, arg));
235*7c478bd9Sstevel@tonic-gate 
236*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_ACQUIRE:
237*7c478bd9Sstevel@tonic-gate 		return (i_dmae_acquire(rdip, arg, (int(*)(caddr_t))offp,
238*7c478bd9Sstevel@tonic-gate 		    (caddr_t)lenp));
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_FREE:
241*7c478bd9Sstevel@tonic-gate 		return (i_dmae_free(rdip, arg));
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_STOP:
244*7c478bd9Sstevel@tonic-gate 		i_dmae_stop(rdip, arg);
245*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_ENABLE:
248*7c478bd9Sstevel@tonic-gate 		i_dmae_enable(rdip, arg);
249*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
250*7c478bd9Sstevel@tonic-gate 
251*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_DISABLE:
252*7c478bd9Sstevel@tonic-gate 		i_dmae_disable(rdip, arg);
253*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_GETCNT:
256*7c478bd9Sstevel@tonic-gate 		i_dmae_get_chan_stat(rdip, arg, NULL, (int *)lenp);
257*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_SWSETUP:
260*7c478bd9Sstevel@tonic-gate 		return (i_dmae_swsetup(rdip, (struct ddi_dmae_req *)offp,
261*7c478bd9Sstevel@tonic-gate 		    (ddi_dma_cookie_t *)lenp, arg));
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_SWSTART:
264*7c478bd9Sstevel@tonic-gate 		i_dmae_swstart(rdip, arg);
265*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
266*7c478bd9Sstevel@tonic-gate 
267*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_GETLIM:
268*7c478bd9Sstevel@tonic-gate 		bcopy(&ISA_dma_limits, objp, sizeof (ddi_dma_lim_t));
269*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
270*7c478bd9Sstevel@tonic-gate 
271*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_GETATTR:
272*7c478bd9Sstevel@tonic-gate 		bcopy(&ISA_dma_attr, objp, sizeof (ddi_dma_attr_t));
273*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_E_1STPTY:
276*7c478bd9Sstevel@tonic-gate 		{
277*7c478bd9Sstevel@tonic-gate 			struct ddi_dmae_req req1stpty =
278*7c478bd9Sstevel@tonic-gate 			    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
279*7c478bd9Sstevel@tonic-gate 			if (arg == 0) {
280*7c478bd9Sstevel@tonic-gate 				req1stpty.der_command = DMAE_CMD_TRAN;
281*7c478bd9Sstevel@tonic-gate 				req1stpty.der_trans = DMAE_TRANS_DMND;
282*7c478bd9Sstevel@tonic-gate 			} else {
283*7c478bd9Sstevel@tonic-gate 				req1stpty.der_trans = DMAE_TRANS_CSCD;
284*7c478bd9Sstevel@tonic-gate 			}
285*7c478bd9Sstevel@tonic-gate 			return (i_dmae_prog(rdip, &req1stpty, NULL, arg));
286*7c478bd9Sstevel@tonic-gate 		}
287*7c478bd9Sstevel@tonic-gate 
288*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_IOPB_ALLOC:	/* get contiguous DMA-able memory */
289*7c478bd9Sstevel@tonic-gate 	case DDI_DMA_SMEM_ALLOC:
290*7c478bd9Sstevel@tonic-gate 		if (!offp) {
291*7c478bd9Sstevel@tonic-gate 			defalt = ISA_dma_limits;
292*7c478bd9Sstevel@tonic-gate 			offp = (off_t *)&defalt;
293*7c478bd9Sstevel@tonic-gate 		}
294*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
295*7c478bd9Sstevel@tonic-gate 	default:
296*7c478bd9Sstevel@tonic-gate 		rval = ddi_dma_mctl(dip, rdip, handle, request, offp,
297*7c478bd9Sstevel@tonic-gate 		    lenp, objp, flags);
298*7c478bd9Sstevel@tonic-gate 	}
299*7c478bd9Sstevel@tonic-gate 	return (rval);
300*7c478bd9Sstevel@tonic-gate }
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate /*
303*7c478bd9Sstevel@tonic-gate  * Check if driver should be treated as an old pre 2.6 driver
304*7c478bd9Sstevel@tonic-gate  */
305*7c478bd9Sstevel@tonic-gate static int
306*7c478bd9Sstevel@tonic-gate old_driver(dev_info_t *dip)
307*7c478bd9Sstevel@tonic-gate {
308*7c478bd9Sstevel@tonic-gate 	extern int ignore_hardware_nodes;	/* force flag from ddi_impl.c */
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate 	if (ndi_dev_is_persistent_node(dip)) {
311*7c478bd9Sstevel@tonic-gate 		if (ignore_hardware_nodes)
312*7c478bd9Sstevel@tonic-gate 			return (1);
313*7c478bd9Sstevel@tonic-gate 		if (ddi_getprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
314*7c478bd9Sstevel@tonic-gate 		    "ignore-hardware-nodes", -1) != -1)
315*7c478bd9Sstevel@tonic-gate 			return (1);
316*7c478bd9Sstevel@tonic-gate 	}
317*7c478bd9Sstevel@tonic-gate 	return (0);
318*7c478bd9Sstevel@tonic-gate }
319*7c478bd9Sstevel@tonic-gate 
320*7c478bd9Sstevel@tonic-gate typedef struct {
321*7c478bd9Sstevel@tonic-gate 	uint32_t phys_hi;
322*7c478bd9Sstevel@tonic-gate 	uint32_t phys_lo;
323*7c478bd9Sstevel@tonic-gate 	uint32_t size;
324*7c478bd9Sstevel@tonic-gate } isa_regs_t;
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate /*
327*7c478bd9Sstevel@tonic-gate  * Return non-zero if device in tree is a PnP isa device
328*7c478bd9Sstevel@tonic-gate  */
329*7c478bd9Sstevel@tonic-gate static int
330*7c478bd9Sstevel@tonic-gate is_pnpisa(dev_info_t *dip)
331*7c478bd9Sstevel@tonic-gate {
332*7c478bd9Sstevel@tonic-gate 	isa_regs_t *isa_regs;
333*7c478bd9Sstevel@tonic-gate 	int proplen, pnpisa;
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate 	if (ndi_dev_is_persistent_node(dip) == 0)
336*7c478bd9Sstevel@tonic-gate 		return (0);
337*7c478bd9Sstevel@tonic-gate 	if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg",
338*7c478bd9Sstevel@tonic-gate 		(caddr_t)&isa_regs, &proplen) != DDI_PROP_SUCCESS) {
339*7c478bd9Sstevel@tonic-gate 		return (0);
340*7c478bd9Sstevel@tonic-gate 	}
341*7c478bd9Sstevel@tonic-gate 	pnpisa = isa_regs[0].phys_hi & 0x80000000;
342*7c478bd9Sstevel@tonic-gate 	/*
343*7c478bd9Sstevel@tonic-gate 	 * free the memory allocated by ddi_getlongprop().
344*7c478bd9Sstevel@tonic-gate 	 */
345*7c478bd9Sstevel@tonic-gate 	kmem_free(isa_regs, proplen);
346*7c478bd9Sstevel@tonic-gate 	if (pnpisa)
347*7c478bd9Sstevel@tonic-gate 		return (1);
348*7c478bd9Sstevel@tonic-gate 	else
349*7c478bd9Sstevel@tonic-gate 		return (0);
350*7c478bd9Sstevel@tonic-gate }
351*7c478bd9Sstevel@tonic-gate 
352*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
353*7c478bd9Sstevel@tonic-gate static int
354*7c478bd9Sstevel@tonic-gate isa_ctlops(dev_info_t *dip, dev_info_t *rdip,
355*7c478bd9Sstevel@tonic-gate 	ddi_ctl_enum_t ctlop, void *arg, void *result)
356*7c478bd9Sstevel@tonic-gate {
357*7c478bd9Sstevel@tonic-gate 	switch (ctlop) {
358*7c478bd9Sstevel@tonic-gate 	case DDI_CTLOPS_REPORTDEV:
359*7c478bd9Sstevel@tonic-gate 		if (rdip == (dev_info_t *)0)
360*7c478bd9Sstevel@tonic-gate 			return (DDI_FAILURE);
361*7c478bd9Sstevel@tonic-gate 		cmn_err(CE_CONT, "?ISA-device: %s%d\n",
362*7c478bd9Sstevel@tonic-gate 		    ddi_driver_name(rdip), ddi_get_instance(rdip));
363*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate 	case DDI_CTLOPS_INITCHILD:
366*7c478bd9Sstevel@tonic-gate 		/*
367*7c478bd9Sstevel@tonic-gate 		 * older drivers aren't expecting the "standard" device
368*7c478bd9Sstevel@tonic-gate 		 * node format used by the hardware nodes.  these drivers
369*7c478bd9Sstevel@tonic-gate 		 * only expect their own properties set in their driver.conf
370*7c478bd9Sstevel@tonic-gate 		 * files.  so they tell us not to call them with hardware
371*7c478bd9Sstevel@tonic-gate 		 * nodes by setting the property "ignore-hardware-nodes".
372*7c478bd9Sstevel@tonic-gate 		 */
373*7c478bd9Sstevel@tonic-gate 		if (old_driver((dev_info_t *)arg)) {
374*7c478bd9Sstevel@tonic-gate 			return (DDI_NOT_WELL_FORMED);
375*7c478bd9Sstevel@tonic-gate 		}
376*7c478bd9Sstevel@tonic-gate 
377*7c478bd9Sstevel@tonic-gate 		return (isa_initchild((dev_info_t *)arg));
378*7c478bd9Sstevel@tonic-gate 
379*7c478bd9Sstevel@tonic-gate 	case DDI_CTLOPS_UNINITCHILD:
380*7c478bd9Sstevel@tonic-gate 		impl_ddi_sunbus_removechild((dev_info_t *)arg);
381*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
382*7c478bd9Sstevel@tonic-gate 
383*7c478bd9Sstevel@tonic-gate 	case DDI_CTLOPS_SIDDEV:
384*7c478bd9Sstevel@tonic-gate 		/*
385*7c478bd9Sstevel@tonic-gate 		 * All ISA devices need to do confirming probes
386*7c478bd9Sstevel@tonic-gate 		 * unless they are PnP ISA.
387*7c478bd9Sstevel@tonic-gate 		 */
388*7c478bd9Sstevel@tonic-gate 		if (is_pnpisa(dip))
389*7c478bd9Sstevel@tonic-gate 			return (DDI_SUCCESS);
390*7c478bd9Sstevel@tonic-gate 		else
391*7c478bd9Sstevel@tonic-gate 			return (DDI_FAILURE);
392*7c478bd9Sstevel@tonic-gate 
393*7c478bd9Sstevel@tonic-gate 	default:
394*7c478bd9Sstevel@tonic-gate 		return (ddi_ctlops(dip, rdip, ctlop, arg, result));
395*7c478bd9Sstevel@tonic-gate 	}
396*7c478bd9Sstevel@tonic-gate }
397*7c478bd9Sstevel@tonic-gate 
398*7c478bd9Sstevel@tonic-gate static void
399*7c478bd9Sstevel@tonic-gate isa_vendor(uint32_t id, char *vendor)
400*7c478bd9Sstevel@tonic-gate {
401*7c478bd9Sstevel@tonic-gate 	vendor[0] = '@' + ((id >> 26) & 0x1f);
402*7c478bd9Sstevel@tonic-gate 	vendor[1] = '@' + ((id >> 21) & 0x1f);
403*7c478bd9Sstevel@tonic-gate 	vendor[2] = '@' + ((id >> 16) & 0x1f);
404*7c478bd9Sstevel@tonic-gate 	vendor[3] = 0;
405*7c478bd9Sstevel@tonic-gate }
406*7c478bd9Sstevel@tonic-gate 
407*7c478bd9Sstevel@tonic-gate /*
408*7c478bd9Sstevel@tonic-gate  * Name a child
409*7c478bd9Sstevel@tonic-gate  */
410*7c478bd9Sstevel@tonic-gate static int
411*7c478bd9Sstevel@tonic-gate isa_name_child(dev_info_t *child, char *name, int namelen)
412*7c478bd9Sstevel@tonic-gate {
413*7c478bd9Sstevel@tonic-gate 	char vendor[8];
414*7c478bd9Sstevel@tonic-gate 	int device;
415*7c478bd9Sstevel@tonic-gate 	uint32_t serial;
416*7c478bd9Sstevel@tonic-gate 	int func;
417*7c478bd9Sstevel@tonic-gate 	int bustype;
418*7c478bd9Sstevel@tonic-gate 	uint32_t base;
419*7c478bd9Sstevel@tonic-gate 	int proplen;
420*7c478bd9Sstevel@tonic-gate 	int pnpisa = 0;
421*7c478bd9Sstevel@tonic-gate 	isa_regs_t *isa_regs;
422*7c478bd9Sstevel@tonic-gate 
423*7c478bd9Sstevel@tonic-gate 	void make_ddi_ppd(dev_info_t *, struct ddi_parent_private_data **);
424*7c478bd9Sstevel@tonic-gate 
425*7c478bd9Sstevel@tonic-gate 	/*
426*7c478bd9Sstevel@tonic-gate 	 * older drivers aren't expecting the "standard" device
427*7c478bd9Sstevel@tonic-gate 	 * node format used by the hardware nodes.  these drivers
428*7c478bd9Sstevel@tonic-gate 	 * only expect their own properties set in their driver.conf
429*7c478bd9Sstevel@tonic-gate 	 * files.  so they tell us not to call them with hardware
430*7c478bd9Sstevel@tonic-gate 	 * nodes by setting the property "ignore-hardware-nodes".
431*7c478bd9Sstevel@tonic-gate 	 */
432*7c478bd9Sstevel@tonic-gate 	if (old_driver(child))
433*7c478bd9Sstevel@tonic-gate 		return (DDI_FAILURE);
434*7c478bd9Sstevel@tonic-gate 
435*7c478bd9Sstevel@tonic-gate 	/*
436*7c478bd9Sstevel@tonic-gate 	 * Fill in parent-private data
437*7c478bd9Sstevel@tonic-gate 	 */
438*7c478bd9Sstevel@tonic-gate 	if (ddi_get_parent_data(child) == NULL) {
439*7c478bd9Sstevel@tonic-gate 		struct ddi_parent_private_data *pdptr;
440*7c478bd9Sstevel@tonic-gate 		make_ddi_ppd(child, &pdptr);
441*7c478bd9Sstevel@tonic-gate 		ddi_set_parent_data(child, pdptr);
442*7c478bd9Sstevel@tonic-gate 	}
443*7c478bd9Sstevel@tonic-gate 
444*7c478bd9Sstevel@tonic-gate 	if (ndi_dev_is_persistent_node(child) == 0) {
445*7c478bd9Sstevel@tonic-gate 		/*
446*7c478bd9Sstevel@tonic-gate 		 * For .conf nodes, generate name from parent private data
447*7c478bd9Sstevel@tonic-gate 		 */
448*7c478bd9Sstevel@tonic-gate 		name[0] = '\0';
449*7c478bd9Sstevel@tonic-gate 		if (sparc_pd_getnreg(child) > 0) {
450*7c478bd9Sstevel@tonic-gate 			(void) snprintf(name, namelen, "%x,%x",
451*7c478bd9Sstevel@tonic-gate 			    (uint_t)sparc_pd_getreg(child, 0)->regspec_bustype,
452*7c478bd9Sstevel@tonic-gate 			    (uint_t)sparc_pd_getreg(child, 0)->regspec_addr);
453*7c478bd9Sstevel@tonic-gate 		}
454*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
455*7c478bd9Sstevel@tonic-gate 	}
456*7c478bd9Sstevel@tonic-gate 
457*7c478bd9Sstevel@tonic-gate 	/*
458*7c478bd9Sstevel@tonic-gate 	 * For hw nodes, look up "reg" property
459*7c478bd9Sstevel@tonic-gate 	 */
460*7c478bd9Sstevel@tonic-gate 	if (ddi_getlongprop(DDI_DEV_T_ANY, child, DDI_PROP_DONTPASS, "reg",
461*7c478bd9Sstevel@tonic-gate 	    (caddr_t)&isa_regs, &proplen) != DDI_PROP_SUCCESS) {
462*7c478bd9Sstevel@tonic-gate 		return (DDI_FAILURE);
463*7c478bd9Sstevel@tonic-gate 	}
464*7c478bd9Sstevel@tonic-gate 
465*7c478bd9Sstevel@tonic-gate 	/*
466*7c478bd9Sstevel@tonic-gate 	 * extract the device identifications
467*7c478bd9Sstevel@tonic-gate 	 */
468*7c478bd9Sstevel@tonic-gate 	pnpisa = isa_regs[0].phys_hi & 0x80000000;
469*7c478bd9Sstevel@tonic-gate 	if (pnpisa) {
470*7c478bd9Sstevel@tonic-gate 		isa_vendor(isa_regs[0].phys_hi, vendor);
471*7c478bd9Sstevel@tonic-gate 		device = isa_regs[0].phys_hi & 0xffff;
472*7c478bd9Sstevel@tonic-gate 		serial = isa_regs[0].phys_lo;
473*7c478bd9Sstevel@tonic-gate 		func = (isa_regs[0].size >> 24) & 0xff;
474*7c478bd9Sstevel@tonic-gate 		if (func != 0)
475*7c478bd9Sstevel@tonic-gate 			(void) snprintf(name, namelen, "pnp%s,%04x,%x,%x",
476*7c478bd9Sstevel@tonic-gate 			    vendor, device, serial, func);
477*7c478bd9Sstevel@tonic-gate 		else
478*7c478bd9Sstevel@tonic-gate 			(void) snprintf(name, namelen, "pnp%s,%04x,%x",
479*7c478bd9Sstevel@tonic-gate 			    vendor, device, serial);
480*7c478bd9Sstevel@tonic-gate 	} else {
481*7c478bd9Sstevel@tonic-gate 		bustype = isa_regs[0].phys_hi;
482*7c478bd9Sstevel@tonic-gate 		base = isa_regs[0].phys_lo;
483*7c478bd9Sstevel@tonic-gate 		(void) sprintf(name, "%x,%x", bustype, base);
484*7c478bd9Sstevel@tonic-gate 	}
485*7c478bd9Sstevel@tonic-gate 
486*7c478bd9Sstevel@tonic-gate 	/*
487*7c478bd9Sstevel@tonic-gate 	 * free the memory allocated by ddi_getlongprop().
488*7c478bd9Sstevel@tonic-gate 	 */
489*7c478bd9Sstevel@tonic-gate 	kmem_free(isa_regs, proplen);
490*7c478bd9Sstevel@tonic-gate 
491*7c478bd9Sstevel@tonic-gate 	return (DDI_SUCCESS);
492*7c478bd9Sstevel@tonic-gate }
493*7c478bd9Sstevel@tonic-gate 
494*7c478bd9Sstevel@tonic-gate static int
495*7c478bd9Sstevel@tonic-gate isa_initchild(dev_info_t *child)
496*7c478bd9Sstevel@tonic-gate {
497*7c478bd9Sstevel@tonic-gate 	char name[80];
498*7c478bd9Sstevel@tonic-gate 
499*7c478bd9Sstevel@tonic-gate 	if (isa_name_child(child, name, 80) != DDI_SUCCESS)
500*7c478bd9Sstevel@tonic-gate 		return (DDI_FAILURE);
501*7c478bd9Sstevel@tonic-gate 	ddi_set_name_addr(child, name);
502*7c478bd9Sstevel@tonic-gate 
503*7c478bd9Sstevel@tonic-gate 	if (ndi_dev_is_persistent_node(child) != 0)
504*7c478bd9Sstevel@tonic-gate 		return (DDI_SUCCESS);
505*7c478bd9Sstevel@tonic-gate 
506*7c478bd9Sstevel@tonic-gate 	/*
507*7c478bd9Sstevel@tonic-gate 	 * This is a .conf node, try merge properties onto a
508*7c478bd9Sstevel@tonic-gate 	 * hw node with the same name.
509*7c478bd9Sstevel@tonic-gate 	 */
510*7c478bd9Sstevel@tonic-gate 	if (ndi_merge_node(child, isa_name_child) == DDI_SUCCESS) {
511*7c478bd9Sstevel@tonic-gate 		/*
512*7c478bd9Sstevel@tonic-gate 		 * Return failure to remove node
513*7c478bd9Sstevel@tonic-gate 		 */
514*7c478bd9Sstevel@tonic-gate 		impl_ddi_sunbus_removechild(child);
515*7c478bd9Sstevel@tonic-gate 		return (DDI_FAILURE);
516*7c478bd9Sstevel@tonic-gate 	}
517*7c478bd9Sstevel@tonic-gate 	/*
518*7c478bd9Sstevel@tonic-gate 	 * Cannot merge node, permit pseudo children
519*7c478bd9Sstevel@tonic-gate 	 */
520*7c478bd9Sstevel@tonic-gate 	return (DDI_SUCCESS);
521*7c478bd9Sstevel@tonic-gate }
522*7c478bd9Sstevel@tonic-gate 
523*7c478bd9Sstevel@tonic-gate /*
524*7c478bd9Sstevel@tonic-gate  * called when ACPI enumeration is not used
525*7c478bd9Sstevel@tonic-gate  */
526*7c478bd9Sstevel@tonic-gate static void
527*7c478bd9Sstevel@tonic-gate add_known_used_resources(void)
528*7c478bd9Sstevel@tonic-gate {
529*7c478bd9Sstevel@tonic-gate 	/* needs to be in increasing order */
530*7c478bd9Sstevel@tonic-gate 	int intr[] = {0x1, 0x3, 0x4, 0x6, 0x7, 0xc};
531*7c478bd9Sstevel@tonic-gate 	int dma[] = {0x2};
532*7c478bd9Sstevel@tonic-gate 	int io[] = {0x60, 0x1, 0x64, 0x1, 0x2f8, 0x8, 0x378, 0x8, 0x3f0, 0x10,
533*7c478bd9Sstevel@tonic-gate 	    0x778, 0x4};
534*7c478bd9Sstevel@tonic-gate 	dev_info_t *usedrdip;
535*7c478bd9Sstevel@tonic-gate 
536*7c478bd9Sstevel@tonic-gate 	usedrdip = ddi_find_devinfo(USED_RESOURCES, -1, 0);
537*7c478bd9Sstevel@tonic-gate 
538*7c478bd9Sstevel@tonic-gate 	if (usedrdip == NULL) {
539*7c478bd9Sstevel@tonic-gate 		(void) ndi_devi_alloc_sleep(ddi_root_node(), USED_RESOURCES,
540*7c478bd9Sstevel@tonic-gate 		    (dnode_t)DEVI_SID_NODEID, &usedrdip);
541*7c478bd9Sstevel@tonic-gate 	}
542*7c478bd9Sstevel@tonic-gate 
543*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, usedrdip,
544*7c478bd9Sstevel@tonic-gate 	    "interrupts", (int *)intr, (int)(sizeof (intr) / sizeof (int)));
545*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, usedrdip,
546*7c478bd9Sstevel@tonic-gate 	    "io-space", (int *)io, (int)(sizeof (io) / sizeof (int)));
547*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, usedrdip,
548*7c478bd9Sstevel@tonic-gate 	    "dma-channels", (int *)dma, (int)(sizeof (dma) / sizeof (int)));
549*7c478bd9Sstevel@tonic-gate 	(void) ndi_devi_bind_driver(usedrdip, 0);
550*7c478bd9Sstevel@tonic-gate 
551*7c478bd9Sstevel@tonic-gate }
552*7c478bd9Sstevel@tonic-gate 
553*7c478bd9Sstevel@tonic-gate static void
554*7c478bd9Sstevel@tonic-gate isa_alloc_nodes(dev_info_t *isa_dip)
555*7c478bd9Sstevel@tonic-gate {
556*7c478bd9Sstevel@tonic-gate 	static int alloced = 0;
557*7c478bd9Sstevel@tonic-gate 	int circ, i;
558*7c478bd9Sstevel@tonic-gate 	dev_info_t *xdip;
559*7c478bd9Sstevel@tonic-gate 
560*7c478bd9Sstevel@tonic-gate 	/* hard coded isa stuff */
561*7c478bd9Sstevel@tonic-gate 	struct regspec asy_regs[] = {
562*7c478bd9Sstevel@tonic-gate 		{1, 0x3f8, 0x8},
563*7c478bd9Sstevel@tonic-gate 		{1, 0x2f8, 0x8}
564*7c478bd9Sstevel@tonic-gate 	};
565*7c478bd9Sstevel@tonic-gate 	int asy_intrs[] = {0x4, 0x3};
566*7c478bd9Sstevel@tonic-gate 
567*7c478bd9Sstevel@tonic-gate 	struct regspec lp_regs = {1, 0x378, 8};
568*7c478bd9Sstevel@tonic-gate 	int lp_intr = 7;
569*7c478bd9Sstevel@tonic-gate 
570*7c478bd9Sstevel@tonic-gate 	struct regspec i8042_regs[] = {
571*7c478bd9Sstevel@tonic-gate 		{1, 0x60, 0x1},
572*7c478bd9Sstevel@tonic-gate 		{1, 0x64, 0x1}
573*7c478bd9Sstevel@tonic-gate 	};
574*7c478bd9Sstevel@tonic-gate 	int i8042_intrs[] = {0x1, 0xc};
575*7c478bd9Sstevel@tonic-gate 	char *acpi_prop;
576*7c478bd9Sstevel@tonic-gate 	int acpi_enum = 1; /* ACPI is default to be on */
577*7c478bd9Sstevel@tonic-gate 
578*7c478bd9Sstevel@tonic-gate 	if (alloced)
579*7c478bd9Sstevel@tonic-gate 		return;
580*7c478bd9Sstevel@tonic-gate 
581*7c478bd9Sstevel@tonic-gate 	ndi_devi_enter(isa_dip, &circ);
582*7c478bd9Sstevel@tonic-gate 	if (alloced) {	/* just in case we are multi-threaded */
583*7c478bd9Sstevel@tonic-gate 		ndi_devi_exit(isa_dip, circ);
584*7c478bd9Sstevel@tonic-gate 		return;
585*7c478bd9Sstevel@tonic-gate 	}
586*7c478bd9Sstevel@tonic-gate 	alloced = 1;
587*7c478bd9Sstevel@tonic-gate 
588*7c478bd9Sstevel@tonic-gate 	if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
589*7c478bd9Sstevel@tonic-gate 	    DDI_PROP_DONTPASS, "acpi-enum", &acpi_prop) == DDI_PROP_SUCCESS) {
590*7c478bd9Sstevel@tonic-gate 		acpi_enum = strcmp("off", acpi_prop);
591*7c478bd9Sstevel@tonic-gate 		ddi_prop_free(acpi_prop);
592*7c478bd9Sstevel@tonic-gate 	}
593*7c478bd9Sstevel@tonic-gate 
594*7c478bd9Sstevel@tonic-gate 	if (acpi_enum) {
595*7c478bd9Sstevel@tonic-gate 		if (acpi_isa_device_enum(isa_dip)) {
596*7c478bd9Sstevel@tonic-gate 			ndi_devi_exit(isa_dip, circ);
597*7c478bd9Sstevel@tonic-gate 			if (isa_resource_setup() != NDI_SUCCESS) {
598*7c478bd9Sstevel@tonic-gate 				cmn_err(CE_WARN, "isa nexus: isa "
599*7c478bd9Sstevel@tonic-gate 				    "resource setup failed");
600*7c478bd9Sstevel@tonic-gate 			}
601*7c478bd9Sstevel@tonic-gate 			return;
602*7c478bd9Sstevel@tonic-gate 		}
603*7c478bd9Sstevel@tonic-gate 		cmn_err(CE_NOTE, "!Solaris did not detect ACPI BIOS");
604*7c478bd9Sstevel@tonic-gate 	}
605*7c478bd9Sstevel@tonic-gate 	cmn_err(CE_NOTE, "!ACPI is off");
606*7c478bd9Sstevel@tonic-gate 
607*7c478bd9Sstevel@tonic-gate 	/* serial ports */
608*7c478bd9Sstevel@tonic-gate 	for (i = 0; i < 2; i++) {
609*7c478bd9Sstevel@tonic-gate 		ndi_devi_alloc_sleep(isa_dip, "asy",
610*7c478bd9Sstevel@tonic-gate 		    (dnode_t)DEVI_SID_NODEID, &xdip);
611*7c478bd9Sstevel@tonic-gate 		(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
612*7c478bd9Sstevel@tonic-gate 		    "reg", (int *)&asy_regs[i], 3);
613*7c478bd9Sstevel@tonic-gate 		(void) ndi_prop_update_int(DDI_DEV_T_NONE, xdip,
614*7c478bd9Sstevel@tonic-gate 		    "interrupts", asy_intrs[i]);
615*7c478bd9Sstevel@tonic-gate 		(void) ndi_devi_bind_driver(xdip, 0);
616*7c478bd9Sstevel@tonic-gate 	}
617*7c478bd9Sstevel@tonic-gate 
618*7c478bd9Sstevel@tonic-gate 	/* parallel port */
619*7c478bd9Sstevel@tonic-gate 	ndi_devi_alloc_sleep(isa_dip, "lp",
620*7c478bd9Sstevel@tonic-gate 	    (dnode_t)DEVI_SID_NODEID, &xdip);
621*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
622*7c478bd9Sstevel@tonic-gate 	    "reg", (int *)&lp_regs, 3);
623*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int(DDI_DEV_T_NONE, xdip,
624*7c478bd9Sstevel@tonic-gate 	    "interrupts", lp_intr);
625*7c478bd9Sstevel@tonic-gate 	(void) ndi_devi_bind_driver(xdip, 0);
626*7c478bd9Sstevel@tonic-gate 
627*7c478bd9Sstevel@tonic-gate 	/* i8042 node */
628*7c478bd9Sstevel@tonic-gate 	ndi_devi_alloc_sleep(isa_dip, "i8042",
629*7c478bd9Sstevel@tonic-gate 	    (dnode_t)DEVI_SID_NODEID, &xdip);
630*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
631*7c478bd9Sstevel@tonic-gate 	    "reg", (int *)i8042_regs, 6);
632*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
633*7c478bd9Sstevel@tonic-gate 	    "interrupts", (int *)i8042_intrs, 2);
634*7c478bd9Sstevel@tonic-gate 	(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
635*7c478bd9Sstevel@tonic-gate 	    "unit-address", "1,60");
636*7c478bd9Sstevel@tonic-gate 	(void) ndi_devi_bind_driver(xdip, 0);
637*7c478bd9Sstevel@tonic-gate 
638*7c478bd9Sstevel@tonic-gate 	add_known_used_resources();
639*7c478bd9Sstevel@tonic-gate 
640*7c478bd9Sstevel@tonic-gate 	ndi_devi_exit(isa_dip, circ);
641*7c478bd9Sstevel@tonic-gate 
642*7c478bd9Sstevel@tonic-gate }
643