VirtualBox

Changeset 32951 in vbox for trunk/src


Ignore:
Timestamp:
Oct 6, 2010 3:03:32 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66448
Message:

PCI: cleanup, bits

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

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

    r32941 r32951  
    528528static void ich9pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel)
    529529{
    530     if (MsiIsEnabled(pPciDev))
    531     {
    532         Log2(("Raise a MSI interrupt: %d\n", iIrq));
    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         if ((iLevel & PDM_IRQ_LEVEL_HIGH) != 0)
    535         {
    536             PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
    537             MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq);
     530
     531    if (PCIDevIsIntxDisabled(pPciDev))
     532    {
     533        if (MsiIsEnabled(pPciDev))
     534        {
     535            Log2(("Raise a MSI interrupt: %d\n", iIrq));
     536            /* 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) */
     537            if ((iLevel & PDM_IRQ_LEVEL_HIGH) != 0)
     538            {
     539                PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
     540                MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq);
     541            }
    538542        }
    539543        return;
     
    569573    uint32_t u32 = 0;
    570574
     575    PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE);
     576
    571577    ich9pciPhysToPciAddr(pGlobals, GCPhysAddr, &aDest);
    572578
    573     PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE);
    574579    switch (cb)
    575580    {
     
    597602    PPCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);
    598603    PciAddress  aDest;
    599     uint32_t    rv = 0;
     604    uint32_t    rv = 0xffffffff;
     605
     606    PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE);
    600607
    601608    ich9pciPhysToPciAddr(pGlobals, GCPhysAddr, &aDest);
    602609
    603     PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE);
    604610    int rc = ich9pciDataReadAddr(pGlobals, &aDest, cb, &rv);
    605     if (rc == VINF_SUCCESS)
    606     {
    607         switch (cb)
    608         {
    609             case 1:
    610                 *(uint8_t*)pv   = (uint8_t)rv;
    611                 break;
    612             case 2:
    613                 *(uint16_t*)pv  = (uint16_t)rv;
    614                 break;
    615             case 4:
    616                 *(uint32_t*)pv  = (uint32_t)rv;
    617                 break;
    618             default:
    619                 Assert(false);
    620                 break;
    621         }
     611
     612    switch (cb)
     613    {
     614        case 1:
     615            *(uint8_t*)pv   = (uint8_t)rv;
     616            break;
     617        case 2:
     618            *(uint16_t*)pv  = (uint16_t)rv;
     619            break;
     620        case 4:
     621            *(uint32_t*)pv  = (uint32_t)rv;
     622            break;
     623        default:
     624            Assert(false);
     625            break;
    622626    }
    623627    PCI_UNLOCK(pDevIns);
     
    16991703            return PCIDevGetByte(aDev,  u32Address);
    17001704        case 2:
    1701             return PCIDevGetWord(aDev,  u32Address);       
     1705            return PCIDevGetWord(aDev,  u32Address);
    17021706        case 4:
    17031707            return PCIDevGetDWord(aDev, u32Address);
     
    22632267}
    22642268
     2269static void ich9pciResetDevice(PPCIDEVICE pDev)
     2270{
     2271    pDev->config[VBOX_PCI_COMMAND] &= ~(VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY |
     2272                                        VBOX_PCI_COMMAND_MASTER);
     2273
     2274    if (!PCIIsPci2PciBridge(pDev))
     2275    {
     2276        pDev->config[VBOX_PCI_CACHE_LINE_SIZE] = 0x0;
     2277        pDev->config[VBOX_PCI_INTERRUPT_LINE] = 0x0;
     2278    }
     2279    /* Regions ? */
     2280}
     2281
     2282
     2283/**
     2284 * @copydoc FNPDMDEVRESET
     2285 */
     2286static DECLCALLBACK(void) ich9pciReset(PPDMDEVINS pDevIns)
     2287{
     2288    PPCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);
     2289    PPCIBUS     pBus     = &pGlobals->aPciBus;
     2290
     2291    /* Relocate RC pointers for the attached pci devices. */
     2292    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
     2293    {
     2294        if (pBus->apDevices[i])
     2295            ich9pciResetDevice(pBus->apDevices[i]);
     2296    }
     2297}
     2298
    22652299/**
    22662300 * @copydoc FNPDMDEVRELOCATE
     
    24732507    NULL,
    24742508    /* pfnReset */
    2475     NULL,
     2509    ich9pciReset,
    24762510    /* pfnSuspend */
    24772511    NULL,
  • trunk/src/VBox/Devices/PC/vbox.dsl

    r32714 r32951  
    556556                    APDE,   8,
    557557                }
    558 
     558             
    559559                // PCI MCFG MMIO ranges
    560560                Device (^PCIE)
     
    565565                    {
    566566                        Memory32Fixed (ReadOnly,
    567                             0xD0000000,         // Address Base
    568                             0x10000000,         // Address Length
     567                            0xdc000000,        // Address Base
     568                            0x4000000,         // Address Length
    569569                            _Y13)
    570570                    })
     
    586586                     }
    587587                    }
    588                 }
     588                }               
    589589
    590590                // Keyboard device
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