21 #define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
22 #define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
26 static dword notify_handle;
37 static void no_printf(
unsigned char *
x, ...)
51 DBG_ERR((
"cb: Change in DAdapter ? Oops ?."));
55 memset(&MAdapter, 0,
sizeof(MAdapter));
58 memcpy(&MAdapter, adapter,
sizeof(MAdapter));
62 }
else if ((adapter->
type > 0) && (adapter->
type < 16)) {
75 static int __init connect_didd(
void)
87 memcpy(&DAdapter, &DIDD_Table[x],
sizeof(DAdapter));
91 req.
didd_notify.info.callback = (
void *)didd_callback;
102 (
void *) &MaintDescriptor;
106 }
else if ((DIDD_Table[x].
type > 0)
107 && (DIDD_Table[x].
type < 16)) {
117 static void __exit disconnect_didd(
void)
142 if (count < (3 *
sizeof(
dword)))
146 buf, 3 *
sizeof(
dword))) {
150 cmd = *(
dword *)&data[0];
151 id = *(
dword *)&data[4];
152 mask = *(
dword *)&data[8];
158 (
NULL, buf, (
void *) &data[0], ret))
168 (
NULL, buf, (
void *) &data[0], ret))
189 }
else if (mask <
sizeof(data)) {
215 if (!(pbuf = diva_os_malloc(0, mask))) {
232 if ((count < size) ||
237 diva_os_free(0, pbuf);
252 if (!(pbuf = diva_os_malloc(0, mask))) {
261 if ((size + 8) > mask) {
268 pbuf[written++] = (
byte) size;
269 pbuf[written++] = (
byte) (size >> 8);
275 memcpy(&pbuf[written], pmsg, size);
290 diva_os_free(0, pbuf);
304 unsigned long diva_dbg_mem)
306 if (*buffer_length < 64) {
309 if (*buffer_length > 512) {
310 *buffer_length = 512;
312 *buffer_length *= 1024;
315 *buffer = (
void *) diva_dbg_mem;
317 while ((*buffer_length >= (64 * 1024))
319 (!(*buffer = diva_os_malloc(0, *buffer_length)))) {
320 *buffer_length -= 1024;
324 DBG_ERR((
"init: Can not alloc trace buffer"));
331 diva_os_free(0, *buffer);
333 DBG_ERR((
"init: maint init failed"));
337 if (!connect_didd()) {
338 DBG_ERR((
"init: failed to connect to DIDD."));
341 diva_os_free(0, *buffer);
365 diva_os_free(0, buffer);
368 memset(&MAdapter, 0,
sizeof(MAdapter));