VirtualBox

source: vbox/trunk/src/VBox/Main/PciDeviceAttachmentImpl.cpp@ 35128

Last change on this file since 35128 was 34331, checked in by vboxsync, 14 years ago

PCI: more 4.0 interfaces

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/* $Id: PciDeviceAttachmentImpl.cpp 34331 2010-11-24 16:24:17Z vboxsync $ */
2
3/** @file
4 *
5 * PCI attachment information implmentation.
6 */
7
8/*
9 * Copyright (C) 2010 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#include "PciDeviceAttachmentImpl.h"
21#include "AutoCaller.h"
22#include "Global.h"
23#include "Logging.h"
24
25struct PciDeviceAttachment::Data
26{
27 Data(Machine *aParent,
28 const Bstr &aDevName,
29 LONG aHostAddress,
30 LONG aGuestAddress,
31 BOOL afPhysical)
32 : pMachine(aParent),
33 HostAddress(aHostAddress), GuestAddress(aGuestAddress),
34 fPhysical(afPhysical)
35 {
36 DevName = aDevName;
37 }
38
39 Machine * const pMachine;
40 Bstr DevName;
41 LONG HostAddress;
42 LONG GuestAddress;
43 BOOL fPhysical;
44};
45
46// constructor / destructor
47/////////////////////////////////////////////////////////////////////////////
48
49HRESULT PciDeviceAttachment::FinalConstruct()
50{
51 LogFlowThisFunc(("\n"));
52 return S_OK;
53}
54
55void PciDeviceAttachment::FinalRelease()
56{
57 LogFlowThisFunc(("\n"));
58 uninit();
59}
60
61// public initializer/uninitializer for internal purposes only
62/////////////////////////////////////////////////////////////////////////////
63HRESULT PciDeviceAttachment::init(Machine *aParent,
64 const Bstr &aDevName,
65 LONG aHostAddress,
66 LONG aGuestAddress,
67 BOOL fPhysical)
68{
69 m = new Data(aParent, aDevName, aHostAddress, aGuestAddress, fPhysical);
70
71 return m != NULL ? S_OK : E_FAIL;
72}
73
74/**
75 * Uninitializes the instance.
76 * Called from FinalRelease().
77 */
78void PciDeviceAttachment::uninit()
79{
80 if (m)
81 {
82 delete m;
83 m = NULL;
84 }
85}
86
87// IPciDeviceAttachment properties
88/////////////////////////////////////////////////////////////////////////////
89
90STDMETHODIMP PciDeviceAttachment::COMGETTER(Name)(BSTR * aName)
91{
92 CheckComArgOutPointerValid(aName);
93 m->DevName.cloneTo(aName);
94 return S_OK;
95}
96
97STDMETHODIMP PciDeviceAttachment::COMGETTER(IsPhysicalDevice)(BOOL * aPhysical)
98{
99 CheckComArgOutPointerValid(aPhysical);
100 *aPhysical = m->fPhysical;
101 return S_OK;
102}
103
104STDMETHODIMP PciDeviceAttachment::COMGETTER(HostAddress)(LONG * aHostAddress)
105{
106 *aHostAddress = m->HostAddress;
107 return S_OK;
108}
109
110STDMETHODIMP PciDeviceAttachment::COMGETTER(GuestAddress)(LONG * aGuestAddress)
111{
112 *aGuestAddress = m->GuestAddress;
113 return S_OK;
114}
115
116#ifdef VBOX_WITH_XPCOM
117NS_DECL_CLASSINFO(PciDeviceAttachment)
118NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PciDeviceAttachment, IPciDeviceAttachment)
119#endif
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