nanxiongchao / rpms / dmidecode

Forked from rpms/dmidecode 4 years ago
Clone

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

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