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 2009 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * Opl platform specific PICL functions. 2N/A * machine_type == MTYPE_OPL 2N/A * Collect I/O nodes information. 2N/A /* Do not proceed to parse this branch */ 2N/A /* Do not parse non-pci nodes */ 2N/A /* Do not proceed to parse this branch */ 2N/A /* Do not proceed to parse this branch */ 2N/A /* Save board node's pathname */ 2N/A /* Walk through the children */ 2N/A /* Do not proceed to parse this node */ 2N/A /* Do not proceed to parse this node */ 2N/A * Get bus#, dev# and func# for this card from 'reg' property. 2N/A /* All of the array of bytes of "reg" have to be read */ 2N/A /* Do not proceed to parse this node */ 2N/A * get_lane_width will fail when run as non-root. 2N/A * Set bus_type to PCI_UNKN so that bus frequency, 2N/A * bus type and lane width will print as "--" or UNKN. 2N/A * Get the name of this card. If binding_name is found, 2N/A * name will be <nodename>-<binding_name> 2N/A * if compatible prop is found, name will be 2N/A * <nodename>-<compatible> 2N/A /* No binding-name or compatible */ 2N/A /* Get the status of the card */ 2N/A /* Get the model of this card */ 2N/A /* Get revision id */ 2N/A * prtdiag -v prints all devices 2N/A /* Print board number */ 2N/A /* Print Card Name */ 2N/A /* Print Card Model */ 2N/A * Display all the PCI IO cards on this board. 2N/A char *
fmt =
"%-3s %-5s %-4s %-20s %-11s %-5s %-11s %-30s %-20s";
2N/A " BDF",
"State",
"Act, Max",
"Name",
"Model", 0);
2N/A "---",
"-----",
"----",
" ------------------",
2N/A " ---------",
"-----",
"-----------",
2N/A "------------------------------",
2N/A "--------------------", 0);
2N/A * return the first compatible value 2N/A /* get first string from table */ 2N/A * search children to get the node by the nodename 2N/A * Link Capabilities and Link Status registers are in the 2N/A * PCI-E capabilities register. They are at offset 2N/A * 0xc and 0x12 respectively. They are documented in section 2N/A * 7.8 of the PCI Express Base Specification. The address of 2N/A * that structure is not fixed, it's kind of a linked list. 2N/A * The Capabilities Pointer reg (8 bits) is always at 0x34. 2N/A * It contains a pointer to the first capabilities structure. 2N/A * For each capability structure, the first 8 bits is the capability 2N/A * ID. The next 8 bits is the pointer to the next structure. 2N/A * If the Next Cap register is zero, it's the end of the list. 2N/A * The capability ID for the PCI-E strucutre is 0x10. The idea 2N/A * is to follow the links until you find a Cap ID of 0x10, then 2N/A * read the registers at 0xc and 0x12 from there. 2N/A * If there's no Cap ID 0x10, then it's not a PCI-E device. 2N/A /* This is a PCI-X bridge */ 2N/A }
else {
/* Leaf device */ 2N/A * get the clock frequency 2N/A * If it is not an int or uint prop, return failure 2N/A default:
/* not supported size */ 2N/A * recursively visit all nodes 2N/A /* Do not display error message */