395 return (-1); /* errno is set for us */
396
397 if (stp->smbst_hdr->smbh_type != SMB_TYPE_BASEBOARD)
398 return (smb_set_errno(shp, ESMB_TYPE));
399
400 smb_info_bcopy(stp->smbst_hdr, &bb, sizeof (bb));
401 bzero(bbp, sizeof (smbios_bboard_t));
402
403 bbp->smbb_chassis = bb.smbbb_chassis;
404 bbp->smbb_flags = bb.smbbb_flags;
405 bbp->smbb_type = bb.smbbb_type;
406 bbp->smbb_contn = bb.smbbb_cn;
407
408 return (0);
409 }
410
411 int
412 smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp)
413 {
414 const smb_struct_t *stp = smb_lookup_id(shp, id);
415 smb_chassis_t ch;
416
417 if (stp == NULL)
418 return (-1); /* errno is set for us */
419
420 if (stp->smbst_hdr->smbh_type != SMB_TYPE_CHASSIS)
421 return (smb_set_errno(shp, ESMB_TYPE));
422
423 smb_info_bcopy(stp->smbst_hdr, &ch, sizeof (ch));
424 bzero(chp, sizeof (smbios_chassis_t));
425
426 chp->smbc_oemdata = ch.smbch_oemdata;
427 chp->smbc_lock = (ch.smbch_type & SMB_CHT_LOCK) != 0;
428 chp->smbc_type = ch.smbch_type & ~SMB_CHT_LOCK;
429 chp->smbc_bustate = ch.smbch_bustate;
430 chp->smbc_psstate = ch.smbch_psstate;
431 chp->smbc_thstate = ch.smbch_thstate;
432 chp->smbc_security = ch.smbch_security;
433 chp->smbc_uheight = ch.smbch_uheight;
434 chp->smbc_cords = ch.smbch_cords;
435 chp->smbc_elems = ch.smbch_cn;
436 chp->smbc_elemlen = ch.smbch_cm;
437
438 if (shp->sh_smbvers >= SMB_VERSION_27)
439 chp->smbc_sku = smb_strptr(stp, ch.smbch_sku);
440
441 return (0);
442 }
443
444 int
445 smbios_info_processor(smbios_hdl_t *shp, id_t id, smbios_processor_t *pp)
446 {
447 const smb_struct_t *stp = smb_lookup_id(shp, id);
448 smb_processor_t p;
449
450 if (stp == NULL)
451 return (-1); /* errno is set for us */
452
453 if (stp->smbst_hdr->smbh_type != SMB_TYPE_PROCESSOR)
454 return (smb_set_errno(shp, ESMB_TYPE));
455
456 smb_info_bcopy(stp->smbst_hdr, &p, sizeof (p));
457 bzero(pp, sizeof (smbios_processor_t));
458
459 pp->smbp_cpuid = p.smbpr_cpuid;
|
395 return (-1); /* errno is set for us */
396
397 if (stp->smbst_hdr->smbh_type != SMB_TYPE_BASEBOARD)
398 return (smb_set_errno(shp, ESMB_TYPE));
399
400 smb_info_bcopy(stp->smbst_hdr, &bb, sizeof (bb));
401 bzero(bbp, sizeof (smbios_bboard_t));
402
403 bbp->smbb_chassis = bb.smbbb_chassis;
404 bbp->smbb_flags = bb.smbbb_flags;
405 bbp->smbb_type = bb.smbbb_type;
406 bbp->smbb_contn = bb.smbbb_cn;
407
408 return (0);
409 }
410
411 int
412 smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp)
413 {
414 const smb_struct_t *stp = smb_lookup_id(shp, id);
415 /* Length is measurable by one byte, so it'll be no more than 255. */
416 uint8_t buf[256]
417 smb_chassis_t *ch = (smb_chassis_t *)&(buf[0]);
418
419 if (stp == NULL)
420 return (-1); /* errno is set for us */
421
422 if (stp->smbst_hdr->smbh_type != SMB_TYPE_CHASSIS)
423 return (smb_set_errno(shp, ESMB_TYPE));
424
425 smb_info_bcopy(stp->smbst_hdr, ch, sizeof (buf));
426 bzero(chp, sizeof (smbios_chassis_t));
427
428 chp->smbc_oemdata = ch->smbch_oemdata;
429 chp->smbc_lock = (ch->smbch_type & SMB_CHT_LOCK) != 0;
430 chp->smbc_type = ch->smbch_type & ~SMB_CHT_LOCK;
431 chp->smbc_bustate = ch->smbch_bustate;
432 chp->smbc_psstate = ch->smbch_psstate;
433 chp->smbc_thstate = ch->smbch_thstate;
434 chp->smbc_security = ch->smbch_security;
435 chp->smbc_uheight = ch->smbch_uheight;
436 chp->smbc_cords = ch->smbch_cords;
437 chp->smbc_elems = ch->smbch_cn;
438 chp->smbc_elemlen = ch->smbch_cm;
439
440 if (shp->sh_smbvers >= SMB_VERSION_27) {
441 (void) strlcpy(chp->smbc_sku, SMB_CH_SKU(ch),
442 sizeof (chp->smbc_sku));
443 }
444
445 return (0);
446 }
447
448 int
449 smbios_info_processor(smbios_hdl_t *shp, id_t id, smbios_processor_t *pp)
450 {
451 const smb_struct_t *stp = smb_lookup_id(shp, id);
452 smb_processor_t p;
453
454 if (stp == NULL)
455 return (-1); /* errno is set for us */
456
457 if (stp->smbst_hdr->smbh_type != SMB_TYPE_PROCESSOR)
458 return (smb_set_errno(shp, ESMB_TYPE));
459
460 smb_info_bcopy(stp->smbst_hdr, &p, sizeof (p));
461 bzero(pp, sizeof (smbios_processor_t));
462
463 pp->smbp_cpuid = p.smbpr_cpuid;
|