summaryrefslogtreecommitdiff
path: root/util/getpir/code_gen.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2009-05-22 18:17:06 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2009-05-22 18:17:06 +0000
commit5e445c5feee84a7a34657f98538771bbcd447b54 (patch)
tree5afeeef7125d1d46b9648e18a330c8ac18c67559 /util/getpir/code_gen.c
parentcf7f148ac8284aaf90ebf985d9a7fcdb5e19f697 (diff)
downloadcoreboot-5e445c5feee84a7a34657f98538771bbcd447b54.tar.xz
Make the getpir output look less crappy and add a license
header template, as people keep forgetting them. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4296 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/getpir/code_gen.c')
-rw-r--r--util/getpir/code_gen.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/util/getpir/code_gen.c b/util/getpir/code_gen.c
index bd7dc36a88..81d6b2c9f9 100644
--- a/util/getpir/code_gen.c
+++ b/util/getpir/code_gen.c
@@ -3,21 +3,34 @@
#include "pirq_routing.h"
static char *preamble[] = {
- "/* This file was generated by getpir.c, do not modify!\n",
- " * (but if you do, please run checkpir on it to verify)\n",
+
+ "/*\n",
+ " * This file is part of the coreboot project.\n",
+ " *\n",
+ " * Copyright (C) 200x TODO <TODO@TODO>\n",
+ " *\n",
+ " * This program is free software; you can redistribute it and/or modify\n",
+ " * it under the terms of the GNU General Public License as published by\n",
+ " * the Free Software Foundation; either version 2 of the License, or\n",
+ " * (at your option) any later version.\n",
" *\n",
- " * Contains the IRQ Routing Table dumped directly from your\n",
- " * memory, which BIOS sets up.\n",
+ " * This program is distributed in the hope that it will be useful,\n",
+ " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n",
+ " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n",
+ " * GNU General Public License for more details.\n",
" *\n",
- " * Documentation at: http://www.microsoft.com/whdc/archive/pciirq.mspx\n */\n\n",
- "#ifdef GETPIR\n",
- "#include \"pirq_routing.h\"\n",
- "#else\n"
+ " * You should have received a copy of the GNU General Public License\n",
+ " * along with this program; if not, write to the Free Software\n",
+ " * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n",
+ " */\n\n",
+ "#ifdef GETPIR /* TODO: Drop this when copying to coreboot. */\n",
+ "#include \"pirq_routing.h\" /* TODO: Drop this when copying to coreboot. */\n",
+ "#else /* TODO: Drop this when copying to coreboot. */\n"
"#include <arch/pirq_routing.h>\n",
- "#endif\n\n"
+ "#endif /* TODO: Drop this when copying to coreboot. */\n\n"
"const struct irq_routing_table intel_irq_routing_table = {\n",
- "\tPIRQ_SIGNATURE, /* u32 signature */\n",
- "\tPIRQ_VERSION, /* u16 version */\n",
+ "\tPIRQ_SIGNATURE, /* u32 signature */\n",
+ "\tPIRQ_VERSION, /* u16 version */\n",
0
};
@@ -36,25 +49,25 @@ void code_gen(char *filename, struct irq_routing_table *rt)
while (*code)
fprintf(fpir, "%s", *code++);
- fprintf(fpir, "\t32+16*%d, /* There can be total %d devices on the bus */\n",
+ fprintf(fpir, "\t32 + 16 * %d, /* Max. number of devices on the bus */\n",
ts, ts);
- fprintf(fpir, "\t0x%02x, /* Where the interrupt router lies (bus) */\n",
+ fprintf(fpir, "\t0x%02x, /* Interrupt router bus */\n",
rt->rtr_bus);
- fprintf(fpir, "\t(0x%02x<<3)|0x%01x, /* Where the interrupt router lies (dev) */\n",
+ fprintf(fpir, "\t(0x%02x << 3) | 0x%01x, /* Interrupt router dev */\n",
rt->rtr_devfn >> 3, rt->rtr_devfn & 7);
- fprintf(fpir, "\t%#x, /* IRQs devoted exclusively to PCI usage */\n",
+ fprintf(fpir, "\t%#x, /* IRQs devoted exclusively to PCI usage */\n",
rt->exclusive_irqs);
- fprintf(fpir, "\t%#x, /* Vendor */\n", rt->rtr_vendor);
- fprintf(fpir, "\t%#x, /* Device */\n", rt->rtr_device);
- fprintf(fpir, "\t%#x, /* Miniport */\n",
+ fprintf(fpir, "\t%#x, /* Vendor */\n", rt->rtr_vendor);
+ fprintf(fpir, "\t%#x, /* Device */\n", rt->rtr_device);
+ fprintf(fpir, "\t%#x, /* Miniport */\n",
rt->miniport_data);
fprintf(fpir, "\t{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* u8 rfu[11] */\n");
- fprintf(fpir, "\t%#x, /* u8 checksum. This has to be set to some\n value that would give 0 after the sum of all\n bytes for this structure (including checksum) */\n",
+ fprintf(fpir, "\t%#x, /* Checksum (has to be set to some value that\n * would give 0 after the sum of all bytes\n * for this structure (including checksum).\n */\n",
rt->checksum);
fprintf(fpir, "\t{\n");
- fprintf(fpir, "\t\t/* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */\n");
+ fprintf(fpir, "\t\t/* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */\n");
for (i = 0; i < ts; i++) {
- fprintf(fpir, "\t\t{0x%02x,(0x%02x<<3)|0x%01x, {{0x%02x, 0x%04x}, {0x%02x, 0x%04x}, {0x%02x, 0x%04x}, {0x%02x, 0x%04x}}, 0x%x, 0x%x},\n",
+ fprintf(fpir, "\t\t{0x%02x, (0x%02x << 3) | 0x%01x, {{0x%02x, 0x%04x}, {0x%02x, 0x%04x}, {0x%02x, 0x%04x}, {0x%02x, 0x%04x}}, 0x%x, 0x%x},\n",
(se_arr+i)->bus, (se_arr+i)->devfn >> 3,
(se_arr+i)->devfn & 7, (se_arr+i)->irq[0].link,
(se_arr+i)->irq[0].bitmap, (se_arr+i)->irq[1].link,