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