seperate code generation
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1646 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
7b08c116b9
commit
39fdcbf9f0
|
@ -13,16 +13,21 @@ static char *preamble[] = {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
void code_gen(FILE * fpir, struct irq_routing_table *rt)
|
void code_gen(char *filename, struct irq_routing_table *rt)
|
||||||
{
|
{
|
||||||
char **code = preamble;
|
char **code = preamble;
|
||||||
struct irq_info *se_arr = (struct irq_info *) ((char *) rt + 32);
|
struct irq_info *se_arr = (struct irq_info *) ((char *) rt + 32);
|
||||||
int i, ts = (rt->size - 32) / 16;
|
int i, ts = (rt->size - 32) / 16;
|
||||||
|
FILE *fpir;
|
||||||
|
|
||||||
|
if ((fpir = fopen(filename, "w")) == NULL) {
|
||||||
|
printf("Failed creating file!\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
while (*code)
|
while (*code)
|
||||||
fprintf(fpir, "%s", *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, /* there can be total %d devices on the bus */\n",
|
||||||
ts, ts);
|
ts, ts);
|
||||||
fprintf(fpir, "\t0x%02x, /* Where the interrupt router lies (bus) */\n",
|
fprintf(fpir, "\t0x%02x, /* Where the interrupt router lies (bus) */\n",
|
||||||
|
@ -52,4 +57,6 @@ void code_gen(FILE * fpir, struct irq_routing_table *rt)
|
||||||
}
|
}
|
||||||
fprintf(fpir, "\t}\n");
|
fprintf(fpir, "\t}\n");
|
||||||
fprintf(fpir, "};\n");
|
fprintf(fpir, "};\n");
|
||||||
|
|
||||||
|
fclose(fpir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ static struct irq_routing_table *probe_table(int fd_mem)
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
int fd_mem;
|
int fd_mem;
|
||||||
FILE *fpir;
|
|
||||||
struct irq_routing_table *rt;
|
struct irq_routing_table *rt;
|
||||||
|
|
||||||
if (getuid()) {
|
if (getuid()) {
|
||||||
|
@ -50,13 +49,7 @@ main()
|
||||||
printf("Checksum is ok!\n");
|
printf("Checksum is ok!\n");
|
||||||
|
|
||||||
printf("Creating irq_tables.c .....\n");
|
printf("Creating irq_tables.c .....\n");
|
||||||
fpir = fopen("irq_tables.c", "w");
|
code_gen("irq_tables.c", rt);
|
||||||
if (!fpir) {
|
|
||||||
printf("Failed creating file!\n");
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
code_gen(fpir, rt);
|
|
||||||
fclose(fpir);
|
|
||||||
|
|
||||||
close(fd_mem);
|
close(fd_mem);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue