Blame SOURCES/0005-biosdecode-Clean-up-the-PIR-table-output.patch

60918b
From baeacaa7b9930badc074eaad3700b075ed9d622f Mon Sep 17 00:00:00 2001
60918b
From: Jean Delvare <jdelvare@suse.de>
60918b
Date: Tue, 25 Jul 2017 11:21:27 +0200
60918b
Subject: [PATCH 05/10] biosdecode: Clean up the PIR table output
60918b
60918b
* Remove entry numbers.
60918b
* Use "Device" instead of "ID".
60918b
* Put repeated code in a function.
60918b
* Don't display unconnected links.
60918b
* Shorten "slot number" to just "slot".
60918b
60918b
---
60918b
 biosdecode.c | 42 ++++++++++++++++++------------------------
60918b
 1 file changed, 18 insertions(+), 24 deletions(-)
60918b
60918b
diff --git a/biosdecode.c b/biosdecode.c
60918b
index 8293e61..b37e510 100644
60918b
--- a/biosdecode.c
60918b
+++ b/biosdecode.c
60918b
@@ -355,7 +355,7 @@ static void pir_slot_number(u8 code)
60918b
 	if (code == 0)
60918b
 		printf(" on-board");
60918b
 	else
60918b
-		printf(" slot number %u", code);
60918b
+		printf(" slot %u", code);
60918b
 }
60918b
 
60918b
 static size_t pir_length(const u8 *p)
60918b
@@ -363,6 +363,16 @@ static size_t pir_length(const u8 *p)
60918b
 	return WORD(p + 6);
60918b
 }
60918b
 
60918b
+static void pir_link_bitmap(char letter, const u8 *p)
60918b
+{
60918b
+	if (p[0] == 0) /* Not connected */
60918b
+		return;
60918b
+
60918b
+	printf("\t\tINT%c#: Link 0x%02x, IRQ Bitmap", letter, p[0]);
60918b
+	pir_irqs(WORD(p + 1));
60918b
+	printf("\n");
60918b
+}
60918b
+
60918b
 static int pir_decode(const u8 *p, size_t len)
60918b
 {
60918b
 	int i;
60918b
@@ -372,7 +382,7 @@ static int pir_decode(const u8 *p, size_t len)
60918b
 
60918b
 	printf("PCI Interrupt Routing %u.%u present.\n",
60918b
 		p[5], p[4]);
60918b
-	printf("\tRouter ID: %02x:%02x.%1x\n",
60918b
+	printf("\tRouter Device: %02x:%02x.%1x\n",
60918b
 		p[8], p[9]>>3, p[9] & 0x07);
60918b
 	printf("\tExclusive IRQs:");
60918b
 	pir_irqs(WORD(p + 10));
60918b
@@ -386,32 +396,16 @@ static int pir_decode(const u8 *p, size_t len)
60918b
 
60918b
 	for (i = 1; i <= (WORD(p + 6) - 32) / 16; i++)
60918b
 	{
60918b
-		printf("\tSlot Entry %u: ID %02x:%02x,",
60918b
-			i, p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3);
60918b
+		printf("\tDevice: %02x:%02x,",
60918b
+			p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3);
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
+			pir_link_bitmap('A', p + (i + 1) * 16 + 2);
60918b
+			pir_link_bitmap('B', p + (i + 1) * 16 + 5);
60918b
+			pir_link_bitmap('C', p + (i + 1) * 16 + 8);
60918b
+			pir_link_bitmap('D', p + (i + 1) * 16 + 11);
60918b
 		}
60918b
 	}
60918b
 
60918b
-- 
60918b
2.9.5
60918b