Index: getpir.c
===================================================================
--- getpir.c	(revision 4658)
+++ getpir.c	(working copy)
@@ -28,23 +28,42 @@
 {
 	char *ptr, signature[] = "$PIR";
 	struct irq_routing_table *rt;
+	int size = 16;
 
 	ptr =  mmap(0, 0x10000, PROT_READ, MAP_SHARED,
 		    fd_mem, (off_t) 0xf0000);
 
-	if (ptr == MAP_FAILED) {
+	if (ptr == MAP_FAILED)
+	{
 		perror("Mapping system memory failed: ");
-		exit(1);
+		return NULL;
 	}
+	do
+	{
+		rt = (struct irq_routing_table *) memmem(ptr+size, 16, signature, 4);
+		if (rt != NULL)
+		{
+			printf("Found PCI IRQ routing table signature at %p.\n",
+		       (void *)((char *)rt - ptr + 0xf0000));
+	        	printf("Validating... ");
+	        	if (!calc_checksum(rt))
+			{
+                		printf("checksum is ok.\n");
+				break;
+			}
+        		else
+                	{
+				printf("checksum is wrong.\n");
+			}	
+		}
 
-	rt = (struct irq_routing_table *) memmem(ptr, 0xFFFF, signature, 4);
-
-	if (rt != NULL) {
-		printf("Found PCI IRQ routing table signature at %p.\n",
-		       (void *)((char *)rt - ptr + 0xf0000));
-	} else {
+		size+=16;
+	}while(size<0xFFFF);
+	if (size>=0xFFFF)
+	{
 		printf("No PCI IRQ routing table signature found.\n");
-		exit(1);
+		munmap(ptr,0x10000);
+		return NULL;
 	}
 	return rt;
 }
@@ -66,19 +85,14 @@
 
 	printf("Probing PIRQ table in memory.\n");
 	rt = probe_table(fd_mem);
-
-	printf("Validating... ");
-	if (!calc_checksum(rt))
-		printf("checksum is ok.\n");
-	else
-		printf("checksum is wrong.\n");
-
-	printf("Creating irq_tables.c ...\n");
-	code_gen("irq_tables.c", rt);
-
+	if (rt!= NULL)
+	{
+		printf("Creating irq_tables.c ...\n");
+		code_gen("irq_tables.c", rt);
+		printf("Done, you can move the file to the coreboot tree now.\n");
+	}
 	close(fd_mem);
 
-	printf("Done, you can move the file to the coreboot tree now.\n");
 
 	return 0;
 }
Index: Makefile
===================================================================
--- Makefile	(revision 4658)
+++ Makefile	(working copy)
@@ -5,8 +5,7 @@
 CC=gcc
 CFLAGS=-O2 -D_GNU_SOURCE -DGETPIR -Wall
 
-all: getpir checkpir
-	./checkpir
+all: getpir
 
 getpir: getpir.o checksum.o code_gen.o
 	$(CC) $(CFLAGS) -o getpir $^
@@ -14,9 +13,6 @@
 checkpir: checkpir.c checksum.o irq_tables.o
 	$(CC) $(CFLAGS) -o checkpir $^
 
-irq_tables.c: getpir
-	./getpir
-
 clean:
 	rm -f getpir checkpir *.o *~
 
Index: README
===================================================================
--- README	(revision 4658)
+++ README	(working copy)
@@ -4,25 +4,26 @@
 specialy when you are testing new motherboards, changing your hardware often, placing new cards, etc.. 
 
 
-INSTALL:
 
-edit Makefile, define the root to coreboot tree
-make
 
+
 USAGE:
+Steps 
+	1 -	make distclean;
+	2 - 	make getpir
+	3 - 	./getpir
 
-./getpir
+		Will dump irq table to the file called irq_tables.c, ready to use with coreboot. Just move the 
+		file to corresponding place in the coreboot tree.
 
-Will dump irq table to the file called irq_tables.c, ready to use with coreboot. Just move the 
-file to corresponding place in the linux bios tree.
 
+	4 - 	CHECKING CUSTOM irq_tables.c:
 
-CHECKING CUSTOM irq_tables.c:
+		make checkpir
+		./checkpir
 
-checkpir.c Will verify the irq_tables.c, currently it only checks the checksum. In case of wrong
-checksum, a good value is proposed, so you can edit irq_tables.c manualy and replace checksum.
-Run the command like this:
+		checkpir.c Will verify the irq_tables.c, currently it only checks the checksum. In case of wrong
+		checksum, a good value is proposed, so you can edit irq_tables.c manualy and replace checksum.
+		
 
-make test
-
-Do not run ./checkpir directly because it needs to be linked to irq_table.o first.
+Do not run make checkpir and ./checkpir directly because it needs to be linked to irq_table.o first.
