44 static void Request##N(ENTITY *e) \
45 { if (IoAdapters[N]) (*IoAdapters[N]->DIRequest)(IoAdapters[N], e); }
63 { &Request0, &Request1, &Request2, &Request3,
64 &Request4, &Request5, &Request6, &Request7,
65 &Request8, &Request9, &Request10, &Request11,
66 &Request12, &Request13, &Request14, &Request15
77 #if defined(DIVA_IDI_RX_DMA)
92 word logOut = xlogDesc->
out /
sizeof(*Xlog);
93 DBG_FTL((
"%s: ************* XLOG recovery (%d) *************",
94 &IoAdapter->
Name[0], (
int)logCnt))
96 for (; logCnt > 0; --logCnt)
98 if (!GET_WORD(&Xlog[logOut]))
104 if (GET_WORD(&Xlog[logOut]) <= (logOut *
sizeof(*Xlog)))
108 DBG_FTL((
"Possibly corrupted XLOG: %d entries left",
113 logLen = (
dword)(GET_WORD(&Xlog[logOut]) - (logOut *
sizeof(*Xlog)));
115 logOut = (GET_WORD(&Xlog[logOut]) + 1) /
sizeof(*Xlog);
117 DBG_FTL((
"%s: ***************** end of XLOG *****************",
118 &IoAdapter->
Name[0]))
121 #if defined(XDI_USE_XLOG)
122 static char *(ExceptionCauseTable[]) =
128 "Address error load",
129 "Address error store",
130 "Instruction load bus error",
131 "Data load/store bus error",
134 "Reverd instruction",
135 "Coprocessor unusable",
139 "Floating Point Exception",
163 regs = &xcept->regs[0];
164 DBG_FTL((
"%s: ***************** CPU TRAPPED *****************",
165 &IoAdapter->
Name[0]))
168 ExceptionCauseTable[(
READ_DWORD(&xcept->cr) & 0x0000007c) >> 2]))
169 DBG_FTL((
"sr 0x%08x cr 0x%08x epc 0x%08x vaddr 0x%08x",
172 DBG_FTL((
"zero 0x%08x at 0x%08x v0 0x%08x v1 0x%08x",
175 DBG_FTL((
"a0 0x%08x a1 0x%08x a2 0x%08x a3 0x%08x",
178 DBG_FTL((
"t0 0x%08x t1 0x%08x t2 0x%08x t3 0x%08x",
181 DBG_FTL((
"t4 0x%08x t5 0x%08x t6 0x%08x t7 0x%08x",
184 DBG_FTL((
"s0 0x%08x s1 0x%08x s2 0x%08x s3 0x%08x",
187 DBG_FTL((
"s4 0x%08x s5 0x%08x s6 0x%08x s7 0x%08x",
190 DBG_FTL((
"t8 0x%08x t9 0x%08x k0 0x%08x k1 0x%08x",
193 DBG_FTL((
"gp 0x%08x sp 0x%08x s8 0x%08x ra 0x%08x",
196 DBG_FTL((
"md 0x%08x|%08x resvd 0x%08x class 0x%08x",
216 #if defined(DIVA_IDI_RX_DMA)
225 diva_os_enter_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"dma_op");
235 &local_addr, &dma_magic);
252 diva_os_leave_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"dma_op");
264 memset(&prms, 0x00,
sizeof(prms));
268 DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? 1 : 0;
270 DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON) ? 1 : 0;
284 for (i = 0; ((pI->
features) && (i < pI->buffer_length_in_bytes) &&
306 DBG_TRC((
"xdi: Adapter %d / Name '%s'",
310 syncReq->GetName.
name[0] = '\0';
315 syncReq->
GetSerial.serial = IoAdapter->serialNo;
316 DBG_TRC((
"xdi: Adapter %d / SerialNo %ld",
317 IoAdapter->ANum, IoAdapter->serialNo))
320 syncReq->GetSerial.
serial = 0;
325 syncReq->
GetCardType.cardtype = IoAdapter->cardType;
326 DBG_TRC((
"xdi: Adapter %d / CardType %ld",
327 IoAdapter->ANum, IoAdapter->cardType))
335 pcm_req(IoAdapter, e);
343 pcm_req(IoAdapter, e);
352 (
unsigned short)IoAdapter->features;
360 DBG_TRC((
"Xdi:IDI_SYNC_REQ_PORTDRV_HOOK - ignored"))
370 DBG_TRC((
"xdi: Id 0x%x / Req 0x%x / Rc 0x%x", e->
Id, e->
Req, e->
Rc))
373 DBG_FTL((
"xdi: uninitialized Adapter used - ignore request"))
376 diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req");
382 if (IoAdapter->e_count >= IoAdapter->e_max)
384 DBG_FTL((
"xdi: all Ids in use (max=%d) --> Req ignored",
386 diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req");
392 for (i = 1; IoAdapter->e_tbl[i].e; ++i);
393 IoAdapter->e_tbl[i].e = e;
394 IoAdapter->e_count++;
408 DBG_FTL((
"xdi: Id 0x%x busy --> Req 0x%x ignored", e->
Id, e->
Req))
409 if (!IoAdapter->trapped && IoAdapter->trapFnc)
411 IoAdapter->trapFnc(IoAdapter);
415 if (IoAdapter->trapped && IoAdapter->os_trap_nfy_Fnc) {
416 (*(IoAdapter->os_trap_nfy_Fnc))(IoAdapter, IoAdapter->ANum);
419 diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql,
"data_req");
432 IoAdapter->e_tbl[
i].next = 0;
435 IoAdapter->e_tbl[IoAdapter->tail].next =
i;
447 diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql,
"data_req");
456 if (diva_os_atomic_increment(pin_dpc) == 1) {
465 }
while (diva_os_atomic_decrement(pin_dpc) > 0);
483 if ((
int)(a->
ram_in(a, &IoAdapter->
pcm->rc))) {
523 for (rc = 0, i = (IoAdapter->
trapped ? 3000 : 250); !rc && (i > 0); --i)
561 for (i = (IoAdapter->
trapped ? 3000 : 250); --i > 0;)
574 int trapped = IoAdapter->
trapped;
591 val =
READ_BYTE(Base + (
unsigned long)addr);
599 val =
READ_WORD((Base + (
unsigned long)addr));
607 *data++ =
READ_DWORD((Base + (
unsigned long)addr));
635 WRITE_WORD((Base + (
unsigned long)addr), data);
651 memcpy_toio((Base + (
unsigned long)addr), buffer, length);
658 WRITE_BYTE(Base + (
unsigned long)addr, x + 1);
690 adr = ((
byte *) adr) + 1;
704 outppw(Port + 4, (
word)(
unsigned long)RBuffer);
732 adr = ((
byte *) adr) + 1;
761 diva_os_enter_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_free");
764 diva_os_leave_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_free");
771 diva_os_enter_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_assign");
775 diva_os_leave_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_assign");
799 diva_os_enter_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_req_q");
801 if (IoAdapter->
head) {
803 IoAdapter->
tail = e_no;
806 IoAdapter->
head = e_no;
807 IoAdapter->
tail = e_no;
809 diva_os_leave_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_req_q");
822 diva_os_enter_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_req_next");
824 if (!IoAdapter->
head) IoAdapter->
tail = 0;
825 diva_os_leave_spin_lock(&IoAdapter->
data_spin_lock, &irql,
"data_req_next");
838 return ((
void *) e->
X);
842 return ((
void *) e->
R);