From 70dbd1604c7756bf88e10869b10316ce50e8b271 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Thu, 26 Apr 2012 20:24:25 +0000 Subject: [PATCH] Clean up the intr* MD KPI from the SMP dependency, removing a cause of discrepancy between modules and kernel, but deal with SMP differences within the functions themselves. As an added bonus this also helps in terms of code readability. Requested by: gibbs Reviewed by: jhb, marius MFC after: 1 week --- sys/amd64/amd64/machdep.c | 2 -- sys/amd64/include/intr_machdep.h | 4 ---- sys/i386/i386/machdep.c | 2 -- sys/i386/include/intr_machdep.h | 4 ---- sys/pc98/pc98/machdep.c | 2 -- sys/sparc64/include/intr_machdep.h | 2 -- sys/sparc64/sparc64/intr_machdep.c | 16 ++++++++++++++++ sys/sparc64/sparc64/machdep.c | 2 -- sys/x86/x86/intr_machdep.c | 15 +++++++++++++++ 9 files changed, 31 insertions(+), 18 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index acb948a3ca7e..9580d79ad844 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -296,12 +296,10 @@ cpu_startup(dummy) cpu_setregs(); -#ifdef SMP /* * Add BSP as an interrupt target. */ intr_add_cpu(0); -#endif } /* diff --git a/sys/amd64/include/intr_machdep.h b/sys/amd64/include/intr_machdep.h index 700e35f89b19..3dd572df7113 100644 --- a/sys/amd64/include/intr_machdep.h +++ b/sys/amd64/include/intr_machdep.h @@ -140,15 +140,11 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); -#ifdef SMP int intr_bind(u_int vector, u_char cpu); -#endif int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); int intr_describe(u_int vector, void *ih, const char *descr); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index b1757caddb27..fb6ad62faceb 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -337,12 +337,10 @@ cpu_startup(dummy) cpu_setregs(); #endif -#ifdef SMP /* * Add BSP as an interrupt target. */ intr_add_cpu(0); -#endif } /* diff --git a/sys/i386/include/intr_machdep.h b/sys/i386/include/intr_machdep.h index 004ed52e60c9..0312ff102b81 100644 --- a/sys/i386/include/intr_machdep.h +++ b/sys/i386/include/intr_machdep.h @@ -131,14 +131,10 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); -#ifdef SMP int intr_bind(u_int vector, u_char cpu); -#endif int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); int intr_describe(u_int vector, void *ih, const char *descr); diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 1aeb76513bf5..691d21fe942a 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -272,12 +272,10 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); -#ifdef SMP /* * Add BSP as an interrupt target. */ intr_add_cpu(0); -#endif } /* diff --git a/sys/sparc64/include/intr_machdep.h b/sys/sparc64/include/intr_machdep.h index 6e472f7ae607..9319d8c623a5 100644 --- a/sys/sparc64/include/intr_machdep.h +++ b/sys/sparc64/include/intr_machdep.h @@ -91,9 +91,7 @@ struct intr_vector { extern ih_func_t *intr_handlers[]; extern struct intr_vector intr_vectors[]; -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_bind(int vec, u_char cpu); int intr_describe(int vec, void *ih, const char *descr); void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, diff --git a/sys/sparc64/sparc64/intr_machdep.c b/sys/sparc64/sparc64/intr_machdep.c index ed644fce4858..2a2d33bbe5cf 100644 --- a/sys/sparc64/sparc64/intr_machdep.c +++ b/sys/sparc64/sparc64/intr_machdep.c @@ -554,4 +554,20 @@ intr_shuffle_irqs(void *arg __unused) } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); +#else /* !SMP */ + +/* Return EOPNOTSUPP in the UP case. */ +int +intr_bind(int vec __unused, u_char cpu __unused) +{ + + return (EOPNOTSUPP); +} + +/* Use an empty stub for compatibility. */ +void +intr_add_cpu(u_int cpu __unused) +{ + +} #endif diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index fd5d338bf0c6..63be007dec96 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -197,12 +197,10 @@ cpu_startup(void *arg) cpu_identify(rdpr(ver), PCPU_GET(clock), curcpu); -#ifdef SMP /* * Add BSP as an interrupt target. */ intr_add_cpu(0); -#endif } void diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c index fef227eb8786..a33f4b5f2fe3 100644 --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -565,4 +565,19 @@ intr_next_cpu(void) return (PCPU_GET(apic_id)); } + +/* Return EOPNOTSUPP in the UP case. */ +int +intr_bind(u_int vector __unused, u_char cpu __unused) +{ + + return (EOPNOTSUPP); +} + +/* Use an empty stub for compatibility. */ +void +intr_add_cpu(u_int cpu __unused) +{ + +} #endif