diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-04-02 10:58:21 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-04-02 10:58:21 +0000 |
commit | facaf0215efbce11a656a83f04f4f2ed17ef6261 (patch) | |
tree | 430ab220ac9f98076f51ce16c7ccf1e58a0ad6f0 /sys/arch | |
parent | d40eb3bd005b346bc4a126f253658945e587344d (diff) |
Cleanup function definitions, use only one define for DEBUG and remove
unused headers.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/macppc/dev/openpic.c | 103 |
1 files changed, 48 insertions, 55 deletions
diff --git a/sys/arch/macppc/dev/openpic.c b/sys/arch/macppc/dev/openpic.c index 41ee10334ca..520496d2138 100644 --- a/sys/arch/macppc/dev/openpic.c +++ b/sys/arch/macppc/dev/openpic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openpic.c,v 1.76 2015/01/04 13:01:42 mpi Exp $ */ +/* $OpenBSD: openpic.c,v 1.77 2015/04/02 10:58:20 mpi Exp $ */ /*- * Copyright (c) 2008 Dale Rahn <drahn@openbsd.org> @@ -45,7 +45,6 @@ #include <uvm/uvm_extern.h> #include <ddb/db_var.h> -#include <machine/atomic.h> #include <machine/autoconf.h> #include <machine/intr.h> #include <machine/psl.h> @@ -54,6 +53,12 @@ #include <macppc/dev/openpicreg.h> +#ifdef OPENPIC_DEBUG +#define DPRINTF(x...) do { printf(x); } while(0) +#else +#define DPRINTF(x...) +#endif + #define ICU_LEN 128 int openpic_numirq = ICU_LEN; #define LEGAL_IRQ(x) ((x >= 0) && (x < ICU_LEN)) @@ -62,59 +67,53 @@ int openpic_pri_share[IPL_NUM]; struct intrq openpic_handler[ICU_LEN]; -void openpic_calc_mask(void); +struct openpic_softc { + struct device sc_dev; +}; -ppc_splraise_t openpic_splraise; -ppc_spllower_t openpic_spllower; -ppc_splx_t openpic_splx; +vaddr_t openpic_base; +int openpic_big_endian; +struct evcount openpic_spurious; +int openpic_spurious_irq = 255; -/* IRQ vector used for inter-processor interrupts. */ -#define IPI_VECTOR_NOP 64 -#define IPI_VECTOR_DDB 65 -#ifdef MULTIPROCESSOR -static struct evcount ipi_ddb[PPC_MAXPROCS]; -static struct evcount ipi_nop[PPC_MAXPROCS]; -static int ipi_nopirq = IPI_VECTOR_NOP; -static int ipi_ddbirq = IPI_VECTOR_DDB; -#endif -struct evcount openpic_spurious; -int openpic_spurious_irq = 255; +int openpic_match(struct device *parent, void *cf, void *aux); +void openpic_attach(struct device *, struct device *, void *); + +int openpic_splraise(int); +int openpic_spllower(int); +void openpic_splx(int); +u_int openpic_read(int reg); +void openpic_write(int reg, u_int val); void openpic_enable_irq(int, int); void openpic_disable_irq(int); void openpic_init(void); +void openpic_calc_mask(void); void openpic_set_priority(int, int); -void openpic_ipi_ddb(void); -void *openpic_intr_establish(void *, int, int, int, int (*)(void *), - void *, const char *); - -typedef void (void_f) (void); -extern void_f *pending_int_f; - -vaddr_t openpic_base; +void *openpic_intr_establish(void *, int, int, int, int (*)(void *), void *, + const char *); void openpic_intr_disestablish( void *lcp, void *arg); void openpic_collect_preconf_intr(void); -int openpic_big_endian; +void openpic_ext_intr(void); + #ifdef MULTIPROCESSOR -intr_send_ipi_t openpic_send_ipi; -#endif +void openpic_ipi_ddb(void); -u_int openpic_read(int reg); -void openpic_write(int reg, u_int val); +/* IRQ vector used for inter-processor interrupts. */ +#define IPI_VECTOR_NOP 64 +#define IPI_VECTOR_DDB 65 -struct openpic_softc { - struct device sc_dev; -}; +static struct evcount ipi_ddb[PPC_MAXPROCS]; +static struct evcount ipi_nop[PPC_MAXPROCS]; -int openpic_match(struct device *parent, void *cf, void *aux); -void openpic_attach(struct device *, struct device *, void *); -void openpic_collect_preconf_intr(void); -void openpic_ext_intr(void); +static int ipi_nopirq = IPI_VECTOR_NOP; +static int ipi_ddbirq = IPI_VECTOR_DDB; + +intr_send_ipi_t openpic_send_ipi; +#endif /* MULTIPROCESSOR */ -struct cfattach openpic_ca = { - sizeof(struct openpic_softc), - openpic_match, - openpic_attach +const struct cfattach openpic_ca = { + sizeof(struct openpic_softc), openpic_match, openpic_attach }; struct cfdriver openpic_cd = { @@ -293,12 +292,10 @@ openpic_collect_preconf_intr() { int i; for (i = 0; i < ppc_configed_intr_cnt; i++) { -#ifdef DEBUG - printf("\n\t%s irq %d level %d fun %x arg %x", + DPRINTF("\n\t%s irq %d level %d fun %p arg %p", ppc_configed_intr[i].ih_what, ppc_configed_intr[i].ih_irq, ppc_configed_intr[i].ih_level, ppc_configed_intr[i].ih_fun, ppc_configed_intr[i].ih_arg); -#endif openpic_intr_establish(NULL, ppc_configed_intr[i].ih_irq, IST_LEVEL, ppc_configed_intr[i].ih_level, ppc_configed_intr[i].ih_fun, ppc_configed_intr[i].ih_arg, @@ -497,7 +494,7 @@ openpic_send_ipi(struct cpu_info *ci, int id) default: panic("invalid ipi send to cpu %d %d", ci->ci_cpuid, id); } - + openpic_write(OPENPIC_IPI(curcpu()->ci_cpuid, id), 1 << ci->ci_cpuid); } @@ -523,7 +520,7 @@ openpic_ext_intr() while (irq != 255) { openpic_irqloop[ci->ci_cpuid]++; -#ifdef DEBUG +#ifdef OPENPIC_DEBUG if (openpic_irqloop[ci->ci_cpuid] > 20 || openpic_irqnest[ci->ci_cpuid] > 3) { printf("irqloop %d irqnest %d\n", @@ -532,11 +529,9 @@ openpic_ext_intr() } #endif if (openpic_irqloop[ci->ci_cpuid] > 20) { -#ifdef DEBUG - printf("irqloop %d irqnest %d: returning\n", + DPRINTF("irqloop %d irqnest %d: returning\n", openpic_irqloop[ci->ci_cpuid], openpic_irqnest[ci->ci_cpuid]); -#endif openpic_irqnest[ci->ci_cpuid]--; return; } @@ -583,9 +578,7 @@ openpic_ext_intr() } if (spurious) { openpic_spurious.ec_count++; -#ifdef OPENPIC_NOISY - printf("spurious intr %d\n", irq); -#endif + DPRINTF("spurious intr %d\n", irq); } uvmexp.intrs++; @@ -676,13 +669,13 @@ openpic_init() openpic_set_priority(ci->ci_cpuid, 0); } +#ifdef MULTIPROCESSOR void openpic_ipi_ddb() { -#ifdef OPENPIC_NOISY - printf("ipi_ddb() called\n"); -#endif + DPRINTF("ipi_ddb() called\n"); #ifdef DDB Debugger(); #endif } +#endif /* MULTIPROCESSOR */ |