Don't print warning about unassigned interrupt lines on bridges.
[AROS.git] / arch / m68k-all / m680x0 / init.c
blobef4c6f6b40f9dce5cc8293079c5287fe3395baac
2 #include <aros/debug.h>
3 #include <aros/libcall.h>
4 #include <aros/symbolsets.h>
6 #include <proto/exec.h>
8 #include "m680x0_intern.h"
10 extern void sp060_init(void);
12 static AROS_UFH2(struct Library*, OpenLib,
13 AROS_UFHA(ULONG, version, D0),
14 AROS_UFHA(struct Library*, base, A6))
16 AROS_USERFUNC_INIT
18 base->lib_OpenCnt++;
19 return base;
21 AROS_USERFUNC_EXIT
24 static AROS_UFH1(void, CloseLib,
25 AROS_UFHA(struct Library*, base, A6))
27 AROS_USERFUNC_INIT
29 base->lib_OpenCnt--;
31 AROS_USERFUNC_EXIT
34 static AROS_UFH1(ULONG, DummyLib,
35 AROS_UFHA(struct Library*, base, A6))
37 AROS_USERFUNC_INIT
39 return 0;
41 AROS_USERFUNC_EXIT
44 /* This is totally undocumented so complain if something calls our functions */
45 #define UNUSED(x) \
46 static AROS_UFH1(ULONG, x, \
47 AROS_UFHA(struct Library*, base, A6)) { \
48 AROS_USERFUNC_INIT \
49 bug("680x0: " #x "\n"); \
50 return 0; \
51 AROS_USERFUNC_EXIT \
54 UNUSED(Unused5);
55 UNUSED(Unused6);
56 UNUSED(Unused7);
57 UNUSED(Unused8);
58 UNUSED(Unused9);
59 UNUSED(Unused10);
60 UNUSED(Unused11);
61 UNUSED(Unused12);
62 UNUSED(Unused13);
63 UNUSED(Unused14);
64 UNUSED(Unused15);
65 UNUSED(Unused16);
67 static const APTR funcLib[] = {
68 OpenLib, CloseLib, DummyLib, DummyLib,
69 Unused5,
70 Unused6,
71 Unused7,
72 Unused8,
73 Unused9,
74 Unused10,
75 Unused11,
76 Unused12,
77 Unused13,
78 Unused14,
79 Unused15,
80 Unused16,
81 (void*)-1 };
83 static const UBYTE lib68040[] = "68040.library";
84 static const UBYTE lib68060[] = "68060.library";
86 /* m68k identify.library calls these, purpose unknown */
87 AROS_LH0(ULONG, Dummy1, struct M680x0Base*, M680x0Base, 5, m680x0)
89 AROS_LIBFUNC_INIT
90 bug("680x0: dummy1\n");
91 return 0;
92 AROS_LIBFUNC_EXIT
94 AROS_LH0(ULONG, Dummy2, struct M680x0Base*, M680x0Base, 6, m680x0)
96 AROS_LIBFUNC_INIT
97 bug("680x0: dummy2\n");
98 return 0;
99 AROS_LIBFUNC_EXIT
101 AROS_LH0(ULONG, Dummy3, struct M680x0Base*, M680x0Base, 7, m680x0)
103 AROS_LIBFUNC_INIT
104 bug("680x0: dummy3\n");
105 return 0;
106 AROS_LIBFUNC_EXIT
108 AROS_LH0(ULONG, Dummy4, struct M680x0Base*, M680x0Base, 8, m680x0)
110 AROS_LIBFUNC_INIT
111 bug("680x0: dummy4\n");
112 return 0;
113 AROS_LIBFUNC_EXIT
116 static int M680x0Init(struct M680x0Base *M680x0Base)
118 struct Library *lib;
120 if (!(SysBase->AttnFlags & (AFF_68040 | AFF_68060)))
121 return FALSE; /* 68040/060 only need emulation */
122 if (SysBase->AttnFlags & AFF_68882)
123 return FALSE; /* we already have full support? */
124 if (!(SysBase->AttnFlags & AFF_FPU40))
125 return FALSE; /* no FPU, don't bother with missing instruction emulation */
127 /* initialize emulation here */
128 sp060_init();
130 /* Create fake 68040/060.library, stops C:SetPatch from attempting to load
131 * incompatible 68040/060 libraries.
133 * We also create both 68040 and 68060.library if 68060 is detected, it prevents
134 * old SetPatch versions (that do not know about 68060) from loading 68040.library.
136 * (Maybe this is getting too far..)
138 if (SysBase->AttnFlags & AFF_68060) {
139 lib = MakeLibrary(funcLib, NULL, NULL, sizeof(struct Library), BNULL);
140 if (lib) {
141 lib->lib_Node.ln_Name = (UBYTE*)lib68060;
142 lib->lib_IdString = lib->lib_Node.ln_Name;
143 lib->lib_Version = M680x0Base->pb_LibNode.lib_Version;
144 lib->lib_Revision = M680x0Base->pb_LibNode.lib_Revision;
145 lib->lib_OpenCnt = 1;
146 AddLibrary(lib);
149 lib = MakeLibrary(funcLib, NULL, NULL, sizeof(struct Library), BNULL);
150 if (lib) {
151 lib->lib_Node.ln_Name = (UBYTE*)lib68040;
152 lib->lib_IdString = lib->lib_Node.ln_Name;
153 lib->lib_Version = M680x0Base->pb_LibNode.lib_Version;
154 lib->lib_Revision = M680x0Base->pb_LibNode.lib_Revision;
155 lib->lib_OpenCnt = 1;
156 AddLibrary(lib);
159 /* emulation installed, full 68881/68882 instruction set now supported */
160 SysBase->AttnFlags |= AFF_68881 | AFF_68882;
161 /* do not expunge us */
162 M680x0Base->pb_LibNode.lib_OpenCnt++;
163 return TRUE;
166 ADD2INITLIB(M680x0Init, 0)