VirtualBox

source: vbox/trunk/src/VBox/Main/include/BusAssignmentManager.h@ 101505

Last change on this file since 101505 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: BusAssignmentManager.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VirtualBox bus slots assignment manager
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_BusAssignmentManager_h
29#define MAIN_INCLUDED_BusAssignmentManager_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "VBox/types.h"
35#include "VBox/pci.h"
36#include "VirtualBoxBase.h"
37#include <vector>
38
39class BusAssignmentManager
40{
41private:
42 struct State;
43 State *pState;
44
45 BusAssignmentManager();
46 virtual ~BusAssignmentManager();
47
48 HRESULT assignPCIDeviceImpl(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& GuestAddress,
49 PCIBusAddress HostAddress, bool fGuestAddressRequired = false);
50
51public:
52 struct PCIDeviceInfo
53 {
54 com::Utf8Str strDeviceName;
55 PCIBusAddress guestAddress;
56 PCIBusAddress hostAddress;
57 };
58
59 static BusAssignmentManager *createInstance(PCVMMR3VTABLE pVMM, ChipsetType_T chipsetType, IommuType_T iommuType);
60 virtual void AddRef();
61 virtual void Release();
62
63 virtual HRESULT assignHostPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress HostAddress,
64 PCIBusAddress& GuestAddress, bool fAddressRequired = false)
65 {
66 return assignPCIDeviceImpl(pszDevName, pCfg, GuestAddress, HostAddress, fAddressRequired);
67 }
68
69 virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& Address, bool fAddressRequired = false)
70 {
71 PCIBusAddress HostAddress;
72 return assignPCIDeviceImpl(pszDevName, pCfg, Address, HostAddress, fAddressRequired);
73 }
74
75 virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg)
76 {
77 PCIBusAddress GuestAddress;
78 PCIBusAddress HostAddress;
79 return assignPCIDeviceImpl(pszDevName, pCfg, GuestAddress, HostAddress, false);
80 }
81 virtual bool findPCIAddress(const char *pszDevName, int iInstance, PCIBusAddress& Address);
82 virtual bool hasPCIDevice(const char *pszDevName, int iInstance)
83 {
84 PCIBusAddress Address;
85 return findPCIAddress(pszDevName, iInstance, Address);
86 }
87 virtual void listAttachedPCIDevices(std::vector<PCIDeviceInfo> &aAttached);
88};
89
90#endif /* !MAIN_INCLUDED_BusAssignmentManager_h */
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