preprocessor cleanup: __xpv
[unleashed.git] / usr / src / uts / i86pc / io / isa.c
blobe80202e750c684237a1b755713f8d1e5ca0ff05d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 * Copyright (c) 2012 Gary Mills
24 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
28 * ISA bus nexus driver
31 #include <sys/types.h>
32 #include <sys/cmn_err.h>
33 #include <sys/conf.h>
34 #include <sys/modctl.h>
35 #include <sys/autoconf.h>
36 #include <sys/errno.h>
37 #include <sys/debug.h>
38 #include <sys/kmem.h>
39 #include <sys/psm.h>
40 #include <sys/ddidmareq.h>
41 #include <sys/ddi_impldefs.h>
42 #include <sys/ddi_subrdefs.h>
43 #include <sys/dma_engine.h>
44 #include <sys/ddi.h>
45 #include <sys/sunddi.h>
46 #include <sys/sunndi.h>
47 #include <sys/acpi/acpi_enum.h>
48 #include <sys/mach_intr.h>
49 #include <sys/pci.h>
50 #include <sys/note.h>
51 #include <sys/boot_console.h>
52 #include <sys/apic.h>
55 extern int pseudo_isa;
56 extern int isa_resource_setup(void);
57 extern int (*psm_intr_ops)(dev_info_t *, ddi_intr_handle_impl_t *,
58 psm_intr_op_t, int *);
59 extern void pci_register_isa_resources(int, uint32_t, uint32_t);
60 static void isa_enumerate(int);
61 static void enumerate_BIOS_serial(dev_info_t *);
62 static void adjust_prtsz(dev_info_t *isa_dip);
63 static void isa_create_ranges_prop(dev_info_t *);
65 #define USED_RESOURCES "used-resources"
68 * The following typedef is used to represent an entry in the "ranges"
69 * property of a pci-isa bridge device node.
71 typedef struct {
72 uint32_t child_high;
73 uint32_t child_low;
74 uint32_t parent_high;
75 uint32_t parent_mid;
76 uint32_t parent_low;
77 uint32_t size;
78 } pib_ranges_t;
80 typedef struct {
81 uint32_t base;
82 uint32_t len;
83 } used_ranges_t;
85 #define USED_CELL_SIZE 2 /* 1 byte addr, 1 byte size */
86 #define ISA_ADDR_IO 1 /* IO address space */
87 #define ISA_ADDR_MEM 0 /* memory adress space */
90 * #define ISA_DEBUG 1
93 #define num_BIOS_serial 4 /* number of BIOS serial ports to look at */
94 #define min_BIOS_serial 2 /* minimum number of BIOS serial ports */
95 #define COM_ISR 2 /* 16550 intr status register */
96 #define COM_SCR 7 /* 16550 scratch register */
99 * For serial ports not enumerated by ACPI, and parallel ports with
100 * illegal size. Typically, a system can have as many as 4 serial
101 * ports and 3 parallel ports.
103 #define MAX_EXTRA_RESOURCE 7
104 static struct regspec isa_extra_resource[MAX_EXTRA_RESOURCE];
105 static int isa_extra_count = 0;
107 /* Register definitions for COM1 to COM4. */
108 static struct regspec asy_regs[] = {
109 {1, 0x3f8, 0x8},
110 {1, 0x2f8, 0x8},
111 {1, 0x3e8, 0x8},
112 {1, 0x2e8, 0x8}
115 /* Serial port interrupt vectors for COM1 to COM4. */
116 static int asy_intrs[] = {0x4, 0x3, 0x4, 0x3};
117 /* Bitfield indicating which interrupts are overridden by eeprom config */
118 static uchar_t asy_intr_override = 0;
121 * Local data
124 static ddi_dma_attr_t ISA_dma_attr = {
125 DMA_ATTR_V0,
126 (unsigned long long)0,
127 (unsigned long long)0x00ffffff,
128 0x0000ffff,
132 (unsigned long long)0xffffffff,
133 (unsigned long long)0x0000ffff,
141 * Config information
144 static int
145 isa_bus_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp,
146 off_t offset, off_t len, caddr_t *vaddrp);
148 static int
149 isa_dma_allochdl(dev_info_t *, dev_info_t *, ddi_dma_attr_t *,
150 int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *);
152 static int
153 isa_dma_mctl(dev_info_t *, dev_info_t *, ddi_dma_handle_t, enum ddi_dma_ctlops,
154 off_t *, size_t *, caddr_t *, uint_t);
156 static int
157 isa_ctlops(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, void *);
159 static int
160 isa_intr_ops(dev_info_t *pdip, dev_info_t *rdip, ddi_intr_op_t intr_op,
161 ddi_intr_handle_impl_t *hdlp, void *result);
162 static int isa_alloc_intr_fixed(dev_info_t *, ddi_intr_handle_impl_t *, void *);
163 static int isa_free_intr_fixed(dev_info_t *, ddi_intr_handle_impl_t *);
165 struct bus_ops isa_bus_ops = {
166 BUSO_REV,
167 isa_bus_map,
168 NULL,
169 NULL,
170 NULL,
171 i_ddi_map_fault,
172 NULL,
173 isa_dma_allochdl,
174 ddi_dma_freehdl,
175 ddi_dma_bindhdl,
176 ddi_dma_unbindhdl,
177 ddi_dma_flush,
178 ddi_dma_win,
179 isa_dma_mctl,
180 isa_ctlops,
181 ddi_bus_prop_op,
182 NULL, /* (*bus_get_eventcookie)(); */
183 NULL, /* (*bus_add_eventcall)(); */
184 NULL, /* (*bus_remove_eventcall)(); */
185 NULL, /* (*bus_post_event)(); */
186 NULL, /* (*bus_intr_ctl)(); */
187 NULL, /* (*bus_config)(); */
188 NULL, /* (*bus_unconfig)(); */
189 NULL, /* (*bus_fm_init)(); */
190 NULL, /* (*bus_fm_fini)(); */
191 NULL, /* (*bus_fm_access_enter)(); */
192 NULL, /* (*bus_fm_access_exit)(); */
193 NULL, /* (*bus_power)(); */
194 isa_intr_ops /* (*bus_intr_op)(); */
198 static int isa_attach(dev_info_t *devi, ddi_attach_cmd_t cmd);
201 * Internal isa ctlops support routines
203 static int isa_initchild(dev_info_t *child);
205 struct dev_ops isa_ops = {
206 DEVO_REV, /* devo_rev, */
207 0, /* refcnt */
208 ddi_no_info, /* info */
209 nulldev, /* identify */
210 nulldev, /* probe */
211 isa_attach, /* attach */
212 nulldev, /* detach */
213 nodev, /* reset */
214 NULL, /* driver operations */
215 &isa_bus_ops, /* bus operations */
216 NULL, /* power */
217 ddi_quiesce_not_needed, /* quiesce */
221 * Module linkage information for the kernel.
224 static struct modldrv modldrv = {
225 &mod_driverops, /* Type of module. This is ISA bus driver */
226 "isa nexus driver for 'ISA'",
227 &isa_ops, /* driver ops */
230 static struct modlinkage modlinkage = {
231 MODREV_1,
232 &modldrv,
233 NULL
237 _init(void)
239 int err;
240 char tty_irq_param[9] = "ttyX-irq";
241 char *tty_irq;
242 int i;
244 if ((err = mod_install(&modlinkage)) != 0)
245 return (err);
247 /* Check if any tty irqs are overridden by eeprom config */
248 for (i = 0; i < num_BIOS_serial; i++) {
249 tty_irq_param[3] = 'a' + i;
250 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
251 DDI_PROP_DONTPASS, tty_irq_param, &tty_irq)
252 == DDI_PROP_SUCCESS) {
253 long data;
255 if (ddi_strtol(tty_irq, NULL, 0, &data) == 0) {
256 asy_intrs[i] = (int)data;
257 asy_intr_override |= 1<<i;
260 ddi_prop_free(tty_irq);
264 impl_bus_add_probe(isa_enumerate);
265 return (0);
269 _fini(void)
271 int err;
273 impl_bus_delete_probe(isa_enumerate);
275 if ((err = mod_remove(&modlinkage)) != 0)
276 return (err);
278 return (0);
282 _info(struct modinfo *modinfop)
284 return (mod_info(&modlinkage, modinfop));
287 static int
288 isa_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
290 int rval;
293 switch (cmd) {
294 case DDI_ATTACH:
295 break;
296 case DDI_RESUME:
297 return (DDI_SUCCESS);
298 default:
299 return (DDI_FAILURE);
302 if ((rval = i_dmae_init(devi)) == DDI_SUCCESS)
303 ddi_report_dev(devi);
305 return (rval);
308 #define SET_RNGS(rng_p, used_p, ctyp, ptyp) do { \
309 (rng_p)->child_high = (ctyp); \
310 (rng_p)->child_low = (rng_p)->parent_low = (used_p)->base; \
311 (rng_p)->parent_high = (ptyp); \
312 (rng_p)->parent_mid = 0; \
313 (rng_p)->size = (used_p)->len; \
314 _NOTE(CONSTCOND) } while (0)
315 static uint_t
316 isa_used_to_ranges(int ctype, int *array, uint_t size, pib_ranges_t *ranges)
318 used_ranges_t *used_p;
319 pib_ranges_t *rng_p = ranges;
320 uint_t i, ptype;
322 ptype = (ctype == ISA_ADDR_IO) ? PCI_ADDR_IO : PCI_ADDR_MEM32;
323 ptype |= PCI_REG_REL_M;
324 size /= USED_CELL_SIZE;
325 used_p = (used_ranges_t *)array;
326 SET_RNGS(rng_p, used_p, ctype, ptype);
327 for (i = 1, used_p++; i < size; i++, used_p++) {
328 /* merge ranges record if applicable */
329 if (rng_p->child_low + rng_p->size == used_p->base)
330 rng_p->size += used_p->len;
331 else {
332 rng_p++;
333 SET_RNGS(rng_p, used_p, ctype, ptype);
336 return (rng_p - ranges + 1);
339 void
340 isa_remove_res_from_pci(int type, int *array, uint_t size)
342 int i;
343 used_ranges_t *used_p;
345 size /= USED_CELL_SIZE;
346 used_p = (used_ranges_t *)array;
347 for (i = 0; i < size; i++, used_p++)
348 pci_register_isa_resources(type, used_p->base, used_p->len);
351 static void
352 isa_create_ranges_prop(dev_info_t *dip)
354 dev_info_t *used;
355 int *ioarray, *memarray, status;
356 uint_t nio = 0, nmem = 0, nrng = 0, n;
357 pib_ranges_t *ranges;
359 used = ddi_find_devinfo(USED_RESOURCES, -1, 0);
360 if (used == NULL) {
361 cmn_err(CE_WARN, "Failed to find used-resources <%s>\n",
362 ddi_get_name(dip));
363 return;
365 status = ddi_prop_lookup_int_array(DDI_DEV_T_ANY, used,
366 DDI_PROP_DONTPASS, "io-space", &ioarray, &nio);
367 if (status != DDI_PROP_SUCCESS && status != DDI_PROP_NOT_FOUND) {
368 cmn_err(CE_WARN, "io-space property failure for %s (%x)\n",
369 ddi_get_name(used), status);
370 return;
372 status = ddi_prop_lookup_int_array(DDI_DEV_T_ANY, used,
373 DDI_PROP_DONTPASS, "device-memory", &memarray, &nmem);
374 if (status != DDI_PROP_SUCCESS && status != DDI_PROP_NOT_FOUND) {
375 cmn_err(CE_WARN, "device-memory property failure for %s (%x)\n",
376 ddi_get_name(used), status);
377 return;
379 n = (nio + nmem) / USED_CELL_SIZE;
380 ranges = (pib_ranges_t *)kmem_zalloc(sizeof (pib_ranges_t) * n,
381 KM_SLEEP);
383 if (nio != 0) {
384 nrng = isa_used_to_ranges(ISA_ADDR_IO, ioarray, nio, ranges);
385 isa_remove_res_from_pci(ISA_ADDR_IO, ioarray, nio);
386 ddi_prop_free(ioarray);
388 if (nmem != 0) {
389 nrng += isa_used_to_ranges(ISA_ADDR_MEM, memarray, nmem,
390 ranges + nrng);
391 isa_remove_res_from_pci(ISA_ADDR_MEM, memarray, nmem);
392 ddi_prop_free(memarray);
395 if (!pseudo_isa)
396 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip, "ranges",
397 (int *)ranges, nrng * sizeof (pib_ranges_t) / sizeof (int));
398 kmem_free(ranges, sizeof (pib_ranges_t) * n);
401 /*ARGSUSED*/
402 static int
403 isa_apply_range(dev_info_t *dip, struct regspec *isa_reg_p,
404 pci_regspec_t *pci_reg_p)
406 pib_ranges_t *ranges, *rng_p;
407 int len, i, offset, nrange;
409 if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
410 "ranges", (caddr_t)&ranges, &len) != DDI_SUCCESS) {
411 cmn_err(CE_WARN, "Can't get %s ranges property",
412 ddi_get_name(dip));
413 return (DDI_ME_REGSPEC_RANGE);
415 nrange = len / sizeof (pib_ranges_t);
416 rng_p = ranges;
417 for (i = 0; i < nrange; i++, rng_p++) {
418 /* Check for correct space */
419 if (isa_reg_p->regspec_bustype != rng_p->child_high)
420 continue;
422 /* Detect whether request entirely fits within a range */
423 if (isa_reg_p->regspec_addr < rng_p->child_low)
424 continue;
425 if ((isa_reg_p->regspec_addr + isa_reg_p->regspec_size - 1) >
426 (rng_p->child_low + rng_p->size - 1))
427 continue;
429 offset = isa_reg_p->regspec_addr - rng_p->child_low;
431 pci_reg_p->pci_phys_hi = rng_p->parent_high;
432 pci_reg_p->pci_phys_mid = 0;
433 pci_reg_p->pci_phys_low = rng_p->parent_low + offset;
434 pci_reg_p->pci_size_hi = 0;
435 pci_reg_p->pci_size_low = isa_reg_p->regspec_size;
437 break;
439 kmem_free(ranges, len);
441 if (i < nrange)
442 return (DDI_SUCCESS);
445 * Check extra resource range specially for serial and parallel
446 * devices, which are treated differently from all other ISA
447 * devices. On some machines, serial ports are not enumerated
448 * by ACPI but by BIOS, with io base addresses noted in legacy
449 * BIOS data area. Parallel port on some machines comes with
450 * illegal size.
452 if (isa_reg_p->regspec_bustype != ISA_ADDR_IO) {
453 cmn_err(CE_WARN, "Bus type not ISA I/O\n");
454 return (DDI_ME_REGSPEC_RANGE);
457 for (i = 0; i < isa_extra_count; i++) {
458 struct regspec *reg_p = &isa_extra_resource[i];
460 if (isa_reg_p->regspec_addr < reg_p->regspec_addr)
461 continue;
462 if ((isa_reg_p->regspec_addr + isa_reg_p->regspec_size) >
463 (reg_p->regspec_addr + reg_p->regspec_size))
464 continue;
466 pci_reg_p->pci_phys_hi = PCI_ADDR_IO | PCI_REG_REL_M;
467 pci_reg_p->pci_phys_mid = 0;
468 pci_reg_p->pci_phys_low = isa_reg_p->regspec_addr;
469 pci_reg_p->pci_size_hi = 0;
470 pci_reg_p->pci_size_low = isa_reg_p->regspec_size;
471 break;
473 if (i < isa_extra_count)
474 return (DDI_SUCCESS);
476 cmn_err(CE_WARN, "isa_apply_range: Out of range base <0x%x>, size <%d>",
477 isa_reg_p->regspec_addr, isa_reg_p->regspec_size);
478 return (DDI_ME_REGSPEC_RANGE);
481 static int
482 isa_bus_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp,
483 off_t offset, off_t len, caddr_t *vaddrp)
485 struct regspec tmp_reg, *rp;
486 pci_regspec_t vreg;
487 ddi_map_req_t mr = *mp; /* Get private copy of request */
488 int error;
490 if (pseudo_isa)
491 return (i_ddi_bus_map(dip, rdip, mp, offset, len, vaddrp));
493 mp = &mr;
496 * First, if given an rnumber, convert it to a regspec...
498 if (mp->map_type == DDI_MT_RNUMBER) {
500 int rnumber = mp->map_obj.rnumber;
502 rp = i_ddi_rnumber_to_regspec(rdip, rnumber);
503 if (rp == NULL)
504 return (DDI_ME_RNUMBER_RANGE);
507 * Convert the given ddi_map_req_t from rnumber to regspec...
509 mp->map_type = DDI_MT_REGSPEC;
510 mp->map_obj.rp = rp;
514 * Adjust offset and length correspnding to called values...
515 * XXX: A non-zero length means override the one in the regspec.
516 * XXX: (Regardless of what's in the parent's range)
519 tmp_reg = *(mp->map_obj.rp); /* Preserve underlying data */
520 rp = mp->map_obj.rp = &tmp_reg; /* Use tmp_reg in request */
522 rp->regspec_addr += (uint_t)offset;
523 if (len != 0)
524 rp->regspec_size = (uint_t)len;
526 if ((error = isa_apply_range(dip, rp, &vreg)) != 0)
527 return (error);
528 mp->map_obj.rp = (struct regspec *)&vreg;
531 * Call my parents bus_map function with modified values...
534 return (ddi_map(dip, mp, (off_t)0, (off_t)0, vaddrp));
537 static int
538 isa_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *dma_attr,
539 int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep)
541 ddi_dma_attr_merge(dma_attr, &ISA_dma_attr);
542 return (ddi_dma_allochdl(dip, rdip, dma_attr, waitfp, arg, handlep));
545 static int
546 isa_dma_mctl(dev_info_t *dip, dev_info_t *rdip,
547 ddi_dma_handle_t handle, enum ddi_dma_ctlops request,
548 off_t *offp, size_t *lenp, caddr_t *objp, uint_t flags)
550 int rval;
551 int arg = (int)(uintptr_t)objp;
553 switch (request) {
555 case DDI_DMA_E_PROG:
556 return (i_dmae_prog(rdip, (struct ddi_dmae_req *)offp,
557 (ddi_dma_cookie_t *)lenp, arg));
559 case DDI_DMA_E_ACQUIRE:
560 return (i_dmae_acquire(rdip, arg, (int(*)(caddr_t))offp,
561 (caddr_t)lenp));
563 case DDI_DMA_E_FREE:
564 return (i_dmae_free(rdip, arg));
566 case DDI_DMA_E_STOP:
567 i_dmae_stop(rdip, arg);
568 return (DDI_SUCCESS);
570 case DDI_DMA_E_ENABLE:
571 i_dmae_enable(rdip, arg);
572 return (DDI_SUCCESS);
574 case DDI_DMA_E_DISABLE:
575 i_dmae_disable(rdip, arg);
576 return (DDI_SUCCESS);
578 case DDI_DMA_E_GETCNT:
579 i_dmae_get_chan_stat(rdip, arg, NULL, (int *)lenp);
580 return (DDI_SUCCESS);
582 case DDI_DMA_E_SWSETUP:
583 return (i_dmae_swsetup(rdip, (struct ddi_dmae_req *)offp,
584 (ddi_dma_cookie_t *)lenp, arg));
586 case DDI_DMA_E_SWSTART:
587 i_dmae_swstart(rdip, arg);
588 return (DDI_SUCCESS);
590 case DDI_DMA_E_GETATTR:
591 bcopy(&ISA_dma_attr, objp, sizeof (ddi_dma_attr_t));
592 return (DDI_SUCCESS);
594 case DDI_DMA_E_1STPTY:
596 struct ddi_dmae_req req1stpty =
597 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
598 if (arg == 0) {
599 req1stpty.der_command = DMAE_CMD_TRAN;
600 req1stpty.der_trans = DMAE_TRANS_DMND;
601 } else {
602 req1stpty.der_trans = DMAE_TRANS_CSCD;
604 return (i_dmae_prog(rdip, &req1stpty, NULL, arg));
607 default:
609 * We pass to rootnex, but it turns out that rootnex will just
610 * return failure, as we don't use ddi_dma_mctl() except
611 * for DMA engine (ISA) and DVMA (SPARC). Arguably we could
612 * just return an error direclty here, instead.
614 rval = ddi_dma_mctl(dip, rdip, handle, request, offp,
615 lenp, objp, flags);
617 return (rval);
621 * Check if driver should be treated as an old pre 2.6 driver
623 static int
624 old_driver(dev_info_t *dip)
626 extern int ignore_hardware_nodes; /* force flag from ddi_impl.c */
628 if (ndi_dev_is_persistent_node(dip)) {
629 if (ignore_hardware_nodes)
630 return (1);
631 if (ddi_getprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
632 "ignore-hardware-nodes", -1) != -1)
633 return (1);
635 return (0);
638 typedef struct {
639 uint32_t phys_hi;
640 uint32_t phys_lo;
641 uint32_t size;
642 } isa_regs_t;
645 * Return non-zero if device in tree is a PnP isa device
647 static int
648 is_pnpisa(dev_info_t *dip)
650 isa_regs_t *isa_regs;
651 int proplen, pnpisa;
653 if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg",
654 (caddr_t)&isa_regs, &proplen) != DDI_PROP_SUCCESS) {
655 return (0);
657 pnpisa = isa_regs[0].phys_hi & 0x80000000;
659 * free the memory allocated by ddi_getlongprop().
661 kmem_free(isa_regs, proplen);
662 if (pnpisa)
663 return (1);
664 else
665 return (0);
668 /*ARGSUSED*/
669 static int
670 isa_ctlops(dev_info_t *dip, dev_info_t *rdip,
671 ddi_ctl_enum_t ctlop, void *arg, void *result)
673 int rn;
674 struct ddi_parent_private_data *pdp;
676 switch (ctlop) {
677 case DDI_CTLOPS_REPORTDEV:
678 if (rdip == (dev_info_t *)0)
679 return (DDI_FAILURE);
680 cmn_err(CE_CONT, "?ISA-device: %s%d\n",
681 ddi_driver_name(rdip), ddi_get_instance(rdip));
682 return (DDI_SUCCESS);
684 case DDI_CTLOPS_INITCHILD:
686 * older drivers aren't expecting the "standard" device
687 * node format used by the hardware nodes. these drivers
688 * only expect their own properties set in their driver.conf
689 * files. so they tell us not to call them with hardware
690 * nodes by setting the property "ignore-hardware-nodes".
692 if (old_driver((dev_info_t *)arg)) {
693 return (DDI_NOT_WELL_FORMED);
696 return (isa_initchild((dev_info_t *)arg));
698 case DDI_CTLOPS_UNINITCHILD:
699 impl_ddi_sunbus_removechild((dev_info_t *)arg);
700 return (DDI_SUCCESS);
702 case DDI_CTLOPS_SIDDEV:
703 if (ndi_dev_is_persistent_node(rdip))
704 return (DDI_SUCCESS);
706 * All ISA devices need to do confirming probes
707 * unless they are PnP ISA.
709 if (is_pnpisa(rdip))
710 return (DDI_SUCCESS);
711 else
712 return (DDI_FAILURE);
714 case DDI_CTLOPS_REGSIZE:
715 case DDI_CTLOPS_NREGS:
716 if (rdip == (dev_info_t *)0)
717 return (DDI_FAILURE);
719 if ((pdp = ddi_get_parent_data(rdip)) == NULL)
720 return (DDI_FAILURE);
722 if (ctlop == DDI_CTLOPS_NREGS) {
723 *(int *)result = pdp->par_nreg;
724 } else {
725 rn = *(int *)arg;
726 if (rn >= pdp->par_nreg)
727 return (DDI_FAILURE);
728 *(off_t *)result = (off_t)pdp->par_reg[rn].regspec_size;
730 return (DDI_SUCCESS);
732 case DDI_CTLOPS_ATTACH:
733 case DDI_CTLOPS_DETACH:
734 case DDI_CTLOPS_PEEK:
735 case DDI_CTLOPS_POKE:
736 return (DDI_FAILURE);
738 default:
739 return (ddi_ctlops(dip, rdip, ctlop, arg, result));
743 static struct intrspec *
744 isa_get_ispec(dev_info_t *rdip, int inum)
746 struct ddi_parent_private_data *pdp = ddi_get_parent_data(rdip);
748 /* Validate the interrupt number */
749 if (inum >= pdp->par_nintr)
750 return (NULL);
752 /* Get the interrupt structure pointer and return that */
753 return ((struct intrspec *)&pdp->par_intr[inum]);
756 static int
757 isa_intr_ops(dev_info_t *pdip, dev_info_t *rdip, ddi_intr_op_t intr_op,
758 ddi_intr_handle_impl_t *hdlp, void *result)
760 struct intrspec *ispec;
761 if (pseudo_isa)
762 return (i_ddi_intr_ops(pdip, rdip, intr_op, hdlp, result));
765 /* Process the interrupt operation */
766 switch (intr_op) {
767 case DDI_INTROP_GETCAP:
768 /* First check with pcplusmp */
769 if (psm_intr_ops == NULL)
770 return (DDI_FAILURE);
772 if ((*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_GET_CAP, result)) {
773 *(int *)result = 0;
774 return (DDI_FAILURE);
776 break;
777 case DDI_INTROP_SETCAP:
778 if (psm_intr_ops == NULL)
779 return (DDI_FAILURE);
781 if ((*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_SET_CAP, result))
782 return (DDI_FAILURE);
783 break;
784 case DDI_INTROP_ALLOC:
785 ASSERT(hdlp->ih_type == DDI_INTR_TYPE_FIXED);
786 return (isa_alloc_intr_fixed(rdip, hdlp, result));
787 case DDI_INTROP_FREE:
788 ASSERT(hdlp->ih_type == DDI_INTR_TYPE_FIXED);
789 return (isa_free_intr_fixed(rdip, hdlp));
790 case DDI_INTROP_GETPRI:
791 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
792 return (DDI_FAILURE);
793 *(int *)result = ispec->intrspec_pri;
794 break;
795 case DDI_INTROP_SETPRI:
796 /* Validate the interrupt priority passed to us */
797 if (*(int *)result > LOCK_LEVEL)
798 return (DDI_FAILURE);
800 /* Ensure that PSM is all initialized and ispec is ok */
801 if ((psm_intr_ops == NULL) ||
802 ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL))
803 return (DDI_FAILURE);
805 /* update the ispec with the new priority */
806 ispec->intrspec_pri = *(int *)result;
807 break;
808 case DDI_INTROP_ADDISR:
809 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
810 return (DDI_FAILURE);
811 ispec->intrspec_func = hdlp->ih_cb_func;
812 break;
813 case DDI_INTROP_REMISR:
814 if (hdlp->ih_type != DDI_INTR_TYPE_FIXED)
815 return (DDI_FAILURE);
816 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
817 return (DDI_FAILURE);
818 ispec->intrspec_func = (uint_t (*)()) 0;
819 break;
820 case DDI_INTROP_ENABLE:
821 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
822 return (DDI_FAILURE);
824 /* Call psmi to translate irq with the dip */
825 if (psm_intr_ops == NULL)
826 return (DDI_FAILURE);
828 ((ihdl_plat_t *)hdlp->ih_private)->ip_ispecp = ispec;
829 if ((*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_XLATE_VECTOR,
830 (int *)&hdlp->ih_vector) == PSM_FAILURE)
831 return (DDI_FAILURE);
833 /* Add the interrupt handler */
834 if (!add_avintr((void *)hdlp, ispec->intrspec_pri,
835 hdlp->ih_cb_func, DEVI(rdip)->devi_name, hdlp->ih_vector,
836 hdlp->ih_cb_arg1, hdlp->ih_cb_arg2, NULL, rdip))
837 return (DDI_FAILURE);
838 break;
839 case DDI_INTROP_DISABLE:
840 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
841 return (DDI_FAILURE);
843 /* Call psm_ops() to translate irq with the dip */
844 if (psm_intr_ops == NULL)
845 return (DDI_FAILURE);
847 ((ihdl_plat_t *)hdlp->ih_private)->ip_ispecp = ispec;
848 (void) (*psm_intr_ops)(rdip, hdlp,
849 PSM_INTR_OP_XLATE_VECTOR, (int *)&hdlp->ih_vector);
851 /* Remove the interrupt handler */
852 rem_avintr((void *)hdlp, ispec->intrspec_pri,
853 hdlp->ih_cb_func, hdlp->ih_vector);
854 break;
855 case DDI_INTROP_SETMASK:
856 if (psm_intr_ops == NULL)
857 return (DDI_FAILURE);
859 if ((*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_SET_MASK, NULL))
860 return (DDI_FAILURE);
861 break;
862 case DDI_INTROP_CLRMASK:
863 if (psm_intr_ops == NULL)
864 return (DDI_FAILURE);
866 if ((*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_CLEAR_MASK, NULL))
867 return (DDI_FAILURE);
868 break;
869 case DDI_INTROP_GETPENDING:
870 if (psm_intr_ops == NULL)
871 return (DDI_FAILURE);
873 if ((*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_GET_PENDING,
874 result)) {
875 *(int *)result = 0;
876 return (DDI_FAILURE);
878 break;
879 case DDI_INTROP_NAVAIL:
880 case DDI_INTROP_NINTRS:
881 *(int *)result = i_ddi_get_intx_nintrs(rdip);
882 if (*(int *)result == 0) {
883 return (DDI_FAILURE);
885 break;
886 case DDI_INTROP_SUPPORTED_TYPES:
887 *(int *)result = DDI_INTR_TYPE_FIXED; /* Always ... */
888 break;
889 default:
890 return (DDI_FAILURE);
893 return (DDI_SUCCESS);
897 * Allocate interrupt vector for FIXED (legacy) type.
899 static int
900 isa_alloc_intr_fixed(dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp,
901 void *result)
903 struct intrspec *ispec;
904 ddi_intr_handle_impl_t info_hdl;
905 int ret;
906 int free_phdl = 0;
907 apic_get_type_t type_info;
909 if (psm_intr_ops == NULL)
910 return (DDI_FAILURE);
912 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
913 return (DDI_FAILURE);
916 * If the PSM module is "APIX" then pass the request for it
917 * to allocate the vector now.
919 bzero(&info_hdl, sizeof (ddi_intr_handle_impl_t));
920 info_hdl.ih_private = &type_info;
921 if ((*psm_intr_ops)(NULL, &info_hdl, PSM_INTR_OP_APIC_TYPE, NULL) ==
922 PSM_SUCCESS && strcmp(type_info.avgi_type, APIC_APIX_NAME) == 0) {
923 if (hdlp->ih_private == NULL) { /* allocate phdl structure */
924 free_phdl = 1;
925 i_ddi_alloc_intr_phdl(hdlp);
927 ((ihdl_plat_t *)hdlp->ih_private)->ip_ispecp = ispec;
928 ret = (*psm_intr_ops)(rdip, hdlp,
929 PSM_INTR_OP_ALLOC_VECTORS, result);
930 if (free_phdl) { /* free up the phdl structure */
931 free_phdl = 0;
932 i_ddi_free_intr_phdl(hdlp);
933 hdlp->ih_private = NULL;
935 } else {
937 * No APIX module; fall back to the old scheme where the
938 * interrupt vector is allocated during ddi_enable_intr() call.
940 hdlp->ih_pri = ispec->intrspec_pri;
941 *(int *)result = hdlp->ih_scratch1;
942 ret = DDI_SUCCESS;
945 return (ret);
949 * Free up interrupt vector for FIXED (legacy) type.
951 static int
952 isa_free_intr_fixed(dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp)
954 struct intrspec *ispec;
955 ddi_intr_handle_impl_t info_hdl;
956 int ret;
957 apic_get_type_t type_info;
959 if (psm_intr_ops == NULL)
960 return (DDI_FAILURE);
963 * If the PSM module is "APIX" then pass the request for it
964 * to free up the vector now.
966 bzero(&info_hdl, sizeof (ddi_intr_handle_impl_t));
967 info_hdl.ih_private = &type_info;
968 if ((*psm_intr_ops)(NULL, &info_hdl, PSM_INTR_OP_APIC_TYPE, NULL) ==
969 PSM_SUCCESS && strcmp(type_info.avgi_type, APIC_APIX_NAME) == 0) {
970 if ((ispec = isa_get_ispec(rdip, hdlp->ih_inum)) == NULL)
971 return (DDI_FAILURE);
972 ((ihdl_plat_t *)hdlp->ih_private)->ip_ispecp = ispec;
973 ret = (*psm_intr_ops)(rdip, hdlp,
974 PSM_INTR_OP_FREE_VECTORS, NULL);
975 } else {
977 * No APIX module; fall back to the old scheme where
978 * the interrupt vector was already freed during
979 * ddi_disable_intr() call.
981 ret = DDI_SUCCESS;
984 return (ret);
987 static void
988 isa_vendor(uint32_t id, char *vendor)
990 vendor[0] = '@' + ((id >> 26) & 0x1f);
991 vendor[1] = '@' + ((id >> 21) & 0x1f);
992 vendor[2] = '@' + ((id >> 16) & 0x1f);
993 vendor[3] = 0;
997 * Name a child
999 static int
1000 isa_name_child(dev_info_t *child, char *name, int namelen)
1002 char vendor[8];
1003 int device;
1004 uint32_t serial;
1005 int func;
1006 int bustype;
1007 uint32_t base;
1008 int proplen;
1009 int pnpisa = 0;
1010 isa_regs_t *isa_regs;
1012 void make_ddi_ppd(dev_info_t *, struct ddi_parent_private_data **);
1015 * older drivers aren't expecting the "standard" device
1016 * node format used by the hardware nodes. these drivers
1017 * only expect their own properties set in their driver.conf
1018 * files. so they tell us not to call them with hardware
1019 * nodes by setting the property "ignore-hardware-nodes".
1021 if (old_driver(child))
1022 return (DDI_FAILURE);
1025 * Fill in parent-private data
1027 if (ddi_get_parent_data(child) == NULL) {
1028 struct ddi_parent_private_data *pdptr;
1029 make_ddi_ppd(child, &pdptr);
1030 ddi_set_parent_data(child, pdptr);
1033 if (ndi_dev_is_persistent_node(child) == 0) {
1035 * For .conf nodes, generate name from parent private data
1037 name[0] = '\0';
1038 if (sparc_pd_getnreg(child) > 0) {
1039 (void) snprintf(name, namelen, "%x,%x",
1040 (uint_t)sparc_pd_getreg(child, 0)->regspec_bustype,
1041 (uint_t)sparc_pd_getreg(child, 0)->regspec_addr);
1043 return (DDI_SUCCESS);
1047 * For hw nodes, look up "reg" property
1049 if (ddi_getlongprop(DDI_DEV_T_ANY, child, DDI_PROP_DONTPASS, "reg",
1050 (caddr_t)&isa_regs, &proplen) != DDI_PROP_SUCCESS) {
1051 return (DDI_FAILURE);
1055 * extract the device identifications
1057 pnpisa = isa_regs[0].phys_hi & 0x80000000;
1058 if (pnpisa) {
1059 isa_vendor(isa_regs[0].phys_hi, vendor);
1060 device = isa_regs[0].phys_hi & 0xffff;
1061 serial = isa_regs[0].phys_lo;
1062 func = (isa_regs[0].size >> 24) & 0xff;
1063 if (func != 0)
1064 (void) snprintf(name, namelen, "pnp%s,%04x,%x,%x",
1065 vendor, device, serial, func);
1066 else
1067 (void) snprintf(name, namelen, "pnp%s,%04x,%x",
1068 vendor, device, serial);
1069 } else {
1070 bustype = isa_regs[0].phys_hi;
1071 base = isa_regs[0].phys_lo;
1072 (void) sprintf(name, "%x,%x", bustype, base);
1076 * free the memory allocated by ddi_getlongprop().
1078 kmem_free(isa_regs, proplen);
1080 return (DDI_SUCCESS);
1083 static int
1084 isa_initchild(dev_info_t *child)
1086 char name[80];
1088 if (isa_name_child(child, name, 80) != DDI_SUCCESS)
1089 return (DDI_FAILURE);
1090 ddi_set_name_addr(child, name);
1092 if (ndi_dev_is_persistent_node(child) != 0)
1093 return (DDI_SUCCESS);
1096 * This is a .conf node, try merge properties onto a
1097 * hw node with the same name.
1099 if (ndi_merge_node(child, isa_name_child) == DDI_SUCCESS) {
1101 * Return failure to remove node
1103 impl_ddi_sunbus_removechild(child);
1104 return (DDI_FAILURE);
1107 * Cannot merge node, permit pseudo children
1109 return (DDI_SUCCESS);
1113 * called when ACPI enumeration is not used
1115 static void
1116 add_known_used_resources(void)
1118 /* needs to be in increasing order */
1119 int intr[] = {0x1, 0x3, 0x4, 0x6, 0x7, 0xc};
1120 int dma[] = {0x2};
1121 int io[] = {0x60, 0x1, 0x64, 0x1, 0x2f8, 0x8, 0x378, 0x8, 0x3f0, 0x10,
1122 0x778, 0x4};
1123 dev_info_t *usedrdip;
1125 usedrdip = ddi_find_devinfo(USED_RESOURCES, -1, 0);
1127 if (usedrdip == NULL) {
1128 (void) ndi_devi_alloc_sleep(ddi_root_node(), USED_RESOURCES,
1129 (pnode_t)DEVI_SID_NODEID, &usedrdip);
1132 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, usedrdip,
1133 "interrupts", (int *)intr, (int)(sizeof (intr) / sizeof (int)));
1134 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, usedrdip,
1135 "io-space", (int *)io, (int)(sizeof (io) / sizeof (int)));
1136 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, usedrdip,
1137 "dma-channels", (int *)dma, (int)(sizeof (dma) / sizeof (int)));
1138 (void) ndi_devi_bind_driver(usedrdip, 0);
1143 * Return non-zero if UART device exists.
1145 static int
1146 uart_exists(ushort_t port)
1148 outb(port + COM_SCR, (char)0x5a);
1149 outb(port + COM_ISR, (char)0x00);
1150 return (inb(port + COM_SCR) == (char)0x5a);
1153 static void
1154 isa_enumerate(int reprogram)
1156 int circ, i;
1157 dev_info_t *xdip;
1158 dev_info_t *isa_dip = ddi_find_devinfo("isa", -1, 0);
1160 struct regspec i8042_regs[] = {
1161 {1, 0x60, 0x1},
1162 {1, 0x64, 0x1}
1164 int i8042_intrs[] = {0x1, 0xc};
1165 char *acpi_prop;
1166 int acpi_enum = 1; /* ACPI is default to be on */
1167 if (reprogram || !isa_dip)
1168 return;
1170 bzero(isa_extra_resource, MAX_EXTRA_RESOURCE * sizeof (struct regspec));
1172 ndi_devi_enter(isa_dip, &circ);
1174 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
1175 DDI_PROP_DONTPASS, "acpi-enum", &acpi_prop) == DDI_PROP_SUCCESS) {
1176 acpi_enum = strcmp("off", acpi_prop);
1177 ddi_prop_free(acpi_prop);
1180 if (acpi_enum) {
1181 if (acpi_isa_device_enum(isa_dip)) {
1182 ndi_devi_exit(isa_dip, circ);
1183 if (isa_resource_setup() != NDI_SUCCESS) {
1184 cmn_err(CE_WARN, "isa nexus: isa "
1185 "resource setup failed");
1188 /* serial ports? */
1189 enumerate_BIOS_serial(isa_dip);
1191 /* adjust parallel port size */
1192 adjust_prtsz(isa_dip);
1194 isa_create_ranges_prop(isa_dip);
1195 return;
1197 cmn_err(CE_NOTE, "!Solaris did not detect ACPI BIOS");
1199 cmn_err(CE_NOTE, "!ACPI is off");
1201 /* serial ports */
1202 for (i = 0; i < min_BIOS_serial; i++) {
1203 ushort_t addr = asy_regs[i].regspec_addr;
1204 if (!uart_exists(addr))
1205 continue;
1206 ndi_devi_alloc_sleep(isa_dip, "asy",
1207 (pnode_t)DEVI_SID_NODEID, &xdip);
1208 (void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
1209 "compatible", "PNP0500");
1210 /* This should be gotten from master file: */
1211 (void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
1212 "model", "Standard PC COM port");
1213 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
1214 "reg", (int *)&asy_regs[i], 3);
1215 (void) ndi_prop_update_int(DDI_DEV_T_NONE, xdip,
1216 "interrupts", asy_intrs[i]);
1217 (void) ndi_devi_bind_driver(xdip, 0);
1218 /* Adjusting isa_extra here causes a kernel dump later. */
1221 /* i8042 node */
1222 ndi_devi_alloc_sleep(isa_dip, "i8042",
1223 (pnode_t)DEVI_SID_NODEID, &xdip);
1224 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
1225 "reg", (int *)i8042_regs, 6);
1226 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
1227 "interrupts", (int *)i8042_intrs, 2);
1228 (void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
1229 "unit-address", "1,60");
1230 (void) ndi_devi_bind_driver(xdip, 0);
1232 add_known_used_resources();
1234 ndi_devi_exit(isa_dip, circ);
1236 isa_create_ranges_prop(isa_dip);
1240 * On some machines, serial port 2 isn't listed in the ACPI table.
1241 * This function goes through the base I/O addresses and makes sure all
1242 * the serial ports there are in the dev_info tree. If any are missing,
1243 * this function will add them.
1246 static void
1247 enumerate_BIOS_serial(dev_info_t *isa_dip)
1249 int i;
1250 dev_info_t *xdip;
1251 int found;
1252 int ret;
1253 struct regspec *tmpregs;
1254 int tmpregs_len;
1257 * Scan the base I/O addresses of the first four serial ports.
1259 for (i = 0; i < num_BIOS_serial; i++) {
1260 ushort_t addr = asy_regs[i].regspec_addr;
1262 /* Look for it in the dev_info tree */
1263 found = 0;
1264 for (xdip = ddi_get_child(isa_dip); xdip != NULL;
1265 xdip = ddi_get_next_sibling(xdip)) {
1266 if (strncmp(ddi_node_name(xdip), "asy", 3) != 0) {
1267 /* skip non asy */
1268 continue;
1271 /* Match by addr */
1272 ret = ddi_prop_lookup_int_array(DDI_DEV_T_ANY, xdip,
1273 DDI_PROP_DONTPASS, "reg", (int **)&tmpregs,
1274 (uint_t *)&tmpregs_len);
1275 if (ret != DDI_PROP_SUCCESS) {
1276 /* error */
1277 continue;
1280 if (tmpregs->regspec_addr == addr)
1281 found = 1;
1284 * Free the memory allocated by
1285 * ddi_prop_lookup_int_array().
1287 ddi_prop_free(tmpregs);
1289 if (found) {
1290 if (asy_intr_override & 1<<i) {
1291 (void) ndi_prop_update_int(
1292 DDI_DEV_T_NONE, xdip,
1293 "interrupts", asy_intrs[i]);
1296 break;
1300 /* If not found, then add it */
1301 if (!found && uart_exists(addr)) {
1302 ndi_devi_alloc_sleep(isa_dip, "asy",
1303 (pnode_t)DEVI_SID_NODEID, &xdip);
1304 (void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
1305 "compatible", "PNP0500");
1306 /* This should be gotten from master file: */
1307 (void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
1308 "model", "Standard PC COM port");
1309 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, xdip,
1310 "reg", (int *)&asy_regs[i], 3);
1311 (void) ndi_prop_update_int(DDI_DEV_T_NONE, xdip,
1312 "interrupts", asy_intrs[i]);
1313 (void) ndi_devi_bind_driver(xdip, 0);
1315 ASSERT(isa_extra_count < MAX_EXTRA_RESOURCE);
1316 bcopy(&asy_regs[i],
1317 isa_extra_resource + isa_extra_count,
1318 sizeof (struct regspec));
1319 isa_extra_count++;
1324 * An asy node may have been attached via ACPI enumeration, or
1325 * directly from this file. Check each serial port to see if it
1326 * is in use by the hypervisor. If it is in use, then remove
1327 * the node from the device tree.
1333 * Some machine comes with an illegal parallel port size of 3
1334 * bytes in ACPI, even parallel port mode is ECP.
1336 #define DEFAULT_PRT_SIZE 8
1337 static void
1338 adjust_prtsz(dev_info_t *isa_dip)
1340 dev_info_t *cdip;
1341 struct regspec *regs_p, *extreg_p;
1342 int regs_len, nreg, i;
1343 char *name;
1345 for (cdip = ddi_get_child(isa_dip); cdip != NULL;
1346 cdip = ddi_get_next_sibling(cdip)) {
1347 name = ddi_node_name(cdip);
1348 if ((strncmp(name, "lp", 2) != 0) || (strnlen(name, 3) != 2))
1349 continue; /* skip non parallel */
1351 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, cdip,
1352 DDI_PROP_DONTPASS, "reg", (int **)&regs_p,
1353 (uint_t *)&regs_len) != DDI_PROP_SUCCESS)
1354 continue;
1356 nreg = regs_len / (sizeof (struct regspec) / sizeof (int));
1357 for (i = 0; i < nreg; i++) {
1358 if (regs_p[i].regspec_size == DEFAULT_PRT_SIZE)
1359 continue;
1361 ASSERT(isa_extra_count < MAX_EXTRA_RESOURCE);
1362 extreg_p = &isa_extra_resource[isa_extra_count++];
1363 extreg_p->regspec_bustype = ISA_ADDR_IO;
1364 extreg_p->regspec_addr = regs_p[i].regspec_addr;
1365 extreg_p->regspec_size = DEFAULT_PRT_SIZE;
1368 ddi_prop_free(regs_p);