From 2fcc166fb89f85fc91bf5270a0d0973feb077cab Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Wed, 20 Jun 2012 09:58:21 +0200 Subject: [PATCH] mptable: pretty print PCI INT entries make it more readable by adding INT defines and a left shift. Change-Id: I7db4d8c71ab4d705833019aa4cc2f11cef7d4fee Signed-off-by: Sven Schnelle Reviewed-on: http://review.coreboot.org/1113 Tested-by: build bot (Jenkins) --- util/mptable/mptable.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/util/mptable/mptable.c b/util/mptable/mptable.c index 1aabe1782f..e2818610b6 100644 --- a/util/mptable/mptable.c +++ b/util/mptable/mptable.c @@ -298,6 +298,11 @@ char *preamble[] = { "#include ", "#include ", "", + "#define INTA 0x00", + "#define INTB 0x01", + "#define INTC 0x02", + "#define INTD 0x03", + "", "static void *smp_write_config_table(void *v)", "{", " struct mp_config_table *mc;", @@ -1090,14 +1095,25 @@ static void intEntry(void) printf("\t %6d", (int)entry.dstApicID); printf("\t %3d\n", (int)entry.dstApicINT); } - printf("\tsmp_write_intsrc(mc, %s, %s|%s, 0x%x, 0x%x, 0x%x, 0x%x);\n", - intTypes[(int)entry.intType], - triggerMode[((int)entry.intFlags >> 2) & 0x03], - polarityMode[(int)entry.intFlags & 0x03], - (int)entry.srcBusID, - (int)entry.srcBusIRQ, - (int)entry.dstApicID, (int)entry.dstApicINT); + if (busses[(int)entry.srcBusID] == PCI) { + printf("\tsmp_write_intsrc(mc, %s, %s|%s, 0x%x, (0x%02x << 2) | INT%c, 0x%x, 0x%x);\n", + intTypes[(int)entry.intType], + triggerMode[((int)entry.intFlags >> 2) & 0x03], + polarityMode[(int)entry.intFlags & 0x03], + (int)entry.srcBusID, + (int)entry.srcBusIRQ >> 2, + ((int)entry.srcBusIRQ & 3) + 'A', + (int)entry.dstApicID, (int)entry.dstApicINT); + } else { + printf("\tsmp_write_intsrc(mc, %s, %s|%s, 0x%x, 0x%x, 0x%x, 0x%x);\n", + intTypes[(int)entry.intType], + triggerMode[((int)entry.intFlags >> 2) & 0x03], + polarityMode[(int)entry.intFlags & 0x03], + (int)entry.srcBusID, + (int)entry.srcBusIRQ, + (int)entry.dstApicID, (int)entry.dstApicINT); + } } static void lintEntry(void)