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