forked from hartmark/aura-gpu
-
Notifications
You must be signed in to change notification settings - Fork 1
/
aura-gpu-reg.h
102 lines (91 loc) · 2.43 KB
/
aura-gpu-reg.h
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
97
98
99
100
101
102
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _UAPI_AURA_GPU_REGISTRY_H
#define _UAPI_AURA_GPU_REGISTRY_H
#include <linux/pci.h>
#include <linux/types.h>
#include "include/types.h"
struct reg_fields {
uint32_t mask;
uint32_t value;
uint8_t shift;
};
struct aura_reg_service {
void *private;
};
#define PIN_FIELDS(_pin, _field, _value) \
{ \
.mask = _pin->masks->_field, \
.shift = _pin->shifts->_field, \
.value = _value \
}
int32_t reg_read (
struct aura_reg_service *service,
uint32_t reg
);
void reg_write (
struct aura_reg_service *service,
uint32_t reg,
uint32_t value
);
uint32_t reg_get_field_value(
const struct reg_fields *field
);
uint32_t reg_set_field_value(
uint32_t value,
struct reg_fields *field
);
#define reg_field_get_value_ex reg_get_field_value
#define reg_field_set_value_ex reg_set_field_value
#define reg_field_get_value(value, reg, field) \
reg_field_get_value_ex((struct reg_fields[]){ \
REG_FIELD(reg, field, value), \
})
#define reg_field_set_value(set_value, value, reg, field) \
reg_field_set_value_ex(set_value, (struct reg_fields[]){ \
REG_FIELD(reg, field, value), \
})
uint32_t reg_update_ex(
struct aura_reg_service *service,
uint32_t addr,
const struct reg_fields *fields,
ssize_t cnt
);
uint32_t reg_update_seq_ex(
struct aura_reg_service *service,
uint32_t addr,
const struct reg_fields *fields,
ssize_t cnt
);
uint32_t reg_set_ex(
struct aura_reg_service *service,
uint32_t addr,
uint32_t init,
const struct reg_fields *fields,
ssize_t cnt
);
uint32_t reg_get_ex(
struct aura_reg_service *service,
uint32_t addr,
struct reg_fields *fields,
ssize_t cnt
);
uint32_t reg_get_value(
struct aura_reg_service *service,
uint32_t addr,
struct reg_fields *fields,
uint32_t *value
);
void reg_wait_ex(
struct aura_reg_service *service,
uint32_t addr,
struct reg_fields *field,
uint32_t attempts,
uint32_t timeout
);
struct aura_reg_service *aura_gpu_reg_create(
struct pci_dev *pci_dev
);
void aura_gpu_reg_destroy (
struct aura_reg_service *service
);
#endif