Changeset 74 for trunk/src/os2ahci/ahci.c
- Timestamp:
- Feb 16, 2011, 3:39:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/ahci.c
r73 r74 408 408 AHCI_PORT_CFG *pc = NULL; 409 409 u16 *id_buf; 410 int is_ata; 410 411 int rc; 411 412 int p; 413 int i; 412 414 413 415 spin_lock(drv_lock); … … 453 455 } 454 456 455 /* this port has a device attached and is ready to acceptcommands */457 /* this port seems to have a device attached and ready for commands */ 456 458 ddprintf("port #%d seems to be attached to a device; probing...\n", p); 457 rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_ID_ATA, 458 AP_VADDR, (void _far *) id_buf, 512, 459 AP_END); 460 if (rc != 0 || id_buf[ATA_ID_CONFIG] & (1U << 15)) { 461 /* this might be an ATAPI device; run IDENTIFY_PACKET_DEVICE */ 462 rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_ID_ATAPI, 459 460 /* Get ATA(PI) identity. The so-called signature gives us a hint whether 461 * this is an ATA or an ATAPI device but we'll try both in either case; 462 * the signature will merely determine whether we're going to probe for 463 * an ATA or ATAPI device, first, in order to reduce the chance of sending 464 * the wrong command (which would result in a port reset given the way 465 * ahci_exec_polled_cmd() was implemented). 466 */ 467 is_ata = readl(port_base(ai, p) + PORT_SIG) == 0x00000101UL; 468 for (i = 0; i < 2; i++) { 469 rc = ahci_exec_polled_cmd(ai, p, 0, 500, 470 (is_ata) ? ATA_CMD_ID_ATA : ATA_CMD_ID_ATAPI, 463 471 AP_VADDR, (void _far *) id_buf, 512, 464 472 AP_END); 473 if (rc == 0) { 474 break; 475 } 476 477 /* try again with ATA/ATAPI swapped */ 478 is_ata = !is_ata; 465 479 } 466 480 467 481 if (rc == 0) { 468 482 /* we have a valid IDENTIFY or IDENTIFY_PACKET response */ 469 ddphex(id_buf, 512, "ATA_IDENTIFY (_PACKET) results:\n");483 ddphex(id_buf, 512, "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET"); 470 484 ahci_setup_device(ai, p, 0, id_buf); 471 485 } else { … … 1399 1413 int d = iorb_unit_device(iorb); 1400 1414 1415 dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd, 1416 ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen, 1417 "ahci_execute_cdb(%d.%d.%d): ", a, p, d); 1418 1401 1419 if (ad_infos[a].ports[p].devs[d].atapi) { 1402 1420 ahci_exec_iorb(iorb, 0, atapi_execute_cdb); … … 1418 1436 dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd, 1419 1437 ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen, 1420 "ahci_execute_cdb(%d.%d.%d) ", a, p, d);1438 "ahci_execute_cdb(%d.%d.%d): ", a, p, d); 1421 1439 1422 1440 if (ad_infos[a].ports[p].devs[d].atapi) { … … 1461 1479 ai->ports[p].devs[d].atapi_16 = (id_buf[ATA_ID_CONFIG] & 0x0001U) != 0; 1462 1480 ai->ports[p].devs[d].dev_type = (id_buf[ATA_ID_CONFIG] & 0x1f00U) >> 8; 1481 ai->ports[p].devs[d].ncq_max = 1; 1463 1482 1464 1483 } else {
Note:
See TracChangeset
for help on using the changeset viewer.