packaging: update the changelog
[profile/ivi/intel-emgd-kmod.git] / drivers / emgd / include / plb / context.h
1 /*
2  *-----------------------------------------------------------------------------
3  * Filename: context.h
4  * $Revision: 1.17 $
5  *-----------------------------------------------------------------------------
6  * Copyright (c) 2002-2010, Intel Corporation.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  *
26  *-----------------------------------------------------------------------------
27  * Description:
28  *
29  *-----------------------------------------------------------------------------
30  */
31
32 #ifndef _HAL_PLB_CONTEXT_H
33 #define _HAL_PLB_CONTEXT_H
34
35 #include <sched.h>
36
37 #include <pci.h>
38 #include <igd_render.h>
39 #include <plb/sgx.h>
40 #include <servicesint.h>
41 /*
42  * FIXME: Promote io_mapped/io_base to DI layer
43  *
44  * Note: This define is for the vBIOS OAL only. Do not use
45  * it anywhere else, use the actual type name.
46  */
47 #define PLATFORM_CONTEXT_T platform_context_plb_t
48
49 typedef struct psb_use_reg {
50         unsigned long reg_seq;
51         unsigned long base;
52         unsigned long size;
53         unsigned long data_master;
54         unsigned char * virt;
55 } psb_use_reg_t;
56
57 typedef struct drmBO {
58         unsigned long offset;
59 } drmBO_t;
60
61 typedef struct psb_closed_dpm {
62         drmBO_t *page_table_bo;
63         drmBO_t *parameter_bo;
64         unsigned int num_pages;
65         unsigned int context_id;
66         unsigned int ta_global_list;
67         unsigned int ta_threshold;
68         unsigned int zls_threshold;
69 } psb_closed_dpm_t;
70
71 typedef struct _psb_sgx_priv {
72
73         /* HW workaround table */
74         /* ***********************************************/
75     struct pclosed_vopt   vopt;
76
77         /* stuff required to be setup by sgx_init in cmd */
78         /* ***********************************************/
79         struct psb_use_reg    use_code[SGX_MAX_USSE_THRDS];
80         igd_dma_t             drm_bo[DRM_BO_MEM_TYPES];
81
82         igd_dma_t             commBO;
83         igd_dma_t             codeBO;
84         igd_dma_t             sProg;
85         igd_dma_t             geom;
86         igd_dma_t             local;
87
88         unsigned long         usse_reg_dm;
89         unsigned long         num_use_attribute_registers;
90
91         psb_closed_dpm_t      dpms[2];
92         /* What is an igd_command variable doing here?!
93          * should we move this into an appcontext_plb
94          * structure and let psb_sgx_priv_t have a ptr
95          * to the active appcontext_plb pointer? i.e. an
96          * appcontext created for 3d context?
97          */
98         igd_command_t         context_select;
99
100         /* stuff required to be setup by sgx_init in gart */
101         /* ***********************************************/
102         unsigned int          cache_ctrl;
103
104         /* state required to be setup by sgx_init in pwr */
105         /* ***********************************************/
106 } psb_sgx_priv_t;
107
108 /* Values used in platform_context_plb_t->flip_pending
109  * This corresponds to the pipe, which is a bit strange,
110  * but since the flip must wait for a vBlank, it is
111  * based off the PIPE */
112 #define PLB_FLIP_PIPE_A_PENDING 1
113 #define PLB_FLIP_PIPE_B_PENDING 2
114
115 typedef struct _tnc_topaz_priv {
116
117         /* current video task */
118         unsigned long topaz_cur_codec;
119         unsigned long cur_mtx_data_size;
120         int topaz_needs_reset;
121         int topaz_start_idle;
122         unsigned long topaz_idle_start_jiffies;
123         /* used by topaz_lockup */
124         unsigned long topaz_current_sequence;
125         unsigned long topaz_last_sequence;
126         unsigned long topaz_finished_sequence;
127
128         /*
129          * topaz command queueu
130          */
131         int topaz_busy;         /* 0 means topaz is free */
132         int topaz_fw_loaded;
133
134         /* topaz ccb data */
135         unsigned long topaz_ccb_buffer_addr;
136         unsigned long topaz_ccb_ctrl_addr;
137         unsigned long topaz_ccb_size;
138         unsigned long topaz_cmd_windex;
139         unsigned short topaz_cmd_seq;
140
141         unsigned long stored_initial_qp;
142         unsigned long topaz_frame_skip;
143         unsigned long topaz_dash_access_ctrl;
144
145         unsigned char *topaz_ccb_wb;
146         unsigned long topaz_wb_offset;
147         unsigned long *topaz_sync_addr;
148         unsigned long topaz_sync_offset;
149         unsigned long topaz_sync_cmd_seq;
150         unsigned long topaz_sync_id;
151         /**
152          * Virtual address to writeback memory in the aperture space.
153          */
154         unsigned char *virt_wb;
155         /**
156          * Offset in gmm space for write back memory.
157          */
158         unsigned long wb_offset;
159 } tnc_topaz_priv_t;
160
161 struct msvdx_pvr_info;
162
163 typedef struct _platform_context_plb {
164         int irq;
165         unsigned short did;
166         os_pci_dev_t pcidev0;
167         os_pci_dev_t pcidev1;
168         os_pci_dev_t lpc_dev;
169         os_pci_dev_t bridgedev;
170         unsigned char tnc_dev3_rid;             /* TNC Device 3 RID*/
171         os_pci_dev_t stbridgedev;
172         os_pci_dev_t stgpiodev;
173         unsigned long rendec_base0;
174         unsigned long rendec_base1;
175         /*
176          * Cached value of the SGX's PSB_CR_BIF_DIR_LIST_BASE1, which is
177          * used to configure MSVDX MMU base 0.
178          */
179         unsigned long psb_cr_bif_dir_list_base1;
180         int msvdx_needs_reset;
181     spinlock_t msvdx_lock;
182     spinlock_t msvdx_init_plb;
183     unsigned long msvdx_status;
184     int msvdx_busy;
185     struct list_head msvdx_queue;
186         unsigned long msvdx_dash_access_ctrl;
187         struct msvdx_pvr_info *msvdx_pvr;
188         psb_sgx_priv_t sgx_priv_data;
189         tnc_topaz_priv_t tpz_private_data;
190     unsigned long msvdx_fence;
191         int topaz_busy;
192         unsigned long src_pat_data_offset;
193         unsigned long glyph_data_offset;
194         unsigned long sequence;
195         unsigned long mtx_submitted;
196         unsigned long mtx_completed;
197         unsigned long mtx_buf_size;
198         unsigned long host_buf_size;
199         unsigned long mtx_buf_offset;
200         unsigned long host_buf_offset;
201         /* Flip pending. This is used in the mode
202          * module, but it is intialized in the cmd
203          * module along with the other mutex-es */
204         unsigned int flip_pending;
205         os_pthread_mutex_t flip_mutex;
206         int force_polling;
207         int irq_enabled;
208 } platform_context_plb_t, platform_context_tnc_t;
209
210 #endif