15911Svn83148 /*
25911Svn83148 * CDDL HEADER START
35911Svn83148 *
45911Svn83148 * The contents of this file are subject to the terms of the
55911Svn83148 * Common Development and Distribution License (the "License").
65911Svn83148 * You may not use this file except in compliance with the License.
75911Svn83148 *
85911Svn83148 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95911Svn83148 * or http://www.opensolaris.org/os/licensing.
105911Svn83148 * See the License for the specific language governing permissions
115911Svn83148 * and limitations under the License.
125911Svn83148 *
135911Svn83148 * When distributing Covered Code, include this CDDL HEADER in each
145911Svn83148 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155911Svn83148 * If applicable, add the following below this CDDL HEADER, with the
165911Svn83148 * fields enclosed by brackets "[]" replaced with your own identifying
175911Svn83148 * information: Portions Copyright [yyyy] [name of copyright owner]
185911Svn83148 *
195911Svn83148 * CDDL HEADER END
205911Svn83148 */
215911Svn83148
225911Svn83148 /*
235911Svn83148 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
245911Svn83148 * Use is subject to license terms.
255911Svn83148 */
265911Svn83148
275911Svn83148 #include <strings.h>
285911Svn83148
295911Svn83148 #include "hb_rcid.h"
305911Svn83148
315911Svn83148 /* A list of physical root complexes of the SUNW,Sun-Fire-T200 platform */
325911Svn83148 prc_t t200_prcs[] = {
335911Svn83148 /* physical id, bus address */
345911Svn83148 { 0, 0x780 },
355911Svn83148 { 1, 0x7c0 }
365911Svn83148 };
375911Svn83148
385911Svn83148 /* A list of physical root complexes of the SUNW,T5140 platform */
395911Svn83148 prc_t t5140_prcs[] = {
405911Svn83148 /* physical id, bus address */
415911Svn83148 { 0, 0x400 },
425911Svn83148 { 1, 0x500 }
435911Svn83148 };
445911Svn83148
456232Sjl139090
465911Svn83148 pprc_t plat_prcids[] = {
475911Svn83148 /*
485911Svn83148 * platforms that have the same map with T200
495911Svn83148 */
505911Svn83148 { "SUNW,Sun-Fire-T200",
515911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
525911Svn83148 t200_prcs },
535911Svn83148 { "SUNW,Sun-Fire-T1000",
545911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
555911Svn83148 t200_prcs },
565911Svn83148 { "SUNW,SPARC-Enterprise-T2000",
575911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
585911Svn83148 t200_prcs },
595911Svn83148 { "SUNW,SPARC-Enterprise-T1000",
605911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
615911Svn83148 t200_prcs },
625911Svn83148 { "SUNW,Netra-CP3060",
635911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
645911Svn83148 t200_prcs },
655911Svn83148 { "SUNW,Netra-T2000",
665911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
675911Svn83148 t200_prcs },
685911Svn83148 { "SUNW,Sun-Blade-T6300",
695911Svn83148 sizeof (t200_prcs) / sizeof (prc_t),
705911Svn83148 t200_prcs },
715911Svn83148
725911Svn83148 /*
735911Svn83148 * platforms that have the same map with T5140
745911Svn83148 */
755911Svn83148 { "SUNW,T5140",
765911Svn83148 sizeof (t5140_prcs) / sizeof (prc_t),
775911Svn83148 t5140_prcs },
785911Svn83148 { "SUNW,T5240",
795911Svn83148 sizeof (t5140_prcs) / sizeof (prc_t),
805911Svn83148 t5140_prcs },
815911Svn83148 { "SUNW,Netra-T5440",
825911Svn83148 sizeof (t5140_prcs) / sizeof (prc_t),
835911Svn83148 t5140_prcs },
845911Svn83148 { "SUNW,Sun-Blade-T6340",
855911Svn83148 sizeof (t5140_prcs) / sizeof (prc_t),
865911Svn83148 t5140_prcs },
875911Svn83148 { "SUNW,USBRDT-5240",
885911Svn83148 sizeof (t5140_prcs) / sizeof (prc_t),
89*7552Svivek.n.gavaskar@sun.com t5140_prcs }
905911Svn83148 };
915911Svn83148
925911Svn83148 pprcs_t prcids = {
935911Svn83148 sizeof (plat_prcids) / sizeof (pprc_t),
945911Svn83148 plat_prcids
955911Svn83148 };
965911Svn83148
975911Svn83148 /*
985911Svn83148 * hb_find_rc_pid()
995911Svn83148 * Description:
1005911Svn83148 * Return the physical id (non-negative) of a root complex given the
1015911Svn83148 * plaform name and its bus address.
1025911Svn83148 */
1035911Svn83148 int
hb_find_rc_pid(char * platform,uint64_t ba)1045911Svn83148 hb_find_rc_pid(char *platform, uint64_t ba)
1055911Svn83148 {
1065911Svn83148 int rcid = -1;
1075911Svn83148 int p, i;
1085911Svn83148
1095911Svn83148 for (p = 0; p < prcids.nplats; p++) {
1105911Svn83148 if (strcmp(prcids.plats[p].platform, platform) != 0)
1115911Svn83148 continue;
1125911Svn83148 for (i = 0; i < prcids.plats[p].nrcs; i++) {
1135911Svn83148 prc_t pciexrc;
1145911Svn83148 pciexrc = prcids.plats[p].rcs[i];
1155911Svn83148 if (pciexrc.ba == ba) {
1165911Svn83148 rcid = pciexrc.id;
1175911Svn83148 break;
1185911Svn83148 }
1195911Svn83148 }
1205911Svn83148 break;
1215911Svn83148 }
1225911Svn83148 return (rcid);
1235911Svn83148 }
124