7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License (the "License").
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
186d582bd9dbcd38e0aeea49036d47d3426a3536Surya Prakki * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Generic code shared by all the ioboard enumerators
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindistatic int iob_enum(topo_mod_t *, tnode_t *, const char *, topo_instance_t,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi topo_instance_t, void *, void *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindistatic int iob_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int platform_iob_enum(topo_mod_t *, tnode_t *, topo_instance_t,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int platform_iob_label(topo_mod_t *, tnode_t *, nvlist_t *, nvlist_t **);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi { IOBOARD, FM_FMRI_SCHEME_HC, IOB_ENUMR_VERS, &Iob_ops };
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi TOPO_METH_LABEL_VERSION, TOPO_STABILITY_INTERNAL, iob_label },
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Turn on module debugging output
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi topo_mod_dprintf(modhdl, "initializing ioboard enumerator\n");
186d582bd9dbcd38e0aeea49036d47d3426a3536Surya Prakki (void) topo_mod_register(modhdl, &Iob_info, TOPO_VERSION);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiiob_label(topo_mod_t *mp, tnode_t *node, topo_version_t version,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if ((rp = topo_mod_load(mp, HOSTBRIDGE, HB_ENUMR_VERS)) == NULL) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi "%s enumerator could not load %s.\n", IOBOARD, HOSTBRIDGE);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*ARGSUSED*/
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiiob_enum(topo_mod_t *mp, tnode_t *pn, const char *name, topo_instance_t imin,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi "Currently only know how to enumerate %s components.\n",
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Load the hostbridge enumerator, we'll soon need it!
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (-1);
92ba710950bf6ee35de67e1e0b7f20ec9e528106eschrock return (-1);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*ARGSUSED*/
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * node private data (did_t) for this node is destroyed in
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * did_hash_destroy()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi fmri = topo_mod_hcfmri(mod, parent, FM_HC_SCHEME_VERSION, name, i,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi "topo_node_bind (%s%d/%s%d) failed: %s\n",
724365f7556fc4201fdb11766ebc6bd918523130sethg if (topo_method_register(mod, ntn, Iob_methods) < 0) {
724365f7556fc4201fdb11766ebc6bd918523130sethg topo_mod_dprintf(mod, "topo_method_register failed: %s\n",
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiioboard_declare(topo_mod_t *mod, tnode_t *parent, topo_instance_t i, void *priv)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if ((ntn = iob_tnode_create(mod, parent, IOBOARD, i, priv)) == NULL)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if (did_props_set(ntn, priv, IOB_common_props, IOB_propcnt) < 0) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * We expect to find host bridges beneath the ioboard.
724365f7556fc4201fdb11766ebc6bd918523130sethg if (child_range_add(mod, ntn, HOSTBRIDGE, 0, MAX_HBS) < 0) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindisplit_bus_address(topo_mod_t *mod, di_node_t dp, uint_t baseaddr,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint_t bussep, int minbrd, int maxbrd, int *brd, int *br, int *bus)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (e < 0) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (e < 0) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (*brd < minbrd || *brd > maxbrd || (*br != 0 && *br != 1) ||
724365f7556fc4201fdb11766ebc6bd918523130sethg topo_mod_dprintf(mod, "Trouble with transcription\n");
724365f7556fc4201fdb11766ebc6bd918523130sethg topo_mod_dprintf(mod, "brd=%d br=%d bus=%d bc=%x ac=%x\n",