VirtualBox

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


Ignore:
Timestamp:
Oct 28, 2016 1:56:42 PM (8 years ago)
Author:
vboxsync
Message:

DevPci: Cleaning up ich9pciConfigWriteDev.

File:
1 edited

Legend:

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

    r64457 r64458  
    19351935    PCIIORegion *pRegion = &pPciDev->Int.s.aIORegions[iRegion];
    19361936    Log3(("ich9pciWriteBarByte: region=%d off=%d val=%#x size=%#llx\n", iRegion, off, bVal, pRegion->size));
     1937    Assert(off <= 3);
    19371938
    19381939    /* Check if we're writing to upper part of 64-bit BAR. */
    19391940    if (pRegion->type == 0xff)
    1940         ich9pciWriteBarByte(pPciDev, iRegion - 1, off + 4, bVal);
    1941     else
    1942     {
    1943         Assert(off <= 3 || (pRegion->type & PCI_ADDRESS_SPACE_BAR64));
    1944         if (pRegion->size != 0)
    1945         {
    1946 
    1947             uint32_t uAddr = ich9pciGetRegionReg(iRegion) + off;
    1948             Assert((pRegion->size & (pRegion->size - 1)) == 0); /* Region size must be power of two. */
    1949             uint8_t bMask = ( (pRegion->size - 1) >> (off * 8) ) & 0xff;
    1950             if (off == 0)
    1951                 bMask |= (pRegion->type & PCI_ADDRESS_SPACE_IO)
    1952                        ? (1 << 2) - 1 /* 2 lowest bits for IO region */ :
    1953                          (1 << 4) - 1 /* 4 lowest bits for memory region, also ROM enable bit for ROM region */;
    1954 
    1955             uint8_t bOld = PDMPciDevGetByte(pPciDev, uAddr) & bMask;
    1956             bVal = (bOld & bMask) | (bVal & ~bMask);
    1957 
    1958             Log3(("ich9pciWriteBarByte: %x changed to  %x\n", bOld, bVal));
    1959 
    1960             PCIDevSetByte(pPciDev, uAddr, bVal);
    1961         }
    1962         /* else: Region doesn't exist */
     1941    {
     1942        AssertLogRelReturnVoid(iRegion > 0 && iRegion < VBOX_PCI_ROM_SLOT);
     1943        pRegion--;
     1944        iRegion--;
     1945        off += 4;
     1946        Assert(pRegion->type & PCI_ADDRESS_SPACE_BAR64);
     1947    }
     1948
     1949    /* Ignore zero sized regions (they don't exist). */
     1950    if (pRegion->size != 0)
     1951    {
     1952        uint32_t uAddr = ich9pciGetRegionReg(iRegion) + off;
     1953        Assert((pRegion->size & (pRegion->size - 1)) == 0); /* Region size must be power of two. */
     1954        uint8_t bMask = ( (pRegion->size - 1) >> (off * 8) ) & 0xff;
     1955        if (off == 0)
     1956            bMask |= (pRegion->type & PCI_ADDRESS_SPACE_IO)
     1957                   ? (1 << 2) - 1 /* 2 lowest bits for IO region */ :
     1958                     (1 << 4) - 1 /* 4 lowest bits for memory region, also ROM enable bit for ROM region */;
     1959
     1960        uint8_t bOld = PDMPciDevGetByte(pPciDev, uAddr) & bMask;
     1961        bVal = (bOld & bMask) | (bVal & ~bMask);
     1962
     1963        Log3(("ich9pciWriteBarByte: %x changed to  %x\n", bOld, bVal));
     1964
     1965        PCIDevSetByte(pPciDev, uAddr, bVal);
    19631966    }
    19641967}
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