465 (void) strcpy(asru.serial, sn);
466 asru.type = FINDASRU;
467 return (gmem_find_dimm_by_sn(hdl, &asru));
468 }
469
470 int
471 gmem_dimm_present(fmd_hdl_t *hdl, nvlist_t *asru)
472 {
473 char *sn;
474 nvlist_t *dimm = NULL;
475
476 if (nvlist_lookup_string(asru, FM_FMRI_HC_SERIAL_ID, &sn) != 0) {
477 fmd_hdl_debug(hdl, "Unable to get dimm serial\n");
478 return (0);
479 }
480 dimm = gmem_find_dimm_fru(hdl, sn);
481 if (dimm == NULL) {
482 fmd_hdl_debug(hdl, "Dimm sn=%s is not present\n", sn);
483 return (0);
484 }
485 if (dimm != NULL)
486 nvlist_free(dimm);
487 return (1);
488 }
489
490 static int
491 gmem_find_dimm_chip(nvlist_t *nvl, uint32_t *chip)
492 {
493
494 char *name, *id, *end;
495 nvlist_t **hcl;
496 uint_t n;
497 int i;
498 int rc = 0;
499 *chip = ULONG_MAX;
500
501 if (nvlist_lookup_nvlist_array(nvl, FM_FMRI_HC_LIST, &hcl, &n) < 0)
502 return (0);
503 for (i = 0; i < n; i++) {
504 (void) nvlist_lookup_string(hcl[i], FM_FMRI_HC_NAME, &name);
505 (void) nvlist_lookup_string(hcl[i], FM_FMRI_HC_ID, &id);
|
465 (void) strcpy(asru.serial, sn);
466 asru.type = FINDASRU;
467 return (gmem_find_dimm_by_sn(hdl, &asru));
468 }
469
470 int
471 gmem_dimm_present(fmd_hdl_t *hdl, nvlist_t *asru)
472 {
473 char *sn;
474 nvlist_t *dimm = NULL;
475
476 if (nvlist_lookup_string(asru, FM_FMRI_HC_SERIAL_ID, &sn) != 0) {
477 fmd_hdl_debug(hdl, "Unable to get dimm serial\n");
478 return (0);
479 }
480 dimm = gmem_find_dimm_fru(hdl, sn);
481 if (dimm == NULL) {
482 fmd_hdl_debug(hdl, "Dimm sn=%s is not present\n", sn);
483 return (0);
484 }
485 nvlist_free(dimm);
486 return (1);
487 }
488
489 static int
490 gmem_find_dimm_chip(nvlist_t *nvl, uint32_t *chip)
491 {
492
493 char *name, *id, *end;
494 nvlist_t **hcl;
495 uint_t n;
496 int i;
497 int rc = 0;
498 *chip = ULONG_MAX;
499
500 if (nvlist_lookup_nvlist_array(nvl, FM_FMRI_HC_LIST, &hcl, &n) < 0)
501 return (0);
502 for (i = 0; i < n; i++) {
503 (void) nvlist_lookup_string(hcl[i], FM_FMRI_HC_NAME, &name);
504 (void) nvlist_lookup_string(hcl[i], FM_FMRI_HC_ID, &id);
|