diff mbox series

[10/61] external/gard: Enable Power10

Message ID 20210719132012.150948-11-hegdevasant@linux.vnet.ibm.com
State Superseded
Headers show
Series P10 Enablement | expand

Commit Message

Vasant Hegde July 19, 2021, 1:19 p.m. UTC
From: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>

Add Power10 support for opal-gard utility.

Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
[Folded test case fix and updated commit message - Vasant]
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 external/gard/gard.c                    | 15 ++++-
 external/gard/gard.h                    |  1 +
 external/gard/test/results/02-usage.err |  1 +
 external/gard/units.c                   | 89 +++++++++++++++++++++++++
 4 files changed, 103 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/external/gard/gard.c b/external/gard/gard.c
index b012cf9b7..53a26d0e9 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -157,8 +157,12 @@  static void guess_chip_gen(void)
 		set_chip_gen(p9_chip_units);
 		return;
 
+	case 0x0080: /* power10 */
+		set_chip_gen(p10_chip_units);
+		return;
+
 	default:
-		fprintf(stderr, "Unsupported processor (pvr %#x)! Set the processor generation manually with -8 or -9\n", pvr);
+		fprintf(stderr, "Unsupported processor (pvr %#x)! Set the processor generation manually with -8, -9 or -0\n", pvr);
 		exit(1);
 	}
 }
@@ -773,7 +777,8 @@  static void usage(const char *progname)
 	fprintf(stderr, "Usage: %s [-a -e -f <file> -p] <command> [<args>]\n\n",
 			progname);
 	fprintf(stderr, "-8 --p8\n");
-	fprintf(stderr, "-9 --p9\n\tSet the processor generation\n\n");
+	fprintf(stderr, "-9 --p9\n");
+	fprintf(stderr, "-0 --p10\n\tSet the processor generation\n\n");
 	fprintf(stderr, "-e --ecc\n\tForce reading/writing with ECC bytes.\n\n");
 	fprintf(stderr, "-f --file <file>\n\tDon't search for MTD device,"
 	                " read from <file>.\n\n");
@@ -802,9 +807,10 @@  static struct option global_options[] = {
 	{ "ecc", no_argument, 0, 'e' },
 	{ "p8", no_argument, 0, '8' },
 	{ "p9", no_argument, 0, '9' },
+	{ "p10", no_argument, 0, '0' },
 	{ 0 },
 };
-static const char *global_optstring = "+ef:p89";
+static const char *global_optstring = "+ef:p890";
 
 int main(int argc, char **argv)
 {
@@ -853,6 +859,9 @@  int main(int argc, char **argv)
 		case '9':
 			set_chip_gen(p9_chip_units);
 			break;
+		case '0':
+			set_chip_gen(p10_chip_units);
+			break;
 		case '?':
 			usage(progname);
 			rc = EXIT_FAILURE;
diff --git a/external/gard/gard.h b/external/gard/gard.h
index 329772a74..d59c2a0de 100644
--- a/external/gard/gard.h
+++ b/external/gard/gard.h
@@ -71,3 +71,4 @@  struct chip_unit_desc {
 extern const struct chip_unit_desc *chip_units;
 extern const struct chip_unit_desc p8_chip_units[];
 extern const struct chip_unit_desc p9_chip_units[];
+extern const struct chip_unit_desc p10_chip_units[];
diff --git a/external/gard/test/results/02-usage.err b/external/gard/test/results/02-usage.err
index 0e0782628..453fcf52f 100644
--- a/external/gard/test/results/02-usage.err
+++ b/external/gard/test/results/02-usage.err
@@ -2,6 +2,7 @@  Usage: ./opal-gard [-a -e -f <file> -p] <command> [<args>]
 
 -8 --p8
 -9 --p9
+-0 --p10
 	Set the processor generation
 
 -e --ecc
diff --git a/external/gard/units.c b/external/gard/units.c
index 35d46e443..f3b435a3a 100644
--- a/external/gard/units.c
+++ b/external/gard/units.c
@@ -151,3 +151,92 @@  const struct chip_unit_desc p9_chip_units[] = {
 	{0x4F, "LAST_IN_RANGE"},
 };
 
+const struct chip_unit_desc p10_chip_units[] = {
+	{0x00, "NA"},
+	{0x01, "Sys"},
+	{0x02, "Node"},
+	{0x03, "DIMM"},
+	{0x04, "Membuf"},
+	{0x05, "Proc"},
+	{0x06, "EX"},
+	{0x07, "Core"},
+	{0x08, "L2"},
+	{0x09, "L3"},
+	{0x0A, "L4"},
+	{0x0B, "MCS"},
+	/* a hole! */
+	{0x0D, "MBA"},
+	{0x0E, "XBUS"},
+	{0x0F, "ABUS"},
+	{0x10, "PCI"},
+	{0x11, "DPSS"},
+	{0x12, "APSS"},
+	{0x13, "OCC"},
+	{0x14, "PSI"},
+	{0x15, "FSP"},
+	{0x16, "PNOR"},
+	{0x17, "OSC"},
+	{0x18, "TODCLK"},
+	{0x19, "CONTROL_NODE"},
+	{0x1A, "OSCREFCLK"},
+	{0x1B, "OSCPCICLK"},
+	{0x1C, "REFCLKENDPT"},
+	{0x1D, "PCICLKENDPT"},
+	{0x1E, "NX"},
+	{0x1F, "PORE"},
+	{0x20, "PCIESWITCH"},
+	{0x21, "CAPP"},
+	{0x22, "FSI"},
+	{0x23, "EQ"},
+	{0x24, "MCA"},
+	{0x25, "MCBIST"},
+	{0x26, "MI"},
+	{0x27, "DMI"},
+	{0x28, "OBUS"},
+	{0x2A, "SBE"},
+	{0x2B, "PPE"},
+	{0x2C, "PERV"},
+	{0x2D, "PEC"},
+	{0x2E, "PHB"},
+	{0x2F, "SYSREFCLKENDPT"},
+	{0x30, "MFREFCLKENDPT"},
+	{0x31, "TPM"},
+	{0x32, "SP"},
+	{0x33, "UART"},
+	{0x34, "PS"},
+	{0x35, "FAN"},
+	{0x36, "VRM"},
+	{0x37, "USB"},
+	{0x38, "ETH"},
+	{0x39, "PANEL"},
+	{0x3A, "BMC"},
+	{0x3B, "FLASH"},
+	{0x3C, "SEEPROM"},
+	{0x3D, "TMP"},
+	{0x3E, "GPIO_EXPANDER"},
+	{0x3F, "POWER_SEQUENCER"},
+	{0x40, "RTC"},
+	{0x41, "FANCTLR"},
+	{0x42, "OBUS_BRICK"},
+	{0x43, "NPU"},
+	{0x44, "MC"},
+	{0x45, "TEST_FAIL"},
+	{0x46, "MFREFCLK"},
+	{0x47, "SMPGROUP"},
+	{0x48, "OMI"},
+	{0x49, "MCC"},
+	{0x4A, "OMIC"},
+	{0x4B, "OCMB_CHIP"},
+	{0x4C, "MEM_PORT"},
+	{0x4D, "I2C_MUX"},
+	{0x4E, "PMIC"},
+	{0x4F, "NMMU"},
+	{0x50, "PAU"},
+	{0x51, "IOHS"},
+	{0x52, "PAUC"},
+	{0x53, "FC"},
+	{0x54, "LPCREFCLKENDPT"},
+	{0x55, "GENERIC_I2C_DEVICE"},
+	{0x56, "LAST_IN_RANGE"},
+};
+