Commit d0fbca8f authored by Thomas Gleixner's avatar Thomas Gleixner

x86: ioapic/hpet: Convert to new chip functions

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarIngo Molnar <mingo@elte.hu>
parent 90297c5f
...@@ -74,10 +74,12 @@ extern void hpet_disable(void); ...@@ -74,10 +74,12 @@ extern void hpet_disable(void);
extern unsigned int hpet_readl(unsigned int a); extern unsigned int hpet_readl(unsigned int a);
extern void force_hpet_resume(void); extern void force_hpet_resume(void);
extern void hpet_msi_unmask(unsigned int irq); struct irq_data;
extern void hpet_msi_mask(unsigned int irq); extern void hpet_msi_unmask(struct irq_data *data);
extern void hpet_msi_write(unsigned int irq, struct msi_msg *msg); extern void hpet_msi_mask(struct irq_data *data);
extern void hpet_msi_read(unsigned int irq, struct msi_msg *msg); struct hpet_dev;
extern void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg);
extern void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg);
#ifdef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
extern int arch_setup_hpet_msi(unsigned int irq, unsigned int id); extern int arch_setup_hpet_msi(unsigned int irq, unsigned int id);
......
...@@ -3605,26 +3605,25 @@ int arch_setup_dmar_msi(unsigned int irq) ...@@ -3605,26 +3605,25 @@ int arch_setup_dmar_msi(unsigned int irq)
#ifdef CONFIG_HPET_TIMER #ifdef CONFIG_HPET_TIMER
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask) static int hpet_msi_set_affinity(struct irq_data *data,
const struct cpumask *mask, bool force)
{ {
struct irq_desc *desc = irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(data->irq);
struct irq_cfg *cfg; struct irq_cfg *cfg = data->chip_data;
struct msi_msg msg; struct msi_msg msg;
unsigned int dest; unsigned int dest;
if (set_desc_affinity(desc, mask, &dest)) if (set_desc_affinity(desc, mask, &dest))
return -1; return -1;
cfg = get_irq_desc_chip_data(desc); hpet_msi_read(data->handler_data, &msg);
hpet_msi_read(irq, &msg);
msg.data &= ~MSI_DATA_VECTOR_MASK; msg.data &= ~MSI_DATA_VECTOR_MASK;
msg.data |= MSI_DATA_VECTOR(cfg->vector); msg.data |= MSI_DATA_VECTOR(cfg->vector);
msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
msg.address_lo |= MSI_ADDR_DEST_ID(dest); msg.address_lo |= MSI_ADDR_DEST_ID(dest);
hpet_msi_write(irq, &msg); hpet_msi_write(data->handler_data, &msg);
return 0; return 0;
} }
...@@ -3633,8 +3632,8 @@ static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask) ...@@ -3633,8 +3632,8 @@ static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
static struct irq_chip ir_hpet_msi_type = { static struct irq_chip ir_hpet_msi_type = {
.name = "IR-HPET_MSI", .name = "IR-HPET_MSI",
.unmask = hpet_msi_unmask, .irq_unmask = hpet_msi_unmask,
.mask = hpet_msi_mask, .irq_mask = hpet_msi_mask,
#ifdef CONFIG_INTR_REMAP #ifdef CONFIG_INTR_REMAP
.irq_ack = ir_ack_apic_edge, .irq_ack = ir_ack_apic_edge,
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -3646,20 +3645,19 @@ static struct irq_chip ir_hpet_msi_type = { ...@@ -3646,20 +3645,19 @@ static struct irq_chip ir_hpet_msi_type = {
static struct irq_chip hpet_msi_type = { static struct irq_chip hpet_msi_type = {
.name = "HPET_MSI", .name = "HPET_MSI",
.unmask = hpet_msi_unmask, .irq_unmask = hpet_msi_unmask,
.mask = hpet_msi_mask, .irq_mask = hpet_msi_mask,
.irq_ack = ack_apic_edge, .irq_ack = ack_apic_edge,
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
.set_affinity = hpet_msi_set_affinity, .irq_set_affinity = hpet_msi_set_affinity,
#endif #endif
.irq_retrigger = ioapic_retrigger_irq, .irq_retrigger = ioapic_retrigger_irq,
}; };
int arch_setup_hpet_msi(unsigned int irq, unsigned int id) int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
{ {
int ret;
struct msi_msg msg; struct msi_msg msg;
struct irq_desc *desc = irq_to_desc(irq); int ret;
if (intr_remapping_enabled) { if (intr_remapping_enabled) {
struct intel_iommu *iommu = map_hpet_to_ir(id); 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,8 +3675,8 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
if (ret < 0) if (ret < 0)
return ret; return ret;
hpet_msi_write(irq, &msg); hpet_msi_write(get_irq_data(irq), &msg);
desc->status |= IRQ_MOVE_PCNTXT; irq_set_status_flags(irq,IRQ_MOVE_PCNTXT);
if (irq_remapped(irq)) if (irq_remapped(irq))
set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type, set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type,
handle_edge_irq, "edge"); handle_edge_irq, "edge");
......
...@@ -440,9 +440,9 @@ static int hpet_legacy_next_event(unsigned long delta, ...@@ -440,9 +440,9 @@ static int hpet_legacy_next_event(unsigned long delta,
static DEFINE_PER_CPU(struct hpet_dev *, cpu_hpet_dev); static DEFINE_PER_CPU(struct hpet_dev *, cpu_hpet_dev);
static struct hpet_dev *hpet_devs; static struct hpet_dev *hpet_devs;
void hpet_msi_unmask(unsigned int irq) void hpet_msi_unmask(struct irq_data *data)
{ {
struct hpet_dev *hdev = get_irq_data(irq); struct hpet_dev *hdev = data->handler_data;
unsigned int cfg; unsigned int cfg;
/* unmask it */ /* unmask it */
...@@ -451,10 +451,10 @@ void hpet_msi_unmask(unsigned int irq) ...@@ -451,10 +451,10 @@ void hpet_msi_unmask(unsigned int irq)
hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
} }
void hpet_msi_mask(unsigned int irq) void hpet_msi_mask(struct irq_data *data)
{ {
struct hpet_dev *hdev = data->handler_data;
unsigned int cfg; unsigned int cfg;
struct hpet_dev *hdev = get_irq_data(irq);
/* mask it */ /* mask it */
cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
...@@ -462,18 +462,14 @@ void hpet_msi_mask(unsigned int irq) ...@@ -462,18 +462,14 @@ void hpet_msi_mask(unsigned int irq)
hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
} }
void hpet_msi_write(unsigned int irq, struct msi_msg *msg) void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg)
{ {
struct hpet_dev *hdev = get_irq_data(irq);
hpet_writel(msg->data, HPET_Tn_ROUTE(hdev->num)); hpet_writel(msg->data, HPET_Tn_ROUTE(hdev->num));
hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hdev->num) + 4); hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hdev->num) + 4);
} }
void hpet_msi_read(unsigned int irq, struct msi_msg *msg) void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg)
{ {
struct hpet_dev *hdev = get_irq_data(irq);
msg->data = hpet_readl(HPET_Tn_ROUTE(hdev->num)); msg->data = hpet_readl(HPET_Tn_ROUTE(hdev->num));
msg->address_lo = hpet_readl(HPET_Tn_ROUTE(hdev->num) + 4); msg->address_lo = hpet_readl(HPET_Tn_ROUTE(hdev->num) + 4);
msg->address_hi = 0; msg->address_hi = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment