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
12cc75c814f0c017004a9bbc96429911e008601bcindi * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#pragma ident "%Z%%M% %I% %E% SMI"
0eb822a1c0c2bea495647510b75f77f0e57633ebcindibusorrc_new(topo_mod_t *mod, const char *bus_addr, di_node_t di)
724365f7556fc4201fdb11766ebc6bd918523130sethg if ((pp = topo_mod_zalloc(mod, sizeof (busorrc_t))) == NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (e < 0) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi "Trouble interpreting bus_addr before comma.\n");
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if (e < 0) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi "Trouble interpreting bus_addr after comma.\n");
0eb822a1c0c2bea495647510b75f77f0e57633ebcindibusorrc_insert(topo_mod_t *mod, busorrc_t **head, busorrc_t *new)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* No entries yet? */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindibusorrc_add(topo_mod_t *mod, busorrc_t **list, di_node_t n)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (-1);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return (0);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindihb_process(topo_mod_t *mod, tnode_t *ptn, topo_instance_t hbi,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if ((hb = pcihostbridge_declare(mod, ptn, bn, hbi)) == NULL)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if (topo_mod_enumerate(mod, hb, PCI_BUS, PCI_BUS, bi, bi, hbdid) == 0)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindirc_process(topo_mod_t *mod, tnode_t *ptn, topo_instance_t rci, di_node_t bn)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if ((rc = pciexrc_declare(mod, ptn, bn, rci)) == NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * declare_exbuses() assumes the elements in the provided busorrc list
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * are sorted thusly:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Root Complex #0, ExBus #0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Root Complex #0, ExBus #1)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Root Complex #0, ExBus #(buses/rc))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Root Complex #1, ExBus #0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Root Complex #1, ExBus #(buses/rc))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Root Complex #(rcs/hostbridge), ExBus #(buses/rc))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #1, Root Complex #0, ExBus #0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #nhb, Root Complex #(rcs/hostbridge), ExBus #(buses/rc))
0eb822a1c0c2bea495647510b75f77f0e57633ebcindideclare_exbuses(topo_mod_t *mod, busorrc_t *list, tnode_t *ptn, int nhb,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Allocate an array to point at the hostbridge tnode_t pointers.
724365f7556fc4201fdb11766ebc6bd918523130sethg if ((hb = topo_mod_zalloc(mod, nhb * sizeof (tnode_t *))) == NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Allocate an array to point at the root complex tnode_t pointers.
12cc75c814f0c017004a9bbc96429911e008601bcindi if ((rcs = topo_mod_zalloc(mod, nrc * sizeof (tnode_t *))) == NULL) {
12cc75c814f0c017004a9bbc96429911e008601bcindi if (did_create(mod, p->br_din, 0, br, rc, rc) == NULL) {
12cc75c814f0c017004a9bbc96429911e008601bcindi if (err != 0) {
12cc75c814f0c017004a9bbc96429911e008601bcindi for (i = 0; i < nhb; ++i)
12cc75c814f0c017004a9bbc96429911e008601bcindi for (i = 0; i < nrc; ++i)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * declare_buses() assumes the elements in the provided busorrc list
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * are sorted thusly:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Bus #0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #1, Bus #0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #nhb, Bus #0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #0, Bus #1)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (Hostbridge #nhb, Bus #(buses/hostbridge))
0eb822a1c0c2bea495647510b75f77f0e57633ebcindideclare_buses(topo_mod_t *mod, busorrc_t *list, tnode_t *ptn, int nhb)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Allocate an array to point at the hostbridge tnode_t pointers.
724365f7556fc4201fdb11766ebc6bd918523130sethg if ((hb = topo_mod_zalloc(mod, nhb * sizeof (tnode_t *))) == NULL)
12cc75c814f0c017004a9bbc96429911e008601bcindi did_create(mod, p->br_din, 0, br, NO_RC, bus)) == NULL) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi hb[br] = hb_process(mod, ptn, br, bus, p->br_din, link);
12cc75c814f0c017004a9bbc96429911e008601bcindi if (err != 0) {
12cc75c814f0c017004a9bbc96429911e008601bcindi for (i = 0; i < nhb; ++i)