summaryrefslogtreecommitdiff
path: root/lang/intel-compute-runtime/files/patch-no-rebar
blob: 10941205ad284f71dc32d93ec4f62efce93f8217 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Limit resizable BAR to Linux as NEO doesn't use libpci.

level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:15:10: fatal error: 'linux/pci_regs.h' file not found
#include <linux/pci_regs.h>
         ^~~~~~~~~~~~~~~~~~
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:157:20: error: use of undeclared identifier 'PCI_CFG_SPACE_SIZE'
    uint32_t pos = PCI_CFG_SPACE_SIZE;
                   ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:167:23: error: use of undeclared identifier 'PCI_CFG_SPACE_EXP_SIZE'
    auto loopCount = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
                      ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:167:48: error: use of undeclared identifier 'PCI_CFG_SPACE_SIZE'
    auto loopCount = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
                                               ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:174:13: error: use of undeclared identifier 'PCI_EXT_CAP_ID'
        if (PCI_EXT_CAP_ID(header) == PCI_EXT_CAP_ID_REBAR) {
            ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:174:39: error: use of undeclared identifier 'PCI_EXT_CAP_ID_REBAR'
        if (PCI_EXT_CAP_ID(header) == PCI_EXT_CAP_ID_REBAR) {
                                      ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:177:15: error: use of undeclared identifier 'PCI_EXT_CAP_NEXT'
        pos = PCI_EXT_CAP_NEXT(header);
              ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:178:19: error: use of undeclared identifier 'PCI_CFG_SPACE_SIZE'
        if (pos < PCI_CFG_SPACE_SIZE) {
                  ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:202:48: error: use of undeclared identifier 'PCI_CFG_SPACE_EXP_SIZE'
    configMemory = std::make_unique<uint8_t[]>(PCI_CFG_SPACE_EXP_SIZE);
                                               ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:203:35: error: use of undeclared identifier 'PCI_CFG_SPACE_EXP_SIZE'
    memset(configMemory.get(), 0, PCI_CFG_SPACE_EXP_SIZE);
                                  ^
level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp:204:55: error: use of undeclared identifier 'PCI_CFG_SPACE_EXP_SIZE'
    this->preadFunction(fdConfig, configMemory.get(), PCI_CFG_SPACE_EXP_SIZE, 0);
                                                      ^

--- level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp.orig	2021-08-11 16:12:33 UTC
+++ level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp
@@ -12,7 +12,9 @@
 
 #include "sysman/pci/pci_imp.h"
 
+#ifdef __linux__
 #include <linux/pci_regs.h>
+#endif
 
 namespace L0 {
 
@@ -153,6 +155,7 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::
 }
 
 uint32_t LinuxPciImp::getRebarCapabilityPos() {
+#ifdef __linux__
     uint32_t pos = PCI_CFG_SPACE_SIZE;
     uint32_t header = 0;
 
@@ -179,6 +182,7 @@ uint32_t LinuxPciImp::getRebarCapabilityPos() {
         }
         header = getDwordFromConfig(pos);
     }
+#endif
     return 0;
 }
 
@@ -197,6 +201,7 @@ bool LinuxPciImp::resizableBarEnabled(uint32_t barInde
     if (!rebarCapabilityPos) {
         return false;
     }
+#ifdef __linux__
 
     // As per PCI spec, resizable BAR's capability structure's 52 byte length could be represented as:
     // --------------------------------------------------------------
@@ -249,6 +254,7 @@ bool LinuxPciImp::resizableBarEnabled(uint32_t barInde
 
     // If current size is equal to larget possible BAR size, it indicates resizable BAR is enabled.
     return (currentSize == largestPossibleBarSize);
+#endif
 }
 
 ze_result_t LinuxPciImp::getState(zes_pci_state_t *state) {
@@ -256,6 +262,7 @@ ze_result_t LinuxPciImp::getState(zes_pci_state_t *sta
 }
 
 void LinuxPciImp::pciExtendedConfigRead() {
+#ifdef __linux__
     std::string pciConfigNode;
     pSysfsAccess->getRealPath("device/config", pciConfigNode);
     int fdConfig = -1;
@@ -267,6 +274,7 @@ void LinuxPciImp::pciExtendedConfigRead() {
     memset(configMemory.get(), 0, PCI_CFG_SPACE_EXP_SIZE);
     this->preadFunction(fdConfig, configMemory.get(), PCI_CFG_SPACE_EXP_SIZE, 0);
     this->closeFunction(fdConfig);
+#endif
 }
 
 LinuxPciImp::LinuxPciImp(OsSysman *pOsSysman) {