Changeset 81859 in vbox for trunk/src/VBox
- Timestamp:
- Nov 15, 2019 12:32:18 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r81858 r81859 676 676 677 677 # ifdef IN_RING3 678 typedef void (*P BeginTransferFunc)(ATADevState *);679 typedef bool (*P SourceSinkFunc)(ATADevState *);678 typedef void (*PFNBEGINTRANSFER)(ATADevState *); 679 typedef bool (*PFNSOURCESINK)(ATADevState *); 680 680 681 681 static void ataR3ReadWriteSectorsBT(ATADevState *); … … 730 730 * Make sure ATAFNET and this array match! 731 731 */ 732 static const P BeginTransferFuncg_apfnBeginTransFuncs[ATAFN_BT_MAX] =732 static const PFNBEGINTRANSFER g_apfnBeginTransFuncs[ATAFN_BT_MAX] = 733 733 { 734 734 NULL, … … 780 780 * Make sure ATAFNSS and this array match! 781 781 */ 782 static const P SourceSinkFuncg_apfnSourceSinkFuncs[ATAFN_SS_MAX] =782 static const PFNSOURCESINK g_apfnSourceSinkFuncs[ATAFN_SS_MAX] = 783 783 { 784 784 NULL, … … 4823 4823 * very similarly by not continuing with the current instruction 4824 4824 * until the transfer to/from the storage medium is completed. */ 4825 if (s->iSourceSink != ATAFN_SS_NULL) 4825 uint8_t const iSourceSink = s->iSourceSink; 4826 if ( iSourceSink != ATAFN_SS_NULL 4827 && iSourceSink < RT_ELEMENTS(g_apfnSourceSinkFuncs)) 4826 4828 { 4827 4829 bool fRedo; … … 4829 4831 ataSetStatusValue(s, ATA_STAT_BUSY); 4830 4832 Log2(("%s: calling source/sink function\n", __FUNCTION__)); 4831 fRedo = g_apfnSourceSinkFuncs[ s->iSourceSink](s);4833 fRedo = g_apfnSourceSinkFuncs[iSourceSink](s); 4832 4834 pCtl->fRedo = fRedo; 4833 4835 if (RT_UNLIKELY(fRedo)) … … 4837 4839 s->iIOBufferEnd = s->cbElementaryTransfer; 4838 4840 } 4841 else 4842 Assert(iSourceSink == ATAFN_SS_NULL); 4839 4843 # else 4840 4844 AssertReleaseFailed(); … … 5441 5445 * the guest can continue in parallel). If so, the state 5442 5446 * is already set up so the loop is exited immediately. */ 5443 if (s->iSourceSink != ATAFN_SS_NULL) 5447 uint8_t const iSourceSink = s->iSourceSink; 5448 if ( iSourceSink != ATAFN_SS_NULL 5449 && iSourceSink < RT_ELEMENTS(g_apfnSourceSinkFuncs)) 5444 5450 { 5445 5451 s->iIOBufferCur = iIOBufferCur; … … 5448 5454 s->cbTotalTransfer = cbTotalTransfer; 5449 5455 Log2(("%s: calling source/sink function\n", __FUNCTION__)); 5450 fRedo = g_apfnSourceSinkFuncs[ s->iSourceSink](s);5456 fRedo = g_apfnSourceSinkFuncs[iSourceSink](s); 5451 5457 if (RT_UNLIKELY(fRedo)) 5452 5458 { … … 5471 5477 { 5472 5478 /* This forces the loop to exit immediately. */ 5479 Assert(iSourceSink == ATAFN_SS_NULL); 5473 5480 GCPhysDesc = pCtl->GCPhysLastDMADesc + 1; 5474 5481 } … … 5636 5643 { 5637 5644 case ATA_AIO_NEW: 5638 5645 { 5639 5646 pCtl->iAIOIf = pReq->u.t.iIf; 5640 5647 s = &pCtl->aIfs[pCtl->iAIOIf & ATA_SELECTED_IF_MASK]; … … 5668 5675 pCtl->fChainedTransfer = false; 5669 5676 5670 if (s->iBeginTransfer != ATAFN_BT_NULL) 5677 uint8_t const iBeginTransfer = s->iBeginTransfer; 5678 if ( iBeginTransfer != ATAFN_BT_NULL 5679 && iBeginTransfer < RT_ELEMENTS(g_apfnBeginTransFuncs)) 5671 5680 { 5672 5681 Log2(("%s: Ctl#%d: calling begin transfer function\n", __FUNCTION__, ATACONTROLLER_IDX(pCtl))); 5673 g_apfnBeginTransFuncs[ s->iBeginTransfer](s);5682 g_apfnBeginTransFuncs[iBeginTransfer](s); 5674 5683 s->iBeginTransfer = ATAFN_BT_NULL; 5675 5684 if (s->uTxDir != PDMMEDIATXDIR_FROM_DEVICE) … … 5678 5687 else 5679 5688 { 5689 Assert(iBeginTransfer == ATAFN_BT_NULL); 5680 5690 s->cbElementaryTransfer = s->cbTotalTransfer; 5681 5691 s->iIOBufferEnd = s->cbTotalTransfer; … … 5685 5695 if (s->uTxDir != PDMMEDIATXDIR_TO_DEVICE) 5686 5696 { 5687 if (s->iSourceSink != ATAFN_SS_NULL) 5697 uint8_t const iSourceSink = s->iSourceSink; 5698 if ( iSourceSink != ATAFN_SS_NULL 5699 && iSourceSink < RT_ELEMENTS(g_apfnSourceSinkFuncs)) 5688 5700 { 5689 5701 bool fRedo; 5690 5702 Log2(("%s: Ctl#%d: calling source/sink function\n", __FUNCTION__, ATACONTROLLER_IDX(pCtl))); 5691 fRedo = g_apfnSourceSinkFuncs[ s->iSourceSink](s);5703 fRedo = g_apfnSourceSinkFuncs[iSourceSink](s); 5692 5704 pCtl->fRedo = fRedo; 5693 5705 if (RT_UNLIKELY(fRedo && !pCtl->fReset)) … … 5702 5714 } 5703 5715 else 5716 { 5717 Assert(iSourceSink == ATAFN_SS_NULL); 5704 5718 ataR3CmdOK(s, 0); 5719 } 5705 5720 s->iIOBufferEnd = s->cbElementaryTransfer; 5706 5721 … … 5778 5793 } 5779 5794 break; 5795 } 5780 5796 5781 5797 case ATA_AIO_DMA: … … 5836 5852 5837 5853 case ATA_AIO_PIO: 5854 { 5838 5855 s = &pCtl->aIfs[pCtl->iAIOIf & ATA_SELECTED_IF_MASK]; /* Do not remove or there's an instant crash after loading the saved state */ 5839 5856 5840 if (s->iSourceSink != ATAFN_SS_NULL) 5857 uint8_t const iSourceSink = s->iSourceSink; 5858 if ( iSourceSink != ATAFN_SS_NULL 5859 && iSourceSink < RT_ELEMENTS(g_apfnSourceSinkFuncs)) 5841 5860 { 5842 5861 bool fRedo; 5843 5862 Log2(("%s: Ctl#%d: calling source/sink function\n", __FUNCTION__, ATACONTROLLER_IDX(pCtl))); 5844 fRedo = g_apfnSourceSinkFuncs[ s->iSourceSink](s);5863 fRedo = g_apfnSourceSinkFuncs[iSourceSink](s); 5845 5864 pCtl->fRedo = fRedo; 5846 5865 if (RT_UNLIKELY(fRedo && !pCtl->fReset)) … … 5856 5875 { 5857 5876 /* Continue a previously started transfer. */ 5877 Assert(iSourceSink == ATAFN_SS_NULL); 5858 5878 ataUnsetStatus(s, ATA_STAT_BUSY); 5859 5879 ataSetStatus(s, ATA_STAT_READY); … … 5905 5925 } 5906 5926 break; 5927 } 5907 5928 5908 5929 case ATA_AIO_RESET_ASSERTED:
Note:
See TracChangeset
for help on using the changeset viewer.