1 /*
2  * Copyright (C) 2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #include "shared/source/os_interface/linux/system_info.h"
9 
10 #include "shared/source/debug_settings/debug_settings_manager.h"
11 #include "shared/source/helpers/debug_helpers.h"
12 #include "shared/source/helpers/hw_info.h"
13 
14 #include "drm/intel_hwconfig_types.h"
15 
16 namespace NEO {
17 
SystemInfo(const uint32_t * blobData,int32_t blobSize)18 SystemInfo::SystemInfo(const uint32_t *blobData, int32_t blobSize) {
19     this->parseDeviceBlob(blobData, blobSize);
20 }
21 
parseDeviceBlob(const uint32_t * data,int32_t size)22 void SystemInfo::parseDeviceBlob(const uint32_t *data, int32_t size) {
23 
24     uint32_t i = 0;
25     while (i < (size / sizeof(uint32_t))) {
26         DEBUG_BREAK_IF(data[i + 1] < 1);
27 
28         /* Attribute IDs range */
29         DEBUG_BREAK_IF(data[i] < 1);
30 
31         if (INTEL_HWCONFIG_MAX_SLICES_SUPPORTED == data[i]) {
32             maxSlicesSupported = data[i + 2];
33         }
34         if (INTEL_HWCONFIG_MAX_DUAL_SUBSLICES_SUPPORTED == data[i]) {
35             maxDualSubSlicesSupported = data[i + 2];
36         }
37         if (INTEL_HWCONFIG_MAX_NUM_EU_PER_DSS == data[i]) {
38             maxEuPerDualSubSlice = data[i + 2];
39         }
40         if (INTEL_HWCONFIG_MAX_MEMORY_CHANNELS == data[i]) {
41             maxMemoryChannels = data[i + 2];
42         }
43         if (INTEL_HWCONFIG_MEMORY_TYPE == data[i]) {
44             memoryType = data[i + 2];
45         }
46         if (INTEL_HWCONFIG_NUM_THREADS_PER_EU == data[i]) {
47             numThreadsPerEu = data[i + 2];
48         }
49         if (INTEL_HWCONFIG_TOTAL_VS_THREADS == data[i]) {
50             totalVsThreads = data[i + 2];
51         }
52         if (INTEL_HWCONFIG_TOTAL_HS_THREADS == data[i]) {
53             totalHsThreads = data[i + 2];
54         }
55         if (INTEL_HWCONFIG_TOTAL_DS_THREADS == data[i]) {
56             totalDsThreads = data[i + 2];
57         }
58         if (INTEL_HWCONFIG_TOTAL_GS_THREADS == data[i]) {
59             totalGsThreads = data[i + 2];
60         }
61         if (INTEL_HWCONFIG_TOTAL_PS_THREADS == data[i]) {
62             totalPsThreads = data[i + 2];
63         }
64         if (INTEL_HWCONFIG_MAX_RCS == data[i]) {
65             maxRCS = data[i + 2];
66         }
67         if (INTEL_HWCONFIG_MAX_CCS == data[i]) {
68             maxCCS = data[i + 2];
69         }
70         extendParseDeviceBlob(data, i);
71         /* Skip to next attribute */
72         auto blobLength = 2 + data[i + 1];
73         i += blobLength;
74     }
75 }
76 
77 } // namespace NEO
78