Changeset 44722 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Feb 15, 2013 6:19:53 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83823
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r44721 r44722 60 60 * Defined Constants And Macros * 61 61 *******************************************************************************/ 62 #define VMMDEVSTATE_2_DEVINS(pVMMDevState) ( (pVMMDevState)->pDevIns )63 64 62 #define VBOX_GUEST_INTERFACE_VERSION_1_03(s) \ 65 63 ( RT_HIWORD((s)->guestInfo.interfaceVersion) == 1 \ … … 131 129 */ 132 130 133 static void vmmdevSetIRQ_Legacy_EMT 131 static void vmmdevSetIRQ_Legacy_EMT(VMMDevState *pVMMDevState) 134 132 { 135 133 if (!pVMMDevState->fu32AdditionsOk) … … 167 165 /* Set IRQ level for pin 0 */ 168 166 /** @todo make IRQ pin configurable, at least a symbolic constant */ 169 PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS(pVMMDevState);167 PPDMDEVINS pDevIns = pVMMDevState->pDevIns; 170 168 PDMDevHlpPCISetIrqNoWait(pDevIns, 0, u32IRQLevel); 171 169 Log(("vmmdevSetIRQ: IRQ set %d\n", u32IRQLevel)); 172 170 } 173 171 174 static void vmmdevMaybeSetIRQ_EMT (VMMDevState *pVMMDevState) 175 { 176 PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS (pVMMDevState); 177 172 static void vmmdevMaybeSetIRQ_EMT(VMMDevState *pVMMDevState) 173 { 178 174 Log3(("vmmdevMaybeSetIRQ_EMT: u32HostEventFlags = 0x%08X, u32GuestFilterMask = 0x%08X.\n", 179 175 pVMMDevState->u32HostEventFlags, pVMMDevState->u32GuestFilterMask)); … … 182 178 { 183 179 pVMMDevState->pVMMDevRAMR3->V.V1_04.fHaveEvents = true; 184 PDMDevHlpPCISetIrqNoWait (pDevIns, 0, 1);180 PDMDevHlpPCISetIrqNoWait(pVMMDevState->pDevIns, 0, 1); 185 181 Log3(("vmmdevMaybeSetIRQ_EMT: IRQ set.\n")); 186 182 } 187 183 } 188 184 189 static void vmmdevNotifyGuest_EMT 185 static void vmmdevNotifyGuest_EMT(VMMDevState *pVMMDevState, uint32_t u32EventMask) 190 186 { 191 187 Log3(("VMMDevNotifyGuest_EMT: u32EventMask = 0x%08X.\n", u32EventMask)); 192 188 193 if (VBOX_GUEST_INTERFACE_VERSION_1_03 189 if (VBOX_GUEST_INTERFACE_VERSION_1_03(pVMMDevState)) 194 190 { 195 191 Log3(("VMMDevNotifyGuest_EMT: Old additions detected.\n")); 196 192 197 193 pVMMDevState->u32HostEventFlags |= u32EventMask; 198 vmmdevSetIRQ_Legacy_EMT 194 vmmdevSetIRQ_Legacy_EMT(pVMMDevState); 199 195 } 200 196 else … … 252 248 void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask) 253 249 { 254 PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS(pVMMDevState);250 PPDMDEVINS pDevIns = pVMMDevState->pDevIns; 255 251 256 252 Log3(("VMMDevNotifyGuest: u32EventMask = 0x%08X.\n", u32EventMask)); … … 1710 1706 else 1711 1707 { 1712 if (VBOX_GUEST_INTERFACE_VERSION_1_03 1708 if (VBOX_GUEST_INTERFACE_VERSION_1_03(pThis)) 1713 1709 { 1714 vmmdevSetIRQ_Legacy_EMT 1710 vmmdevSetIRQ_Legacy_EMT(pThis); 1715 1711 } 1716 1712 else … … 2478 2474 2479 2475 /** 2480 * Callback function for mapping an PCI I/O region. 2481 * 2482 * @return VBox status code. 2483 * @param pPciDev Pointer to PCI device. Use pPciDev->pDevIns to get the device instance. 2484 * @param iRegion The region number. 2485 * @param GCPhysAddress Physical address of the region. If iType is PCI_ADDRESS_SPACE_IO, this is an 2486 * I/O port, else it's a physical address. 2487 * This address is *NOT* relative to pci_mem_base like earlier! 2488 * @param enmType One of the PCI_ADDRESS_SPACE_* values. 2489 */ 2490 static DECLCALLBACK(int) vmmdevIORAMRegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) 2476 * @interface_method_impl{FNPCIIOREGIONMAP, MMIO/MMIO2 regions} 2477 */ 2478 static DECLCALLBACK(int) 2479 vmmdevIORAMRegionMap(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) 2491 2480 { 2492 2481 LogFlow(("vmmdevR3IORAMRegionMap: iRegion=%d GCPhysAddress=%RGp cb=%#x enmType=%d\n", iRegion, GCPhysAddress, cb, enmType)); … … 2552 2541 2553 2542 /** 2554 * Callback function for mapping a PCI I/O region. 2555 * 2556 * @return VBox status code. 2557 * @param pPciDev Pointer to PCI device. Use pPciDev->pDevIns to get the device instance. 2558 * @param iRegion The region number. 2559 * @param GCPhysAddress Physical address of the region. If iType is PCI_ADDRESS_SPACE_IO, this is an 2560 * I/O port, else it's a physical address. 2561 * This address is *NOT* relative to pci_mem_base like earlier! 2562 * @param enmType One of the PCI_ADDRESS_SPACE_* values. 2563 */ 2564 static DECLCALLBACK(int) vmmdevIOPortRegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) 2543 * @interface_method_impl{FNPCIIOREGIONMAP, I/O Port Region} 2544 */ 2545 static DECLCALLBACK(int) 2546 vmmdevIOPortRegionMap(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) 2565 2547 { 2566 2548 PVMMDEV pThis = RT_FROM_MEMBER(pPciDev, VMMDEV, PciDev); 2567 int rc = VINF_SUCCESS;2568 2549 2569 2550 Assert(enmType == PCI_ADDRESS_SPACE_IO); … … 2572 2553 2573 2554 /* 2574 * Save the base port address to simplify Port offset calculations.2575 */2576 pThis->PortBase = (RTIOPORT)GCPhysAddress;2577 2578 /*2579 2555 * Register our port IO handlers. 2580 2556 */ 2581 rc = PDMDevHlpIOPortRegister(pPciDev->pDevIns, 2582 (RTIOPORT)GCPhysAddress + VMMDEV_PORT_OFF_REQUEST, 1, 2583 (void*)pThis, vmmdevRequestHandler, 2584 NULL, NULL, NULL, "VMMDev Request Handler"); 2557 int rc = PDMDevHlpIOPortRegister(pPciDev->pDevIns, (RTIOPORT)GCPhysAddress + VMMDEV_PORT_OFF_REQUEST, 1, 2558 pThis, vmmdevRequestHandler, NULL, NULL, NULL, "VMMDev Request Handler"); 2585 2559 AssertRC(rc); 2586 2560 return rc; … … 2632 2606 /* -=-=-=-=-=- PDMIVMMDEVPORT (VMMDEV::IPort) -=-=-=-=-=- */ 2633 2607 2634 /** Converts a VMMDev port interface pointer to a VMMDev state pointer. */2635 #define IVMMDEVPORT_2_VMMDEVSTATE(pInterface) ( (VMMDevState*)((uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, IPort)) )2636 2637 2638 2608 /** 2639 2609 * @interface_method_impl{PDMIVMMDEVPORT, pfnQueryAbsoluteMouse} … … 2643 2613 PVMMDEV pThis = RT_FROM_MEMBER(pInterface, VMMDEV, IPort); 2644 2614 2615 /** @todo at the first sign of trouble in this area, just enter the critsect. 2616 * As indicated by the comment below, the atomic reads serves no real purpose 2617 * here since we can assume cache coherency protocoles and int32_t alignment 2618 * rules making sure we won't see a halfwritten value. */ 2645 2619 if (pxAbs) 2646 2620 *pxAbs = ASMAtomicReadS32(&pThis->mouseXAbs); /* why the atomic read? */ 2647 2621 if (pyAbs) 2648 2622 *pyAbs = ASMAtomicReadS32(&pThis->mouseYAbs); 2623 2649 2624 return VINF_SUCCESS; 2650 2625 } … … 2717 2692 2718 2693 if (idxDisplay >= RT_ELEMENTS(pThis->displayChangeData.aRequests)) 2719 {2720 2694 return VERR_INVALID_PARAMETER; 2721 }2722 2695 2723 2696 PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); … … 2921 2894 Log(("vmmdevIPort_VBVAChange: fEnabled = %d\n", fEnabled)); 2922 2895 2896 /* Only used by saved state, which I guess is why we don't bother with locking here. */ 2923 2897 pThis->u32VideoAccelEnabled = fEnabled; 2924 2898 } … … 2929 2903 static DECLCALLBACK(int) vmmdevIPort_CpuHotUnplug(PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage) 2930 2904 { 2931 int rc = VINF_SUCCESS;2932 2905 PVMMDEV pThis = RT_FROM_MEMBER(pInterface, VMMDEV, IPort); 2906 int rc = VINF_SUCCESS; 2933 2907 2934 2908 Log(("vmmdevIPort_CpuHotUnplug: idCpuCore=%u idCpuPackage=%u\n", idCpuCore, idCpuPackage)); … … 2955 2929 static DECLCALLBACK(int) vmmdevIPort_CpuHotPlug(PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage) 2956 2930 { 2957 int rc = VINF_SUCCESS;2958 2931 PVMMDEV pThis = RT_FROM_MEMBER(pInterface, VMMDEV, IPort); 2932 int rc = VINF_SUCCESS; 2959 2933 2960 2934 Log(("vmmdevCpuPlug: idCpuCore=%u idCpuPackage=%u\n", idCpuCore, idCpuPackage)); -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r44709 r44722 158 158 /** message buffer index. */ 159 159 uint32_t iMsg; 160 /** Base port in the assigned I/O space. */ 161 RTIOPORT PortBase; 162 /** Alignment padding. */ 163 RTIOPORT PortAlignment2; 160 /** Alignment padding. */ 161 uint32_t u32Alignment2; 164 162 165 163 /** IRQ number assigned to the device */ -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r44720 r44722 1427 1427 GEN_CHECK_OFF(VMMDEV, szMsg); 1428 1428 GEN_CHECK_OFF(VMMDEV, iMsg); 1429 GEN_CHECK_OFF(VMMDEV, PortBase);1430 1429 GEN_CHECK_OFF(VMMDEV, irq); 1431 1430 GEN_CHECK_OFF(VMMDEV, u32HostEventFlags);
Note:
See TracChangeset
for help on using the changeset viewer.