summaryrefslogtreecommitdiff
path: root/util/getpir/checkpir.c
diff options
context:
space:
mode:
authorLi-Ta Lo <ollie@lanl.gov>2004-04-13 21:06:45 +0000
committerLi-Ta Lo <ollie@lanl.gov>2004-04-13 21:06:45 +0000
commitfd8f02f762f50de5df348c24dbff978c34e74f2c (patch)
tree75c862aa558b43017e2dc729df29eb6a0f2fffd4 /util/getpir/checkpir.c
parent3f5b4660b6c50af57a8599d54b5d84026e0de5cd (diff)
downloadcoreboot-fd8f02f762f50de5df348c24dbff978c34e74f2c.tar.xz
porting getpir to freebios2
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1500 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/getpir/checkpir.c')
-rw-r--r--util/getpir/checkpir.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/util/getpir/checkpir.c b/util/getpir/checkpir.c
new file mode 100644
index 0000000000..e86af49215
--- /dev/null
+++ b/util/getpir/checkpir.c
@@ -0,0 +1,48 @@
+/* checkpir.c : This software is released under GPL
+ For Linuxbios use only
+ Aug 26 2001 , Nikolai Vladychevski, <niko@isl.net.mx>
+*/
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <device/pci.h>
+#include <pirq_routing.h>
+
+#define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24))
+#define PIRQ_VERS 0x0100
+
+struct irq_info se_arr[50];
+struct irq_routing_table *rt;
+
+int calc_checksum(struct irq_routing_table *rt)
+{
+ long sum = 0, i;
+ uint8_t *addr, sum2 = 0;
+
+ addr = (uint8_t *) rt;
+ for (i = 0; i < rt->size; i++)
+ sum2 += addr[i];
+ return (sum2);
+}
+
+main()
+{
+ uint8_t sum, newsum;
+
+ rt = (struct irq_routing_table *) &intel_irq_routing_table;
+ sum = calc_checksum(rt);
+
+ printf("Validating checksum, file: irq_tables.c that was in ./ at compile time...\n");
+ printf("(no other tests are done)\n");
+
+ if (!sum) {
+ printf("Checksum for IRQ Routing table is ok. You can use it in LinuxBios now\n");
+ } else {
+ newsum = rt->checksum - sum;
+ printf("BAD CHECKSUM for IRQ Routing table !!!!\n");
+ printf("If you want to make it valid, change the checksum to: %#x\n",
+ newsum);
+ }
+}