VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/DrvAcpiCpu.cpp@ 25893

Last change on this file since 25893 was 25893, checked in by vboxsync, 15 years ago

PDMDrv,*: multi context drivers, part 2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: DrvAcpiCpu.cpp 25893 2010-01-18 14:08:39Z vboxsync $ */
2/** @file
3 * DrvAcpiCpu - ACPI CPU dummy driver for hotplugging.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22/*******************************************************************************
23* Header Files *
24*******************************************************************************/
25#define LOG_GROUP LOG_GROUP_DRV_ACPI
26
27#include <VBox/pdmdrv.h>
28#include <VBox/log.h>
29#include <iprt/assert.h>
30#include <iprt/string.h>
31
32#include "Builtins.h"
33
34/**
35 * Queries an interface to the driver.
36 *
37 * @returns Pointer to interface.
38 * @returns NULL if the interface was not supported by the driver.
39 * @param pInterface Pointer to this interface structure.
40 * @param enmInterface The requested interface identification.
41 * @thread Any thread.
42 */
43static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
44{
45 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
46
47 switch (enmInterface)
48 {
49 case PDMINTERFACE_BASE:
50 return &pDrvIns->IBase;
51 default:
52 return NULL;
53 }
54}
55
56/**
57 * Destruct a driver instance.
58 *
59 * Most VM resources are freed by the VM. This callback is provided so that any non-VM
60 * resources can be freed correctly.
61 *
62 * @param pDrvIns The driver instance data.
63 */
64static DECLCALLBACK(void) drvACPICpuDestruct(PPDMDRVINS pDrvIns)
65{
66 LogFlow(("drvACPICpuDestruct\n"));
67}
68
69/**
70 * Construct an ACPI CPU driver instance.
71 *
72 * @copydoc FNPDMDRVCONSTRUCT
73 */
74static DECLCALLBACK(int) drvACPICpuConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
75{
76 /*
77 * Init the static parts.
78 */
79 /* IBase */
80 pDrvIns->IBase.pfnQueryInterface = drvACPICpuQueryInterface;
81
82 /*
83 * Validate the config.
84 */
85 if (!CFGMR3AreValuesValid(pCfgHandle, "\0"))
86 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
87
88 /*
89 * Check that no-one is attached to us.
90 */
91 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
92 ("Configuration error: Not possible to attach anything to this driver!\n"),
93 VERR_PDM_DRVINS_NO_ATTACH);
94
95 return VINF_SUCCESS;
96}
97
98/**
99 * ACPI CPU driver registration record.
100 */
101const PDMDRVREG g_DrvAcpiCpu =
102{
103 /* u32Version */
104 PDM_DRVREG_VERSION,
105 /* szDriverName */
106 "ACPICpu",
107 /* szRCMod */
108 "",
109 /* szR0Mod */
110 "",
111 /* pszDescription */
112 "ACPI CPU Driver",
113 /* fFlags */
114 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
115 /* fClass. */
116 PDM_DRVREG_CLASS_ACPI,
117 /* cMaxInstances */
118 ~0,
119 /* cbInstance */
120 sizeof(PDMDRVINS),
121 /* pfnConstruct */
122 drvACPICpuConstruct,
123 /* pfnDestruct */
124 drvACPICpuDestruct,
125 /* pfnRelocate */
126 NULL,
127 /* pfnIOCtl */
128 NULL,
129 /* pfnPowerOn */
130 NULL,
131 /* pfnReset */
132 NULL,
133 /* pfnSuspend */
134 NULL,
135 /* pfnResume */
136 NULL,
137 /* pfnAttach */
138 NULL,
139 /* pfnDetach */
140 NULL,
141 /* pfnPowerOff */
142 NULL,
143 /* pfnSoftReset */
144 NULL,
145 /* u32EndVersion */
146 PDM_DRVREG_VERSION
147};
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette