Merge branch 'acpica-release-fixes' into release-2.6.27
[pandora-kernel.git] / arch / x86 / kernel / visws_quirks.c
1 /*
2  *  SGI Visual Workstation support and quirks, unmaintained.
3  *
4  *  Split out from setup.c by davej@suse.de
5  *
6  *      Copyright (C) 1999 Bent Hagemark, Ingo Molnar
7  *
8  *  SGI Visual Workstation interrupt controller
9  *
10  *  The Cobalt system ASIC in the Visual Workstation contains a "Cobalt" APIC
11  *  which serves as the main interrupt controller in the system.  Non-legacy
12  *  hardware in the system uses this controller directly.  Legacy devices
13  *  are connected to the PIIX4 which in turn has its 8259(s) connected to
14  *  a of the Cobalt APIC entry.
15  *
16  *  09/02/2000 - Updated for 2.4 by jbarnes@sgi.com
17  *
18  *  25/11/2002 - Updated for 2.5 by Andrey Panin <pazke@orbita1.ru>
19  */
20 #include <linux/interrupt.h>
21 #include <linux/module.h>
22 #include <linux/init.h>
23 #include <linux/smp.h>
24
25 #include <asm/visws/cobalt.h>
26 #include <asm/visws/piix4.h>
27 #include <asm/arch_hooks.h>
28 #include <asm/fixmap.h>
29 #include <asm/reboot.h>
30 #include <asm/setup.h>
31 #include <asm/e820.h>
32 #include <asm/smp.h>
33 #include <asm/io.h>
34
35 #include <mach_ipi.h>
36
37 #include "mach_apic.h"
38
39 #include <linux/init.h>
40 #include <linux/smp.h>
41
42 #include <linux/kernel_stat.h>
43 #include <linux/interrupt.h>
44 #include <linux/init.h>
45
46 #include <asm/io.h>
47 #include <asm/apic.h>
48 #include <asm/i8259.h>
49 #include <asm/irq_vectors.h>
50 #include <asm/visws/cobalt.h>
51 #include <asm/visws/lithium.h>
52 #include <asm/visws/piix4.h>
53
54 #include <linux/sched.h>
55 #include <linux/kernel.h>
56 #include <linux/init.h>
57 #include <linux/pci.h>
58 #include <linux/pci_ids.h>
59
60 extern int no_broadcast;
61
62 #include <asm/io.h>
63 #include <asm/apic.h>
64 #include <asm/arch_hooks.h>
65 #include <asm/visws/cobalt.h>
66 #include <asm/visws/lithium.h>
67
68 char visws_board_type   = -1;
69 char visws_board_rev    = -1;
70
71 int is_visws_box(void)
72 {
73         return visws_board_type >= 0;
74 }
75
76 static int __init visws_time_init(void)
77 {
78         printk(KERN_INFO "Starting Cobalt Timer system clock\n");
79
80         /* Set the countdown value */
81         co_cpu_write(CO_CPU_TIMEVAL, CO_TIME_HZ/HZ);
82
83         /* Start the timer */
84         co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) | CO_CTRL_TIMERUN);
85
86         /* Enable (unmask) the timer interrupt */
87         co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) & ~CO_CTRL_TIMEMASK);
88
89         /*
90          * Zero return means the generic timer setup code will set up
91          * the standard vector:
92          */
93         return 0;
94 }
95
96 static int __init visws_pre_intr_init(void)
97 {
98         init_VISWS_APIC_irqs();
99
100         /*
101          * We dont want ISA irqs to be set up by the generic code:
102          */
103         return 1;
104 }
105
106 /* Quirk for machine specific memory setup. */
107
108 #define MB (1024 * 1024)
109
110 unsigned long sgivwfb_mem_phys;
111 unsigned long sgivwfb_mem_size;
112 EXPORT_SYMBOL(sgivwfb_mem_phys);
113 EXPORT_SYMBOL(sgivwfb_mem_size);
114
115 long long mem_size __initdata = 0;
116
117 static char * __init visws_memory_setup(void)
118 {
119         long long gfx_mem_size = 8 * MB;
120
121         mem_size = boot_params.alt_mem_k;
122
123         if (!mem_size) {
124                 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
125                 mem_size = 128 * MB;
126         }
127
128         /*
129          * this hardcodes the graphics memory to 8 MB
130          * it really should be sized dynamically (or at least
131          * set as a boot param)
132          */
133         if (!sgivwfb_mem_size) {
134                 printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n");
135                 sgivwfb_mem_size = 8 * MB;
136         }
137
138         /*
139          * Trim to nearest MB
140          */
141         sgivwfb_mem_size &= ~((1 << 20) - 1);
142         sgivwfb_mem_phys = mem_size - gfx_mem_size;
143
144         e820_add_region(0, LOWMEMSIZE(), E820_RAM);
145         e820_add_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM);
146         e820_add_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED);
147
148         return "PROM";
149 }
150
151 static void visws_machine_emergency_restart(void)
152 {
153         /*
154          * Visual Workstations restart after this
155          * register is poked on the PIIX4
156          */
157         outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
158 }
159
160 static void visws_machine_power_off(void)
161 {
162         unsigned short pm_status;
163 /*      extern unsigned int pci_bus0; */
164
165         while ((pm_status = inw(PMSTS_PORT)) & 0x100)
166                 outw(pm_status, PMSTS_PORT);
167
168         outw(PM_SUSPEND_ENABLE, PMCNTRL_PORT);
169
170         mdelay(10);
171
172 #define PCI_CONF1_ADDRESS(bus, devfn, reg) \
173         (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
174
175 /*      outl(PCI_CONF1_ADDRESS(pci_bus0, SPECIAL_DEV, SPECIAL_REG), 0xCF8); */
176         outl(PIIX_SPECIAL_STOP, 0xCFC);
177 }
178
179 static int __init visws_get_smp_config(unsigned int early)
180 {
181         /*
182          * Prevent MP-table parsing by the generic code:
183          */
184         return 1;
185 }
186
187 /*
188  * The Visual Workstation is Intel MP compliant in the hardware
189  * sense, but it doesn't have a BIOS(-configuration table).
190  * No problem for Linux.
191  */
192
193 static void __init MP_processor_info(struct mpc_config_processor *m)
194 {
195         int ver, logical_apicid;
196         physid_mask_t apic_cpus;
197
198         if (!(m->mpc_cpuflag & CPU_ENABLED))
199                 return;
200
201         logical_apicid = m->mpc_apicid;
202         printk(KERN_INFO "%sCPU #%d %u:%u APIC version %d\n",
203                m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
204                m->mpc_apicid,
205                (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
206                (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
207                m->mpc_apicver);
208
209         if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
210                 boot_cpu_physical_apicid = m->mpc_apicid;
211
212         ver = m->mpc_apicver;
213         if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) {
214                 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
215                         m->mpc_apicid, MAX_APICS);
216                 return;
217         }
218
219         apic_cpus = apicid_to_cpu_present(m->mpc_apicid);
220         physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
221         /*
222          * Validate version
223          */
224         if (ver == 0x0) {
225                 printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
226                         "fixing up to 0x10. (tell your hw vendor)\n",
227                         m->mpc_apicid);
228                 ver = 0x10;
229         }
230         apic_version[m->mpc_apicid] = ver;
231 }
232
233 static int __init visws_find_smp_config(unsigned int reserve)
234 {
235         struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS);
236         unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
237
238         if (ncpus > CO_CPU_MAX) {
239                 printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
240                         ncpus, mp);
241
242                 ncpus = CO_CPU_MAX;
243         }
244
245         if (ncpus > setup_max_cpus)
246                 ncpus = setup_max_cpus;
247
248 #ifdef CONFIG_X86_LOCAL_APIC
249         smp_found_config = 1;
250 #endif
251         while (ncpus--)
252                 MP_processor_info(mp++);
253
254         mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
255
256         return 1;
257 }
258
259 static int visws_trap_init(void);
260
261 static struct x86_quirks visws_x86_quirks __initdata = {
262         .arch_time_init         = visws_time_init,
263         .arch_pre_intr_init     = visws_pre_intr_init,
264         .arch_memory_setup      = visws_memory_setup,
265         .arch_intr_init         = NULL,
266         .arch_trap_init         = visws_trap_init,
267         .mach_get_smp_config    = visws_get_smp_config,
268         .mach_find_smp_config   = visws_find_smp_config,
269 };
270
271 void __init visws_early_detect(void)
272 {
273         int raw;
274
275         visws_board_type = (char)(inb_p(PIIX_GPI_BD_REG) & PIIX_GPI_BD_REG)
276                                                          >> PIIX_GPI_BD_SHIFT;
277
278         if (visws_board_type < 0)
279                 return;
280
281         /*
282          * Install special quirks for timer, interrupt and memory setup:
283          * Fall back to generic behavior for traps:
284          * Override generic MP-table parsing:
285          */
286         x86_quirks = &visws_x86_quirks;
287
288         /*
289          * Install reboot quirks:
290          */
291         pm_power_off                    = visws_machine_power_off;
292         machine_ops.emergency_restart   = visws_machine_emergency_restart;
293
294         /*
295          * Do not use broadcast IPIs:
296          */
297         no_broadcast = 0;
298
299 #ifdef CONFIG_X86_IO_APIC
300         /*
301          * Turn off IO-APIC detection and initialization:
302          */
303         skip_ioapic_setup               = 1;
304 #endif
305
306         /*
307          * Get Board rev.
308          * First, we have to initialize the 307 part to allow us access
309          * to the GPIO registers.  Let's map them at 0x0fc0 which is right
310          * after the PIIX4 PM section.
311          */
312         outb_p(SIO_DEV_SEL, SIO_INDEX);
313         outb_p(SIO_GP_DEV, SIO_DATA);   /* Talk to GPIO regs. */
314
315         outb_p(SIO_DEV_MSB, SIO_INDEX);
316         outb_p(SIO_GP_MSB, SIO_DATA);   /* MSB of GPIO base address */
317
318         outb_p(SIO_DEV_LSB, SIO_INDEX);
319         outb_p(SIO_GP_LSB, SIO_DATA);   /* LSB of GPIO base address */
320
321         outb_p(SIO_DEV_ENB, SIO_INDEX);
322         outb_p(1, SIO_DATA);            /* Enable GPIO registers. */
323
324         /*
325          * Now, we have to map the power management section to write
326          * a bit which enables access to the GPIO registers.
327          * What lunatic came up with this shit?
328          */
329         outb_p(SIO_DEV_SEL, SIO_INDEX);
330         outb_p(SIO_PM_DEV, SIO_DATA);   /* Talk to GPIO regs. */
331
332         outb_p(SIO_DEV_MSB, SIO_INDEX);
333         outb_p(SIO_PM_MSB, SIO_DATA);   /* MSB of PM base address */
334
335         outb_p(SIO_DEV_LSB, SIO_INDEX);
336         outb_p(SIO_PM_LSB, SIO_DATA);   /* LSB of PM base address */
337
338         outb_p(SIO_DEV_ENB, SIO_INDEX);
339         outb_p(1, SIO_DATA);            /* Enable PM registers. */
340
341         /*
342          * Now, write the PM register which enables the GPIO registers.
343          */
344         outb_p(SIO_PM_FER2, SIO_PM_INDEX);
345         outb_p(SIO_PM_GP_EN, SIO_PM_DATA);
346
347         /*
348          * Now, initialize the GPIO registers.
349          * We want them all to be inputs which is the
350          * power on default, so let's leave them alone.
351          * So, let's just read the board rev!
352          */
353         raw = inb_p(SIO_GP_DATA1);
354         raw &= 0x7f;    /* 7 bits of valid board revision ID. */
355
356         if (visws_board_type == VISWS_320) {
357                 if (raw < 0x6) {
358                         visws_board_rev = 4;
359                 } else if (raw < 0xc) {
360                         visws_board_rev = 5;
361                 } else {
362                         visws_board_rev = 6;
363                 }
364         } else if (visws_board_type == VISWS_540) {
365                         visws_board_rev = 2;
366                 } else {
367                         visws_board_rev = raw;
368                 }
369
370         printk(KERN_INFO "Silicon Graphics Visual Workstation %s (rev %d) detected\n",
371                (visws_board_type == VISWS_320 ? "320" :
372                (visws_board_type == VISWS_540 ? "540" :
373                 "unknown")), visws_board_rev);
374 }
375
376 #define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4)
377 #define BCD (LI_INTB | LI_INTC | LI_INTD)
378 #define ALLDEVS (A01234 | BCD)
379
380 static __init void lithium_init(void)
381 {
382         set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
383         set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
384
385         if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
386             (li_pcia_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
387                 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
388 /*              panic("This machine is not SGI Visual Workstation 320/540"); */
389         }
390
391         if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
392             (li_pcib_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
393                 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
394 /*              panic("This machine is not SGI Visual Workstation 320/540"); */
395         }
396
397         li_pcia_write16(LI_PCI_INTEN, ALLDEVS);
398         li_pcib_write16(LI_PCI_INTEN, ALLDEVS);
399 }
400
401 static __init void cobalt_init(void)
402 {
403         /*
404          * On normal SMP PC this is used only with SMP, but we have to
405          * use it and set it up here to start the Cobalt clock
406          */
407         set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
408         setup_local_APIC();
409         printk(KERN_INFO "Local APIC Version %#x, ID %#x\n",
410                 (unsigned int)apic_read(APIC_LVR),
411                 (unsigned int)apic_read(APIC_ID));
412
413         set_fixmap(FIX_CO_CPU, CO_CPU_PHYS);
414         set_fixmap(FIX_CO_APIC, CO_APIC_PHYS);
415         printk(KERN_INFO "Cobalt Revision %#lx, APIC ID %#lx\n",
416                 co_cpu_read(CO_CPU_REV), co_apic_read(CO_APIC_ID));
417
418         /* Enable Cobalt APIC being careful to NOT change the ID! */
419         co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID) | CO_APIC_ENABLE);
420
421         printk(KERN_INFO "Cobalt APIC enabled: ID reg %#lx\n",
422                 co_apic_read(CO_APIC_ID));
423 }
424
425 static int __init visws_trap_init(void)
426 {
427         lithium_init();
428         cobalt_init();
429
430         return 1;
431 }
432
433 /*
434  * IRQ controller / APIC support:
435  */
436
437 static DEFINE_SPINLOCK(cobalt_lock);
438
439 /*
440  * Set the given Cobalt APIC Redirection Table entry to point
441  * to the given IDT vector/index.
442  */
443 static inline void co_apic_set(int entry, int irq)
444 {
445         co_apic_write(CO_APIC_LO(entry), CO_APIC_LEVEL | (irq + FIRST_EXTERNAL_VECTOR));
446         co_apic_write(CO_APIC_HI(entry), 0);
447 }
448
449 /*
450  * Cobalt (IO)-APIC functions to handle PCI devices.
451  */
452 static inline int co_apic_ide0_hack(void)
453 {
454         extern char visws_board_type;
455         extern char visws_board_rev;
456
457         if (visws_board_type == VISWS_320 && visws_board_rev == 5)
458                 return 5;
459         return CO_APIC_IDE0;
460 }
461
462 static int is_co_apic(unsigned int irq)
463 {
464         if (IS_CO_APIC(irq))
465                 return CO_APIC(irq);
466
467         switch (irq) {
468                 case 0: return CO_APIC_CPU;
469                 case CO_IRQ_IDE0: return co_apic_ide0_hack();
470                 case CO_IRQ_IDE1: return CO_APIC_IDE1;
471                 default: return -1;
472         }
473 }
474
475
476 /*
477  * This is the SGI Cobalt (IO-)APIC:
478  */
479
480 static void enable_cobalt_irq(unsigned int irq)
481 {
482         co_apic_set(is_co_apic(irq), irq);
483 }
484
485 static void disable_cobalt_irq(unsigned int irq)
486 {
487         int entry = is_co_apic(irq);
488
489         co_apic_write(CO_APIC_LO(entry), CO_APIC_MASK);
490         co_apic_read(CO_APIC_LO(entry));
491 }
492
493 /*
494  * "irq" really just serves to identify the device.  Here is where we
495  * map this to the Cobalt APIC entry where it's physically wired.
496  * This is called via request_irq -> setup_irq -> irq_desc->startup()
497  */
498 static unsigned int startup_cobalt_irq(unsigned int irq)
499 {
500         unsigned long flags;
501
502         spin_lock_irqsave(&cobalt_lock, flags);
503         if ((irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
504                 irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
505         enable_cobalt_irq(irq);
506         spin_unlock_irqrestore(&cobalt_lock, flags);
507         return 0;
508 }
509
510 static void ack_cobalt_irq(unsigned int irq)
511 {
512         unsigned long flags;
513
514         spin_lock_irqsave(&cobalt_lock, flags);
515         disable_cobalt_irq(irq);
516         apic_write(APIC_EOI, APIC_EIO_ACK);
517         spin_unlock_irqrestore(&cobalt_lock, flags);
518 }
519
520 static void end_cobalt_irq(unsigned int irq)
521 {
522         unsigned long flags;
523
524         spin_lock_irqsave(&cobalt_lock, flags);
525         if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
526                 enable_cobalt_irq(irq);
527         spin_unlock_irqrestore(&cobalt_lock, flags);
528 }
529
530 static struct irq_chip cobalt_irq_type = {
531         .typename =     "Cobalt-APIC",
532         .startup =      startup_cobalt_irq,
533         .shutdown =     disable_cobalt_irq,
534         .enable =       enable_cobalt_irq,
535         .disable =      disable_cobalt_irq,
536         .ack =          ack_cobalt_irq,
537         .end =          end_cobalt_irq,
538 };
539
540
541 /*
542  * This is the PIIX4-based 8259 that is wired up indirectly to Cobalt
543  * -- not the manner expected by the code in i8259.c.
544  *
545  * there is a 'master' physical interrupt source that gets sent to
546  * the CPU. But in the chipset there are various 'virtual' interrupts
547  * waiting to be handled. We represent this to Linux through a 'master'
548  * interrupt controller type, and through a special virtual interrupt-
549  * controller. Device drivers only see the virtual interrupt sources.
550  */
551 static unsigned int startup_piix4_master_irq(unsigned int irq)
552 {
553         init_8259A(0);
554
555         return startup_cobalt_irq(irq);
556 }
557
558 static void end_piix4_master_irq(unsigned int irq)
559 {
560         unsigned long flags;
561
562         spin_lock_irqsave(&cobalt_lock, flags);
563         enable_cobalt_irq(irq);
564         spin_unlock_irqrestore(&cobalt_lock, flags);
565 }
566
567 static struct irq_chip piix4_master_irq_type = {
568         .typename =     "PIIX4-master",
569         .startup =      startup_piix4_master_irq,
570         .ack =          ack_cobalt_irq,
571         .end =          end_piix4_master_irq,
572 };
573
574
575 static struct irq_chip piix4_virtual_irq_type = {
576         .typename =     "PIIX4-virtual",
577         .shutdown =     disable_8259A_irq,
578         .enable =       enable_8259A_irq,
579         .disable =      disable_8259A_irq,
580 };
581
582
583 /*
584  * PIIX4-8259 master/virtual functions to handle interrupt requests
585  * from legacy devices: floppy, parallel, serial, rtc.
586  *
587  * None of these get Cobalt APIC entries, neither do they have IDT
588  * entries. These interrupts are purely virtual and distributed from
589  * the 'master' interrupt source: CO_IRQ_8259.
590  *
591  * When the 8259 interrupts its handler figures out which of these
592  * devices is interrupting and dispatches to its handler.
593  *
594  * CAREFUL: devices see the 'virtual' interrupt only. Thus disable/
595  * enable_irq gets the right irq. This 'master' irq is never directly
596  * manipulated by any driver.
597  */
598 static irqreturn_t piix4_master_intr(int irq, void *dev_id)
599 {
600         int realirq;
601         irq_desc_t *desc;
602         unsigned long flags;
603
604         spin_lock_irqsave(&i8259A_lock, flags);
605
606         /* Find out what's interrupting in the PIIX4 master 8259 */
607         outb(0x0c, 0x20);               /* OCW3 Poll command */
608         realirq = inb(0x20);
609
610         /*
611          * Bit 7 == 0 means invalid/spurious
612          */
613         if (unlikely(!(realirq & 0x80)))
614                 goto out_unlock;
615
616         realirq &= 7;
617
618         if (unlikely(realirq == 2)) {
619                 outb(0x0c, 0xa0);
620                 realirq = inb(0xa0);
621
622                 if (unlikely(!(realirq & 0x80)))
623                         goto out_unlock;
624
625                 realirq = (realirq & 7) + 8;
626         }
627
628         /* mask and ack interrupt */
629         cached_irq_mask |= 1 << realirq;
630         if (unlikely(realirq > 7)) {
631                 inb(0xa1);
632                 outb(cached_slave_mask, 0xa1);
633                 outb(0x60 + (realirq & 7), 0xa0);
634                 outb(0x60 + 2, 0x20);
635         } else {
636                 inb(0x21);
637                 outb(cached_master_mask, 0x21);
638                 outb(0x60 + realirq, 0x20);
639         }
640
641         spin_unlock_irqrestore(&i8259A_lock, flags);
642
643         desc = irq_desc + realirq;
644
645         /*
646          * handle this 'virtual interrupt' as a Cobalt one now.
647          */
648         kstat_cpu(smp_processor_id()).irqs[realirq]++;
649
650         if (likely(desc->action != NULL))
651                 handle_IRQ_event(realirq, desc->action);
652
653         if (!(desc->status & IRQ_DISABLED))
654                 enable_8259A_irq(realirq);
655
656         return IRQ_HANDLED;
657
658 out_unlock:
659         spin_unlock_irqrestore(&i8259A_lock, flags);
660         return IRQ_NONE;
661 }
662
663 static struct irqaction master_action = {
664         .handler =      piix4_master_intr,
665         .name =         "PIIX4-8259",
666 };
667
668 static struct irqaction cascade_action = {
669         .handler =      no_action,
670         .name =         "cascade",
671 };
672
673
674 void init_VISWS_APIC_irqs(void)
675 {
676         int i;
677
678         for (i = 0; i < CO_IRQ_APIC0 + CO_APIC_LAST + 1; i++) {
679                 irq_desc[i].status = IRQ_DISABLED;
680                 irq_desc[i].action = 0;
681                 irq_desc[i].depth = 1;
682
683                 if (i == 0) {
684                         irq_desc[i].chip = &cobalt_irq_type;
685                 }
686                 else if (i == CO_IRQ_IDE0) {
687                         irq_desc[i].chip = &cobalt_irq_type;
688                 }
689                 else if (i == CO_IRQ_IDE1) {
690                         irq_desc[i].chip = &cobalt_irq_type;
691                 }
692                 else if (i == CO_IRQ_8259) {
693                         irq_desc[i].chip = &piix4_master_irq_type;
694                 }
695                 else if (i < CO_IRQ_APIC0) {
696                         irq_desc[i].chip = &piix4_virtual_irq_type;
697                 }
698                 else if (IS_CO_APIC(i)) {
699                         irq_desc[i].chip = &cobalt_irq_type;
700                 }
701         }
702
703         setup_irq(CO_IRQ_8259, &master_action);
704         setup_irq(2, &cascade_action);
705 }