blob: d319c98b969c5aa36cc1842d632b35aff90635de [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2008-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#ifndef __ADRENO_H
14#define __ADRENO_H
15
16#include "kgsl_device.h"
17#include "adreno_drawctxt.h"
18#include "adreno_ringbuffer.h"
Shubhraprakash Dasc6e21012012-05-11 17:24:51 -060019#include "kgsl_iommu.h"
liu zhong7dfa2a32012-04-27 19:11:01 -070020#include <mach/ocmem.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021
22#define DEVICE_3D_NAME "kgsl-3d"
23#define DEVICE_3D0_NAME "kgsl-3d0"
24
25#define ADRENO_DEVICE(device) \
26 KGSL_CONTAINER_OF(device, struct adreno_device, dev)
27
Jordan Crouse4815e9f2012-07-09 15:36:37 -060028#define ADRENO_CHIPID_CORE(_id) (((_id) >> 24) & 0xFF)
29#define ADRENO_CHIPID_MAJOR(_id) (((_id) >> 16) & 0xFF)
30#define ADRENO_CHIPID_MINOR(_id) (((_id) >> 8) & 0xFF)
31#define ADRENO_CHIPID_PATCH(_id) ((_id) & 0xFF)
32
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070033/* Flags to control command packet settings */
Jordan Crousee0ea7622012-01-24 09:32:04 -070034#define KGSL_CMD_FLAGS_NONE 0x00000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#define KGSL_CMD_FLAGS_PMODE 0x00000001
Vijay Krishnamoorthye80c3462012-08-27 14:07:32 -070036#define KGSL_CMD_FLAGS_INTERNAL_ISSUE 0x00000002
Tarun Karradeeecc02013-01-21 23:42:17 -080037#define KGSL_CMD_FLAGS_EOF 0x00000100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070038
39/* Command identifiers */
Shubhraprakash Dasd23ff4b2012-04-05 16:55:54 -060040#define KGSL_CONTEXT_TO_MEM_IDENTIFIER 0x2EADBEEF
41#define KGSL_CMD_IDENTIFIER 0x2EEDFACE
42#define KGSL_START_OF_IB_IDENTIFIER 0x2EADEABE
43#define KGSL_END_OF_IB_IDENTIFIER 0x2ABEDEAD
Tarun Karradeeecc02013-01-21 23:42:17 -080044#define KGSL_END_OF_FRAME_IDENTIFIER 0x2E0F2E0F
45#define KGSL_NOP_IB_IDENTIFIER 0x20F20F20
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046
47#ifdef CONFIG_MSM_SCM
48#define ADRENO_DEFAULT_PWRSCALE_POLICY (&kgsl_pwrscale_policy_tz)
Lynus Vaz31754cb2012-02-22 18:07:02 +053049#elif defined CONFIG_MSM_SLEEP_STATS_DEVICE
50#define ADRENO_DEFAULT_PWRSCALE_POLICY (&kgsl_pwrscale_policy_idlestats)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#else
52#define ADRENO_DEFAULT_PWRSCALE_POLICY NULL
53#endif
54
Harsh Vardhan Dwivedi715fb832012-05-18 00:24:18 -060055void adreno_debugfs_init(struct kgsl_device *device);
56
Jordan Crousec6b3a992012-02-04 10:23:51 -070057#define ADRENO_ISTORE_START 0x5000 /* Istore offset */
Jeremy Gebbenddf6b572011-09-09 13:39:49 -070058
Shubhraprakash Das4624b552012-06-01 14:08:03 -060059#define ADRENO_NUM_CTX_SWITCH_ALLOWED_BEFORE_DRAW 50
60
Jordan Crousea29a2e02012-08-14 09:09:23 -060061/* One cannot wait forever for the core to idle, so set an upper limit to the
62 * amount of time to wait for the core to go idle
63 */
64
65#define ADRENO_IDLE_TIMEOUT (20 * 1000)
66
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070067enum adreno_gpurev {
68 ADRENO_REV_UNKNOWN = 0,
69 ADRENO_REV_A200 = 200,
Ranjhith Kalisamy938e00f2012-02-17 14:39:47 +053070 ADRENO_REV_A203 = 203,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071 ADRENO_REV_A205 = 205,
72 ADRENO_REV_A220 = 220,
73 ADRENO_REV_A225 = 225,
Sudhakara Rao Tentu79853832012-03-06 15:52:38 +053074 ADRENO_REV_A305 = 305,
Jordan Crouseb4d31bd2012-02-01 22:11:12 -070075 ADRENO_REV_A320 = 320,
liu zhongfd42e622012-05-01 19:18:30 -070076 ADRENO_REV_A330 = 330,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077};
78
Jordan Crousea78c9172011-07-11 13:14:09 -060079struct adreno_gpudev;
80
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081struct adreno_device {
82 struct kgsl_device dev; /* Must be first field in this struct */
83 unsigned int chip_id;
84 enum adreno_gpurev gpurev;
Jordan Crouse7501d452012-04-19 08:58:44 -060085 unsigned long gmem_base;
86 unsigned int gmem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087 struct adreno_context *drawctxt_active;
Jordan Crouse505df9c2011-07-28 08:37:59 -060088 const char *pfp_fwfile;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089 unsigned int *pfp_fw;
90 size_t pfp_fw_size;
Tarun Karra9c070822012-11-27 16:43:51 -070091 unsigned int pfp_fw_version;
Jordan Crouse505df9c2011-07-28 08:37:59 -060092 const char *pm4_fwfile;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093 unsigned int *pm4_fw;
94 size_t pm4_fw_size;
Tarun Karra9c070822012-11-27 16:43:51 -070095 unsigned int pm4_fw_version;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096 struct adreno_ringbuffer ringbuffer;
97 unsigned int mharb;
Jordan Crousea78c9172011-07-11 13:14:09 -060098 struct adreno_gpudev *gpudev;
Ranjhith Kalisamy823c1482011-09-05 20:31:07 +053099 unsigned int wait_timeout;
Jeremy Gebbenddf6b572011-09-09 13:39:49 -0700100 unsigned int istore_size;
101 unsigned int pix_shader_start;
Jordan Crousec6b3a992012-02-04 10:23:51 -0700102 unsigned int instruction_size;
Jeremy Gebbend0ab6ad2012-04-06 11:13:35 -0600103 unsigned int ib_check_level;
Tarun Karra3335f142012-06-19 14:11:48 -0700104 unsigned int fast_hang_detect;
Tarun Karradeeecc02013-01-21 23:42:17 -0800105 unsigned int ft_policy;
Tarun Karra987e2f72013-02-14 12:12:22 -0800106 unsigned int ft_user_control;
Tarun Karra696f89e2013-01-27 21:31:40 -0800107 unsigned int long_ib_detect;
108 unsigned int long_ib;
109 unsigned int long_ib_ts;
Tarun Karra99678f82013-02-13 13:57:25 -0800110 unsigned int ft_pf_policy;
Tarun Karra9c070822012-11-27 16:43:51 -0700111 unsigned int gpulist_index;
liu zhong7dfa2a32012-04-27 19:11:01 -0700112 struct ocmem_buf *ocmem_hdl;
liu zhong5af32d92012-08-29 14:36:36 -0600113 unsigned int ocmem_base;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700114};
115
Jordan Crousea78c9172011-07-11 13:14:09 -0600116struct adreno_gpudev {
Jordan Crouseb4d31bd2012-02-01 22:11:12 -0700117 /*
118 * These registers are in a different location on A3XX, so define
119 * them in the structure and use them as variables.
120 */
121 unsigned int reg_rbbm_status;
122 unsigned int reg_cp_pfp_ucode_data;
123 unsigned int reg_cp_pfp_ucode_addr;
Shubhraprakash Das4624b552012-06-01 14:08:03 -0600124 /* keeps track of when we need to execute the draw workaround code */
125 int ctx_switches_since_last_draw;
Jordan Crouseb4d31bd2012-02-01 22:11:12 -0700126
127 /* GPU specific function hooks */
Vijay Krishnamoorthybef66932012-01-24 09:32:05 -0700128 int (*ctxt_create)(struct adreno_device *, struct adreno_context *);
Jordan Crousea78c9172011-07-11 13:14:09 -0600129 void (*ctxt_save)(struct adreno_device *, struct adreno_context *);
130 void (*ctxt_restore)(struct adreno_device *, struct adreno_context *);
Shubhraprakash Dasb2abc452012-06-08 16:33:03 -0600131 void (*ctxt_draw_workaround)(struct adreno_device *,
132 struct adreno_context *);
Jordan Crousea78c9172011-07-11 13:14:09 -0600133 irqreturn_t (*irq_handler)(struct adreno_device *);
134 void (*irq_control)(struct adreno_device *, int);
Jordan Crouseab601992013-03-05 11:18:20 -0700135 unsigned int (*irq_pending)(struct adreno_device *);
Jordan Crouse156cfbc2012-01-24 09:32:04 -0700136 void * (*snapshot)(struct adreno_device *, void *, int *, int);
Jordan Crouseb4d31bd2012-02-01 22:11:12 -0700137 void (*rb_init)(struct adreno_device *, struct adreno_ringbuffer *);
138 void (*start)(struct adreno_device *);
139 unsigned int (*busy_cycles)(struct adreno_device *);
Jordan Crousea78c9172011-07-11 13:14:09 -0600140};
141
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600142/*
Tarun Karrad20d71a2013-01-25 15:38:57 -0800143 * struct adreno_ft_data - Structure that contains all information to
144 * perform gpu fault tolerance
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600145 * @ib1 - IB1 that the GPU was executing when hang happened
146 * @context_id - Context which caused the hang
147 * @global_eop - eoptimestamp at time of hang
148 * @rb_buffer - Buffer that holds the commands from good contexts
149 * @rb_size - Number of valid dwords in rb_buffer
150 * @bad_rb_buffer - Buffer that holds commands from the hanging context
151 * bad_rb_size - Number of valid dwords in bad_rb_buffer
Tarun Karradeeecc02013-01-21 23:42:17 -0800152 * @good_rb_buffer - Buffer that holds commands from good contexts
153 * good_rb_size - Number of valid dwords in good_rb_buffer
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600154 * @last_valid_ctx_id - The last context from which commands were placed in
155 * ringbuffer before the GPU hung
Tarun Karrad20d71a2013-01-25 15:38:57 -0800156 * @step - Current fault tolerance step being executed
157 * @err_code - Fault tolerance error code
Shubhraprakash Das2747cf62012-09-27 23:05:43 -0700158 * @fault - Indicates whether the hang was caused due to a pagefault
Shubhraprakash Das460cc762013-01-16 16:57:46 -0800159 * @start_of_replay_cmds - Offset in ringbuffer from where commands can be
Tarun Karrad20d71a2013-01-25 15:38:57 -0800160 * replayed during fault tolerance
Shubhraprakash Das460cc762013-01-16 16:57:46 -0800161 * @replay_for_snapshot - Offset in ringbuffer where IB's can be saved for
162 * replaying with snapshot
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600163 */
Tarun Karrad20d71a2013-01-25 15:38:57 -0800164struct adreno_ft_data {
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600165 unsigned int ib1;
166 unsigned int context_id;
167 unsigned int global_eop;
168 unsigned int *rb_buffer;
169 unsigned int rb_size;
170 unsigned int *bad_rb_buffer;
171 unsigned int bad_rb_size;
Tarun Karradeeecc02013-01-21 23:42:17 -0800172 unsigned int *good_rb_buffer;
173 unsigned int good_rb_size;
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600174 unsigned int last_valid_ctx_id;
Tarun Karra3164fb02013-02-05 15:38:51 -0800175 unsigned int status;
176 unsigned int ft_policy;
177 unsigned int err_code;
Shubhraprakash Das460cc762013-01-16 16:57:46 -0800178 unsigned int start_of_replay_cmds;
179 unsigned int replay_for_snapshot;
Shubhraprakash Dasba6c70b2012-05-31 02:53:06 -0600180};
181
Jordan Crousea78c9172011-07-11 13:14:09 -0600182extern struct adreno_gpudev adreno_a2xx_gpudev;
Jordan Crouseb4d31bd2012-02-01 22:11:12 -0700183extern struct adreno_gpudev adreno_a3xx_gpudev;
Jordan Crousea78c9172011-07-11 13:14:09 -0600184
Jordan Crousef7597bf2012-01-03 08:43:34 -0700185/* A2XX register sets defined in adreno_a2xx.c */
186extern const unsigned int a200_registers[];
187extern const unsigned int a220_registers[];
Jeremy Gebben6be78d12012-03-07 16:02:47 -0700188extern const unsigned int a225_registers[];
Jordan Crousef7597bf2012-01-03 08:43:34 -0700189extern const unsigned int a200_registers_count;
190extern const unsigned int a220_registers_count;
Jeremy Gebben6be78d12012-03-07 16:02:47 -0700191extern const unsigned int a225_registers_count;
Jordan Crousef7597bf2012-01-03 08:43:34 -0700192
Jordan Crouse0c2761a2012-02-01 22:11:12 -0700193/* A3XX register set defined in adreno_a3xx.c */
194extern const unsigned int a3xx_registers[];
195extern const unsigned int a3xx_registers_count;
196
Carter Cooperf294e892012-11-26 10:45:53 -0700197extern const unsigned int a3xx_hlsq_registers[];
198extern const unsigned int a3xx_hlsq_registers_count;
199
Jordan Crouse99839252012-08-14 14:33:42 -0600200extern const unsigned int a330_registers[];
201extern const unsigned int a330_registers_count;
202
Tarun Karra696f89e2013-01-27 21:31:40 -0800203extern unsigned int ft_detect_regs[];
204extern const unsigned int ft_detect_regs_count;
Tarun Karra3335f142012-06-19 14:11:48 -0700205
206
Jordan Crousea29a2e02012-08-14 09:09:23 -0600207int adreno_idle(struct kgsl_device *device);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208void adreno_regread(struct kgsl_device *device, unsigned int offsetwords,
209 unsigned int *value);
210void adreno_regwrite(struct kgsl_device *device, unsigned int offsetwords,
211 unsigned int value);
212
Harsh Vardhan Dwivedi715fb832012-05-18 00:24:18 -0600213int adreno_dump(struct kgsl_device *device, int manual);
214
Harsh Vardhan Dwivedi8cb835b2012-03-29 17:23:11 -0600215struct kgsl_memdesc *adreno_find_region(struct kgsl_device *device,
Jeremy Gebben16e80fa2011-11-30 15:56:29 -0700216 unsigned int pt_base,
217 unsigned int gpuaddr,
218 unsigned int size);
219
220uint8_t *adreno_convertaddr(struct kgsl_device *device,
221 unsigned int pt_base, unsigned int gpuaddr, unsigned int size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700222
Jordan Crouse233b2092012-04-18 09:31:09 -0600223struct kgsl_memdesc *adreno_find_ctxtmem(struct kgsl_device *device,
224 unsigned int pt_base, unsigned int gpuaddr, unsigned int size);
225
Jordan Crouse156cfbc2012-01-24 09:32:04 -0700226void *adreno_snapshot(struct kgsl_device *device, void *snapshot, int *remain,
227 int hang);
228
Tarun Karrad20d71a2013-01-25 15:38:57 -0800229int adreno_dump_and_exec_ft(struct kgsl_device *device);
230
231void adreno_dump_rb(struct kgsl_device *device, const void *buf,
232 size_t len, int start, int size);
Shubhraprakash Dasb2abc452012-06-08 16:33:03 -0600233
Tarun Karra696f89e2013-01-27 21:31:40 -0800234unsigned int adreno_ft_detect(struct kgsl_device *device,
Tarun Karra3335f142012-06-19 14:11:48 -0700235 unsigned int *prev_reg_val);
236
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700237static inline int adreno_is_a200(struct adreno_device *adreno_dev)
238{
239 return (adreno_dev->gpurev == ADRENO_REV_A200);
240}
241
Ranjhith Kalisamy938e00f2012-02-17 14:39:47 +0530242static inline int adreno_is_a203(struct adreno_device *adreno_dev)
243{
244 return (adreno_dev->gpurev == ADRENO_REV_A203);
245}
246
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700247static inline int adreno_is_a205(struct adreno_device *adreno_dev)
248{
Ranjhith Kalisamy938e00f2012-02-17 14:39:47 +0530249 return (adreno_dev->gpurev == ADRENO_REV_A205);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700250}
251
252static inline int adreno_is_a20x(struct adreno_device *adreno_dev)
253{
Ranjhith Kalisamy938e00f2012-02-17 14:39:47 +0530254 return (adreno_dev->gpurev <= 209);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255}
256
257static inline int adreno_is_a220(struct adreno_device *adreno_dev)
258{
259 return (adreno_dev->gpurev == ADRENO_REV_A220);
260}
261
262static inline int adreno_is_a225(struct adreno_device *adreno_dev)
263{
264 return (adreno_dev->gpurev == ADRENO_REV_A225);
265}
266
267static inline int adreno_is_a22x(struct adreno_device *adreno_dev)
268{
269 return (adreno_dev->gpurev == ADRENO_REV_A220 ||
270 adreno_dev->gpurev == ADRENO_REV_A225);
271}
272
Jordan Crouse196c45b2011-07-28 08:37:57 -0600273static inline int adreno_is_a2xx(struct adreno_device *adreno_dev)
274{
Jordan Crouseb4d31bd2012-02-01 22:11:12 -0700275 return (adreno_dev->gpurev <= 299);
276}
277
278static inline int adreno_is_a3xx(struct adreno_device *adreno_dev)
279{
280 return (adreno_dev->gpurev >= 300);
Jordan Crouse196c45b2011-07-28 08:37:57 -0600281}
282
Kevin Matlage48d0e2e2012-04-26 10:52:36 -0600283static inline int adreno_is_a305(struct adreno_device *adreno_dev)
284{
285 return (adreno_dev->gpurev == ADRENO_REV_A305);
286}
287
288static inline int adreno_is_a320(struct adreno_device *adreno_dev)
289{
290 return (adreno_dev->gpurev == ADRENO_REV_A320);
291}
292
Jordan Crousec0978202012-08-29 14:35:51 -0600293static inline int adreno_is_a330(struct adreno_device *adreno_dev)
294{
295 return (adreno_dev->gpurev == ADRENO_REV_A330);
296}
297
Jordan Crousee6b77622012-04-05 16:55:54 -0600298static inline int adreno_rb_ctxtswitch(unsigned int *cmd)
299{
300 return (cmd[0] == cp_nop_packet(1) &&
301 cmd[1] == KGSL_CONTEXT_TO_MEM_IDENTIFIER);
302}
303
Jeremy Gebbenddf6b572011-09-09 13:39:49 -0700304/**
305 * adreno_encode_istore_size - encode istore size in CP format
306 * @adreno_dev - The 3D device.
307 *
308 * Encode the istore size into the format expected that the
309 * CP_SET_SHADER_BASES and CP_ME_INIT commands:
310 * bits 31:29 - istore size as encoded by this function
311 * bits 27:16 - vertex shader start offset in instructions
312 * bits 11:0 - pixel shader start offset in instructions.
313 */
314static inline int adreno_encode_istore_size(struct adreno_device *adreno_dev)
315{
316 unsigned int size;
317 /* in a225 the CP microcode multiplies the encoded
318 * value by 3 while decoding.
319 */
320 if (adreno_is_a225(adreno_dev))
321 size = adreno_dev->istore_size/3;
322 else
323 size = adreno_dev->istore_size;
324
325 return (ilog2(size) - 5) << 29;
326}
Jordan Crouse196c45b2011-07-28 08:37:57 -0600327
Shubhraprakash Dasc6e21012012-05-11 17:24:51 -0600328static inline int __adreno_add_idle_indirect_cmds(unsigned int *cmds,
329 unsigned int nop_gpuaddr)
330{
331 /* Adding an indirect buffer ensures that the prefetch stalls until
332 * the commands in indirect buffer have completed. We need to stall
333 * prefetch with a nop indirect buffer when updating pagetables
334 * because it provides stabler synchronization */
335 *cmds++ = CP_HDR_INDIRECT_BUFFER_PFD;
336 *cmds++ = nop_gpuaddr;
337 *cmds++ = 2;
338 *cmds++ = cp_type3_packet(CP_WAIT_FOR_IDLE, 1);
339 *cmds++ = 0x00000000;
340 return 5;
341}
342
343static inline int adreno_add_change_mh_phys_limit_cmds(unsigned int *cmds,
344 unsigned int new_phys_limit,
345 unsigned int nop_gpuaddr)
346{
347 unsigned int *start = cmds;
348
Shubhraprakash Dasc6e21012012-05-11 17:24:51 -0600349 *cmds++ = cp_type0_packet(MH_MMU_MPU_END, 1);
350 *cmds++ = new_phys_limit;
351 cmds += __adreno_add_idle_indirect_cmds(cmds, nop_gpuaddr);
352 return cmds - start;
353}
354
355static inline int adreno_add_bank_change_cmds(unsigned int *cmds,
356 int cur_ctx_bank,
357 unsigned int nop_gpuaddr)
358{
359 unsigned int *start = cmds;
360
Shubhraprakash Dasc6e21012012-05-11 17:24:51 -0600361 *cmds++ = cp_type0_packet(REG_CP_STATE_DEBUG_INDEX, 1);
362 *cmds++ = (cur_ctx_bank ? 0 : 0x20);
363 cmds += __adreno_add_idle_indirect_cmds(cmds, nop_gpuaddr);
364 return cmds - start;
365}
366
367/*
368 * adreno_read_cmds - Add pm4 packets to perform read
369 * @device - Pointer to device structure
370 * @cmds - Pointer to memory where read commands need to be added
371 * @addr - gpu address of the read
372 * @val - The GPU will wait until the data at address addr becomes
373 * equal to value
374 */
375static inline int adreno_add_read_cmds(struct kgsl_device *device,
376 unsigned int *cmds, unsigned int addr,
377 unsigned int val, unsigned int nop_gpuaddr)
378{
379 unsigned int *start = cmds;
380
381 *cmds++ = cp_type3_packet(CP_WAIT_REG_MEM, 5);
382 /* MEM SPACE = memory, FUNCTION = equals */
383 *cmds++ = 0x13;
384 *cmds++ = addr;
385 *cmds++ = val;
386 *cmds++ = 0xFFFFFFFF;
387 *cmds++ = 0xFFFFFFFF;
388 cmds += __adreno_add_idle_indirect_cmds(cmds, nop_gpuaddr);
389 return cmds - start;
390}
391
Tarun Karra9c070822012-11-27 16:43:51 -0700392/*
393 * adreno_idle_cmds - Add pm4 packets for GPU idle
394 * @adreno_dev - Pointer to device structure
395 * @cmds - Pointer to memory where idle commands need to be added
396 */
397static inline int adreno_add_idle_cmds(struct adreno_device *adreno_dev,
398 unsigned int *cmds)
399{
400 unsigned int *start = cmds;
401
402 *cmds++ = cp_type3_packet(CP_WAIT_FOR_IDLE, 1);
403 *cmds++ = 0x00000000;
404
405 if ((adreno_dev->gpurev == ADRENO_REV_A305) ||
406 (adreno_dev->gpurev == ADRENO_REV_A320)) {
407 *cmds++ = cp_type3_packet(CP_WAIT_FOR_ME, 1);
408 *cmds++ = 0x00000000;
409 }
410
411 return cmds - start;
412}
413
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414#endif /*__ADRENO_H */