1376
1377 /* Grab the lock so that no one can read flash when we reset the chip */
1378 (void) ql_8021_rom_lock(ha);
1379 ql_8021_wr_32(ha, UNM_ROMUSB_GLB_SW_RESET, 0xffffffff);
1380 /* Just in case it was held when we reset the chip */
1381 ql_8021_rom_unlock(ha);
1382
1383 if (ql_8021_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafe ||
1384 ql_8021_rom_fast_read(ha, 4, &n) != 0) {
1385 EL(ha, "ERROR Reading crb_init area: n: %08x\n", n);
1386 return (-1);
1387 }
1388 offset = n & 0xffff;
1389 n = (n >> 16) & 0xffff;
1390 if (n >= 1024) {
1391 EL(ha, "n=0x%x Error! NetXen card flash not initialized\n", n);
1392 return (-1);
1393 }
1394
1395 buf = kmem_zalloc(n * sizeof (struct crb_addr_pair), KM_SLEEP);
1396 if (buf == NULL) {
1397 EL(ha, "Unable to zalloc memory\n");
1398 return (-1);
1399 }
1400
1401 for (i = 0; i < n; i++) {
1402 if (ql_8021_rom_fast_read(ha, 8 * i + 4 * offset, &val) != 0 ||
1403 ql_8021_rom_fast_read(ha, 8 * i + 4 * offset + 4, &addr) !=
1404 0) {
1405 kmem_free(buf, n * sizeof (struct crb_addr_pair));
1406 EL(ha, "ql_8021_rom_fast_read != 0 to zalloc memory\n");
1407 return (-1);
1408 }
1409
1410 buf[i].addr = addr;
1411 buf[i].data = val;
1412 }
1413
1414 for (i = 0; i < n; i++) {
1415 off = ql_8021_decode_crb_addr(ha, buf[i].addr);
1416 if (off == ADDR_ERROR) {
1417 EL(ha, "Err: Unknown addr: 0x%lx\n", buf[i].addr);
1418 continue;
1419 }
|
1376
1377 /* Grab the lock so that no one can read flash when we reset the chip */
1378 (void) ql_8021_rom_lock(ha);
1379 ql_8021_wr_32(ha, UNM_ROMUSB_GLB_SW_RESET, 0xffffffff);
1380 /* Just in case it was held when we reset the chip */
1381 ql_8021_rom_unlock(ha);
1382
1383 if (ql_8021_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafe ||
1384 ql_8021_rom_fast_read(ha, 4, &n) != 0) {
1385 EL(ha, "ERROR Reading crb_init area: n: %08x\n", n);
1386 return (-1);
1387 }
1388 offset = n & 0xffff;
1389 n = (n >> 16) & 0xffff;
1390 if (n >= 1024) {
1391 EL(ha, "n=0x%x Error! NetXen card flash not initialized\n", n);
1392 return (-1);
1393 }
1394
1395 buf = kmem_zalloc(n * sizeof (struct crb_addr_pair), KM_SLEEP);
1396
1397 for (i = 0; i < n; i++) {
1398 if (ql_8021_rom_fast_read(ha, 8 * i + 4 * offset, &val) != 0 ||
1399 ql_8021_rom_fast_read(ha, 8 * i + 4 * offset + 4, &addr) !=
1400 0) {
1401 kmem_free(buf, n * sizeof (struct crb_addr_pair));
1402 EL(ha, "ql_8021_rom_fast_read != 0 to zalloc memory\n");
1403 return (-1);
1404 }
1405
1406 buf[i].addr = addr;
1407 buf[i].data = val;
1408 }
1409
1410 for (i = 0; i < n; i++) {
1411 off = ql_8021_decode_crb_addr(ha, buf[i].addr);
1412 if (off == ADDR_ERROR) {
1413 EL(ha, "Err: Unknown addr: 0x%lx\n", buf[i].addr);
1414 continue;
1415 }
|