* Stefan Reinauer <[EMAIL PROTECTED]> [040605 12:29]:
> * Stefan Reinauer <[EMAIL PROTECTED]> [040605 12:12]:
> > I will comment the two table fixing functions out for now until we
> > generate this table dynamically
> 
> The table is checked twice, once the original and once the copy. 
> Since the checking of the original does not change the fact whether the
> the table is copied at all, I will unify these and only check the copy
> of the pirq table. There we can change checksum and length as we wish.

If noone is going to object the attached patch, I am going to submit
this soon.

Stefan

Index: arch/i386/boot/pirq_routing.c
===================================================================
RCS file: /cvsroot/freebios/freebios2/src/arch/i386/boot/pirq_routing.c,v
retrieving revision 1.8
diff -u -r1.8 pirq_routing.c
--- arch/i386/boot/pirq_routing.c       15 Apr 2004 17:33:20 -0000      1.8
+++ arch/i386/boot/pirq_routing.c       5 Jun 2004 10:36:43 -0000
@@ -3,29 +3,24 @@
 #include <string.h>
 
 #if (DEBUG==1 && HAVE_PIRQ_TABLE==1)
-void check_pirq_routing_table(void)
+static void check_pirq_routing_table(struct irq_routing_table *rt)
 {
-       const uint8_t *addr;
-       const struct irq_routing_table *rt;
+       uint8_t *addr = (uint8_t *)rt;
+       uint8_t sum=0;
        int i;
-       uint8_t sum;
 
-       printk_info("Checking IRQ routing tables...\n");
+       printk_info("Checking IRQ routing table consistency...\n");
 
 #if defined(IRQ_SLOT_COUNT)
-       if (sizeof(intel_irq_routing_table) != intel_irq_routing_table.size) {
+       if (sizeof(struct irq_routing_table) != rt->size) {
                printk_warning("Inconsistent IRQ routing table size (0x%x/0x%x)\n",
-                              sizeof(intel_irq_routing_table),
-                              intel_irq_routing_table.size
+                              sizeof(struct irq_routing_table),
+                              rt->size
                        );
-               intel_irq_routing_table.size=sizeof(intel_irq_routing_table);
+               rt->size=sizeof(struct irq_routing_table);
        }
 #endif
 
-       rt = &intel_irq_routing_table;
-       addr = (uint8_t *)rt;
-
-       sum = 0;
        for (i = 0; i < rt->size; i++)
                sum += addr[i];
 
@@ -43,7 +38,7 @@
        }
 
        if (rt->signature != PIRQ_SIGNATURE || rt->version != PIRQ_VERSION ||
-           rt->size % 16 || rt->size < sizeof(struct irq_routing_table)) {
+           rt->size % 16 ) {
                printk_warning("%s:%6d:%s() - "
                               "Interrupt Routing Table not valid\n",
                               __FILE__, __LINE__, __FUNCTION__);
@@ -63,7 +58,7 @@
        printk_info("done.\n");
 }
 
-int verify_copy_pirq_routing_table(unsigned long addr)
+static int verify_copy_pirq_routing_table(unsigned long addr)
 {
        int i;
        uint8_t *rt_orig, *rt_curr;
@@ -78,6 +73,9 @@
                }
        }
        printk_info("done\n");
+       
+       check_routing_table((struct irq_routing_table *)addr);
+       
        return 0;
 }
 #else
Index: arch/i386/boot/tables.c
===================================================================
RCS file: /cvsroot/freebios/freebios2/src/arch/i386/boot/tables.c,v
retrieving revision 1.7
diff -u -r1.7 tables.c
--- arch/i386/boot/tables.c     15 Apr 2004 17:33:20 -0000      1.7
+++ arch/i386/boot/tables.c     5 Jun 2004 10:36:44 -0000
@@ -46,7 +46,6 @@
        low_table_end = 16;
 
        post_code(0x9a);
-       check_pirq_routing_table();
 
        /* This table must be betweeen 0xf0000 & 0x100000 */
        rom_table_end = copy_pirq_routing_table(rom_table_end);
Index: arch/i386/include/arch/pirq_routing.h
===================================================================
RCS file: /cvsroot/freebios/freebios2/src/arch/i386/include/arch/pirq_routing.h,v
retrieving revision 1.2
diff -u -r1.2 pirq_routing.h
--- arch/i386/include/arch/pirq_routing.h       23 Mar 2004 17:39:22 -0000      1.2
+++ arch/i386/include/arch/pirq_routing.h       5 Jun 2004 10:36:44 -0000
@@ -39,12 +39,6 @@
 
 extern const struct irq_routing_table intel_irq_routing_table;
 
-#if (DEBUG==1 && HAVE_PIRQ_TABLE==1)
-void check_pirq_routing_table(void);
-#else
-#define check_pirq_routing_table() do {} while(0)
-#endif
-
 #if HAVE_PIRQ_TABLE==1
 unsigned long copy_pirq_routing_table(unsigned long start);
 #else

Reply via email to