DevPCI-new.cpp revision 728e645c59f8e1a91e241a104872626109a5a231
/* $Id$ */
/** @file
* DevPCI - PCI BUS Device.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* 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.
*/
/*******************************************************************************
* 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"
/**
* PCI Bus instance.
*/
typedef struct
{
/** Bus 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. */
/**
* PIIX3 ISA Bridge state.
*/
typedef struct
{
/** The PCI device of the bridge. */
/** @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
{
/** I/O APIC usage flag */
bool fUseIoApic;
/** 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. */
#ifndef VBOX_DEVICE_STRUCT_TESTCASE
#ifdef IN_RING3
int iInstance,
{
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.
*/
return VINF_SUCCESS;
}
/**
* @copydoc FNPDMDEVRELOCATE
*/
{
}
/**
* @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\""));
return VINF_SUCCESS;
}
/**
* @copydoc FNPDMDEVRESET
*/
{
}
/**
* @copydoc FNPDMDEVRELOCATE
*/
{
}
/**
* The PCI bus 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 */
};
/**
* 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 */