msm: kgsl: Move the GPU register lists to a common location
Move the GPU register lists to a common location so they can be used
by multiple sub-systems. To avoid confusion, convert the lists from
byte offsets to dword offsets to match how we do register offsets
throughout the entire driver and in user space.
Change-Id: Ic0dedbad0f320242b77231a444939f9c6d852976
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.h b/drivers/gpu/msm/adreno.h
index 99c6c52..a3d2c00 100644
--- a/drivers/gpu/msm/adreno.h
+++ b/drivers/gpu/msm/adreno.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -88,6 +88,12 @@
extern struct adreno_gpudev adreno_a2xx_gpudev;
+/* A2XX register sets defined in adreno_a2xx.c */
+extern const unsigned int a200_registers[];
+extern const unsigned int a220_registers[];
+extern const unsigned int a200_registers_count;
+extern const unsigned int a220_registers_count;
+
int adreno_idle(struct kgsl_device *device, unsigned int timeout);
void adreno_regread(struct kgsl_device *device, unsigned int offsetwords,
unsigned int *value);
diff --git a/drivers/gpu/msm/adreno_a2xx.c b/drivers/gpu/msm/adreno_a2xx.c
index d083586..16402c3 100644
--- a/drivers/gpu/msm/adreno_a2xx.c
+++ b/drivers/gpu/msm/adreno_a2xx.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002,2007-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2002,2007-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -18,6 +18,74 @@
#include "adreno_a2xx_trace.h"
/*
+ * These are the registers that are dumped with GPU snapshot
+ * and postmortem. The lists are dword offset pairs in the
+ * form of {start offset, end offset} inclusive.
+ */
+
+/* A200, A205 */
+const unsigned int a200_registers[] = {
+ 0x0000, 0x0002, 0x0004, 0x000B, 0x003B, 0x003D, 0x0040, 0x0044,
+ 0x0046, 0x0047, 0x01C0, 0x01C1, 0x01C3, 0x01C8, 0x01D5, 0x01D9,
+ 0x01DC, 0x01DD, 0x01EA, 0x01EA, 0x01EE, 0x01F3, 0x01F6, 0x01F7,
+ 0x01FC, 0x01FF, 0x0391, 0x0392, 0x039B, 0x039E, 0x03B2, 0x03B5,
+ 0x03B7, 0x03B7, 0x03F8, 0x03FB, 0x0440, 0x0440, 0x0443, 0x0444,
+ 0x044B, 0x044B, 0x044D, 0x044F, 0x0452, 0x0452, 0x0454, 0x045B,
+ 0x047F, 0x047F, 0x0578, 0x0587, 0x05C9, 0x05C9, 0x05D0, 0x05D0,
+ 0x0601, 0x0604, 0x0606, 0x0609, 0x060B, 0x060E, 0x0613, 0x0614,
+ 0x0A29, 0x0A2B, 0x0A2F, 0x0A31, 0x0A40, 0x0A43, 0x0A45, 0x0A45,
+ 0x0A4E, 0x0A4F, 0x0C2C, 0x0C2C, 0x0C30, 0x0C30, 0x0C38, 0x0C3C,
+ 0x0C40, 0x0C40, 0x0C44, 0x0C44, 0x0C80, 0x0C86, 0x0C88, 0x0C94,
+ 0x0C99, 0x0C9A, 0x0CA4, 0x0CA5, 0x0D00, 0x0D03, 0x0D06, 0x0D06,
+ 0x0D08, 0x0D0B, 0x0D34, 0x0D35, 0x0DAE, 0x0DC1, 0x0DC8, 0x0DD4,
+ 0x0DD8, 0x0DD9, 0x0E00, 0x0E00, 0x0E02, 0x0E04, 0x0E17, 0x0E1E,
+ 0x0EC0, 0x0EC9, 0x0ECB, 0x0ECC, 0x0ED0, 0x0ED0, 0x0ED4, 0x0ED7,
+ 0x0EE0, 0x0EE2, 0x0F01, 0x0F02, 0x0F0C, 0x0F0C, 0x0F0E, 0x0F12,
+ 0x0F26, 0x0F2A, 0x0F2C, 0x0F2C, 0x2000, 0x2002, 0x2006, 0x200F,
+ 0x2080, 0x2082, 0x2100, 0x2109, 0x210C, 0x2114, 0x2180, 0x2184,
+ 0x21F5, 0x21F7, 0x2200, 0x2208, 0x2280, 0x2283, 0x2293, 0x2294,
+ 0x2300, 0x2308, 0x2312, 0x2312, 0x2316, 0x231D, 0x2324, 0x2326,
+ 0x2380, 0x2383, 0x2400, 0x2402, 0x2406, 0x240F, 0x2480, 0x2482,
+ 0x2500, 0x2509, 0x250C, 0x2514, 0x2580, 0x2584, 0x25F5, 0x25F7,
+ 0x2600, 0x2608, 0x2680, 0x2683, 0x2693, 0x2694, 0x2700, 0x2708,
+ 0x2712, 0x2712, 0x2716, 0x271D, 0x2724, 0x2726, 0x2780, 0x2783,
+ 0x4000, 0x4003, 0x4800, 0x4805, 0x4900, 0x4900, 0x4908, 0x4908,
+};
+
+/* A220, A225 */
+const unsigned int a220_registers[] = {
+ 0x0000, 0x0002, 0x0004, 0x000B, 0x003B, 0x003D, 0x0040, 0x0044,
+ 0x0046, 0x0047, 0x01C0, 0x01C1, 0x01C3, 0x01C8, 0x01D5, 0x01D9,
+ 0x01DC, 0x01DD, 0x01EA, 0x01EA, 0x01EE, 0x01F3, 0x01F6, 0x01F7,
+ 0x01FC, 0x01FF, 0x0391, 0x0392, 0x039B, 0x039E, 0x03B2, 0x03B5,
+ 0x03B7, 0x03B7, 0x03F8, 0x03FB, 0x0440, 0x0440, 0x0443, 0x0444,
+ 0x044B, 0x044B, 0x044D, 0x044F, 0x0452, 0x0452, 0x0454, 0x045B,
+ 0x047F, 0x047F, 0x0578, 0x0587, 0x05C9, 0x05C9, 0x05D0, 0x05D0,
+ 0x0601, 0x0604, 0x0606, 0x0609, 0x060B, 0x060E, 0x0613, 0x0614,
+ 0x0A29, 0x0A2B, 0x0A2F, 0x0A31, 0x0A40, 0x0A40, 0x0A42, 0x0A43,
+ 0x0A45, 0x0A45, 0x0A4E, 0x0A4F, 0x0C30, 0x0C30, 0x0C38, 0x0C39,
+ 0x0C3C, 0x0C3C, 0x0C80, 0x0C81, 0x0C88, 0x0C93, 0x0D00, 0x0D03,
+ 0x0D05, 0x0D06, 0x0D08, 0x0D0B, 0x0D34, 0x0D35, 0x0DAE, 0x0DC1,
+ 0x0DC8, 0x0DD4, 0x0DD8, 0x0DD9, 0x0E00, 0x0E00, 0x0E02, 0x0E04,
+ 0x0E17, 0x0E1E, 0x0EC0, 0x0EC9, 0x0ECB, 0x0ECC, 0x0ED0, 0x0ED0,
+ 0x0ED4, 0x0ED7, 0x0EE0, 0x0EE2, 0x0F01, 0x0F02, 0x2000, 0x2002,
+ 0x2006, 0x200F, 0x2080, 0x2082, 0x2100, 0x2102, 0x2104, 0x2109,
+ 0x210C, 0x2114, 0x2180, 0x2184, 0x21F5, 0x21F7, 0x2200, 0x2202,
+ 0x2204, 0x2204, 0x2208, 0x2208, 0x2280, 0x2282, 0x2294, 0x2294,
+ 0x2300, 0x2308, 0x2309, 0x230A, 0x2312, 0x2312, 0x2316, 0x2316,
+ 0x2318, 0x231D, 0x2324, 0x2326, 0x2380, 0x2383, 0x2400, 0x2402,
+ 0x2406, 0x240F, 0x2480, 0x2482, 0x2500, 0x2502, 0x2504, 0x2509,
+ 0x250C, 0x2514, 0x2580, 0x2584, 0x25F5, 0x25F7, 0x2600, 0x2602,
+ 0x2604, 0x2606, 0x2608, 0x2608, 0x2680, 0x2682, 0x2694, 0x2694,
+ 0x2700, 0x2708, 0x2712, 0x2712, 0x2716, 0x2716, 0x2718, 0x271D,
+ 0x2724, 0x2726, 0x2780, 0x2783, 0x4000, 0x4003, 0x4800, 0x4805,
+ 0x4900, 0x4900, 0x4908, 0x4908,
+};
+
+const unsigned int a200_registers_count = ARRAY_SIZE(a200_registers) / 2;
+const unsigned int a220_registers_count = ARRAY_SIZE(a220_registers) / 2;
+
+/*
*
* Memory Map for Register, Constant & Instruction Shadow, and Command Buffers
* (34.5KB)
diff --git a/drivers/gpu/msm/adreno_postmortem.c b/drivers/gpu/msm/adreno_postmortem.c
index aafef21..40dfb30 100644
--- a/drivers/gpu/msm/adreno_postmortem.c
+++ b/drivers/gpu/msm/adreno_postmortem.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -69,95 +69,6 @@
{CP_WAIT_FOR_IDLE, "WAIT4IDL"},
};
-/* Offset address pairs: start, end of range to dump (inclusive) */
-
-/* GPU < Z470 */
-
-static const int a200_registers[] = {
- 0x0000, 0x0008, 0x0010, 0x002c, 0x00ec, 0x00f4,
- 0x0100, 0x0110, 0x0118, 0x011c,
- 0x0700, 0x0704, 0x070c, 0x0720, 0x0754, 0x0764,
- 0x0770, 0x0774, 0x07a8, 0x07a8, 0x07b8, 0x07cc,
- 0x07d8, 0x07dc, 0x07f0, 0x07fc, 0x0e44, 0x0e48,
- 0x0e6c, 0x0e78, 0x0ec8, 0x0ed4, 0x0edc, 0x0edc,
- 0x0fe0, 0x0fec, 0x1100, 0x1100,
-
- 0x110c, 0x1110, 0x112c, 0x112c, 0x1134, 0x113c,
- 0x1148, 0x1148, 0x1150, 0x116c, 0x11fc, 0x11fc,
- 0x15e0, 0x161c, 0x1724, 0x1724, 0x1740, 0x1740,
- 0x1804, 0x1810, 0x1818, 0x1824, 0x182c, 0x1838,
- 0x184c, 0x1850, 0x28a4, 0x28ac, 0x28bc, 0x28c4,
- 0x2900, 0x290c, 0x2914, 0x2914, 0x2938, 0x293c,
- 0x30b0, 0x30b0, 0x30c0, 0x30c0, 0x30e0, 0x30f0,
- 0x3100, 0x3100, 0x3110, 0x3110, 0x3200, 0x3218,
- 0x3220, 0x3250, 0x3264, 0x3268, 0x3290, 0x3294,
- 0x3400, 0x340c, 0x3418, 0x3418, 0x3420, 0x342c,
- 0x34d0, 0x34d4, 0x36b8, 0x3704, 0x3720, 0x3750,
- 0x3760, 0x3764, 0x3800, 0x3800, 0x3808, 0x3810,
- 0x385c, 0x3878, 0x3b00, 0x3b24, 0x3b2c, 0x3b30,
- 0x3b40, 0x3b40, 0x3b50, 0x3b5c, 0x3b80, 0x3b88,
- 0x3c04, 0x3c08, 0x3c30, 0x3c30, 0x3c38, 0x3c48,
- 0x3c98, 0x3ca8, 0x3cb0, 0x3cb0,
-
- 0x8000, 0x8008, 0x8018, 0x803c, 0x8200, 0x8208,
- 0x8400, 0x8424, 0x8430, 0x8450, 0x8600, 0x8610,
- 0x87d4, 0x87dc, 0x8800, 0x8820, 0x8a00, 0x8a0c,
- 0x8a4c, 0x8a50, 0x8c00, 0x8c20, 0x8c48, 0x8c48,
- 0x8c58, 0x8c74, 0x8c90, 0x8c98, 0x8e00, 0x8e0c,
-
- 0x9000, 0x9008, 0x9018, 0x903c, 0x9200, 0x9208,
- 0x9400, 0x9424, 0x9430, 0x9450, 0x9600, 0x9610,
- 0x97d4, 0x97dc, 0x9800, 0x9820, 0x9a00, 0x9a0c,
- 0x9a4c, 0x9a50, 0x9c00, 0x9c20, 0x9c48, 0x9c48,
- 0x9c58, 0x9c74, 0x9c90, 0x9c98, 0x9e00, 0x9e0c,
-
- 0x10000, 0x1000c, 0x12000, 0x12014,
- 0x12400, 0x12400, 0x12420, 0x12420
-};
-
-/* GPU = Z470 */
-
-static const int a220_registers[] = {
- 0x0000, 0x0008, 0x0010, 0x002c, 0x00ec, 0x00f4,
- 0x0100, 0x0110, 0x0118, 0x011c,
- 0x0700, 0x0704, 0x070c, 0x0720, 0x0754, 0x0764,
- 0x0770, 0x0774, 0x07a8, 0x07a8, 0x07b8, 0x07cc,
- 0x07d8, 0x07dc, 0x07f0, 0x07fc, 0x0e44, 0x0e48,
- 0x0e6c, 0x0e78, 0x0ec8, 0x0ed4, 0x0edc, 0x0edc,
- 0x0fe0, 0x0fec, 0x1100, 0x1100,
-
- 0x110c, 0x1110, 0x112c, 0x112c, 0x1134, 0x113c,
- 0x1148, 0x1148, 0x1150, 0x116c, 0x11fc, 0x11fc,
- 0x15e0, 0x161c, 0x1724, 0x1724, 0x1740, 0x1740,
- 0x1804, 0x1810, 0x1818, 0x1824, 0x182c, 0x1838,
- 0x184c, 0x1850, 0x28a4, 0x28ac, 0x28bc, 0x28c4,
- 0x2900, 0x2900, 0x2908, 0x290c, 0x2914, 0x2914,
- 0x2938, 0x293c, 0x30c0, 0x30c0, 0x30e0, 0x30e4,
- 0x30f0, 0x30f0, 0x3200, 0x3204, 0x3220, 0x324c,
- 0x3400, 0x340c, 0x3414, 0x3418, 0x3420, 0x342c,
- 0x34d0, 0x34d4, 0x36b8, 0x3704, 0x3720, 0x3750,
- 0x3760, 0x3764, 0x3800, 0x3800, 0x3808, 0x3810,
- 0x385c, 0x3878, 0x3b00, 0x3b24, 0x3b2c, 0x3b30,
- 0x3b40, 0x3b40, 0x3b50, 0x3b5c, 0x3b80, 0x3b88,
- 0x3c04, 0x3c08, 0x8000, 0x8008, 0x8018, 0x803c,
- 0x8200, 0x8208, 0x8400, 0x8408, 0x8410, 0x8424,
- 0x8430, 0x8450, 0x8600, 0x8610, 0x87d4, 0x87dc,
- 0x8800, 0x8808, 0x8810, 0x8810, 0x8820, 0x8820,
- 0x8a00, 0x8a08, 0x8a50, 0x8a50,
- 0x8c00, 0x8c20, 0x8c24, 0x8c28, 0x8c48, 0x8c48,
- 0x8c58, 0x8c58, 0x8c60, 0x8c74, 0x8c90, 0x8c98,
- 0x8e00, 0x8e0c, 0x9000, 0x9008, 0x9018, 0x903c,
- 0x9200, 0x9208, 0x9400, 0x9408, 0x9410, 0x9424,
- 0x9430, 0x9450, 0x9600, 0x9610, 0x97d4, 0x97dc,
- 0x9800, 0x9808, 0x9810, 0x9818, 0x9820, 0x9820,
- 0x9a00, 0x9a08, 0x9a50, 0x9a50, 0x9c00, 0x9c20,
- 0x9c48, 0x9c48, 0x9c58, 0x9c58, 0x9c60, 0x9c74,
- 0x9c90, 0x9c98, 0x9e00, 0x9e0c,
-
- 0x10000, 0x1000c, 0x12000, 0x12014,
- 0x12400, 0x12400, 0x12420, 0x12420
-};
-
static uint32_t adreno_is_pm4_len(uint32_t word)
{
if (word == INVALID_RB_CMD)
@@ -224,8 +135,8 @@
for (range = 0; range < size; range++) {
/* start and end are in dword offsets */
- int start = registers[range * 2] / 4;
- int end = registers[range * 2 + 1] / 4;
+ int start = registers[range * 2];
+ int end = registers[range * 2 + 1];
unsigned char linebuf[32 * 3 + 2 + 32 + 1];
int linelen, i;
@@ -240,7 +151,7 @@
hex_dump_to_buffer(regvals, linelen*4, 32, 4,
linebuf, sizeof(linebuf), 0);
KGSL_LOG_DUMP(device,
- "REG: %5.5X: %s\n", offset<<2, linebuf);
+ "REG: %5.5X: %s\n", offset, linebuf);
}
}
}
@@ -774,10 +685,10 @@
if (adreno_is_a20x(adreno_dev))
adreno_dump_regs(device, a200_registers,
- ARRAY_SIZE(a200_registers) / 2);
+ a200_registers_count);
else if (adreno_is_a22x(adreno_dev))
adreno_dump_regs(device, a220_registers,
- ARRAY_SIZE(a220_registers) / 2);
+ a220_registers_count);
error_vfree:
vfree(rb_copy);