Blame SOURCES/0004-biosdecode-Add-option-pir-full.patch

5f4333
From 6486331cf66e35bcf01e1c15c4396af68b6eb4d4 Mon Sep 17 00:00:00 2001
5f4333
From: Jean Delvare <jdelvare@suse.de>
5f4333
Date: Tue, 25 Jul 2017 11:21:22 +0200
5f4333
Subject: [PATCH 04/10] biosdecode: Add option --pir full
5f4333
5f4333
Add an option to decode the details of the PIR table.
5f4333
5f4333
This implements support request #109339:
5f4333
https://savannah.nongnu.org/support/index.php?109339
5f4333
5f4333
---
5f4333
 biosdecode.c     | 59 +++++++++++++++++++++++++++++++-------------------------
5f4333
 man/biosdecode.8 |  3 +++
5f4333
 2 files changed, 36 insertions(+), 26 deletions(-)
5f4333
5f4333
diff --git a/biosdecode.c b/biosdecode.c
5f4333
index ad3d4bc..8293e61 100644
5f4333
--- a/biosdecode.c
5f4333
+++ b/biosdecode.c
5f4333
@@ -73,12 +73,16 @@ struct opt
5f4333
 {
5f4333
 	const char *devmem;
5f4333
 	unsigned int flags;
5f4333
+	unsigned char pir;
5f4333
 };
5f4333
 static struct opt opt;
5f4333
 
5f4333
 #define FLAG_VERSION            (1 << 0)
5f4333
 #define FLAG_HELP               (1 << 1)
5f4333
 
5f4333
+#define PIR_SHORT               0
5f4333
+#define PIR_FULL                1
5f4333
+
5f4333
 struct bios_entry {
5f4333
 	const char *anchor;
5f4333
 	size_t anchor_len; /* computed */
5f4333
@@ -386,32 +390,29 @@ static int pir_decode(const u8 *p, size_t len)
5f4333
 			i, p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3);
5f4333
 		pir_slot_number(p[(i + 1) * 16 + 14]);
5f4333
 		printf("\n");
5f4333
-/*		printf("\tSlot Entry %u\n", i);
5f4333
-		printf("\t\tID: %02x:%02x\n",
5f4333
-			p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3);
5f4333
-		printf("\t\tLink Value for INTA#: %u\n",
5f4333
-			p[(i + 1) * 16 + 2]);
5f4333
-		printf("\t\tIRQ Bitmap for INTA#:");
5f4333
-		pir_irqs(WORD(p + (i + 1) * 16 + 3));
5f4333
-		printf("\n");
5f4333
-		printf("\t\tLink Value for INTB#: %u\n",
5f4333
-			p[(i + 1) * 16 + 5]);
5f4333
-		printf("\t\tIRQ Bitmap for INTB#:");
5f4333
-		pir_irqs(WORD(p + (i + 1) * 16 + 6));
5f4333
-		printf("\n");
5f4333
-		printf("\t\tLink Value for INTC#: %u\n",
5f4333
-			p[(i + 1) * 16 + 8]);
5f4333
-		printf("\t\tIRQ Bitmap for INTC#:");
5f4333
-		pir_irqs(WORD(p + (i + 1) * 16 + 9));
5f4333
-		printf("\n");
5f4333
-		printf("\t\tLink Value for INTD#: %u\n",
5f4333
-			p[(i + 1) * 16 + 11]);
5f4333
-		printf("\t\tIRQ Bitmap for INTD#:");
5f4333
-		pir_irqs(WORD(p + (i + 1) * 16 + 12));
5f4333
-		printf("\n");
5f4333
-		printf("\t\tSlot Number:");
5f4333
-		pir_slot_number(p[(i + 1) * 16 + 14]);
5f4333
-		printf("\n");*/
5f4333
+		if (opt.pir == PIR_FULL)
5f4333
+		{
5f4333
+			printf("\t\tLink Value for INTA#: %u\n",
5f4333
+				p[(i + 1) * 16 + 2]);
5f4333
+			printf("\t\tIRQ Bitmap for INTA#:");
5f4333
+			pir_irqs(WORD(p + (i + 1) * 16 + 3));
5f4333
+			printf("\n");
5f4333
+			printf("\t\tLink Value for INTB#: %u\n",
5f4333
+				p[(i + 1) * 16 + 5]);
5f4333
+			printf("\t\tIRQ Bitmap for INTB#:");
5f4333
+			pir_irqs(WORD(p + (i + 1) * 16 + 6));
5f4333
+			printf("\n");
5f4333
+			printf("\t\tLink Value for INTC#: %u\n",
5f4333
+				p[(i + 1) * 16 + 8]);
5f4333
+			printf("\t\tIRQ Bitmap for INTC#:");
5f4333
+			pir_irqs(WORD(p + (i + 1) * 16 + 9));
5f4333
+			printf("\n");
5f4333
+			printf("\t\tLink Value for INTD#: %u\n",
5f4333
+				p[(i + 1) * 16 + 11]);
5f4333
+			printf("\t\tIRQ Bitmap for INTD#:");
5f4333
+			pir_irqs(WORD(p + (i + 1) * 16 + 12));
5f4333
+			printf("\n");
5f4333
+		}
5f4333
 	}
5f4333
 
5f4333
 	return 1;
5f4333
@@ -616,6 +617,7 @@ static int parse_command_line(int argc, char * const argv[])
5f4333
 	const char *optstring = "d:hV";
5f4333
 	struct option longopts[] = {
5f4333
 		{ "dev-mem", required_argument, NULL, 'd' },
5f4333
+		{ "pir", required_argument, NULL, 'P' },
5f4333
 		{ "help", no_argument, NULL, 'h' },
5f4333
 		{ "version", no_argument, NULL, 'V' },
5f4333
 		{ NULL, 0, NULL, 0 }
5f4333
@@ -627,6 +629,10 @@ static int parse_command_line(int argc, char * const argv[])
5f4333
 			case 'd':
5f4333
 				opt.devmem = optarg;
5f4333
 				break;
5f4333
+			case 'P':
5f4333
+				if (strcmp(optarg, "full") == 0)
5f4333
+					opt.pir = PIR_FULL;
5f4333
+				break;
5f4333
 			case 'h':
5f4333
 				opt.flags |= FLAG_HELP;
5f4333
 				break;
5f4333
@@ -646,6 +652,7 @@ static void print_help(void)
5f4333
 		"Usage: biosdecode [OPTIONS]\n"
5f4333
 		"Options are:\n"
5f4333
 		" -d, --dev-mem FILE     Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
5f4333
+		"     --pir full         Decode the details of the PCI IRQ routing table\n"
5f4333
 		" -h, --help             Display this help text and exit\n"
5f4333
 		" -V, --version          Display the version and exit\n";
5f4333
 
5f4333
diff --git a/man/biosdecode.8 b/man/biosdecode.8
5f4333
index c39d6a0..a96eb68 100644
5f4333
--- a/man/biosdecode.8
5f4333
+++ b/man/biosdecode.8
5f4333
@@ -60,6 +60,9 @@ program.
5f4333
 .BR "-d" ", " "--dev-mem FILE"
5f4333
 Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR)
5f4333
 .TP
5f4333
+.BR "  " "  " "--pir full"
5f4333
+Decode the details of the PCI IRQ routing table
5f4333
+.TP
5f4333
 .BR "-h" ", " "--help"
5f4333
 Display usage information and exit
5f4333
 .TP
5f4333
-- 
5f4333
2.9.5
5f4333