diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-11-17 13:23:42 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2015-11-25 22:08:29 -0500 |
commit | ea41ed600b261fec87820c1aa2455942dcfa1ce7 (patch) | |
tree | ca9b3d35e1da95be8ded4259dab27f33f418fcd8 | |
parent | 1940ed62f9ca6d0b1f4c10afef3960f4f8a7d327 (diff) |
atp870u: Untangle tmport #4
Untangle the tmport crap so it becomes obvious what ports are accessed.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/atp870u.c | 370 |
1 files changed, 138 insertions, 232 deletions
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index a23f38717d90..3e3a68b2738d 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -1207,7 +1207,6 @@ G2Q_QUIN: /* k=binID#, */ | |||
1207 | 1207 | ||
1208 | static void is870(struct atp_unit *dev, unsigned int wkport) | 1208 | static void is870(struct atp_unit *dev, unsigned int wkport) |
1209 | { | 1209 | { |
1210 | unsigned int tmport; | ||
1211 | unsigned char i, j, k, rmb, n; | 1210 | unsigned char i, j, k, rmb, n; |
1212 | unsigned short int m; | 1211 | unsigned short int m; |
1213 | static unsigned char mbuf[512]; | 1212 | static unsigned char mbuf[512]; |
@@ -1218,8 +1217,7 @@ static void is870(struct atp_unit *dev, unsigned int wkport) | |||
1218 | static unsigned char synw[6] = { 0x80, 1, 3, 1, 0x0c, 0x07 }; | 1217 | static unsigned char synw[6] = { 0x80, 1, 3, 1, 0x0c, 0x07 }; |
1219 | static unsigned char wide[6] = { 0x80, 1, 2, 3, 1, 0 }; | 1218 | static unsigned char wide[6] = { 0x80, 1, 2, 3, 1, 0 }; |
1220 | 1219 | ||
1221 | tmport = wkport + 0x3a; | 1220 | outb((unsigned char) (inb(wkport + 0x3a) | 0x10), wkport + 0x3a); |
1222 | outb((unsigned char) (inb(tmport) | 0x10), tmport); | ||
1223 | 1221 | ||
1224 | for (i = 0; i < 16; i++) { | 1222 | for (i = 0; i < 16; i++) { |
1225 | if ((dev->chip_ver != 4) && (i > 7)) { | 1223 | if ((dev->chip_ver != 4) && (i > 7)) { |
@@ -1234,135 +1232,105 @@ static void is870(struct atp_unit *dev, unsigned int wkport) | |||
1234 | printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[0]); | 1232 | printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[0]); |
1235 | continue; | 1233 | continue; |
1236 | } | 1234 | } |
1237 | tmport = wkport + 0x1b; | ||
1238 | if (dev->chip_ver == 4) { | 1235 | if (dev->chip_ver == 4) { |
1239 | outb(0x01, tmport); | 1236 | outb(0x01, wkport + 0x1b); |
1240 | } else { | 1237 | } else { |
1241 | outb(0x00, tmport); | 1238 | outb(0x00, wkport + 0x1b); |
1242 | } | 1239 | } |
1243 | tmport = wkport + 1; | 1240 | outb(0x08, wkport + 1); |
1244 | outb(0x08, tmport++); | 1241 | outb(0x7f, wkport + 2); |
1245 | outb(0x7f, tmport++); | 1242 | outb(satn[0], wkport + 3); |
1246 | outb(satn[0], tmport++); | 1243 | outb(satn[1], wkport + 4); |
1247 | outb(satn[1], tmport++); | 1244 | outb(satn[2], wkport + 5); |
1248 | outb(satn[2], tmport++); | 1245 | outb(satn[3], wkport + 6); |
1249 | outb(satn[3], tmport++); | 1246 | outb(satn[4], wkport + 7); |
1250 | outb(satn[4], tmport++); | 1247 | outb(satn[5], wkport + 8); |
1251 | outb(satn[5], tmport++); | 1248 | outb(0, wkport + 0x0f); |
1252 | tmport += 0x06; | 1249 | outb(dev->id[0][i].devsp, wkport + 0x11); |
1253 | outb(0, tmport); | 1250 | outb(0, wkport + 0x12); |
1254 | tmport += 0x02; | 1251 | outb(satn[6], wkport + 0x13); |
1255 | outb(dev->id[0][i].devsp, tmport++); | 1252 | outb(satn[7], wkport + 0x14); |
1256 | outb(0, tmport++); | ||
1257 | outb(satn[6], tmport++); | ||
1258 | outb(satn[7], tmport++); | ||
1259 | j = i; | 1253 | j = i; |
1260 | if ((j & 0x08) != 0) { | 1254 | if ((j & 0x08) != 0) { |
1261 | j = (j & 0x07) | 0x40; | 1255 | j = (j & 0x07) | 0x40; |
1262 | } | 1256 | } |
1263 | outb(j, tmport); | 1257 | outb(j, wkport + 0x15); |
1264 | tmport += 0x03; | 1258 | outb(satn[8], wkport + 0x18); |
1265 | outb(satn[8], tmport); | ||
1266 | tmport += 0x07; | ||
1267 | 1259 | ||
1268 | while ((inb(tmport) & 0x80) == 0x00) | 1260 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1269 | cpu_relax(); | 1261 | cpu_relax(); |
1270 | 1262 | ||
1271 | tmport -= 0x08; | 1263 | if (inb(wkport + 0x17) != 0x11 && inb(wkport + 0x17) != 0x8e) |
1272 | if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) | ||
1273 | continue; | 1264 | continue; |
1274 | 1265 | ||
1275 | while (inb(tmport) != 0x8e) | 1266 | while (inb(wkport + 0x17) != 0x8e) |
1276 | cpu_relax(); | 1267 | cpu_relax(); |
1277 | 1268 | ||
1278 | dev->active_id[0] |= m; | 1269 | dev->active_id[0] |= m; |
1279 | 1270 | ||
1280 | tmport = wkport + 0x10; | 1271 | outb(0x30, wkport + 0x10); |
1281 | outb(0x30, tmport); | 1272 | outb(0x00, wkport + 0x04); |
1282 | tmport = wkport + 0x04; | ||
1283 | outb(0x00, tmport); | ||
1284 | 1273 | ||
1285 | phase_cmd: | 1274 | phase_cmd: |
1286 | tmport = wkport + 0x18; | 1275 | outb(0x08, wkport + 0x18); |
1287 | outb(0x08, tmport); | 1276 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1288 | tmport += 0x07; | ||
1289 | while ((inb(tmport) & 0x80) == 0x00) | ||
1290 | cpu_relax(); | 1277 | cpu_relax(); |
1291 | tmport -= 0x08; | 1278 | j = inb(wkport + 0x17); |
1292 | j = inb(tmport); | ||
1293 | if (j != 0x16) { | 1279 | if (j != 0x16) { |
1294 | tmport = wkport + 0x10; | 1280 | outb(0x41, wkport + 0x10); |
1295 | outb(0x41, tmport); | ||
1296 | goto phase_cmd; | 1281 | goto phase_cmd; |
1297 | } | 1282 | } |
1298 | sel_ok: | 1283 | sel_ok: |
1299 | tmport = wkport + 3; | 1284 | outb(inqd[0], wkport + 3); |
1300 | outb(inqd[0], tmport++); | 1285 | outb(inqd[1], wkport + 4); |
1301 | outb(inqd[1], tmport++); | 1286 | outb(inqd[2], wkport + 5); |
1302 | outb(inqd[2], tmport++); | 1287 | outb(inqd[3], wkport + 6); |
1303 | outb(inqd[3], tmport++); | 1288 | outb(inqd[4], wkport + 7); |
1304 | outb(inqd[4], tmport++); | 1289 | outb(inqd[5], wkport + 8); |
1305 | outb(inqd[5], tmport); | 1290 | outb(0, wkport + 0x0f); |
1306 | tmport += 0x07; | 1291 | outb(dev->id[0][i].devsp, wkport + 0x11); |
1307 | outb(0, tmport); | 1292 | outb(0, wkport + 0x12); |
1308 | tmport += 0x02; | 1293 | outb(inqd[6], wkport + 0x13); |
1309 | outb(dev->id[0][i].devsp, tmport++); | 1294 | outb(inqd[7], wkport + 0x14); |
1310 | outb(0, tmport++); | 1295 | outb(inqd[8], wkport + 0x18); |
1311 | outb(inqd[6], tmport++); | 1296 | |
1312 | outb(inqd[7], tmport++); | 1297 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1313 | tmport += 0x03; | ||
1314 | outb(inqd[8], tmport); | ||
1315 | tmport += 0x07; | ||
1316 | |||
1317 | while ((inb(tmport) & 0x80) == 0x00) | ||
1318 | cpu_relax(); | 1298 | cpu_relax(); |
1319 | 1299 | ||
1320 | tmport -= 0x08; | 1300 | if (inb(wkport + 0x17) != 0x11 && inb(wkport + 0x17) != 0x8e) |
1321 | if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) | ||
1322 | continue; | 1301 | continue; |
1323 | 1302 | ||
1324 | while (inb(tmport) != 0x8e) | 1303 | while (inb(wkport + 0x17) != 0x8e) |
1325 | cpu_relax(); | 1304 | cpu_relax(); |
1326 | 1305 | ||
1327 | tmport = wkport + 0x1b; | ||
1328 | if (dev->chip_ver == 4) | 1306 | if (dev->chip_ver == 4) |
1329 | outb(0x00, tmport); | 1307 | outb(0x00, wkport + 0x1b); |
1330 | 1308 | ||
1331 | tmport = wkport + 0x18; | 1309 | outb(0x08, wkport + 0x18); |
1332 | outb(0x08, tmport); | ||
1333 | tmport += 0x07; | ||
1334 | j = 0; | 1310 | j = 0; |
1335 | rd_inq_data: | 1311 | rd_inq_data: |
1336 | k = inb(tmport); | 1312 | k = inb(wkport + 0x1f); |
1337 | if ((k & 0x01) != 0) { | 1313 | if ((k & 0x01) != 0) { |
1338 | tmport -= 0x06; | 1314 | mbuf[j++] = inb(wkport + 0x19); |
1339 | mbuf[j++] = inb(tmport); | ||
1340 | tmport += 0x06; | ||
1341 | goto rd_inq_data; | 1315 | goto rd_inq_data; |
1342 | } | 1316 | } |
1343 | if ((k & 0x80) == 0) { | 1317 | if ((k & 0x80) == 0) { |
1344 | goto rd_inq_data; | 1318 | goto rd_inq_data; |
1345 | } | 1319 | } |
1346 | tmport -= 0x08; | 1320 | j = inb(wkport + 0x17); |
1347 | j = inb(tmport); | ||
1348 | if (j == 0x16) { | 1321 | if (j == 0x16) { |
1349 | goto inq_ok; | 1322 | goto inq_ok; |
1350 | } | 1323 | } |
1351 | tmport = wkport + 0x10; | 1324 | outb(0x46, wkport + 0x10); |
1352 | outb(0x46, tmport); | 1325 | outb(0, wkport + 0x12); |
1353 | tmport += 0x02; | 1326 | outb(0, wkport + 0x13); |
1354 | outb(0, tmport++); | 1327 | outb(0, wkport + 0x14); |
1355 | outb(0, tmport++); | 1328 | outb(0x08, wkport + 0x18); |
1356 | outb(0, tmport++); | ||
1357 | tmport += 0x03; | ||
1358 | outb(0x08, tmport); | ||
1359 | tmport += 0x07; | ||
1360 | 1329 | ||
1361 | while ((inb(tmport) & 0x80) == 0x00) | 1330 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1362 | cpu_relax(); | 1331 | cpu_relax(); |
1363 | 1332 | ||
1364 | tmport -= 0x08; | 1333 | if (inb(wkport + 0x17) != 0x16) { |
1365 | if (inb(tmport) != 0x16) { | ||
1366 | goto sel_ok; | 1334 | goto sel_ok; |
1367 | } | 1335 | } |
1368 | inq_ok: | 1336 | inq_ok: |
@@ -1380,57 +1348,43 @@ inq_ok: | |||
1380 | if ((dev->global_map[0] & 0x20) == 0) { | 1348 | if ((dev->global_map[0] & 0x20) == 0) { |
1381 | goto not_wide; | 1349 | goto not_wide; |
1382 | } | 1350 | } |
1383 | tmport = wkport + 0x1b; | 1351 | outb(0x01, wkport + 0x1b); |
1384 | outb(0x01, tmport); | 1352 | outb(satn[0], wkport + 3); |
1385 | tmport = wkport + 3; | 1353 | outb(satn[1], wkport + 4); |
1386 | outb(satn[0], tmport++); | 1354 | outb(satn[2], wkport + 5); |
1387 | outb(satn[1], tmport++); | 1355 | outb(satn[3], wkport + 6); |
1388 | outb(satn[2], tmport++); | 1356 | outb(satn[4], wkport + 7); |
1389 | outb(satn[3], tmport++); | 1357 | outb(satn[5], wkport + 8); |
1390 | outb(satn[4], tmport++); | 1358 | outb(0, wkport + 0x0f); |
1391 | outb(satn[5], tmport++); | 1359 | outb(dev->id[0][i].devsp, wkport + 0x11); |
1392 | tmport += 0x06; | 1360 | outb(0, wkport + 0x12); |
1393 | outb(0, tmport); | 1361 | outb(satn[6], wkport + 0x13); |
1394 | tmport += 0x02; | 1362 | outb(satn[7], wkport + 0x14); |
1395 | outb(dev->id[0][i].devsp, tmport++); | 1363 | outb(satn[8], wkport + 0x18); |
1396 | outb(0, tmport++); | 1364 | |
1397 | outb(satn[6], tmport++); | 1365 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1398 | outb(satn[7], tmport++); | ||
1399 | tmport += 0x03; | ||
1400 | outb(satn[8], tmport); | ||
1401 | tmport += 0x07; | ||
1402 | |||
1403 | while ((inb(tmport) & 0x80) == 0x00) | ||
1404 | cpu_relax(); | 1366 | cpu_relax(); |
1405 | 1367 | ||
1406 | tmport -= 0x08; | 1368 | if (inb(wkport + 0x17) != 0x11 && inb(wkport + 0x17) != 0x8e) |
1407 | if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) | ||
1408 | continue; | 1369 | continue; |
1409 | 1370 | ||
1410 | while (inb(tmport) != 0x8e) | 1371 | while (inb(wkport + 0x17) != 0x8e) |
1411 | cpu_relax(); | 1372 | cpu_relax(); |
1412 | 1373 | ||
1413 | try_wide: | 1374 | try_wide: |
1414 | j = 0; | 1375 | j = 0; |
1415 | tmport = wkport + 0x14; | 1376 | outb(0x05, wkport + 0x14); |
1416 | outb(0x05, tmport); | 1377 | outb(0x20, wkport + 0x18); |
1417 | tmport += 0x04; | ||
1418 | outb(0x20, tmport); | ||
1419 | tmport += 0x07; | ||
1420 | 1378 | ||
1421 | while ((inb(tmport) & 0x80) == 0) { | 1379 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
1422 | if ((inb(tmport) & 0x01) != 0) { | 1380 | if ((inb(wkport + 0x1f) & 0x01) != 0) |
1423 | tmport -= 0x06; | 1381 | outb(wide[j++], wkport + 0x19); |
1424 | outb(wide[j++], tmport); | ||
1425 | tmport += 0x06; | ||
1426 | } | ||
1427 | } | 1382 | } |
1428 | tmport -= 0x08; | ||
1429 | 1383 | ||
1430 | while ((inb(tmport) & 0x80) == 0x00) | 1384 | while ((inb(wkport + 0x17) & 0x80) == 0x00) |
1431 | cpu_relax(); | 1385 | cpu_relax(); |
1432 | 1386 | ||
1433 | j = inb(tmport) & 0x0f; | 1387 | j = inb(wkport + 0x17) & 0x0f; |
1434 | if (j == 0x0f) { | 1388 | if (j == 0x0f) { |
1435 | goto widep_in; | 1389 | goto widep_in; |
1436 | } | 1390 | } |
@@ -1442,18 +1396,12 @@ try_wide: | |||
1442 | } | 1396 | } |
1443 | continue; | 1397 | continue; |
1444 | widep_out: | 1398 | widep_out: |
1445 | tmport = wkport + 0x18; | 1399 | outb(0x20, wkport + 0x18); |
1446 | outb(0x20, tmport); | 1400 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
1447 | tmport += 0x07; | 1401 | if ((inb(wkport + 0x1f) & 0x01) != 0) |
1448 | while ((inb(tmport) & 0x80) == 0) { | 1402 | outb(0, wkport + 0x19); |
1449 | if ((inb(tmport) & 0x01) != 0) { | ||
1450 | tmport -= 0x06; | ||
1451 | outb(0, tmport); | ||
1452 | tmport += 0x06; | ||
1453 | } | ||
1454 | } | 1403 | } |
1455 | tmport -= 0x08; | 1404 | j = inb(wkport + 0x17) & 0x0f; |
1456 | j = inb(tmport) & 0x0f; | ||
1457 | if (j == 0x0f) { | 1405 | if (j == 0x0f) { |
1458 | goto widep_in; | 1406 | goto widep_in; |
1459 | } | 1407 | } |
@@ -1465,25 +1413,19 @@ widep_out: | |||
1465 | } | 1413 | } |
1466 | continue; | 1414 | continue; |
1467 | widep_in: | 1415 | widep_in: |
1468 | tmport = wkport + 0x14; | 1416 | outb(0xff, wkport + 0x14); |
1469 | outb(0xff, tmport); | 1417 | outb(0x20, wkport + 0x18); |
1470 | tmport += 0x04; | ||
1471 | outb(0x20, tmport); | ||
1472 | tmport += 0x07; | ||
1473 | k = 0; | 1418 | k = 0; |
1474 | widep_in1: | 1419 | widep_in1: |
1475 | j = inb(tmport); | 1420 | j = inb(wkport + 0x1f); |
1476 | if ((j & 0x01) != 0) { | 1421 | if ((j & 0x01) != 0) { |
1477 | tmport -= 0x06; | 1422 | mbuf[k++] = inb(wkport + 0x19); |
1478 | mbuf[k++] = inb(tmport); | ||
1479 | tmport += 0x06; | ||
1480 | goto widep_in1; | 1423 | goto widep_in1; |
1481 | } | 1424 | } |
1482 | if ((j & 0x80) == 0x00) { | 1425 | if ((j & 0x80) == 0x00) { |
1483 | goto widep_in1; | 1426 | goto widep_in1; |
1484 | } | 1427 | } |
1485 | tmport -= 0x08; | 1428 | j = inb(wkport + 0x17) & 0x0f; |
1486 | j = inb(tmport) & 0x0f; | ||
1487 | if (j == 0x0f) { | 1429 | if (j == 0x0f) { |
1488 | goto widep_in; | 1430 | goto widep_in; |
1489 | } | 1431 | } |
@@ -1495,19 +1437,14 @@ widep_in1: | |||
1495 | } | 1437 | } |
1496 | continue; | 1438 | continue; |
1497 | widep_cmd: | 1439 | widep_cmd: |
1498 | tmport = wkport + 0x10; | 1440 | outb(0x30, wkport + 0x10); |
1499 | outb(0x30, tmport); | 1441 | outb(0x00, wkport + 0x14); |
1500 | tmport = wkport + 0x14; | 1442 | outb(0x08, wkport + 0x18); |
1501 | outb(0x00, tmport); | ||
1502 | tmport += 0x04; | ||
1503 | outb(0x08, tmport); | ||
1504 | tmport += 0x07; | ||
1505 | 1443 | ||
1506 | while ((inb(tmport) & 0x80) == 0x00) | 1444 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1507 | cpu_relax(); | 1445 | cpu_relax(); |
1508 | 1446 | ||
1509 | tmport -= 0x08; | 1447 | j = inb(wkport + 0x17); |
1510 | j = inb(tmport); | ||
1511 | if (j != 0x16) { | 1448 | if (j != 0x16) { |
1512 | if (j == 0x4e) { | 1449 | if (j == 0x4e) { |
1513 | goto widep_out; | 1450 | goto widep_out; |
@@ -1535,69 +1472,56 @@ not_wide: | |||
1535 | } | 1472 | } |
1536 | continue; | 1473 | continue; |
1537 | set_sync: | 1474 | set_sync: |
1538 | tmport = wkport + 0x1b; | ||
1539 | j = 0; | 1475 | j = 0; |
1540 | if ((m & dev->wide_id[0]) != 0) { | 1476 | if ((m & dev->wide_id[0]) != 0) { |
1541 | j |= 0x01; | 1477 | j |= 0x01; |
1542 | } | 1478 | } |
1543 | outb(j, tmport); | 1479 | outb(j, wkport + 0x1b); |
1544 | tmport = wkport + 3; | 1480 | outb(satn[0], wkport + 3); |
1545 | outb(satn[0], tmport++); | 1481 | outb(satn[1], wkport + 4); |
1546 | outb(satn[1], tmport++); | 1482 | outb(satn[2], wkport + 5); |
1547 | outb(satn[2], tmport++); | 1483 | outb(satn[3], wkport + 6); |
1548 | outb(satn[3], tmport++); | 1484 | outb(satn[4], wkport + 7); |
1549 | outb(satn[4], tmport++); | 1485 | outb(satn[5], wkport + 8); |
1550 | outb(satn[5], tmport++); | 1486 | outb(0, wkport + 0x0f); |
1551 | tmport += 0x06; | 1487 | outb(dev->id[0][i].devsp, wkport + 0x11); |
1552 | outb(0, tmport); | 1488 | outb(0, wkport + 0x12); |
1553 | tmport += 0x02; | 1489 | outb(satn[6], wkport + 0x13); |
1554 | outb(dev->id[0][i].devsp, tmport++); | 1490 | outb(satn[7], wkport + 0x14); |
1555 | outb(0, tmport++); | 1491 | outb(satn[8], wkport + 0x18); |
1556 | outb(satn[6], tmport++); | 1492 | |
1557 | outb(satn[7], tmport++); | 1493 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1558 | tmport += 0x03; | ||
1559 | outb(satn[8], tmport); | ||
1560 | tmport += 0x07; | ||
1561 | |||
1562 | while ((inb(tmport) & 0x80) == 0x00) | ||
1563 | cpu_relax(); | 1494 | cpu_relax(); |
1564 | 1495 | ||
1565 | tmport -= 0x08; | 1496 | if (inb(wkport + 0x17) != 0x11 && inb(wkport + 0x17) != 0x8e) |
1566 | if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) | ||
1567 | continue; | 1497 | continue; |
1568 | 1498 | ||
1569 | while (inb(tmport) != 0x8e) | 1499 | while (inb(wkport + 0x17) != 0x8e) |
1570 | cpu_relax(); | 1500 | cpu_relax(); |
1571 | 1501 | ||
1572 | try_sync: | 1502 | try_sync: |
1573 | j = 0; | 1503 | j = 0; |
1574 | tmport = wkport + 0x14; | 1504 | outb(0x06, wkport + 0x14); |
1575 | outb(0x06, tmport); | 1505 | outb(0x20, wkport + 0x18); |
1576 | tmport += 0x04; | ||
1577 | outb(0x20, tmport); | ||
1578 | tmport += 0x07; | ||
1579 | 1506 | ||
1580 | while ((inb(tmport) & 0x80) == 0) { | 1507 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
1581 | if ((inb(tmport) & 0x01) != 0) { | 1508 | if ((inb(wkport + 0x1f) & 0x01) != 0) { |
1582 | tmport -= 0x06; | ||
1583 | if ((m & dev->wide_id[0]) != 0) { | 1509 | if ((m & dev->wide_id[0]) != 0) { |
1584 | outb(synw[j++], tmport); | 1510 | outb(synw[j++], wkport + 0x19); |
1585 | } else { | 1511 | } else { |
1586 | if ((m & dev->ultra_map[0]) != 0) { | 1512 | if ((m & dev->ultra_map[0]) != 0) { |
1587 | outb(synu[j++], tmport); | 1513 | outb(synu[j++], wkport + 0x19); |
1588 | } else { | 1514 | } else { |
1589 | outb(synn[j++], tmport); | 1515 | outb(synn[j++], wkport + 0x19); |
1590 | } | 1516 | } |
1591 | } | 1517 | } |
1592 | tmport += 0x06; | ||
1593 | } | 1518 | } |
1594 | } | 1519 | } |
1595 | tmport -= 0x08; | ||
1596 | 1520 | ||
1597 | while ((inb(tmport) & 0x80) == 0x00) | 1521 | while ((inb(wkport + 0x17) & 0x80) == 0x00) |
1598 | cpu_relax(); | 1522 | cpu_relax(); |
1599 | 1523 | ||
1600 | j = inb(tmport) & 0x0f; | 1524 | j = inb(wkport + 0x17) & 0x0f; |
1601 | if (j == 0x0f) { | 1525 | if (j == 0x0f) { |
1602 | goto phase_ins; | 1526 | goto phase_ins; |
1603 | } | 1527 | } |
@@ -1609,18 +1533,12 @@ try_sync: | |||
1609 | } | 1533 | } |
1610 | continue; | 1534 | continue; |
1611 | phase_outs: | 1535 | phase_outs: |
1612 | tmport = wkport + 0x18; | 1536 | outb(0x20, wkport + 0x18); |
1613 | outb(0x20, tmport); | 1537 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) { |
1614 | tmport += 0x07; | 1538 | if ((inb(wkport + 0x1f) & 0x01) != 0x00) |
1615 | while ((inb(tmport) & 0x80) == 0x00) { | 1539 | outb(0x00, wkport + 0x19); |
1616 | if ((inb(tmport) & 0x01) != 0x00) { | ||
1617 | tmport -= 0x06; | ||
1618 | outb(0x00, tmport); | ||
1619 | tmport += 0x06; | ||
1620 | } | ||
1621 | } | 1540 | } |
1622 | tmport -= 0x08; | 1541 | j = inb(wkport + 0x17); |
1623 | j = inb(tmport); | ||
1624 | if (j == 0x85) { | 1542 | if (j == 0x85) { |
1625 | goto tar_dcons; | 1543 | goto tar_dcons; |
1626 | } | 1544 | } |
@@ -1636,29 +1554,23 @@ phase_outs: | |||
1636 | } | 1554 | } |
1637 | continue; | 1555 | continue; |
1638 | phase_ins: | 1556 | phase_ins: |
1639 | tmport = wkport + 0x14; | 1557 | outb(0xff, wkport + 0x14); |
1640 | outb(0xff, tmport); | 1558 | outb(0x20, wkport + 0x18); |
1641 | tmport += 0x04; | ||
1642 | outb(0x20, tmport); | ||
1643 | tmport += 0x07; | ||
1644 | k = 0; | 1559 | k = 0; |
1645 | phase_ins1: | 1560 | phase_ins1: |
1646 | j = inb(tmport); | 1561 | j = inb(wkport + 0x1f); |
1647 | if ((j & 0x01) != 0x00) { | 1562 | if ((j & 0x01) != 0x00) { |
1648 | tmport -= 0x06; | 1563 | mbuf[k++] = inb(wkport + 0x19); |
1649 | mbuf[k++] = inb(tmport); | ||
1650 | tmport += 0x06; | ||
1651 | goto phase_ins1; | 1564 | goto phase_ins1; |
1652 | } | 1565 | } |
1653 | if ((j & 0x80) == 0x00) { | 1566 | if ((j & 0x80) == 0x00) { |
1654 | goto phase_ins1; | 1567 | goto phase_ins1; |
1655 | } | 1568 | } |
1656 | tmport -= 0x08; | ||
1657 | 1569 | ||
1658 | while ((inb(tmport) & 0x80) == 0x00) | 1570 | while ((inb(wkport + 0x17) & 0x80) == 0x00) |
1659 | cpu_relax(); | 1571 | cpu_relax(); |
1660 | 1572 | ||
1661 | j = inb(tmport); | 1573 | j = inb(wkport + 0x17); |
1662 | if (j == 0x85) { | 1574 | if (j == 0x85) { |
1663 | goto tar_dcons; | 1575 | goto tar_dcons; |
1664 | } | 1576 | } |
@@ -1674,20 +1586,15 @@ phase_ins1: | |||
1674 | } | 1586 | } |
1675 | continue; | 1587 | continue; |
1676 | phase_cmds: | 1588 | phase_cmds: |
1677 | tmport = wkport + 0x10; | 1589 | outb(0x30, wkport + 0x10); |
1678 | outb(0x30, tmport); | ||
1679 | tar_dcons: | 1590 | tar_dcons: |
1680 | tmport = wkport + 0x14; | 1591 | outb(0x00, wkport + 0x14); |
1681 | outb(0x00, tmport); | 1592 | outb(0x08, wkport + 0x18); |
1682 | tmport += 0x04; | ||
1683 | outb(0x08, tmport); | ||
1684 | tmport += 0x07; | ||
1685 | 1593 | ||
1686 | while ((inb(tmport) & 0x80) == 0x00) | 1594 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
1687 | cpu_relax(); | 1595 | cpu_relax(); |
1688 | 1596 | ||
1689 | tmport -= 0x08; | 1597 | j = inb(wkport + 0x17); |
1690 | j = inb(tmport); | ||
1691 | if (j != 0x16) { | 1598 | if (j != 0x16) { |
1692 | continue; | 1599 | continue; |
1693 | } | 1600 | } |
@@ -1727,8 +1634,7 @@ tar_dcons: | |||
1727 | set_syn_ok: | 1634 | set_syn_ok: |
1728 | dev->id[0][i].devsp = (dev->id[0][i].devsp & 0x0f) | j; | 1635 | dev->id[0][i].devsp = (dev->id[0][i].devsp & 0x0f) | j; |
1729 | } | 1636 | } |
1730 | tmport = wkport + 0x3a; | 1637 | outb((unsigned char) (inb(wkport + 0x3a) & 0xef), wkport + 0x3a); |
1731 | outb((unsigned char) (inb(tmport) & 0xef), tmport); | ||
1732 | } | 1638 | } |
1733 | 1639 | ||
1734 | static void is880(struct atp_unit *dev, unsigned int wkport) | 1640 | static void is880(struct atp_unit *dev, unsigned int wkport) |