Changeset 81703 in vbox
- Timestamp:
- Nov 6, 2019 11:51:57 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r81696 r81703 396 396 } 397 397 398 static DECLCALLBACK(uint32_t) vnetIoCb_GetHostFeatures(void *pvState) 399 { 400 RT_NOREF_PV(pvState); 398 /** 399 * @interface_method_impl{VPCIIOCALLBACKS,pfnGetHostFeatures} 400 */ 401 static DECLCALLBACK(uint32_t) vnetIoCb_GetHostFeatures(PVPCISTATE pVPciState) 402 { 403 RT_NOREF_PV(pVPciState); 401 404 402 405 /* We support: … … 429 432 } 430 433 431 static DECLCALLBACK(uint32_t) vnetIoCb_GetHostMinimalFeatures(void *pvState) 432 { 433 RT_NOREF_PV(pvState); 434 /** 435 * @interface_method_impl{VPCIIOCALLBACKS,pfnGetHostMinimalFeatures} 436 */ 437 static DECLCALLBACK(uint32_t) vnetIoCb_GetHostMinimalFeatures(PVPCISTATE pVPciState) 438 { 439 RT_NOREF_PV(pVPciState); 434 440 return VNET_F_MAC; 435 441 } 436 442 437 static DECLCALLBACK(void) vnetIoCb_SetHostFeatures(void *pvState, uint32_t fFeatures) 438 { 443 /** 444 * @interface_method_impl{VPCIIOCALLBACKS,pfnSetHostFeatures} 445 */ 446 static DECLCALLBACK(void) vnetIoCb_SetHostFeatures(PVPCISTATE pVPciState, uint32_t fFeatures) 447 { 448 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 439 449 /** @todo Nothing to do here yet */ 440 PVNETSTATE pThis = (PVNETSTATE)pvState;441 450 LogFlow(("%s vnetIoCb_SetHostFeatures: uFeatures=%x\n", INSTANCE(pThis), fFeatures)); 442 451 vnetPrintFeatures(pThis, fFeatures, "The guest negotiated the following features"); 443 452 } 444 453 445 static DECLCALLBACK(int) vnetIoCb_GetConfig(void *pvState, uint32_t offCfg, uint32_t cb, void *data) 446 { 447 PVNETSTATE pThis = (PVNETSTATE)pvState; 454 /** 455 * @interface_method_impl{VPCIIOCALLBACKS,pfnGetConfig} 456 */ 457 static DECLCALLBACK(int) vnetIoCb_GetConfig(PVPCISTATE pVPciState, uint32_t offCfg, uint32_t cb, void *data) 458 { 459 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 448 460 if (offCfg + cb > sizeof(struct VNetPCIConfig)) 449 461 { … … 455 467 } 456 468 457 static DECLCALLBACK(int) vnetIoCb_SetConfig(void *pvState, uint32_t offCfg, uint32_t cb, void *data) 458 { 459 PVNETSTATE pThis = (PVNETSTATE)pvState; 469 /** 470 * @interface_method_impl{VPCIIOCALLBACKS,pfnSetConfig} 471 */ 472 static DECLCALLBACK(int) vnetIoCb_SetConfig(PVPCISTATE pVPciState, uint32_t offCfg, uint32_t cb, void *data) 473 { 474 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 460 475 if (offCfg + cb > sizeof(struct VNetPCIConfig)) 461 476 { 462 477 Log(("%s vnetIoCb_SetConfig: Write beyond the config structure is attempted (offCfg=%#x cb=%x).\n", INSTANCE(pThis), offCfg, cb)); 463 478 if (offCfg < sizeof(struct VNetPCIConfig)) 464 memcpy((uint8_t *)&pThis->config + offCfg, data, 465 sizeof(struct VNetPCIConfig) - offCfg); 479 memcpy((uint8_t *)&pThis->config + offCfg, data, sizeof(struct VNetPCIConfig) - offCfg); 466 480 return VINF_SUCCESS; 467 481 } … … 471 485 472 486 /** 487 * @interface_method_impl{VPCIIOCALLBACKS,pfnReset} 488 * 473 489 * Hardware reset. Revert all registers to initial values. 474 * 475 * @param pThis The device state structure. 476 */ 477 static DECLCALLBACK(int) vnetIoCb_Reset(void *pvState) 478 { 479 PVNETSTATE pThis = (PVNETSTATE)pvState; 490 */ 491 static DECLCALLBACK(int) vnetIoCb_Reset(PVPCISTATE pVPciState) 492 { 493 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 480 494 Log(("%s Reset triggered\n", INSTANCE(pThis))); 481 495 … … 610 624 611 625 /** 626 * @interface_method_impl{VPCIIOCALLBACKS,pfnReady} 627 * 612 628 * This function is called when the driver becomes ready. 613 * 614 * @param pThis The device state structure. 615 */ 616 static DECLCALLBACK(void) vnetIoCb_Ready(void *pvState) 617 { 618 PVNETSTATE pThis = (PVNETSTATE)pvState; 629 */ 630 static DECLCALLBACK(void) vnetIoCb_Ready(PVPCISTATE pVPciState) 631 { 632 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 619 633 Log(("%s Driver became ready, waking up RX thread...\n", INSTANCE(pThis))); 620 634 /** … … 655 669 PDMBOTHCBDECL(int) vnetIOPortIn(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT port, uint32_t *pu32, unsigned cb) 656 670 { 657 return vpciIOPortIn(pDevIns, pvUser, port, pu32, cb, &g_IOCallbacks); 671 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 672 RT_NOREF(pvUser); 673 return vpciIOPortIn(pDevIns, &pThis->VPCI, port, pu32, cb, &g_IOCallbacks); 658 674 } 659 675 … … 664 680 PDMBOTHCBDECL(int) vnetIOPortOut(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT port, uint32_t u32, unsigned cb) 665 681 { 666 return vpciIOPortOut(pDevIns, pvUser, port, u32, cb, &g_IOCallbacks); 682 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 683 RT_NOREF(pvUser); 684 return vpciIOPortOut(pDevIns, &pThis->VPCI, port, u32, cb, &g_IOCallbacks); 667 685 } 668 686 … … 1118 1136 } 1119 1137 1120 static DECLCALLBACK(void) vnetR3QueueReceive( void *pvState, PVQUEUE pQueue)1121 { 1122 RT_NOREF(pQueue);1123 PVNETSTATE pThis = (PVNETSTATE)pvState;1138 static DECLCALLBACK(void) vnetR3QueueReceive(PPDMDEVINS pDevIns, PVPCISTATE pVPciState, PVQUEUE pQueue) 1139 { 1140 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 1141 RT_NOREF(pThis, pQueue); 1124 1142 Log(("%s Receive buffers has been added, waking up receive thread.\n", INSTANCE(pThis))); 1125 vnetR3WakeupReceive(p This->VPCI.CTX_SUFF(pDevIns));1143 vnetR3WakeupReceive(pDevIns); 1126 1144 } 1127 1145 … … 1429 1447 # ifdef VNET_TX_DELAY 1430 1448 1431 static DECLCALLBACK(void) vnetR3QueueTransmit(void *pvState, PVQUEUE pQueue) 1432 { 1433 PVNETSTATE pThis = (PVNETSTATE)pvState; 1449 static DECLCALLBACK(void) vnetR3QueueTransmit(PPDMDEVINS pDevIns, PVPCISTATE pVPciState, PVQUEUE pQueue) 1450 { 1451 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 1452 RT_NOREF(pDevIns); 1434 1453 1435 1454 if (TMTimerIsActive(pThis->CTX_SUFF(pTxTimer))) … … 1513 1532 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 1514 1533 { 1515 rc = SUPSemEventWaitNoResume(pThis->pSupDrvSession, pThis->hTxEvent, RT_INDEFINITE_WAIT);1534 rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pThis->hTxEvent, RT_INDEFINITE_WAIT); 1516 1535 if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING)) 1517 1536 break; … … 1538 1557 * @param pThread The send thread. 1539 1558 */ 1540 static DECLCALLBACK(int) vnetTxThreadWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 1541 { 1542 RT_NOREF(pDevIns); 1559 static DECLCALLBACK(int) vnetR3TxThreadWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 1560 { 1543 1561 PVNETSTATE pThis = (PVNETSTATE)pThread->pvUser; 1544 return SUPSemEventSignal(pThis->pSupDrvSession, pThis->hTxEvent);1562 return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hTxEvent); 1545 1563 } 1546 1564 1547 1565 static int vnetR3CreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis) 1548 1566 { 1549 int rc = SUPSemEventCreate(pThis->pSupDrvSession, &pThis->hTxEvent);1567 int rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->hTxEvent); 1550 1568 if (RT_FAILURE(rc)) 1551 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 1552 N_("VNET: Failed to create SUP event semaphore")); 1569 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, N_("VNET: Failed to create SUP event semaphore")); 1570 1553 1571 rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pTxThread, pThis, vnetR3TxThread, 1554 vnet TxThreadWakeUp, 0, RTTHREADTYPE_IO, INSTANCE(pThis));1572 vnetR3TxThreadWakeUp, 0, RTTHREADTYPE_IO, INSTANCE(pThis)); 1555 1573 if (RT_FAILURE(rc)) 1556 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 1557 N_("VNET: Failed to create worker thread %s"), INSTANCE(pThis)); 1574 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, N_("VNET: Failed to create worker thread %s"), INSTANCE(pThis)); 1558 1575 return VINF_SUCCESS; 1559 1576 } 1560 1577 1561 static void vnetR3DestroyTxThreadAndEvent(P VNETSTATE pThis)1578 static void vnetR3DestroyTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis) 1562 1579 { 1563 1580 if (pThis->pTxThread) … … 1572 1589 if (pThis->hTxEvent != NIL_SUPSEMEVENT) 1573 1590 { 1574 SUPSemEventClose(pThis->pSupDrvSession, pThis->hTxEvent);1591 PDMDevHlpSUPSemEventClose(pDevIns, pThis->hTxEvent); 1575 1592 pThis->hTxEvent = NIL_SUPSEMEVENT; 1576 1593 } 1577 1594 } 1578 1595 1579 static DECLCALLBACK(void) vnetR3QueueTransmit( void *pvState, PVQUEUE pQueue)1580 { 1581 PVNETSTATE pThis = (PVNETSTATE)pvState;1596 static DECLCALLBACK(void) vnetR3QueueTransmit(PPDMDEVINS pDevIns, PVPCISTATE pVPciState, PVQUEUE pQueue) 1597 { 1598 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 1582 1599 1583 1600 Log(("vnetR3QueueTransmit: disable kicking and wake up TX thread\n")); 1584 1601 vringSetNotification(&pThis->VPCI, &pQueue->VRing, false); 1585 SUPSemEventSignal(pThis->pSupDrvSession, pThis->hTxEvent);1602 PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hTxEvent); 1586 1603 } 1587 1604 … … 1735 1752 1736 1753 1737 static DECLCALLBACK(void) vnetR3QueueControl(void *pvState, PVQUEUE pQueue) 1738 { 1739 PVNETSTATE pThis = (PVNETSTATE)pvState; 1740 uint8_t u8Ack; 1754 static DECLCALLBACK(void) vnetR3QueueControl(PPDMDEVINS pDevIns, PVPCISTATE pVPciState, PVQUEUE pQueue) 1755 { 1756 PVNETSTATE pThis = RT_FROM_MEMBER(pVPciState, VNETSTATE, VPCI); 1741 1757 VQUEUEELEM elem; 1742 1758 while (vqueueGet(&pThis->VPCI, pQueue, &elem)) … … 1756 1772 } 1757 1773 1774 uint8_t bAck; 1758 1775 VNETCTLHDR CtlHdr; 1759 PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), 1760 elem.aSegsOut[0].addr, 1761 &CtlHdr, sizeof(CtlHdr)); 1776 PDMDevHlpPhysRead(pDevIns, elem.aSegsOut[0].addr, &CtlHdr, sizeof(CtlHdr)); 1762 1777 switch (CtlHdr.u8Class) 1763 1778 { 1764 1779 case VNET_CTRL_CLS_RX_MODE: 1765 u8Ack = vnetR3ControlRx(pThis, &CtlHdr, &elem);1780 bAck = vnetR3ControlRx(pThis, &CtlHdr, &elem); 1766 1781 break; 1767 1782 case VNET_CTRL_CLS_MAC: 1768 u8Ack = vnetR3ControlMac(pThis, &CtlHdr, &elem);1783 bAck = vnetR3ControlMac(pThis, &CtlHdr, &elem); 1769 1784 break; 1770 1785 case VNET_CTRL_CLS_VLAN: 1771 u8Ack = vnetR3ControlVlan(pThis, &CtlHdr, &elem);1786 bAck = vnetR3ControlVlan(pThis, &CtlHdr, &elem); 1772 1787 break; 1773 1788 default: 1774 u8Ack = VNET_ERROR; 1775 } 1776 Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, u8Ack)); 1777 PDMDevHlpPCIPhysWrite(pThis->VPCI.CTX_SUFF(pDevIns), 1778 elem.aSegsIn[elem.nIn - 1].addr, 1779 &u8Ack, sizeof(u8Ack)); 1780 1781 vqueuePut(&pThis->VPCI, pQueue, &elem, sizeof(u8Ack)); 1789 bAck = VNET_ERROR; 1790 } 1791 Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, bAck)); 1792 PDMDevHlpPCIPhysWrite(pDevIns, elem.aSegsIn[elem.nIn - 1].addr, &bAck, sizeof(bAck)); 1793 1794 vqueuePut(&pThis->VPCI, pQueue, &elem, sizeof(bAck)); 1782 1795 vqueueSync(&pThis->VPCI, pQueue); 1783 1796 } … … 2007 2020 } 2008 2021 2009 vnetR3DestroyTxThreadAndEvent(pThis); 2022 vnetR3DestroyTxThreadAndEvent(pDevIns, pThis); 2023 2010 2024 /* 2011 * Zero someimportant members.2025 * Zero important members. 2012 2026 */ 2013 2027 pThis->pDrvBase = NULL; … … 2124 2138 2125 2139 #ifdef VNET_TX_DELAY 2126 LogRel(("TxTimer stats (avg/min/max): %7d usec %7d usec %7d usec\n", 2127 pThis->u32AvgDiff, pThis->u32MinDiff, pThis->u32MaxDiff)); 2128 #endif /* VNET_TX_DELAY */ 2140 LogRel(("TxTimer stats (avg/min/max): %7d usec %7d usec %7d usec\n", pThis->u32AvgDiff, pThis->u32MinDiff, pThis->u32MaxDiff)); 2141 #endif 2142 2129 2143 Log(("%s Destroying instance\n", INSTANCE(pThis))); 2130 2144 if (pThis->hEventMoreRxDescAvail != NIL_RTSEMEVENT) … … 2156 2170 */ 2157 2171 pThis->hEventMoreRxDescAvail = NIL_RTSEMEVENT; 2172 #ifndef VNET_TX_DELAY 2173 pThis->hTxEvent = NIL_SUPSEMEVENT; 2174 pThis->pTxThread = NULL; 2175 #endif 2158 2176 2159 2177 /* Do our own locking. */ … … 2190 2208 Assert(pThis->cMsLinkUpDelay <= 300000); /* less than 5 minutes */ 2191 2209 if (pThis->cMsLinkUpDelay > 5000 || pThis->cMsLinkUpDelay < 100) 2192 LogRel(("%s WARNING! Link up delay is set to %u seconds!\n", 2193 INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000)); 2194 Log(("%s Link up delay is set to %u seconds\n", 2195 INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000)); 2196 2197 vnetPrintFeatures(pThis, vnetIoCb_GetHostFeatures(pThis), "Device supports the following features"); 2210 LogRel(("%s WARNING! Link up delay is set to %u seconds!\n", INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000)); 2211 Log(("%s Link up delay is set to %u seconds\n", INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000)); 2212 2213 vnetPrintFeatures(pThis, vnetIoCb_GetHostFeatures(&pThis->VPCI), "Device supports the following features"); 2198 2214 2199 2215 /* Initialize PCI config space */ … … 2244 2260 AssertRCReturn(rc, rc); 2245 2261 2246 #ifndef VNET_TX_DELAY 2247 pThis->pSupDrvSession = PDMDevHlpGetSupDrvSession(pDevIns); 2248 pThis->hTxEvent = NIL_SUPSEMEVENT; 2249 pThis->pTxThread = NULL; 2250 #else /* VNET_TX_DELAY */ 2262 #ifdef VNET_TX_DELAY 2251 2263 /* Create Transmit Delay Timer */ 2252 2264 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetR3TxTimer, pThis, TMTIMER_FLAGS_NO_CRIT_SECT, … … 2286 2298 AssertRCReturn(rc, rc); 2287 2299 2288 rc = vnetIoCb_Reset( pThis);2300 rc = vnetIoCb_Reset(&pThis->VPCI); 2289 2301 AssertRCReturn(rc, rc); 2290 2302 -
trunk/src/VBox/Devices/VirtIO/Virtio.cpp
r81031 r81703 362 362 363 363 364 DECLINLINE(uint32_t) vpciGetHostFeatures(PVPCISTATE pState, 365 PFNGETHOSTFEATURES pfnGetHostFeatures) 366 { 367 return pfnGetHostFeatures(pState) 364 DECLINLINE(uint32_t) vpciGetHostFeatures(PVPCISTATE pState, PCVPCIIOCALLBACKS pCallbacks) 365 { 366 return pCallbacks->pfnGetHostFeatures(pState) 368 367 | VPCI_F_NOTIFY_ON_EMPTY; 369 368 } … … 375 374 * 376 375 * @param pDevIns The device instance. 377 * @param p vUser Pointer to the device state structure.376 * @param pState The VPCI core state. 378 377 * @param Port Port number used for the IN operation. 379 378 * @param pu32 Where to store the result. … … 383 382 */ 384 383 int vpciIOPortIn(PPDMDEVINS pDevIns, 385 void *pvUser,384 PVPCISTATE pState, 386 385 RTIOPORT Port, 387 386 uint32_t *pu32, … … 389 388 PCVPCIIOCALLBACKS pCallbacks) 390 389 { 391 VPCISTATE *pState = PDMINS_2_DATA(pDevIns, VPCISTATE *);392 int rc = VINF_SUCCESS;393 390 STAM_PROFILE_ADV_START(&pState->CTX_SUFF(StatIORead), a); 394 RT_NOREF_PV(pvUser);391 int rc = VINF_SUCCESS; 395 392 396 393 /* … … 415 412 case VPCI_HOST_FEATURES: 416 413 /* Tell the guest what features we support. */ 417 *pu32 = vpciGetHostFeatures(pState, pCallbacks->pfnGetHostFeatures) 418 | VPCI_F_BAD_FEATURE; 414 *pu32 = vpciGetHostFeatures(pState, pCallbacks) | VPCI_F_BAD_FEATURE; 419 415 break; 420 416 … … 473 469 * 474 470 * @param pDevIns The device instance. 475 * @param p vUser User argument.471 * @param pState The VPCI core state. 476 472 * @param Port Port number used for the IN operation. 477 473 * @param u32 The value to output. … … 480 476 * @thread EMT 481 477 */ 482 int vpciIOPortOut(PPDMDEVINS pDevIns, 483 void *pvUser, 484 RTIOPORT Port, 485 uint32_t u32, 486 unsigned cb, 487 PCVPCIIOCALLBACKS pCallbacks) 488 { 489 VPCISTATE *pState = PDMINS_2_DATA(pDevIns, VPCISTATE *); 490 int rc = VINF_SUCCESS; 491 bool fHasBecomeReady; 478 int vpciIOPortOut(PPDMDEVINS pDevIns, 479 PVPCISTATE pState, 480 RTIOPORT Port, 481 uint32_t u32, 482 unsigned cb, 483 PCVPCIIOCALLBACKS pCallbacks) 484 { 492 485 STAM_PROFILE_ADV_START(&pState->CTX_SUFF(StatIOWrite), a); 493 RT_NOREF_PV(pvUser); 486 int rc = VINF_SUCCESS; 487 bool fHasBecomeReady; 494 488 495 489 Port -= pState->IOPortBase; … … 500 494 case VPCI_GUEST_FEATURES: 501 495 { 502 const uint32_t uHostFeatures = vpciGetHostFeatures(pState, pCallbacks->pfnGetHostFeatures);503 504 if (RT_LIKELY((u32 & ~ uHostFeatures) == 0))496 const uint32_t fHostFeatures = vpciGetHostFeatures(pState, pCallbacks); 497 498 if (RT_LIKELY((u32 & ~fHostFeatures) == 0)) 505 499 { 506 500 pState->uGuestFeatures = u32; … … 522 516 { 523 517 Log(("%s Guest asked for features host does not support! (host=%x guest=%x)\n", 524 INSTANCE(pState), uHostFeatures, u32));525 pState->uGuestFeatures = u32 & uHostFeatures;518 INSTANCE(pState), fHostFeatures, u32)); 519 pState->uGuestFeatures = u32 & fHostFeatures; 526 520 } 527 521 } … … 565 559 // if (RT_LIKELY(rc == VINF_SUCCESS)) 566 560 // { 567 pState->Queues[u32].pfnCallback(p State, &pState->Queues[u32]);561 pState->Queues[u32].pfnCallback(pDevIns, pState, &pState->Queues[u32]); 568 562 // vpciCsLeave(pState); 569 563 // } -
trunk/src/VBox/Devices/VirtIO/Virtio.h
r81031 r81703 22 22 #endif 23 23 24 #include <iprt/ctype.h> 24 #include <iprt/types.h> 25 26 27 /** Pointer to the core (/common) state of a VirtIO PCI device. */ 28 typedef struct VPCISTATE *PVPCISTATE; 25 29 26 30 … … 120 124 * Queue callback (consumer?). 121 125 * 122 * @param pvState Pointer to the VirtIO PCI core state, VPCISTATE. 126 * @param pDevIns The device instance. 127 * @param pVPciState Pointer to the VirtIO PCI core state. 123 128 * @param pQueue Pointer to the queue structure. 124 129 */ 125 typedef DECLCALLBACK(void) FNVPCIQUEUECALLBACK( void *pvState, struct VQueue *pQueue);130 typedef DECLCALLBACK(void) FNVPCIQUEUECALLBACK(PPDMDEVINS pDevIns, PVPCISTATE pVPciState, struct VQueue *pQueue); 126 131 /** Pointer to a VQUEUE callback function. */ 127 132 typedef FNVPCIQUEUECALLBACK *PFNVPCIQUEUECALLBACK; … … 169 174 * @implements PDMILEDPORTS 170 175 */ 171 typedef struct VPCIS tate_st176 typedef struct VPCISTATE 172 177 { 173 178 PDMCRITSECT cs; /**< Critical section - what is it protecting? */ … … 213 218 VQUEUE Queues[VIRTIO_MAX_NQUEUES]; 214 219 215 #if defined(VBOX_WITH_STATISTICS)220 #ifdef VBOX_WITH_STATISTICS 216 221 STAMPROFILEADV StatIOReadR3; 217 222 STAMPROFILEADV StatIOReadR0; … … 225 230 STAMPROFILE StatCsR0; 226 231 STAMPROFILE StatCsRC; 227 #endif /* VBOX_WITH_STATISTICS */232 #endif 228 233 } VPCISTATE; 229 /** Pointer to the core (/common) state of a VirtIO PCI device. */230 typedef VPCISTATE *PVPCISTATE;231 232 typedef DECLCALLBACK(uint32_t) FNGETHOSTFEATURES(void *pvState);233 typedef FNGETHOSTFEATURES *PFNGETHOSTFEATURES;234 234 235 235 /** @name VirtIO port I/O callbacks. … … 237 237 typedef struct VPCIIOCALLBACKS 238 238 { 239 DECLCALLBACKMEMBER(uint32_t, pfnGetHostFeatures)( void *pvState);240 DECLCALLBACKMEMBER(uint32_t, pfnGetHostMinimalFeatures)( void *pvState);241 DECLCALLBACKMEMBER(void, pfnSetHostFeatures)( void *pvState, uint32_t fFeatures);242 DECLCALLBACKMEMBER(int, pfnGetConfig)( void *pvState, uint32_t offCfg, uint32_t cb, void *pvData);243 DECLCALLBACKMEMBER(int, pfnSetConfig)( void *pvState, uint32_t offCfg, uint32_t cb, void *pvData);244 DECLCALLBACKMEMBER(int, pfnReset)( void *pvState);245 DECLCALLBACKMEMBER(void, pfnReady)( void *pvState);239 DECLCALLBACKMEMBER(uint32_t, pfnGetHostFeatures)(PVPCISTATE pVPciState); 240 DECLCALLBACKMEMBER(uint32_t, pfnGetHostMinimalFeatures)(PVPCISTATE pVPciState); 241 DECLCALLBACKMEMBER(void, pfnSetHostFeatures)(PVPCISTATE pVPciState, uint32_t fFeatures); 242 DECLCALLBACKMEMBER(int, pfnGetConfig)(PVPCISTATE pVPciState, uint32_t offCfg, uint32_t cb, void *pvData); 243 DECLCALLBACKMEMBER(int, pfnSetConfig)(PVPCISTATE pVPciState, uint32_t offCfg, uint32_t cb, void *pvData); 244 DECLCALLBACKMEMBER(int, pfnReset)(PVPCISTATE pVPciState); 245 DECLCALLBACKMEMBER(void, pfnReady)(PVPCISTATE pVPciState); 246 246 } VPCIIOCALLBACKS; 247 247 /** Pointer to a const VirtIO port I/O callback structure. */ … … 251 251 int vpciRaiseInterrupt(VPCISTATE *pState, int rcBusy, uint8_t u8IntCause); 252 252 int vpciIOPortIn(PPDMDEVINS pDevIns, 253 void *pvUser,253 PVPCISTATE pState, 254 254 RTIOPORT port, 255 255 uint32_t *pu32, … … 257 257 PCVPCIIOCALLBACKS pCallbacks); 258 258 259 int vpciIOPortOut(PPDMDEVINS 260 void *pvUser,261 RTIOPORT 262 uint32_t 263 unsigned 264 PCVPCIIOCALLBACKS 259 int vpciIOPortOut(PPDMDEVINS pDevIns, 260 PVPCISTATE pState, 261 RTIOPORT port, 262 uint32_t u32, 263 unsigned cb, 264 PCVPCIIOCALLBACKS pCallbacks); 265 265 266 266 void vpciSetWriteLed(PVPCISTATE pState, bool fOn);
Note:
See TracChangeset
for help on using the changeset viewer.