/sys/bus/pci/devices doesn't exist as kms-drm exports sysfs via sysctl

  $ clinfo | fgrep clock
    Max clock frequency                             0MHz

--- shared/source/os_interface/linux/drm_neo.cpp.orig	2021-09-10 14:22:47 UTC
+++ shared/source/os_interface/linux/drm_neo.cpp
@@ -34,6 +34,13 @@
 #include <cstdio>
 #include <cstring>
 
+#if defined(__FreeBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <cstdio>
+#include <cstdlib>
+#endif
+
 namespace NEO {
 
 namespace IoctlHelper {
@@ -800,6 +807,26 @@ bool Drm::sysmanQueryEngineInfo() {
 
 int getMaxGpuFrequencyOfDevice(Drm &drm, std::string &sysFsPciPath, int &maxGpuFrequency) {
     maxGpuFrequency = 0;
+#if defined(__FreeBSD__)
+    char name[SPECNAMELEN + 1];
+    if (!fdevname_r(drm.getFileDescriptor(), name, sizeof(name))) {
+        return 0;
+    }
+    int id;
+    if (!sscanf(name, "drm/%d", &id) && !sscanf(name, "dri/renderD%d", &id)) {
+        return 0;
+    }
+
+    char oid[MAXPATHLEN + 1];
+    char max_freq[PAGE_SIZE];
+    size_t len = sizeof(max_freq);
+    snprintf(oid, sizeof(oid), "sys.class.drm.card%d.gt_max_freq_mhz", id - 128);
+    if (sysctlbyname(oid, &max_freq, &len, NULL, 0)) {
+        return 0;
+    }
+
+    maxGpuFrequency = std::stoi(max_freq);
+#else
     std::string clockSysFsPath = sysFsPciPath + "/gt_max_freq_mhz";
 
     std::ifstream ifs(clockSysFsPath.c_str(), std::ifstream::in);
@@ -809,6 +836,7 @@ int getMaxGpuFrequencyOfDevice(Drm &drm, std::string &
 
     ifs >> maxGpuFrequency;
     ifs.close();
+#endif
     return 0;
 }
 
