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