1 | /* $Id: PciDeviceAttachmentImpl.h 35885 2011-02-08 01:20:04Z 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 | #ifndef ____H_PCIDEVICEATTACHMENTIMPL
|
---|
21 | #define ____H_PCIDEVICEATTACHMENTIMPL
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 | #include <VBox/settings.h>
|
---|
25 |
|
---|
26 | class ATL_NO_VTABLE PciAddress :
|
---|
27 | public VirtualBoxBase,
|
---|
28 | VBOX_SCRIPTABLE_IMPL(IPciAddress)
|
---|
29 | {
|
---|
30 | public:
|
---|
31 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(PciAddress, IPciAddress)
|
---|
32 |
|
---|
33 | DECLARE_NOT_AGGREGATABLE(PciAddress)
|
---|
34 |
|
---|
35 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
36 |
|
---|
37 | BEGIN_COM_MAP(PciAddress)
|
---|
38 | VBOX_DEFAULT_INTERFACE_ENTRIES(IPciAddress)
|
---|
39 | END_COM_MAP()
|
---|
40 |
|
---|
41 | PciAddress() { }
|
---|
42 | ~PciAddress() { }
|
---|
43 |
|
---|
44 | // public initializer/uninitializer for internal purposes only
|
---|
45 | HRESULT init(LONG aAddess);
|
---|
46 | void uninit();
|
---|
47 |
|
---|
48 | HRESULT FinalConstruct();
|
---|
49 | void FinalRelease();
|
---|
50 |
|
---|
51 | // IPciAddress properties
|
---|
52 | STDMETHOD(COMGETTER(Bus))(SHORT *aBus)
|
---|
53 | {
|
---|
54 | *aBus = mBus;
|
---|
55 | return S_OK;
|
---|
56 | }
|
---|
57 | STDMETHOD(COMSETTER(Bus))(SHORT aBus)
|
---|
58 | {
|
---|
59 | mBus = aBus;
|
---|
60 | return S_OK;
|
---|
61 | }
|
---|
62 | STDMETHOD(COMGETTER(Device))(SHORT *aDevice)
|
---|
63 | {
|
---|
64 | *aDevice = mDevice;
|
---|
65 | return S_OK;
|
---|
66 | }
|
---|
67 | STDMETHOD(COMSETTER(Device))(SHORT aDevice)
|
---|
68 | {
|
---|
69 | mDevice = aDevice;
|
---|
70 | return S_OK;
|
---|
71 | }
|
---|
72 |
|
---|
73 | STDMETHOD(COMGETTER(DevFunction))(SHORT *aDevFunction)
|
---|
74 | {
|
---|
75 | *aDevFunction = mFn;
|
---|
76 | return S_OK;
|
---|
77 | }
|
---|
78 | STDMETHOD(COMSETTER(DevFunction))(SHORT aDevFunction)
|
---|
79 | {
|
---|
80 | mFn = aDevFunction;
|
---|
81 | return S_OK;
|
---|
82 | }
|
---|
83 |
|
---|
84 | private:
|
---|
85 | SHORT mBus, mDevice, mFn;
|
---|
86 | };
|
---|
87 |
|
---|
88 | class ATL_NO_VTABLE PciDeviceAttachment :
|
---|
89 | public VirtualBoxBase,
|
---|
90 | VBOX_SCRIPTABLE_IMPL(IPciDeviceAttachment)
|
---|
91 | {
|
---|
92 | public:
|
---|
93 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(PciDeviceAttachment, IPciDeviceAttachment)
|
---|
94 |
|
---|
95 | DECLARE_NOT_AGGREGATABLE(PciDeviceAttachment)
|
---|
96 |
|
---|
97 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
98 |
|
---|
99 | BEGIN_COM_MAP(PciDeviceAttachment)
|
---|
100 | VBOX_DEFAULT_INTERFACE_ENTRIES(IPciDeviceAttachment)
|
---|
101 | END_COM_MAP()
|
---|
102 |
|
---|
103 | PciDeviceAttachment() { }
|
---|
104 | ~PciDeviceAttachment() { }
|
---|
105 |
|
---|
106 | // public initializer/uninitializer for internal purposes only
|
---|
107 | HRESULT init(IMachine * aParent,
|
---|
108 | const Bstr &aName,
|
---|
109 | LONG aHostAddess,
|
---|
110 | LONG aGuestAddress,
|
---|
111 | BOOL fPhysical);
|
---|
112 |
|
---|
113 | void uninit();
|
---|
114 |
|
---|
115 | // settings
|
---|
116 | HRESULT loadSettings(IMachine * aParent,
|
---|
117 | const settings::HostPciDeviceAttachment& aHpda);
|
---|
118 | HRESULT saveSettings(settings::HostPciDeviceAttachment &data);
|
---|
119 |
|
---|
120 | HRESULT FinalConstruct();
|
---|
121 | void FinalRelease();
|
---|
122 |
|
---|
123 | // IPciDeviceAttachment properties
|
---|
124 | STDMETHOD(COMGETTER(Name))(BSTR * aName);
|
---|
125 | STDMETHOD(COMGETTER(IsPhysicalDevice))(BOOL * aPhysical);
|
---|
126 | STDMETHOD(COMGETTER(HostAddress))(LONG * hostAddress);
|
---|
127 | STDMETHOD(COMGETTER(GuestAddress))(LONG * guestAddress);
|
---|
128 |
|
---|
129 | private:
|
---|
130 | struct Data;
|
---|
131 | Data* m;
|
---|
132 | };
|
---|
133 |
|
---|
134 | #endif // ____H_PCIDEVICEATTACHMENTIMPL
|
---|