- Timestamp:
- May 6, 2019 9:14:32 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r78394 r78405 1740 1740 if (RT_SUCCESS(rc)) 1741 1741 { 1742 /* When READ SECTORS etc. finishes, the address in the task 1743 * file register points at the last sector read, not at the next 1744 * sector that would be read. This ensures the registers always 1745 * contain a valid sector address. 1746 */ 1742 ataR3SetSector(s, iLBA + cSectors); 1747 1743 if (s->cbElementaryTransfer == s->cbTotalTransfer) 1748 {1749 1744 s->iSourceSink = ATAFN_SS_NULL; 1750 ataR3SetSector(s, iLBA + cSectors - 1);1751 }1752 else1753 ataR3SetSector(s, iLBA + cSectors);1754 s->uATARegNSector -= cSectors;1755 1745 ataR3CmdOK(s, ATA_STAT_SEEK); 1756 1746 } … … 3970 3960 ataR3LockEnter(pCtl); 3971 3961 ataR3CmdOK(s, ATA_STAT_SEEK); 3962 ataHCSetIRQ(s); 3972 3963 return false; 3973 3964 } … … 3983 3974 ataR3LockEnter(pCtl); 3984 3975 ataR3CmdOK(s, ATA_STAT_SEEK); 3976 ataHCSetIRQ(s); 3985 3977 return false; 3986 3978 } … … 4365 4357 * Device 1 responds to writes (except commands are not executed) but does 4366 4358 * not respond to reads. If Device 1 selected, normal behavior applies. 4367 * See ATA-6 clause 9.16.2 and Table 15 in clause 7.1. 4368 * 4369 * Note: Task file register writes with BSY=1 and/or DRQ=1 are problematic. 4370 * Newer ATA/ATAPI specifications define that writes with BSY=0 and DRQ=1 4371 * are a "host malfunction" and ignored (see e.g. Table 15 in clause 7.1 of 4372 * the ATA-6 specification). 4373 * However, the results of writes with BSY=1 are "indeterminate", with the 4374 * sole exception of writing the DEVICE RESET command (if supported). We 4375 * choose to ignore the writes when BSY=1. 4376 * 4377 * Note: Ignoring writes to the Device/Head register when BSY=1 or DRQ=1 has the 4378 * convenient side effect that the non-selected device (if any) is guaranteed 4379 * to have BSY=0 and DRQ=0. 4359 * See ATAPI-6 clause 9.16.2 and Table 15 in clause 7.1. 4380 4360 */ 4381 4361 … … 4387 4367 { 4388 4368 case 0: 4389 Assert(0); /* This handler is not used for the Data register! */4390 4369 break; 4391 4370 case 1: /* feature register */ … … 4431 4410 break; 4432 4411 case 6: /* drive/head */ 4433 if (pCtl->aIfs[pCtl->iAIOIf].uATARegStatus & ATA_STAT_DRQ)4434 {4435 Log(("DRQ=1, register write ignored!\n"));4436 break;4437 }4438 4412 pCtl->aIfs[0].uATARegSelect = (val & ~0x10) | 0xa0; 4439 4413 pCtl->aIfs[1].uATARegSelect = (val | 0x10) | 0xa0; … … 4492 4466 4493 4467 4494 /*4495 * Note: When the BSY bit is set, generally no other bits in the Status register4496 * are valid and no other registers can be read. Newer ATA specs explicitly define4497 * (e.g. clause 7.1, table 16 in ATA-6) that if any command block register is4498 * read with BSY=1, the Status register contents are always returned instead.4499 */4500 4468 static int ataIOPortReadU8(PATACONTROLLER pCtl, uint32_t addr, uint32_t *pu32) 4501 4469 { … … 4534 4502 } 4535 4503 } 4536 4537 /*4538 * If the device is busy, the Status register is always read, but when reading the4539 * Status register proper, special semantics apply. See status register handling4540 * with interrupt clearing and yields below.4541 * NB: This can't happen for non-present devices as those never become busy.4542 */4543 if (RT_UNLIKELY(s->uATARegStatus & ATA_STAT_BUSY))4544 {4545 Assert(s->pDrvMedia);4546 if ((addr & 7) != 7)4547 {4548 *pu32 = s->uATARegStatus;4549 Log2(("%s: LUN#%d addr=%#x val=%#04x (BSY=1, returning status!)\n", __FUNCTION__, s->iLUN, addr, *pu32));4550 return VINF_SUCCESS;4551 }4552 }4553 4554 4504 fHOB = !!(s->uATARegDevCtl & (1 << 7)); 4555 4505 switch (addr & 7) 4556 4506 { 4557 default:/* only to satisfy certain compilers, all cases are already handled */4558 4507 case 0: /* data register */ 4559 Assert(0); /* This handler is not used for the Data register! */4560 4508 val = 0xff; 4561 4509 break; … … 4604 4552 val = s->uATARegSelect; 4605 4553 break; 4554 default: 4606 4555 case 7: /* primary status */ 4607 4556 {
Note:
See TracChangeset
for help on using the changeset viewer.