chip.c (f2dbfd32) | chip.c (d0caeb89) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 9 unchanged lines hidden (view full) --- 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * Copyright 2019, Joyent, Inc. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 9 unchanged lines hidden (view full) --- 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * Copyright 2019, Joyent, Inc. |
26 * Copyright 2020 Oxide Computer Company |
|
26 */ 27 28#include <unistd.h> 29#include <fcntl.h> 30#include <stdio.h> 31#include <stdlib.h> 32#include <stdarg.h> 33#include <string.h> --- 443 unchanged lines hidden (view full) --- 477create_chip(topo_mod_t *mod, tnode_t *pnode, topo_instance_t min, 478 topo_instance_t max, nvlist_t *cpu, nvlist_t *auth, 479 int mc_offchip, kstat_ctl_t *kc) 480{ 481 tnode_t *chip; 482 nvlist_t *fmri = NULL; 483 int err, perr, nerr = 0; 484 int32_t chipid, procnodeid, procnodes_per_pkg; | 27 */ 28 29#include <unistd.h> 30#include <fcntl.h> 31#include <stdio.h> 32#include <stdlib.h> 33#include <stdarg.h> 34#include <string.h> --- 443 unchanged lines hidden (view full) --- 478create_chip(topo_mod_t *mod, tnode_t *pnode, topo_instance_t min, 479 topo_instance_t max, nvlist_t *cpu, nvlist_t *auth, 480 int mc_offchip, kstat_ctl_t *kc) 481{ 482 tnode_t *chip; 483 nvlist_t *fmri = NULL; 484 int err, perr, nerr = 0; 485 int32_t chipid, procnodeid, procnodes_per_pkg; |
485 const char *vendor, *brand; | 486 const char *vendor; 487 char *brand, *socket; |
486 int32_t family, model; 487 boolean_t create_mc = B_FALSE; 488 uint16_t smbios_id; 489 490 /* 491 * /dev/fm will export the chipid based on SMBIOS' ordering 492 * of Type-4 structures, if SMBIOS meets FMA needs 493 */ --- 50 unchanged lines hidden (view full) --- 544 545 (void) topo_pgroup_create(chip, &chip_pgroup, &err); 546 nerr -= add_nvlist_strprop(mod, chip, cpu, PGNAME(CHIP), 547 CHIP_VENDOR_ID, NULL); 548 nerr -= add_nvlist_longprops(mod, chip, cpu, PGNAME(CHIP), 549 NULL, CHIP_FAMILY, CHIP_MODEL, CHIP_STEPPING, NULL); 550 551 /* | 488 int32_t family, model; 489 boolean_t create_mc = B_FALSE; 490 uint16_t smbios_id; 491 492 /* 493 * /dev/fm will export the chipid based on SMBIOS' ordering 494 * of Type-4 structures, if SMBIOS meets FMA needs 495 */ --- 50 unchanged lines hidden (view full) --- 546 547 (void) topo_pgroup_create(chip, &chip_pgroup, &err); 548 nerr -= add_nvlist_strprop(mod, chip, cpu, PGNAME(CHIP), 549 CHIP_VENDOR_ID, NULL); 550 nerr -= add_nvlist_longprops(mod, chip, cpu, PGNAME(CHIP), 551 NULL, CHIP_FAMILY, CHIP_MODEL, CHIP_STEPPING, NULL); 552 553 /* |
552 * Attempt to lookup the processor brand string in kstats. 553 * and add it as a prop, if found. | 554 * Attempt to lookup the processor brand and socket string in 555 * kstats and add it as a prop, if found. |
554 */ | 556 */ |
555 brand = get_chip_brand(mod, kc, chipid); | 557 brand = socket = NULL; 558 get_chip_kstat_strs(mod, kc, chipid, &brand, &socket); |
556 if (brand != NULL && topo_prop_set_string(chip, PGNAME(CHIP), 557 CHIP_BRAND, TOPO_PROP_IMMUTABLE, brand, &perr) != 0) { 558 whinge(mod, &nerr, "failed to set prop %s/%s", 559 PGNAME(CHIP), CHIP_BRAND); 560 } | 559 if (brand != NULL && topo_prop_set_string(chip, PGNAME(CHIP), 560 CHIP_BRAND, TOPO_PROP_IMMUTABLE, brand, &perr) != 0) { 561 whinge(mod, &nerr, "failed to set prop %s/%s", 562 PGNAME(CHIP), CHIP_BRAND); 563 } |
561 topo_mod_strfree(mod, (char *)brand); | 564 topo_mod_strfree(mod, brand); |
562 | 565 |
566 if (socket != NULL && topo_prop_set_string(chip, PGNAME(CHIP), 567 CHIP_SOCKET, TOPO_PROP_IMMUTABLE, socket, &perr) != 0) { 568 whinge(mod, &nerr, "failed to set prop %s/%s", 569 PGNAME(CHIP), CHIP_SOCKET); 570 } 571 topo_mod_strfree(mod, socket); 572 |
|
563 if (FM_AWARE_SMBIOS(mod)) { 564 int fru = 0; 565 char *serial = NULL; 566 char *part = NULL; 567 char *rev = NULL; 568 char *label; 569 570 fru = chip_fru_smbios_get(mod, smbios_id); --- 250 unchanged lines hidden --- | 573 if (FM_AWARE_SMBIOS(mod)) { 574 int fru = 0; 575 char *serial = NULL; 576 char *part = NULL; 577 char *rev = NULL; 578 char *label; 579 580 fru = chip_fru_smbios_get(mod, smbios_id); --- 250 unchanged lines hidden --- |