pcibus_labels.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Do a platform specific label lookup based on physical slot number. 2N/A * Do a platform specific label lookup based on slot name. 2N/A "old_label=%s, new_label=%s\n",
2N/A * If a test function is specified then call 2N/A * it to do an additional check. 2N/A "%s: calling test function=%p\n",
2N/A "%s: test function return=%d\n",
2N/A * Do a platform specific label lookup based on bus, dev, etc. 2N/A "board=%d, bridge=%d, rc=%d, bus=%d, dev=%d\n",
2N/A * If a test function is specified then call 2N/A * it to do an additional test. 2N/A "%s: calling test function=%p\n",
2N/A "%s: test function return=%d\n",
2N/A * Do an overall slot label lookup for the device node. 2N/A "node_inst=%d, dp=%p, dp_bdf=%d/%d/%d, pdp=%p\n",
2N/A * The slot label is determined in the following order: 2N/A * - Platform specific lookup based on physical slot #. 2N/A * - Platform specific lookup based on default label string. 2N/A * - Platform specific lookup based on device number (Note that this 2N/A * can override the default label by pci_label_slotname_lookup 2N/A * returning null, and the pci_label_missing_lookup setting a new 2N/A * If no platform known, then just use default label. 2N/A * Trim SUNW, from the platform name 2N/A * If we haven't overridden the label, then we may need to 2N/A * concatenate with that of an ancestor node. Check ancestors for a 2N/A * slot label until we either find one or hit a non-pci device. 2N/A * If an ancestor has a slot label, then this node's label 2N/A * is generated by concatenating the default label onto the 2N/A * We grab pairs of ancestors (parent and child) as we go up 2N/A * the tree because the parent is checked for the presence 2N/A * of a slot while the child contains the label. 2N/A * Check ancestors for a slot label until we 2N/A * either find one or hit a non-pci device. 2N/A * Get next ancestor node and data pointers. 2N/A "two ancestors: anode=%p, adp=%p " 2N/A "apnode=%p, apdp=%p\n",
2N/A "anode_name=%s[%d], anode_bdf=%d/%d/%d\n",
2N/A "apnode_name=%s[%d], " 2N/A "apnode_bdf=%d/%d/%d\n",
2N/A * If the ancestors do not exist or are not pci 2N/A * devices then we're done searching. 2N/A * Otherwise, if the ancestor has a physical slot, 2N/A * and it is a different slot than the one we 2N/A * started with then lookup the ancestor label, 2N/A "%s: node=%p: topo_node_label() " 2N/A "ancestor with a slot, label=%s ",
2N/A * If we found an ancestor with a slot label, and this node has 2N/A * a physical slot number label then concatenate the two to form 2N/A * this node's label. Otherwise, do a full slot label lookup. 2N/A "ancestor_l=%s and l=%s\n",
2N/A * If we calculated a slot label, then save it in the 2N/A * node's data structure so we can free it later. 2N/A * If it's not a device or a PCI-express bus (which could potentially 2N/A * represent a slot, and therefore we might need to capture its slot 2N/A * name information), just inherit any label from our parent 2N/A * Is there a slot label associated with the device? 2N/A * Is there a slot label associated with the device?