Changeset 56399 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 12, 2015 10:34:27 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r56394 r56399 704 704 static void ataAsyncIOClearRequests(PATACONTROLLER pCtl) 705 705 { 706 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);706 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 707 707 AssertRC(rc); 708 708 … … 717 717 static void ataAsyncIOPutRequest(PATACONTROLLER pCtl, const ATARequest *pReq) 718 718 { 719 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);719 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 720 720 AssertRC(rc); 721 721 … … 741 741 const ATARequest *pReq; 742 742 743 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);743 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 744 744 AssertRC(rc); 745 745 … … 765 765 static void ataAsyncIORemoveCurrentRequest(PATACONTROLLER pCtl, ATAAIO ReqType) 766 766 { 767 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);767 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 768 768 AssertRC(rc); 769 769 … … 788 788 static void ataAsyncIODumpRequests(PATACONTROLLER pCtl) 789 789 { 790 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);790 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 791 791 AssertRC(rc); 792 792 … … 837 837 static bool ataAsyncIOIsIdle(PATACONTROLLER pCtl, bool fStrict) 838 838 { 839 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);839 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 840 840 AssertRC(rc); 841 841 … … 4559 4559 #ifndef IN_RING3 4560 4560 if ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_RESET) 4561 return VINF_IOM_R3_IOPORT_WRITE; /* The RESET stuff is too complicated for GC. */4561 return VINF_IOM_R3_IOPORT_WRITE; /* The RESET stuff is too complicated for RC+R0. */ 4562 4562 #endif /* !IN_RING3 */ 4563 4563 4564 4564 Log2(("%s: addr=%#x val=%#04x\n", __FUNCTION__, addr, val)); 4565 4565 /* RESET is common for both drives attached to a controller. */ 4566 if ( !(pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) &&4567 4566 if ( !(pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) 4567 && (val & ATA_DEVCTL_RESET)) 4568 4568 { 4569 4569 #ifdef IN_RING3 4570 4570 /* Software RESET low to high */ 4571 int32_t uCmdWait0 = -1, uCmdWait1 = -1; 4571 int32_t uCmdWait0 = -1; 4572 int32_t uCmdWait1 = -1; 4572 4573 uint64_t uNow = RTTimeNanoTS(); 4573 4574 if (pCtl->aIfs[0].u64CmdTS) … … 4576 4577 uCmdWait1 = (uNow - pCtl->aIfs[1].u64CmdTS) / 1000; 4577 4578 LogRel(("PIIX3 ATA: Ctl#%d: RESET, DevSel=%d AIOIf=%d CmdIf0=%#04x (%d usec ago) CmdIf1=%#04x (%d usec ago)\n", 4578 4579 4580 4579 ATACONTROLLER_IDX(pCtl), pCtl->iSelectedIf, pCtl->iAIOIf, 4580 pCtl->aIfs[0].uATARegCommand, uCmdWait0, 4581 pCtl->aIfs[1].uATARegCommand, uCmdWait1)); 4581 4582 pCtl->fReset = true; 4582 4583 /* Everything must be done after the reset flag is set, otherwise … … 4610 4611 #endif /* IN_RING3 */ 4611 4612 } 4612 else if ( (pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) &&4613 4613 else if ( (pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) 4614 && !(val & ATA_DEVCTL_RESET)) 4614 4615 { 4615 4616 #ifdef IN_RING3 … … 4630 4631 /* Change of interrupt disable flag. Update interrupt line if interrupt 4631 4632 * is pending on the current interface. */ 4632 if ( (val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_DISABLE_IRQ4633 && 4633 if ( ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_DISABLE_IRQ) 4634 && pCtl->aIfs[pCtl->iSelectedIf].fIrqPending) 4634 4635 { 4635 4636 if (!(val & ATA_DEVCTL_DISABLE_IRQ)) … … 4789 4790 else 4790 4791 return VINF_IOM_R3_IOPORT_WRITE; 4791 #else /* IN_RING3 */4792 #else /* IN_RING3 */ 4792 4793 memcpy(p, pbBuf, cbSize); 4793 4794 s->iIOBufferPIODataStart += cbSize; 4794 4795 if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd) 4795 4796 ataPIOTransferFinish(pCtl, s); 4796 #endif /* !IN_RING3 */4797 #endif /* IN_RING3 */ 4797 4798 } 4798 4799 else … … 4812 4813 p = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart; 4813 4814 #ifndef IN_RING3 4814 /* All but the last transfer unit is simple enough for GC, but4815 /* All but the last transfer unit is simple enough for RC, but 4815 4816 * sending a request to the async IO thread is too complicated. */ 4816 4817 if (s->iIOBufferPIODataStart + cbSize < s->iIOBufferPIODataEnd) … … 4821 4822 else 4822 4823 return VINF_IOM_R3_IOPORT_READ; 4823 #else /* IN_RING3 */4824 #else /* IN_RING3 */ 4824 4825 memcpy(pbBuf, p, cbSize); 4825 4826 s->iIOBufferPIODataStart += cbSize; 4826 4827 if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd) 4827 4828 ataPIOTransferFinish(pCtl, s); 4828 #endif /* !IN_RING3 */4829 #endif /* IN_RING3 */ 4829 4830 } 4830 4831 else … … 5040 5041 * unnecessary work and racing ataR3WaitForAsyncIOIsIdle. 5041 5042 */ 5042 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, V ERR_IGNORED);5043 int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS); 5043 5044 AssertRC(rc); 5044 5045 … … 5054 5055 } 5055 5056 5056 /** Async I/O thread for an interface. Once upon a time this was readable 5057 * code with several loops and a different semaphore for each purpose. But 5058 * then came the "how can one save the state in the middle of a PIO transfer" 5059 * question. The solution was to use an ASM, which is what's there now. */ 5060 static DECLCALLBACK(int) ataAsyncIOLoop(RTTHREAD ThreadSelf, void *pvUser) 5057 /** 5058 * Async I/O thread for an interface. 5059 * 5060 * Once upon a time this was readable code with several loops and a different 5061 * semaphore for each purpose. But then came the "how can one save the state in 5062 * the middle of a PIO transfer" question. The solution was to use an ASM, 5063 * which is what's there now. 5064 */ 5065 static DECLCALLBACK(int) ataR3AsyncIOThread(RTTHREAD ThreadSelf, void *pvUser) 5061 5066 { 5062 5067 const ATARequest *pReq; … … 5140 5145 #if defined(DEBUG) || defined(VBOX_WITH_STATISTICS) 5141 5146 STAM_PROFILE_ADV_START(&pCtl->StatAsyncTime, a); 5142 #endif /* DEBUG || VBOX_WITH_STATISTICS */5147 #endif 5143 5148 } 5144 5149 … … 5478 5483 if (pCtl->uAsyncIOState == ATA_AIO_NEW && !pCtl->fChainedTransfer) 5479 5484 { 5480 # if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)5485 # if defined(DEBUG) || defined(VBOX_WITH_STATISTICS) 5481 5486 STAM_PROFILE_ADV_STOP(&pCtl->StatAsyncTime, a); 5482 # endif /* DEBUG || VBOX_WITH_STATISTICS */5487 # endif 5483 5488 5484 5489 u64TS = RTTimeNanoTS() - u64TS; … … 5520 5525 } 5521 5526 5522 # if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)5527 # if defined(DEBUG) || defined(VBOX_WITH_STATISTICS) 5523 5528 if (uWait < pCtl->StatAsyncMinWait || !pCtl->StatAsyncMinWait) 5524 5529 pCtl->StatAsyncMinWait = uWait; … … 5528 5533 STAM_COUNTER_ADD(&pCtl->StatAsyncTimeUS, uWait); 5529 5534 STAM_COUNTER_INC(&pCtl->StatAsyncOps); 5530 # endif /* DEBUG || VBOX_WITH_STATISTICS */5535 # endif /* DEBUG || VBOX_WITH_STATISTICS */ 5531 5536 } 5532 5537 … … 7417 7422 7418 7423 ataAsyncIOClearRequests(pCtl); 7419 rc = RTThreadCreateF(&pCtl->AsyncIOThread, ata AsyncIOLoop, (void *)pCtl, 128*1024 /*cbStack*/,7424 rc = RTThreadCreateF(&pCtl->AsyncIOThread, ataR3AsyncIOThread, (void *)pCtl, 128*1024 /*cbStack*/, 7420 7425 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "ATA-%u", i); 7421 7426 AssertLogRelRCReturn(rc, rc);
Note:
See TracChangeset
for help on using the changeset viewer.