aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/emgd/emgd/include/plb/context.h
blob: 3213c62aeb35375dc3252995ad9cba8d201e036f (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/* -*- pse-c -*-
 *-----------------------------------------------------------------------------
 * Filename: context.h
 * $Revision: 1.10 $
 *-----------------------------------------------------------------------------
 * Copyright © 2002-2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *-----------------------------------------------------------------------------
 * Description:
 *  
 *-----------------------------------------------------------------------------
 */

#ifndef _HAL_PLB_CONTEXT_H
#define _HAL_PLB_CONTEXT_H

#include <sched.h>

#include <pci.h>
#include <igd_render.h>
#include <plb/sgx.h>
/*
 * FIXME: Promote io_mapped/io_base to DI layer
 *
 * Note: This define is for the vBIOS OAL only. Do not use
 * it anywhere else, use the actual type name.
 */
#define PLATFORM_CONTEXT_T platform_context_plb_t

typedef struct psb_use_reg {
	unsigned long reg_seq;
	unsigned long base;
	unsigned long size;
	unsigned long data_master;
	unsigned char * virt;
} psb_use_reg_t;

typedef struct drmBO {
	unsigned long offset;
} drmBO_t;

typedef struct psb_closed_dpm {
	drmBO_t *page_table_bo;
	drmBO_t *parameter_bo;
	unsigned int num_pages;
	unsigned int context_id;
	unsigned int ta_global_list;
	unsigned int ta_threshold;
	unsigned int zls_threshold;
} psb_closed_dpm_t;

typedef struct _psb_sgx_priv {

	/* HW workaround table */
	/* ***********************************************/
    struct pclosed_vopt   vopt;

	/* stuff required to be setup by sgx_init in cmd */
	/* ***********************************************/
	struct psb_use_reg    use_code[SGX_MAX_USSE_THRDS];
	igd_dma_t             drm_bo[DRM_BO_MEM_TYPES];

	igd_dma_t             commBO;
	igd_dma_t             codeBO;
	igd_dma_t             sProg;
	igd_dma_t             geom;
	igd_dma_t             local;

	unsigned long         usse_reg_dm;
	unsigned long         num_use_attribute_registers;

	psb_closed_dpm_t      dpms[2];
	/* What is an igd_command variable doing here?!
	 * should we move this into an appcontext_plb
	 * structure and let psb_sgx_priv_t have a ptr
	 * to the active appcontext_plb pointer? i.e. an
	 * appcontext created for 3d context?
	 */
	igd_command_t         context_select;

	/* stuff required to be setup by sgx_init in gart */
	/* ***********************************************/
	unsigned int          cache_ctrl;

	/* state required to be setup by sgx_init in pwr */
	/* ***********************************************/
} psb_sgx_priv_t;

/* Values used in platform_context_plb_t->flip_pending
 * This corresponds to the pipe, which is a bit strange,
 * but since the flip must wait for a vBlank, it is
 * based off the PIPE */
#define PLB_FLIP_PIPE_A_PENDING 1
#define PLB_FLIP_PIPE_B_PENDING 2

typedef struct _tnc_topaz_priv {

	/* current video task */
	unsigned long topaz_cur_codec;
	unsigned long cur_mtx_data_size;
	int topaz_needs_reset;
	int topaz_start_idle;
	unsigned long topaz_idle_start_jiffies;
	/* used by topaz_lockup */
	unsigned long topaz_current_sequence;
	unsigned long topaz_last_sequence;
	unsigned long topaz_finished_sequence;

	/*
	 * topaz command queueu
	 */
	int topaz_busy;		/* 0 means topaz is free */
	int topaz_fw_loaded;

	/* topaz ccb data */
	unsigned long topaz_ccb_buffer_addr;
	unsigned long topaz_ccb_ctrl_addr;
	unsigned long topaz_ccb_size;
	unsigned long topaz_cmd_windex;
	unsigned short topaz_cmd_seq;

	unsigned long stored_initial_qp;
	unsigned long topaz_frame_skip;
	unsigned long topaz_dash_access_ctrl;

	unsigned char *topaz_ccb_wb;
	unsigned long topaz_wb_offset;
	unsigned long *topaz_sync_addr;
	unsigned long topaz_sync_offset;
	unsigned long topaz_sync_cmd_seq;
	unsigned long topaz_sync_val;
	/**
	 * Virtual address to writeback memory in the aperture space.
	 */
	unsigned char *virt_wb;
	/**
	 * Offset in gmm space for write back memory.
	 */
	unsigned long wb_offset;
} tnc_topaz_priv_t;

typedef struct _platform_context_plb {
	int irq;
	unsigned short did;
	os_pci_dev_t pcidev0;
	os_pci_dev_t pcidev1;
	os_pci_dev_t lpc_dev;
	os_pci_dev_t bridgedev;
	unsigned long rendec_base0;
	unsigned long rendec_base1;
	int msvdx_needs_reset;
    spinlock_t msvdx_lock;
    int msvdx_busy;
    struct list_head msvdx_queue;
	psb_sgx_priv_t sgx_priv_data;
	tnc_topaz_priv_t tpz_private_data;
    unsigned long msvdx_fence;
	int topaz_busy;
	unsigned long src_pat_data_offset;
	unsigned long glyph_data_offset;
	unsigned long sequence;
	unsigned long mtx_submitted;
	unsigned long mtx_completed;
	unsigned long mtx_buf_size;
	unsigned long host_buf_size;
	unsigned long mtx_buf_offset;
	unsigned long host_buf_offset;
	/* Flip pending. This is used in the mode
	 * module, but it is intialized in the cmd
	 * module along with the other mutex-es */
	unsigned int flip_pending;
        os_pthread_mutex_t flip_mutex;
	int force_polling;
	int irq_enabled;
} platform_context_plb_t, platform_context_tnc_t;

#endif