VirtualBox

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

Last change on this file since 46355 was 45061, checked in by vboxsync, 12 years ago

Review of PDM driver destructors making sure that variables they use are correctly initialized in the constructor. Found several RTFileClose(0) cases.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: DrvAcpiCpu.cpp 45061 2013-03-18 14:09:03Z vboxsync $ */
2/** @file
3 * DrvAcpiCpu - ACPI CPU dummy driver for hotplugging.
4 */
5
6/*
7 * Copyright (C) 2006-2012 Oracle Corporation
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
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#define LOG_GROUP LOG_GROUP_DRV_ACPI
22
23#include <VBox/vmm/pdmdrv.h>
24#include <VBox/log.h>
25#include <iprt/assert.h>
26#include <iprt/string.h>
27#include <iprt/uuid.h>
28
29#include "VBoxDD.h"
30
31
32/**
33 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
34 */
35static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, const char *pszIID)
36{
37 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
38 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
39 return NULL;
40}
41
42/**
43 * Construct an ACPI CPU driver instance.
44 *
45 * @copydoc FNPDMDRVCONSTRUCT
46 */
47static DECLCALLBACK(int) drvACPICpuConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
48{
49 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
50
51 /*
52 * Init the static parts.
53 */
54 /* IBase */
55 pDrvIns->IBase.pfnQueryInterface = drvACPICpuQueryInterface;
56
57 /*
58 * Validate the config.
59 */
60 if (!CFGMR3AreValuesValid(pCfg, "\0"))
61 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
62
63 /*
64 * Check that no-one is attached to us.
65 */
66 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
67 ("Configuration error: Not possible to attach anything to this driver!\n"),
68 VERR_PDM_DRVINS_NO_ATTACH);
69
70 return VINF_SUCCESS;
71}
72
73/**
74 * ACPI CPU driver registration record.
75 */
76const PDMDRVREG g_DrvAcpiCpu =
77{
78 /* u32Version */
79 PDM_DRVREG_VERSION,
80 /* szName */
81 "ACPICpu",
82 /* szRCMod */
83 "",
84 /* szR0Mod */
85 "",
86 /* pszDescription */
87 "ACPI CPU Driver",
88 /* fFlags */
89 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
90 /* fClass. */
91 PDM_DRVREG_CLASS_ACPI,
92 /* cMaxInstances */
93 ~0U,
94 /* cbInstance */
95 sizeof(PDMDRVINS),
96 /* pfnConstruct */
97 drvACPICpuConstruct,
98 /* pfnDestruct */
99 NULL,
100 /* pfnRelocate */
101 NULL,
102 /* pfnIOCtl */
103 NULL,
104 /* pfnPowerOn */
105 NULL,
106 /* pfnReset */
107 NULL,
108 /* pfnSuspend */
109 NULL,
110 /* pfnResume */
111 NULL,
112 /* pfnAttach */
113 NULL,
114 /* pfnDetach */
115 NULL,
116 /* pfnPowerOff */
117 NULL,
118 /* pfnSoftReset */
119 NULL,
120 /* u32EndVersion */
121 PDM_DRVREG_VERSION
122};
Note: See TracBrowser for help on using the repository browser.

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