1 | /* $Id: BusAssignmentManager.h 61009 2016-05-17 17:18:29Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox bus slots assignment manager
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2010-2016 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 | #ifndef __BusAssignmentManager_h
|
---|
20 | #define __BusAssignmentManager_h
|
---|
21 |
|
---|
22 | #include "VBox/types.h"
|
---|
23 | #include "VBox/pci.h"
|
---|
24 | #include "VirtualBoxBase.h"
|
---|
25 | #include <vector>
|
---|
26 |
|
---|
27 | class BusAssignmentManager
|
---|
28 | {
|
---|
29 | private:
|
---|
30 | struct State;
|
---|
31 | State *pState;
|
---|
32 |
|
---|
33 | BusAssignmentManager();
|
---|
34 | virtual ~BusAssignmentManager();
|
---|
35 |
|
---|
36 | HRESULT assignPCIDeviceImpl(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& GuestAddress,
|
---|
37 | PCIBusAddress HostAddress, bool fGuestAddressRequired = false);
|
---|
38 |
|
---|
39 | public:
|
---|
40 | struct PCIDeviceInfo
|
---|
41 | {
|
---|
42 | com::Utf8Str strDeviceName;
|
---|
43 | PCIBusAddress guestAddress;
|
---|
44 | PCIBusAddress hostAddress;
|
---|
45 | };
|
---|
46 |
|
---|
47 | static BusAssignmentManager *createInstance(ChipsetType_T chipsetType);
|
---|
48 | virtual void AddRef();
|
---|
49 | virtual void Release();
|
---|
50 |
|
---|
51 | virtual HRESULT assignHostPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress HostAddress,
|
---|
52 | PCIBusAddress& GuestAddress, bool fAddressRequired = false)
|
---|
53 | {
|
---|
54 | return assignPCIDeviceImpl(pszDevName, pCfg, GuestAddress, HostAddress, fAddressRequired);
|
---|
55 | }
|
---|
56 |
|
---|
57 | virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& Address, bool fAddressRequired = false)
|
---|
58 | {
|
---|
59 | PCIBusAddress HostAddress;
|
---|
60 | return assignPCIDeviceImpl(pszDevName, pCfg, Address, HostAddress, fAddressRequired);
|
---|
61 | }
|
---|
62 |
|
---|
63 | virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg)
|
---|
64 | {
|
---|
65 | PCIBusAddress GuestAddress;
|
---|
66 | PCIBusAddress HostAddress;
|
---|
67 | return assignPCIDeviceImpl(pszDevName, pCfg, GuestAddress, HostAddress, false);
|
---|
68 | }
|
---|
69 | virtual bool findPCIAddress(const char *pszDevName, int iInstance, PCIBusAddress& Address);
|
---|
70 | virtual bool hasPCIDevice(const char *pszDevName, int iInstance)
|
---|
71 | {
|
---|
72 | PCIBusAddress Address;
|
---|
73 | return findPCIAddress(pszDevName, iInstance, Address);
|
---|
74 | }
|
---|
75 | virtual void listAttachedPCIDevices(std::vector<PCIDeviceInfo> &aAttached);
|
---|
76 | };
|
---|
77 |
|
---|
78 | #endif // __BusAssignmentManager_h
|
---|