2N/A/*
2N/A * CDDL HEADER START
2N/A *
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 *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A/*
2N/A * Create a topology node for a PRI node of type 'hostbridge'
2N/A */
2N/A#include <sys/types.h>
2N/A#include <strings.h>
2N/A#include <sys/fm/protocol.h>
2N/A#include <fm/topo_mod.h>
2N/A#include <fm/topo_hc.h>
2N/A#include "pi_impl.h"
2N/A
2N/A#define _ENUM_NAME "enum_hostbridge"
2N/A
2N/A
2N/A/*
2N/A * Create a hostbridge topo node.
2N/A */
2N/Aint
2N/Api_enum_hostbridge(topo_mod_t *mod, md_t *mdp, mde_cookie_t mde_node,
2N/A topo_instance_t inst, tnode_t *t_parent, const char *hc_name,
2N/A tnode_t **t_node)
2N/A{
2N/A int result;
2N/A
2N/A topo_mod_dprintf(mod, "%s called for node_0x%llx type %s\n",
2N/A _ENUM_NAME, (uint64_t)mde_node, hc_name);
2N/A
2N/A *t_node = NULL;
2N/A
2N/A /*
2N/A * Create the hostbridge topo node. Use the generic enumerator to
2N/A * do this, and then we will add more attributes below.
2N/A */
2N/A result = pi_enum_generic_impl(mod, mdp, mde_node, inst, t_parent,
2N/A t_parent, hc_name, _ENUM_NAME, t_node, 0);
2N/A if (result != 0 || *t_node == NULL) {
2N/A topo_mod_dprintf(mod,
2N/A "%s node_0x%llx failed to create topo node: %s\n",
2N/A _ENUM_NAME, (uint64_t)mde_node,
2N/A topo_strerror(topo_mod_errno(mod)));
2N/A return (result);
2N/A }
2N/A
2N/A /* Update the topo node with more specific information */
2N/A result = pi_enum_update(mod, mdp, mde_node, t_parent, *t_node,
2N/A hc_name);
2N/A if (result != 0) {
2N/A topo_mod_dprintf(mod,
2N/A "%s node_0x%llx failed to create node properites: %s\n",
2N/A _ENUM_NAME, (uint64_t)mde_node,
2N/A topo_strerror(topo_mod_errno(mod)));
2N/A return (result);
2N/A }
2N/A
2N/A topo_mod_dprintf(mod, "%s added node_0x%llx type %s\n",
2N/A _ENUM_NAME, (uint64_t)mde_node, hc_name);
2N/A
2N/A return (result);
2N/A}