DevPCI.cpp revision 383606fb05ec93fcb06e37cc695926dd524d4b7e
/* $Id$ */
/** @file
* DevPCI - PCI BUS Device.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
* --------------------------------------------------------------------
*
* This code is based on:
*
* QEMU PCI bus manager
*
* Copyright (c) 2004 Fabrice Bellard
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_DEV_PCI
/* Hack to get PCIDEVICEINT declare at the right point - include "PCIInternal.h". */
#define PCI_INCLUDE_PRIVATE
#include "../Builtins.h"
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* PIIX3 ISA Bridge state.
*/
typedef struct PIIX3State
{
/** The PCI device of the bridge. */
/**
* PCI Bus instance.
*/
typedef struct PCIBus
{
/** Bus number. */
/** Start device number. */
/** Number of bridges attached to the bus. */
/** Array of PCI devices. */
/** Array of bridges attached to the bus. */
/** R3 pointer to the device instance. */
/** Pointer to the PCI R3 helpers. */
/** R0 pointer to the device instance. */
/** Pointer to the PCI R0 helpers. */
/** RC pointer to the device instance. */
/** Pointer to the PCI RC helpers. */
/** The PCI device for the PCI bridge. */
} PCIBUS;
/** Pointer to a PCIBUS instance. */
/** @def PCI_IRQ_PINS
* Number of pins for interrupts (PIRQ#0...PIRQ#3)
*/
#define PCI_IRQ_PINS 4
/** @def PCI_APIC_IRQ_PINS
* Number of pins for interrupts if the APIC is used.
*/
#define PCI_APIC_IRQ_PINS 8
/**
* PCI Globals - This is the host-to-pci bridge and the root bus.
*/
typedef struct PCIGLOBALS
{
/** Irq levels for the four PCI Irqs.
* These count how many devices asserted
* the IRQ line. If greater 0 an IRQ is sent to the guest.
* If it drops to 0 the IRQ is deasserted.
*/
#if 1 /* Will be moved into the BIOS soon. */
/** The next I/O port address which the PCI BIOS will use. */
/** The next MMIO address which the PCI BIOS will use. */
/** Actual bus number. */
#endif
/** I/O APIC usage flag */
bool fUseIoApic;
/** I/O APIC irq levels */
/** ACPI IRQ level */
/** ACPI PIC IRQ */
int acpi_irq;
/** Config register. */
/** R3 pointer to the device instance. */
/** R0 pointer to the device instance. */
/** RC pointer to the device instance. */
#if HC_ARCH_BITS == 64
#endif
/** ISA bridge state. */
/** PCI bus which is attached to the host-to-PCI bridge. */
} PCIGLOBALS;
/** Pointer to per VM data. */
typedef PCIGLOBALS *PPCIGLOBALS;
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** Converts a bus instance pointer to a device instance pointer. */
/** Converts a device instance pointer to a PCIGLOBALS pointer. */
/** Converts a device instance pointer to a PCIBUS pointer. */
/** Converts a pointer to a PCI bus instance to a PCIGLOBALS pointer.
* @note This works only if the bus number is 0!!!
*/
#define PCIBUS_2_PCIGLOBALS(pPciBus) ( (PPCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(PCIGLOBALS, PciBus)) )
/** @def PCI_LOCK
* Acquires the PDM lock. This is a NOP if locking is disabled. */
/** @def PCI_UNLOCK
* Releases the PDM lock. This is a NOP if locking is disabled. */
do { \
if (rc2 != VINF_SUCCESS) \
return rc2; \
} while (0)
#define PCI_UNLOCK(pDevIns) \
/** @def VBOX_PCI_SAVED_STATE_VERSION
* Saved state version of the PCI bus device.
*/
#define VBOX_PCI_SAVED_STATE_VERSION 3
#ifndef VBOX_DEVICE_STRUCT_TESTCASE
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
PDMBOTHCBDECL(int) pciIOPortAddressWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
PDMBOTHCBDECL(int) pciIOPortAddressRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
PDMBOTHCBDECL(int) pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
PDMBOTHCBDECL(int) pciIOPortDataRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
#ifdef IN_RING3
#endif
#define DEBUG_PCI
#ifdef IN_RING3
static void pci_update_mappings(PCIDevice *d)
{
PCIIORegion *r;
int cmd, i;
for(i = 0; i < PCI_NUM_REGIONS; i++) {
r = &d->Int.s.aIORegions[i];
if (i == PCI_ROM_SLOT) {
config_ofs = 0x30;
} else {
}
if (r->size != 0) {
if (r->type & PCI_ADDRESS_SPACE_IO) {
if (cmd & PCI_COMMAND_IO) {
config_ofs));
/* NOTE: we have only 64K ioports on PC */
last_addr >= 0x10000) {
new_addr = ~0U;
}
} else {
new_addr = ~0U;
}
} else {
if (cmd & PCI_COMMAND_MEMORY) {
config_ofs));
/* the ROM slot has a specific enable bit */
goto no_mem_map;
/* NOTE: we do not support wrapping */
/* XXX: as we cannot support really dynamic
mappings, we handle specific values as invalid
mappings. */
last_addr == ~0U) {
new_addr = ~0U;
}
} else {
new_addr = ~0U;
}
}
/* now do the real mapping */
if (r->addr != ~0U) {
if (r->type & PCI_ADDRESS_SPACE_IO) {
int devclass;
/* NOTE: specific hack for IDE in PC case:
only one byte must be mapped. */
} else {
}
} else {
int rc;
{
/* unmap it. */
}
else
AssertMsgRC(rc, ("rc=%Rrc d=%s i=%d GCPhysBase=%RGp size=%#x\n", rc, d->name, i, GCPhysBase, r->size));
}
}
if (r->addr != ~0U) {
}
}
}
}
}
{
switch(len) {
case 1:
break;
case 2:
break;
default:
case 4:
break;
}
return val;
}
static DECLCALLBACK(void) pci_default_write_config(PCIDevice *d, uint32_t address, uint32_t val, unsigned len)
{
int can_write;
unsigned i;
PCIIORegion *r;
int reg;
if ( address >= 0x30 ) {
reg = PCI_ROM_SLOT;
}else{
}
if (r->size == 0)
goto default_config;
/* compute the stored value */
if (reg == PCI_ROM_SLOT) {
/* keep ROM enable bit */
} else {
}
return;
}
/* not efficient, but simple */
for(i = 0; i < len; i++) {
switch(d->config[0x0e]) {
case 0x00: /* normal device */
case 0x80: /* multi-function device */
switch(addr) {
case 0x00:
case 0x01:
case 0x02:
case 0x03:
case 0x08:
case 0x09:
case 0x0a:
case 0x0b:
case 0x0e:
case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: /* base */
case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
case 0x2c: case 0x2d: /* subsystem ID */
case 0x2e: case 0x2f: /* vendor ID */
case 0x30: case 0x31: case 0x32: case 0x33: /* rom */
case 0x3d:
can_write = 0;
break;
default:
can_write = 1;
break;
}
break;
default:
case 0x01: /* bridge */
switch(addr) {
case 0x00:
case 0x01:
case 0x02:
case 0x03:
case 0x08:
case 0x09:
case 0x0a:
case 0x0b:
case 0x0e:
case 0x38: case 0x39: case 0x3a: case 0x3b: /* rom */
case 0x3d:
can_write = 0;
break;
default:
can_write = 1;
break;
}
break;
}
#ifdef VBOX
if (addr == 0x06)
{
/* don't change read-only bits => actually all lower bits are read-only */
/* status register, low part: clear bits by writing a '1' to the corresponding bit */
}
else if (addr == 0x07)
{
/* don't change read-only bits */
/* status register, high part: clear bits by writing a '1' to the corresponding bit */
}
else
#endif
if (can_write) {
}
addr++;
val >>= 8;
}
/* if the command register is modified, we must modify the mappings */
}
}
#endif /* IN_RING3 */
{
return VINF_SUCCESS;
}
return VINF_SUCCESS;
}
if (iBus != 0)
{
{
if (pBridgeDevice)
{
pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, iBus, iDevice, config_addr, val, len);
}
#else
return VINF_IOM_HC_IOPORT_WRITE;
#endif
}
}
else
{
if (pci_dev)
{
#ifdef IN_RING3
#else
return VINF_IOM_HC_IOPORT_WRITE;
#endif
}
}
return VINF_SUCCESS;
}
{
*pu32 = 0xffffffff;
return VINF_SUCCESS;
return VINF_SUCCESS;
if (iBus != 0)
{
{
if (pBridgeDevice)
{
*pu32 = pBridgeDevice->Int.s.pfnBridgeConfigRead(pBridgeDevice->pDevIns, iBus, iDevice, config_addr, len);
}
#else
return VINF_IOM_HC_IOPORT_READ;
#endif
}
}
else
{
if (pci_dev)
{
#ifdef IN_RING3
#else
return VINF_IOM_HC_IOPORT_READ;
#endif
}
}
return VINF_SUCCESS;
}
/* return the global irq number corresponding to a given device irq
pin. We could also use the bus number to have a more precise
mapping.
This is the implementation note described in the PCI spec chapter 2.2.6 */
{
int slot_addend;
}
{
}
{
}
static void apic_set_irq(PPCIBUS pBus, uint8_t uDevFn, PCIDevice *pPciDev, int irq_num1, int iLevel, int acpi_irq)
{
/* This is only allowed to be called with a pointer to the host bus. */
if (acpi_irq == -1) {
int apic_irq, apic_level;
Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d\n",
Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d (flop)\n",
}
} else {
Log3(("apic_set_irq: %s: irq_num1=%d level=%d acpi_irq=%d\n",
}
}
{
}
/**
* Set the IRQ for a PCI device on the host bus - shared by host bus and bridge.
*
* @param pDevIns Device instance of the host PCI Bus.
* @param uDevFn The device number on the host bus which will raise the IRQ
* @param pPciDev The PCI device structure which raised the interrupt.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level.
* @remark uDevFn and pPciDev->devfn are not the same if the device is behind a bridge.
* In that case uDevFn will be the slot of the bridge which is needed to calculate the
* PIRQ value.
*/
static void pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel)
{
/* If the two configuration space bytes at 0xde, 0xad are set to 0xbe, 0xef, a back door
* is opened to route PCI interrupts directly to the I/O APIC and bypass the PIC.
* See the \_SB_.PCI0._PRT method in vbox.dsl.
*/
/* Check if the state changed. */
{
/* Send interrupt to I/O APIC only. */
if (fIsApicEnabled)
{
if (fIsAcpiDevice)
/*
* ACPI needs special treatment since SCI is hardwired and
* should not be affected by PCI IRQ routing tables at the
* same time SCI IRQ is shared in PCI sense hence this
* kludge (i.e. we fetch the hardwired value from ACPIs
* PCI device configuration space).
*/
else
return;
}
if (fIsAcpiDevice)
{
/* As per above treat ACPI in a special way */
}
else
{
int irq_num;
/* now we change the pic irq level according to the piix irq mappings */
if (pic_irq >= 16)
{
{
}
return;
}
}
/* the pic level is the logical OR of all the PCI irqs mapped to it */
pic_level = 0;
Log3(("pciSetIrq: %s: iLevel=%d iIrq=%d pic_irq=%d pic_level=%d\n",
/** @todo optimize pci irq flip-flop some rainy day. */
}
}
/**
* Set the IRQ for a PCI device on the host bus.
*
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level.
*/
{
}
#ifdef IN_RING3
/**
* Finds a bridge on the bus which contains the destination bus.
*
* @return Pointer to the device instance data of the bus or
* NULL if no bridge was found.
* @param pBus Pointer to the bus to search on.
* @param iBus Destination bus number.
*/
{
/* Search for a fitting bridge. */
{
/*
* Examine secondary and subordinate bus number.
* If the target bus is in the range we pass the request on to the bridge.
*/
("Device is not a PCI bridge but on the list of PCI bridges\n"));
return pBridgeTemp;
}
/* Nothing found. */
return NULL;
}
static void piix3_reset(PIIX3State *d)
{
pci_conf[0x82] = 0x02; /* Get rid of the Linux guest "Enabling Passive Release" PCI quirk warning. */
}
static void pci_config_writel(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val)
{
}
static void pci_config_writew(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val)
{
}
static void pci_config_writeb(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val)
{
}
{
return u32Val;
}
{
return u32Val;
}
{
return u32Val;
}
/* host irqs corresponding to PCI irqs A-D */
static void pci_set_io_region_addr(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, int region_num, uint32_t addr)
{
if ( region_num == PCI_ROM_SLOT )
ofs = 0x30;
else
/* Read memory type first. */
/* Read command register. */
if ( region_num == PCI_ROM_SLOT )
cmd |= 2;
else /* The region is MMIO. */
/* Write address of the device. */
/* enable memory mappings */
}
static void pci_bios_init_device(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint8_t cBridgeDepth, uint8_t *paBridgePositions)
{
/* Check if device is present. */
if (vendor_id != 0xffff)
{
switch(devclass)
{
case 0x0101:
if ( (vendor_id == 0x8086)
{
/* PIIX3, PIIX4 or ICH6 IDE */
goto default_map;
}
else
{
/* IDE: we map it as in ISA mode */
}
break;
case 0x0300:
if (vendor_id != 0x80ee)
goto default_map;
/* VGA: map frame buffer to default Bochs VBE address */
/*
* Legacy VGA I/O ports are implicitly decoded by a VGA class device. But
* only the framebuffer (i.e., a memory region) is explicitly registered via
* pci_set_io_region_addr, so I/O decoding must be enabled manually.
*/
| 1 /* Enable I/O space access. */);
break;
case 0x0800:
/* PIC */
if (vendor_id == 0x1014)
{
/* IBM */
{
/* MPIC & MPIC2 */
}
}
break;
case 0xff00:
if ( (vendor_id == 0x0106b)
{
/* macio bridge */
}
break;
case 0x0604:
{
/* Init PCI-to-PCI bridge. */
pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_SUBORDINATE_BUS, 0xff); /* Temporary until we know how many other bridges are behind this one. */
/* Add position of this bridge into the array. */
/*
* The I/O range for the bridge must be aligned to a 4KB boundary.
* This does not change anything really as the access to the device is not going
* through the bridge but we want to be compliant to the spec.
*/
Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, pGlobals->pci_bios_io_addr));
pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_BASE, (pGlobals->pci_bios_io_addr >> 8) & 0xf0);
/* The MMIO range for the bridge must be aligned to a 1MB boundary. */
Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, pGlobals->pci_bios_mem_addr));
pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pGlobals->pci_bios_mem_addr >> 16) & UINT32_C(0xffff0));
/* Save values to compare later to. */
/* Init devices behind the bridge and possibly other bridges as well. */
/* The number of bridges behind the this one is now available. */
/*
* Set I/O limit register. If there is no device with I/O space behind the bridge
* we set a lower value than in the base register.
* The result with a real bridge is that no I/O transactions are passed to the secondary
* interface. Again this doesn't really matter here but we want to be compliant to the spec.
*/
{
/* The upper boundary must be one byte less than a 4KB boundary. */
}
pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pGlobals->pci_bios_io_addr >> 8) & 0xf0) - 1);
/* Same with the MMIO limit register but with 1MB boundary here. */
if ((u32MMIOAddressBase != pGlobals->pci_bios_mem_addr) && ((pGlobals->pci_bios_mem_addr % (1024 * 1024)) != 0))
{
/* The upper boundary must be one byte less than a 1MB boundary. */
}
pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pGlobals->pci_bios_mem_addr >> 16) & UINT32_C(0xfff0)) - 1);
/*
* Set the prefetch base and limit registers. We currently have no device with a prefetchable region
* which may be behind a bridge. Thatswhy it is unconditionally disabled here atm by writing a higher value into
* the base register than in the limit register.
*/
break;
}
default:
{
/* default memory mappings */
/*
* PCI_NUM_REGIONS is 7 because of the rom region but there are only 6 base address register defined by the PCI spec.
* Leaving only PCI_NUM_REGIONS would cause reading another and enabling a memory region which does not exist.
*/
for(i = 0; i < (PCI_NUM_REGIONS-1); i++)
{
/* Calculate size. */
/* Clear ressource information depending on ressource type. */
u32Size &= ~(0x01);
else /* MMIO */
u32Size &= ~(0x0f);
/*
* Invert all bits and add 1 to get size of the region.
* (From PCI implementation note)
*/
else
Log(("%s: Size of region %u for device %d on bus %d is %u\n", __FUNCTION__, i, uDevFn, uBus, u32Size));
if (u32Size)
{
else
Log(("%s: Start address of %s region %u is %#x\n", __FUNCTION__, ((u8RessourceType & 0x01) == 1 ? "I/O" : "MMIO"), i, *paddr));
}
}
break;
}
}
/* map the interrupt */
if (pin != 0)
{
pin--;
/* We need to go up to the host bus to see which irq this device will assert there. */
while (cBridgeDepth != 0)
{
/* Get the pin the device would assert on the bridge. */
cBridgeDepth--;
}
}
}
}
#endif /* IN_RING3 */
/* -=-=-=-=-=- wrappers -=-=-=-=-=- */
/**
* Port I/O Handler for PCI address OUT operations.
*
* @returns VBox status code.
*
* @param pDevIns The device instance.
* @param pvUser User argument - ignored.
* @param uPort Port number used for the IN operation.
* @param u32 The value to output.
* @param cb The value size in bytes.
*/
PDMBOTHCBDECL(int) pciIOPortAddressWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
{
if (cb == 4)
{
}
/* else: 440FX does "pass through to the bus" for other writes, what ever that means.
return VINF_SUCCESS;
}
/**
* Port I/O Handler for PCI address IN operations.
*
* @returns VBox status code.
*
* @param pDevIns The device instance.
* @param pvUser User argument - ignored.
* @param uPort Port number used for the IN operation.
* @param pu32 Where to store the result.
* @param cb Number of bytes read.
*/
PDMBOTHCBDECL(int) pciIOPortAddressRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
{
if (cb == 4)
{
return VINF_SUCCESS;
}
/* else: 440FX does "pass through to the bus" for other writes, what ever that means.
return VERR_IOM_IOPORT_UNUSED;
}
/**
* Port I/O Handler for PCI data OUT operations.
*
* @returns VBox status code.
*
* @param pDevIns The device instance.
* @param pvUser User argument - ignored.
* @param uPort Port number used for the IN operation.
* @param u32 The value to output.
* @param cb The value size in bytes.
*/
PDMBOTHCBDECL(int) pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
{
int rc = VINF_SUCCESS;
{
}
else
return rc;
}
/**
* Port I/O Handler for PCI data IN operations.
*
* @returns VBox status code.
*
* @param pDevIns The device instance.
* @param pvUser User argument - ignored.
* @param uPort Port number used for the IN operation.
* @param pu32 Where to store the result.
* @param cb Number of bytes read.
*/
PDMBOTHCBDECL(int) pciIOPortDataRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
{
{
return rc;
}
return VERR_IOM_IOPORT_UNUSED;
}
#ifdef IN_RING3
/**
* Saves a state of the PCI device.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev Pointer to PCI device.
* @param pSSM The handle to save the state to.
*/
static DECLCALLBACK(int) pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
{
}
/**
* Loads a saved PCI device state.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev Pointer to PCI device.
* @param pSSM The handle to the saved state.
*/
static DECLCALLBACK(int) pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
{
}
/**
* Common worker for pciR3SaveExec and pcibridgeR3SaveExec.
*
* @returns VBox status code.
* @param pBus The bus to save.
* @param pSSM The saved state handle.
*/
{
/*
* Iterate thru all the devices.
*/
{
if (pDev)
{
SSMR3PutU32(pSSM, i);
if (RT_FAILURE(rc))
return rc;
}
}
}
/**
* Saves a state of the PCI device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pPciDev Pointer to PCI device.
* @param pSSM The handle to save the state to.
*/
{
uint32_t i;
/*
* Bus state data.
*/
/*
* Save IRQ states.
*/
for (i = 0; i < PCI_IRQ_PINS; i++)
for (i = 0; i < PCI_APIC_IRQ_PINS; i++)
/*
* Join paths with pcibridgeR3SaveExec.
*/
}
/**
* Common routine for restoring the config registers of a PCI device.
*
* @param pDev The PCI device.
* @param pbSrcConfig The configuration register values to be loaded.
* @param fIsBridge Whether this is a bridge device or not.
*/
{
/*
* This table defines the fields for normal devices and bridge devices, and
* the order in which they need to be restored.
*/
static const struct PciField
{
const char *pszName;
} s_aFields[] =
{
/* off,cb,fW,fB, pszName */
{ 0x00, 2, 0, 3, "VENDOR_ID" },
{ 0x02, 2, 0, 3, "DEVICE_ID" },
{ 0x06, 2, 1, 3, "STATUS" },
{ 0x08, 1, 0, 3, "REVISION_ID" },
{ 0x09, 1, 0, 3, "CLASS_PROG" },
{ 0x0a, 1, 0, 3, "CLASS_SUB" },
{ 0x0b, 1, 0, 3, "CLASS_BASE" },
{ 0x0c, 1, 0, 3, "CACHE_LINE_SIZE" }, // fWritable = ??
{ 0x0d, 1, 0, 3, "LATENCY_TIMER" }, // fWritable = ??
{ 0x0e, 1, 0, 3, "HEADER_TYPE" }, // fWritable = ??
{ 0x0f, 1, 0, 3, "BIST" }, // fWritable = ??
{ 0x10, 4, 1, 3, "BASE_ADDRESS_0" },
{ 0x14, 4, 1, 3, "BASE_ADDRESS_1" },
{ 0x18, 4, 1, 1, "BASE_ADDRESS_2" },
{ 0x18, 1, 1, 2, "PRIMARY_BUS" }, // fWritable = ??
{ 0x19, 1, 1, 2, "SECONDARY_BUS" }, // fWritable = ??
{ 0x1a, 1, 1, 2, "SUBORDINATE_BUS" }, // fWritable = ??
{ 0x1b, 1, 1, 2, "SEC_LATENCY_TIMER" }, // fWritable = ??
{ 0x1c, 4, 1, 1, "BASE_ADDRESS_3" },
{ 0x1c, 1, 1, 2, "IO_BASE" }, // fWritable = ??
{ 0x1d, 1, 1, 2, "IO_LIMIT" }, // fWritable = ??
{ 0x1e, 2, 1, 2, "SEC_STATUS" }, // fWritable = ??
{ 0x20, 4, 1, 1, "BASE_ADDRESS_4" },
{ 0x20, 2, 1, 2, "MEMORY_BASE" }, // fWritable = ??
{ 0x22, 2, 1, 2, "MEMORY_LIMIT" }, // fWritable = ??
{ 0x24, 4, 1, 1, "BASE_ADDRESS_4" },
{ 0x24, 2, 1, 2, "PREF_MEMORY_BASE" }, // fWritable = ??
{ 0x26, 2, 1, 2, "PREF_MEMORY_LIMIT" }, // fWritable = ??
{ 0x28, 4, 1, 1, "CARDBUS_CIS" }, // fWritable = ??
{ 0x28, 4, 1, 2, "PREF_BASE_UPPER32" }, // fWritable = ??
{ 0x2c, 2, 0, 1, "SUBSYSTEM_VENDOR_ID" },// fWritable = !?
{ 0x2c, 4, 1, 2, "PREF_LIMIT_UPPER32" },// fWritable = ??
{ 0x2e, 2, 0, 1, "SUBSYSTEM_ID" }, // fWritable = !?
{ 0x30, 4, 1, 1, "ROM_ADDRESS" }, // fWritable = ?!
{ 0x30, 2, 1, 2, "IO_BASE_UPPER16" }, // fWritable = ?!
{ 0x32, 2, 1, 2, "IO_LIMIT_UPPER16" }, // fWritable = ?!
{ 0x34, 4, 0, 3, "CAPABILITY_LIST" }, // fWritable = !? cb=!?
{ 0x38, 4, 1, 1, "???" }, // ???
{ 0x38, 4, 1, 2, "ROM_ADDRESS_BR" }, // fWritable = !? cb=!? fBridge=!?
{ 0x3c, 1, 1, 3, "INTERRUPT_LINE" }, // fBridge=??
{ 0x3d, 1, 0, 3, "INTERRUPT_PIN" }, // fBridge=??
{ 0x3e, 1, 0, 1, "MIN_GNT" }, // fWritable = !?
{ 0x3e, 1, 1, 2, "BRIDGE_CONTROL" }, // fWritable = !? cb=!?
{ 0x3f, 1, 1, 3, "MAX_LAT" }, // fWritable = !? fBridge=!?
/* The COMMAND register must come last as it requires the *ADDRESS*
registers to be restored before we pretent to change it from 0 to
whatever value the guest assigned it. */
{ 0x04, 2, 1, 3, "COMMAND" },
};
#ifdef RT_STRICT
/* Check that we've got full register coverage. */
{
while (cb-- > 0)
{
off++;
}
}
{
}
#endif
/*
* Loop thru the fields covering the 64 bytes of standard registers.
*/
{
switch (cb)
{
case 1:
break;
case 2:
break;
case 4:
break;
default:
AssertFailed();
continue;
}
|| off == VBOX_PCI_COMMAND)
{
{
LogRel(("PCI: %8s/%u: %2u-bit field %s: %x -> %x - !READ ONLY!\n",
else
LogRel(("PCI: %8s/%u: %2u-bit field %s: %x -> %x\n",
}
if (off == VBOX_PCI_COMMAND)
}
}
/*
* The device dependent registers.
*
* We will not use ConfigWrite here as we have no clue about the size
* of the registers, so the device is responsible for correctly
* restoring functionality governed by these registers.
*/
{
LogRel(("PCI: %8s/%u: register %02x: %02x -> %02x\n",
pDev->name, pDev->pDevIns->iInstance, off, pbDstConfig[off], pbSrcConfig[off])); /** @todo make this Log() later. */
}
}
/**
* Common worker for pciR3LoadExec and pcibridgeR3LoadExec.
*
* @returns VBox status code.
* @param pBus The bus which data is being loaded.
* @param pSSM The saved state handle.
* @param uVersion The data version.
* @param uPass The pass.
*/
static DECLCALLBACK(int) pciR3CommonLoadExec(PPCIBUS pBus, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
{
uint32_t i;
int rc;
/*
* Iterate thru all the devices and write 0 to the COMMAND register so
* that all the memory is unmapped before we start restoring the saved
* mapping locations.
*
* The register value is restored afterwards so we can do proper
* LogRels in pciR3CommonRestoreConfig.
*/
{
if (pDev)
{
}
}
/*
* Iterate all the devices.
*/
for (i = 0;; i++)
{
/* index / terminator */
if (RT_FAILURE(rc))
return rc;
break;
|| u32 < i)
{
return rc;
}
/* skip forward to the device checking that no new devices are present. */
for (; i < u32; i++)
{
{
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("New device in slot %#x, %s (vendor=%#06x device=%#06x)"),
i, pBus->devices[i]->name, PCIDevGetVendorId(pBus->devices[i]), PCIDevGetDeviceId(pBus->devices[i]));
}
}
/* get the data */
DevTmp.Int.s.uIrqPinState = ~0; /* Invalid value in case we have an older saved state to force a state change in pciSetIrq. */
if (uVersion < 3)
{
/* Irq value not needed anymore. */
if (RT_FAILURE(rc))
return rc;
}
else
{
if (RT_FAILURE(rc))
return rc;
}
/* check that it's still around. */
if (!pDev)
{
LogRel(("Device in slot %#x has been removed! vendor=%#06x device=%#06x\n", i,
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x has been removed! vendor=%#06x device=%#06x"),
continue;
}
/* match the vendor id assuming that this will never be changed. */
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x (%s) vendor id mismatch! saved=%.4Rhxs current=%.4Rhxs"),
/* commit the loaded device config. */
}
return VINF_SUCCESS;
}
/**
* Loads a saved PCI device state.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pSSM The handle to the saved state.
* @param uVersion The data unit version number.
* @param uPass The data pass.
*/
static DECLCALLBACK(int) pciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
{
int rc;
/*
* Check the version.
*/
/*
* Bus state data.
*/
if (uVersion > 1)
/* Load IRQ states. */
if (uVersion > 2)
{
for (uint8_t i = 0; i < PCI_IRQ_PINS; i++)
for (uint8_t i = 0; i < PCI_APIC_IRQ_PINS; i++)
}
/* separator */
if (RT_FAILURE(rc))
return rc;
/*
* The devices.
*/
}
/* -=-=-=-=-=- real code -=-=-=-=-=- */
/**
* Registers the device with the specified PCI bus.
*
* @returns VBox status code.
* @param pBus The bus to register with.
* @param iDev The PCI device ordinal.
* @param pPciDev The PCI device structure.
* @param pszName Pointer to device name (permanent, readonly). For debugging, not unique.
*/
{
/*
* Find device slot.
*/
if (iDev < 0)
{
/*
* Special check for the IDE controller which is our function 1 device
* before searching.
*/
iDev = 9;
#ifdef VBOX_WITH_LPC
/* LPC bus expected to be there by some guests, better make an additional argument to PDM
device helpers, but requires significant rewrite */
iDev = 0xf8;
#endif
else
{
break;
{
AssertMsgFailed(("Couldn't find free spot!\n"));
return VERR_PDM_TOO_PCI_MANY_DEVICES;
}
}
}
else
{
/*
* An explicit request.
*
* If the slot is occupied we'll have to relocate the device
* currently occupying it first. This can only be done if the
* existing device wasn't explicitly assigned. Also we limit
* ourselves to function 0 devices.
*
* If you start setting devices + function in the
* config, do it for all pci devices!
*/
//AssertReleaseMsg(iDev > 8 || pBus->iBus != 0, ("iDev=%d pszName=%s\n", iDev, pszName));
{
int iDevRel;
{
AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n",
return VERR_INTERNAL_ERROR;
}
/* Find free slot for the device(s) we're moving and move them. */
{
{
int i = 0;
for (i = 0; i < 8; i++)
{
continue;
Log(("PCI: relocating '%s' from slot %#x to %#x\n", pBus->devices[iDev + i]->name, iDev + i, iDevRel + i));
}
}
}
{
AssertMsgFailed(("Couldn't find free spot!\n"));
return VERR_PDM_TOO_PCI_MANY_DEVICES;
}
} /* if conflict */
}
{
AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->devices), ("Number of bridges exceeds the number of possible devices on the bus\n"));
}
Log(("PCI: Registered device %d function %d (%#x) '%s'.\n",
return VINF_SUCCESS;
}
/**
* Registers the device with the default PCI bus.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* Any PCI enabled device must keep this in it's instance data!
* Fill in the PCI data config before registration, please.
* @param pszName Pointer to device name (permanent, readonly). For debugging, not unique.
* @param iDev The PCI device number. Use a negative value for auto assigning one.
*/
static DECLCALLBACK(int) pciRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev)
{
/*
* Check input.
*/
if ( !pszName
|| !pPciDev
{
return VERR_INVALID_PARAMETER;
}
/*
* Register the device.
*/
}
static DECLCALLBACK(int) pciIORegionRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
{
/*
* Validate.
*/
|| enmType == PCI_ADDRESS_SPACE_IO
("Invalid enmType=%#x? Or was this a bitmask after all...\n", enmType),
AssertMsgReturn( iLastSet != 0
/*
* Register the I/O region.
*/
/* Set type in the config space. */
return VINF_SUCCESS;
}
/**
* @copydoc PDMPCIBUSREG::pfnSetConfigCallbacksR3
*/
static DECLCALLBACK(void) pciSetConfigCallbacks(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
{
if (ppfnReadOld)
if (ppfnWriteOld)
}
/**
* Called to perform the job of the bios.
*
* @returns VBox status.
* @param pDevIns Device instance of the first bus.
*/
{
unsigned i;
/*
* Set the start addresses.
*/
/*
* Activate IRQ mappings.
*/
for (i = 0; i < 4; i++)
{
/* Set to trigger level. */
/* Activate irq remapping in PIIX3. */
}
/* Tell to the PIC. */
if (rcStrict == VINF_SUCCESS)
if (rcStrict != VINF_SUCCESS)
{
}
/*
* Init the devices.
*/
for (i = 0; i < 256; i++)
{
Log2(("PCI: Initializing device %d (%#x)\n",
i, 0x80000000 | (i << 8)));
}
return VINF_SUCCESS;
}
/**
* @copydoc FNPDMDEVRELOCATE
*/
{
/* Relocate RC pointers for the attached pci devices. */
{
}
}
/**
* @interface_method_impl{PDMDEVREG,pfnConstruct}
*/
{
int rc;
/*
* Validate and read configuration.
*/
/* query whether we got an IOAPIC */
bool fUseIoApic;
if (RT_FAILURE(rc))
N_("Configuration error: Failed to query boolean value \"IOAPIC\""));
/* check if RC code is enabled. */
bool fGCEnabled;
if (RT_FAILURE(rc))
N_("Configuration error: Failed to query boolean value \"GCEnabled\""));
/* check if R0 code is enabled. */
bool fR0Enabled;
if (RT_FAILURE(rc))
N_("Configuration error: Failed to query boolean value \"R0Enabled\""));
Log(("PCI: fUseIoApic=%RTbool fGCEnabled=%RTbool fR0Enabled=%RTbool\n", fUseIoApic, fGCEnabled, fR0Enabled));
/*
* Init data and register the PCI bus.
*/
pGlobals->PciBus.papBridgesR3 = (PPCIDEVICE *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPCIDEVICE) * RT_ELEMENTS(pGlobals->PciBus.devices));
if (RT_FAILURE(rc))
N_("Failed to register ourselves as a PCI Bus"));
N_("PCI helper version mismatch; got %#x expected %#x"),
/*
* Fill in PCI configs and add them to the bus.
*/
/* i440FX */
/* PIIX3 */
PCIDevSetDeviceId( &pGlobals->PIIX3State.dev, 0x7000); /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
/*
* Register I/O ports and save state.
*/
rc = PDMDevHlpIOPortRegister(pDevIns, 0x0cf8, 1, NULL, pciIOPortAddressWrite, pciIOPortAddressRead, NULL, NULL, "i440FX (PCI)");
if (RT_FAILURE(rc))
return rc;
rc = PDMDevHlpIOPortRegister(pDevIns, 0x0cfc, 4, NULL, pciIOPortDataWrite, pciIOPortDataRead, NULL, NULL, "i440FX (PCI)");
if (RT_FAILURE(rc))
return rc;
if (fGCEnabled)
{
rc = PDMDevHlpIOPortRegisterRC(pDevIns, 0x0cf8, 1, NIL_RTGCPTR, "pciIOPortAddressWrite", "pciIOPortAddressRead", NULL, NULL, "i440FX (PCI)");
if (RT_FAILURE(rc))
return rc;
rc = PDMDevHlpIOPortRegisterRC(pDevIns, 0x0cfc, 4, NIL_RTGCPTR, "pciIOPortDataWrite", "pciIOPortDataRead", NULL, NULL, "i440FX (PCI)");
if (RT_FAILURE(rc))
return rc;
}
if (fR0Enabled)
{
rc = PDMDevHlpIOPortRegisterR0(pDevIns, 0x0cf8, 1, NIL_RTR0PTR, "pciIOPortAddressWrite", "pciIOPortAddressRead", NULL, NULL, "i440FX (PCI)");
if (RT_FAILURE(rc))
return rc;
rc = PDMDevHlpIOPortRegisterR0(pDevIns, 0x0cfc, 4, NIL_RTR0PTR, "pciIOPortDataWrite", "pciIOPortDataRead", NULL, NULL, "i440FX (PCI)");
if (RT_FAILURE(rc))
return rc;
}
if (RT_FAILURE(rc))
return rc;
return VINF_SUCCESS;
}
/**
* The device registration structure.
*/
const PDMDEVREG g_DevicePCI =
{
/* u32Version */
/* szName */
"pci",
/* szRCMod */
"VBoxDDGC.gc",
/* szR0Mod */
"VBoxDDR0.r0",
/* pszDescription */
"i440FX PCI bridge and PIIX3 ISA bridge.",
/* fFlags */
/* fClass */
/* cMaxInstances */
1,
/* cbInstance */
sizeof(PCIGLOBALS),
/* pfnConstruct */
/* pfnDestruct */
NULL,
/* pfnRelocate */
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnQueryInterface */
NULL,
/* pfnInitComplete */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
};
#endif /* IN_RING3 */
/**
* Set the IRQ for a PCI device on a secondary bus.
*
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level.
*/
{
/*
* The PCI-to-PCI bridge specification defines how the interrupt pins
* are routed from the secondary to the primary bus (see chapter 9).
* iIrq gives the interrupt pin the pci device asserted.
* We change iIrq here according to the spec and call the SetIrq function
* of our parent passing the device which asserted the interrupt instead of the device of the bridge.
*/
int iIrqPinBridge = iIrq;
uint8_t uDevFnBridge = 0;
/* Walk the chain until we reach the host bus. */
do
{
/* Get the parent. */
}
#ifdef IN_RING3
static void pcibridgeConfigWrite(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, uint32_t u32Value, unsigned cb)
{
LogFlowFunc((": pDevIns=%p iBus=%d iDevice=%d u32Address=%u u32Value=%u cb=%d\n", pDevIns, iBus, iDevice, u32Address, u32Value, cb));
/* If the current bus is not the target bus search for the bus which contains the device. */
{
if (pBridgeDevice)
{
pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, iBus, iDevice, u32Address, u32Value, cb);
}
}
else
{
/* This is the target bus, pass the write to the device. */
if (pPciDev)
{
Log(("%s: %s: addr=%02x val=%08x len=%d\n", __FUNCTION__, pPciDev->name, u32Address, u32Value, cb));
}
}
}
static uint32_t pcibridgeConfigRead(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, unsigned cb)
{
LogFlowFunc((": pDevIns=%p iBus=%d iDevice=%d u32Address=%u cb=%d\n", pDevIns, iBus, iDevice, u32Address, cb));
/* If the current bus is not the target bus search for the bus which contains the device. */
{
if (pBridgeDevice)
{
u32Value = pBridgeDevice->Int.s.pfnBridgeConfigRead(pBridgeDevice->pDevIns, iBus, iDevice, u32Address, cb);
}
}
else
{
/* This is the target bus, pass the read to the device. */
if (pPciDev)
{
Log(("%s: %s: u32Address=%02x u32Value=%08x cb=%d\n", __FUNCTION__, pPciDev->name, u32Address, u32Value, cb));
}
}
return u32Value;
}
/**
* @copydoc FNSSMDEVSAVEEXEC
*/
{
}
/**
* @copydoc FNSSMDEVLOADEXEC
*/
static DECLCALLBACK(int) pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
{
}
/**
* Registers the device with the default PCI bus.
*
* @returns VBox status code.
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* Any PCI enabled device must keep this in it's instance data!
* Fill in the PCI data config before registration, please.
* @param pszName Pointer to device name (permanent, readonly). For debugging, not unique.
* @param iDev The PCI device number. Use a negative value for auto assigning one.
*/
static DECLCALLBACK(int) pcibridgeRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev)
{
/*
* Check input.
*/
if ( !pszName
|| !pPciDev
{
return VERR_INVALID_PARAMETER;
}
/*
* Register the device.
*/
}
/**
* @copydoc FNPDMDEVRESET
*/
{
/* Reset config space to default values. */
}
/**
* @copydoc FNPDMDEVRELOCATE
*/
{
/* Relocate RC pointers for the attached pci devices. */
{
}
}
/**
* @interface_method_impl{PDMDEVREG,pfnConstruct}
*/
{
int rc;
/*
* Validate and read configuration.
*/
/* check if RC code is enabled. */
bool fGCEnabled;
if (RT_FAILURE(rc))
N_("Configuration error: Failed to query boolean value \"GCEnabled\""));
/* check if R0 code is enabled. */
bool fR0Enabled;
if (RT_FAILURE(rc))
N_("Configuration error: Failed to query boolean value \"R0Enabled\""));
/*
* Init data and register the PCI bus.
*/
pBus->papBridgesR3 = (PPCIDEVICE *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPCIDEVICE) * RT_ELEMENTS(pBus->devices));
if (RT_FAILURE(rc))
N_("Failed to register ourselves as a PCI Bus"));
N_("PCI helper version mismatch; got %#x expected %#x"),
/*
* Fill in PCI configs and add them to the bus.
*/
PCIDevSetHeaderType(&pBus->PciDev, 0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */
/*
* This device does not generate interrupts. Interrupt delivery from
* devices attached to the bus is unaffected.
*/
/*
* Register this PCI bridge. The called function will take care on which bus we will get registered.
*/
if (RT_FAILURE(rc))
return rc;
pBus->iDevSearch = 0;
/*
* The iBus property doesn't really represent the bus number
* because the guest and the BIOS can choose different bus numbers
* for them.
* The bus number is mainly for the setIrq function to indicate
* when the host bus is reached which will have iBus = 0.
* Thathswhy the + 1.
*/
/*
* Register SSM handlers. We use the same saved state version as for the host bridge
* to make changes easier.
*/
if (RT_FAILURE(rc))
return rc;
return VINF_SUCCESS;
}
/**
* The device registration structure
* for the PCI-to-PCI bridge.
*/
const PDMDEVREG g_DevicePCIBridge =
{
/* u32Version */
/* szName */
"pcibridge",
/* szRCMod */
"VBoxDDGC.gc",
/* szR0Mod */
"VBoxDDR0.r0",
/* pszDescription */
"82801 Mobile PCI to PCI bridge",
/* fFlags */
/* fClass */
/* cMaxInstances */
~0,
/* cbInstance */
sizeof(PCIBUS),
/* pfnConstruct */
/* pfnDestruct */
NULL,
/* pfnRelocate */
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnQueryInterface */
NULL,
/* pfnInitComplete */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
};
#endif /* IN_RING3 */
#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */