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

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