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 #include <stdio.h> 30*7c478bd9Sstevel@tonic-gate #include <stddef.h> 31*7c478bd9Sstevel@tonic-gate #include <fcntl.h> 32*7c478bd9Sstevel@tonic-gate #include <string.h> 33*7c478bd9Sstevel@tonic-gate #include <libdevinfo.h> 34*7c478bd9Sstevel@tonic-gate #include <sys/pctypes.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/pcmcia.h> 36*7c478bd9Sstevel@tonic-gate #include <sys/utsname.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/avintr.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate #include "prtconf.h" 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate struct priv_data { 42*7c478bd9Sstevel@tonic-gate char *drv_name; /* parent name */ 43*7c478bd9Sstevel@tonic-gate void (*pd_print)(uintptr_t, int); /* print function */ 44*7c478bd9Sstevel@tonic-gate }; 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate extern void indent_to_level(); 47*7c478bd9Sstevel@tonic-gate static void obio_printregs(struct regspec *, int); 48*7c478bd9Sstevel@tonic-gate static void obio_printranges(struct rangespec *, int); 49*7c478bd9Sstevel@tonic-gate static void obio_printintr(struct intrspec *, int); 50*7c478bd9Sstevel@tonic-gate static void obio_print(uintptr_t, int); 51*7c478bd9Sstevel@tonic-gate static void pcmcia_printregs(struct pcm_regs *, int); 52*7c478bd9Sstevel@tonic-gate static void pcmcia_printintr(struct intrspec *, int); 53*7c478bd9Sstevel@tonic-gate static void pcmcia_print(uintptr_t, int); 54*7c478bd9Sstevel@tonic-gate static void sbus_print(uintptr_t, int); 55*7c478bd9Sstevel@tonic-gate static struct priv_data *match_priv_data(di_node_t); 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* 58*7c478bd9Sstevel@tonic-gate * This is a hardcoded list of drivers we print parent private 59*7c478bd9Sstevel@tonic-gate * data as of Solaris 7. 60*7c478bd9Sstevel@tonic-gate */ 61*7c478bd9Sstevel@tonic-gate static struct di_priv_format ppd_format[] = { 62*7c478bd9Sstevel@tonic-gate { 63*7c478bd9Sstevel@tonic-gate /* 64*7c478bd9Sstevel@tonic-gate * obio format: applies the following list 65*7c478bd9Sstevel@tonic-gate * of nexus drivers. Note that obio driver 66*7c478bd9Sstevel@tonic-gate * went away with sun4m. 67*7c478bd9Sstevel@tonic-gate */ 68*7c478bd9Sstevel@tonic-gate "central dma ebus eisa esp fas fhc glm iommu isa" 69*7c478bd9Sstevel@tonic-gate " isp mc pci pci_pci pln rootnex" 70*7c478bd9Sstevel@tonic-gate " sf socal", 71*7c478bd9Sstevel@tonic-gate sizeof (struct ddi_parent_private_data), 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate sizeof (struct regspec), /* first pointer */ 74*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_reg), 75*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_nreg), 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate sizeof (struct intrspec), /* second pointer */ 78*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_intr), 79*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_nintr), 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate sizeof (struct rangespec), /* third pointer */ 82*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_rng), 83*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_nrng), 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate 0, 0, 0, /* no more pointers */ 86*7c478bd9Sstevel@tonic-gate 0, 0, 0 87*7c478bd9Sstevel@tonic-gate }, 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate { /* pcmcia format */ 90*7c478bd9Sstevel@tonic-gate "pcic stp4020", 91*7c478bd9Sstevel@tonic-gate sizeof (struct pcmcia_parent_private), 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate sizeof (struct pcm_regs), /* first pointer */ 94*7c478bd9Sstevel@tonic-gate offsetof(struct pcmcia_parent_private, ppd_reg), 95*7c478bd9Sstevel@tonic-gate offsetof(struct pcmcia_parent_private, ppd_nreg), 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate sizeof (struct intrspec), /* second pointer */ 98*7c478bd9Sstevel@tonic-gate offsetof(struct pcmcia_parent_private, ppd_intrspec), 99*7c478bd9Sstevel@tonic-gate offsetof(struct pcmcia_parent_private, ppd_intr), 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate 0, 0, 0, /* no more pointers */ 102*7c478bd9Sstevel@tonic-gate 0, 0, 0, 103*7c478bd9Sstevel@tonic-gate 0, 0, 0 104*7c478bd9Sstevel@tonic-gate }, 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate { /* sbus format--it's different on sun4u!! */ 107*7c478bd9Sstevel@tonic-gate "sbus", 108*7c478bd9Sstevel@tonic-gate sizeof (struct ddi_parent_private_data), 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate sizeof (struct regspec), /* first pointer */ 111*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_reg), 112*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_nreg), 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate sizeof (struct intrspec), /* second pointer */ 115*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_intr), 116*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_nintr), 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate sizeof (struct rangespec), /* third pointer */ 119*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_rng), 120*7c478bd9Sstevel@tonic-gate offsetof(struct ddi_parent_private_data, par_nrng), 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate 0, 0, 0, /* no more pointers */ 123*7c478bd9Sstevel@tonic-gate 0, 0, 0 124*7c478bd9Sstevel@tonic-gate } 125*7c478bd9Sstevel@tonic-gate }; 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate static struct priv_data prt_priv_data[] = { 128*7c478bd9Sstevel@tonic-gate { ppd_format[0].drv_name, obio_print}, 129*7c478bd9Sstevel@tonic-gate { ppd_format[1].drv_name, pcmcia_print}, 130*7c478bd9Sstevel@tonic-gate { ppd_format[2].drv_name, sbus_print} 131*7c478bd9Sstevel@tonic-gate }; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate static int nprt_priv_data = sizeof (prt_priv_data)/sizeof (struct priv_data); 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate void 136*7c478bd9Sstevel@tonic-gate init_priv_data(struct di_priv_data *fetch) 137*7c478bd9Sstevel@tonic-gate { 138*7c478bd9Sstevel@tonic-gate /* no driver private data */ 139*7c478bd9Sstevel@tonic-gate fetch->version = DI_PRIVDATA_VERSION_0; 140*7c478bd9Sstevel@tonic-gate fetch->n_driver = 0; 141*7c478bd9Sstevel@tonic-gate fetch->driver = NULL; 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate fetch->n_parent = nprt_priv_data; 144*7c478bd9Sstevel@tonic-gate fetch->parent = ppd_format; 145*7c478bd9Sstevel@tonic-gate } 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate static void 148*7c478bd9Sstevel@tonic-gate obio_printregs(struct regspec *rp, int ilev) 149*7c478bd9Sstevel@tonic-gate { 150*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 151*7c478bd9Sstevel@tonic-gate (void) printf(" Bus Type=0x%x, Address=0x%x, Size=0x%x\n", 152*7c478bd9Sstevel@tonic-gate rp->regspec_bustype, rp->regspec_addr, rp->regspec_size); 153*7c478bd9Sstevel@tonic-gate } 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate static void 156*7c478bd9Sstevel@tonic-gate obio_printranges(struct rangespec *rp, int ilev) 157*7c478bd9Sstevel@tonic-gate { 158*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 159*7c478bd9Sstevel@tonic-gate (void) printf(" Ch: %.2x,%.8x Pa: %.2x,%.8x, Sz: %x\n", 160*7c478bd9Sstevel@tonic-gate rp->rng_cbustype, rp->rng_coffset, 161*7c478bd9Sstevel@tonic-gate rp->rng_bustype, rp->rng_offset, 162*7c478bd9Sstevel@tonic-gate rp->rng_size); 163*7c478bd9Sstevel@tonic-gate } 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate static void 166*7c478bd9Sstevel@tonic-gate obio_printintr(struct intrspec *ip, int ilev) 167*7c478bd9Sstevel@tonic-gate { 168*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 169*7c478bd9Sstevel@tonic-gate (void) printf(" Interrupt Priority=0x%x (ipl %d)", 170*7c478bd9Sstevel@tonic-gate ip->intrspec_pri, INT_IPL(ip->intrspec_pri)); 171*7c478bd9Sstevel@tonic-gate if (ip->intrspec_vec) 172*7c478bd9Sstevel@tonic-gate (void) printf(", vector=0x%x (%d)", 173*7c478bd9Sstevel@tonic-gate ip->intrspec_vec, ip->intrspec_vec); 174*7c478bd9Sstevel@tonic-gate (void) printf("\n"); 175*7c478bd9Sstevel@tonic-gate } 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate static void 178*7c478bd9Sstevel@tonic-gate obio_print(uintptr_t data, int ilev) 179*7c478bd9Sstevel@tonic-gate { 180*7c478bd9Sstevel@tonic-gate int i, nreg, nrng, nintr; 181*7c478bd9Sstevel@tonic-gate struct ddi_parent_private_data *dp; 182*7c478bd9Sstevel@tonic-gate struct regspec *reg; 183*7c478bd9Sstevel@tonic-gate struct intrspec *intr; 184*7c478bd9Sstevel@tonic-gate struct rangespec *rng; 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate dp = (struct ddi_parent_private_data *)data; 187*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 188*7c478bd9Sstevel@tonic-gate dprintf("obio parent private data: nreg = 0x%x offset = 0x%x" 189*7c478bd9Sstevel@tonic-gate " nintr = 0x%x offset = 0x%x nrng = 0x%x offset = %x\n", 190*7c478bd9Sstevel@tonic-gate dp->par_nreg, *((di_off_t *)(&dp->par_reg)), 191*7c478bd9Sstevel@tonic-gate dp->par_nintr, *((di_off_t *)(&dp->par_intr)), 192*7c478bd9Sstevel@tonic-gate dp->par_nrng, *((di_off_t *)(&dp->par_rng))); 193*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 194*7c478bd9Sstevel@tonic-gate nreg = dp->par_nreg; 195*7c478bd9Sstevel@tonic-gate nintr = dp->par_nintr; 196*7c478bd9Sstevel@tonic-gate nrng = dp->par_nrng; 197*7c478bd9Sstevel@tonic-gate 198*7c478bd9Sstevel@tonic-gate /* 199*7c478bd9Sstevel@tonic-gate * All pointers are translated to di_off_t by the devinfo driver. 200*7c478bd9Sstevel@tonic-gate * This is a private agreement between libdevinfo and prtconf. 201*7c478bd9Sstevel@tonic-gate */ 202*7c478bd9Sstevel@tonic-gate if (nreg != 0) { 203*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 204*7c478bd9Sstevel@tonic-gate (void) printf("Register Specifications:\n"); 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate reg = (struct regspec *)(data + *(di_off_t *)(&dp->par_reg)); 207*7c478bd9Sstevel@tonic-gate for (i = 0; i < nreg; ++i) 208*7c478bd9Sstevel@tonic-gate obio_printregs(reg + i, ilev); 209*7c478bd9Sstevel@tonic-gate } 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate if (nrng != 0) { 212*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 213*7c478bd9Sstevel@tonic-gate (void) printf("Range Specifications:\n"); 214*7c478bd9Sstevel@tonic-gate 215*7c478bd9Sstevel@tonic-gate rng = (struct rangespec *)(data + *(di_off_t *)(&dp->par_rng)); 216*7c478bd9Sstevel@tonic-gate for (i = 0; i < nrng; ++i) 217*7c478bd9Sstevel@tonic-gate obio_printranges(rng + i, ilev); 218*7c478bd9Sstevel@tonic-gate } 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate if (nintr != 0) { 221*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 222*7c478bd9Sstevel@tonic-gate (void) printf("Interrupt Specifications:\n"); 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate intr = (struct intrspec *)(data + *(di_off_t *)(&dp->par_intr)); 225*7c478bd9Sstevel@tonic-gate for (i = 0; i < nintr; ++i) 226*7c478bd9Sstevel@tonic-gate obio_printintr(intr + i, ilev); 227*7c478bd9Sstevel@tonic-gate } 228*7c478bd9Sstevel@tonic-gate } 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate static void 231*7c478bd9Sstevel@tonic-gate pcmcia_printregs(struct pcm_regs *rp, int ilev) 232*7c478bd9Sstevel@tonic-gate { 233*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 234*7c478bd9Sstevel@tonic-gate (void) printf(" Phys hi=0x%x, Phys lo=0x%x, Phys len=%x\n", 235*7c478bd9Sstevel@tonic-gate rp->phys_hi, rp->phys_lo, rp->phys_len); 236*7c478bd9Sstevel@tonic-gate } 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate static void 239*7c478bd9Sstevel@tonic-gate pcmcia_printintr(struct intrspec *ip, int ilev) 240*7c478bd9Sstevel@tonic-gate { 241*7c478bd9Sstevel@tonic-gate obio_printintr(ip, ilev); 242*7c478bd9Sstevel@tonic-gate } 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate static void 245*7c478bd9Sstevel@tonic-gate pcmcia_print(uintptr_t data, int ilev) 246*7c478bd9Sstevel@tonic-gate { 247*7c478bd9Sstevel@tonic-gate int i, nreg, nintr; 248*7c478bd9Sstevel@tonic-gate struct pcmcia_parent_private *dp; 249*7c478bd9Sstevel@tonic-gate struct pcm_regs *reg; 250*7c478bd9Sstevel@tonic-gate struct intrspec *intr; 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate dp = (struct pcmcia_parent_private *)data; 253*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 254*7c478bd9Sstevel@tonic-gate dprintf("pcmcia parent private data: nreg = 0x%x offset = 0x%x" 255*7c478bd9Sstevel@tonic-gate " intr = 0x%x offset = %x\n", 256*7c478bd9Sstevel@tonic-gate dp->ppd_nreg, *(di_off_t *)(&dp->ppd_reg), 257*7c478bd9Sstevel@tonic-gate dp->ppd_intr, *(di_off_t *)(&dp->ppd_intrspec)); 258*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 259*7c478bd9Sstevel@tonic-gate nreg = dp->ppd_nreg; 260*7c478bd9Sstevel@tonic-gate nintr = dp->ppd_intr; 261*7c478bd9Sstevel@tonic-gate 262*7c478bd9Sstevel@tonic-gate /* 263*7c478bd9Sstevel@tonic-gate * All pointers are translated to di_off_t by the devinfo driver. 264*7c478bd9Sstevel@tonic-gate * This is a private agreement between libdevinfo and prtconf. 265*7c478bd9Sstevel@tonic-gate */ 266*7c478bd9Sstevel@tonic-gate if (nreg != 0) { 267*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 268*7c478bd9Sstevel@tonic-gate (void) printf("Register Specifications:\n"); 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate reg = (struct pcm_regs *)(data + *(di_off_t *)(&dp->ppd_reg)); 271*7c478bd9Sstevel@tonic-gate for (i = 0; i < nreg; ++i) 272*7c478bd9Sstevel@tonic-gate pcmcia_printregs(reg + i, ilev); 273*7c478bd9Sstevel@tonic-gate } 274*7c478bd9Sstevel@tonic-gate 275*7c478bd9Sstevel@tonic-gate if (nintr != 0) { 276*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 277*7c478bd9Sstevel@tonic-gate (void) printf("Interrupt Specifications:\n"); 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate intr = (struct intrspec *) 280*7c478bd9Sstevel@tonic-gate (data + *(di_off_t *)(&dp->ppd_intrspec)); 281*7c478bd9Sstevel@tonic-gate for (i = 0; i < nintr; ++i) 282*7c478bd9Sstevel@tonic-gate pcmcia_printintr(intr + i, ilev); 283*7c478bd9Sstevel@tonic-gate } 284*7c478bd9Sstevel@tonic-gate } 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate static void 287*7c478bd9Sstevel@tonic-gate sbus_print(uintptr_t data, int ilev) 288*7c478bd9Sstevel@tonic-gate { 289*7c478bd9Sstevel@tonic-gate int i, nreg, nrng, nintr; 290*7c478bd9Sstevel@tonic-gate struct ddi_parent_private_data *dp; 291*7c478bd9Sstevel@tonic-gate struct regspec *reg; 292*7c478bd9Sstevel@tonic-gate struct intrspec *intr; 293*7c478bd9Sstevel@tonic-gate struct rangespec *rng; 294*7c478bd9Sstevel@tonic-gate 295*7c478bd9Sstevel@tonic-gate dp = (struct ddi_parent_private_data *)data; 296*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 297*7c478bd9Sstevel@tonic-gate dprintf("sbus parent private data: nreg = 0x%x offset = 0x%x" 298*7c478bd9Sstevel@tonic-gate " nintr = 0x%x offset = 0x%x nrng = 0x%x offset = %x\n", 299*7c478bd9Sstevel@tonic-gate dp->par_nreg, *((di_off_t *)(&dp->par_reg)), 300*7c478bd9Sstevel@tonic-gate dp->par_nintr, *((di_off_t *)(&dp->par_intr)), 301*7c478bd9Sstevel@tonic-gate dp->par_nrng, *((di_off_t *)(&dp->par_rng))); 302*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 303*7c478bd9Sstevel@tonic-gate nreg = dp->par_nreg; 304*7c478bd9Sstevel@tonic-gate nintr = dp->par_nintr; 305*7c478bd9Sstevel@tonic-gate nrng = dp->par_nrng; 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate /* 308*7c478bd9Sstevel@tonic-gate * All pointers are translated to di_off_t by the devinfo driver. 309*7c478bd9Sstevel@tonic-gate * This is a private agreement between libdevinfo and prtconf. 310*7c478bd9Sstevel@tonic-gate */ 311*7c478bd9Sstevel@tonic-gate if (nreg != 0) { 312*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 313*7c478bd9Sstevel@tonic-gate (void) printf("Register Specifications:\n"); 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate reg = (struct regspec *)(data + *(di_off_t *)(&dp->par_reg)); 316*7c478bd9Sstevel@tonic-gate for (i = 0; i < nreg; ++i) 317*7c478bd9Sstevel@tonic-gate obio_printregs(reg + i, ilev); 318*7c478bd9Sstevel@tonic-gate } 319*7c478bd9Sstevel@tonic-gate 320*7c478bd9Sstevel@tonic-gate 321*7c478bd9Sstevel@tonic-gate if (nrng != 0) { 322*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 323*7c478bd9Sstevel@tonic-gate (void) printf("Range Specifications:\n"); 324*7c478bd9Sstevel@tonic-gate 325*7c478bd9Sstevel@tonic-gate rng = (struct rangespec *)(data + *(di_off_t *)(&dp->par_rng)); 326*7c478bd9Sstevel@tonic-gate for (i = 0; i < nrng; ++i) 327*7c478bd9Sstevel@tonic-gate obio_printranges(rng + i, ilev); 328*7c478bd9Sstevel@tonic-gate } 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gate /* 331*7c478bd9Sstevel@tonic-gate * To print interrupt property for children of sbus on sun4u requires 332*7c478bd9Sstevel@tonic-gate * definitions in sysiosbus.h. 333*7c478bd9Sstevel@tonic-gate * 334*7c478bd9Sstevel@tonic-gate * We can't #include <sys/sysiosbus.h> to have the build work on 335*7c478bd9Sstevel@tonic-gate * non sun4u machines. It's not right either to 336*7c478bd9Sstevel@tonic-gate * #include "../../uts/sun4u/sys/sysiosbus.h" 337*7c478bd9Sstevel@tonic-gate * As a result, we will not print the information. 338*7c478bd9Sstevel@tonic-gate */ 339*7c478bd9Sstevel@tonic-gate if ((nintr != 0) && (strcmp(opts.o_uts.machine, "sun4u") != 0)) { 340*7c478bd9Sstevel@tonic-gate indent_to_level(ilev); 341*7c478bd9Sstevel@tonic-gate (void) printf("Interrupt Specifications:\n"); 342*7c478bd9Sstevel@tonic-gate 343*7c478bd9Sstevel@tonic-gate for (i = 0; i < nintr; ++i) { 344*7c478bd9Sstevel@tonic-gate intr = (struct intrspec *) 345*7c478bd9Sstevel@tonic-gate (data + *(di_off_t *)(&dp->par_intr)); 346*7c478bd9Sstevel@tonic-gate obio_printintr(intr + i, ilev); 347*7c478bd9Sstevel@tonic-gate } 348*7c478bd9Sstevel@tonic-gate } 349*7c478bd9Sstevel@tonic-gate } 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate static struct priv_data * 352*7c478bd9Sstevel@tonic-gate match_priv_data(di_node_t node) 353*7c478bd9Sstevel@tonic-gate { 354*7c478bd9Sstevel@tonic-gate int i; 355*7c478bd9Sstevel@tonic-gate size_t len; 356*7c478bd9Sstevel@tonic-gate char *drv_name, *tmp; 357*7c478bd9Sstevel@tonic-gate di_node_t parent; 358*7c478bd9Sstevel@tonic-gate struct priv_data *pdp; 359*7c478bd9Sstevel@tonic-gate 360*7c478bd9Sstevel@tonic-gate if ((parent = di_parent_node(node)) == DI_NODE_NIL) 361*7c478bd9Sstevel@tonic-gate return (NULL); 362*7c478bd9Sstevel@tonic-gate 363*7c478bd9Sstevel@tonic-gate if ((drv_name = di_driver_name(parent)) == NULL) 364*7c478bd9Sstevel@tonic-gate return (NULL); 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate pdp = prt_priv_data; 367*7c478bd9Sstevel@tonic-gate len = strlen(drv_name); 368*7c478bd9Sstevel@tonic-gate for (i = 0; i < nprt_priv_data; ++i, ++pdp) { 369*7c478bd9Sstevel@tonic-gate tmp = pdp->drv_name; 370*7c478bd9Sstevel@tonic-gate while (tmp && (*tmp != '\0')) { 371*7c478bd9Sstevel@tonic-gate if (strncmp(tmp, drv_name, len) == 0) { 372*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 373*7c478bd9Sstevel@tonic-gate dprintf("matched parent private data" 374*7c478bd9Sstevel@tonic-gate " at Node <%s> parent driver <%s>\n", 375*7c478bd9Sstevel@tonic-gate di_node_name(node), drv_name); 376*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 377*7c478bd9Sstevel@tonic-gate return (pdp); 378*7c478bd9Sstevel@tonic-gate } 379*7c478bd9Sstevel@tonic-gate /* 380*7c478bd9Sstevel@tonic-gate * skip a white space 381*7c478bd9Sstevel@tonic-gate */ 382*7c478bd9Sstevel@tonic-gate if (tmp = strchr(tmp, ' ')) 383*7c478bd9Sstevel@tonic-gate tmp++; 384*7c478bd9Sstevel@tonic-gate } 385*7c478bd9Sstevel@tonic-gate } 386*7c478bd9Sstevel@tonic-gate 387*7c478bd9Sstevel@tonic-gate return (NULL); 388*7c478bd9Sstevel@tonic-gate } 389*7c478bd9Sstevel@tonic-gate 390*7c478bd9Sstevel@tonic-gate void 391*7c478bd9Sstevel@tonic-gate dump_priv_data(int ilev, di_node_t node) 392*7c478bd9Sstevel@tonic-gate { 393*7c478bd9Sstevel@tonic-gate uintptr_t priv; 394*7c478bd9Sstevel@tonic-gate struct priv_data *pdp; 395*7c478bd9Sstevel@tonic-gate 396*7c478bd9Sstevel@tonic-gate if ((priv = (uintptr_t)di_parent_private_data(node)) == NULL) 397*7c478bd9Sstevel@tonic-gate return; 398*7c478bd9Sstevel@tonic-gate 399*7c478bd9Sstevel@tonic-gate if ((pdp = match_priv_data(node)) == NULL) { 400*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 401*7c478bd9Sstevel@tonic-gate dprintf("Error: parent private data format unknown\n"); 402*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 403*7c478bd9Sstevel@tonic-gate return; 404*7c478bd9Sstevel@tonic-gate } 405*7c478bd9Sstevel@tonic-gate 406*7c478bd9Sstevel@tonic-gate pdp->pd_print(priv, ilev); 407*7c478bd9Sstevel@tonic-gate 408*7c478bd9Sstevel@tonic-gate /* ignore driver private data for now */ 409*7c478bd9Sstevel@tonic-gate } 410