pi_pciexrc.c revision 908f1e1388f616898b4e515d343c0414f2a6472e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Create a topology node for a PRI node of type 'pciexrc'
*/
#include <strings.h>
#include <fm/topo_mod.h>
#include <libdevinfo.h>
#include "pi_impl.h"
#define TOPO_PGROUP_PCIEX "pciex"
#define TOPO_PCIEX_DRIVER "px"
#define PCIEX_MAX_DEVICE 255
#define _ENUM_NAME "enum_pciexrc"
static const topo_pgroup_info_t io_pgroup =
static const topo_pgroup_info_t pci_pgroup =
tnode_t *);
/*
* Create a pciexrc topo by calling the pciexrc enumerator for this instance.
*/
int
{
int result;
/*
* Create the root complex topo node. Use the generic enumerator to
* do this, and then we will add more attributes below.
*/
"%s node_0x%llx failed to create topo node: %s\n",
return (result);
}
/* Update the topo node with more specific information */
if (result != 0) {
"%s node_0x%llx failed to create node properites: %s\n",
return (result);
}
if (result == 0) {
/*
* The node exists in this domain. We will call the PCIBUS
* enumerator after the entire PRI graph has been walked so
* that all the possible FRU nodes are available for bus's
* that span multiple FRU boundaries.
*/
if (result != 0) {
/* We cannot defer the call, so we need to do it now */
}
} else {
/*
* It is OK if the node does not exist for further PCIBUS
* enumeration. We can return success having created the
* root complex node itself.
*/
result = 0;
}
return (result);
}
/* ARGSUSED */
static int
{
int result;
"%s node_0x%llx deferred enumeration starting\n", _ENUM_NAME,
/* Make sure our dependent modules are loaded */
return (-1);
}
/* Create a node range for children of this bus */
min = 0;
if (result != 0) {
"%s node_0x%llx failed to create node range: %s\n",
return (-1);
}
/*
* Invoke the pcibus enumerator for this node.
*/
if (result != 0) {
"%s node_0x%llx enumeration failed: %s\n", _ENUM_NAME,
}
return (result);
}
/*
* Update a PCIEXRC topo node with node-specific information
*
* The following is mostly a duplicate of code contained in:
* cpuboard_hostbridge.c:cpuboard_rc_node_create
*/
static int
{
int result;
int err;
char dnpath[MAXPATHLEN];
return (-1);
}
/*
* Calculate the device path for this root complex node.
*/
if (result != 0) {
return (result);
}
/*
* Set the ASRU for this node using the dev scheme
*/
return (-1);
}
if (result != 0) {
return (-1);
}
/*
* Set PCIEXRC properties for root complex nodes
*/
if (result < 0) {
"%s node_0x%llx topo_pgroup_create for io pgroup failed\n",
return (result);
}
if (result < 0) {
"%s node_0x%llx topo_pgroup_create for pci pgroup failed\n",
return (result);
}
if (result != 0) {
"%s node_0x%llx failed to set DEV property\n",
return (result);
}
/* device type is always "pciex" */
if (result < 0) {
"%s node_0x%llx failed to set DEVTYPE property\n",
return (result);
}
/*
* driver is always "px"
*/
if (result < 0) {
"%s node_0x%llx failed to set DRIVER property\n",
return (result);
}
"%s node_0x%llx failed to create module fmri\n",
return (result);
}
if (result < 0) {
"%s node_0x%llx failed to set MODULE property\n",
return (result);
}
/* This is a PCIEX root complex */
if (result < 0) {
"%s node_0x%llx failed to set EXCAP property\n",
return (result);
}
/* Create a node range for the children of this root complex */
return (0);
}
static int
{
int result;
/* Initialize the device information structure for this module */
if (devtree == DI_NODE_NIL) {
return (-1);
}
/*
* Find the PRI node cfg-handle. This will be used to associate the
* PRI node with the device node
*/
if (result != 0) {
return (result);
}
/*
* Scan the device node list and find the node associated with
* the given PRI node. Equality is defined as the PRI cfg-handle
* equalling the device node bus address.
*/
while (dnode != DI_NODE_NIL) {
char *addr;
if (bus_addr == cfg_handle) {
/* We have found the matching dnode */
break;
}
}
/* We have not found the matching dnode yet */
}
if (dnode != DI_NODE_NIL) {
/*
* Associate this dnode with the topo node. The PCI
* enumerator requires this information.
*/
}
return (0);
}