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 |
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; |
486 const char *vendor; 487 char *brand, *socket; |
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 /* |
554 * Attempt to lookup the processor brand and socket string in 555 * kstats and add it as a prop, if found. |
556 */ |
557 brand = socket = NULL; 558 get_chip_kstat_strs(mod, kc, chipid, &brand, &socket); |
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 } |
564 topo_mod_strfree(mod, brand); |
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 |
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 --- |