ioapic.c

Go to the documentation of this file.
00001 #include <console/console.h>
00002 #include <arch/ioapic.h>
00003 
00004 /* we have to do more than we thought. I assumed Linux would do all the
00005  * interesting parts, and I was wrong. 
00006  */
00007 struct ioapicreg {
00008         unsigned int reg;
00009         unsigned int value_low, value_high;
00010 };
00011 struct ioapicreg ioapicregvalues[] = {
00012 #define ALL             (0xff << 24)
00013 #define NONE            (0)
00014 #define DISABLED        (1 << 16)
00015 #define ENABLED         (0 << 16)
00016 #define TRIGGER_EDGE    (0 << 15)
00017 #define TRIGGER_LEVEL   (1 << 15)
00018 #define POLARITY_HIGH   (0 << 13)
00019 #define POLARITY_LOW    (1 << 13)
00020 #define PHYSICAL_DEST   (0 << 11)
00021 #define LOGICAL_DEST    (1 << 11)
00022 #define ExtINT          (7 << 8)
00023 #define NMI             (4 << 8)
00024 #define SMI             (2 << 8)
00025 #define INT             (1 << 8)
00026         /* mask, trigger, polarity, destination, delivery, vector */
00027         {0x00, DISABLED, NONE},
00028         {0x01, DISABLED, NONE},
00029         {0x02, DISABLED, NONE},
00030         {0x03, DISABLED, NONE},
00031         {0x04, DISABLED, NONE},
00032         {0x05, DISABLED, NONE},
00033         {0x06, DISABLED, NONE},
00034         {0x07, DISABLED, NONE},
00035         {0x08, DISABLED, NONE},
00036         {0x09, DISABLED, NONE},
00037         {0x0a, DISABLED, NONE},
00038         {0x0b, DISABLED, NONE},
00039         {0x0c, DISABLED, NONE},
00040         {0x0d, DISABLED, NONE},
00041         {0x0e, DISABLED, NONE},
00042         {0x0f, DISABLED, NONE},
00043         {0x10, DISABLED, NONE},
00044         {0x11, DISABLED, NONE},
00045         {0x12, DISABLED, NONE},
00046         {0x13, DISABLED, NONE},
00047         {0x14, DISABLED, NONE},
00048         {0x14, DISABLED, NONE},
00049         {0x15, DISABLED, NONE},
00050         {0x16, DISABLED, NONE},
00051         {0x17, DISABLED, NONE},
00052 };
00053 
00054 void setup_ioapic(void)
00055 {
00056         int i;
00057         unsigned long value_low, value_high;
00058         unsigned long nvram = 0xfec00000;
00059         volatile unsigned long *l;
00060         struct ioapicreg *a = ioapicregvalues;
00061 
00062         l = (unsigned long *) nvram;
00063 #if defined(i786)
00064         /* For the pentium 4 and above apic deliver their interrupts
00065          * on the front side bus, enable that.
00066          */
00067         l[0] = 0x03;
00068         l[4] = 1;
00069 #endif /* i786 */
00070         for (i = 0; i < ARRAY_SIZE(ioapicregvalues);
00071              i++, a++) {
00072                 l[0] = (a->reg * 2) + 0x10;
00073                 l[4] = a->value_low;
00074                 value_low = l[4];
00075                 l[0] = (a->reg *2) + 0x11;
00076                 l[4] = a->value_high;
00077                 value_high = l[4];
00078                 if ((i==0) && (value_low == 0xffffffff)) {
00079                         printk_warning("IO APIC not responding.\n");
00080                         return;
00081                 }
00082                 printk_spew("for IRQ, reg 0x%08x value 0x%08x 0x%08x\n", 
00083                         a->reg, a->value_low, a->value_high);
00084         }
00085 }

Generated on Mon Dec 29 10:54:06 2008 for coreboot by  doxygen 1.5.5