DevPCI.cpp revision 57841838548117a868e95979ddbbd205d4c9333f
/* $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"
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** @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) \
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* PIIX3 ISA Bridge state.
*/
typedef struct PIIX3State
{
/** The PCI device of the bridge. */
/** Maximum number of PCI devices.
* Defined like this to make interrupt handling simple. */
#define PCI_DEVICES_MAX 64
/** Number of uint32_t entries needed make a bitmask of the interrupts. */
/**
* PCI Globals.
*
* @remark
* These are currently put in the PCIBus structure since we've
* only got one PCI bus in the current VM configurations. This
* makes life somewhat simpler in RC.
*/
typedef struct PCIGLOBALS
{
/** Irq levels for the four PCI Irqs. */
/** The base address for PCI assigned MMIO addresses. */
/** The next I/O port address which the PCI BIOS will use. */
/** The next MMIO address which the PCI BIOS will use. */
/** I/O APIC usage flag */
bool fUseIoApic;
/** I/O APIC irq levels */
/** ACPI IRQ level */
/** ACPI PIC IRQ */
int acpi_irq;
} PCIGLOBALS;
/** Pointer to per VM data. */
typedef PCIGLOBALS *PPCIGLOBALS;
/**
* PCI Bus instance.
*/
typedef struct PCIBus
{
/** IRQ index */
/** Bus number. */
/** Start device number. */
/** Config register. */
/** Array of PCI devices. */
/** 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. */
/** ISA bridge state. */
/** The global data.
* Since we've only got one bus at present, we put it here to keep things simple. */
} PCIBUS;
/** Pointer to a PCIBUS instance. */
/** Converts a bus instance pointer to a device instance pointer. */
/** Converts a device instance pointer to a PCIGLOBALS pointer. */
/** Converts a bus instance pointer to a PCIGLOBALS pointer. */
#ifndef VBOX_DEVICE_STRUCT_TESTCASE
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
#define DEBUG_PCI
#ifdef IN_RING3
{
s->uConfigReg = val;
}
{
return s->uConfigReg;
}
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:
case 0x80:
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 0x30: case 0x31: case 0x32: case 0x33: /* rom */
case 0x3d:
can_write = 0;
break;
default:
can_write = 1;
break;
}
break;
default:
case 0x01:
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
/* status register: only clear bits by writing a '1' at the corresponding bit */
if (addr == 0x06)
{
}
else if (addr == 0x07)
{
}
else
#endif
if (can_write) {
}
addr++;
val >>= 8;
}
/* if the command register is modified, we must modify the mappings */
}
}
{
int config_addr, iBus;
return;
}
if ((s->uConfigReg & 0x3) != 0) {
return;
}
if (iBus != 0)
return;
if (!pci_dev)
return;
}
{
int config_addr, iBus;
goto fail;
if ((s->uConfigReg & 0x3) != 0)
goto fail;
if (iBus != 0)
goto fail;
if (!pci_dev) {
fail:
switch(len) {
case 1:
val = 0xff;
break;
case 2:
val = 0xffff;
break;
default:
case 4:
val = 0xffffffff;
break;
}
goto the_end;
}
return val;
}
#endif /* IN_RING3 */
/* 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. */
{
int slot_addend;
}
{
}
{
int apic_level;
return apic_level;
}
{
if (acpi_irq == -1) {
uint32_t *p;
Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d\n",
*p = (*p & ~(1 << shift));
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",
}
}
{
int pic_level;
#if (PCI_IRQ_WORDS == 2)
#else
{
int i;
pic_level = 0;
for(i = 0; i < PCI_IRQ_WORDS; i++) {
pic_level = 1;
break;
}
}
}
#endif
return pic_level;
}
/**
* Set the IRQ for a PCI device.
*
* @param pDevIns Device instance of the PCI Bus.
* @param pPciDev The PCI device structure.
* @param iIrq IRQ number to set.
* @param iLevel IRQ level.
*/
{
uint32_t *p;
/* 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
{
/* now we change the pic irq level according to the piix irq mappings */
if (pic_irq >= 16)
{
*p = (*p & ~(1 << shift));
return;
}
}
/* the pic level is the logical OR of all the PCI irqs mapped to it */
pic_level = 0;
Log3(("piix3_set_irq: %s: iLevel=%d iIrq=%d pic_irq=%d pic_level=%d\n",
/** @todo optimize pci irq flip-flop some rainy day. */
}
#ifdef IN_RING3
static void piix3_reset(PIIX3State *d)
{
pci_conf[0x82] = 0x02; /* Get rid of the Linux guest "Enabling Passive Release" PCI quirk warning. */
}
{
}
{
}
{
}
{
}
{
}
/* host irqs corresponding to PCI irqs A-D */
{
PCIIORegion *r;
if ( region_num == PCI_ROM_SLOT ) {
ofs = 0x30;
}else{
}
/* enable memory mappings */
if ( region_num == PCI_ROM_SLOT )
cmd |= 2;
else if (r->type & PCI_ADDRESS_SPACE_IO)
cmd |= 1;
else
cmd |= 2;
}
static void pci_bios_init_device(PCIDevice *d)
{
int devclass;
PCIIORegion *r;
switch(devclass)
{
case 0x0101:
if (vendor_id == 0x8086 &&
/* PIIX3 or PIIX4 IDE */
goto default_map;
} else {
/* IDE: we map it as in ISA mode */
pci_set_io_region_addr(d, 0, 0x1f0);
}
break;
case 0x0300:
if (vendor_id != 0x80ee)
goto default_map;
/* VGA: map frame buffer to default Bochs VBE address */
pci_set_io_region_addr(d, 0, 0xE0000000);
break;
case 0x0800:
/* PIC */
if (vendor_id == 0x1014) {
/* IBM */
/* MPIC & MPIC2 */
}
}
break;
case 0xff00:
if (vendor_id == 0x0106b &&
/* macio bridge */
pci_set_io_region_addr(d, 0, 0x80800000);
}
break;
default:
/* default memory mappings */
for(i = 0; i < PCI_NUM_REGIONS; i++) {
r = &d->Int.s.aIORegions[i];
if (r->size) {
if (r->type & PCI_ADDRESS_SPACE_IO)
else
pci_set_io_region_addr(d, i, *paddr);
}
}
break;
}
/* map the interrupt */
if (pin != 0) {
}
}
/* -=-=-=-=-=- 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.
*/
static DECLCALLBACK(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.
*/
static DECLCALLBACK(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.
*/
static DECLCALLBACK(int) pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
{
{
}
else
return VINF_SUCCESS;
}
/**
* 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.
*/
static DECLCALLBACK(int) pciIOPortDataRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
{
{
return VINF_SUCCESS;
}
return VERR_IOM_IOPORT_UNUSED;
}
/**
* 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 pSSMHandle The handle to save the state to.
*/
static DECLCALLBACK(int) pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle)
{
}
/**
* 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 pSSMHandle The handle to the saved state.
*/
static DECLCALLBACK(int) pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle)
{
}
/**
* Saves a state of the PCI device.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pPciDev Pointer to PCI device.
* @param pSSMHandle The handle to save the state to.
*/
{
uint32_t i;
/*
* Bus state data.
*/
/*
* Iterate all the devices.
*/
{
if (pDev)
{
int rc;
SSMR3PutU32(pSSMHandle, i);
if (RT_FAILURE(rc))
return rc;
}
}
}
/**
* Loads a saved PCI device state.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pSSMHandle The handle to the saved state.
* @param u32Version The data unit version number.
*/
static DECLCALLBACK(int) pciLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
{
uint32_t i;
int rc;
/*
* Check the version.
*/
if (u32Version > 2)
{
AssertFailed();
}
/*
* Bus state data.
*/
if (u32Version > 1)
/* separator */
if (RT_FAILURE(rc))
return rc;
/*
* 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++)
{
{
}
}
/* get the data */
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,
continue;
}
/* match the vendor id assuming that this will never be changed. */
{
LogRel(("Device in slot %#x (%s) vendor id mismatch! saved=%.4Vhxs current=%.4Vhxs\n",
}
/* commit the loaded device config. */
{
LogRel(("Device %s: Too many devices %d (max=%d)\n", pDev->name, DevTmp.Int.s.iIrq, PCI_DEVICES_MAX));
}
}
return VINF_SUCCESS;
}
/* -=-=-=-=-=- real code -=-=-=-=-=- */
/**
* Registers the device with the default 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.
*/
{
("Device %s: Too many devices %d (max=%d)\n",
Log(("PCI: Registered device %d function %d (%#x) '%s'.\n",
}
/**
* 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;
}
/*
* Find device slot.
*/
if (iDev < 0)
{
/*
* Special check for the IDE controller which is our function 1 device
* before searching.
*/
iDev = 9;
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!
*/
{
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 */
}
/*
* Register the device.
*/
return VINF_SUCCESS;
}
static DECLCALLBACK(int) pciIORegionRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
{
/*
* Validate.
*/
if ( enmType != PCI_ADDRESS_SPACE_MEM
&& enmType != PCI_ADDRESS_SPACE_IO
{
return VERR_INVALID_PARAMETER;
}
if ((unsigned)iRegion >= PCI_NUM_REGIONS)
{
return VERR_INVALID_PARAMETER;
}
/*
* Register the I/O region.
*/
return VINF_SUCCESS;
}
/**
* @copydoc PDMPCIBUSREG::pfnSetConfigCallbacksHC
*/
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.
*/
{
int rc;
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 (rc == VINF_SUCCESS)
if (rc != VINF_SUCCESS)
{
AssertMsgFailed(("Writing to PIC failed!\n"));
}
/*
* Init the devices.
*/
{
{
Log2(("PCI: Initializing device %d (%#x) '%s'\n",
}
}
return VINF_SUCCESS;
}
/**
* @copydoc FNPDMDEVRELOCATE
*/
{
}
/**
* Construct a PCI Bus device instance for a VM.
*
* @returns VBox status.
* @param pDevIns The device instance data.
* If the registration structure is needed, pDevIns->pDevReg points to it.
* @param iInstance Instance number. Use this to figure out which registers and such to use.
* The device number is also found in pDevIns->iInstance, but since it's
* likely to be freqently used PDM passes it as parameter.
* @param pCfgHandle Configuration node handle for the device. Use this to obtain the configuration
* of the device instance. It's also found in pDevIns->pCfgHandle, but like
* iInstance it's expected to be used a bit in this function.
*/
{
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->pci_mem_base = 0;
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 */
/*
* 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 (RT_FAILURE(rc))
return rc;
return VINF_SUCCESS;
}
/**
* The device registration structure.
*/
const PDMDEVREG g_DevicePCI =
{
/* u32Version */
/* szDeviceName */
"pci",
/* szGCMod */
"VBoxDDGC.gc",
/* szR0Mod */
"VBoxDDR0.r0",
/* pszDescription */
"i440FX PCI bridge and PIIX3 ISA bridge.",
/* fFlags */
PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DEVREG_FLAGS_GUEST_BITS_32 | PDM_DEVREG_FLAGS_GC | PDM_DEVREG_FLAGS_R0,
/* fClass */
/* cMaxInstances */
1,
/* cbInstance */
sizeof(PCIBUS),
/* pfnConstruct */
/* pfnDestruct */
NULL,
/* pfnRelocate */
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnQueryInterface */
NULL,
/* pfnInitComplete */
};
#endif /* IN_RING3 */
#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */