diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-05-17 22:46:29 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-05-17 22:46:29 +0000 |
commit | fab438f937925243666564eae47032d71d7b1116 (patch) | |
tree | 7fc535435bb79ff4c573215b0602b23d684cbf39 /sys/arch/mvme88k/include | |
parent | eedcd44e3fcfdaba879129c944e9a5eb670ef460 (diff) |
Replace the bunch of md_* function pointers with a `struct board' containing
function pointers for all the board-specific code.
Add a bunch of `struct board' methods to cover most, if not all, of the
`per-board' logic. This allows most of the md drivers to be cleaned up and
no longer need to embed board-specific knowledge.
Diffstat (limited to 'sys/arch/mvme88k/include')
-rw-r--r-- | sys/arch/mvme88k/include/board.h | 115 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/cpu.h | 22 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/mvme187.h | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/mvme188.h | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/trap.h | 3 |
5 files changed, 126 insertions, 30 deletions
diff --git a/sys/arch/mvme88k/include/board.h b/sys/arch/mvme88k/include/board.h new file mode 100644 index 00000000000..941e15176de --- /dev/null +++ b/sys/arch/mvme88k/include/board.h @@ -0,0 +1,115 @@ +/* $OpenBSD: board.h,v 1.22 2013/05/17 22:46:27 miod Exp $ */ +/* + * Copyright (c) 2013, Miodrag Vallat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_BOARD_H_ +#define _MACHINE_BOARD_H_ + +#if !defined(_LOCORE) + +struct cmmu_p; +struct intrhand; +struct mvmeprom_brdid; +struct pmap_table; + +struct board { + void (*bootstrap)(void); + vaddr_t (*memsize)(void); + int (*cpuspeed)(const struct mvmeprom_brdid *); + void (*reboot)(int); + int (*is_syscon)(void); + + void (*intr)(struct trapframe *); + int (*nmi)(struct trapframe *); /* 88110 */ + void (*nmi_wrapup)(struct trapframe *); /* 88110 */ + + u_int (*getipl)(void); + u_int (*setipl)(u_int); + u_int (*raiseipl)(u_int); + + int (*intsrc_available)(u_int, int); + void (*intsrc_enable)(u_int, int); + void (*intsrc_disable)(u_int, int); + int (*intsrc_establish)(u_int, struct intrhand *, + const char *); + void (*intsrc_disestablish)(u_int, struct intrhand *); + + void (*init_clocks)(void); + void (*delay)(int); + + u_int (*init_vme)(const char *); + +#ifdef MULTIPROCESSOR + void (*send_ipi)(int, cpuid_t); + void (*smp_setup)(struct cpu_info *); +#endif + + const struct pmap_table *ptable; + const struct cmmu_p *cmmu; +}; + +#define BOARD_PROTOS(b) \ +void m##b##_bootstrap(void); \ +vaddr_t m##b##_memsize(void); \ +int m##b##_cpuspeed(const struct mvmeprom_brdid *); \ +void m##b##_reboot(int); \ +int m##b##_is_syscon(void); \ +void m##b##_intr(struct trapframe *); \ +int m##b##_nmi(struct trapframe *); \ +void m##b##_nmi_wrapup(struct trapframe *); \ +u_int m##b##_getipl(void); \ +u_int m##b##_setipl(u_int); \ +u_int m##b##_raiseipl(u_int); \ +int m##b##_intsrc_available(u_int, int); \ +void m##b##_intsrc_enable(u_int, int); \ +void m##b##_intsrc_disable(u_int, int); \ +int m##b##_intsrc_establish(u_int, struct intrhand *, const char *); \ +void m##b##_intsrc_disestablish(u_int, struct intrhand *); \ +void m##b##_init_clocks(void); \ +u_int m##b##_init_vme(const char *); \ +void m##b##_delay(int); \ +void m##b##_send_ipi(int, cpuid_t); \ +void m##b##_smp_setup(struct cpu_info *) + +BOARD_PROTOS(181); +BOARD_PROTOS(187); +BOARD_PROTOS(188); +BOARD_PROTOS(197); +BOARD_PROTOS(1x7); + +extern const struct board board_mvme181; +extern const struct board board_mvme187; +extern const struct board board_mvme188; +extern const struct board board_mvme197le; +extern const struct board board_mvme197spdp; + +extern const struct board *platform; + +#define md_interrupt_func(f) platform->intr(f) +#define md_nmi_func(f) platform->nmi(f) +#define md_nmi_wrapup_func(f) platform->nmi_wrapup(f) + +#endif /* _LOCORE */ +#endif /* _MACHINE_BOARD_H_ */ diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h index 073612dec07..5ede70aacd1 100644 --- a/sys/arch/mvme88k/include/cpu.h +++ b/sys/arch/mvme88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.46 2013/05/17 22:40:01 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.47 2013/05/17 22:46:27 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -46,23 +46,15 @@ extern int cpuspeed; -/* board dependent pointers */ -extern void (*md_interrupt_func_ptr)(struct trapframe *); -#define md_interrupt_func (*md_interrupt_func_ptr) -extern int (*md_nmi_func_ptr)(struct trapframe *); -#define md_nmi_func (*md_nmi_func_ptr) -extern void (*md_nmi_wrapup_func_ptr)(struct trapframe *); -#define md_nmi_wrapup_func (*md_nmi_wrapup_func_ptr) -extern u_int (*md_getipl)(void); -extern u_int (*md_setipl)(u_int); -extern u_int (*md_raiseipl)(u_int); -extern void (*md_init_clocks)(void); -extern void (*md_send_ipi)(int, cpuid_t); -extern void (*md_delay)(int); -extern void (*md_smp_setup)(struct cpu_info *); __dead void doboot(void); void nmihand(void *); +/* M88100 PFSR machine-dependent code snippets */ +extern u_int32_t pfsr_save_single[]; +extern u_int32_t pfsr_save_188_straight[]; +extern u_int32_t pfsr_save_188_double[]; +extern u_int32_t pfsr_save_188_quad[]; + #endif /* _KERNEL */ #endif diff --git a/sys/arch/mvme88k/include/mvme187.h b/sys/arch/mvme88k/include/mvme187.h index 88b986d72d9..cb351584093 100644 --- a/sys/arch/mvme88k/include/mvme187.h +++ b/sys/arch/mvme88k/include/mvme187.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mvme187.h,v 1.10 2011/03/23 16:54:36 pirofti Exp $ */ +/* $OpenBSD: mvme187.h,v 1.11 2013/05/17 22:46:27 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1999 Steve Murphree, Jr. @@ -63,8 +63,4 @@ #define MEM_CTLR 0xfff43000 /* MEMC040 mem controller */ -#if defined(_KERNEL) && !defined(_LOCORE) -extern u_int32_t pfsr_save_187[]; -#endif - #endif /* _MACHINE_MVME187_H_ */ diff --git a/sys/arch/mvme88k/include/mvme188.h b/sys/arch/mvme88k/include/mvme188.h index 97bbab5f425..7a7985cfd7a 100644 --- a/sys/arch/mvme88k/include/mvme188.h +++ b/sys/arch/mvme88k/include/mvme188.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mvme188.h,v 1.34 2011/03/23 16:54:36 pirofti Exp $ */ +/* $OpenBSD: mvme188.h,v 1.35 2013/05/17 22:46:27 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. @@ -215,12 +215,4 @@ #define VME_CMMU_D2 0xfff3f000 #define VME_CMMU_D3 0xfff7f000 -#if defined(_KERNEL) && !defined(_LOCORE) -extern u_int32_t pfsr_save_188_straight[]; -extern u_int32_t pfsr_save_188_double[]; -extern u_int32_t pfsr_save_188_quad[]; - -extern u_int32_t int_mask_val[NIPLS]; -#endif - #endif /* _MACHINE_MVME188_H_ */ diff --git a/sys/arch/mvme88k/include/trap.h b/sys/arch/mvme88k/include/trap.h index 008ce864255..b8490824bfa 100644 --- a/sys/arch/mvme88k/include/trap.h +++ b/sys/arch/mvme88k/include/trap.h @@ -1,3 +1,4 @@ -/* $OpenBSD: trap.h,v 1.24 2004/04/26 14:31:11 miod Exp $ */ +/* $OpenBSD: trap.h,v 1.25 2013/05/17 22:46:28 miod Exp $ */ /* public domain */ +#include <machine/board.h> /* md_interrupt_func */ #include <m88k/trap.h> |