Commit 1dad093b authored by Thomas Huth's avatar Thomas Huth Committed by Martin Schwidefsky

s390/irq: Use defines for external interruption codes

Use the new defines for external interruption codes to get rid
of "magic" numbers in the s390 source code. And while we're at it,
also rename the (un-)register_external_interrupt function to
something shorter so that this patch does not exceed the 80
columns all over the place.
Signed-off-by: default avatarThomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 072c2790
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define EXT_IRQ_TIMING_ALERT 0x1406 #define EXT_IRQ_TIMING_ALERT 0x1406
#define EXT_IRQ_MEASURE_ALERT 0x1407 #define EXT_IRQ_MEASURE_ALERT 0x1407
#define EXT_IRQ_SERVICE_SIG 0x2401 #define EXT_IRQ_SERVICE_SIG 0x2401
#define EXT_IRQ_CP_SERVICE 0x2603
#define EXT_IRQ_IUCV 0x4000 #define EXT_IRQ_IUCV 0x4000
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
...@@ -89,8 +90,8 @@ struct ext_code { ...@@ -89,8 +90,8 @@ struct ext_code {
typedef void (*ext_int_handler_t)(struct ext_code, unsigned int, unsigned long); typedef void (*ext_int_handler_t)(struct ext_code, unsigned int, unsigned long);
int register_external_interrupt(u16 code, ext_int_handler_t handler); int register_external_irq(u16 code, ext_int_handler_t handler);
int unregister_external_interrupt(u16 code, ext_int_handler_t handler); int unregister_external_irq(u16 code, ext_int_handler_t handler);
enum irq_subclass { enum irq_subclass {
IRQ_SUBCLASS_MEASUREMENT_ALERT = 5, IRQ_SUBCLASS_MEASUREMENT_ALERT = 5,
......
...@@ -205,7 +205,7 @@ static inline int ext_hash(u16 code) ...@@ -205,7 +205,7 @@ static inline int ext_hash(u16 code)
return (code + (code >> 9)) & (ARRAY_SIZE(ext_int_hash) - 1); return (code + (code >> 9)) & (ARRAY_SIZE(ext_int_hash) - 1);
} }
int register_external_interrupt(u16 code, ext_int_handler_t handler) int register_external_irq(u16 code, ext_int_handler_t handler)
{ {
struct ext_int_info *p; struct ext_int_info *p;
unsigned long flags; unsigned long flags;
...@@ -223,9 +223,9 @@ int register_external_interrupt(u16 code, ext_int_handler_t handler) ...@@ -223,9 +223,9 @@ int register_external_interrupt(u16 code, ext_int_handler_t handler)
spin_unlock_irqrestore(&ext_int_hash_lock, flags); spin_unlock_irqrestore(&ext_int_hash_lock, flags);
return 0; return 0;
} }
EXPORT_SYMBOL(register_external_interrupt); EXPORT_SYMBOL(register_external_irq);
int unregister_external_interrupt(u16 code, ext_int_handler_t handler) int unregister_external_irq(u16 code, ext_int_handler_t handler)
{ {
struct ext_int_info *p; struct ext_int_info *p;
unsigned long flags; unsigned long flags;
...@@ -241,7 +241,7 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler) ...@@ -241,7 +241,7 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
spin_unlock_irqrestore(&ext_int_hash_lock, flags); spin_unlock_irqrestore(&ext_int_hash_lock, flags);
return 0; return 0;
} }
EXPORT_SYMBOL(unregister_external_interrupt); EXPORT_SYMBOL(unregister_external_irq);
static irqreturn_t do_ext_interrupt(int irq, void *dummy) static irqreturn_t do_ext_interrupt(int irq, void *dummy)
{ {
...@@ -251,7 +251,7 @@ static irqreturn_t do_ext_interrupt(int irq, void *dummy) ...@@ -251,7 +251,7 @@ static irqreturn_t do_ext_interrupt(int irq, void *dummy)
int index; int index;
ext_code = *(struct ext_code *) &regs->int_code; ext_code = *(struct ext_code *) &regs->int_code;
if (ext_code.code != 0x1004) if (ext_code.code != EXT_IRQ_CLK_COMP)
__get_cpu_var(s390_idle).nohz_delay = 1; __get_cpu_var(s390_idle).nohz_delay = 1;
index = ext_hash(ext_code.code); index = ext_hash(ext_code.code);
......
...@@ -673,7 +673,8 @@ static int __init cpumf_pmu_init(void) ...@@ -673,7 +673,8 @@ static int __init cpumf_pmu_init(void)
ctl_clear_bit(0, 48); ctl_clear_bit(0, 48);
/* register handler for measurement-alert interruptions */ /* register handler for measurement-alert interruptions */
rc = register_external_interrupt(0x1407, cpumf_measurement_alert); rc = register_external_irq(EXT_IRQ_MEASURE_ALERT,
cpumf_measurement_alert);
if (rc) { if (rc) {
pr_err("Registering for CPU-measurement alerts " pr_err("Registering for CPU-measurement alerts "
"failed with rc=%i\n", rc); "failed with rc=%i\n", rc);
...@@ -684,7 +685,8 @@ static int __init cpumf_pmu_init(void) ...@@ -684,7 +685,8 @@ static int __init cpumf_pmu_init(void)
rc = perf_pmu_register(&cpumf_pmu, "cpum_cf", PERF_TYPE_RAW); rc = perf_pmu_register(&cpumf_pmu, "cpum_cf", PERF_TYPE_RAW);
if (rc) { if (rc) {
pr_err("Registering the cpum_cf PMU failed with rc=%i\n", rc); pr_err("Registering the cpum_cf PMU failed with rc=%i\n", rc);
unregister_external_interrupt(0x1407, cpumf_measurement_alert); unregister_external_irq(EXT_IRQ_MEASURE_ALERT,
cpumf_measurement_alert);
goto out; goto out;
} }
perf_cpu_notifier(cpumf_pmu_notifier); perf_cpu_notifier(cpumf_pmu_notifier);
......
...@@ -1621,7 +1621,8 @@ static int __init init_cpum_sampling_pmu(void) ...@@ -1621,7 +1621,8 @@ static int __init init_cpum_sampling_pmu(void)
pr_err("Registering for s390dbf failed\n"); pr_err("Registering for s390dbf failed\n");
debug_register_view(sfdbg, &debug_sprintf_view); debug_register_view(sfdbg, &debug_sprintf_view);
err = register_external_interrupt(0x1407, cpumf_measurement_alert); err = register_external_irq(EXT_IRQ_MEASURE_ALERT,
cpumf_measurement_alert);
if (err) { if (err) {
pr_cpumsf_err(RS_INIT_FAILURE_ALRT); pr_cpumsf_err(RS_INIT_FAILURE_ALRT);
goto out; goto out;
...@@ -1630,7 +1631,8 @@ static int __init init_cpum_sampling_pmu(void) ...@@ -1630,7 +1631,8 @@ static int __init init_cpum_sampling_pmu(void)
err = perf_pmu_register(&cpumf_sampling, "cpum_sf", PERF_TYPE_RAW); err = perf_pmu_register(&cpumf_sampling, "cpum_sf", PERF_TYPE_RAW);
if (err) { if (err) {
pr_cpumsf_err(RS_INIT_FAILURE_PERF); pr_cpumsf_err(RS_INIT_FAILURE_PERF);
unregister_external_interrupt(0x1407, cpumf_measurement_alert); unregister_external_irq(EXT_IRQ_MEASURE_ALERT,
cpumf_measurement_alert);
goto out; goto out;
} }
perf_cpu_notifier(cpumf_pmu_notifier); perf_cpu_notifier(cpumf_pmu_notifier);
......
...@@ -138,7 +138,8 @@ static int __init runtime_instr_init(void) ...@@ -138,7 +138,8 @@ static int __init runtime_instr_init(void)
return 0; return 0;
irq_subclass_register(IRQ_SUBCLASS_MEASUREMENT_ALERT); irq_subclass_register(IRQ_SUBCLASS_MEASUREMENT_ALERT);
rc = register_external_interrupt(0x1407, runtime_instr_int_handler); rc = register_external_irq(EXT_IRQ_MEASURE_ALERT,
runtime_instr_int_handler);
if (rc) if (rc)
irq_subclass_unregister(IRQ_SUBCLASS_MEASUREMENT_ALERT); irq_subclass_unregister(IRQ_SUBCLASS_MEASUREMENT_ALERT);
else else
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/irq.h>
LC_EXT_NEW_PSW = 0x58 # addr of ext int handler LC_EXT_NEW_PSW = 0x58 # addr of ext int handler
LC_EXT_NEW_PSW_64 = 0x1b0 # addr of ext int handler 64 bit LC_EXT_NEW_PSW_64 = 0x1b0 # addr of ext int handler 64 bit
...@@ -73,9 +74,9 @@ _sclp_wait_int: ...@@ -73,9 +74,9 @@ _sclp_wait_int:
lpsw .LwaitpswS1-.LbaseS1(%r13) # wait until interrupt lpsw .LwaitpswS1-.LbaseS1(%r13) # wait until interrupt
.LwaitS1: .LwaitS1:
lh %r7,LC_EXT_INT_CODE lh %r7,LC_EXT_INT_CODE
chi %r7,0x1004 # timeout? chi %r7,EXT_IRQ_CLK_COMP # timeout?
je .LtimeoutS1 je .LtimeoutS1
chi %r7,0x2401 # service int? chi %r7,EXT_IRQ_SERVICE_SIG # service int?
jne .LloopS1 jne .LloopS1
sr %r2,%r2 sr %r2,%r2
l %r3,LC_EXT_INT_PARAM l %r3,LC_EXT_INT_PARAM
......
...@@ -785,10 +785,10 @@ void __init smp_fill_possible_mask(void) ...@@ -785,10 +785,10 @@ void __init smp_fill_possible_mask(void)
void __init smp_prepare_cpus(unsigned int max_cpus) void __init smp_prepare_cpus(unsigned int max_cpus)
{ {
/* request the 0x1201 emergency signal external interrupt */ /* request the 0x1201 emergency signal external interrupt */
if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) if (register_external_irq(EXT_IRQ_EMERGENCY_SIG, do_ext_call_interrupt))
panic("Couldn't request external interrupt 0x1201"); panic("Couldn't request external interrupt 0x1201");
/* request the 0x1202 external call external interrupt */ /* request the 0x1202 external call external interrupt */
if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0) if (register_external_irq(EXT_IRQ_EXTERNAL_CALL, do_ext_call_interrupt))
panic("Couldn't request external interrupt 0x1202"); panic("Couldn't request external interrupt 0x1202");
smp_detect_cpus(); smp_detect_cpus();
} }
......
...@@ -262,11 +262,11 @@ void __init time_init(void) ...@@ -262,11 +262,11 @@ void __init time_init(void)
stp_reset(); stp_reset();
/* request the clock comparator external interrupt */ /* request the clock comparator external interrupt */
if (register_external_interrupt(0x1004, clock_comparator_interrupt)) if (register_external_irq(EXT_IRQ_CLK_COMP, clock_comparator_interrupt))
panic("Couldn't request external interrupt 0x1004"); panic("Couldn't request external interrupt 0x1004");
/* request the timing alert external interrupt */ /* request the timing alert external interrupt */
if (register_external_interrupt(0x1406, timing_alert_interrupt)) if (register_external_irq(EXT_IRQ_TIMING_ALERT, timing_alert_interrupt))
panic("Couldn't request external interrupt 0x1406"); panic("Couldn't request external interrupt 0x1406");
if (clocksource_register(&clocksource_tod) != 0) if (clocksource_register(&clocksource_tod) != 0)
......
...@@ -627,7 +627,7 @@ static int __init pfault_irq_init(void) ...@@ -627,7 +627,7 @@ static int __init pfault_irq_init(void)
{ {
int rc; int rc;
rc = register_external_interrupt(0x2603, pfault_interrupt); rc = register_external_irq(EXT_IRQ_CP_SERVICE, pfault_interrupt);
if (rc) if (rc)
goto out_extint; goto out_extint;
rc = pfault_init() == 0 ? 0 : -EOPNOTSUPP; rc = pfault_init() == 0 ? 0 : -EOPNOTSUPP;
...@@ -638,7 +638,7 @@ static int __init pfault_irq_init(void) ...@@ -638,7 +638,7 @@ static int __init pfault_irq_init(void)
return 0; return 0;
out_pfault: out_pfault:
unregister_external_interrupt(0x2603, pfault_interrupt); unregister_external_irq(EXT_IRQ_CP_SERVICE, pfault_interrupt);
out_extint: out_extint:
pfault_disable = 1; pfault_disable = 1;
return rc; return rc;
......
...@@ -1033,7 +1033,7 @@ int hwsampler_setup(void) ...@@ -1033,7 +1033,7 @@ int hwsampler_setup(void)
max_sampler_rate = cb->qsi.max_sampl_rate; max_sampler_rate = cb->qsi.max_sampl_rate;
} }
} }
register_external_interrupt(0x1407, hws_ext_handler); register_external_irq(EXT_IRQ_MEASURE_ALERT, hws_ext_handler);
hws_state = HWS_DEALLOCATED; hws_state = HWS_DEALLOCATED;
rc = 0; rc = 0;
...@@ -1068,7 +1068,7 @@ int hwsampler_shutdown(void) ...@@ -1068,7 +1068,7 @@ int hwsampler_shutdown(void)
hws_wq = NULL; hws_wq = NULL;
} }
unregister_external_interrupt(0x1407, hws_ext_handler); unregister_external_irq(EXT_IRQ_MEASURE_ALERT, hws_ext_handler);
hws_state = HWS_INIT; hws_state = HWS_INIT;
rc = 0; rc = 0;
} }
......
...@@ -646,7 +646,7 @@ dasd_diag_init(void) ...@@ -646,7 +646,7 @@ dasd_diag_init(void)
ASCEBC(dasd_diag_discipline.ebcname, 4); ASCEBC(dasd_diag_discipline.ebcname, 4);
irq_subclass_register(IRQ_SUBCLASS_SERVICE_SIGNAL); irq_subclass_register(IRQ_SUBCLASS_SERVICE_SIGNAL);
register_external_interrupt(0x2603, dasd_ext_handler); register_external_irq(EXT_IRQ_CP_SERVICE, dasd_ext_handler);
dasd_diag_discipline_pointer = &dasd_diag_discipline; dasd_diag_discipline_pointer = &dasd_diag_discipline;
return 0; return 0;
} }
...@@ -654,7 +654,7 @@ dasd_diag_init(void) ...@@ -654,7 +654,7 @@ dasd_diag_init(void)
static void __exit static void __exit
dasd_diag_cleanup(void) dasd_diag_cleanup(void)
{ {
unregister_external_interrupt(0x2603, dasd_ext_handler); unregister_external_irq(EXT_IRQ_CP_SERVICE, dasd_ext_handler);
irq_subclass_unregister(IRQ_SUBCLASS_SERVICE_SIGNAL); irq_subclass_unregister(IRQ_SUBCLASS_SERVICE_SIGNAL);
dasd_diag_discipline_pointer = NULL; dasd_diag_discipline_pointer = NULL;
} }
......
...@@ -972,7 +972,7 @@ sclp_check_interface(void) ...@@ -972,7 +972,7 @@ sclp_check_interface(void)
spin_lock_irqsave(&sclp_lock, flags); spin_lock_irqsave(&sclp_lock, flags);
/* Prepare init mask command */ /* Prepare init mask command */
rc = register_external_interrupt(0x2401, sclp_check_handler); rc = register_external_irq(EXT_IRQ_SERVICE_SIG, sclp_check_handler);
if (rc) { if (rc) {
spin_unlock_irqrestore(&sclp_lock, flags); spin_unlock_irqrestore(&sclp_lock, flags);
return rc; return rc;
...@@ -1005,7 +1005,7 @@ sclp_check_interface(void) ...@@ -1005,7 +1005,7 @@ sclp_check_interface(void)
} else } else
rc = -EBUSY; rc = -EBUSY;
} }
unregister_external_interrupt(0x2401, sclp_check_handler); unregister_external_irq(EXT_IRQ_SERVICE_SIG, sclp_check_handler);
spin_unlock_irqrestore(&sclp_lock, flags); spin_unlock_irqrestore(&sclp_lock, flags);
return rc; return rc;
} }
...@@ -1206,7 +1206,7 @@ sclp_init(void) ...@@ -1206,7 +1206,7 @@ sclp_init(void)
if (rc) if (rc)
goto fail_init_state_uninitialized; goto fail_init_state_uninitialized;
/* Register interrupt handler */ /* Register interrupt handler */
rc = register_external_interrupt(0x2401, sclp_interrupt_handler); rc = register_external_irq(EXT_IRQ_SERVICE_SIG, sclp_interrupt_handler);
if (rc) if (rc)
goto fail_unregister_reboot_notifier; goto fail_unregister_reboot_notifier;
sclp_init_state = sclp_init_state_initialized; sclp_init_state = sclp_init_state_initialized;
......
...@@ -477,7 +477,7 @@ static int __init kvm_devices_init(void) ...@@ -477,7 +477,7 @@ static int __init kvm_devices_init(void)
INIT_WORK(&hotplug_work, hotplug_devices); INIT_WORK(&hotplug_work, hotplug_devices);
irq_subclass_register(IRQ_SUBCLASS_SERVICE_SIGNAL); irq_subclass_register(IRQ_SUBCLASS_SERVICE_SIGNAL);
register_external_interrupt(0x2603, kvm_extint_handler); register_external_irq(EXT_IRQ_CP_SERVICE, kvm_extint_handler);
scan_devices(); scan_devices();
return 0; return 0;
......
...@@ -2016,7 +2016,7 @@ static int __init iucv_init(void) ...@@ -2016,7 +2016,7 @@ static int __init iucv_init(void)
rc = iucv_query_maxconn(); rc = iucv_query_maxconn();
if (rc) if (rc)
goto out_ctl; goto out_ctl;
rc = register_external_interrupt(0x4000, iucv_external_interrupt); rc = register_external_irq(EXT_IRQ_IUCV, iucv_external_interrupt);
if (rc) if (rc)
goto out_ctl; goto out_ctl;
iucv_root = root_device_register("iucv"); iucv_root = root_device_register("iucv");
...@@ -2081,7 +2081,7 @@ static int __init iucv_init(void) ...@@ -2081,7 +2081,7 @@ static int __init iucv_init(void)
} }
root_device_unregister(iucv_root); root_device_unregister(iucv_root);
out_int: out_int:
unregister_external_interrupt(0x4000, iucv_external_interrupt); unregister_external_irq(EXT_IRQ_IUCV, iucv_external_interrupt);
out_ctl: out_ctl:
ctl_clear_bit(0, 1); ctl_clear_bit(0, 1);
out: out:
...@@ -2116,7 +2116,7 @@ static void __exit iucv_exit(void) ...@@ -2116,7 +2116,7 @@ static void __exit iucv_exit(void)
} }
root_device_unregister(iucv_root); root_device_unregister(iucv_root);
bus_unregister(&iucv_bus); bus_unregister(&iucv_bus);
unregister_external_interrupt(0x4000, iucv_external_interrupt); unregister_external_irq(EXT_IRQ_IUCV, iucv_external_interrupt);
} }
subsys_initcall(iucv_init); subsys_initcall(iucv_init);
......
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