Print this page
4018 mpt_sas: allow physical topology enumeration in libtopo
4019 mpt_sas: expose LED controls to libtopo
Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Albert Lee <trisk@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/fm/topo/libtopo/common/topo_xml.c
          +++ new/usr/src/lib/fm/topo/libtopo/common/topo_xml.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  #include <libxml/parser.h>
  27   28  #include <libxml/xinclude.h>
  28   29  #include <sys/fm/protocol.h>
  29   30  #include <assert.h>
  30   31  #include <string.h>
  31   32  #include <strings.h>
  32   33  #include <ctype.h>
  33   34  #include <errno.h>
↓ open down ↓ 1335 lines elided ↑ open up ↑
1369 1370              "fac_enum_process() called for %s=%d\n", topo_node_name(ptn),
1370 1371              topo_node_instance(ptn));
1371 1372  
1372 1373          for (cn = pn->xmlChildrenNode; cn != NULL; cn = cn->next) {
1373 1374  
1374 1375                  if (xmlStrcmp(cn->name, (xmlChar *)"fac-enum") != 0)
1375 1376                          continue;
1376 1377  
1377 1378                  if ((fprov = xmlGetProp(cn, (xmlChar *)Provider)) == NULL)
1378 1379                          goto fenumdone;
1379      -
1380      -                if (xmlStrcmp(fprov, (xmlChar *)"fac_prov_ipmi") != 0) {
1381      -                        topo_dprintf(mp->tm_hdl, TOPO_DBG_XML,
1382      -                            "Invalid provider specified: %s\n", fprov);
1383      -                        goto fenumdone;
1384      -                }
1385      -
1386 1380                  /*
1387      -                 * Invoke enum entry point in fac provider which will cause the
1388      -                 * facility enumeration node method to be registered.
     1381 +                 * Invoke enum entry point in facility provider which will
     1382 +                 * cause the facility enumeration node method to be
     1383 +                 * registered.
1389 1384                   */
1390 1385                  if (fac_enum_run(mp, ptn, (const char *)fprov) != 0) {
1391 1386                          topo_dprintf(mp->tm_hdl, TOPO_DBG_ERR,
1392 1387                              "fac_enum_process: enum entry point failed!\n");
1393 1388                          goto fenumdone;
1394 1389                  }
1395 1390                  xmlFree(fprov);
1396 1391          }
1397 1392          return (0);
1398 1393  fenumdone:
↓ open down ↓ 34 lines elided ↑ open up ↑
1433 1428                  if ((ftype = xmlGetProp(cn, (xmlChar *)Type)) == NULL)
1434 1429                          goto facdone;
1435 1430  
1436 1431                  if ((provider = xmlGetProp(cn, (xmlChar *)Provider)) == NULL)
1437 1432                          goto facdone;
1438 1433  
1439 1434                  if (xmlStrcmp(ftype, (xmlChar *)Sensor) != 0 &&
1440 1435                      xmlStrcmp(ftype, (xmlChar *)Indicator) != 0)
1441 1436                          goto facdone;
1442 1437  
1443      -                if (xmlStrcmp(provider, (xmlChar *)"fac_prov_ipmi") != 0) {
1444      -                        topo_dprintf(mp->tm_hdl, TOPO_DBG_XML, "fac_process: "
1445      -                            "Invalid provider attr value: %s\n", provider);
1446      -                        goto facdone;
1447      -                }
1448      -
1449 1438                  if ((ntn = topo_node_facbind(mp, ptn, (char *)fname,
1450 1439                      (char *)ftype)) == NULL)
1451 1440                          goto facdone;
1452 1441  
1453 1442                  pgi.tpi_name = TOPO_PGROUP_FACILITY;
1454 1443                  pgi.tpi_namestab = TOPO_STABILITY_PRIVATE;
1455 1444                  pgi.tpi_datastab = TOPO_STABILITY_PRIVATE;
1456 1445                  pgi.tpi_version = 1;
1457 1446                  if (topo_pgroup_create(ntn, &pgi, &err) != 0) {
1458 1447                          if (err != ETOPO_PROP_DEFD) {
1459 1448                                  topo_dprintf(mp->tm_hdl, TOPO_DBG_ERR,
1460 1449                                      "pgroups create failure: %s\n",
1461 1450                                      topo_strerror(err));
1462 1451                                  return (-1);
1463 1452                          }
1464 1453                  }
1465 1454                  /*
1466      -                 * Invoke enum entry point in fac_prov_ipmi module, which will
1467      -                 * cause the provider methods to be registered on this node
     1455 +                 * Invoke enum entry point in the facility provider module,
     1456 +                 * which will cause the provider methods to be registered on
     1457 +                 * this node
1468 1458                   */
1469 1459                  if (fac_enum_run(mp, ntn, (const char *)provider) != 0) {
1470 1460                          topo_dprintf(mp->tm_hdl, TOPO_DBG_ERR, "fac_process: "
1471 1461                              "enum entry point failed for provider %s!\n",
1472 1462                              provider);
1473 1463                          goto facdone;
1474 1464                  }
1475 1465  
1476 1466                  if ((newi = tf_idata_new(mp, 0, ntn)) == NULL)
1477 1467                          goto facdone;
↓ open down ↓ 670 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX