11414Scindi /*
21414Scindi * CDDL HEADER START
31414Scindi *
41414Scindi * The contents of this file are subject to the terms of the
51414Scindi * Common Development and Distribution License (the "License").
61414Scindi * You may not use this file except in compliance with the License.
71414Scindi *
81414Scindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91414Scindi * or http://www.opensolaris.org/os/licensing.
101414Scindi * See the License for the specific language governing permissions
111414Scindi * and limitations under the License.
121414Scindi *
131414Scindi * When distributing Covered Code, include this CDDL HEADER in each
141414Scindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151414Scindi * If applicable, add the following below this CDDL HEADER, with the
161414Scindi * fields enclosed by brackets "[]" replaced with your own identifying
171414Scindi * information: Portions Copyright [yyyy] [name of copyright owner]
181414Scindi *
191414Scindi * CDDL HEADER END
201414Scindi */
211414Scindi
221414Scindi /*
23*9718STarik.Soydan@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
241414Scindi * Use is subject to license terms.
251414Scindi */
261414Scindi
271414Scindi #include <fm/topo_mod.h>
28*9718STarik.Soydan@Sun.COM #include <did_props.h>
291414Scindi
301414Scindi /*
311414Scindi * Including the following file gives us definitions of the three
321414Scindi * global arrays used to adjust labels, Slot_Rewrites, Physlot_Names,
331414Scindi * and Missing_Names. With those defined we can use the common labeling
341414Scindi * routines for pci.
351414Scindi */
361414Scindi #include "pci_sun4u.h"
371414Scindi
383895Szx143588 #include "pci_sun4.h"
39*9718STarik.Soydan@Sun.COM #include <strings.h>
403895Szx143588
411414Scindi int
platform_pci_label(topo_mod_t * mod,tnode_t * node,nvlist_t * in,nvlist_t ** out)423062Scindi platform_pci_label(topo_mod_t *mod, tnode_t *node, nvlist_t *in,
433062Scindi nvlist_t **out)
441414Scindi {
453062Scindi return (pci_label_cmn(mod, node, in, out));
461414Scindi }
473895Szx143588 int
platform_pci_fru(topo_mod_t * mod,tnode_t * node,nvlist_t * in,nvlist_t ** out)483895Szx143588 platform_pci_fru(topo_mod_t *mod, tnode_t *node, nvlist_t *in,
493895Szx143588 nvlist_t **out)
503895Szx143588 {
513895Szx143588 return (pci_fru_compute(mod, node, in, out));
523895Szx143588 }
53*9718STarik.Soydan@Sun.COM
54*9718STarik.Soydan@Sun.COM /*
55*9718STarik.Soydan@Sun.COM * Sun-Fire platform function to test whether the hostbridge which
56*9718STarik.Soydan@Sun.COM * this PCI device is associated with is an Xmits or not. This
57*9718STarik.Soydan@Sun.COM * function applies to E3800, E48xx, E4900, E6800, and E6900.
58*9718STarik.Soydan@Sun.COM *
59*9718STarik.Soydan@Sun.COM * Return 1 if the hostbridge is an Xmits otherwise return 0.
60*9718STarik.Soydan@Sun.COM *
61*9718STarik.Soydan@Sun.COM * This check is done by walking up the topo tree and checking the
62*9718STarik.Soydan@Sun.COM * associated device info nodes for a binding name or a compatible
63*9718STarik.Soydan@Sun.COM * name matching that of Xmits.
64*9718STarik.Soydan@Sun.COM */
65*9718STarik.Soydan@Sun.COM int
sunfire_test_func(topo_mod_t * mod,did_t * dp)66*9718STarik.Soydan@Sun.COM sunfire_test_func(topo_mod_t *mod, did_t *dp)
67*9718STarik.Soydan@Sun.COM {
68*9718STarik.Soydan@Sun.COM tnode_t *tp;
69*9718STarik.Soydan@Sun.COM int done, xmits_found, i, n;
70*9718STarik.Soydan@Sun.COM char *compatible_names, *binding_name;
71*9718STarik.Soydan@Sun.COM
72*9718STarik.Soydan@Sun.COM done = xmits_found = 0;
73*9718STarik.Soydan@Sun.COM tp = did_gettnode(dp);
74*9718STarik.Soydan@Sun.COM
75*9718STarik.Soydan@Sun.COM while (!done) {
76*9718STarik.Soydan@Sun.COM topo_mod_dprintf(mod, "%s: dp=0x%p, tp=0x%p\n",
77*9718STarik.Soydan@Sun.COM __func__, dp, tp);
78*9718STarik.Soydan@Sun.COM
79*9718STarik.Soydan@Sun.COM /*
80*9718STarik.Soydan@Sun.COM * Check binding name.
81*9718STarik.Soydan@Sun.COM */
82*9718STarik.Soydan@Sun.COM binding_name = di_binding_name(did_dinode(dp));
83*9718STarik.Soydan@Sun.COM if (binding_name != NULL) {
84*9718STarik.Soydan@Sun.COM topo_mod_dprintf(mod, "%s: binding_name=%s\n",
85*9718STarik.Soydan@Sun.COM __func__, binding_name);
86*9718STarik.Soydan@Sun.COM if (strncmp(binding_name, XMITS_COMPAT,
87*9718STarik.Soydan@Sun.COM sizeof (XMITS_COMPAT)) == 0) {
88*9718STarik.Soydan@Sun.COM done = xmits_found = 1;
89*9718STarik.Soydan@Sun.COM break;
90*9718STarik.Soydan@Sun.COM }
91*9718STarik.Soydan@Sun.COM }
92*9718STarik.Soydan@Sun.COM
93*9718STarik.Soydan@Sun.COM /*
94*9718STarik.Soydan@Sun.COM * Check compatible names.
95*9718STarik.Soydan@Sun.COM */
96*9718STarik.Soydan@Sun.COM n = di_compatible_names(did_dinode(dp), &compatible_names);
97*9718STarik.Soydan@Sun.COM for (i = 0; i < n; i++) {
98*9718STarik.Soydan@Sun.COM topo_mod_dprintf(mod, "%s: compatible_name[%d]=%s\n",
99*9718STarik.Soydan@Sun.COM __func__, i, compatible_names);
100*9718STarik.Soydan@Sun.COM if (strncmp(compatible_names, XMITS_COMPAT,
101*9718STarik.Soydan@Sun.COM sizeof (XMITS_COMPAT)) == 0) {
102*9718STarik.Soydan@Sun.COM done = xmits_found = 1;
103*9718STarik.Soydan@Sun.COM break;
104*9718STarik.Soydan@Sun.COM }
105*9718STarik.Soydan@Sun.COM compatible_names += strlen(compatible_names) + 1;
106*9718STarik.Soydan@Sun.COM }
107*9718STarik.Soydan@Sun.COM
108*9718STarik.Soydan@Sun.COM /*
109*9718STarik.Soydan@Sun.COM * Walk up the tree until we hit the top or hit
110*9718STarik.Soydan@Sun.COM * a non-PCI device.
111*9718STarik.Soydan@Sun.COM */
112*9718STarik.Soydan@Sun.COM if (((tp = topo_node_parent(tp)) == NULL) ||
113*9718STarik.Soydan@Sun.COM (dp = did_find(mod, topo_node_getspecific(tp))) == NULL) {
114*9718STarik.Soydan@Sun.COM done = 1;
115*9718STarik.Soydan@Sun.COM break;
116*9718STarik.Soydan@Sun.COM }
117*9718STarik.Soydan@Sun.COM }
118*9718STarik.Soydan@Sun.COM
119*9718STarik.Soydan@Sun.COM return (xmits_found);
120*9718STarik.Soydan@Sun.COM }
121