sbdvar.h revision 1.1 1 1.1 tsutsui /* $NetBSD: sbdvar.h,v 1.1 2005/12/29 15:20:09 tsutsui Exp $ */
2 1.1 tsutsui
3 1.1 tsutsui /*-
4 1.1 tsutsui * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
5 1.1 tsutsui * All rights reserved.
6 1.1 tsutsui *
7 1.1 tsutsui * This code is derived from software contributed to The NetBSD Foundation
8 1.1 tsutsui * by UCHIYAMA Yasushi.
9 1.1 tsutsui *
10 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
11 1.1 tsutsui * modification, are permitted provided that the following conditions
12 1.1 tsutsui * are met:
13 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
14 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
15 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
17 1.1 tsutsui * documentation and/or other materials provided with the distribution.
18 1.1 tsutsui * 3. All advertising materials mentioning features or use of this software
19 1.1 tsutsui * must display the following acknowledgement:
20 1.1 tsutsui * This product includes software developed by the NetBSD
21 1.1 tsutsui * Foundation, Inc. and its contributors.
22 1.1 tsutsui * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 tsutsui * contributors may be used to endorse or promote products derived
24 1.1 tsutsui * from this software without specific prior written permission.
25 1.1 tsutsui *
26 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 tsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 tsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 tsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 tsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 tsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 tsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 tsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 tsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 tsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 tsutsui * POSSIBILITY OF SUCH DAMAGE.
37 1.1 tsutsui */
38 1.1 tsutsui
39 1.1 tsutsui #ifndef _EWS4800MIPS_SBDVAR_H_
40 1.1 tsutsui #define _EWS4800MIPS_SBDVAR_H_
41 1.1 tsutsui
42 1.1 tsutsui #include <sys/kcore.h> /* phys_ram_seg_t */
43 1.1 tsutsui
44 1.1 tsutsui #include <machine/autoconf.h> /* mainbus_attach_args */
45 1.1 tsutsui #include <machine/vmparam.h> /* VM_PHYSSEG_MAX */
46 1.1 tsutsui #include <machine/sbd.h> /* enum sbd_machine_type */
47 1.1 tsutsui #include <machine/sbdiovar.h> /* sbdio_attach_args */
48 1.1 tsutsui
49 1.1 tsutsui /* Software representation of system board */
50 1.1 tsutsui struct sbd {
51 1.1 tsutsui /* Machine identification */
52 1.1 tsutsui enum sbd_machine_type machine;
53 1.1 tsutsui char name[32];
54 1.1 tsutsui int cpu_clock;
55 1.1 tsutsui
56 1.1 tsutsui /* mainbus node table */
57 1.1 tsutsui const char **mainbusdevs;
58 1.1 tsutsui
59 1.1 tsutsui /* System Board I/O device table */
60 1.1 tsutsui const struct sbdiodevdesc *sbdiodevs;
61 1.1 tsutsui
62 1.1 tsutsui /* Memory */
63 1.1 tsutsui phys_ram_seg_t mem_clseters[VM_PHYSSEG_MAX];
64 1.1 tsutsui size_t mem_size; /* total size of memory */
65 1.1 tsutsui
66 1.1 tsutsui void (*mem_init)(void *, void *);
67 1.1 tsutsui
68 1.1 tsutsui /* Cache configuration (determine L2-cache size) */
69 1.1 tsutsui void (*cache_config)(void);
70 1.1 tsutsui
71 1.1 tsutsui /* Write buffer */
72 1.1 tsutsui void (*wbflush)(void);
73 1.1 tsutsui
74 1.1 tsutsui /* Interrupt services */
75 1.1 tsutsui void (*intr_init)(void);
76 1.1 tsutsui void *(*intr_establish)(int, int (*)(void *), void *);
77 1.1 tsutsui void (*intr_disestablish)(void *);
78 1.1 tsutsui void (*intr)(uint32_t, uint32_t, uint32_t, uint32_t);
79 1.1 tsutsui
80 1.1 tsutsui /* Interval timer helper routines */
81 1.1 tsutsui void (*initclocks)(void);
82 1.1 tsutsui u_long (*readclock)(void);
83 1.1 tsutsui
84 1.1 tsutsui /* Miscellaneous */
85 1.1 tsutsui void (*consinit)(void);
86 1.1 tsutsui int (*ipl_bootdev)(void);
87 1.1 tsutsui void (*reboot)(void);
88 1.1 tsutsui void (*poweroff)(void);
89 1.1 tsutsui void (*ether_addr)(uint8_t *);
90 1.1 tsutsui };
91 1.1 tsutsui
92 1.1 tsutsui #define SBD_DECL(x) \
93 1.1 tsutsui void x ## _cache_config(void); \
94 1.1 tsutsui void x ## _wbflush(void); \
95 1.1 tsutsui void x ## _mem_init(void *, void *); \
96 1.1 tsutsui void x ## _intr_init(void); \
97 1.1 tsutsui void * x ## _intr_establish(int, int (*)(void *), void *); \
98 1.1 tsutsui void x ## _intr_disestablish(void *); \
99 1.1 tsutsui void x ## _intr(uint32_t, uint32_t, uint32_t, uint32_t); \
100 1.1 tsutsui void x ## _initclocks(void); \
101 1.1 tsutsui u_long x ## _readclock(void); \
102 1.1 tsutsui void x ## _consinit(void); \
103 1.1 tsutsui int x ## _ipl_bootdev(void); \
104 1.1 tsutsui void x ## _reboot(void); \
105 1.1 tsutsui void x ## _poweroff(void); \
106 1.1 tsutsui void x ## _ether_addr(uint8_t *); \
107 1.1 tsutsui extern const uint32_t x ## _sr_bits[]
108 1.1 tsutsui
109 1.1 tsutsui #define _SBD_OPS_SET(m, x) platform . x = m ## _ ## x
110 1.1 tsutsui
111 1.1 tsutsui #define _SBD_OPS_REGISTER_ALL(m) \
112 1.1 tsutsui _SBD_OPS_SET(m, cache_config); \
113 1.1 tsutsui _SBD_OPS_SET(m, wbflush); \
114 1.1 tsutsui _SBD_OPS_SET(m, mem_init); \
115 1.1 tsutsui _SBD_OPS_SET(m, intr_init); \
116 1.1 tsutsui _SBD_OPS_SET(m, intr_establish); \
117 1.1 tsutsui _SBD_OPS_SET(m, intr_disestablish); \
118 1.1 tsutsui _SBD_OPS_SET(m, intr); \
119 1.1 tsutsui _SBD_OPS_SET(m, initclocks); \
120 1.1 tsutsui _SBD_OPS_SET(m, readclock); \
121 1.1 tsutsui _SBD_OPS_SET(m, consinit); \
122 1.1 tsutsui _SBD_OPS_SET(m, ipl_bootdev); \
123 1.1 tsutsui _SBD_OPS_SET(m, reboot); \
124 1.1 tsutsui _SBD_OPS_SET(m, poweroff); \
125 1.1 tsutsui _SBD_OPS_SET(m, ether_addr); \
126 1.1 tsutsui
127 1.1 tsutsui
128 1.1 tsutsui extern struct sbd platform;
129 1.1 tsutsui
130 1.1 tsutsui extern int mem_cluster_cnt;
131 1.1 tsutsui extern phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
132 1.1 tsutsui
133 1.1 tsutsui void sbd_init(void);
134 1.1 tsutsui void sbd_set_mainfo(uint32_t);
135 1.1 tsutsui
136 1.1 tsutsui void sbd_memcluster_init(uint32_t);
137 1.1 tsutsui void sbd_memcluster_setup(void *, void *);
138 1.1 tsutsui void sbd_memcluster_check(void);
139 1.1 tsutsui
140 1.1 tsutsui void tr2_init(void);
141 1.1 tsutsui void tr2a_init(void);
142 1.1 tsutsui
143 1.1 tsutsui #endif /* !_EWS4800MIPS_SBDVAR_H_ */
144 1.1 tsutsui
145