VirtualBox

Ignore:
Timestamp:
Oct 24, 2016 2:06:02 PM (8 years ago)
Author:
vboxsync
Message:

PDM,Devices: Some PCI device type cleanup.

File:
1 edited

Legend:

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

    r64373 r64387  
    5757
    5858    /** Array of PCI devices. We assume 32 slots, each with 8 functions. */
    59     R3PTRTYPE(PPCIDEVICE)   apDevices[256];
     59    R3PTRTYPE(PPDMPCIDEV)   apDevices[256];
    6060    /** Array of bridges attached to the bus. */
    61     R3PTRTYPE(PPCIDEVICE *) papBridgesR3;
     61    R3PTRTYPE(PPDMPCIDEV *) papBridgesR3;
    6262
    6363    /** R3 pointer to the device instance. */
     
    7777
    7878    /** The PCI device for the PCI bridge. */
    79     PCIDEVICE           aPciDev;
     79    PDMPCIDEV           aPciDev;
    8080
    8181    /** Start device number - always zero (only for DevPCI source compat). */
     
    177177
    178178/* Prototypes */
    179 static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev,
     179static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPDMPCIDEV pPciDev,
    180180                                  int iIrq, int iLevel, uint32_t uTagSrc);
    181181#ifdef IN_RING3
    182182static void ich9pcibridgeReset(PPDMDEVINS pDevIns);
    183 static void ich9pciUpdateMappings(PCIDevice *pDev);
     183static void ich9pciUpdateMappings(PDMPCIDEV *pDev);
    184184static DECLCALLBACK(uint32_t) ich9pciConfigReadDev(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t u32Address, unsigned len);
    185185static DECLCALLBACK(void)     ich9pciConfigWriteDev(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t u32Address, uint32_t val, unsigned len);
    186 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(PICH9PCIBUS pBus, uint8_t iBus);
     186DECLINLINE(PPDMPCIDEV) ich9pciFindBridge(PICH9PCIBUS pBus, uint8_t iBus);
    187187static void ich9pciBiosInitDevice(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn);
    188188#endif
     
    205205}
    206206
    207 PDMBOTHCBDECL(void) ich9pciSetIrq(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel, uint32_t uTagSrc)
     207PDMBOTHCBDECL(void) ich9pciSetIrq(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel, uint32_t uTagSrc)
    208208{
    209209    LogFlowFunc(("invoked by %p/%d: iIrq=%d iLevel=%d uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, iIrq, iLevel, uTagSrc));
     
    211211}
    212212
    213 PDMBOTHCBDECL(void) ich9pcibridgeSetIrq(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel, uint32_t uTagSrc)
     213PDMBOTHCBDECL(void) ich9pcibridgeSetIrq(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel, uint32_t uTagSrc)
    214214{
    215215    /*
     
    221221     */
    222222    PICH9PCIBUS    pBus          = PDMINS_2_DATA(pDevIns, PICH9PCIBUS);
    223     PPCIDEVICE     pPciDevBus    = pPciDev;
     223    PPDMPCIDEV     pPciDevBus    = pPciDev;
    224224    int            iIrqPinBridge = iIrq;
    225225    uint8_t        uDevFnBridge  = 0;
     
    330330        {
    331331#ifdef IN_RING3 /** @todo do lookup in R0/RC too! */
    332             PPCIDEVICE pBridgeDevice = ich9pciFindBridge(&pGlobals->aPciBus, pAddr->iBus);
     332            PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->aPciBus, pAddr->iBus);
    333333            if (pBridgeDevice)
    334334            {
     
    344344    else                    /* forward to directly connected device */
    345345    {
    346         R3PTRTYPE(PCIDevice *) pPciDev = pGlobals->aPciBus.apDevices[pAddr->iDeviceFunc];
     346        R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->aPciBus.apDevices[pAddr->iDeviceFunc];
    347347        if (pPciDev)
    348348        {
     
    443443        {
    444444#ifdef IN_RING3 /** @todo do lookup in R0/RC too! */
    445             PPCIDEVICE pBridgeDevice = ich9pciFindBridge(&pGlobals->aPciBus, pPciAddr->iBus);
     445            PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->aPciBus, pPciAddr->iBus);
    446446            if (pBridgeDevice)
    447447            {
     
    460460    else                    /* forward to directly connected device */
    461461    {
    462         R3PTRTYPE(PCIDevice *) pPciDev = pGlobals->aPciBus.apDevices[pPciAddr->iDeviceFunc];
     462        R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->aPciBus.apDevices[pPciAddr->iDeviceFunc];
    463463        if (pPciDev)
    464464        {
     
    575575}
    576576
    577 static void ich9pciApicSetIrq(PICH9PCIBUS pBus, uint8_t uDevFn, PCIDevice *pPciDev, int irq_num1, int iLevel,
     577static void ich9pciApicSetIrq(PICH9PCIBUS pBus, uint8_t uDevFn, PDMPCIDEV *pPciDev, int irq_num1, int iLevel,
    578578                              uint32_t uTagSrc, int iForcedIrq)
    579579{
     
    618618}
    619619
    620 static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev,
     620static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPDMPCIDEV pPciDev,
    621621                                  int iIrq, int iLevel, uint32_t uTagSrc)
    622622{
     
    789789
    790790
    791 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(PICH9PCIBUS pBus, uint8_t iBus)
     791DECLINLINE(PPDMPCIDEV) ich9pciFindBridge(PICH9PCIBUS pBus, uint8_t iBus)
    792792{
    793793    /* Search for a fitting bridge. */
     
    798798         * If the target bus is in the range we pass the request on to the bridge.
    799799         */
    800         PPCIDEVICE pBridge = pBus->papBridgesR3[iBridge];
     800        PPDMPCIDEV pBridge = pBus->papBridgesR3[iBridge];
    801801        AssertMsg(pBridge && pciDevIsPci2PciBridge(pBridge),
    802802                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
     
    840840#define INVALID_PCI_ADDRESS ~0U
    841841
    842 static int  ich9pciUnmapRegion(PPCIDEVICE pDev, int iRegion)
     842static int  ich9pciUnmapRegion(PPDMPCIDEV pDev, int iRegion)
    843843{
    844844    PCIIORegion* pRegion = &pDev->Int.s.aIORegions[iRegion];
     
    877877}
    878878
    879 static void ich9pciUpdateMappings(PCIDevice* pDev)
     879static void ich9pciUpdateMappings(PDMPCIDEV* pDev)
    880880{
    881881    uint64_t uLast, uNew;
     
    962962
    963963
    964 static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PPDMMSIREG pMsiReg)
     964static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg)
    965965{
    966966    NOREF(pDevIns);
     
    979979
    980980
    981 static DECLCALLBACK(int) ich9pciIORegionRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, RTGCPHYS cbRegion,
     981static DECLCALLBACK(int) ich9pciIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion,
    982982                                                 PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
    983983{
     
    10361036}
    10371037
    1038 static DECLCALLBACK(void) ich9pciSetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
     1038static DECLCALLBACK(void) ich9pciSetConfigCallbacks(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
    10391039                                                    PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)
    10401040{
     
    10571057    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
    10581058    {
    1059         PPCIDEVICE pDev = pBus->apDevices[i];
     1059        PPDMPCIDEV pDev = pBus->apDevices[i];
    10601060        if (pDev)
    10611061        {
     
    11401140    if (iBus != PCIDevGetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS))
    11411141    {
    1142         PPCIDEVICE pBridgeDevice = ich9pciFindBridge(pBus, iBus);
     1142        PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(pBus, iBus);
    11431143        if (pBridgeDevice)
    11441144        {
     
    11501150    {
    11511151        /* This is the target bus, pass the write to the device. */
    1152         PPCIDEVICE pPciDev = pBus->apDevices[iDevice];
     1152        PPDMPCIDEV pPciDev = pBus->apDevices[iDevice];
    11531153        if (pPciDev)
    11541154        {
     
    11691169    if (iBus != PCIDevGetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS))
    11701170    {
    1171         PPCIDEVICE pBridgeDevice = ich9pciFindBridge(pBus, iBus);
     1171        PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(pBus, iBus);
    11721172        if (pBridgeDevice)
    11731173        {
     
    11811181    {
    11821182        /* This is the target bus, pass the read to the device. */
    1183         PPCIDEVICE pPciDev = pBus->apDevices[iDevice];
     1183        PPDMPCIDEV pPciDev = pBus->apDevices[iDevice];
    11841184        if (pPciDev)
    11851185        {
     
    12021202 * @param   fIsBridge           Whether this is a bridge device or not.
    12031203 */
    1204 static void pciR3CommonRestoreConfig(PPCIDEVICE pDev, uint8_t const *pbSrcConfig, bool fIsBridge)
     1204static void pciR3CommonRestoreConfig(PPDMPCIDEV pDev, uint8_t const *pbSrcConfig, bool fIsBridge)
    12051205{
    12061206    /*
     
    13911391    for (i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
    13921392    {
    1393         PPCIDEVICE pDev = pBus->apDevices[i];
     1393        PPDMPCIDEV pDev = pBus->apDevices[i];
    13941394        if (pDev)
    13951395        {
     
    14091409    for (i = 0;; i++)
    14101410    {
    1411         PPCIDEVICE  pDev;
    1412         PCIDEVICE   DevTmp;
     1411        PPDMPCIDEV  pDev;
     1412        PDMPCIDEV   DevTmp;
    14131413
    14141414        /* index / terminator */
     
    18551855            while (1)
    18561856            {
    1857                 PPCIDEVICE pBridge = ich9pciFindBridge(pBus, uBus);
     1857                PPDMPCIDEV pBridge = ich9pciFindBridge(pBus, uBus);
    18581858                if (!pBridge)
    18591859                {
     
    18991899                                      unsigned uBusSecondary)
    19001900{
    1901     PPCIDEVICE pBridgeDev = &pBus->aPciDev;
     1901    PPDMPCIDEV pBridgeDev = &pBus->aPciDev;
    19021902
    19031903    /* Set only if we are not on the root bus, it has no primary bus attached. */
     
    19101910    for (uint32_t iBridge = 0; iBridge < pBus->cBridges; iBridge++)
    19111911    {
    1912         PPCIDEVICE pBridge = pBus->papBridgesR3[iBridge];
     1912        PPDMPCIDEV pBridge = pBus->papBridgesR3[iBridge];
    19131913        AssertMsg(pBridge && pciDevIsPci2PciBridge(pBridge),
    19141914                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
     
    22382238    for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->apDevices); iDev++)
    22392239    {
    2240         PPCIDEVICE pPciDev = pBus->apDevices[iDev];
     2240        PPDMPCIDEV pPciDev = pBus->apDevices[iDev];
    22412241        if (pPciDev != NULL)
    22422242        {
     
    24512451    pGlobals->aPciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    24522452    pGlobals->aPciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    2453     pGlobals->aPciBus.papBridgesR3 = (PPCIDEVICE *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPCIDEVICE) * RT_ELEMENTS(pGlobals->aPciBus.apDevices));
     2453    pGlobals->aPciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->aPciBus.apDevices));
    24542454
    24552455    /*
     
    25702570}
    25712571
    2572 static void ich9pciResetDevice(PPCIDEVICE pDev)
     2572static void ich9pciResetDevice(PPDMPCIDEV pDev)
    25732573{
    25742574    /* Clear regions */
     
    26452645}
    26462646
    2647 static void ich9pciRelocateDevice(PPCIDEVICE pDev, RTGCINTPTR offDelta)
     2647static void ich9pciRelocateDevice(PPDMPCIDEV pDev, RTGCINTPTR offDelta)
    26482648{
    26492649    if (pDev)
     
    27102710    pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    27112711    pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    2712     pBus->papBridgesR3 = (PPCIDEVICE *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPCIDEVICE) * RT_ELEMENTS(pBus->apDevices));
     2712    pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices));
    27132713
    27142714    PDMPCIBUSREG PciBusReg;
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