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) 2008, 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 'niu'
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_niu"
2N/A
2N/A
2N/A/* ARGSUSED */
2N/Aint
2N/Api_enum_niu(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 *t_node = NULL;
2N/A
2N/A topo_mod_dprintf(mod,
2N/A "%s node_0x%llx enumeration starting\n", _ENUM_NAME,
2N/A (uint64_t)mde_node);
2N/A
2N/A /* Make sure our dependent modules are loaded */
2N/A if (topo_mod_load(mod, NIU, TOPO_VERSION) == NULL) {
2N/A topo_mod_dprintf(mod, "%s could not load %s module: %s\n",
2N/A _ENUM_NAME, NIU, topo_strerror(topo_mod_errno(mod)));
2N/A return (-1);
2N/A }
2N/A
2N/A /*
2N/A * Invoke the niu enumerator for this node.
2N/A */
2N/A result = topo_mod_enumerate(mod, t_parent, NIU, hc_name, inst, inst,
2N/A NULL);
2N/A if (result != 0) {
2N/A topo_mod_dprintf(mod,
2N/A "%s node_0x%llx enumeration failed: %s\n", _ENUM_NAME,
2N/A (uint64_t)mde_node, topo_strerror(topo_mod_errno(mod)));
2N/A return (-1);
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 (0);
2N/A}