29 #define DIVA_PRI_NO_PCI_BIOS_WORKAROUND 1
50 static int pri_is_rev_2_card(
int card_ordinal)
52 switch (card_ordinal) {
99 unsigned long bar_length[5] = {
122 for (bar = 0; bar < 5; bar++) {
129 DBG_ERR((
"A: invalid bar[%d]=%08x", bar,
146 for (bar = 0; bar < 5; bar++) {
151 DBG_ERR((
"A: A(%d), can't map bar[%d]",
153 diva_pri_cleanup_adapter(a);
161 diva_pri_set_addresses(a);
166 if (pri_get_serial_number(a)) {
172 DBG_ERR((
"A: A(%d) can't get Serial Number, generated serNo=%ld",
181 diva_pri_cleanup_adapter(a);
184 if (diva_os_initialize_spin_lock
186 diva_pri_cleanup_adapter(a);
194 diva_pri_cleanup_adapter(a);
214 diva_pri_cleanup_adapter(a);
230 a->
dsp_mask = diva_pri_detect_dsps(a);
249 diva_pri_cleanup_adapter(a);
268 diva_pri_stop_adapter(a);
282 for (bar = 0; bar < 5; bar++) {
342 DBG_ERR((
"A: A(%d) can't reset PRI adapter - please stop first",
351 IoAdapter->rstFnc(IoAdapter);
361 DBG_ERR((
"A: A(%d) CPU on PRI %ld is not alive!",
362 IoAdapter->ANum, IoAdapter->serialNo))
366 DBG_ERR((
"A: A(%d) PRI %ld Board Selftest failed, error=%08lx",
367 IoAdapter->ANum, IoAdapter->serialNo,
377 IoAdapter->e_count = 0;
378 if (IoAdapter->e_tbl) {
379 memset(IoAdapter->e_tbl, 0x00,
380 IoAdapter->e_max *
sizeof(
E_INFO));
384 IoAdapter->assign = 0;
385 IoAdapter->trapped = 0;
387 memset(&IoAdapter->a.IdTable[0], 0x00,
388 sizeof(IoAdapter->a.IdTable));
389 memset(&IoAdapter->a.IdTypeTable[0], 0x00,
390 sizeof(IoAdapter->a.IdTypeTable));
391 memset(&IoAdapter->a.FlowControlIdTable[0], 0x00,
392 sizeof(IoAdapter->a.FlowControlIdTable));
393 memset(&IoAdapter->a.FlowControlSkipTable[0], 0x00,
394 sizeof(IoAdapter->a.FlowControlSkipTable));
395 memset(&IoAdapter->a.misc_flags_table[0], 0x00,
396 sizeof(IoAdapter->a.misc_flags_table));
397 memset(&IoAdapter->a.rx_stream[0], 0x00,
398 sizeof(IoAdapter->a.rx_stream));
399 memset(&IoAdapter->a.tx_stream[0], 0x00,
400 sizeof(IoAdapter->a.tx_stream));
401 memset(&IoAdapter->a.tx_pos[0], 0x00,
sizeof(IoAdapter->a.tx_pos));
402 memset(&IoAdapter->a.rx_pos[0], 0x00,
sizeof(IoAdapter->a.rx_pos));
415 if (((address + length) >= limit) || !mem) {
417 DBG_ERR((
"A: A(%d) write PRI address=0x%08lx",
418 IoAdapter->
ANum, address + length))
444 DBG_ERR((
"A: A(%d) pri_start_adapter, adapter already running",
450 DBG_ERR((
"A: PRI %ld can't start, adapter not mapped",
455 sprintf(IoAdapter->Name, "
A(%
d)", (
int) IoAdapter->ANum);
462 for (i = 0; i < 300; ++i) {
464 if ((
READ_DWORD(&boot->signature) >> 16) == 0x4447) {
465 DBG_LOG((
"A(%d) Protocol startup time %d.%02d seconds",
466 IoAdapter->
ANum, (i / 100), (i % 100)))
478 DBG_ERR((
"A(%d) Adapter start failed 0x%08lx, TrapId=%08lx, debug=%08lx",
482 if (IoAdapter->trapFnc) {
483 (*(IoAdapter->trapFnc)) (IoAdapter);
485 IoAdapter->
stop(IoAdapter);
502 for (i = 100; !IoAdapter->
IrqCount && (i-- > 0); diva_os_wait(10));
505 DBG_ERR((
"A: A(%d) interrupt test failed",
507 IoAdapter->Initialized =
false;
508 IoAdapter->
stop(IoAdapter);
532 IoAdapter->
disIrq(IoAdapter);
554 if (!IoAdapter->
ram) {
558 DBG_ERR((
"A: A(%d) can't stop PRI adapter - not running",
562 IoAdapter->Initialized = 0;
572 a->clear_interrupts_proc = diva_pri_clear_interrupts;
573 IoAdapter->a.ReadyInt = 1;
574 IoAdapter->a.ram_inc(&IoAdapter->a, &
PR_RAM->ReadyInt);
580 diva_pri_clear_interrupts(a);
582 DBG_ERR((
"A: A(%d) no final interrupt from PRI adapter",
590 IoAdapter->
stop(IoAdapter);
608 DBG_ERR((
"A: pri_cmd, invalid controller=%d != %d",
646 for (i = 0; i < 8; i++) {
666 pri_is_rev_2_card(a->
673 ret = diva_pri_stop_adapter(a);
689 DBG_TRC((
"Set raw protocol features (%08x)",
698 if (a->xdi_mbox.data) {
789 for (i = 0; i <
len; i++) {
790 data[
i] =
READ_BYTE(&flash[0x8000 - len + i]);
799 if (
memcmp(&data[48],
"DIVAserverPR", 12)) {
800 #if !defined(DIVA_PRI_NO_PCI_BIOS_WORKAROUND)
801 word cmd = 0, cmd_org;
810 DBG_ERR((
"A: apply Compaq BIOS workaround"))
812 data[0], data[1], data[2], data[3],
813 data[4], data[5], data[6], data[7]))
840 if (!(config[0xc3c] & 0x08)) {
841 config[0xc3c] |= 0x08;
849 for (i = 0; i <
len; i++) {
850 data[
i] = flash[0x8000 - len +
i];
858 if (
memcmp(&data[48],
"DIVAserverPR", 12)) {
859 DBG_ERR((
"A: failed to read serial number"))
861 data[0], data[1], data[2], data[3],
862 data[4], data[5], data[6], data[7]))
866 DBG_ERR((
"A: failed to read DIVA signature word"))
867 DBG_LOG(("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
868 data[0], data[1], data[2], data[3],
869 data[4], data[5], data[6], data[7]))
870 DBG_LOG(("%02x:%02x:%02x:%02x", data[47], data[46],
876 (data[47] << 24) | (data[46] << 16) | (data[45] << 8) |
881 DBG_ERR((
"A: failed to read serial number"))
885 DBG_LOG(("Serial
No. : %
ld", a->xdi_adapter.serialNo))
894 (
int) ((data[28] > 90) ? 1900 : 2000) +
895 (
int) data[28], (
int) data[29], (
int) data[30]))
923 DBG_TRC((
"W: DSP[%d] %04x(is) != %04x(should)",
934 if (pattern != (
word)~DSP_SIGNATURE_PROBE_WORD) {
935 DBG_ERR((
"A: DSP[%d] %04x(is) != %04x(should)",
936 dsp, pattern, (
word)~DSP_SIGNATURE_PROBE_WORD))
960 dword row_offset[7] = {
972 int dsp_row = 0, dsp_index, dsp_num;
974 if (!a->xdi_adapter.Control || !a->xdi_adapter.reset) {
985 for (dsp_num = 0; dsp_num < 30; dsp_num++) {
986 dsp_row = dsp_num / 7 + 1;
987 dsp_index = dsp_num % 7;
989 dsp_data_port = base;
990 dsp_addr_port = base;
992 dsp_data_port += row_offset[dsp_row];
993 dsp_addr_port += row_offset[dsp_row];
995 dsp_data_port += (dsp_index * 8);
996 dsp_addr_port += (dsp_index * 8) + 0x80;
998 if (!dsp_check_presence
999 (dsp_addr_port, dsp_data_port, dsp_num + 1)) {
1000 ret |= (1 << dsp_num);
1013 for (dsp_row = 0; dsp_row < 4; dsp_row++) {
1014 row_state = ((ret >> (dsp_row * 7)) & 0x7F);
1015 if (row_state && (row_state != 0x7F)) {
1016 for (dsp_index = 0; dsp_index < 7; dsp_index++) {
1017 if (!(row_state & (1 << dsp_index))) {
1018 DBG_ERR((
"A: MODULE[%d]-DSP[%d] failed",
1026 if (!(ret & 0x10000000)) {
1027 DBG_ERR((
"A: ON BOARD-DSP[1] failed"))
1029 if (!(ret & 0x20000000)) {
1030 DBG_ERR((
"A: ON BOARD-DSP[2] failed"))
1036 DBG_LOG((
"+-----------------------+"))
1038 DBG_LOG(("+-----------------------+"))
1039 DBG_LOG(("| 1 | 2 | 3 | 4 |"))
1040 DBG_LOG(("+-----------------------+"))
1042 ((ret >> (0 * 7)) & 0x7F) ? "Y" : "
N",
1043 ((ret >> (1 * 7)) & 0x7F) ? "Y" : "N",
1044 ((ret >> (2 * 7)) & 0x7F) ? "Y" : "N",
1045 ((ret >> (3 * 7)) & 0x7F) ? "Y" : "N"))
1046 DBG_LOG(("+-----------------------+"))
1048 DBG_LOG(("
DSP's(present-absent):%08x-%08x", ret,