Print this page
5218 posix definition of NULL
correct unistd.h and iso/stddef_iso.h
update gate source affected


 412                             maxranks) < 0) {
 413                                 return (-1);
 414                         }
 415                         channel++;
 416                 }
 417                 for (nvp = nvlist_next_nvpair(nvl, NULL); nvp != NULL;
 418                     nvp = nvlist_next_nvpair(nvl, nvp)) {
 419                         pname = nvpair_name(nvp);
 420                         if (strcmp(pname, MCINTEL_NVLIST_MC) != 0 &&
 421                             strcmp(pname, MCINTEL_NVLIST_NMEM) != 0 &&
 422                             strcmp(pname, MCINTEL_NVLIST_NRANKS) != 0 &&
 423                             strcmp(pname, MCINTEL_NVLIST_NDIMMS) != 0 &&
 424                             strcmp(pname, MCINTEL_NVLIST_VERSTR) != 0 &&
 425                             strcmp(pname, MCINTEL_NVLIST_MEM) != 0) {
 426                                 (void) nvprop_add(mod, nvp, PGNAME(MCT),
 427                                     mcnode);
 428                         }
 429                 }
 430         }
 431 
 432         return (NULL);
 433 }
 434 
 435 int
 436 mc_node_create(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode,
 437     const char *name, nvlist_t *auth)
 438 {
 439         mc_snapshot_info_t mcs;
 440         void *buf = NULL;
 441         nvlist_t *nvl;
 442         uint8_t ver;
 443         int rc;
 444 
 445         if (ioctl(mc_fd, MC_IOC_SNAPSHOT_INFO, &mcs) == -1 ||
 446             (buf = topo_mod_alloc(mod, mcs.mcs_size)) == NULL ||
 447             ioctl(mc_fd, MC_IOC_SNAPSHOT, buf) == -1) {
 448 
 449                 whinge(mod, NULL, "mc failed to snapshot %s\n",
 450                     strerror(errno));
 451 
 452                 free(buf);
 453                 (void) close(mc_fd);
 454                 return (NULL);
 455         }
 456         (void) close(mc_fd);
 457         (void) nvlist_unpack(buf, mcs.mcs_size, &nvl, 0);
 458         topo_mod_free(mod, buf, mcs.mcs_size);
 459 
 460         if (nvlist_lookup_uint8(nvl, MCINTEL_NVLIST_VERSTR, &ver) != 0) {
 461                 whinge(mod, NULL, "mc nvlist is not versioned\n");
 462                 nvlist_free(nvl);
 463                 return (NULL);
 464         } else if (ver != MCINTEL_NVLIST_VERS0) {
 465                 whinge(mod, NULL, "mc nvlist version mismatch\n");
 466                 nvlist_free(nvl);
 467                 return (NULL);
 468         }
 469 
 470         rc = mc_nb_create(mod, chip_smbid, pnode, name, auth, nvl);
 471 
 472         nvlist_free(nvl);
 473         return (rc);
 474 }
 475 
 476 void
 477 onchip_mc_create(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode,
 478     const char *name, nvlist_t *auth)
 479 {
 480         if (mc_onchip(topo_node_instance(pnode)))
 481                 (void) mc_node_create(mod, chip_smbid, pnode, name, auth);
 482 }
 483 
 484 int
 485 mc_offchip_create(topo_mod_t *mod, tnode_t *pnode, const char *name,
 486     nvlist_t *auth)
 487 {


 412                             maxranks) < 0) {
 413                                 return (-1);
 414                         }
 415                         channel++;
 416                 }
 417                 for (nvp = nvlist_next_nvpair(nvl, NULL); nvp != NULL;
 418                     nvp = nvlist_next_nvpair(nvl, nvp)) {
 419                         pname = nvpair_name(nvp);
 420                         if (strcmp(pname, MCINTEL_NVLIST_MC) != 0 &&
 421                             strcmp(pname, MCINTEL_NVLIST_NMEM) != 0 &&
 422                             strcmp(pname, MCINTEL_NVLIST_NRANKS) != 0 &&
 423                             strcmp(pname, MCINTEL_NVLIST_NDIMMS) != 0 &&
 424                             strcmp(pname, MCINTEL_NVLIST_VERSTR) != 0 &&
 425                             strcmp(pname, MCINTEL_NVLIST_MEM) != 0) {
 426                                 (void) nvprop_add(mod, nvp, PGNAME(MCT),
 427                                     mcnode);
 428                         }
 429                 }
 430         }
 431 
 432         return (0);
 433 }
 434 
 435 int
 436 mc_node_create(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode,
 437     const char *name, nvlist_t *auth)
 438 {
 439         mc_snapshot_info_t mcs;
 440         void *buf = NULL;
 441         nvlist_t *nvl;
 442         uint8_t ver;
 443         int rc;
 444 
 445         if (ioctl(mc_fd, MC_IOC_SNAPSHOT_INFO, &mcs) == -1 ||
 446             (buf = topo_mod_alloc(mod, mcs.mcs_size)) == NULL ||
 447             ioctl(mc_fd, MC_IOC_SNAPSHOT, buf) == -1) {
 448 
 449                 whinge(mod, NULL, "mc failed to snapshot %s\n",
 450                     strerror(errno));
 451 
 452                 free(buf);
 453                 (void) close(mc_fd);
 454                 return (0);
 455         }
 456         (void) close(mc_fd);
 457         (void) nvlist_unpack(buf, mcs.mcs_size, &nvl, 0);
 458         topo_mod_free(mod, buf, mcs.mcs_size);
 459 
 460         if (nvlist_lookup_uint8(nvl, MCINTEL_NVLIST_VERSTR, &ver) != 0) {
 461                 whinge(mod, NULL, "mc nvlist is not versioned\n");
 462                 nvlist_free(nvl);
 463                 return (0);
 464         } else if (ver != MCINTEL_NVLIST_VERS0) {
 465                 whinge(mod, NULL, "mc nvlist version mismatch\n");
 466                 nvlist_free(nvl);
 467                 return (0);
 468         }
 469 
 470         rc = mc_nb_create(mod, chip_smbid, pnode, name, auth, nvl);
 471 
 472         nvlist_free(nvl);
 473         return (rc);
 474 }
 475 
 476 void
 477 onchip_mc_create(topo_mod_t *mod, uint16_t chip_smbid, tnode_t *pnode,
 478     const char *name, nvlist_t *auth)
 479 {
 480         if (mc_onchip(topo_node_instance(pnode)))
 481                 (void) mc_node_create(mod, chip_smbid, pnode, name, auth);
 482 }
 483 
 484 int
 485 mc_offchip_create(topo_mod_t *mod, tnode_t *pnode, const char *name,
 486     nvlist_t *auth)
 487 {