summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/fm/libldom/sparc/ldmsvcs_utils.c18
-rw-r--r--usr/src/lib/fm/topo/modules/sun4v/chip/chip_sun4v.c54
-rw-r--r--usr/src/lib/fm/topo/modules/sun4v/platform-cpu/cpu.c48
3 files changed, 62 insertions, 58 deletions
diff --git a/usr/src/lib/fm/libldom/sparc/ldmsvcs_utils.c b/usr/src/lib/fm/libldom/sparc/ldmsvcs_utils.c
index e046f058b9..915c055ade 100644
--- a/usr/src/lib/fm/libldom/sparc/ldmsvcs_utils.c
+++ b/usr/src/lib/fm/libldom/sparc/ldmsvcs_utils.c
@@ -1401,24 +1401,24 @@ mem_request(struct ldom_hdl *lhp, uint32_t msg_type, uint64_t pa,
if (msg_type == FMA_MEM_REQ_STATUS) {
if (respmsg->result == FMA_MEM_RESP_OK) {
if (respmsg->status == FMA_MEM_STAT_RETIRED)
- rc = 0;
+ rc = 0; /* page is retired */
else if (respmsg->status == FMA_MEM_STAT_NOTRETIRED)
- rc = EIO;
- else if (respmsg->status == 0x3) /* pending */
- rc = EAGAIN;
+ rc = EIO; /* page is not scheduled */
} else if (respmsg->result == FMA_MEM_RESP_FAILURE) {
- if (respmsg->status == FMA_MEM_STAT_ILLEGAL)
+ if (respmsg->status == FMA_MEM_STAT_NOTRETIRED)
+ rc = EAGAIN; /* page is scheduled */
+ else if (respmsg->status == FMA_MEM_STAT_ILLEGAL)
rc = EINVAL;
}
} else if (msg_type == FMA_MEM_REQ_RETIRE) {
if (respmsg->result == FMA_MEM_RESP_OK) {
if (respmsg->status == FMA_MEM_STAT_RETIRED)
- rc = 0;
+ rc = 0; /* is successfully retired */
} else if (respmsg->result == FMA_MEM_RESP_FAILURE) {
if (respmsg->status == FMA_MEM_STAT_RETIRED)
- rc = EIO;
- else if (respmsg->status == 0x3) /* pending */
- rc = EAGAIN;
+ rc = EIO; /* is already retired */
+ else if (respmsg->status == FMA_MEM_STAT_NOTRETIRED)
+ rc = EAGAIN; /* is scheduled to retire */
else if (respmsg->status == FMA_MEM_STAT_ILLEGAL)
rc = EINVAL;
}
diff --git a/usr/src/lib/fm/topo/modules/sun4v/chip/chip_sun4v.c b/usr/src/lib/fm/topo/modules/sun4v/chip/chip_sun4v.c
index ae1db76895..ab50a9211b 100644
--- a/usr/src/lib/fm/topo/modules/sun4v/chip/chip_sun4v.c
+++ b/usr/src/lib/fm/topo/modules/sun4v/chip/chip_sun4v.c
@@ -131,21 +131,21 @@ chip_tnode_create(topo_mod_t *mod, tnode_t *parent,
if (topo_mod_nvalloc(mod, &auth, NV_UNIQUE_NAME) == 0) {
if (topo_prop_get_string(parent, FM_FMRI_AUTHORITY,
- FM_FMRI_AUTH_PRODUCT, &prod, &err) == 0) {
+ FM_FMRI_AUTH_PRODUCT, &prod, &err) == 0) {
(void) nvlist_add_string(auth, FM_FMRI_AUTH_PRODUCT,
- prod);
+ prod);
topo_mod_strfree(mod, prod);
}
if (topo_prop_get_string(parent, FM_FMRI_AUTHORITY,
- FM_FMRI_AUTH_SERVER, &server, &err) == 0) {
+ FM_FMRI_AUTH_SERVER, &server, &err) == 0) {
(void) nvlist_add_string(auth, FM_FMRI_AUTH_SERVER,
- server);
+ server);
topo_mod_strfree(mod, server);
}
if (topo_prop_get_string(parent, FM_FMRI_AUTHORITY,
- FM_FMRI_AUTH_CHASSIS, &csn, &err) == 0) {
+ FM_FMRI_AUTH_CHASSIS, &csn, &err) == 0) {
(void) nvlist_add_string(auth, FM_FMRI_AUTH_CHASSIS,
- csn);
+ csn);
topo_mod_strfree(mod, csn);
}
}
@@ -246,10 +246,9 @@ cpu_create(topo_mod_t *mod, tnode_t *rnode, const char *name, md_info_t *chip,
}
if (min < 0 || max < 0)
return (-1);
- topo_node_range_destroy(rnode, name);
if (topo_node_range_create(mod, rnode, name, 0, max+1) < 0) {
topo_mod_dprintf(mod, "failed to create cpu range[0,%d]: %s\n",
- max, topo_mod_errmsg(mod));
+ max, topo_mod_errmsg(mod));
return (-1);
}
@@ -267,12 +266,11 @@ cpu_create(topo_mod_t *mod, tnode_t *rnode, const char *name, md_info_t *chip,
/* physical cpuid */
pid = mcmp->cpumap_pid;
cnode = chip_tnode_create(mod, rnode, name,
- (topo_instance_t)pid, sbuf,
- NULL, NULL, NULL);
+ (topo_instance_t)pid, sbuf, NULL, NULL, NULL);
if (cnode == NULL) {
topo_mod_dprintf(mod,
- "failed to create a cpu=%d node: %s\n",
- pid, topo_mod_errmsg(mod));
+ "failed to create a cpu=%d node: %s\n",
+ pid, topo_mod_errmsg(mod));
nerr++;
continue;
}
@@ -307,37 +305,35 @@ chip_create(topo_mod_t *mod, tnode_t *rnode, const char *name,
topo_mod_dprintf(mod, "enumerating cmp chip\n");
- /* Create the range of chip nodes */
- for (chipidx = 0, procp = chip->procs; chipidx < chip->nprocs &&
- procp->serialno != 0; chipidx++, procp++);
- topo_node_range_destroy(rnode, name);
- if (topo_node_range_create(mod, rnode, name, 0, chipidx+1) < 0) {
- topo_mod_dprintf(mod, "failed to create chip range[0,%d]: %s\n",
- chipidx, topo_mod_errmsg(mod));
- return (-1);
- }
-
/*
* Create the chip[i] nodes, one for each CMP chip uniquely identified
* by the serial number.
*/
for (chipidx = 0, procp = chip->procs; chipidx < chip->nprocs;
- chipidx++, procp++) {
+ chipidx++, procp++) {
if (procp->serialno == 0) {
continue;
}
- (void) snprintf(sbuf, sizeof (sbuf), "%llx",
- procp->serialno);
+ if (chipidx > max) {
+ /*
+ * Step out the allocated range (min, max) specified in
+ * the xml file. End enumerating the chips
+ */
+ topo_mod_dprintf(mod,
+ "chip[%d] is out of the allocated range (%d, %d)\n",
+ chipidx, min, max);
+ break;
+ }
- topo_mod_dprintf(mod, "enumerating chip [%s]\n", sbuf);
+ (void) snprintf(sbuf, sizeof (sbuf), "%llx", procp->serialno);
+ topo_mod_dprintf(mod, "node chip[%d], sn=%s\n", chipidx, sbuf);
cnode = chip_tnode_create(mod, rnode, name,
- (topo_instance_t)chipidx, sbuf,
- fru, label, NULL);
+ (topo_instance_t)chipidx, sbuf, fru, label, NULL);
if (cnode == NULL) {
topo_mod_dprintf(mod, "failed to create a chip node: "
- "%s\n", topo_mod_errmsg(mod));
+ "%s\n", topo_mod_errmsg(mod));
nerr++;
continue;
}
diff --git a/usr/src/lib/fm/topo/modules/sun4v/platform-cpu/cpu.c b/usr/src/lib/fm/topo/modules/sun4v/platform-cpu/cpu.c
index df7e3bb2be..cf7466a6e5 100644
--- a/usr/src/lib/fm/topo/modules/sun4v/platform-cpu/cpu.c
+++ b/usr/src/lib/fm/topo/modules/sun4v/platform-cpu/cpu.c
@@ -93,7 +93,7 @@ _topo_init(topo_mod_t *mod)
if (getenv("TOPOPLATFORMCPUDBG"))
topo_mod_setdebug(mod);
topo_mod_dprintf(mod, "initializing %s enumerator\n",
- PLATFORM_CPU_NAME);
+ PLATFORM_CPU_NAME);
if ((chip = topo_mod_zalloc(mod, sizeof (md_info_t))) == NULL)
return (-1);
@@ -108,7 +108,7 @@ _topo_init(topo_mod_t *mod)
if (topo_mod_register(mod, &cpu_info, TOPO_VERSION) != 0) {
topo_mod_dprintf(mod, "failed to register %s: %s\n",
- PLATFORM_CPU_NAME, topo_mod_errmsg(mod));
+ PLATFORM_CPU_NAME, topo_mod_errmsg(mod));
cpu_mdesc_fini(mod, chip);
topo_mod_free(mod, chip, sizeof (md_info_t));
return (-1);
@@ -147,18 +147,26 @@ cpu_present(topo_mod_t *mod, tnode_t *node, topo_version_t vers,
md_info_t *chip = (md_info_t *)topo_mod_getspecific(mod);
/*
- * Support only cpu scheme version 0
+ * Get the physical cpuid
*/
if (nvlist_lookup_uint8(in, FM_VERSION, &version) != 0 ||
- version > CPU_SCHEME_VERSION0 ||
- nvlist_lookup_uint32(in, FM_FMRI_CPU_ID, &cpuid) != 0 ||
- nvlist_lookup_uint64(in, FM_FMRI_CPU_SERIAL_ID, &nvlserid) != 0) {
+ version > FM_CPU_SCHEME_VERSION ||
+ nvlist_lookup_uint32(in, FM_FMRI_CPU_ID, &cpuid) != 0) {
return (topo_mod_seterrno(mod, EMOD_NVL_INVAL));
}
- /* Find the cpuid entry */
+ /*
+ * Find the cpuid entry
+ * If the input nvl contains a serial number, the cpu is identified
+ * by a tuple <cpuid, cpuserial>
+ * Otherwise, the cpu is identified by the <cpuid>.
+ */
if ((mcmp = cpu_find_cpumap(chip, cpuid)) != NULL) {
- present = nvlserid == mcmp->cpumap_serialno;
+ if (nvlist_lookup_uint64(in, FM_FMRI_CPU_SERIAL_ID, &nvlserid) \
+ == 0)
+ present = nvlserid == mcmp->cpumap_serialno;
+ else
+ present = 1;
}
/* return the present status */
@@ -216,22 +224,22 @@ cpu_expand(topo_mod_t *mod, tnode_t *node, topo_version_t vers,
/* part number + dash number */
len = (frup->part ? strlen(frup->part) : 0) +
- (frup->dash ? strlen(frup->dash) : 0) + 1;
+ (frup->dash ? strlen(frup->dash) : 0) + 1;
str = cpu_alloc(len);
(void) snprintf(str, len, "%s%s",
- frup->part ? frup->part : MD_STR_BLANK,
- frup->dash ? frup->dash : MD_STR_BLANK);
+ frup->part ? frup->part : MD_STR_BLANK,
+ frup->dash ? frup->dash : MD_STR_BLANK);
(void) nvlist_add_string(in, FM_FMRI_HC_PART, str);
cpu_free(str, len);
/* fru name */
(void) nvlist_add_string(in, FM_FMRI_CPU_CPUFRU,
- frup->nac ? frup->nac : MD_STR_BLANK);
+ frup->nac ? frup->nac : MD_STR_BLANK);
/* fru serial */
in->nvl_nvflag = NV_UNIQUE_NAME_TYPE;
(void) nvlist_add_string(in, FM_FMRI_HC_SERIAL_ID,
- frup->serial ? frup->serial : MD_STR_BLANK);
+ frup->serial ? frup->serial : MD_STR_BLANK);
}
return (0);
@@ -260,7 +268,7 @@ cpu_unusable(topo_mod_t *mod, tnode_t *node, topo_version_t vers,
}
status = ldom_fmri_status(lhp, in);
rc = (status == P_FAULTED ||
- (status == P_OFFLINE && ldom_major_version(lhp) == 1));
+ (status == P_OFFLINE && ldom_major_version(lhp) == 1));
ldom_fini(lhp);
/* return the unusable status */
@@ -358,7 +366,7 @@ cpu_create(topo_mod_t *mod, tnode_t *rnode, const char *name, md_info_t *chip)
topo_node_range_destroy(rnode, name);
if (topo_node_range_create(mod, rnode, name, 0, max+1) < 0) {
topo_mod_dprintf(mod, "failed to create cpu range[0,%d]: %s\n",
- max, topo_mod_errmsg(mod));
+ max, topo_mod_errmsg(mod));
return (-1);
}
@@ -368,16 +376,16 @@ cpu_create(topo_mod_t *mod, tnode_t *rnode, const char *name, md_info_t *chip)
for (i = 0; i < chip->ncpus; i++) {
(void) snprintf(sbuf, sizeof (sbuf), "%llx",
- chip->cpus[i].cpumap_serialno);
+ chip->cpus[i].cpumap_serialno);
/* physical cpuid */
pid = chip->cpus[i].cpumap_pid;
cnode = cpu_tnode_create(mod, rnode, name,
- (topo_instance_t)pid, sbuf, NULL);
+ (topo_instance_t)pid, sbuf, NULL);
if (cnode == NULL) {
topo_mod_dprintf(mod,
- "failed to create a cpu=%d node: %s\n",
- pid, topo_mod_errmsg(mod));
+ "failed to create a cpu=%d node: %s\n",
+ pid, topo_mod_errmsg(mod));
nerr++;
continue;
}
@@ -399,7 +407,7 @@ cpu_enum(topo_mod_t *mod, tnode_t *rnode, const char *name,
if (topo_method_register(mod, rnode, cpu_methods) < 0) {
topo_mod_dprintf(mod, "topo_method_register failed: %s\n",
- topo_strerror(topo_mod_errno(mod)));
+ topo_strerror(topo_mod_errno(mod)));
return (-1);
}