Changeset 32935 in vbox
- Timestamp:
- Oct 6, 2010 9:28:42 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 66421
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/include/VBox/pdmapi.h ¶
r30072 r32935 44 44 VMMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level); 45 45 VMMDECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level); 46 VMMDECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue); 46 47 VMMDECL(bool) PDMHasIoApic(PVM pVM); 47 48 VMMDECL(int) PDMApicHasPendingIrq(PVM pVM, bool *pfPending); -
TabularUnified trunk/include/VBox/pdmdev.h ¶
r32820 r32935 579 579 580 580 /** 581 * Send an MSI. 582 * 583 * @param pDevIns PCI device instance. 584 * @param GCAddr Physical address MSI request was written. 585 * @param uValue Value written. 586 * @thread EMT only. 587 */ 588 DECLRCCALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 589 590 591 /** 581 592 * Acquires the PDM lock. 582 593 * … … 603 614 typedef RCPTRTYPE(const PDMPCIHLPRC *) PCPDMPCIHLPRC; 604 615 605 /** Current PDMPCIHLPR 3version number. */606 #define PDM_PCIHLPRC_VERSION PDM_VERSION_MAKE(0xfffd, 1, 0)616 /** Current PDMPCIHLPRC version number. */ 617 #define PDM_PCIHLPRC_VERSION PDM_VERSION_MAKE(0xfffd, 2, 0) 607 618 608 619 … … 634 645 */ 635 646 DECLR0CALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 647 648 /** 649 * Send an MSI. 650 * 651 * @param pDevIns PCI device instance. 652 * @param GCAddr Physical address MSI request was written. 653 * @param uValue Value written. 654 * @thread EMT only. 655 */ 656 DECLR0CALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 657 636 658 637 659 /** … … 661 683 662 684 /** Current PDMPCIHLPR0 version number. */ 663 #define PDM_PCIHLPR0_VERSION PDM_VERSION_MAKE(0xfffc, 1, 0)685 #define PDM_PCIHLPR0_VERSION PDM_VERSION_MAKE(0xfffc, 2, 0) 664 686 665 687 /** … … 690 712 */ 691 713 DECLR3CALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 714 715 /** 716 * Send an MSI. 717 * 718 * @param pDevIns PCI device instance. 719 * @param GCAddr Physical address MSI request was written. 720 * @param uValue Value written. 721 * @thread EMT only. 722 */ 723 DECLR3CALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 692 724 693 725 /** … … 751 783 752 784 /** Current PDMPCIHLPR3 version number. */ 753 #define PDM_PCIHLPR3_VERSION PDM_VERSION_MAKE(0xfffb, 1, 0)785 #define PDM_PCIHLPR3_VERSION PDM_VERSION_MAKE(0xfffb, 2, 0) 754 786 755 787 … … 1449 1481 /** The name of the R0 SetIrq entry point. */ 1450 1482 const char *pszSetIrqR0; 1483 1484 /** 1485 * Send a MSI. 1486 * 1487 * @param pDevIns Device instance of the I/O APIC. 1488 * @param GCPhys Request address. 1489 * @param uValue Request value. 1490 */ 1491 DECLR3CALLBACKMEMBER(void, pfnSendMsiR3,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 1492 1493 /** The name of the GC SendMsi entry point. */ 1494 const char *pszSendMsiRC; 1495 1496 /** The name of the R0 SendMsi entry point. */ 1497 const char *pszSendMsiR0; 1451 1498 } PDMIOAPICREG; 1452 1499 /** Pointer to an APIC registration structure. */ … … 1454 1501 1455 1502 /** Current PDMAPICREG version number. */ 1456 #define PDM_IOAPICREG_VERSION PDM_VERSION_MAKE(0xfff2, 1, 0)1503 #define PDM_IOAPICREG_VERSION PDM_VERSION_MAKE(0xfff2, 2, 0) 1457 1504 1458 1505 -
TabularUnified trunk/src/VBox/Devices/Bus/DevPciIch9.cpp ¶
r32860 r32935 528 528 static void ich9pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel) 529 529 { 530 if (M SIIsEnabled(pPciDev))530 if (MsiIsEnabled(pPciDev)) 531 531 { 532 532 Log2(("Raise a MSI interrupt: %d\n", iIrq)); 533 533 /* We only trigger MSI on level up, as technically it's matching flip-flop best (maybe even assert that level == PDM_IRQ_LEVEL_FLIP_FLOP) */ 534 534 if ((iLevel & PDM_IRQ_LEVEL_HIGH) != 0) 535 MSINotify(pGlobals->aPciBus.CTX_SUFF(pDevIns), pPciDev, iIrq); 535 { 536 PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns); 537 MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq); 538 } 536 539 return; 537 540 } … … 786 789 static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PPDMMSIREG pMsiReg) 787 790 { 788 return M SIInit(pPciDev, pMsiReg);791 return MsiInit(pPciDev, pMsiReg); 789 792 } 790 793 … … 1686 1689 ) 1687 1690 { 1688 return M SIPciConfigRead(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), aDev, u32Address, len);1691 return MsiPciConfigRead(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), aDev, u32Address, len); 1689 1692 } 1690 1693 … … 1723 1726 ) 1724 1727 { 1725 MSIPciConfigWrite(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), aDev, u32Address, val, len); 1728 MsiPciConfigWrite(aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pDevIns), 1729 aDev->Int.s.CTX_SUFF(pBus)->CTX_SUFF(pPciHlp), 1730 aDev, u32Address, val, len); 1726 1731 return; 1727 1732 } -
TabularUnified trunk/src/VBox/Devices/Bus/MsiCommon.cpp ¶
r32862 r32935 92 92 93 93 94 void M SIPciConfigWrite(PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len)94 void MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len) 95 95 { 96 96 int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset; … … 113 113 /* don't change read-only bits: 1-3,7 */ 114 114 val &= UINT32_C(~0x8e); 115 pDev->config[uAddr] &= ~val;115 pDev->config[uAddr] = val; 116 116 break; 117 117 case VBOX_MSI_CAP_MESSAGE_CONTROL + 1: … … 149 149 /* To ensure that we're no longer masked */ 150 150 pDev->config[uAddr] &= ~iBit; 151 M SINotify(pDevIns, pDev, maskUpdated*8 + iBitNum);151 MsiNotify(pDevIns, pPciHlp, pDev, maskUpdated*8 + iBitNum); 152 152 } 153 153 } … … 162 162 } 163 163 164 uint32_t M SIPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len)164 uint32_t MsiPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len) 165 165 { 166 166 int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset; … … 172 172 { 173 173 case 1: 174 rv = PCIDevGetByte(pDev, u32Address);174 rv = PCIDevGetByte(pDev, u32Address); 175 175 break; 176 176 case 2: 177 rv = PCIDevGetWord(pDev, u32Address);177 rv = PCIDevGetWord(pDev, u32Address); 178 178 break; 179 179 case 4: … … 190 190 191 191 192 int M SIInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg)192 int MsiInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg) 193 193 { 194 194 uint16_t cVectors = pMsiReg->cVectors; … … 225 225 226 226 227 bool M SIIsEnabled(PPCIDEVICE pDev)227 bool MsiIsEnabled(PPCIDEVICE pDev) 228 228 { 229 229 return PCIIsMsiCapable(pDev) && msiIsEnabled(pDev); 230 230 } 231 231 232 void M SINotify(PPDMDEVINS pDevIns, PPCIDEVICE pDev, int iVector)232 void MsiNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector) 233 233 { 234 234 Log2(("MSINotify: %d\n", iVector)); … … 250 250 *upPending &= ~(1<<iVector); 251 251 252 PDMDevHlpPhysWrite(pDevIns, GCAddr, &u32Value, sizeof(u32Value)); 253 } 252 Assert(pPciHlp->pfnIoApicSendMsi != NULL); 253 pPciHlp->pfnIoApicSendMsi(pDevIns, GCAddr, u32Value); 254 } -
TabularUnified trunk/src/VBox/Devices/Bus/MsiCommon.h ¶
r32860 r32935 15 15 */ 16 16 17 /* Maybe belongs to types.h */ 18 #ifdef IN_RING3 19 typedef PCPDMPCIHLPR3 PCPDMPCIHLP; 20 #endif 21 22 #ifdef IN_RING0 23 typedef PCPDMPCIHLPR0 PCPDMPCIHLP; 24 #endif 25 26 #ifdef IN_RC 27 typedef PCPDMPCIHLPRC PCPDMPCIHLP; 28 #endif 29 17 30 /* Init MSI support in the device. */ 18 int M SIInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg);31 int MsiInit(PPCIDEVICE pDev, PPDMMSIREG pMsiReg); 19 32 20 33 /* If MSI is enabled, so that MSINotify() shall be used for notifications. */ 21 bool MSIIsEnabled(PPCIDEVICE pDev); 34 bool MsiIsEnabled(PPCIDEVICE pDev); 35 22 36 /* Device notification (aka interrupt). */ 23 void M SINotify(PPDMDEVINS pDevIns, PPCIDEVICE pDev, int iVector);37 void MsiNotify(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, int iVector); 24 38 25 39 /* PCI config space accessors for MSI registers */ 26 void M SIPciConfigWrite(PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len);27 uint32_t M SIPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len);40 void MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev, uint32_t u32Address, uint32_t val, unsigned len); 41 uint32_t MsiPciConfigRead (PPDMDEVINS pDevIns, PPCIDEVICE pDev, uint32_t u32Address, unsigned len); -
TabularUnified trunk/src/VBox/Devices/PC/DevAPIC.cpp ¶
r32857 r32935 356 356 PDMBOTHCBDECL(int) ioapicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb); 357 357 PDMBOTHCBDECL(void) ioapicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel); 358 PDMBOTHCBDECL(void) ioapicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue); 358 359 359 360 static void apic_update_tpr(APICDeviceInfo *dev, APICState* s, uint32_t val); … … 1531 1532 return val; 1532 1533 } 1533 /**1534 * See chapter 10.11 MESSAGE SIGNALLED INTERRUPTS of IA-32 Intel Architecture1535 * Software Developer's Manual, Volume 3A: System Programming Guide, Part 11536 * for details on MSI and LAPIC interaction.1537 */1538 static int apicSendMsi(APICDeviceInfo* dev, RTGCPHYS addr, uint32_t val)1539 {1540 uint8_t dest = (addr & VBOX_MSI_ADDR_DEST_ID_MASK) >> VBOX_MSI_ADDR_DEST_ID_SHIFT;1541 uint8_t vector_num = (val & VBOX_MSI_DATA_VECTOR_MASK) >> VBOX_MSI_DATA_VECTOR_SHIFT;1542 uint8_t dest_mode = (addr >> VBOX_MSI_ADDR_DEST_MODE_SHIFT) & 0x1;1543 uint8_t trigger_mode = (val >> VBOX_MSI_DATA_TRIGGER_SHIFT) & 0x1;1544 uint8_t delivery_mode = (val >> VBOX_MSI_DATA_DELIVERY_MODE_SHIFT) & 0x7;1545 /**1546 * This bit indicates whether the message should be directed to the1547 * processor with the lowest interrupt priority among1548 * processors that can receive the interrupt, ignored ATM.1549 */1550 uint8_t redir_hint = (addr >> VBOX_MSI_ADDR_REDIRECTION_SHIFT) & 0x1;1551 uint32_t deliver_bitmask = apic_get_delivery_bitmask(dev, dest, dest_mode);1552 1553 return apic_bus_deliver(dev, deliver_bitmask, delivery_mode,1554 vector_num, 0 /* polarity */, trigger_mode);1555 }1556 1534 1557 1535 static int apic_mem_writel(APICDeviceInfo* dev, APICState *s, RTGCPHYS addr, uint32_t val) … … 1564 1542 #endif 1565 1543 1566 index = (addr >> 4) & 0xff; 1567 addr -= (s->apicbase & ~0xfff); 1568 1569 if (addr > 0xfff || (index == 0)) 1570 return apicSendMsi(dev, addr, val); 1544 index = (addr >> 4) & 0xff; 1571 1545 1572 1546 switch(index) { … … 2503 2477 */ 2504 2478 uint32_t ApicBase = pThis->paLapicsR3[0].apicbase & ~0xfff; 2505 /* See comment in msi.h, on why LAPIC and MSI share same region */ 2506 rc = PDMDevHlpMMIORegister(pDevIns, ApicBase, VBOX_MSI_ADDR_SIZE, pThis, 2479 rc = PDMDevHlpMMIORegister(pDevIns, ApicBase, 0x1000, pThis, 2507 2480 apicMMIOWrite, apicMMIORead, NULL, "APIC Memory"); 2508 2481 if (RT_FAILURE(rc)) … … 2513 2486 pThis->pCritSectRC = pThis->pApicHlpR3->pfnGetRCCritSect(pDevIns); 2514 2487 2515 rc = PDMDevHlpMMIORegisterRC(pDevIns, ApicBase, VBOX_MSI_ADDR_SIZE, 0,2488 rc = PDMDevHlpMMIORegisterRC(pDevIns, ApicBase, 0x1000, 0, 2516 2489 "apicMMIOWrite", "apicMMIORead", NULL); 2517 2490 if (RT_FAILURE(rc)) … … 2523 2496 pThis->pCritSectR0 = pThis->pApicHlpR3->pfnGetR0CritSect(pDevIns); 2524 2497 2525 rc = PDMDevHlpMMIORegisterR0(pDevIns, ApicBase, VBOX_MSI_ADDR_SIZE, 0,2498 rc = PDMDevHlpMMIORegisterR0(pDevIns, ApicBase, 0x1000, 0, 2526 2499 "apicMMIOWrite", "apicMMIORead", NULL); 2527 2500 if (RT_FAILURE(rc)) … … 2704 2677 } 2705 2678 2679 PDMBOTHCBDECL(void) ioapicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue) 2680 { 2681 IOAPICState *pThis = PDMINS_2_DATA(pDevIns, IOAPICState *); 2682 2683 LogFlow(("ioapicSendMsi: Address=%p uValue=%\n", GCAddr, uValue)); 2684 2685 uint8_t dest = (GCAddr & VBOX_MSI_ADDR_DEST_ID_MASK) >> VBOX_MSI_ADDR_DEST_ID_SHIFT; 2686 uint8_t vector_num = (uValue & VBOX_MSI_DATA_VECTOR_MASK) >> VBOX_MSI_DATA_VECTOR_SHIFT; 2687 uint8_t dest_mode = (GCAddr >> VBOX_MSI_ADDR_DEST_MODE_SHIFT) & 0x1; 2688 uint8_t trigger_mode = (uValue >> VBOX_MSI_DATA_TRIGGER_SHIFT) & 0x1; 2689 uint8_t delivery_mode = (uValue >> VBOX_MSI_DATA_DELIVERY_MODE_SHIFT) & 0x7; 2690 /** 2691 * This bit indicates whether the message should be directed to the 2692 * processor with the lowest interrupt priority among 2693 * processors that can receive the interrupt, ignored ATM. 2694 */ 2695 uint8_t redir_hint = (GCAddr >> VBOX_MSI_ADDR_REDIRECTION_SHIFT) & 0x1; 2696 2697 int rc = pThis->CTX_SUFF(pIoApicHlp)->pfnApicBusDeliver(pDevIns, 2698 dest, 2699 dest_mode, 2700 delivery_mode, 2701 vector_num, 2702 0 /* polarity, n/a */, 2703 trigger_mode); 2704 /* We must be sure that attempts to reschedule in R3 2705 never get here */ 2706 Assert(rc == VINF_SUCCESS); 2707 } 2706 2708 2707 2709 #ifdef IN_RING3 … … 2848 2850 */ 2849 2851 IoApicReg.u32Version = PDM_IOAPICREG_VERSION; 2850 IoApicReg.pfnSetIrqR3 = ioapicSetIrq; 2852 IoApicReg.pfnSetIrqR3 = ioapicSetIrq; 2851 2853 IoApicReg.pszSetIrqRC = fGCEnabled ? "ioapicSetIrq" : NULL; 2852 2854 IoApicReg.pszSetIrqR0 = fR0Enabled ? "ioapicSetIrq" : NULL; 2855 IoApicReg.pfnSendMsiR3 = ioapicSendMsi; 2856 IoApicReg.pszSendMsiRC = fGCEnabled ? "ioapicSendMsi" : NULL; 2857 IoApicReg.pszSendMsiR0 = fR0Enabled ? "ioapicSendMsi" : NULL; 2858 2853 2859 rc = PDMDevHlpIOAPICRegister(pDevIns, &IoApicReg, &s->pIoApicHlpR3); 2854 2860 if (RT_FAILURE(rc)) -
TabularUnified trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp ¶
r31382 r32935 48 48 /** Maximum number of entries in the release log. */ 49 49 #define MAX_REL_LOG_ERRORS 1024 50 51 /* If LSI shall emulate MSI support */ 52 #define LSILOGIC_WITH_MSI 50 53 51 54 /** … … 4848 4851 PCIDevSetInterruptPin(&pThis->PciDev, 0x01); /* Interrupt pin A */ 4849 4852 4853 #ifdef LSILOGIC_WITH_MSI 4854 PCIDevSetStatus(&pThis->PciDev, VBOX_PCI_STATUS_CAP_LIST); 4855 PCIDevSetCapabilityList(&pThis->PciDev, 0x80); 4856 #endif 4857 4850 4858 pThis->pDevInsR3 = pDevIns; 4851 4859 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); … … 4860 4868 if (RT_FAILURE(rc)) 4861 4869 return rc; 4870 4871 #ifdef LSILOGIC_WITH_MSI 4872 PDMMSIREG aMsiReg; 4873 aMsiReg.cVectors = 1; 4874 aMsiReg.iCapOffset = 0x80; 4875 aMsiReg.iNextOffset = 0x0; 4876 aMsiReg.iMsiFlags = 0; 4877 rc = PDMDevHlpPCIRegisterMsi(pDevIns, &aMsiReg); 4878 AssertRC(rc); 4879 if (RT_FAILURE (rc)) 4880 return rc; 4881 #endif 4862 4882 4863 4883 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, LSILOGIC_PCI_SPACE_IO_SIZE, PCI_ADDRESS_SPACE_IO, lsilogicMap); … … 5150 5170 #endif /* IN_RING3 */ 5151 5171 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 5152 -
TabularUnified trunk/src/VBox/Devices/VMMDev/VMMDev.cpp ¶
r32774 r32935 3195 3195 }; 3196 3196 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 3197 -
TabularUnified trunk/src/VBox/VMM/PDMDevHlp.cpp ¶
r32820 r32935 2043 2043 else 2044 2044 { 2045 pPciBus->pfnSetIrqRC = 0;2046 pPciBus->pDevInsRC = 0;2045 pPciBus->pfnSetIrqRC = 0; 2046 pPciBus->pDevInsRC = 0; 2047 2047 } 2048 2048 … … 2555 2555 return VERR_INVALID_PARAMETER; 2556 2556 } 2557 if (!pIoApicReg->pfnSetIrqR3 )2557 if (!pIoApicReg->pfnSetIrqR3 || !pIoApicReg->pfnSendMsiR3) 2558 2558 { 2559 2559 Assert(pIoApicReg->pfnSetIrqR3); … … 2568 2568 return VERR_INVALID_PARAMETER; 2569 2569 } 2570 if ( pIoApicReg->pszSendMsiRC 2571 && !VALID_PTR(pIoApicReg->pszSendMsiRC)) 2572 { 2573 Assert(VALID_PTR(pIoApicReg->pszSendMsiRC)); 2574 LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER)); 2575 return VERR_INVALID_PARAMETER; 2576 } 2570 2577 if ( pIoApicReg->pszSetIrqR0 2571 2578 && !VALID_PTR(pIoApicReg->pszSetIrqR0)) 2572 2579 { 2573 2580 Assert(VALID_PTR(pIoApicReg->pszSetIrqR0)); 2581 LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER)); 2582 return VERR_INVALID_PARAMETER; 2583 } 2584 if ( pIoApicReg->pszSendMsiR0 2585 && !VALID_PTR(pIoApicReg->pszSendMsiR0)) 2586 { 2587 Assert(VALID_PTR(pIoApicReg->pszSendMsiR0)); 2574 2588 LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc (GC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER)); 2575 2589 return VERR_INVALID_PARAMETER; … … 2631 2645 } 2632 2646 2647 if (pIoApicReg->pszSendMsiRC) 2648 { 2649 int rc = PDMR3LdrGetSymbolRCLazy(pVM, pDevIns->pReg->szRCMod, pIoApicReg->pszSetIrqRC, &pVM->pdm.s.IoApic.pfnSendMsiRC); 2650 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pIoApicReg->pszSendMsiRC, rc)); 2651 if (RT_FAILURE(rc)) 2652 { 2653 LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 2654 return rc; 2655 } 2656 } 2657 else 2658 { 2659 pVM->pdm.s.IoApic.pfnSendMsiRC = 0; 2660 } 2661 2633 2662 /* 2634 2663 * Resolve & initialize the R0 bits. … … 2652 2681 } 2653 2682 2683 if (pIoApicReg->pszSendMsiR0) 2684 { 2685 int rc = PDMR3LdrGetSymbolR0Lazy(pVM, pDevIns->pReg->szR0Mod, pIoApicReg->pszSetIrqR0, &pVM->pdm.s.IoApic.pfnSendMsiR0); 2686 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pIoApicReg->pszSendMsiR0, rc)); 2687 if (RT_FAILURE(rc)) 2688 { 2689 LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 2690 return rc; 2691 } 2692 } 2693 else 2694 { 2695 pVM->pdm.s.IoApic.pfnSendMsiR0 = 0; 2696 } 2697 2698 2654 2699 /* 2655 2700 * Initialize the R3 bits. … … 2657 2702 pVM->pdm.s.IoApic.pDevInsR3 = pDevIns; 2658 2703 pVM->pdm.s.IoApic.pfnSetIrqR3 = pIoApicReg->pfnSetIrqR3; 2704 pVM->pdm.s.IoApic.pfnSendMsiR3 = pIoApicReg->pfnSendMsiR3; 2659 2705 Log(("PDM: Registered I/O APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns)); 2660 2706 -
TabularUnified trunk/src/VBox/VMM/PDMDevMiscHlp.cpp ¶
r28800 r32935 458 458 } 459 459 460 461 460 /** @interface_method_impl{PDMPCIHLPR3,pfnIoApicSetIrq} */ 462 461 static DECLCALLBACK(void) pdmR3PciHlp_IoApicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel) 463 462 { 464 463 PDMDEV_ASSERT_DEVINS(pDevIns); 465 Log4(("pdmR3PciHlp_I saSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel));464 Log4(("pdmR3PciHlp_IoApicSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel)); 466 465 PDMIoApicSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel); 467 466 } 468 467 468 /** @interface_method_impl{PDMPCIHLPR3,pfnIoApicSendMsi} */ 469 static DECLCALLBACK(void) pdmR3PciHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue) 470 { 471 PDMDEV_ASSERT_DEVINS(pDevIns); 472 Log4(("pdmR3PciHlp_IoApicSendMsi: address=%p value=%x\n", GCAddr, uValue)); 473 PDMIoApicSendMsi(pDevIns->Internal.s.pVMR3, GCAddr, uValue); 474 } 469 475 470 476 /** @interface_method_impl{PDMPCIHLPR3,pfnIsMMIO2Base} */ … … 535 541 pdmR3PciHlp_IsaSetIrq, 536 542 pdmR3PciHlp_IoApicSetIrq, 543 pdmR3PciHlp_IoApicSendMsi, 537 544 pdmR3PciHlp_IsMMIO2Base, 538 545 pdmR3PciHlp_GetRCHelpers, -
TabularUnified trunk/src/VBox/VMM/PDMInternal.h ¶
r32820 r32935 548 548 /** @copydoc PDMIOAPICREG::pfnSetIrqR3 */ 549 549 DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 550 /** @copydoc PDMIOAPICREG::pfnSendMsiR3 */ 551 DECLR3CALLBACKMEMBER(void, pfnSendMsiR3,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 550 552 551 553 /** Pointer to the PIC device instance - R0. */ … … 553 555 /** @copydoc PDMIOAPICREG::pfnSetIrqR3 */ 554 556 DECLR0CALLBACKMEMBER(void, pfnSetIrqR0,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 557 /** @copydoc PDMIOAPICREG::pfnSendMsiR3 */ 558 DECLR0CALLBACKMEMBER(void, pfnSendMsiR0,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 555 559 556 560 /** Pointer to the APIC device instance - RC Ptr. */ … … 558 562 /** @copydoc PDMIOAPICREG::pfnSetIrqR3 */ 559 563 DECLRCCALLBACKMEMBER(void, pfnSetIrqRC,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); 564 /** @copydoc PDMIOAPICREG::pfnSendMsiR3 */ 565 DECLRCCALLBACKMEMBER(void, pfnSendMsiRC,(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue)); 566 567 uint8_t Alignment[4]; 560 568 } PDMIOAPIC; 561 569 -
TabularUnified trunk/src/VBox/VMM/VMMAll/PDMAll.cpp ¶
r28800 r32935 154 154 } 155 155 156 /** 157 * Send a MSI to an I/O APIC. 158 * 159 * @returns VBox status code. 160 * @param pVM VM handle. 161 * @param GCAddr Request address. 162 * @param u8Value REquest value. 163 */ 164 VMMDECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue) 165 { 166 if (pVM->pdm.s.IoApic.CTX_SUFF(pDevIns)) 167 { 168 Assert(pVM->pdm.s.IoApic.CTX_SUFF(pfnSendMsi)); 169 pdmLock(pVM); 170 pVM->pdm.s.IoApic.CTX_SUFF(pfnSendMsi)(pVM->pdm.s.IoApic.CTX_SUFF(pDevIns), GCAddr, uValue); 171 pdmUnlock(pVM); 172 return VINF_SUCCESS; 173 } 174 return VERR_PDM_NO_PIC_INSTANCE; 175 } 176 177 156 178 157 179 /** -
TabularUnified trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp ¶
r32156 r32935 55 55 static void pdmRCIsaSetIrq(PVM pVM, int iIrq, int iLevel); 56 56 static void pdmRCIoApicSetIrq(PVM pVM, int iIrq, int iLevel); 57 58 59 57 static void pdmRCIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue); 60 58 61 59 /** @name Raw-Mode Context Device Helpers … … 553 551 { 554 552 PDMDEV_ASSERT_DEVINS(pDevIns); 555 Log4(("pdmRCPciHlp_I saSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel));553 Log4(("pdmRCPciHlp_IoApicSetIrq: iIrq=%d iLevel=%d\n", iIrq, iLevel)); 556 554 pdmRCIoApicSetIrq(pDevIns->Internal.s.pVMRC, iIrq, iLevel); 555 } 556 557 /** @interface_method_impl{PDMPCIHLPRC,pfnIoApicSendMsi} */ 558 static DECLCALLBACK(void) pdmRCPciHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue) 559 { 560 PDMDEV_ASSERT_DEVINS(pDevIns); 561 Log4(("pdmRCPciHlp_IoApicSendMsi: Address=%p Value=%d\n", GCAddr, uValue)); 562 pdmRCIoApicSendMsi(pDevIns->Internal.s.pVMRC, GCAddr, uValue); 557 563 } 558 564 … … 582 588 pdmRCPciHlp_IsaSetIrq, 583 589 pdmRCPciHlp_IoApicSetIrq, 590 pdmRCPciHlp_IoApicSendMsi, 584 591 pdmRCPciHlp_Lock, 585 592 pdmRCPciHlp_Unlock, … … 786 793 } 787 794 } 795 796 797 /** 798 * Sends an MSI to I/O APIC. 799 * 800 * @param pVM The VM handle. 801 * @param GCAddr Address of the message. 802 * @param uValue Value of the message. 803 */ 804 static void pdmRCIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue) 805 { 806 if (pVM->pdm.s.IoApic.pDevInsRC) 807 { 808 pdmLock(pVM); 809 pVM->pdm.s.IoApic.pfnSendMsiRC(pVM->pdm.s.IoApic.pDevInsRC, GCAddr, uValue); 810 pdmUnlock(pVM); 811 } 812 } -
TabularUnified trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp ¶
r32156 r32935 57 57 static void pdmR0IsaSetIrq(PVM pVM, int iIrq, int iLevel); 58 58 static void pdmR0IoApicSetIrq(PVM pVM, int iIrq, int iLevel); 59 59 static void pdmR0IoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue); 60 60 61 61 … … 592 592 } 593 593 594 /** @interface_method_impl{PDMPCIHLPR0,pfnIoApicSendMsi} */ 595 static DECLCALLBACK(void) pdmR0PciHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t uValue) 596 { 597 PDMDEV_ASSERT_DEVINS(pDevIns); 598 Log4(("pdmR0PciHlp_IoApicSendMsi: Address=%p Value=%d\n", GCAddr, uValue)); 599 pdmR0IoApicSendMsi(pDevIns->Internal.s.pVMR0, GCAddr, uValue); 600 } 594 601 595 602 /** @interface_method_impl{PDMPCIHLPR0,pfnLock} */ … … 617 624 pdmR0PciHlp_IsaSetIrq, 618 625 pdmR0PciHlp_IoApicSetIrq, 626 pdmR0PciHlp_IoApicSendMsi, 619 627 pdmR0PciHlp_Lock, 620 628 pdmR0PciHlp_Unlock, … … 846 854 } 847 855 856 /** 857 * Sends an MSI to I/O APIC. 858 * 859 * @param pVM The VM handle. 860 * @param GCAddr Address of the message. 861 * @param uValue Value of the message. 862 */ 863 static void pdmR0IoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue) 864 { 865 if (pVM->pdm.s.IoApic.pDevInsR0) 866 { 867 pdmLock(pVM); 868 pVM->pdm.s.IoApic.pfnSendMsiR0(pVM->pdm.s.IoApic.pDevInsR0, GCAddr, uValue); 869 pdmUnlock(pVM); 870 } 871 } 872
Note:
See TracChangeset
for help on using the changeset viewer.