VirtualBox

Changeset 41811 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Jun 18, 2012 9:50:23 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78629
Message:

PCI/DevATA: Added bus mastering support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r41697 r41811  
    242242
    243243#ifdef IN_RING3
     244/**
     245 * Reads data via bus mastering, if enabled. If no bus mastering is available,
     246 * this function does nothing and returns VINF_SUCCESS.
     247 *
     248 * @return  IPRT status code.
     249 */
     250int PCIDevPhysRead(PPCIDEVICE pPciDev, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     251{
     252    AssertPtrReturn(pPciDev, VERR_INVALID_POINTER);
     253    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
     254    AssertReturn(cbRead, VERR_INVALID_PARAMETER);
     255
     256    if (!PCIDevIsBusmaster(pPciDev))
     257    {
     258#ifdef DEBUG
     259        Log2(("%s: %RU16:%RU16: No bus master (anymore), skipping read %p (%z)\n", __FUNCTION__,
     260              PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbRead));
     261#endif
     262        return VINF_SUCCESS;
     263    }
     264
     265    return PDMDevHlpPhysRead(pPciDev->pDevIns, GCPhys, pvBuf, cbRead);
     266}
     267
     268/**
     269 * Writes data via bus mastering, if enabled. If no bus mastering is available,
     270 * this function does nothing and returns VINF_SUCCESS.
     271 *
     272 * @return  IPRT status code.
     273 */
     274int PCIDevPhysWrite(PPCIDEVICE pPciDev, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
     275{
     276    AssertPtrReturn(pPciDev, VERR_INVALID_POINTER);
     277    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
     278    AssertReturn(cbWrite, VERR_INVALID_PARAMETER);
     279
     280    if (!PCIDevIsBusmaster(pPciDev))
     281    {
     282#ifdef DEBUG
     283        Log2(("%s: %RU16:%RU16: No bus master (anymore), skipping write %p (%z)\n", __FUNCTION__,
     284              PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev), pvBuf, cbWrite));
     285#endif
     286        return VINF_SUCCESS;
     287    }
     288
     289    return PDMDevHlpPhysWrite(pPciDev->pDevIns, GCPhys, pvBuf, cbWrite);
     290}
    244291
    245292static void pci_update_mappings(PCIDevice *d)
     
    758805
    759806#ifdef IN_RING3
    760 
    761807/**
    762808 * Finds a bridge on the bus which contains the destination bus.
Note: See TracChangeset for help on using the changeset viewer.

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