Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 1 | /* checkpir.c : This software is released under GPL |
Stefan Reinauer | 997afe6 | 2008-01-18 15:34:24 +0000 | [diff] [blame] | 2 | * For coreboot use only |
Jeremy Jackson | 46d65e8 | 2007-04-11 18:44:42 +0000 | [diff] [blame] | 3 | * Aug 26 2001 , Nikolai Vladychevski, <niko@isl.net.mx> |
| 4 | */ |
Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 5 | |
Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 6 | #include <stdio.h> |
Jeremy Jackson | 46d65e8 | 2007-04-11 18:44:42 +0000 | [diff] [blame] | 7 | #include "pirq_routing.h" |
Li-Ta Lo | 6463ae7 | 2004-04-14 22:24:50 +0000 | [diff] [blame] | 8 | #include "checksum.h" |
| 9 | |
Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 10 | struct irq_routing_table *rt; |
| 11 | |
Jeremy Jackson | 46d65e8 | 2007-04-11 18:44:42 +0000 | [diff] [blame] | 12 | int main(void) |
Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 13 | { |
| 14 | uint8_t sum, newsum; |
| 15 | |
| 16 | rt = (struct irq_routing_table *) &intel_irq_routing_table; |
| 17 | sum = calc_checksum(rt); |
| 18 | |
| 19 | printf("Validating checksum, file: irq_tables.c that was in ./ at compile time...\n"); |
| 20 | printf("(no other tests are done)\n"); |
| 21 | |
| 22 | if (!sum) { |
Stefan Reinauer | 997afe6 | 2008-01-18 15:34:24 +0000 | [diff] [blame] | 23 | printf("Checksum for IRQ Routing table is ok. You can use irq_tables.c in coreboot now.\n"); |
Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 24 | } else { |
| 25 | newsum = rt->checksum - sum; |
| 26 | printf("BAD CHECKSUM for IRQ Routing table !!!!\n"); |
| 27 | printf("If you want to make it valid, change the checksum to: %#x\n", |
| 28 | newsum); |
| 29 | } |
Jeremy Jackson | 46d65e8 | 2007-04-11 18:44:42 +0000 | [diff] [blame] | 30 | return 0; |
Li-Ta Lo | fd8f02f | 2004-04-13 21:06:45 +0000 | [diff] [blame] | 31 | } |