apbus.h revision 1.1 1 /* $NetBSD: apbus.h,v 1.1 1999/12/22 05:53:21 tsubai Exp $ */
2
3 /*-
4 * Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef __MACHINE_APBUS__
30 #define __MACHINE_APBUS__
31
32 struct apbus_ctl {
33 int apbc_ctlno;
34 int apbc_mu;
35 int apbc_unknown2;
36 void *apbc_sladdr;
37
38 int apbc_unknown4;
39 int apbc_hwbase;
40 char *apbc_softc;
41 void *apbc_ent7;
42
43 int apbc_unknown8;
44 int apbc_sl;
45
46 struct apbus_ctl *apbc_slave0;
47 int apbc_slave0no;
48 int apbc_unknown12;
49 int apbc_unknown13;
50
51 struct apbus_ctl *apbc_slave1;
52 int apbc_slave1no;
53 int apbc_unknown16;
54 int apbc_unknown17;
55
56 struct apbus_ctl *apbc_slave2;
57 int apbc_slave2no;
58 int apbc_unknown20;
59 int apbc_unknown21;
60
61 struct apbus_ctl *apbc_parent;
62 int apbc_parentno;
63 int apbc_unknown24;
64 int apbc_unknown25;
65
66 struct apbus_ctl *apbc_link;
67 int apbc_unknown27;
68 int apbc_unknown28;
69 int apbc_unknown29;
70 int apbc_unknown30;
71 int apbc_unknown31;
72 };
73
74 struct apbus_device {
75 char *apbd_name;
76 char *apbd_vendor;
77 unsigned int apbd_atr;
78 #define APBD_CHAR 0x00000001
79 #define APBD_STDIN 0x00000002
80 #define APBD_STDOUT 0x00000004
81 unsigned int apbd_rev;
82 void* apbd_driver;
83 struct {
84 int (*func0)();
85 int (*func1)();
86 int (*func2)();
87 int (*func3)();
88 int (*func4)();
89 int (*func5)();
90 int (*func6)();
91 int (*func7)();
92 int (*func8)();
93 int (*func9)();
94 int (*func10)();
95 int (*func11)();
96 int (*func12)();
97 int (*func13)();
98 int (*func14)();
99 int (*func15)();
100 } apbd_call;
101 struct apbus_ctl *apbd_ctl;
102 struct apbus_device *apbd_link;
103 unsigned int apbd_unknwon;
104 };
105
106 struct apbus_bus {
107 unsigned int apbb_no;
108 void *apbb_unknown1;
109 void *apbb_unknown2;
110 void *apbb_unknown3;
111 struct apbus_bus *apbb_link;
112 unsigned int apbb_unknown5;
113 unsigned int apbb_unknown6;
114 unsigned int apbb_unknown7;
115 unsigned int apbb_unknown8;
116 };
117
118 struct apbus_vector {
119 unsigned short state;
120 unsigned short mask;
121 unsigned int (*handler)();
122 };
123
124 struct apbus_sysinfo {
125 int apbsi_revision;
126 int (*apbsi_call)();
127 unsigned int apbsi_error1;
128 void * apbsi_progstart;
129
130 void * apbsi_progend;
131 struct apbus_device *apbsi_dev;
132 struct apbus_bus *apbsi_bus;
133 unsigned int apbsi_error2;
134
135 unsigned int apbsi_basel;
136 unsigned int apbsi_baseh;
137 unsigned int apbsi_memsize;
138 unsigned int apbsi_tmpsize;
139
140 unsigned int apbsi_freesize;
141 unsigned char *apbsi_sram;
142 void *apbsi_io;
143 void *apbsi_alloc;
144
145 void *apbsi_cmdtable;
146 unsigned int apbsi_none0;
147 struct apbus_vector apbsi_vector[8];
148 void (*apbsi_trap)();
149 unsigned int apbsi_romversion;
150 unsigned char apbsi_none1[112];
151 };
152
153 /*
154 * FYI: result of 'ss -m' command on NEWS5000 rom monitor on my machine...
155 *
156 * > ss -m
157 * Memory use:
158 * diag info: bf881800
159 * environ: bf881000
160 * apinfo: bf880000
161 * sysinfo: 9ff03270 -> struct apbus_sysinfo
162 * alloc list: ffffbff8
163 * max mem: 04000000
164 * free mem: 03ff1678
165 * mem base: 100000000
166 *
167 */
168
169 extern struct apbus_sysinfo *_sip;
170 void apbus_wbflush __P((void));
171
172 #endif /* !__MACHINE_APBUS__ */
173