VirtualBox

Changeset 91935 in vbox


Ignore:
Timestamp:
Oct 21, 2021 11:08:45 AM (3 years ago)
Author:
vboxsync
Message:

VMM,Devices: Eliminate direct calls to IOMIOPortWrite API and introduce callbacks in the device helper callback table, bugref:10074

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmdev.h

    r91930 r91935  
    24242424
    24252425/** Current PDMDEVHLPR3 version number. */
    2426 #define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 56, 0)
     2426#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 57, 0)
    24272427
    24282428/**
     
    25082508     */
    25092509    DECLR3CALLBACKMEMBER(uint32_t, pfnIoPortGetMappingAddress,(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts));
     2510
     2511    /**
     2512     * Writes to an I/O port register.
     2513     *
     2514     * @returns Strict VBox status code. Informational status codes other than the one documented
     2515     *          here are to be treated as internal failure. Use IOM_SUCCESS() to check for success.
     2516     * @retval  VINF_SUCCESS                Success.
     2517     * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success with some exceptions (see IOM_SUCCESS()), the
     2518     *                                      status code must be passed on to EM.
     2519     *
     2520     * @param   pDevIns     The device instance to register the ports with.
     2521     * @param   Port        The port to write to.
     2522     * @param   u32Value    The value to write.
     2523     * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
     2524     *
     2525     * @thread EMT
     2526     * @todo r=aeichner This is only used by DevPCI.cpp to write the ELCR of the PIC. This shouldn't be done that way
     2527     *       and removed again as soon as possible (no time right now)...
     2528     */
     2529    DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnIoPortWrite,(PPDMDEVINS pDevIns, RTIOPORT Port, uint32_t u32Value, size_t cbValue));
    25102530    /** @}  */
    25112531
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r91897 r91935  
    775775
    776776    /* Tell to the PIC. */
    777     VBOXSTRICTRC rcStrict = IOMIOPortWrite(pVM, pVCpu, 0x4d0, elcr[0], sizeof(uint8_t));
     777    /** @todo r=aeichner We should really move this to the BIOS code and get rid of this fake PCI BIOS thing,
     778     * DevPciIch9.cpp lacks this code and has a todo for this.
     779     */
     780    VBOXSTRICTRC rcStrict = pDevIns->pHlpR3->pfnIoPortWrite(pDevIns, 0x4d0, elcr[0], sizeof(uint8_t));
    778781    if (rcStrict == VINF_SUCCESS)
    779         rcStrict = IOMIOPortWrite(pVM, pVCpu, 0x4d1, elcr[1], sizeof(uint8_t));
     782        rcStrict = pDevIns->pHlpR3->pfnIoPortWrite(pDevIns, 0x4d1, elcr[1], sizeof(uint8_t));
    780783    if (rcStrict != VINF_SUCCESS)
    781784    {
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r91930 r91935  
    129129    LogFlow(("pdmR3DevHlp_IoPortGetMappingAddress: caller='%s'/%d: returns %#RX32\n", pDevIns->pReg->szName, pDevIns->iInstance, uAddress));
    130130    return uAddress;
     131}
     132
     133
     134/** @interface_method_impl{PDMDEVHLPR3,pfnIoPortWrite} */
     135static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_IoPortWrite(PPDMDEVINS pDevIns, RTIOPORT Port, uint32_t u32Value, size_t cbValue)
     136{
     137    PDMDEV_ASSERT_DEVINS(pDevIns);
     138    LogFlow(("pdmR3DevHlp_IoPortWrite: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
     139    PVM pVM = pDevIns->Internal.s.pVMR3;
     140    VM_ASSERT_EMT_RETURN(pVM, VERR_VM_THREAD_NOT_EMT);
     141
     142    PVMCPU pVCpu = VMMGetCpu(pVM);
     143    AssertPtrReturn(pVCpu, VERR_ACCESS_DENIED);
     144
     145    VBOXSTRICTRC rcStrict = IOMIOPortWrite(pVM, pVCpu, Port, u32Value, cbValue);
     146
     147    LogFlow(("pdmR3DevHlp_IoPortWrite: caller='%s'/%d: returns %Rrc\n",
     148             pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict)));
     149    return rcStrict;
    131150}
    132151
     
    45854604    pdmR3DevHlp_IoPortUnmap,
    45864605    pdmR3DevHlp_IoPortGetMappingAddress,
     4606    pdmR3DevHlp_IoPortWrite,
    45874607    pdmR3DevHlp_MmioCreateEx,
    45884608    pdmR3DevHlp_MmioMap,
     
    49664986    pdmR3DevHlpTracing_IoPortUnmap,
    49674987    pdmR3DevHlp_IoPortGetMappingAddress,
     4988    pdmR3DevHlp_IoPortWrite,
    49684989    pdmR3DevHlpTracing_MmioCreateEx,
    49694990    pdmR3DevHlpTracing_MmioMap,
     
    56185639    pdmR3DevHlp_IoPortUnmap,
    56195640    pdmR3DevHlp_IoPortGetMappingAddress,
     5641    pdmR3DevHlp_IoPortWrite,
    56205642    pdmR3DevHlp_MmioCreateEx,
    56215643    pdmR3DevHlp_MmioMap,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette