The Pedigree Project
0.1
src
system
include
pedigree
kernel
machine
PciVirtualFunctions.h
1
/* Copyright (c) 2026, Pedigree Developers. SPDX-License-Identifier: ISC */
2
#ifndef PEDIGREE_PCI_VIRTUAL_FUNCTIONS_H
3
#define PEDIGREE_PCI_VIRTUAL_FUNCTIONS_H
4
5
#include "pedigree/kernel/compiler.h"
6
#include "pedigree/kernel/machine/PciSriov.h"
7
8
class
Device
;
9
21
class
EXPORTED_PUBLIC
PciVirtualFunctions
{
22
public
:
23
explicit
PciVirtualFunctions
(
Device
* pf);
24
~PciVirtualFunctions
();
25
26
bool
enable(
size_t
count);
27
Device
* function(
size_t
index)
const
;
28
size_t
count()
const
;
29
bool
disable();
30
static
bool
bar(
Device
* vf, uint8_t index, uint64_t& pciBase, uint64_t& bytes);
31
32
private
:
33
PciVirtualFunctions
(
const
PciVirtualFunctions
&) =
delete
;
34
PciVirtualFunctions
& operator=(
const
PciVirtualFunctions
&) =
delete
;
35
36
void
reclaim();
37
38
// The current VT-d backend has eight requester-domain slots. Other devices
39
// may occupy some of them; attach failure rolls the whole group back.
40
static
constexpr
size_t
MaxFunctions = 8;
41
Device
* m_Pf;
42
Device
* m_Functions[MaxFunctions] = {};
43
bool
m_Present[MaxFunctions] = {};
44
bool
m_Reserved[6] = {};
45
size_t
m_PlannedCount = 0;
46
size_t
m_Count = 0;
47
uint16_t m_Offset = 0;
48
uint16_t m_NextCapability = 0;
49
PciSriov::State
m_Original;
50
PciSriov::Geometry
m_Bars;
51
bool
m_Touched =
false
;
52
bool
m_EnableAttempted =
false
;
53
};
54
55
#endif
Device
Definition
Device.h:41
PciVirtualFunctions
Definition
PciVirtualFunctions.h:21
PciSriov::Geometry
Definition
PciSriov.h:45
PciSriov::State
Definition
PciSriov.h:16
Generated on Tue Sep 29 2026 04:30:11 for The Pedigree Project by
1.9.8