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
|
/*
* Copyright 2016-17 IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _ASM_POWERPC_VAS_H
#define _ASM_POWERPC_VAS_H
/*
* Min and max FIFO sizes are based on Version 1.05 Section 3.1.4.25
* (Local FIFO Size Register) of the VAS workbook.
*/
#define VAS_RX_FIFO_SIZE_MIN (1 << 10) /* 1KB */
#define VAS_RX_FIFO_SIZE_MAX (8 << 20) /* 8MB */
/*
* Threshold Control Mode: Have paste operation fail if the number of
* requests in receive FIFO exceeds a threshold.
*
* NOTE: No special error code yet if paste is rejected because of these
* limits. So users can't distinguish between this and other errors.
*/
#define VAS_THRESH_DISABLED 0
#define VAS_THRESH_FIFO_GT_HALF_FULL 1
#define VAS_THRESH_FIFO_GT_QTR_FULL 2
#define VAS_THRESH_FIFO_GT_EIGHTH_FULL 3
/*
* Get/Set bit fields
*/
#define GET_FIELD(m, v) (((v) & (m)) >> MASK_LSH(m))
#define MASK_LSH(m) (__builtin_ffsl(m) - 1)
#define SET_FIELD(m, v, val) \
(((v) & ~(m)) | ((((typeof(v))(val)) << MASK_LSH(m)) & (m)))
/*
* Co-processor Engine type.
*/
enum vas_cop_type {
VAS_COP_TYPE_FAULT,
VAS_COP_TYPE_842,
VAS_COP_TYPE_842_HIPRI,
VAS_COP_TYPE_GZIP,
VAS_COP_TYPE_GZIP_HIPRI,
VAS_COP_TYPE_FTW,
VAS_COP_TYPE_MAX,
};
/*
* Receive window attributes specified by the (in-kernel) owner of window.
*/
struct vas_rx_win_attr {
void *rx_fifo;
int rx_fifo_size;
int wcreds_max;
bool pin_win;
bool rej_no_credit;
bool tx_wcred_mode;
bool rx_wcred_mode;
bool tx_win_ord_mode;
bool rx_win_ord_mode;
bool data_stamp;
bool nx_win;
bool fault_win;
bool user_win;
bool notify_disable;
bool intr_disable;
bool notify_early;
int lnotify_lpid;
int lnotify_pid;
int lnotify_tid;
u32 pswid;
int tc_mode;
};
/*
* Helper to initialize receive window attributes to defaults for an
* NX window.
*/
void vas_init_rx_win_attr(struct vas_rx_win_attr *rxattr, enum vas_cop_type cop);
/*
* Open a VAS receive window for the instance of VAS identified by @vasid
* Use @attr to initialize the attributes of the window.
*
* Return a handle to the window or ERR_PTR() on error.
*/
struct vas_window *vas_rx_win_open(int vasid, enum vas_cop_type cop,
struct vas_rx_win_attr *attr);
#endif /* __ASM_POWERPC_VAS_H */
|