summaryrefslogtreecommitdiff
path: root/usr/src/tools/cpcgen/cpcgen.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-04-08 11:41:12 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-04-08 11:41:12 +0000
commit6b564a7014af2d4d9f000ed39a4fed77fd5245e0 (patch)
tree3805c7d1cab7ee8faf746ed3a1f0d1a448d4a8da /usr/src/tools/cpcgen/cpcgen.c
parent4fc8237742a380d4833394892fb148e1a34acb28 (diff)
parent62366fbbe8edca853fee6c14327d822239ba914f (diff)
downloadillumos-joyent-6b564a7014af2d4d9f000ed39a4fed77fd5245e0.tar.gz
[illumos-gate merge]release-20200409
commit 62366fbbe8edca853fee6c14327d822239ba914f 12466 Enable IPv6 TSO Support for vioif commit d240edaf609c558d5a1f981b09a577823b54fae2 12465 vioif needs length for tso checksum commit 425251fd07ab465313fb50dea0f1ac795be10e05 9059 Simplify SMAP relocations with krtld commit 28e0ac9c914344194ef919b0271895d33f83d396 12433 efcode: NULL pointer errors commit 31aa620247ae407b2bee2dccd71693d1938f54d6 12452 Want support for AMD Zen 2 CPC Events Conflicts: usr/src/uts/i86pc/os/machdep.c usr/src/uts/common/io/dld/dld_proto.c usr/src/uts/common/inet/ip/ip_if.c
Diffstat (limited to 'usr/src/tools/cpcgen/cpcgen.c')
-rw-r--r--usr/src/tools/cpcgen/cpcgen.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/usr/src/tools/cpcgen/cpcgen.c b/usr/src/tools/cpcgen/cpcgen.c
index 43bc016a70..4934fda015 100644
--- a/usr/src/tools/cpcgen/cpcgen.c
+++ b/usr/src/tools/cpcgen/cpcgen.c
@@ -332,11 +332,11 @@ static const char *cpcgen_manual_amd_header = ""
".Os\n"
".Sh NAME\n"
".Nm amd_%s_events\n"
-".Nd AMD family %s processor performance monitoring events\n"
+".Nd AMD Family %s processor performance monitoring events\n"
".Sh DESCRIPTION\n"
-"This manual page describes events specfic to AMD family %s processors.\n"
+"This manual page describes events specfic to AMD Family %s processors.\n"
"For more information, please consult the appropriate AMD BIOS and Kernel\n"
-"Developer's guide or Open-Source Register Reference manual.\n"
+"Developer's guide or Open-Source Register Reference.\n"
".Pp\n"
"Each of the events listed below includes the AMD mnemonic which matches\n"
"the name found in the AMD manual and a brief summary of the event.\n"
@@ -630,7 +630,7 @@ cpcgen_determine_vendor(const char *datadir)
* Read in all the data files that exist for AMD.
*
* Our family names for AMD systems are based on the family and type so a given
- * name will look like f17h_core.json.
+ * name will look like f17h_<core>_core.json.
*/
static void
cpcgen_read_amd(const char *datadir, const char *platform)
@@ -660,16 +660,26 @@ cpcgen_read_amd(const char *datadir, const char *platform)
continue;
}
+ /*
+ * Chop off the .json. Next, make sure we have both _ present.
+ */
if (*(c + slen) != '\0') {
free(name);
continue;
}
-
*c = '\0';
+
c = strchr(name, '_');
if (c == NULL) {
- free(name);
- continue;
+ errx(EXIT_FAILURE, "unexpected AMD JSON file name: %s",
+ d->d_name);
+ }
+
+ c++;
+ c = strchr(c, '_');
+ if (c == NULL) {
+ errx(EXIT_FAILURE, "unexpected AMD JSON file name: %s",
+ d->d_name);
}
*c = '\0';
c++;
@@ -1408,29 +1418,42 @@ static boolean_t
cpcgen_manual_amd_file_before(FILE *f, cpc_map_t *map)
{
size_t i;
- char *upper;
- const char *family;
+ char *upper, *desc, *c;
if ((upper = strdup(map->cmap_name)) == NULL) {
warn("failed to duplicate manual name for %s", map->cmap_name);
return (B_FALSE);
}
+ if ((desc = strdup(map->cmap_name)) == NULL) {
+ warn("failed to duplicate manual name for %s", map->cmap_name);
+ free(upper);
+ return (B_FALSE);
+ }
+
for (i = 0; upper[i] != '\0'; i++) {
upper[i] = toupper(upper[i]);
}
- family = map->cmap_name + 1;
+ desc++;
+ c = strchr(desc, '_');
+ if (c != NULL) {
+ *c = ' ';
+ c++;
+ *c = toupper(*c);
+ }
if (fprintf(f, cpcgen_manual_amd_header, map->cmap_path, upper,
- family, family, family) == -1) {
+ map->cmap_name, desc, desc) == -1) {
warn("failed to write out manual header for %s",
map->cmap_name);
free(upper);
+ free(desc);
return (B_FALSE);
}
free(upper);
+ free(desc);
return (B_TRUE);
}