VirtualBox

Changeset 64414 in vbox


Ignore:
Timestamp:
Oct 25, 2016 2:12:19 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111529
Message:

DevPCI: Moved ICH9PCIBUS to a common header (DevPciInternal.h) and use that for both PCI bus implementations.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmpcidevint.h

    r64395 r64414  
    8282
    8383/* Forward declaration */
    84 struct PCIBus;
     84struct DEVPCIBUS;
    8585
    8686enum {
     
    119119    PPDMDEVINSR3                    pDevInsR3;
    120120    /** Pointer to the next PDM device associate with the PDM device. (R3 ptr) */
    121     R3PTRTYPE(PPDMPCIDEV)        pNextR3;
     121    R3PTRTYPE(PPDMPCIDEV)           pNextR3;
    122122    /** Pointer to the internal PDM PCI bus for the device. (R3 ptr) */
    123123    R3PTRTYPE(struct PDMPCIBUS *)   pPdmBusR3;
     
    126126    PPDMDEVINSR0                    pDevInsR0;
    127127    /** Pointer to the next PDM device associate with the PDM device. (R0 ptr) */
    128     R0PTRTYPE(PPDMPCIDEV)        pNextR0;
     128    R0PTRTYPE(PPDMPCIDEV)           pNextR0;
    129129    /** Pointer to the internal PDM PCI bus for the device. (R0 ptr) */
    130130    R0PTRTYPE(struct PDMPCIBUS *)   pPdmBusR0;
     
    133133    PPDMDEVINSRC                    pDevInsRC;
    134134    /** Pointer to the next PDM device associate with the PDM device. (RC ptr) */
    135     RCPTRTYPE(PPDMPCIDEV)        pNextRC;
     135    RCPTRTYPE(PPDMPCIDEV)           pNextRC;
    136136    /** Pointer to the internal PDM PCI bus for the device. (RC ptr) */
    137137    RCPTRTYPE(struct PDMPCIBUS *)   pPdmBusRC;
     
    153153     */
    154154    /** Pointer to the PCI bus of the device. (R3 ptr) */
    155     R3PTRTYPE(struct PCIBus *)      pBusR3;
     155    R3PTRTYPE(struct DEVPCIBUS *)   pBusR3;
    156156    /** Page used for MSI-X state.             (R3 ptr) */
    157157    R3PTRTYPE(void *)               pMsixPageR3;
     
    168168
    169169    /** Pointer to the PCI bus of the device. (R0 ptr) */
    170     R0PTRTYPE(struct PCIBus *)      pBusR0;
     170    R0PTRTYPE(struct DEVPCIBUS *)   pBusR0;
    171171    /** Page used for MSI-X state.             (R0 ptr) */
    172172    R0PTRTYPE(void *)               pMsixPageR0;
    173173
    174174    /** Pointer to the PCI bus of the device. (RC ptr) */
    175     RCPTRTYPE(struct PCIBus *)      pBusRC;
     175    RCPTRTYPE(struct DEVPCIBUS *)   pBusRC;
    176176    /** Page used for MSI-X state.             (RC ptr) */
    177177    RCPTRTYPE(void *)               pMsixPageRC;
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r64393 r64414  
    22/** @file
    33 * DevPCI - PCI BUS Device.
     4 *
     5 * @remarks New code is currently added to DevPciMerge1.cpp.h, the goal is
     6 *          to end up with a large common code base for the two PCI bus
     7 *          implementations.  The merge file will soon be compiled separately
     8 *          and not included, so it shall not be used as a template with
     9 *          \#ifdefs for different PCI bus configs, but rather use config
     10 *          flags in the structures to select paths & feature sets.
     11 *
     12 *          When moving code, always prefer the ICH9 version, not this!
    413 */
    514
     
    5665#include "PciInline.h"
    5766#include "VBoxDD.h"
     67#include "DevPciInternal.h"
    5868
    5969
     
    6171*   Structures and Typedefs                                                                                                      *
    6272*********************************************************************************************************************************/
     73typedef DEVPCIBUS  PCIBUS;
     74typedef PDEVPCIBUS PPCIBUS;
     75
     76
    6377/**
    6478 * PIIX3 ISA Bridge state.
     
    7084} PIIX3State, PIIX3, *PPIIX3;
    7185
    72 /**
    73  * PCI Bus instance.
    74  */
    75 typedef struct PCIBus
    76 {
    77     /** Bus number. */
    78     int32_t             iBus;
    79     /** Start device number. */
    80     uint32_t            iDevSearch;
    81     /** Number of bridges attached to the bus. */
    82     uint32_t            cBridges;
    83 
    84     uint32_t            Alignment0;
    85 
    86     union
    87     {
    88         /** Array of PCI devices. */
    89         R3PTRTYPE(PPDMPCIDEV) apDevices[256];
    90         /** @deprecated   */
    91         R3PTRTYPE(PPDMPCIDEV) devices[256];
    92     };
    93     /** Array of bridges attached to the bus. */
    94     R3PTRTYPE(PPDMPCIDEV *) papBridgesR3;
    95 
    96     /** R3 pointer to the device instance. */
    97     PPDMDEVINSR3        pDevInsR3;
    98     /** Pointer to the PCI R3  helpers. */
    99     PCPDMPCIHLPR3       pPciHlpR3;
    100 
    101     /** R0 pointer to the device instance. */
    102     PPDMDEVINSR0        pDevInsR0;
    103     /** Pointer to the PCI R0 helpers. */
    104     PCPDMPCIHLPR0       pPciHlpR0;
    105 
    106     /** RC pointer to the device instance. */
    107     PPDMDEVINSRC        pDevInsRC;
    108     /** Pointer to the PCI RC helpers. */
    109     PCPDMPCIHLPRC       pPciHlpRC;
    110 
    111     /** The PCI device for the PCI bridge. */
    112     PDMPCIDEV           PciDev;
    113 
    114 } PCIBUS;
    115 /** Pointer to a PCIBUS instance. */
    116 typedef PCIBUS *PPCIBUS;
    117 typedef PCIBUS PCIBus;
    118 
    11986/** @def PCI_IRQ_PINS
    12087 * Number of pins for interrupts (PIRQ#0...PIRQ#3)
     
    133100{
    134101    /** Irq levels for the four PCI Irqs.
    135      *  These count how many devices asserted
    136      *  the IRQ line. If greater 0 an IRQ is sent to the guest.
    137      *  If it drops to 0 the IRQ is deasserted.
     102     * These count how many devices asserted the IRQ line. If greater 0 an IRQ is
     103     * sent to the guest.  If it drops to 0 the IRQ is deasserted.
    138104     */
    139105    volatile uint32_t   pci_irq_levels[PCI_IRQ_PINS];
    140106
    141 #if 1 /* Will be moved into the BIOS soon. */
     107#if 1 /* Will be moved into the BIOS "soon". */
    142108    /** The next I/O port address which the PCI BIOS will use. */
    143     uint32_t            pci_bios_io_addr;
     109    uint32_t            uPciBiosIo;
    144110    /** The next MMIO address which the PCI BIOS will use. */
    145     uint32_t            pci_bios_mem_addr;
     111    uint32_t            uPciBiosMmio;
    146112    /** Actual bus number. */
    147113    uint8_t             uBus;
     114    uint8_t             uAlignment0[2];
    148115#endif
    149116
     
    151118    bool                fUseIoApic;
    152119    /** I/O APIC irq levels */
    153     volatile uint32_t   pci_apic_irq_levels[PCI_APIC_IRQ_PINS];
     120    volatile uint32_t   uaPciApicIrqLevels[PCI_APIC_IRQ_PINS];
    154121    /** ACPI IRQ level */
    155122    uint32_t            acpi_irq_level;
    156123    /** ACPI PIC IRQ */
    157124    int                 acpi_irq;
    158     /** Config register. */
     125    /** Value latched in Configuration Address Port (0CF8h) */
    159126    uint32_t            uConfigReg;
    160127
     
    173140    PIIX3               PIIX3State;
    174141    /** PCI bus which is attached to the host-to-PCI bridge. */
    175     PCIBUS              PciBus;
     142    DEVPCIBUS           PciBus;
    176143
    177144} PCIGLOBALS;
     
    188155/** Converts a PCI bus device instance pointer to a PCIGLOBALS pointer. */
    189156#define DEVINS_2_PCIGLOBALS(pDevIns)    ((PPCIGLOBALS)(PDMINS_2_DATA(pDevIns, PPCIGLOBALS)))
    190 /** Converts a PCI bus device instance pointer to a PCIBUS pointer. */
     157/** Converts a PCI bus device instance pointer to a DEVPCIBUS pointer. */
    191158#define DEVINS_2_PCIBUS(pDevIns)        ((PPCIBUS)(&PDMINS_2_DATA(pDevIns, PPCIGLOBALS)->PciBus))
    192159
     
    529496    else
    530497    {
    531         R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus.devices[iDevice];
     498        R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus.apDevices[iDevice];
    532499        if (pci_dev)
    533500        {
     
    576543    else
    577544    {
    578         R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus.devices[iDevice];
     545        R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus.apDevices[iDevice];
    579546        if (pci_dev)
    580547        {
     
    612579static inline int get_pci_irq_apic_level(PPCIGLOBALS pGlobals, int irq_num)
    613580{
    614     return (pGlobals->pci_apic_irq_levels[irq_num] != 0);
     581    return (pGlobals->uaPciApicIrqLevels[irq_num] != 0);
    615582}
    616583
     
    626593
    627594        if ((iLevel & PDM_IRQ_LEVEL_HIGH) == PDM_IRQ_LEVEL_HIGH)
    628             ASMAtomicIncU32(&pGlobals->pci_apic_irq_levels[irq_num]);
     595            ASMAtomicIncU32(&pGlobals->uaPciApicIrqLevels[irq_num]);
    629596        else if ((iLevel & PDM_IRQ_LEVEL_HIGH) == PDM_IRQ_LEVEL_LOW)
    630             ASMAtomicDecU32(&pGlobals->pci_apic_irq_levels[irq_num]);
     597            ASMAtomicDecU32(&pGlobals->uaPciApicIrqLevels[irq_num]);
    631598
    632599        apic_irq = irq_num + 0x10;
     
    637604
    638605        if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) {
    639             ASMAtomicDecU32(&pGlobals->pci_apic_irq_levels[irq_num]);
     606            ASMAtomicDecU32(&pGlobals->uaPciApicIrqLevels[irq_num]);
    640607            pPciDev->Int.s.uIrqPinState = PDM_IRQ_LEVEL_LOW;
    641608            apic_level = get_pci_irq_apic_level(pGlobals, irq_num);
     
    998965                 * through the bridge but we want to be compliant to the spec.
    999966                 */
    1000                 if ((pGlobals->pci_bios_io_addr % 4096) != 0)
    1001                     pGlobals->pci_bios_io_addr = RT_ALIGN_32(pGlobals->pci_bios_io_addr, 4*1024);
    1002                 Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, pGlobals->pci_bios_io_addr));
    1003                 pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_BASE, (pGlobals->pci_bios_io_addr >> 8) & 0xf0);
     967                if ((pGlobals->uPciBiosIo % 4096) != 0)
     968                    pGlobals->uPciBiosIo = RT_ALIGN_32(pGlobals->uPciBiosIo, 4*1024);
     969                Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, pGlobals->uPciBiosIo));
     970                pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_BASE, (pGlobals->uPciBiosIo >> 8) & 0xf0);
    1004971
    1005972                /* The MMIO range for the bridge must be aligned to a 1MB boundary. */
    1006                 if ((pGlobals->pci_bios_mem_addr % (1024 * 1024)) != 0)
    1007                     pGlobals->pci_bios_mem_addr = RT_ALIGN_32(pGlobals->pci_bios_mem_addr, 1024*1024);
    1008                 Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, pGlobals->pci_bios_mem_addr));
    1009                 pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pGlobals->pci_bios_mem_addr >> 16) & UINT32_C(0xffff0));
     973                if ((pGlobals->uPciBiosMmio % (1024 * 1024)) != 0)
     974                    pGlobals->uPciBiosMmio = RT_ALIGN_32(pGlobals->uPciBiosMmio, 1024*1024);
     975                Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, pGlobals->uPciBiosMmio));
     976                pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pGlobals->uPciBiosMmio >> 16) & UINT32_C(0xffff0));
    1010977
    1011978                /* Save values to compare later to. */
    1012                 uint32_t u32IoAddressBase = pGlobals->pci_bios_io_addr;
    1013                 uint32_t u32MMIOAddressBase = pGlobals->pci_bios_mem_addr;
     979                uint32_t u32IoAddressBase = pGlobals->uPciBiosIo;
     980                uint32_t u32MMIOAddressBase = pGlobals->uPciBiosMmio;
    1014981
    1015982                /* Init devices behind the bridge and possibly other bridges as well. */
     
    1026993                 * interface. Again this doesn't really matter here but we want to be compliant to the spec.
    1027994                 */
    1028                 if ((u32IoAddressBase != pGlobals->pci_bios_io_addr) && ((pGlobals->pci_bios_io_addr % 4096) != 0))
     995                if ((u32IoAddressBase != pGlobals->uPciBiosIo) && ((pGlobals->uPciBiosIo % 4096) != 0))
    1029996                {
    1030997                    /* The upper boundary must be one byte less than a 4KB boundary. */
    1031                     pGlobals->pci_bios_io_addr = RT_ALIGN_32(pGlobals->pci_bios_io_addr, 4*1024);
     998                    pGlobals->uPciBiosIo = RT_ALIGN_32(pGlobals->uPciBiosIo, 4*1024);
    1032999                }
    1033                 pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pGlobals->pci_bios_io_addr >> 8) & 0xf0) - 1);
     1000                pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pGlobals->uPciBiosIo >> 8) & 0xf0) - 1);
    10341001
    10351002                /* Same with the MMIO limit register but with 1MB boundary here. */
    1036                 if ((u32MMIOAddressBase != pGlobals->pci_bios_mem_addr) && ((pGlobals->pci_bios_mem_addr % (1024 * 1024)) != 0))
     1003                if ((u32MMIOAddressBase != pGlobals->uPciBiosMmio) && ((pGlobals->uPciBiosMmio % (1024 * 1024)) != 0))
    10371004                {
    10381005                    /* The upper boundary must be one byte less than a 1MB boundary. */
    1039                     pGlobals->pci_bios_mem_addr = RT_ALIGN_32(pGlobals->pci_bios_mem_addr, 1024*1024);
     1006                    pGlobals->uPciBiosMmio = RT_ALIGN_32(pGlobals->uPciBiosMmio, 1024*1024);
    10401007                }
    1041                 pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pGlobals->pci_bios_mem_addr >> 16) & UINT32_C(0xfff0)) - 1);
     1008                pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pGlobals->uPciBiosMmio >> 16) & UINT32_C(0xfff0)) - 1);
    10421009
    10431010                /*
     
    10931060                    {
    10941061                        if (fIsPio)
    1095                             paddr = &pGlobals->pci_bios_io_addr;
     1062                            paddr = &pGlobals->uPciBiosIo;
    10961063                        else
    1097                             paddr = &pGlobals->pci_bios_mem_addr;
     1064                            paddr = &pGlobals->uPciBiosMmio;
    10981065                        uint32_t uNew = *paddr;
    10991066                        uNew = (uNew + u32Size - 1) & ~(u32Size - 1);
     
    12491216 *       as a possible file #2 contains external code if there's any left.
    12501217 */
    1251 typedef PPCIBUS PPCIMERGEDBUS;
    12521218# define pciR3UnmergedConfigReadDev  pci_default_read_config
    12531219# define pciR3UnmergedConfigWriteDev pci_default_write_config
     
    12691235     * Iterate thru all the devices.
    12701236     */
    1271     for (uint32_t i = 0; i < RT_ELEMENTS(pBus->devices); i++)
    1272     {
    1273         PPDMPCIDEV pDev = pBus->devices[i];
     1237    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
     1238    {
     1239        PPDMPCIDEV pDev = pBus->apDevices[i];
    12741240        if (pDev)
    12751241        {
     
    13061272        SSMR3PutU32(pSSM, pThis->pci_irq_levels[i]);
    13071273    for (i = 0; i < PCI_APIC_IRQ_PINS; i++)
    1308         SSMR3PutU32(pSSM, pThis->pci_apic_irq_levels[i]);
     1274        SSMR3PutU32(pSSM, pThis->uaPciApicIrqLevels[i]);
    13091275
    13101276    SSMR3PutU32(pSSM, pThis->acpi_irq_level);
     
    15111477     * LogRels in pciR3CommonRestoreConfig.
    15121478     */
    1513     for (i = 0; i < RT_ELEMENTS(pBus->devices); i++)
    1514     {
    1515         PPDMPCIDEV pDev = pBus->devices[i];
     1479    for (i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
     1480    {
     1481        PPDMPCIDEV pDev = pBus->apDevices[i];
    15161482        if (pDev)
    15171483        {
     
    15371503        if (u32 == (uint32_t)~0)
    15381504            break;
    1539         if (    u32 >= RT_ELEMENTS(pBus->devices)
     1505        if (    u32 >= RT_ELEMENTS(pBus->apDevices)
    15401506            ||  u32 < i)
    15411507        {
     
    15471513        for (; i < u32; i++)
    15481514        {
    1549             if (pBus->devices[i])
     1515            if (pBus->apDevices[i])
    15501516            {
    1551                 LogRel(("PCI: New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pBus->devices[i]->pszNameR3,
    1552                         PCIDevGetVendorId(pBus->devices[i]), PCIDevGetDeviceId(pBus->devices[i])));
     1517                LogRel(("PCI: New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pBus->apDevices[i]->pszNameR3,
     1518                        PCIDevGetVendorId(pBus->apDevices[i]), PCIDevGetDeviceId(pBus->apDevices[i])));
    15531519                if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
    15541520                    return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("New device in slot %#x, %s (vendor=%#06x device=%#06x)"),
    1555                                             i, pBus->devices[i]->pszNameR3, PCIDevGetVendorId(pBus->devices[i]), PCIDevGetDeviceId(pBus->devices[i]));
     1521                                            i, pBus->apDevices[i]->pszNameR3, PCIDevGetVendorId(pBus->apDevices[i]), PCIDevGetDeviceId(pBus->apDevices[i]));
    15561522            }
    15571523        }
     
    15761542
    15771543        /* check that it's still around. */
    1578         pDev = pBus->devices[i];
     1544        pDev = pBus->apDevices[i];
    15791545        if (!pDev)
    15801546        {
     
    16331599            SSMR3GetU32(pSSM, (uint32_t *)&pThis->pci_irq_levels[i]);
    16341600        for (uint8_t i = 0; i < PCI_APIC_IRQ_PINS; i++)
    1635             SSMR3GetU32(pSSM, (uint32_t *)&pThis->pci_apic_irq_levels[i]);
     1601            SSMR3GetU32(pSSM, (uint32_t *)&pThis->uaPciApicIrqLevels[i]);
    16361602
    16371603        SSMR3GetU32(pSSM, &pThis->acpi_irq_level);
     
    17361702     * Set the start addresses.
    17371703     */
    1738     pGlobals->pci_bios_io_addr  = 0xd000;
    1739     pGlobals->pci_bios_mem_addr = UINT32_C(0xf0000000);
     1704    pGlobals->uPciBiosIo  = 0xd000;
     1705    pGlobals->uPciBiosMmio = UINT32_C(0xf0000000);
    17401706    pGlobals->uBus = 0;
    17411707
     
    18141780    for (int i = 0; i < PCI_APIC_IRQ_PINS; ++i)
    18151781    {
    1816         pHlp->pfnPrintf(pHlp, "  IRQ%02d: %u\n", 0x10 + i, pGlobals->pci_apic_irq_levels[i]);
     1782        pHlp->pfnPrintf(pHlp, "  IRQ%02d: %u\n", 0x10 + i, pGlobals->uaPciApicIrqLevels[i]);
    18171783    }
    18181784}
     
    18411807static void pciR3BusInfo(PPCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent, bool fRegisters)
    18421808{
    1843     for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->devices); iDev++)
    1844     {
    1845         PPDMPCIDEV pPciDev = pBus->devices[iDev];
     1809    for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->apDevices); iDev++)
     1810    {
     1811        PPDMPCIDEV pPciDev = pBus->apDevices[iDev];
    18461812        if (pPciDev != NULL)
    18471813        {
     
    19781944
    19791945    /* Relocate RC pointers for the attached pci devices. */
    1980     for (uint32_t i = 0; i < RT_ELEMENTS(pBus->devices); i++)
    1981     {
    1982         if (pBus->devices[i])
    1983             pBus->devices[i]->Int.s.pBusRC += offDelta;
     1946    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
     1947    {
     1948        if (pBus->apDevices[i])
     1949            pBus->apDevices[i]->Int.s.pBusRC += offDelta;
    19841950    }
    19851951}
     
    20362002     */
    20372003    PPCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);
    2038     pGlobals->pci_bios_io_addr    = 0xc000;
    2039     pGlobals->pci_bios_mem_addr   = 0xf0000000;
     2004    pGlobals->uPciBiosIo    = 0xc000;
     2005    pGlobals->uPciBiosMmio   = 0xf0000000;
    20402006    memset((void *)&pGlobals->pci_irq_levels, 0, sizeof(pGlobals->pci_irq_levels));
    20412007    pGlobals->fUseIoApic          = fUseIoApic;
    2042     memset((void *)&pGlobals->pci_apic_irq_levels, 0, sizeof(pGlobals->pci_apic_irq_levels));
     2008    memset((void *)&pGlobals->uaPciApicIrqLevels, 0, sizeof(pGlobals->uaPciApicIrqLevels));
    20432009
    20442010    pGlobals->pDevInsR3 = pDevIns;
     
    20502016    pGlobals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    20512017    pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns,   sizeof(PPDMPCIDEV)
    2052                                                                                  * RT_ELEMENTS(pGlobals->PciBus.devices));
     2018                                                                                 * RT_ELEMENTS(pGlobals->PciBus.apDevices));
    20532019
    20542020    PDMPCIBUSREG PciBusReg;
     
    22682234    {
    22692235        /* This is the target bus, pass the write to the device. */
    2270         PPDMPCIDEV pPciDev = pBus->devices[iDevice];
     2236        PPDMPCIDEV pPciDev = pBus->apDevices[iDevice];
    22712237        if (pPciDev)
    22722238        {
     
    23012267    {
    23022268        /* This is the target bus, pass the read to the device. */
    2303         PPDMPCIDEV pPciDev = pBus->devices[iDevice];
     2269        PPDMPCIDEV pPciDev = pBus->apDevices[iDevice];
    23042270        if (pPciDev)
    23052271        {
     
    23582324
    23592325    /* Relocate RC pointers for the attached pci devices. */
    2360     for (uint32_t i = 0; i < RT_ELEMENTS(pBus->devices); i++)
    2361     {
    2362         if (pBus->devices[i])
    2363             pBus->devices[i]->Int.s.pBusRC += offDelta;
     2326    for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)
     2327    {
     2328        if (pBus->apDevices[i])
     2329            pBus->apDevices[i]->Int.s.pBusRC += offDelta;
    23642330    }
    23652331}
     
    24012367    pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    24022368    pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    2403     pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->devices));
     2369    pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices));
    24042370
    24052371    PDMPCIBUSREG PciBusReg;
     
    25042470    ~0U,
    25052471    /* cbInstance */
    2506     sizeof(PCIBUS),
     2472    sizeof(DEVPCIBUS),
    25072473    /* pfnConstruct */
    25082474    pcibridgeR3Construct,
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r64393 r64414  
    33 * DevPCI - ICH9 southbridge PCI bus emulation device.
    44 *
    5  * @note    bird: I've cleaned up DevPCI.cpp to some extent, this file has not
    6  *                be cleaned up and because of pending code merge.
     5 * @remarks New code is currently added to DevPciMerge1.cpp.h, the goal is
     6 *          to end up with a large common code base for the two PCI bus
     7 *          implementations.  The merge file will soon be compiled separately
     8 *          and not included, so it shall not be used as a template with
     9 *          \#ifdefs for different PCI bus configs, but rather use config
     10 *          flags in the structures to select paths & feature sets.
     11 *
     12 *          When moving code, always prefer the ICH9 version (this file)!
    713 */
    814
     
    2430*********************************************************************************************************************************/
    2531#define LOG_GROUP LOG_GROUP_DEV_PCI
    26 #define PCIBus    ICH9PCIBus        /**< HACK ALERT! Real ugly type hack! */
    2732#define PDMPCIDEV_INCLUDE_PRIVATE  /* Hack to get pdmpcidevint.h included at the right point. */
    2833#include <VBox/vmm/pdmpcidev.h>
     
    4146#include "VBoxDD.h"
    4247#include "MsiCommon.h"
     48#include "DevPciInternal.h"
    4349
    4450
     
    4652*   Structures and Typedefs                                                                                                      *
    4753*********************************************************************************************************************************/
    48 /**
    49  * PCI Bus instance.
    50  */
    51 typedef struct ICH9PCIBus
    52 {
    53     /** Bus number. */
    54     int32_t             iBus;
    55     /** Number of bridges attached to the bus. */
    56     uint32_t            cBridges;
    57 
    58     /** Array of PCI devices. We assume 32 slots, each with 8 functions. */
    59     R3PTRTYPE(PPDMPCIDEV)   apDevices[256];
    60     /** Array of bridges attached to the bus. */
    61     R3PTRTYPE(PPDMPCIDEV *) papBridgesR3;
    62 
    63     /** R3 pointer to the device instance. */
    64     PPDMDEVINSR3        pDevInsR3;
    65     /** Pointer to the PCI R3  helpers. */
    66     PCPDMPCIHLPR3       pPciHlpR3;
    67 
    68     /** R0 pointer to the device instance. */
    69     PPDMDEVINSR0        pDevInsR0;
    70     /** Pointer to the PCI R0 helpers. */
    71     PCPDMPCIHLPR0       pPciHlpR0;
    72 
    73     /** RC pointer to the device instance. */
    74     PPDMDEVINSRC        pDevInsRC;
    75     /** Pointer to the PCI RC helpers. */
    76     PCPDMPCIHLPRC       pPciHlpRC;
    77 
    78     /** The PCI device for the PCI bridge. */
    79     PDMPCIDEV           aPciDev;
    80 
    81     /** Start device number - always zero (only for DevPCI source compat). */
    82     uint32_t            iDevSearch;
    83     /** Size alignemnt padding. */
    84     uint32_t            u32Alignment;
    85 } ICH9PCIBUS, *PICH9PCIBUS;
     54typedef DEVPCIBUS  ICH9PCIBUS;
     55typedef PDEVPCIBUS PICH9PCIBUS;
    8656
    8757
     
    10979    volatile uint32_t   uaPciApicIrqLevels[PCI_APIC_IRQ_PINS];
    11080
    111 #if 1 /* Will be moved into the BIOS soon. */
     81#if 1 /* Will be moved into the BIOS "soon". */
    11282    /** The next I/O port address which the PCI BIOS will use. */
    11383    uint32_t            uPciBiosIo;
     
    12696
    12797    /** PCI bus which is attached to the host-to-PCI bridge. */
    128     ICH9PCIBUS          aPciBus;
     98    DEVPCIBUS           PciBus;
    12999} ICH9PCIGLOBALS, *PICH9PCIGLOBALS;
    130100
     
    159129#define DEVINS_2_PCIGLOBALS(pDevIns)    ((PICH9PCIGLOBALS)(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS)))
    160130/** Converts a device instance pointer to a PCIBUS pointer. */
    161 #define DEVINS_2_PCIBUS(pDevIns)        ((PICH9PCIBUS)(&PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS)->aPciBus))
     131#define DEVINS_2_PCIBUS(pDevIns)        ((PICH9PCIBUS)(&PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS)->PciBus))
    162132/** Converts a pointer to a PCI root bus instance to a PCIGLOBALS pointer. */
    163 #define PCIROOTBUS_2_PCIGLOBALS(pPciBus)    ( (PICH9PCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(ICH9PCIGLOBALS, aPciBus)) )
     133#define PCIROOTBUS_2_PCIGLOBALS(pPciBus)    ( (PICH9PCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(ICH9PCIGLOBALS, PciBus)) )
    164134
    165135/** @def PCI_LOCK
     
    228198    do
    229199    {
    230         uDevFnBridge  = pBus->aPciDev.uDevFn;
     200        uDevFnBridge  = pBus->PciDev.uDevFn;
    231201        iIrqPinBridge = ((pPciDevBus->uDevFn >> 3) + iIrqPinBridge) & 3;
    232202
    233203        /* Get the parent. */
    234         pBus = pBus->aPciDev.Int.s.CTX_SUFF(pBus);
    235         pPciDevBus = &pBus->aPciDev;
     204        pBus = pBus->PciDev.Int.s.CTX_SUFF(pBus);
     205        pPciDevBus = &pBus->PciDev;
    236206    } while (pBus->iBus != 0);
    237207
     
    327297    if (pAddr->iBus != 0)       /* forward to subordinate bus */
    328298    {
    329         if (pGlobals->aPciBus.cBridges)
     299        if (pGlobals->PciBus.cBridges)
    330300        {
    331301#ifdef IN_RING3 /** @todo do lookup in R0/RC too! */
    332             PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->aPciBus, pAddr->iBus);
     302            PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->PciBus, pAddr->iBus);
    333303            if (pBridgeDevice)
    334304            {
     
    344314    else                    /* forward to directly connected device */
    345315    {
    346         R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->aPciBus.apDevices[pAddr->iDeviceFunc];
     316        R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->PciBus.apDevices[pAddr->iDeviceFunc];
    347317        if (pPciDev)
    348318        {
     
    440410    if (pPciAddr->iBus != 0)    /* forward to subordinate bus */
    441411    {
    442         if (pGlobals->aPciBus.cBridges)
     412        if (pGlobals->PciBus.cBridges)
    443413        {
    444414#ifdef IN_RING3 /** @todo do lookup in R0/RC too! */
    445             PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->aPciBus, pPciAddr->iBus);
     415            PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->PciBus, pPciAddr->iBus);
    446416            if (pBridgeDevice)
    447417            {
     
    461431    else                    /* forward to directly connected device */
    462432    {
    463         R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->aPciBus.apDevices[pPciAddr->iDeviceFunc];
     433        R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->PciBus.apDevices[pPciAddr->iDeviceFunc];
    464434        if (pPciDev)
    465435        {
     
    631601        Assert(!MsixIsEnabled(pPciDev));    /* Not allowed -- see note above. */
    632602        LogFlowFunc(("PCI Dev %p : MSI\n", pPciDev));
    633         PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
    634         MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
     603        PPDMDEVINS pDevIns = pGlobals->PciBus.CTX_SUFF(pDevIns);
     604        MsiNotify(pDevIns, pGlobals->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
    635605        return;
    636606    }
     
    639609    {
    640610        LogFlowFunc(("PCI Dev %p : MSI-X\n", pPciDev));
    641         PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
    642         MsixNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
     611        PPDMDEVINS pDevIns = pGlobals->PciBus.CTX_SUFF(pDevIns);
     612        MsixNotify(pDevIns, pGlobals->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
    643613        return;
    644614    }
    645615
    646     PICH9PCIBUS     pBus      =     &pGlobals->aPciBus;
     616    PICH9PCIBUS     pBus      =     &pGlobals->PciBus;
    647617    const bool  fIsAcpiDevice = PCIDevGetDeviceId(pPciDev) == 0x7113;
    648618
     
    784754 *       as a possible file #2 contains external code if there's any left.
    785755 */
    786 typedef PICH9PCIBUS PPCIMERGEDBUS;
    787756# define pciR3UnmergedConfigReadDev  ich9pciConfigReadDev
    788757# define pciR3UnmergedConfigWriteDev ich9pciConfigWriteDev
     
    11211090    SSMR3PutU32(pSSM, UINT32_MAX);  /* separator */
    11221091
    1123     return ich9pciR3CommonSaveExec(&pThis->aPciBus, pSSM);
     1092    return ich9pciR3CommonSaveExec(&pThis->PciBus, pSSM);
    11241093}
    11251094
     
    11391108
    11401109    /* If the current bus is not the target bus search for the bus which contains the device. */
    1141     if (iBus != PCIDevGetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS))
     1110    if (iBus != PCIDevGetByte(&pBus->PciDev, VBOX_PCI_SECONDARY_BUS))
    11421111    {
    11431112        PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(pBus, iBus);
     
    11691138
    11701139    /* If the current bus is not the target bus search for the bus which contains the device. */
    1171     if (iBus != PCIDevGetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS))
     1140    if (iBus != PCIDevGetByte(&pBus->PciDev, VBOX_PCI_SECONDARY_BUS))
    11721141    {
    11731142        PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(pBus, iBus);
     
    15161485{
    15171486    PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
    1518     PICH9PCIBUS     pBus  = &pThis->aPciBus;
     1487    PICH9PCIBUS     pBus  = &pThis->PciBus;
    15191488    uint32_t        u32;
    15201489    int             rc;
     
    18551824        {
    18561825            /* Find bus this device attached to. */
    1857             PICH9PCIBUS pBus = &pGlobals->aPciBus;
     1826            PICH9PCIBUS pBus = &pGlobals->PciBus;
    18581827            while (1)
    18591828            {
     
    18781847            {
    18791848                /* Get the pin the device would assert on the bridge. */
    1880                 iPin = ((pBus->aPciDev.uDevFn >> 3) + iPin) & 3;
    1881                 pBus = pBus->aPciDev.Int.s.pBusR3;
     1849                iPin = ((pBus->PciDev.uDevFn >> 3) + iPin) & 3;
     1850                pBus = pBus->PciDev.Int.s.pBusR3;
    18821851            };
    18831852        }
     
    19021871                                      unsigned uBusSecondary)
    19031872{
    1904     PPDMPCIDEV pBridgeDev = &pBus->aPciDev;
     1873    PPDMPCIDEV pBridgeDev = &pBus->PciDev;
    19051874
    19061875    /* Set only if we are not on the root bus, it has no primary bus attached. */
     
    19561925     * Assign bridge topology, for further routing to work.
    19571926     */
    1958     PICH9PCIBUS pBus = &pGlobals->aPciBus;
     1927    PICH9PCIBUS pBus = &pGlobals->PciBus;
    19591928    ich9pciInitBridgeTopology(pGlobals, pBus, 0, 0);
    19601929
     
    24312400     */
    24322401    PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
    2433     PICH9PCIBUS     pBus     = &pGlobals->aPciBus;
     2402    PICH9PCIBUS     pBus     = &pGlobals->PciBus;
    24342403    /* Zero out everything */
    24352404    memset(pGlobals, 0, sizeof(*pGlobals));
     
    24512420    pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    24522421
    2453     pGlobals->aPciBus.pDevInsR3 = pDevIns;
    2454     pGlobals->aPciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    2455     pGlobals->aPciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    2456     pGlobals->aPciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->aPciBus.apDevices));
     2422    pGlobals->PciBus.pDevInsR3 = pDevIns;
     2423    pGlobals->PciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     2424    pGlobals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     2425    pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->PciBus.apDevices));
    24572426
    24582427    /*
     
    24912460#if 0
    24922461    /* Host bridge device */
    2493     PCIDevSetVendorId(  &pBus->aPciDev, 0x8086); /* Intel */
    2494     PCIDevSetDeviceId(  &pBus->aPciDev, 0x29e0); /* Desktop */
    2495     PCIDevSetRevisionId(&pBus->aPciDev,   0x01); /* rev. 01 */
    2496     PCIDevSetClassBase( &pBus->aPciDev,   0x06); /* bridge */
    2497     PCIDevSetClassSub(  &pBus->aPciDev,   0x00); /* Host/PCI bridge */
    2498     PCIDevSetClassProg( &pBus->aPciDev,   0x00); /* Host/PCI bridge */
    2499     PCIDevSetHeaderType(&pBus->aPciDev,   0x00); /* bridge */
    2500     PCIDevSetWord(&pBus->aPciDev,  VBOX_PCI_SEC_STATUS, 0x0280);  /* secondary status */
    2501 
    2502     pBus->aPciDev.pDevIns               = pDevIns;
     2462    PCIDevSetVendorId(  &pBus->PciDev, 0x8086); /* Intel */
     2463    PCIDevSetDeviceId(  &pBus->PciDev, 0x29e0); /* Desktop */
     2464    PCIDevSetRevisionId(&pBus->PciDev,   0x01); /* rev. 01 */
     2465    PCIDevSetClassBase( &pBus->PciDev,   0x06); /* bridge */
     2466    PCIDevSetClassSub(  &pBus->PciDev,   0x00); /* Host/PCI bridge */
     2467    PCIDevSetClassProg( &pBus->PciDev,   0x00); /* Host/PCI bridge */
     2468    PCIDevSetHeaderType(&pBus->PciDev,   0x00); /* bridge */
     2469    PCIDevSetWord(&pBus->PciDev,  VBOX_PCI_SEC_STATUS, 0x0280);  /* secondary status */
     2470
     2471    pBus->PciDev.pDevIns               = pDevIns;
    25032472    /* We register Host<->PCI controller on the bus */
    2504     ich9pciRegisterInternal(pBus, 0, &pBus->aPciDev, "dram");
     2473    ich9pciRegisterInternal(pBus, 0, &pBus->PciDev, "dram");
    25052474#endif
    25062475
     
    26302599{
    26312600    PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
    2632     PICH9PCIBUS     pBus     = &pGlobals->aPciBus;
     2601    PICH9PCIBUS     pBus     = &pGlobals->PciBus;
    26332602
    26342603    /* PCI-specific reset for each device. */
     
    26642633{
    26652634    PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
    2666     PICH9PCIBUS     pBus     = &pGlobals->aPciBus;
     2635    PICH9PCIBUS     pBus     = &pGlobals->PciBus;
    26672636    pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    26682637
     
    27442713     * Fill in PCI configs and add them to the bus.
    27452714     */
    2746     PCIDevSetVendorId(  &pBus->aPciDev, 0x8086); /* Intel */
    2747     PCIDevSetDeviceId(  &pBus->aPciDev, 0x2448); /* 82801 Mobile PCI bridge. */
    2748     PCIDevSetRevisionId(&pBus->aPciDev,   0xf2);
    2749     PCIDevSetClassSub(  &pBus->aPciDev,   0x04); /* pci2pci */
    2750     PCIDevSetClassBase( &pBus->aPciDev,   0x06); /* PCI_bridge */
    2751     PCIDevSetClassProg( &pBus->aPciDev,   0x01); /* Supports subtractive decoding. */
    2752     PCIDevSetHeaderType(&pBus->aPciDev,   0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */
    2753     PCIDevSetCommand(   &pBus->aPciDev,   0x00);
    2754     PCIDevSetStatus(    &pBus->aPciDev,   0x20); /* 66MHz Capable. */
    2755     PCIDevSetInterruptLine(&pBus->aPciDev, 0x00); /* This device does not assert interrupts. */
     2715    PCIDevSetVendorId(  &pBus->PciDev, 0x8086); /* Intel */
     2716    PCIDevSetDeviceId(  &pBus->PciDev, 0x2448); /* 82801 Mobile PCI bridge. */
     2717    PCIDevSetRevisionId(&pBus->PciDev,   0xf2);
     2718    PCIDevSetClassSub(  &pBus->PciDev,   0x04); /* pci2pci */
     2719    PCIDevSetClassBase( &pBus->PciDev,   0x06); /* PCI_bridge */
     2720    PCIDevSetClassProg( &pBus->PciDev,   0x01); /* Supports subtractive decoding. */
     2721    PCIDevSetHeaderType(&pBus->PciDev,   0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */
     2722    PCIDevSetCommand(   &pBus->PciDev,   0x00);
     2723    PCIDevSetStatus(    &pBus->PciDev,   0x20); /* 66MHz Capable. */
     2724    PCIDevSetInterruptLine(&pBus->PciDev, 0x00); /* This device does not assert interrupts. */
    27562725
    27572726    /*
     
    27592728     * devices attached to the bus is unaffected.
    27602729     */
    2761     PCIDevSetInterruptPin (&pBus->aPciDev, 0x00);
     2730    PCIDevSetInterruptPin (&pBus->PciDev, 0x00);
    27622731
    27632732    /*
    27642733     * Register this PCI bridge. The called function will take care on which bus we will get registered.
    27652734     */
    2766     rc = PDMDevHlpPCIRegisterEx(pDevIns, &pBus->aPciDev, PDMPCIDEVREG_CFG_PRIMARY, PDMPCIDEVREG_F_PCI_BRIDGE,
     2735    rc = PDMDevHlpPCIRegisterEx(pDevIns, &pBus->PciDev, PDMPCIDEVREG_CFG_PRIMARY, PDMPCIDEVREG_F_PCI_BRIDGE,
    27672736                                PDMPCIDEVREG_DEV_NO_FIRST_UNUSED, PDMPCIDEVREG_FUN_NO_FIRST_UNUSED, "ich9pcibridge");
    27682737    if (RT_FAILURE(rc))
    27692738        return rc;
    2770     pBus->aPciDev.Int.s.pfnBridgeConfigRead  = ich9pcibridgeConfigRead;
    2771     pBus->aPciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite;
     2739    pBus->PciDev.Int.s.pfnBridgeConfigRead  = ich9pcibridgeConfigRead;
     2740    pBus->PciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite;
    27722741
    27732742    /*
     
    28062775
    28072776    /* Reset config space to default values. */
    2808     PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_PRIMARY_BUS, 0);
    2809     PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS, 0);
    2810     PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_SUBORDINATE_BUS, 0);
     2777    PCIDevSetByte(&pBus->PciDev, VBOX_PCI_PRIMARY_BUS, 0);
     2778    PCIDevSetByte(&pBus->PciDev, VBOX_PCI_SECONDARY_BUS, 0);
     2779    PCIDevSetByte(&pBus->PciDev, VBOX_PCI_SUBORDINATE_BUS, 0);
    28112780
    28122781    /* PCI-specific reset for each device. */
     
    29102879    ~0U,
    29112880    /* cbInstance */
    2912     sizeof(ICH9PCIBUS),
     2881    sizeof(DEVPCIBUS),
    29132882    /* pfnConstruct */
    29142883    ich9pcibridgeConstruct,
  • trunk/src/VBox/Devices/Bus/DevPciMerge1.cpp.h

    r64375 r64414  
    2828 * @remarks Caller enters the PDM critical section.
    2929 */
    30 static uint8_t pciR3MergedFindUnusedDeviceNo(PPCIMERGEDBUS pBus)
     30static uint8_t pciR3MergedFindUnusedDeviceNo(PDEVPCIBUS pBus)
    3131{
    3232    for (uint8_t uPciDevNo = pBus->iDevSearch >> VBOX_PCI_DEVFN_DEV_SHIFT; uPciDevNo < VBOX_PCI_MAX_DEVICES; uPciDevNo++)
     
    6464 * @remarks Caller enters the PDM critical section.
    6565 */
    66 static int pciR3MergedRegisterDeviceOnBus(PPCIMERGEDBUS pBus, PPDMPCIDEV pPciDev, uint32_t fFlags,
     66static int pciR3MergedRegisterDeviceOnBus(PDEVPCIBUS pBus, PPDMPCIDEV pPciDev, uint32_t fFlags,
    6767                                          uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName,
    6868                                          PFNPCICONFIGREAD pfnConfigRead, PFNPCICONFIGWRITE pfnConfigWrite)
     
    221221                                             uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName)
    222222{
    223     PPCIMERGEDBUS pBus = DEVINS_2_PCIBUS(pDevIns);
     223    PDEVPCIBUS pBus = DEVINS_2_PCIBUS(pDevIns);
    224224    return pciR3MergedRegisterDeviceOnBus(pBus, pPciDev, fFlags, uPciDevNo, uPciFunNo, pszName,
    225225                                          pciR3UnmergedConfigReadDev, pciR3UnmergedConfigWriteDev);
     
    233233                                                         uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName)
    234234{
    235     PPCIMERGEDBUS pBus = PDMINS_2_DATA(pDevIns, PPCIMERGEDBUS);
     235    PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS);
    236236    return pciR3MergedRegisterDeviceOnBus(pBus, pPciDev, fFlags, uPciDevNo, uPciFunNo, pszName,
    237237                                          pciR3UnmergedConfigReadDev, pciR3UnmergedConfigWriteDev);
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSize.cpp

    r64387 r64414  
    361361# endif
    362362#endif
    363     CHECK_MEMBER_ALIGNMENT(PCIBUS, devices, 16);
    364     CHECK_MEMBER_ALIGNMENT(PCIBUS, devices, 16);
     363    CHECK_MEMBER_ALIGNMENT(DEVPCIBUS, apDevices, 64);
    365364    CHECK_MEMBER_ALIGNMENT(PCIGLOBALS, pci_irq_levels, 16);
    366365    CHECK_MEMBER_ALIGNMENT(PCNETSTATE, u64LastPoll, 8);
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r64409 r64414  
    3636#define VBOX_DEVICE_STRUCT_TESTCASE
    3737#define VBOX_WITH_HGCM                  /* grumble */
     38#undef LOG_GROUP
     39#include "../Bus/DevPciInternal.h"
    3840#undef LOG_GROUP
    3941#include "../Bus/DevPCI.cpp" /* must be first! */
     
    147149    GEN_CHECK_OFF(PDMDEVINS, achInstanceData);
    148150
    149     /* DevPCI.cpp */
     151    /* PDMPCIDEV */
    150152    GEN_CHECK_SIZE(PDMPCIDEV);
    151153    GEN_CHECK_SIZE(PDMPCIDEVINT);
    152     GEN_CHECK_SIZE(PCIIOREGION);
     154    GEN_CHECK_SIZE(PCIIOREGION); /** @todo fix name of PCIIOREGION */
    153155    GEN_CHECK_OFF(PDMPCIDEV, abConfig);
    154156    GEN_CHECK_OFF(PDMPCIDEV, uDevFn);
     
    173175    GEN_CHECK_OFF(PDMPCIDEV, Int.s.pfnBridgeConfigWrite);
    174176    GEN_CHECK_PADDING(PDMPCIDEV, Int, 8);
     177
     178    /* DevPciInternal.h */
     179    GEN_CHECK_SIZE(DEVPCIBUS);
     180    GEN_CHECK_OFF(DEVPCIBUS, iBus);
     181    GEN_CHECK_OFF(DEVPCIBUS, iDevSearch);
     182    GEN_CHECK_OFF(DEVPCIBUS, cBridges);
     183    GEN_CHECK_OFF(DEVPCIBUS, apDevices);
     184    GEN_CHECK_OFF(DEVPCIBUS, apDevices[1]);
     185    GEN_CHECK_OFF(DEVPCIBUS, pDevInsR3);
     186    GEN_CHECK_OFF(DEVPCIBUS, pPciHlpR3);
     187    GEN_CHECK_OFF(DEVPCIBUS, papBridgesR3);
     188    GEN_CHECK_OFF(DEVPCIBUS, pDevInsR0);
     189    GEN_CHECK_OFF(DEVPCIBUS, pPciHlpR0);
     190    GEN_CHECK_OFF(DEVPCIBUS, pDevInsRC);
     191    GEN_CHECK_OFF(DEVPCIBUS, pPciHlpRC);
     192    GEN_CHECK_OFF(DEVPCIBUS, PciDev);
     193
     194    /* DevPCI.cpp */
    175195    GEN_CHECK_SIZE(PIIX3State);
    176     GEN_CHECK_SIZE(PCIBUS);
    177     GEN_CHECK_OFF(PCIBUS, iBus);
    178     GEN_CHECK_OFF(PCIBUS, iDevSearch);
    179     GEN_CHECK_OFF(PCIBUS, cBridges);
    180     GEN_CHECK_OFF(PCIBUS, devices);
    181     GEN_CHECK_OFF(PCIBUS, devices[1]);
    182     GEN_CHECK_OFF(PCIBUS, pDevInsR3);
    183     GEN_CHECK_OFF(PCIBUS, pPciHlpR3);
    184     GEN_CHECK_OFF(PCIBUS, papBridgesR3);
    185     GEN_CHECK_OFF(PCIBUS, pDevInsR0);
    186     GEN_CHECK_OFF(PCIBUS, pPciHlpR0);
    187     GEN_CHECK_OFF(PCIBUS, pDevInsRC);
    188     GEN_CHECK_OFF(PCIBUS, pPciHlpRC);
    189     GEN_CHECK_OFF(PCIBUS, PciDev);
    190196    GEN_CHECK_SIZE(PCIGLOBALS);
    191     GEN_CHECK_OFF(PCIGLOBALS, pci_bios_io_addr);
    192     GEN_CHECK_OFF(PCIGLOBALS, pci_bios_mem_addr);
     197    GEN_CHECK_OFF(PCIGLOBALS, uPciBiosIo);
     198    GEN_CHECK_OFF(PCIGLOBALS, uPciBiosMmio);
    193199    GEN_CHECK_OFF(PCIGLOBALS, pci_irq_levels);
    194200    GEN_CHECK_OFF(PCIGLOBALS, pci_irq_levels[1]);
    195201    GEN_CHECK_OFF(PCIGLOBALS, fUseIoApic);
    196     GEN_CHECK_OFF(PCIGLOBALS, pci_apic_irq_levels);
    197     GEN_CHECK_OFF(PCIGLOBALS, pci_apic_irq_levels[1]);
     202    GEN_CHECK_OFF(PCIGLOBALS, uaPciApicIrqLevels);
     203    GEN_CHECK_OFF(PCIGLOBALS, uaPciApicIrqLevels[1]);
    198204    GEN_CHECK_OFF(PCIGLOBALS, acpi_irq_level);
    199205    GEN_CHECK_OFF(PCIGLOBALS, acpi_irq);
     
    206212
    207213    /* DevPciIch9.cpp */
    208     GEN_CHECK_SIZE(ICH9PCIBUS);
    209     GEN_CHECK_OFF(ICH9PCIBUS, iBus);
    210     GEN_CHECK_OFF(ICH9PCIBUS, cBridges);
    211     GEN_CHECK_OFF(ICH9PCIBUS, apDevices);
    212     GEN_CHECK_OFF(ICH9PCIBUS, apDevices[1]);
    213     GEN_CHECK_OFF(ICH9PCIBUS, pDevInsR3);
    214     GEN_CHECK_OFF(ICH9PCIBUS, pPciHlpR3);
    215     GEN_CHECK_OFF(ICH9PCIBUS, papBridgesR3);
    216     GEN_CHECK_OFF(ICH9PCIBUS, pDevInsR0);
    217     GEN_CHECK_OFF(ICH9PCIBUS, pPciHlpR0);
    218     GEN_CHECK_OFF(ICH9PCIBUS, pDevInsRC);
    219     GEN_CHECK_OFF(ICH9PCIBUS, pPciHlpRC);
    220     GEN_CHECK_OFF(ICH9PCIBUS, aPciDev);
    221214    GEN_CHECK_SIZE(ICH9PCIGLOBALS);
    222215    GEN_CHECK_OFF(ICH9PCIGLOBALS, pDevInsR3);
     
    232225    GEN_CHECK_OFF(ICH9PCIGLOBALS, u64PciConfigMMioAddress);
    233226    GEN_CHECK_OFF(ICH9PCIGLOBALS, u64PciConfigMMioLength);
    234     GEN_CHECK_OFF(ICH9PCIGLOBALS, aPciBus);
     227    GEN_CHECK_OFF(ICH9PCIGLOBALS, PciBus);
    235228
    236229    /* EFI/DevSMC.cpp */
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