VirtualBox

Changeset 34746 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 6, 2010 1:23:17 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68551
Message:

PCI: registers, better reset and relocation handlers

File:
1 edited

Legend:

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

    r34516 r34746  
    21222122}
    21232123
    2124 static void ich9pciBusInfo(PPCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent)
     2124static void ich9pciBusInfo(PPCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent, bool fRegisters)
    21252125{
    21262126    for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->apDevices); iDev++)
     
    21722172                }
    21732173            }
     2174
     2175            if (fRegisters)
     2176            {
     2177                printIndent(pHlp, iIndent + 2);
     2178                pHlp->pfnPrintf(pHlp, "  PCI registers:\n");
     2179                for (int iReg = 0; iReg < 0x100; )
     2180                {
     2181                    int iPerLine = 0x10;
     2182                    Assert (0x100 % iPerLine == 0);
     2183                    printIndent(pHlp, iIndent + 3);
     2184
     2185                    while (iPerLine-- > 0)
     2186                    {
     2187                        pHlp->pfnPrintf(pHlp, "%02x ", pPciDev->config[iReg++]);
     2188                    }
     2189                    pHlp->pfnPrintf(pHlp, "\n");
     2190                }
     2191            }
    21742192        }
    21752193    }
     
    21822200        {
    21832201            PPCIBUS pBusSub = PDMINS_2_DATA(pBus->papBridgesR3[iBridge]->pDevIns, PPCIBUS);
    2184             ich9pciBusInfo(pBusSub, pHlp, iIndent + 1);
     2202            ich9pciBusInfo(pBusSub, pHlp, iIndent + 1, fRegisters);
    21852203        }
    21862204    }
     
    21982216    PPCIBUS pBus = DEVINS_2_PCIBUS(pDevIns);
    21992217
    2200     ich9pciBusInfo(pBus, pHlp, 0);
     2218    if (pszArgs == NULL || !strcmp(pszArgs, "basic"))
     2219    {
     2220        ich9pciBusInfo(pBus, pHlp, 0, false);
     2221    }
     2222    else if (!strcmp(pszArgs, "verbose"))
     2223    {
     2224        ich9pciBusInfo(pBus, pHlp, 0, true);
     2225    }
     2226    else
     2227    {
     2228        pHlp->pfnPrintf(pHlp, "Invalid argument. Recognized arguments are 'basic', 'verbose'.\n");
     2229    }
    22012230}
    22022231
     
    24222451static void ich9pciResetDevice(PPCIDEVICE pDev)
    24232452{
    2424     pDev->config[VBOX_PCI_COMMAND] &= ~(VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY |
    2425                                         VBOX_PCI_COMMAND_MASTER);
    2426 
     2453    PCIDevSetCommand(pDev,
     2454                     PCIDevGetCommand(pDev)
     2455                     &
     2456                     ~(VBOX_PCI_COMMAND_IO |
     2457                       VBOX_PCI_COMMAND_MEMORY |
     2458                       VBOX_PCI_COMMAND_MASTER));
     2459
     2460    /* Bridge device has its own reset handler clearing PCI registers */
    24272461    if (!PCIIsPci2PciBridge(pDev))
    24282462    {
    24292463        PCIDevSetByte(pDev, VBOX_PCI_CACHE_LINE_SIZE, 0x0);
    2430         PCIDevSetByte(pDev, VBOX_PCI_INTERRUPT_LINE,  0x0);
    2431     }
    2432     else
    2433     {
    2434         /* @todo: reset devices behind the bridge too */
    2435     }
    2436     /* Regions ? */
     2464        PCIDevSetInterruptLine(pDev, 0x0);
     2465    }
     2466    /* Clear regions too ? */
    24372467}
    24382468
     
    24562486}
    24572487
     2488static void ich9pciRelocateDevice(PPCIDEVICE pDev, RTGCINTPTR offDelta)
     2489{
     2490    if (pDev)
     2491    {
     2492        pDev->Int.s.pBusRC += offDelta;
     2493        if (pDev->Int.s.pMsixPageRC)
     2494            pDev->Int.s.pMsixPageRC += offDelta;
     2495    }
     2496}
     2497
    24582498/**
    24592499 * @copydoc FNPDMDEVRELOCATE
     
    24702510    /* Relocate RC pointers for the attached pci devices. */
    24712511    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
    2472     {
    2473         if (pBus->apDevices[i])
    2474         {
    2475             pBus->apDevices[i]->Int.s.pBusRC += offDelta;
    2476             if (pBus->apDevices[i]->Int.s.pMsixPageRC)
    2477                 pBus->apDevices[i]->Int.s.pMsixPageRC += offDelta;
    2478         }
    2479     }
     2512        ich9pciRelocateDevice(pBus->apDevices[i], offDelta);
    24802513
    24812514}
     
    26162649    PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS, 0);
    26172650    PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_SUBORDINATE_BUS, 0);
     2651
     2652    /* PCI-specific reset for each device. */
     2653    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
     2654    {
     2655        if (pBus->apDevices[i])
     2656            ich9pciResetDevice(pBus->apDevices[i]);
     2657    }
    26182658}
    26192659
     
    26292669    /* Relocate RC pointers for the attached pci devices. */
    26302670    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
    2631     {
    2632         if (pBus->apDevices[i])
    2633             pBus->apDevices[i]->Int.s.pBusRC += offDelta;
    2634     }
    2635 
     2671        ich9pciRelocateDevice(pBus->apDevices[i], offDelta);
    26362672}
    26372673
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