aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-09-28 10:18:39 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 10:53:37 -0400
commitd0fbca8f9304d1760fdc906b35b06e89fbdbb51f (patch)
tree4f831294a9cd4d2f46298c45fccfc57a942f04f0 /arch/x86
parent90297c5fe71d32a2a0ead38bd8f6b1112a2e5ac0 (diff)
x86: ioapic/hpet: Convert to new chip functions
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/hpet.h10
-rw-r--r--arch/x86/kernel/apic/io_apic.c30
-rw-r--r--arch/x86/kernel/hpet.c16
3 files changed, 26 insertions, 30 deletions
diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h
index 1d5c08a1bdfd..2c392d663dce 100644
--- a/arch/x86/include/asm/hpet.h
+++ b/arch/x86/include/asm/hpet.h
@@ -74,10 +74,12 @@ extern void hpet_disable(void);
74extern unsigned int hpet_readl(unsigned int a); 74extern unsigned int hpet_readl(unsigned int a);
75extern void force_hpet_resume(void); 75extern void force_hpet_resume(void);
76 76
77extern void hpet_msi_unmask(unsigned int irq); 77struct irq_data;
78extern void hpet_msi_mask(unsigned int irq); 78extern void hpet_msi_unmask(struct irq_data *data);
79extern void hpet_msi_write(unsigned int irq, struct msi_msg *msg); 79extern void hpet_msi_mask(struct irq_data *data);
80extern void hpet_msi_read(unsigned int irq, struct msi_msg *msg); 80struct hpet_dev;
81extern void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg);
82extern void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg);
81 83
82#ifdef CONFIG_PCI_MSI 84#ifdef CONFIG_PCI_MSI
83extern int arch_setup_hpet_msi(unsigned int irq, unsigned int id); 85extern int arch_setup_hpet_msi(unsigned int irq, unsigned int id);
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index b8b013f0cfdd..49aa857ff004 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3605,26 +3605,25 @@ int arch_setup_dmar_msi(unsigned int irq)
3605#ifdef CONFIG_HPET_TIMER 3605#ifdef CONFIG_HPET_TIMER
3606 3606
3607#ifdef CONFIG_SMP 3607#ifdef CONFIG_SMP
3608static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask) 3608static int hpet_msi_set_affinity(struct irq_data *data,
3609 const struct cpumask *mask, bool force)
3609{ 3610{
3610 struct irq_desc *desc = irq_to_desc(irq); 3611 struct irq_desc *desc = irq_to_desc(data->irq);
3611 struct irq_cfg *cfg; 3612 struct irq_cfg *cfg = data->chip_data;
3612 struct msi_msg msg; 3613 struct msi_msg msg;
3613 unsigned int dest; 3614 unsigned int dest;
3614 3615
3615 if (set_desc_affinity(desc, mask, &dest)) 3616 if (set_desc_affinity(desc, mask, &dest))
3616 return -1; 3617 return -1;
3617 3618
3618 cfg = get_irq_desc_chip_data(desc); 3619 hpet_msi_read(data->handler_data, &msg);
3619
3620 hpet_msi_read(irq, &msg);
3621 3620
3622 msg.data &= ~MSI_DATA_VECTOR_MASK; 3621 msg.data &= ~MSI_DATA_VECTOR_MASK;
3623 msg.data |= MSI_DATA_VECTOR(cfg->vector); 3622 msg.data |= MSI_DATA_VECTOR(cfg->vector);
3624 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; 3623 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
3625 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 3624 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
3626 3625
3627 hpet_msi_write(irq, &msg); 3626 hpet_msi_write(data->handler_data, &msg);
3628 3627
3629 return 0; 3628 return 0;
3630} 3629}
@@ -3633,8 +3632,8 @@ static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
3633 3632
3634static struct irq_chip ir_hpet_msi_type = { 3633static struct irq_chip ir_hpet_msi_type = {
3635 .name = "IR-HPET_MSI", 3634 .name = "IR-HPET_MSI",
3636 .unmask = hpet_msi_unmask, 3635 .irq_unmask = hpet_msi_unmask,
3637 .mask = hpet_msi_mask, 3636 .irq_mask = hpet_msi_mask,
3638#ifdef CONFIG_INTR_REMAP 3637#ifdef CONFIG_INTR_REMAP
3639 .irq_ack = ir_ack_apic_edge, 3638 .irq_ack = ir_ack_apic_edge,
3640#ifdef CONFIG_SMP 3639#ifdef CONFIG_SMP
@@ -3646,20 +3645,19 @@ static struct irq_chip ir_hpet_msi_type = {
3646 3645
3647static struct irq_chip hpet_msi_type = { 3646static struct irq_chip hpet_msi_type = {
3648 .name = "HPET_MSI", 3647 .name = "HPET_MSI",
3649 .unmask = hpet_msi_unmask, 3648 .irq_unmask = hpet_msi_unmask,
3650 .mask = hpet_msi_mask, 3649 .irq_mask = hpet_msi_mask,
3651 .irq_ack = ack_apic_edge, 3650 .irq_ack = ack_apic_edge,
3652#ifdef CONFIG_SMP 3651#ifdef CONFIG_SMP
3653 .set_affinity = hpet_msi_set_affinity, 3652 .irq_set_affinity = hpet_msi_set_affinity,
3654#endif 3653#endif
3655 .irq_retrigger = ioapic_retrigger_irq, 3654 .irq_retrigger = ioapic_retrigger_irq,
3656}; 3655};
3657 3656
3658int arch_setup_hpet_msi(unsigned int irq, unsigned int id) 3657int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3659{ 3658{
3660 int ret;
3661 struct msi_msg msg; 3659 struct msi_msg msg;
3662 struct irq_desc *desc = irq_to_desc(irq); 3660 int ret;
3663 3661
3664 if (intr_remapping_enabled) { 3662 if (intr_remapping_enabled) {
3665 struct intel_iommu *iommu = map_hpet_to_ir(id); 3663 struct intel_iommu *iommu = map_hpet_to_ir(id);
@@ -3677,8 +3675,8 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3677 if (ret < 0) 3675 if (ret < 0)
3678 return ret; 3676 return ret;
3679 3677
3680 hpet_msi_write(irq, &msg); 3678 hpet_msi_write(get_irq_data(irq), &msg);
3681 desc->status |= IRQ_MOVE_PCNTXT; 3679 irq_set_status_flags(irq,IRQ_MOVE_PCNTXT);
3682 if (irq_remapped(irq)) 3680 if (irq_remapped(irq))
3683 set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type, 3681 set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type,
3684 handle_edge_irq, "edge"); 3682 handle_edge_irq, "edge");
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 7494999141b3..efaf906daf93 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -440,9 +440,9 @@ static int hpet_legacy_next_event(unsigned long delta,
440static DEFINE_PER_CPU(struct hpet_dev *, cpu_hpet_dev); 440static DEFINE_PER_CPU(struct hpet_dev *, cpu_hpet_dev);
441static struct hpet_dev *hpet_devs; 441static struct hpet_dev *hpet_devs;
442 442
443void hpet_msi_unmask(unsigned int irq) 443void hpet_msi_unmask(struct irq_data *data)
444{ 444{
445 struct hpet_dev *hdev = get_irq_data(irq); 445 struct hpet_dev *hdev = data->handler_data;
446 unsigned int cfg; 446 unsigned int cfg;
447 447
448 /* unmask it */ 448 /* unmask it */
@@ -451,10 +451,10 @@ void hpet_msi_unmask(unsigned int irq)
451 hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); 451 hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
452} 452}
453 453
454void hpet_msi_mask(unsigned int irq) 454void hpet_msi_mask(struct irq_data *data)
455{ 455{
456 struct hpet_dev *hdev = data->handler_data;
456 unsigned int cfg; 457 unsigned int cfg;
457 struct hpet_dev *hdev = get_irq_data(irq);
458 458
459 /* mask it */ 459 /* mask it */
460 cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); 460 cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
@@ -462,18 +462,14 @@ void hpet_msi_mask(unsigned int irq)
462 hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); 462 hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
463} 463}
464 464
465void hpet_msi_write(unsigned int irq, struct msi_msg *msg) 465void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg)
466{ 466{
467 struct hpet_dev *hdev = get_irq_data(irq);
468
469 hpet_writel(msg->data, HPET_Tn_ROUTE(hdev->num)); 467 hpet_writel(msg->data, HPET_Tn_ROUTE(hdev->num));
470 hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hdev->num) + 4); 468 hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hdev->num) + 4);
471} 469}
472 470
473void hpet_msi_read(unsigned int irq, struct msi_msg *msg) 471void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg)
474{ 472{
475 struct hpet_dev *hdev = get_irq_data(irq);
476
477 msg->data = hpet_readl(HPET_Tn_ROUTE(hdev->num)); 473 msg->data = hpet_readl(HPET_Tn_ROUTE(hdev->num));
478 msg->address_lo = hpet_readl(HPET_Tn_ROUTE(hdev->num) + 4); 474 msg->address_lo = hpet_readl(HPET_Tn_ROUTE(hdev->num) + 4);
479 msg->address_hi = 0; 475 msg->address_hi = 0;