Blame 0007-biosdecode-Clean-up-the-PIR-table-output.patch

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