blob: 890c625e0068dbbcb17dd9bde9679bfbb471f7aa (
plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
// SPDX-License-Identifier: GPL-2.0 only
/*
* Emerald Hill compression engine driver internal header
*
* Copyright (C) 2020 Google LLC
* Author: Petri Gynther <pgynther@google.com>
*/
#ifndef _EH_INTERNAL_H
#define _EH_INTERNAL_H
#include <linux/eh.h>
#include "eh_regs.h"
#include <linux/spinlock_types.h>
#include <linux/wait.h>
#include <linux/kobject.h>
struct eh_completion {
void *priv;
};
#define EH_MAX_DCMD 8
#define EH_QUIRK_IGNORE_GCTRL_RESET BIT(0)
struct eh_request {
struct page *page;
void *priv;
struct list_head list;
};
struct eh_request_pool {
struct list_head head;
int count;
spinlock_t lock;
};
struct eh_sw_fifo {
struct list_head head;
int count;
spinlock_t lock;
};
struct eh_device {
struct kobject kobj;
struct list_head eh_dev_list;
/* hardware characteristics */
/* how many decompression command sets are implemented */
unsigned int decompr_cmd_count;
/* relating to the fifo and masks used to do related calculations */
unsigned short fifo_size;
unsigned short fifo_index_mask;
unsigned short fifo_color_mask;
/* cached copy of HW write index */
unsigned int write_index;
/* cached copy of HW complete index */
unsigned int complete_index;
__iomem unsigned char *regs;
/* in-memory allocated location (not aligned) for cacheable fifo */
void *fifo_alloc;
/* 64B aligned compression command fifo of either type 0 or type 1 */
void *fifo;
spinlock_t fifo_prod_lock;
/* Array of completions to keep track of each ongoing compression */
struct eh_completion *completions;
/* Array of pre-allocated buffers for compression */
void **compr_buffers;
#ifdef CONFIG_GOOGLE_EH_DCMD_STATUS_IN_MEMORY
unsigned long decompr_status[EH_MAX_DCMD];
#endif
/* Array of pre-allocated bounce buffers for decompression */
unsigned long __percpu *bounce_buffer;
/* parent device */
struct device *dev;
/* EH clock */
struct clk *clk;
int error_irq;
/*
* no interrupts, need to use a polling
* We use the polling for the HW validation testing .
*/
#define EH_POLL_DELAY_MS 500
unsigned short quirks;
struct task_struct *comp_thread;
wait_queue_head_t comp_wq;
atomic_t nr_request;
eh_cb_fn comp_callback;
/*
* eh_request pool to avoid memory allocation when EH's HW queue
* is full.
*/
struct eh_request_pool pool;
/* keep pending request */
struct eh_sw_fifo sw_fifo;
atomic64_t nr_stall;
};
#endif
|