This source file includes following definitions.
- iosapic_read
- iosapic_write
- iosapic_eoi
- iosapic_alloc_irt
- iosapic_load_irt
- iosapic_init
- irt_find_irqline
- iosapic_xlate_pin
- iosapic_rd_irt_entry
- iosapic_wr_irt_entry
- iosapic_set_irt_data
- iosapic_mask_irq
- iosapic_unmask_irq
- iosapic_eoi_irq
- iosapic_set_affinity_irq
- iosapic_fixup_irq
- iosapic_serial_irq
- iosapic_rd_version
- iosapic_register
- iosapic_prt_irt
- iosapic_prt_vi
- iosapic_prt_isi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126 #include <linux/pci.h>
127
128 #include <asm/pdc.h>
129 #include <asm/pdcpat.h>
130 #ifdef CONFIG_SUPERIO
131 #include <asm/superio.h>
132 #endif
133
134 #include <asm/ropes.h>
135 #include "iosapic_private.h"
136
137 #define MODULE_NAME "iosapic"
138
139
140 #undef PCI_BRIDGE_FUNCS
141 #undef DEBUG_IOSAPIC
142 #undef DEBUG_IOSAPIC_IRT
143
144
145 #ifdef DEBUG_IOSAPIC
146 #define DBG(x...) printk(x)
147 #else
148 #define DBG(x...)
149 #endif
150
151 #ifdef DEBUG_IOSAPIC_IRT
152 #define DBG_IRT(x...) printk(x)
153 #else
154 #define DBG_IRT(x...)
155 #endif
156
157 #ifdef CONFIG_64BIT
158 #define COMPARE_IRTE_ADDR(irte, hpa) ((irte)->dest_iosapic_addr == (hpa))
159 #else
160 #define COMPARE_IRTE_ADDR(irte, hpa) \
161 ((irte)->dest_iosapic_addr == ((hpa) | 0xffffffff00000000ULL))
162 #endif
163
164 #define IOSAPIC_REG_SELECT 0x00
165 #define IOSAPIC_REG_WINDOW 0x10
166 #define IOSAPIC_REG_EOI 0x40
167
168 #define IOSAPIC_REG_VERSION 0x1
169
170 #define IOSAPIC_IRDT_ENTRY(idx) (0x10+(idx)*2)
171 #define IOSAPIC_IRDT_ENTRY_HI(idx) (0x11+(idx)*2)
172
173 static inline unsigned int iosapic_read(void __iomem *iosapic, unsigned int reg)
174 {
175 writel(reg, iosapic + IOSAPIC_REG_SELECT);
176 return readl(iosapic + IOSAPIC_REG_WINDOW);
177 }
178
179 static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 val)
180 {
181 writel(reg, iosapic + IOSAPIC_REG_SELECT);
182 writel(val, iosapic + IOSAPIC_REG_WINDOW);
183 }
184
185 #define IOSAPIC_VERSION_MASK 0x000000ff
186 #define IOSAPIC_VERSION(ver) ((int) (ver & IOSAPIC_VERSION_MASK))
187
188 #define IOSAPIC_MAX_ENTRY_MASK 0x00ff0000
189 #define IOSAPIC_MAX_ENTRY_SHIFT 0x10
190 #define IOSAPIC_IRDT_MAX_ENTRY(ver) \
191 (int) (((ver) & IOSAPIC_MAX_ENTRY_MASK) >> IOSAPIC_MAX_ENTRY_SHIFT)
192
193
194 #define IOSAPIC_IRDT_ENABLE 0x10000
195 #define IOSAPIC_IRDT_PO_LOW 0x02000
196 #define IOSAPIC_IRDT_LEVEL_TRIG 0x08000
197 #define IOSAPIC_IRDT_MODE_LPRI 0x00100
198
199
200 #define IOSAPIC_IRDT_ID_EID_SHIFT 0x10
201
202
203 static DEFINE_SPINLOCK(iosapic_lock);
204
205 static inline void iosapic_eoi(void __iomem *addr, unsigned int data)
206 {
207 __raw_writel(data, addr);
208 }
209
210
211
212
213
214
215
216
217
218
219 static struct irt_entry *irt_cell;
220 static size_t irt_num_entry;
221
222 static struct irt_entry *iosapic_alloc_irt(int num_entries)
223 {
224 unsigned long a;
225
226
227
228
229
230
231 a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL);
232 a = (a + 7UL) & ~7UL;
233 return (struct irt_entry *)a;
234 }
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263 static int __init
264 iosapic_load_irt(unsigned long cell_num, struct irt_entry **irt)
265 {
266 long status;
267 struct irt_entry *table;
268 unsigned long num_entries = 0UL;
269
270 BUG_ON(!irt);
271
272 if (is_pdc_pat()) {
273
274 DBG("calling get_irt_size (cell %ld)\n", cell_num);
275 status = pdc_pat_get_irt_size(&num_entries, cell_num);
276 DBG("get_irt_size: %ld\n", status);
277
278 BUG_ON(status != PDC_OK);
279 BUG_ON(num_entries == 0);
280
281
282
283
284
285
286
287 table = iosapic_alloc_irt(num_entries);
288 if (table == NULL) {
289 printk(KERN_WARNING MODULE_NAME ": read_irt : can "
290 "not alloc mem for IRT\n");
291 return 0;
292 }
293
294
295 status = pdc_pat_get_irt(table, cell_num);
296 DBG("pdc_pat_get_irt: %ld\n", status);
297 WARN_ON(status != PDC_OK);
298 } else {
299
300
301
302
303
304 if (irt_cell)
305 return 0;
306
307
308 status = pdc_pci_irt_size(&num_entries, 0);
309 DBG("pdc_pci_irt_size: %ld\n", status);
310
311 if (status != PDC_OK) {
312
313 return 0;
314 }
315
316 BUG_ON(num_entries == 0);
317
318 table = iosapic_alloc_irt(num_entries);
319 if (!table) {
320 printk(KERN_WARNING MODULE_NAME ": read_irt : can "
321 "not alloc mem for IRT\n");
322 return 0;
323 }
324
325
326 status = pdc_pci_irt(num_entries, 0, table);
327 BUG_ON(status != PDC_OK);
328 }
329
330
331 *irt = table;
332
333 #ifdef DEBUG_IOSAPIC_IRT
334 {
335 struct irt_entry *p = table;
336 int i;
337
338 printk(MODULE_NAME " Interrupt Routing Table (cell %ld)\n", cell_num);
339 printk(MODULE_NAME " start = 0x%p num_entries %ld entry_size %d\n",
340 table,
341 num_entries,
342 (int) sizeof(struct irt_entry));
343
344 for (i = 0 ; i < num_entries ; i++, p++) {
345 printk(MODULE_NAME " %02x %02x %02x %02x %02x %02x %02x %02x %08x%08x\n",
346 p->entry_type, p->entry_length, p->interrupt_type,
347 p->polarity_trigger, p->src_bus_irq_devno, p->src_bus_id,
348 p->src_seg_id, p->dest_iosapic_intin,
349 ((u32 *) p)[2],
350 ((u32 *) p)[3]
351 );
352 }
353 }
354 #endif
355
356 return num_entries;
357 }
358
359
360
361 void __init iosapic_init(void)
362 {
363 unsigned long cell = 0;
364
365 DBG("iosapic_init()\n");
366
367 #ifdef __LP64__
368 if (is_pdc_pat()) {
369 int status;
370 struct pdc_pat_cell_num cell_info;
371
372 status = pdc_pat_cell_get_number(&cell_info);
373 if (status == PDC_OK) {
374 cell = cell_info.cell_num;
375 }
376 }
377 #endif
378
379
380 irt_num_entry = iosapic_load_irt(cell, &irt_cell);
381 if (irt_num_entry == 0)
382 irt_cell = NULL;
383 }
384
385
386
387
388
389 static struct irt_entry *
390 irt_find_irqline(struct iosapic_info *isi, u8 slot, u8 intr_pin)
391 {
392 struct irt_entry *i = irt_cell;
393 int cnt;
394 u8 irq_devno = (slot << IRT_DEV_SHIFT) | (intr_pin-1);
395
396 DBG_IRT("irt_find_irqline() SLOT %d pin %d\n", slot, intr_pin);
397
398 for (cnt=0; cnt < irt_num_entry; cnt++, i++) {
399
400
401
402
403
404
405
406
407 if (i->entry_type != IRT_IOSAPIC_TYPE) {
408 DBG_IRT(KERN_WARNING MODULE_NAME ":find_irqline(0x%p): skipping entry %d type %d\n", i, cnt, i->entry_type);
409 continue;
410 }
411
412 if (i->entry_length != IRT_IOSAPIC_LENGTH) {
413 DBG_IRT(KERN_WARNING MODULE_NAME ":find_irqline(0x%p): skipping entry %d length %d\n", i, cnt, i->entry_length);
414 continue;
415 }
416
417 if (i->interrupt_type != IRT_VECTORED_INTR) {
418 DBG_IRT(KERN_WARNING MODULE_NAME ":find_irqline(0x%p): skipping entry %d interrupt_type %d\n", i, cnt, i->interrupt_type);
419 continue;
420 }
421
422 if (!COMPARE_IRTE_ADDR(i, isi->isi_hpa))
423 continue;
424
425 if ((i->src_bus_irq_devno & IRT_IRQ_DEVNO_MASK) != irq_devno)
426 continue;
427
428
429
430
431
432
433
434
435
436 return i;
437 }
438
439 printk(KERN_WARNING MODULE_NAME ": 0x%lx : no IRT entry for slot %d, pin %d\n",
440 isi->isi_hpa, slot, intr_pin);
441 return NULL;
442 }
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459 static struct irt_entry *
460 iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev)
461 {
462 u8 intr_pin, intr_slot;
463
464 pci_read_config_byte(pcidev, PCI_INTERRUPT_PIN, &intr_pin);
465
466 DBG_IRT("iosapic_xlate_pin(%s) SLOT %d pin %d\n",
467 pcidev->slot_name, PCI_SLOT(pcidev->devfn), intr_pin);
468
469 if (intr_pin == 0) {
470
471 return NULL;
472 }
473
474
475 if (pcidev->bus->parent) {
476
477
478
479 #ifdef PCI_BRIDGE_FUNCS
480
481
482
483
484
485
486
487
488
489 if (pci_bridge_funcs->xlate_intr_line) {
490 intr_pin = pci_bridge_funcs->xlate_intr_line(pcidev);
491 }
492 #else
493 struct pci_bus *p = pcidev->bus;
494
495
496
497
498
499
500
501
502
503
504
505
506
507 intr_pin = pci_swizzle_interrupt_pin(pcidev, intr_pin);
508 #endif
509
510
511
512
513 while (p->parent->parent)
514 p = p->parent;
515
516 intr_slot = PCI_SLOT(p->self->devfn);
517 } else {
518 intr_slot = PCI_SLOT(pcidev->devfn);
519 }
520 DBG_IRT("iosapic_xlate_pin: bus %d slot %d pin %d\n",
521 pcidev->bus->busn_res.start, intr_slot, intr_pin);
522
523 return irt_find_irqline(isi, intr_slot, intr_pin);
524 }
525
526 static void iosapic_rd_irt_entry(struct vector_info *vi , u32 *dp0, u32 *dp1)
527 {
528 struct iosapic_info *isp = vi->iosapic;
529 u8 idx = vi->irqline;
530
531 *dp0 = iosapic_read(isp->addr, IOSAPIC_IRDT_ENTRY(idx));
532 *dp1 = iosapic_read(isp->addr, IOSAPIC_IRDT_ENTRY_HI(idx));
533 }
534
535
536 static void iosapic_wr_irt_entry(struct vector_info *vi, u32 dp0, u32 dp1)
537 {
538 struct iosapic_info *isp = vi->iosapic;
539
540 DBG_IRT("iosapic_wr_irt_entry(): irq %d hpa %lx 0x%x 0x%x\n",
541 vi->irqline, isp->isi_hpa, dp0, dp1);
542
543 iosapic_write(isp->addr, IOSAPIC_IRDT_ENTRY(vi->irqline), dp0);
544
545
546 dp0 = readl(isp->addr+IOSAPIC_REG_WINDOW);
547
548 iosapic_write(isp->addr, IOSAPIC_IRDT_ENTRY_HI(vi->irqline), dp1);
549
550
551 dp1 = readl(isp->addr+IOSAPIC_REG_WINDOW);
552 }
553
554
555
556
557
558
559 static void
560 iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1)
561 {
562 u32 mode = 0;
563 struct irt_entry *p = vi->irte;
564
565 if ((p->polarity_trigger & IRT_PO_MASK) == IRT_ACTIVE_LO)
566 mode |= IOSAPIC_IRDT_PO_LOW;
567
568 if (((p->polarity_trigger >> IRT_EL_SHIFT) & IRT_EL_MASK) == IRT_LEVEL_TRIG)
569 mode |= IOSAPIC_IRDT_LEVEL_TRIG;
570
571
572
573
574
575
576 *dp0 = mode | (u32) vi->txn_data;
577
578
579
580
581
582 if (is_pdc_pat()) {
583
584
585
586
587 *dp1 = (u32) (vi->txn_addr);
588 } else {
589
590
591
592
593
594
595
596 *dp1 = (((u32)vi->txn_addr & 0x0ff00000) >> 4) |
597 (((u32)vi->txn_addr & 0x000ff000) << 12);
598 }
599 DBG_IRT("iosapic_set_irt_data(): 0x%x 0x%x\n", *dp0, *dp1);
600 }
601
602
603 static void iosapic_mask_irq(struct irq_data *d)
604 {
605 unsigned long flags;
606 struct vector_info *vi = irq_data_get_irq_chip_data(d);
607 u32 d0, d1;
608
609 spin_lock_irqsave(&iosapic_lock, flags);
610 iosapic_rd_irt_entry(vi, &d0, &d1);
611 d0 |= IOSAPIC_IRDT_ENABLE;
612 iosapic_wr_irt_entry(vi, d0, d1);
613 spin_unlock_irqrestore(&iosapic_lock, flags);
614 }
615
616 static void iosapic_unmask_irq(struct irq_data *d)
617 {
618 struct vector_info *vi = irq_data_get_irq_chip_data(d);
619 u32 d0, d1;
620
621
622 WARN_ON(vi->txn_irq == 0);
623
624 iosapic_set_irt_data(vi, &d0, &d1);
625 iosapic_wr_irt_entry(vi, d0, d1);
626
627 #ifdef DEBUG_IOSAPIC_IRT
628 {
629 u32 *t = (u32 *) ((ulong) vi->eoi_addr & ~0xffUL);
630 printk("iosapic_enable_irq(): regs %p", vi->eoi_addr);
631 for ( ; t < vi->eoi_addr; t++)
632 printk(" %x", readl(t));
633 printk("\n");
634 }
635
636 printk("iosapic_enable_irq(): sel ");
637 {
638 struct iosapic_info *isp = vi->iosapic;
639
640 for (d0=0x10; d0<0x1e; d0++) {
641 d1 = iosapic_read(isp->addr, d0);
642 printk(" %x", d1);
643 }
644 }
645 printk("\n");
646 #endif
647
648
649
650
651
652
653
654 DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", d->irq,
655 vi->eoi_addr, vi->eoi_data);
656 iosapic_eoi(vi->eoi_addr, vi->eoi_data);
657 }
658
659 static void iosapic_eoi_irq(struct irq_data *d)
660 {
661 struct vector_info *vi = irq_data_get_irq_chip_data(d);
662
663 iosapic_eoi(vi->eoi_addr, vi->eoi_data);
664 cpu_eoi_irq(d);
665 }
666
667 #ifdef CONFIG_SMP
668 static int iosapic_set_affinity_irq(struct irq_data *d,
669 const struct cpumask *dest, bool force)
670 {
671 struct vector_info *vi = irq_data_get_irq_chip_data(d);
672 u32 d0, d1, dummy_d0;
673 unsigned long flags;
674 int dest_cpu;
675
676 dest_cpu = cpu_check_affinity(d, dest);
677 if (dest_cpu < 0)
678 return -1;
679
680 cpumask_copy(irq_data_get_affinity_mask(d), cpumask_of(dest_cpu));
681 vi->txn_addr = txn_affinity_addr(d->irq, dest_cpu);
682
683 spin_lock_irqsave(&iosapic_lock, flags);
684
685
686 iosapic_rd_irt_entry(vi, &d0, &d1);
687 iosapic_set_irt_data(vi, &dummy_d0, &d1);
688 iosapic_wr_irt_entry(vi, d0, d1);
689 spin_unlock_irqrestore(&iosapic_lock, flags);
690
691 return 0;
692 }
693 #endif
694
695 static struct irq_chip iosapic_interrupt_type = {
696 .name = "IO-SAPIC-level",
697 .irq_unmask = iosapic_unmask_irq,
698 .irq_mask = iosapic_mask_irq,
699 .irq_ack = cpu_ack_irq,
700 .irq_eoi = iosapic_eoi_irq,
701 #ifdef CONFIG_SMP
702 .irq_set_affinity = iosapic_set_affinity_irq,
703 #endif
704 };
705
706 int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev)
707 {
708 struct iosapic_info *isi = isi_obj;
709 struct irt_entry *irte = NULL;
710 struct vector_info *vi;
711 int isi_line;
712
713 if (!isi) {
714 printk(KERN_WARNING MODULE_NAME ": hpa not registered for %s\n",
715 pci_name(pcidev));
716 return -1;
717 }
718
719 #ifdef CONFIG_SUPERIO
720
721
722
723
724
725
726
727
728 if (is_superio_device(pcidev)) {
729
730 pcidev->irq = superio_fixup_irq(pcidev);
731
732
733 if (PCI_FUNC(pcidev->devfn) != SUPERIO_USB_FN)
734 return pcidev->irq;
735 }
736 #endif
737
738
739 irte = iosapic_xlate_pin(isi, pcidev);
740 if (!irte) {
741 printk("iosapic: no IRTE for %s (IRQ not connected?)\n",
742 pci_name(pcidev));
743 return -1;
744 }
745 DBG_IRT("iosapic_fixup_irq(): irte %p %x %x %x %x %x %x %x %x\n",
746 irte,
747 irte->entry_type,
748 irte->entry_length,
749 irte->polarity_trigger,
750 irte->src_bus_irq_devno,
751 irte->src_bus_id,
752 irte->src_seg_id,
753 irte->dest_iosapic_intin,
754 (u32) irte->dest_iosapic_addr);
755 isi_line = irte->dest_iosapic_intin;
756
757
758 vi = isi->isi_vector + isi_line;
759 DBG_IRT("iosapic_fixup_irq: line %d vi 0x%p\n", isi_line, vi);
760
761
762 if (vi->irte)
763 goto out;
764
765 vi->irte = irte;
766
767
768
769
770
771
772
773
774
775
776 vi->txn_irq = txn_alloc_irq(8);
777
778 if (vi->txn_irq < 0)
779 panic("I/O sapic: couldn't get TXN IRQ\n");
780
781
782 vi->txn_addr = txn_alloc_addr(vi->txn_irq);
783 vi->txn_data = txn_alloc_data(vi->txn_irq);
784
785 vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI;
786 vi->eoi_data = cpu_to_le32(vi->txn_data);
787
788 cpu_claim_irq(vi->txn_irq, &iosapic_interrupt_type, vi);
789
790 out:
791 pcidev->irq = vi->txn_irq;
792
793 DBG_IRT("iosapic_fixup_irq() %d:%d %x %x line %d irq %d\n",
794 PCI_SLOT(pcidev->devfn), PCI_FUNC(pcidev->devfn),
795 pcidev->vendor, pcidev->device, isi_line, pcidev->irq);
796
797 return pcidev->irq;
798 }
799
800 static struct iosapic_info *iosapic_list;
801
802 #ifdef CONFIG_64BIT
803 int iosapic_serial_irq(struct parisc_device *dev)
804 {
805 struct iosapic_info *isi;
806 struct irt_entry *irte;
807 struct vector_info *vi;
808 int cnt;
809 int intin;
810
811 intin = (dev->mod_info >> 24) & 15;
812
813
814 for (cnt = 0; cnt < irt_num_entry; cnt++) {
815 irte = &irt_cell[cnt];
816 if (COMPARE_IRTE_ADDR(irte, dev->mod0) &&
817 irte->dest_iosapic_intin == intin)
818 break;
819 }
820 if (cnt >= irt_num_entry)
821 return 0;
822
823 DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n",
824 irte,
825 irte->entry_type,
826 irte->entry_length,
827 irte->polarity_trigger,
828 irte->src_bus_irq_devno,
829 irte->src_bus_id,
830 irte->src_seg_id,
831 irte->dest_iosapic_intin,
832 (u32) irte->dest_iosapic_addr);
833
834
835 for (isi = iosapic_list; isi; isi = isi->isi_next)
836 if (isi->isi_hpa == dev->mod0)
837 break;
838 if (!isi)
839 return 0;
840
841
842 vi = isi->isi_vector + intin;
843 DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", iosapic_intin, vi);
844
845
846 if (vi->irte)
847 goto out;
848
849 vi->irte = irte;
850
851
852
853
854
855
856
857
858
859
860 vi->txn_irq = txn_alloc_irq(8);
861
862 if (vi->txn_irq < 0)
863 panic("I/O sapic: couldn't get TXN IRQ\n");
864
865
866 vi->txn_addr = txn_alloc_addr(vi->txn_irq);
867 vi->txn_data = txn_alloc_data(vi->txn_irq);
868
869 vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI;
870 vi->eoi_data = cpu_to_le32(vi->txn_data);
871
872 cpu_claim_irq(vi->txn_irq, &iosapic_interrupt_type, vi);
873
874 out:
875
876 return vi->txn_irq;
877 }
878 #endif
879
880
881
882
883
884 static unsigned int
885 iosapic_rd_version(struct iosapic_info *isi)
886 {
887 return iosapic_read(isi->addr, IOSAPIC_REG_VERSION);
888 }
889
890
891
892
893
894
895
896
897
898
899
900
901 void *iosapic_register(unsigned long hpa)
902 {
903 struct iosapic_info *isi = NULL;
904 struct irt_entry *irte = irt_cell;
905 struct vector_info *vip;
906 int cnt;
907
908
909
910
911
912
913 for (cnt=0; cnt < irt_num_entry; cnt++, irte++) {
914 WARN_ON(IRT_IOSAPIC_TYPE != irte->entry_type);
915 if (COMPARE_IRTE_ADDR(irte, hpa))
916 break;
917 }
918
919 if (cnt >= irt_num_entry) {
920 DBG("iosapic_register() ignoring 0x%lx (NOT FOUND)\n", hpa);
921 return NULL;
922 }
923
924 isi = kzalloc(sizeof(struct iosapic_info), GFP_KERNEL);
925 if (!isi) {
926 BUG();
927 return NULL;
928 }
929
930 isi->addr = ioremap_nocache(hpa, 4096);
931 isi->isi_hpa = hpa;
932 isi->isi_version = iosapic_rd_version(isi);
933 isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1;
934
935 vip = isi->isi_vector = kcalloc(isi->isi_num_vectors,
936 sizeof(struct vector_info), GFP_KERNEL);
937 if (vip == NULL) {
938 kfree(isi);
939 return NULL;
940 }
941
942 for (cnt=0; cnt < isi->isi_num_vectors; cnt++, vip++) {
943 vip->irqline = (unsigned char) cnt;
944 vip->iosapic = isi;
945 }
946 isi->isi_next = iosapic_list;
947 iosapic_list = isi;
948 return isi;
949 }
950
951
952 #ifdef DEBUG_IOSAPIC
953
954 static void
955 iosapic_prt_irt(void *irt, long num_entry)
956 {
957 unsigned int i, *irp = (unsigned int *) irt;
958
959
960 printk(KERN_DEBUG MODULE_NAME ": Interrupt Routing Table (%lx entries)\n", num_entry);
961
962 for (i=0; i<num_entry; i++, irp += 4) {
963 printk(KERN_DEBUG "%p : %2d %.8x %.8x %.8x %.8x\n",
964 irp, i, irp[0], irp[1], irp[2], irp[3]);
965 }
966 }
967
968
969 static void
970 iosapic_prt_vi(struct vector_info *vi)
971 {
972 printk(KERN_DEBUG MODULE_NAME ": vector_info[%d] is at %p\n", vi->irqline, vi);
973 printk(KERN_DEBUG "\t\tstatus: %.4x\n", vi->status);
974 printk(KERN_DEBUG "\t\ttxn_irq: %d\n", vi->txn_irq);
975 printk(KERN_DEBUG "\t\ttxn_addr: %lx\n", vi->txn_addr);
976 printk(KERN_DEBUG "\t\ttxn_data: %lx\n", vi->txn_data);
977 printk(KERN_DEBUG "\t\teoi_addr: %p\n", vi->eoi_addr);
978 printk(KERN_DEBUG "\t\teoi_data: %x\n", vi->eoi_data);
979 }
980
981
982 static void
983 iosapic_prt_isi(struct iosapic_info *isi)
984 {
985 printk(KERN_DEBUG MODULE_NAME ": io_sapic_info at %p\n", isi);
986 printk(KERN_DEBUG "\t\tisi_hpa: %lx\n", isi->isi_hpa);
987 printk(KERN_DEBUG "\t\tisi_status: %x\n", isi->isi_status);
988 printk(KERN_DEBUG "\t\tisi_version: %x\n", isi->isi_version);
989 printk(KERN_DEBUG "\t\tisi_vector: %p\n", isi->isi_vector);
990 }
991 #endif