DrvAcpiCpu.cpp revision ad77e3ec3cde24263bc7537575f5cae442bee3b1
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/* $Id$ */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/** @file
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * DrvAcpiCpu - ACPI CPU dummy driver for hotplugging.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * available from http://www.virtualbox.org. This file is free software;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * additional information or have any questions.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync */
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync/*******************************************************************************
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync* Header Files *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync*******************************************************************************/
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync#define LOG_GROUP LOG_GROUP_DRV_ACPI
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync#include <VBox/pdmdrv.h>
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync#include <VBox/log.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/assert.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/string.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include "Builtins.h"
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/**
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Queries an interface to the driver.
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @returns Pointer to interface.
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync * @returns NULL if the interface was not supported by the driver.
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync * @param pInterface Pointer to this interface structure.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @param enmInterface The requested interface identification.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @thread Any thread.
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncstatic DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsync{
8e034cd2a6b0c86697554278e970163287003bb9vboxsync PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsync switch (enmInterface)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync {
089c21a647af46044cad04a78cfdcfae814d2105vboxsync case PDMINTERFACE_BASE:
089c21a647af46044cad04a78cfdcfae814d2105vboxsync return &pDrvIns->IBase;
089c21a647af46044cad04a78cfdcfae814d2105vboxsync default:
089c21a647af46044cad04a78cfdcfae814d2105vboxsync return NULL;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync }
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync}
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsync/**
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Destruct a driver instance.
4b37aac42309dbacba7ff11f16ed8d72a06b71e4vboxsync *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Most VM resources are freed by the VM. This callback is provided so that any non-VM
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * resources can be freed correctly.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync *
089c21a647af46044cad04a78cfdcfae814d2105vboxsync * @param pDrvIns The driver instance data.
8e034cd2a6b0c86697554278e970163287003bb9vboxsync */
8e034cd2a6b0c86697554278e970163287003bb9vboxsyncstatic DECLCALLBACK(void) drvACPICpuDestruct(PPDMDRVINS pDrvIns)
8e034cd2a6b0c86697554278e970163287003bb9vboxsync{
8e034cd2a6b0c86697554278e970163287003bb9vboxsync LogFlow(("drvACPICpuDestruct\n"));
8e034cd2a6b0c86697554278e970163287003bb9vboxsync}
8e034cd2a6b0c86697554278e970163287003bb9vboxsync
8e034cd2a6b0c86697554278e970163287003bb9vboxsync/**
8e034cd2a6b0c86697554278e970163287003bb9vboxsync * Construct an ACPI CPU driver instance.
8e034cd2a6b0c86697554278e970163287003bb9vboxsync *
8e034cd2a6b0c86697554278e970163287003bb9vboxsync * @copydoc FNPDMDRVCONSTRUCT
8e034cd2a6b0c86697554278e970163287003bb9vboxsync */
8e034cd2a6b0c86697554278e970163287003bb9vboxsyncstatic DECLCALLBACK(int) drvACPICpuConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
8e034cd2a6b0c86697554278e970163287003bb9vboxsync{
8e034cd2a6b0c86697554278e970163287003bb9vboxsync /*
2c203bb219df5391ed7f3888c85e12a4e47817davboxsync * Init the static parts.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync /* IBase */
pDrvIns->IBase.pfnQueryInterface = drvACPICpuQueryInterface;
/*
* Validate the config.
*/
if (!CFGMR3AreValuesValid(pCfgHandle, "\0"))
return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
/*
* Check that no-one is attached to us.
*/
AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
("Configuration error: Not possible to attach anything to this driver!\n"),
VERR_PDM_DRVINS_NO_ATTACH);
return VINF_SUCCESS;
}
/**
* ACPI CPU driver registration record.
*/
const PDMDRVREG g_DrvAcpiCpu =
{
/* u32Version */
PDM_DRVREG_VERSION,
/* szDriverName */
"ACPICpu",
/* szRCMod */
"",
/* szR0Mod */
"",
/* pszDescription */
"ACPI CPU Driver",
/* fFlags */
PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
/* fClass. */
PDM_DRVREG_CLASS_ACPI,
/* cMaxInstances */
~0,
/* cbInstance */
sizeof(PDMDRVINS),
/* pfnConstruct */
drvACPICpuConstruct,
/* pfnDestruct */
drvACPICpuDestruct,
/* pfnRelocate */
NULL,
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32EndVersion */
PDM_DRVREG_VERSION
};