/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <libdevinfo.h>
#include "prtconf.h"
struct priv_data {
};
extern void indent_to_level();
static void obio_printregs(struct regspec *, int);
static void obio_printranges(struct rangespec *, int);
static void obio_printintr(struct intrspec *, int);
static void obio_print(uintptr_t, int);
static void pcmcia_printregs(struct pcm_regs *, int);
static void pcmcia_printintr(struct intrspec *, int);
static void pcmcia_print(uintptr_t, int);
static void sbus_print(uintptr_t, int);
/*
* This is a hardcoded list of drivers we print parent private
* data as of Solaris 7.
*/
{
/*
* obio format: applies the following list
* of nexus drivers. Note that obio driver
* went away with sun4m.
*/
#ifdef __sparc
"central dma ebus fhc isa pci rootnex",
#else
"central dma ebus fhc isa pci pci_pci rootnex",
#endif /* __sparc */
sizeof (struct ddi_parent_private_data),
sizeof (struct regspec), /* first pointer */
sizeof (struct intrspec), /* second pointer */
sizeof (struct rangespec), /* third pointer */
0, 0, 0, /* no more pointers */
0, 0, 0
},
{ /* pcmcia format */
"pcic",
sizeof (struct pcmcia_parent_private),
sizeof (struct pcm_regs), /* first pointer */
sizeof (struct intrspec), /* second pointer */
0, 0, 0, /* no more pointers */
0, 0, 0,
0, 0, 0
},
{ /* sbus format--it's different on sun4u!! */
"sbus",
sizeof (struct ddi_parent_private_data),
sizeof (struct regspec), /* first pointer */
sizeof (struct intrspec), /* second pointer */
sizeof (struct rangespec), /* third pointer */
0, 0, 0, /* no more pointers */
0, 0, 0
}
};
};
void
{
/* no driver private data */
}
static void
{
(void) printf(" Bus Type=0x%x, Address=0x%x, Size=0x%x\n",
}
static void
{
(void) printf(" Ch: %.2x,%.8x Pa: %.2x,%.8x, Sz: %x\n",
}
static void
{
(void) printf(" Interrupt Priority=0x%x (ipl %d)",
if (ip->intrspec_vec)
(void) printf(", vector=0x%x (%d)",
(void) printf("\n");
}
static void
{
#ifdef DEBUG
dprintf("obio parent private data: nreg = 0x%x offset = 0x%x"
" nintr = 0x%x offset = 0x%x nrng = 0x%x offset = %x\n",
#endif /* DEBUG */
/*
* All pointers are translated to di_off_t by the devinfo driver.
* This is a private agreement between libdevinfo and prtconf.
*/
if (nreg != 0) {
(void) printf("Register Specifications:\n");
for (i = 0; i < nreg; ++i)
}
if (nrng != 0) {
(void) printf("Range Specifications:\n");
for (i = 0; i < nrng; ++i)
}
if (nintr != 0) {
(void) printf("Interrupt Specifications:\n");
for (i = 0; i < nintr; ++i)
}
}
static void
{
(void) printf(" Phys hi=0x%x, Phys lo=0x%x, Phys len=%x\n",
}
static void
{
}
static void
{
#ifdef DEBUG
dprintf("pcmcia parent private data: nreg = 0x%x offset = 0x%x"
" intr = 0x%x offset = %x\n",
#endif /* DEBUG */
/*
* All pointers are translated to di_off_t by the devinfo driver.
* This is a private agreement between libdevinfo and prtconf.
*/
if (nreg != 0) {
(void) printf("Register Specifications:\n");
for (i = 0; i < nreg; ++i)
}
if (nintr != 0) {
(void) printf("Interrupt Specifications:\n");
for (i = 0; i < nintr; ++i)
}
}
static void
{
#ifdef DEBUG
dprintf("sbus parent private data: nreg = 0x%x offset = 0x%x"
" nintr = 0x%x offset = 0x%x nrng = 0x%x offset = %x\n",
#endif /* DEBUG */
/*
* All pointers are translated to di_off_t by the devinfo driver.
* This is a private agreement between libdevinfo and prtconf.
*/
if (nreg != 0) {
(void) printf("Register Specifications:\n");
for (i = 0; i < nreg; ++i)
}
if (nrng != 0) {
(void) printf("Range Specifications:\n");
for (i = 0; i < nrng; ++i)
}
/*
* To print interrupt property for children of sbus on sun4u requires
* definitions in sysiosbus.h.
*
* We can't #include <sys/sysiosbus.h> to have the build work on
* non sun4u machines. It's not right either to
* #include "../../uts/sun4u/sys/sysiosbus.h"
* As a result, we will not print the information.
*/
(void) printf("Interrupt Specifications:\n");
for (i = 0; i < nintr; ++i) {
}
}
}
static struct priv_data *
{
int i;
return (NULL);
return (NULL);
pdp = prt_priv_data;
for (i = 0; i < nprt_priv_data; ++i, ++pdp) {
#ifdef DEBUG
dprintf("matched parent private data"
" at Node <%s> parent driver <%s>\n",
#endif /* DEBUG */
return (pdp);
}
/*
* skip a white space
*/
tmp++;
}
}
return (NULL);
}
void
{
return;
#ifdef DEBUG
dprintf("Error: parent private data format unknown\n");
#endif /* DEBUG */
return;
}
/* ignore driver private data for now */
}
((nodetype == DI_PROM_NODEID) ? \
#define ISPCI(s) \
(strcmp((s), "pciex") == 0)))
/*
* Print vendor ID and device ID for PCI devices
*/
int
{
char *s = NULL;
"device_type", &s) <= 0)
return (0);
if (!ISPCI(s))
return (0); /* not a pci device */
(void) printf(" (%s", s);
"vendor-id", &i) > 0)
(void) printf("%x", i[0]);
"device-id", &i) > 0)
(void) printf(",%x", i[0]);
(void) printf(") [");
else
(void) printf("unknown vendor, ");
else
(void) printf("unknown device");
(void) printf("]");
return (1);
}