forked from parallella/pal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p_query.c
67 lines (63 loc) · 1.92 KB
/
p_query.c
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
#include <pal.h>
#include "pal_base.h"
#include "pal_base_private.h"
/**
*
* Queries a PAL device,returning an integer
* The object can be of type pal_dev_t, pal_mem_t, or pal_team_t.
* Valid queries should never return '0'.
*
* @todo Currently we only support querying devices.
*
* @param dev Device to query
*
* @param prop Property to query
*
* TYPE - Device type
* 1:EPIPHANY
* 2:GRID
* 3:SMP
* 4:FPGA
* 5:GPU
* ISA - Instruction Set Architecture
* 1:EPIPHANY
* 2:x86
* 3:ARM
* 4:MIPS
* OS - Operating System
* 1:Bare metal (CRT0)
* 2:Linux
* MEMARCH - Memory architecture
* 1:32 bits
* 2:64 bits
* TOPOLOGY - Network topology of device
* 1:Point to point
* 2:Bus
* 3:Star
* 4:Ring
* 5:Mesh
* 6:Hypercube
* 7:Tree
* NODES - Number of nodes in device
* ROWS - Number of rows in topology
* COLS - Number of cols in topology
* PLANES - Number of planes in topology
* CHIPROWS - Number of rows on a single chip
* CHIPCOLS - Number of cols on a single chip
* SIMD - Vector size at each node
* MEMSIZE - Local memory size at each node
* MEMBASE - Memory offset of first node
* VERSION - Unique platform version "tag"
* WHOAMI - Returns index of current node
*
* @return Value of property being queried
*
*/
int p_query(p_dev_t dev, int prop)
{
struct dev *pdev;
if (p_ref_is_err(dev))
return -EINVAL;
pdev = (struct dev *) dev;
return pdev->dev_ops->query(pdev, prop);
}