From f31e04a96013c059fc90c98a878de14adbea524a Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Tue, 29 Apr 2008 19:34:22 +0200 Subject: nouveau: NV9x cards exist as well. --- shared-core/nouveau_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c index 555955d4..0183b0b4 100644 --- a/shared-core/nouveau_state.c +++ b/shared-core/nouveau_state.c @@ -243,6 +243,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) break; case 0x50: case 0x80: /* gotta love NVIDIA's consistency.. */ + case 0x90: engine->instmem.init = nv50_instmem_init; engine->instmem.takedown= nv50_instmem_takedown; engine->instmem.populate = nv50_instmem_populate; -- cgit v1.2.3 From cb33133ef354b77a8cf06b16ce95a0babbe8bc6f Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Tue, 29 Apr 2008 12:36:04 -0700 Subject: i915: fix off by one in VGA save/restore of AR & CR regs Turns out it's important to save/restore AR14 in particular. --- linux-core/i915_drv.c | 8 ++++---- shared-core/i915_drv.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c index 5a6f0adc..91c2da23 100644 --- a/linux-core/i915_drv.c +++ b/linux-core/i915_drv.c @@ -172,7 +172,7 @@ static void i915_save_vga(struct drm_device *dev) i915_write_indexed(cr_index, cr_data, 0x11, i915_read_indexed(cr_index, cr_data, 0x11) & (~0x80)); - for (i = 0; i < 0x24; i++) + for (i = 0; i <= 0x24; i++) dev_priv->saveCR[i] = i915_read_indexed(cr_index, cr_data, i); /* Make sure we don't turn off CR group 0 writes */ @@ -181,7 +181,7 @@ static void i915_save_vga(struct drm_device *dev) /* Attribute controller registers */ inb(st01); dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX); - for (i = 0; i < 20; i++) + for (i = 0; i <= 0x14; i++) dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); inb(st01); outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); @@ -231,7 +231,7 @@ static void i915_restore_vga(struct drm_device *dev) /* CRT controller regs */ /* Enable CR group 0 writes */ i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); - for (i = 0; i < 0x24; i++) + for (i = 0; i <= 0x24; i++) i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]); /* Graphics controller regs */ @@ -248,7 +248,7 @@ static void i915_restore_vga(struct drm_device *dev) /* Attribute controller registers */ inb(st01); /* switch back to index mode */ - for (i = 0; i < 20; i++) + for (i = 0; i <= 0x14; i++) i915_write_ar(st01, i, dev_priv->saveAR[i], 0); inb(st01); /* switch back to index mode */ outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h index 412a2594..aad74b1c 100644 --- a/shared-core/i915_drv.h +++ b/shared-core/i915_drv.h @@ -237,10 +237,10 @@ typedef struct drm_i915_private { u8 saveSR[8]; u8 saveGR[25]; u8 saveAR_INDEX; - u8 saveAR[20]; + u8 saveAR[21]; u8 saveDACMASK; u8 saveDACDATA[256*3]; /* 256 3-byte colors */ - u8 saveCR[36]; + u8 saveCR[37]; } drm_i915_private_t; enum intel_chip_family { -- cgit v1.2.3 From b92efd59565b9c63734b762b9d2be46447309007 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 1 May 2008 23:47:42 +1000 Subject: nv50: I cave... Add nv84 initial context values. I swore I'd actually do this properly and not go the horrible route we did with nv4x, but I won't get around to it just yet with so many *actually* interesting things to do first.. One day. Since someone already added nv86, why not! --- shared-core/nv50_graph.c | 1166 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1152 insertions(+), 14 deletions(-) diff --git a/shared-core/nv50_graph.c b/shared-core/nv50_graph.c index 17649ba0..ebe4b1f6 100644 --- a/shared-core/nv50_graph.c +++ b/shared-core/nv50_graph.c @@ -931,13 +931,1143 @@ nv86_graph_init_ctxvals(struct drm_device *dev, struct nouveau_gpuobj_ref *ref) } +static void +nv84_graph_init_ctxvals(struct drm_device *dev, struct nouveau_gpuobj_ref *ref) +{ + struct drm_nouveau_private *dev_priv = dev->dev_private; + struct nouveau_gpuobj *ctx = ref->gpuobj; + + INSTANCE_WR(ctx, 0x00000/4, 0x00000001); + INSTANCE_WR(ctx, 0x0010c/4, 0x00000030); + INSTANCE_WR(ctx, 0x00130/4, 0x00000002); + INSTANCE_WR(ctx, 0x001d4/4, 0x00000003); + INSTANCE_WR(ctx, 0x001d8/4, 0x00001000); + INSTANCE_WR(ctx, 0x00218/4, 0x0000fe0c); + INSTANCE_WR(ctx, 0x0022c/4, 0x00001000); + INSTANCE_WR(ctx, 0x00258/4, 0x00000187); + INSTANCE_WR(ctx, 0x0026c/4, 0x00001018); + INSTANCE_WR(ctx, 0x00270/4, 0x000000ff); + INSTANCE_WR(ctx, 0x002ac/4, 0x00000004); + INSTANCE_WR(ctx, 0x002b0/4, 0x044d00df); + INSTANCE_WR(ctx, 0x002b8/4, 0x00000600); + INSTANCE_WR(ctx, 0x002d0/4, 0x01000000); + INSTANCE_WR(ctx, 0x002d4/4, 0x000000ff); + INSTANCE_WR(ctx, 0x002dc/4, 0x00000400); + INSTANCE_WR(ctx, 0x002f4/4, 0x00000001); + INSTANCE_WR(ctx, 0x002f8/4, 0x000e0080); + INSTANCE_WR(ctx, 0x002fc/4, 0x00000004); + INSTANCE_WR(ctx, 0x00318/4, 0x00000002); + INSTANCE_WR(ctx, 0x0031c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00328/4, 0x00000001); + INSTANCE_WR(ctx, 0x0032c/4, 0x00000100); + INSTANCE_WR(ctx, 0x00344/4, 0x00000002); + INSTANCE_WR(ctx, 0x00348/4, 0x00000001); + INSTANCE_WR(ctx, 0x0034c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0035c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00360/4, 0x003fffff); + INSTANCE_WR(ctx, 0x00364/4, 0x00001fff); + INSTANCE_WR(ctx, 0x0036c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00370/4, 0x00000001); + INSTANCE_WR(ctx, 0x00378/4, 0x00000001); + INSTANCE_WR(ctx, 0x0037c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00380/4, 0x00000001); + INSTANCE_WR(ctx, 0x00384/4, 0x00000004); + INSTANCE_WR(ctx, 0x00388/4, 0x00000001); + INSTANCE_WR(ctx, 0x0038c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00390/4, 0x00000001); + INSTANCE_WR(ctx, 0x00394/4, 0x00000007); + INSTANCE_WR(ctx, 0x00398/4, 0x00000001); + INSTANCE_WR(ctx, 0x0039c/4, 0x00000007); + INSTANCE_WR(ctx, 0x003a0/4, 0x00000001); + INSTANCE_WR(ctx, 0x003a4/4, 0x00000001); + INSTANCE_WR(ctx, 0x003a8/4, 0x00000001); + INSTANCE_WR(ctx, 0x003bc/4, 0x00000001); + INSTANCE_WR(ctx, 0x003c0/4, 0x00000100); + INSTANCE_WR(ctx, 0x003c8/4, 0x00000001); + INSTANCE_WR(ctx, 0x003d4/4, 0x00000100); + INSTANCE_WR(ctx, 0x003d8/4, 0x00000001); + INSTANCE_WR(ctx, 0x003dc/4, 0x00000100); + INSTANCE_WR(ctx, 0x003e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x003f0/4, 0x00000100); + INSTANCE_WR(ctx, 0x00404/4, 0x00000004); + INSTANCE_WR(ctx, 0x00408/4, 0x00000070); + INSTANCE_WR(ctx, 0x0040c/4, 0x00000080); + INSTANCE_WR(ctx, 0x00420/4, 0x0000000c); + INSTANCE_WR(ctx, 0x00428/4, 0x00000008); + INSTANCE_WR(ctx, 0x0042c/4, 0x00000014); + INSTANCE_WR(ctx, 0x00434/4, 0x00000029); + INSTANCE_WR(ctx, 0x00438/4, 0x00000027); + INSTANCE_WR(ctx, 0x0043c/4, 0x00000026); + INSTANCE_WR(ctx, 0x00440/4, 0x00000008); + INSTANCE_WR(ctx, 0x00444/4, 0x00000004); + INSTANCE_WR(ctx, 0x00448/4, 0x00000027); + INSTANCE_WR(ctx, 0x00454/4, 0x00000001); + INSTANCE_WR(ctx, 0x00458/4, 0x00000002); + INSTANCE_WR(ctx, 0x0045c/4, 0x00000003); + INSTANCE_WR(ctx, 0x00460/4, 0x00000004); + INSTANCE_WR(ctx, 0x00464/4, 0x00000005); + INSTANCE_WR(ctx, 0x00468/4, 0x00000006); + INSTANCE_WR(ctx, 0x0046c/4, 0x00000007); + INSTANCE_WR(ctx, 0x00470/4, 0x00000001); + INSTANCE_WR(ctx, 0x004b4/4, 0x000000cf); + INSTANCE_WR(ctx, 0x004e4/4, 0x00000080); + INSTANCE_WR(ctx, 0x004e8/4, 0x00000004); + INSTANCE_WR(ctx, 0x004ec/4, 0x00000004); + INSTANCE_WR(ctx, 0x004f0/4, 0x00000003); + INSTANCE_WR(ctx, 0x004f4/4, 0x00000001); + INSTANCE_WR(ctx, 0x00500/4, 0x00000012); + INSTANCE_WR(ctx, 0x00504/4, 0x00000010); + INSTANCE_WR(ctx, 0x00508/4, 0x0000000c); + INSTANCE_WR(ctx, 0x0050c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0051c/4, 0x00000004); + INSTANCE_WR(ctx, 0x00520/4, 0x00000002); + INSTANCE_WR(ctx, 0x00524/4, 0x00000004); + INSTANCE_WR(ctx, 0x00530/4, 0x003fffff); + INSTANCE_WR(ctx, 0x00534/4, 0x00001fff); + INSTANCE_WR(ctx, 0x0055c/4, 0x00000004); + INSTANCE_WR(ctx, 0x00560/4, 0x00000014); + INSTANCE_WR(ctx, 0x00564/4, 0x00000001); + INSTANCE_WR(ctx, 0x00570/4, 0x00000002); + INSTANCE_WR(ctx, 0x0057c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00584/4, 0x00000002); + INSTANCE_WR(ctx, 0x00588/4, 0x00001000); + INSTANCE_WR(ctx, 0x0058c/4, 0x00000e00); + INSTANCE_WR(ctx, 0x00590/4, 0x00001000); + INSTANCE_WR(ctx, 0x00594/4, 0x00001e00); + INSTANCE_WR(ctx, 0x0059c/4, 0x00000001); + INSTANCE_WR(ctx, 0x005a0/4, 0x00000001); + INSTANCE_WR(ctx, 0x005a4/4, 0x00000001); + INSTANCE_WR(ctx, 0x005a8/4, 0x00000001); + INSTANCE_WR(ctx, 0x005ac/4, 0x00000001); + INSTANCE_WR(ctx, 0x005bc/4, 0x00000200); + INSTANCE_WR(ctx, 0x005c4/4, 0x00000001); + INSTANCE_WR(ctx, 0x005c8/4, 0x00000070); + INSTANCE_WR(ctx, 0x005cc/4, 0x00000080); + INSTANCE_WR(ctx, 0x005d8/4, 0x00000001); + INSTANCE_WR(ctx, 0x005dc/4, 0x00000070); + INSTANCE_WR(ctx, 0x005e0/4, 0x00000080); + INSTANCE_WR(ctx, 0x005f0/4, 0x00000001); + INSTANCE_WR(ctx, 0x005f4/4, 0x000000cf); + INSTANCE_WR(ctx, 0x005fc/4, 0x00000001); + INSTANCE_WR(ctx, 0x0060c/4, 0x000000cf); + INSTANCE_WR(ctx, 0x00614/4, 0x00000002); + INSTANCE_WR(ctx, 0x0061c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00624/4, 0x00000001); + INSTANCE_WR(ctx, 0x0062c/4, 0x000000cf); + INSTANCE_WR(ctx, 0x00630/4, 0x000000cf); + INSTANCE_WR(ctx, 0x00634/4, 0x00000001); + INSTANCE_WR(ctx, 0x0063c/4, 0x00000f80); + INSTANCE_WR(ctx, 0x00684/4, 0x007f0080); + INSTANCE_WR(ctx, 0x006c0/4, 0x007f0080); + + INSTANCE_WR(ctx, 0x006e4/4, 0x3b74f821); + INSTANCE_WR(ctx, 0x006e8/4, 0x89058001); + INSTANCE_WR(ctx, 0x006f0/4, 0x00001000); + INSTANCE_WR(ctx, 0x006f4/4, 0x0000001f); + INSTANCE_WR(ctx, 0x006f8/4, 0x027c10fa); + INSTANCE_WR(ctx, 0x006fc/4, 0x400000c0); + INSTANCE_WR(ctx, 0x00700/4, 0xb7892080); + + INSTANCE_WR(ctx, 0x0070c/4, 0x3b74f821); + INSTANCE_WR(ctx, 0x00710/4, 0x89058001); + INSTANCE_WR(ctx, 0x00718/4, 0x00001000); + INSTANCE_WR(ctx, 0x0071c/4, 0x0000001f); + INSTANCE_WR(ctx, 0x00720/4, 0x027c10fa); + INSTANCE_WR(ctx, 0x00724/4, 0x400000c0); + INSTANCE_WR(ctx, 0x00728/4, 0xb7892080); + + INSTANCE_WR(ctx, 0x00734/4, 0x3b74f821); + INSTANCE_WR(ctx, 0x00738/4, 0x89058001); + INSTANCE_WR(ctx, 0x00740/4, 0x00001000); + INSTANCE_WR(ctx, 0x00744/4, 0x0000001f); + INSTANCE_WR(ctx, 0x00748/4, 0x027c10fa); + INSTANCE_WR(ctx, 0x0074c/4, 0x400000c0); + INSTANCE_WR(ctx, 0x00750/4, 0xb7892080); + + INSTANCE_WR(ctx, 0x0075c/4, 0x3b74f821); + INSTANCE_WR(ctx, 0x00760/4, 0x89058001); + INSTANCE_WR(ctx, 0x00768/4, 0x00001000); + INSTANCE_WR(ctx, 0x0076c/4, 0x0000001f); + INSTANCE_WR(ctx, 0x00770/4, 0x027c10fa); + INSTANCE_WR(ctx, 0x00774/4, 0x400000c0); + INSTANCE_WR(ctx, 0x00778/4, 0xb7892080); + + INSTANCE_WR(ctx, 0x00784/4, 0x00010040); + INSTANCE_WR(ctx, 0x0078c/4, 0x00000022); + INSTANCE_WR(ctx, 0x00798/4, 0x00010040); + INSTANCE_WR(ctx, 0x0079c/4, 0x00000022); + + INSTANCE_WR(ctx, 0x007b4/4, 0x01800000); + INSTANCE_WR(ctx, 0x007b8/4, 0x00160000); + INSTANCE_WR(ctx, 0x007bc/4, 0x01800000); + INSTANCE_WR(ctx, 0x007cc/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x007d0/4, 0x00880000); + INSTANCE_WR(ctx, 0x007f4/4, 0x00010401); + INSTANCE_WR(ctx, 0x007fc/4, 0x00000078); + INSTANCE_WR(ctx, 0x00804/4, 0x000000bf); + INSTANCE_WR(ctx, 0x0080c/4, 0x00001210); + INSTANCE_WR(ctx, 0x00810/4, 0x08000080); + INSTANCE_WR(ctx, 0x00834/4, 0x01800000); + INSTANCE_WR(ctx, 0x00838/4, 0x00160000); + INSTANCE_WR(ctx, 0x0083c/4, 0x01800000); + INSTANCE_WR(ctx, 0x0084c/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00850/4, 0x00880000); + INSTANCE_WR(ctx, 0x00874/4, 0x00010401); + INSTANCE_WR(ctx, 0x0087c/4, 0x00000078); + INSTANCE_WR(ctx, 0x00884/4, 0x000000bf); + INSTANCE_WR(ctx, 0x0088c/4, 0x00001210); + INSTANCE_WR(ctx, 0x00890/4, 0x08000080); + INSTANCE_WR(ctx, 0x008b8/4, 0x00027070); + INSTANCE_WR(ctx, 0x008c4/4, 0x03ffffff); + INSTANCE_WR(ctx, 0x008dc/4, 0x00120407); + INSTANCE_WR(ctx, 0x008e0/4, 0x05091507); + INSTANCE_WR(ctx, 0x008e4/4, 0x05100202); + INSTANCE_WR(ctx, 0x008e8/4, 0x00030201); + INSTANCE_WR(ctx, 0x00904/4, 0x00000040); + INSTANCE_WR(ctx, 0x00908/4, 0x0d0c0b0a); + INSTANCE_WR(ctx, 0x0090c/4, 0x00141210); + INSTANCE_WR(ctx, 0x00910/4, 0x000001f0); + INSTANCE_WR(ctx, 0x00914/4, 0x00000001); + INSTANCE_WR(ctx, 0x00918/4, 0x00000003); + INSTANCE_WR(ctx, 0x00924/4, 0x00039e00); + INSTANCE_WR(ctx, 0x00928/4, 0x00000100); + INSTANCE_WR(ctx, 0x0092c/4, 0x00003800); + INSTANCE_WR(ctx, 0x00930/4, 0x00404040); + INSTANCE_WR(ctx, 0x00934/4, 0x0000ff0a); + INSTANCE_WR(ctx, 0x0093c/4, 0x0077f005); + INSTANCE_WR(ctx, 0x00940/4, 0x003f7fff); + + INSTANCE_WR(ctx, 0x00950/4, 0x01800000); + INSTANCE_WR(ctx, 0x00954/4, 0x00160000); + INSTANCE_WR(ctx, 0x00958/4, 0x01800000); + INSTANCE_WR(ctx, 0x00968/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x0096c/4, 0x00880000); + INSTANCE_WR(ctx, 0x00990/4, 0x00010401); + INSTANCE_WR(ctx, 0x00998/4, 0x00000078); + INSTANCE_WR(ctx, 0x009a0/4, 0x000000bf); + INSTANCE_WR(ctx, 0x009a8/4, 0x00001210); + INSTANCE_WR(ctx, 0x009ac/4, 0x08000080); + INSTANCE_WR(ctx, 0x009d0/4, 0x01800000); + INSTANCE_WR(ctx, 0x009d4/4, 0x00160000); + INSTANCE_WR(ctx, 0x009d8/4, 0x01800000); + INSTANCE_WR(ctx, 0x009e8/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x009ec/4, 0x00880000); + INSTANCE_WR(ctx, 0x00a10/4, 0x00010401); + INSTANCE_WR(ctx, 0x00a18/4, 0x00000078); + INSTANCE_WR(ctx, 0x00a20/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00a28/4, 0x00001210); + INSTANCE_WR(ctx, 0x00a2c/4, 0x08000080); + INSTANCE_WR(ctx, 0x00a54/4, 0x00027070); + INSTANCE_WR(ctx, 0x00a60/4, 0x03ffffff); + INSTANCE_WR(ctx, 0x00a78/4, 0x00120407); + INSTANCE_WR(ctx, 0x00a7c/4, 0x05091507); + INSTANCE_WR(ctx, 0x00a80/4, 0x05100202); + INSTANCE_WR(ctx, 0x00a84/4, 0x00030201); + INSTANCE_WR(ctx, 0x00aa0/4, 0x00000040); + INSTANCE_WR(ctx, 0x00aa4/4, 0x0d0c0b0a); + INSTANCE_WR(ctx, 0x00aa8/4, 0x00141210); + INSTANCE_WR(ctx, 0x00aac/4, 0x000001f0); + INSTANCE_WR(ctx, 0x00ab0/4, 0x00000001); + INSTANCE_WR(ctx, 0x00ab4/4, 0x00000003); + INSTANCE_WR(ctx, 0x00ac0/4, 0x00039e00); + INSTANCE_WR(ctx, 0x00ac4/4, 0x00000100); + INSTANCE_WR(ctx, 0x00ac8/4, 0x00003800); + INSTANCE_WR(ctx, 0x00acc/4, 0x00404040); + INSTANCE_WR(ctx, 0x00ad0/4, 0x0000ff0a); + INSTANCE_WR(ctx, 0x00ad8/4, 0x0077f005); + INSTANCE_WR(ctx, 0x00adc/4, 0x003f7fff); + + INSTANCE_WR(ctx, 0x00aec/4, 0x01800000); + INSTANCE_WR(ctx, 0x00af0/4, 0x00160000); + INSTANCE_WR(ctx, 0x00af4/4, 0x01800000); + INSTANCE_WR(ctx, 0x00b04/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00b08/4, 0x00880000); + INSTANCE_WR(ctx, 0x00b2c/4, 0x00010401); + INSTANCE_WR(ctx, 0x00b34/4, 0x00000078); + INSTANCE_WR(ctx, 0x00b3c/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00b44/4, 0x00001210); + INSTANCE_WR(ctx, 0x00b48/4, 0x08000080); + INSTANCE_WR(ctx, 0x00b6c/4, 0x01800000); + INSTANCE_WR(ctx, 0x00b70/4, 0x00160000); + INSTANCE_WR(ctx, 0x00b74/4, 0x01800000); + INSTANCE_WR(ctx, 0x00b84/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00b88/4, 0x00880000); + INSTANCE_WR(ctx, 0x00bac/4, 0x00010401); + INSTANCE_WR(ctx, 0x00bb4/4, 0x00000078); + INSTANCE_WR(ctx, 0x00bbc/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00bc4/4, 0x00001210); + INSTANCE_WR(ctx, 0x00bc8/4, 0x08000080); + INSTANCE_WR(ctx, 0x00bf0/4, 0x00027070); + INSTANCE_WR(ctx, 0x00bfc/4, 0x03ffffff); + INSTANCE_WR(ctx, 0x00c14/4, 0x00120407); + INSTANCE_WR(ctx, 0x00c18/4, 0x05091507); + INSTANCE_WR(ctx, 0x00c1c/4, 0x05100202); + INSTANCE_WR(ctx, 0x00c20/4, 0x00030201); + INSTANCE_WR(ctx, 0x00c3c/4, 0x00000040); + INSTANCE_WR(ctx, 0x00c40/4, 0x0d0c0b0a); + INSTANCE_WR(ctx, 0x00c44/4, 0x00141210); + INSTANCE_WR(ctx, 0x00c48/4, 0x000001f0); + INSTANCE_WR(ctx, 0x00c4c/4, 0x00000001); + INSTANCE_WR(ctx, 0x00c50/4, 0x00000003); + INSTANCE_WR(ctx, 0x00c5c/4, 0x00039e00); + INSTANCE_WR(ctx, 0x00c60/4, 0x00000100); + INSTANCE_WR(ctx, 0x00c64/4, 0x00003800); + INSTANCE_WR(ctx, 0x00c68/4, 0x00404040); + INSTANCE_WR(ctx, 0x00c6c/4, 0x0000ff0a); + INSTANCE_WR(ctx, 0x00c74/4, 0x0077f005); + INSTANCE_WR(ctx, 0x00c78/4, 0x003f7fff); + + INSTANCE_WR(ctx, 0x00c88/4, 0x01800000); + INSTANCE_WR(ctx, 0x00c8c/4, 0x00160000); + INSTANCE_WR(ctx, 0x00c90/4, 0x01800000); + INSTANCE_WR(ctx, 0x00ca0/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00ca4/4, 0x00880000); + INSTANCE_WR(ctx, 0x00cc8/4, 0x00010401); + INSTANCE_WR(ctx, 0x00cd0/4, 0x00000078); + INSTANCE_WR(ctx, 0x00cd8/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00ce0/4, 0x00001210); + INSTANCE_WR(ctx, 0x00ce4/4, 0x08000080); + INSTANCE_WR(ctx, 0x00d08/4, 0x01800000); + INSTANCE_WR(ctx, 0x00d0c/4, 0x00160000); + INSTANCE_WR(ctx, 0x00d10/4, 0x01800000); + INSTANCE_WR(ctx, 0x00d20/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00d24/4, 0x00880000); + INSTANCE_WR(ctx, 0x00d48/4, 0x00010401); + INSTANCE_WR(ctx, 0x00d50/4, 0x00000078); + INSTANCE_WR(ctx, 0x00d58/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00d60/4, 0x00001210); + INSTANCE_WR(ctx, 0x00d64/4, 0x08000080); + INSTANCE_WR(ctx, 0x00d8c/4, 0x00027070); + INSTANCE_WR(ctx, 0x00d98/4, 0x03ffffff); + INSTANCE_WR(ctx, 0x00db0/4, 0x00120407); + INSTANCE_WR(ctx, 0x00db4/4, 0x05091507); + INSTANCE_WR(ctx, 0x00db8/4, 0x05100202); + INSTANCE_WR(ctx, 0x00dbc/4, 0x00030201); + INSTANCE_WR(ctx, 0x00dd8/4, 0x00000040); + INSTANCE_WR(ctx, 0x00ddc/4, 0x0d0c0b0a); + INSTANCE_WR(ctx, 0x00de0/4, 0x00141210); + INSTANCE_WR(ctx, 0x00de4/4, 0x000001f0); + INSTANCE_WR(ctx, 0x00de8/4, 0x00000001); + INSTANCE_WR(ctx, 0x00dec/4, 0x00000003); + INSTANCE_WR(ctx, 0x00df8/4, 0x00039e00); + INSTANCE_WR(ctx, 0x00dfc/4, 0x00000100); + INSTANCE_WR(ctx, 0x00e00/4, 0x00003800); + INSTANCE_WR(ctx, 0x00e04/4, 0x00404040); + INSTANCE_WR(ctx, 0x00e08/4, 0x0000ff0a); + INSTANCE_WR(ctx, 0x00e10/4, 0x0077f005); + INSTANCE_WR(ctx, 0x00e14/4, 0x003f7fff); + + INSTANCE_WR(ctx, 0x00e24/4, 0x01800000); + INSTANCE_WR(ctx, 0x00e28/4, 0x00160000); + INSTANCE_WR(ctx, 0x00e2c/4, 0x01800000); + INSTANCE_WR(ctx, 0x00e3c/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00e40/4, 0x00880000); + INSTANCE_WR(ctx, 0x00e64/4, 0x00010401); + INSTANCE_WR(ctx, 0x00e6c/4, 0x00000078); + INSTANCE_WR(ctx, 0x00e74/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00e7c/4, 0x00001210); + INSTANCE_WR(ctx, 0x00e80/4, 0x08000080); + INSTANCE_WR(ctx, 0x00ea4/4, 0x01800000); + INSTANCE_WR(ctx, 0x00ea8/4, 0x00160000); + INSTANCE_WR(ctx, 0x00eac/4, 0x01800000); + INSTANCE_WR(ctx, 0x00ebc/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00ec0/4, 0x00880000); + INSTANCE_WR(ctx, 0x00ee4/4, 0x00010401); + INSTANCE_WR(ctx, 0x00eec/4, 0x00000078); + INSTANCE_WR(ctx, 0x00ef4/4, 0x000000bf); + INSTANCE_WR(ctx, 0x00efc/4, 0x00001210); + INSTANCE_WR(ctx, 0x00f00/4, 0x08000080); + INSTANCE_WR(ctx, 0x00f28/4, 0x00027070); + INSTANCE_WR(ctx, 0x00f34/4, 0x03ffffff); + INSTANCE_WR(ctx, 0x00f4c/4, 0x00120407); + INSTANCE_WR(ctx, 0x00f50/4, 0x05091507); + INSTANCE_WR(ctx, 0x00f54/4, 0x05100202); + INSTANCE_WR(ctx, 0x00f58/4, 0x00030201); + INSTANCE_WR(ctx, 0x00f74/4, 0x00000040); + INSTANCE_WR(ctx, 0x00f78/4, 0x0d0c0b0a); + INSTANCE_WR(ctx, 0x00f7c/4, 0x00141210); + INSTANCE_WR(ctx, 0x00f80/4, 0x000001f0); + INSTANCE_WR(ctx, 0x00f84/4, 0x00000001); + INSTANCE_WR(ctx, 0x00f88/4, 0x00000003); + INSTANCE_WR(ctx, 0x00f94/4, 0x00039e00); + INSTANCE_WR(ctx, 0x00f98/4, 0x00000100); + INSTANCE_WR(ctx, 0x00f9c/4, 0x00003800); + INSTANCE_WR(ctx, 0x00fa0/4, 0x00404040); + INSTANCE_WR(ctx, 0x00fa4/4, 0x0000ff0a); + INSTANCE_WR(ctx, 0x00fac/4, 0x0077f005); + INSTANCE_WR(ctx, 0x00fb0/4, 0x003f7fff); + + INSTANCE_WR(ctx, 0x00fc0/4, 0x01800000); + INSTANCE_WR(ctx, 0x00fc4/4, 0x00160000); + INSTANCE_WR(ctx, 0x00fc8/4, 0x01800000); + INSTANCE_WR(ctx, 0x00fd8/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x00fdc/4, 0x00880000); + INSTANCE_WR(ctx, 0x01000/4, 0x00010401); + INSTANCE_WR(ctx, 0x01008/4, 0x00000078); + INSTANCE_WR(ctx, 0x01010/4, 0x000000bf); + INSTANCE_WR(ctx, 0x01018/4, 0x00001210); + INSTANCE_WR(ctx, 0x0101c/4, 0x08000080); + INSTANCE_WR(ctx, 0x01040/4, 0x01800000); + INSTANCE_WR(ctx, 0x01044/4, 0x00160000); + INSTANCE_WR(ctx, 0x01048/4, 0x01800000); + INSTANCE_WR(ctx, 0x01058/4, 0x0003ffff); + INSTANCE_WR(ctx, 0x0105c/4, 0x00880000); + INSTANCE_WR(ctx, 0x01080/4, 0x00010401); + INSTANCE_WR(ctx, 0x01088/4, 0x00000078); + INSTANCE_WR(ctx, 0x01090/4, 0x000000bf); + INSTANCE_WR(ctx, 0x01098/4, 0x00001210); + INSTANCE_WR(ctx, 0x0109c/4, 0x08000080); + INSTANCE_WR(ctx, 0x010c4/4, 0x00027070); + INSTANCE_WR(ctx, 0x010d0/4, 0x03ffffff); + INSTANCE_WR(ctx, 0x010e8/4, 0x00120407); + INSTANCE_WR(ctx, 0x010ec/4, 0x05091507); + INSTANCE_WR(ctx, 0x010f0/4, 0x05100202); + INSTANCE_WR(ctx, 0x010f4/4, 0x00030201); + INSTANCE_WR(ctx, 0x01110/4, 0x00000040); + INSTANCE_WR(ctx, 0x01114/4, 0x0d0c0b0a); + INSTANCE_WR(ctx, 0x01118/4, 0x00141210); + INSTANCE_WR(ctx, 0x0111c/4, 0x000001f0); + INSTANCE_WR(ctx, 0x01120/4, 0x00000001); + INSTANCE_WR(ctx, 0x01124/4, 0x00000003); + INSTANCE_WR(ctx, 0x01130/4, 0x00039e00); + INSTANCE_WR(ctx, 0x01134/4, 0x00000100); + INSTANCE_WR(ctx, 0x01138/4, 0x00003800); + INSTANCE_WR(ctx, 0x0113c/4, 0x00404040); + INSTANCE_WR(ctx, 0x01140/4, 0x0000ff0a); + INSTANCE_WR(ctx, 0x01148/4, 0x0077f005); + INSTANCE_WR(ctx, 0x0114c/4, 0x003f7fff); + + INSTANCE_WR(ctx, 0x01230/4, 0x00000004); + INSTANCE_WR(ctx, 0x01284/4, 0x0000000f); + INSTANCE_WR(ctx, 0x0130c/4, 0x00000002); + INSTANCE_WR(ctx, 0x01324/4, 0x00000020); + INSTANCE_WR(ctx, 0x0134c/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x014ec/4, 0x00000001); + INSTANCE_WR(ctx, 0x014f0/4, 0x00000004); + INSTANCE_WR(ctx, 0x01504/4, 0x0000001a); + INSTANCE_WR(ctx, 0x0150c/4, 0x00000010); + INSTANCE_WR(ctx, 0x01510/4, 0x00000004); + INSTANCE_WR(ctx, 0x01530/4, 0x00608080); + INSTANCE_WR(ctx, 0x0156c/4, 0x00000001); + INSTANCE_WR(ctx, 0x015d0/4, 0x00000004); + INSTANCE_WR(ctx, 0x01630/4, 0x00000004); + INSTANCE_WR(ctx, 0x0164c/4, 0x00000002); + INSTANCE_WR(ctx, 0x01650/4, 0x00000004); + INSTANCE_WR(ctx, 0x01670/4, 0x00000080); + INSTANCE_WR(ctx, 0x01690/4, 0x00000004); + INSTANCE_WR(ctx, 0x016c4/4, 0x00000004); + INSTANCE_WR(ctx, 0x016e4/4, 0x00000004); + INSTANCE_WR(ctx, 0x01724/4, 0x00000004); + INSTANCE_WR(ctx, 0x01744/4, 0x00000008); + INSTANCE_WR(ctx, 0x0176c/4, 0x00000001); + INSTANCE_WR(ctx, 0x01784/4, 0x000007ff); + INSTANCE_WR(ctx, 0x0178c/4, 0x00000010); + INSTANCE_WR(ctx, 0x017cc/4, 0x00000001); + INSTANCE_WR(ctx, 0x01924/4, 0x0000000f); + INSTANCE_WR(ctx, 0x01a4c/4, 0x00000010); + INSTANCE_WR(ctx, 0x01b30/4, 0x00000004); + INSTANCE_WR(ctx, 0x01b50/4, 0x00000080); + INSTANCE_WR(ctx, 0x01b70/4, 0x00000004); + INSTANCE_WR(ctx, 0x01b90/4, 0x03020100); + INSTANCE_WR(ctx, 0x01bb0/4, 0x00000003); + INSTANCE_WR(ctx, 0x01bd0/4, 0x00000004); + INSTANCE_WR(ctx, 0x01c6c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01c70/4, 0x00000004); + INSTANCE_WR(ctx, 0x01c8c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01c90/4, 0x00000003); + INSTANCE_WR(ctx, 0x01cac/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01ccc/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01cec/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01d0c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01d10/4, 0x00000004); + INSTANCE_WR(ctx, 0x01d2c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01d4c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01d6c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01d8c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01dac/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01dcc/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01dec/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01e0c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01e2c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x01e4c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0218c/4, 0x00000010); + INSTANCE_WR(ctx, 0x021cc/4, 0x0000003f); + INSTANCE_WR(ctx, 0x022ac/4, 0x00000001); + INSTANCE_WR(ctx, 0x022ec/4, 0x00000001); + INSTANCE_WR(ctx, 0x0232c/4, 0x00000001); + INSTANCE_WR(ctx, 0x024cc/4, 0x00000011); + INSTANCE_WR(ctx, 0x025cc/4, 0x0000000f); + INSTANCE_WR(ctx, 0x026cc/4, 0x00000011); + INSTANCE_WR(ctx, 0x027ac/4, 0x00000001); + INSTANCE_WR(ctx, 0x027cc/4, 0x00000001); + INSTANCE_WR(ctx, 0x027ec/4, 0x00000001); + INSTANCE_WR(ctx, 0x0280c/4, 0x00000002); + INSTANCE_WR(ctx, 0x0282c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0284c/4, 0x00000002); + INSTANCE_WR(ctx, 0x0286c/4, 0x00000001); + INSTANCE_WR(ctx, 0x028ac/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x028ec/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x02bac/4, 0x00000001); + INSTANCE_WR(ctx, 0x02bcc/4, 0x00000002); + INSTANCE_WR(ctx, 0x02bec/4, 0x00000001); + INSTANCE_WR(ctx, 0x02c0c/4, 0x00000001); + INSTANCE_WR(ctx, 0x02c2c/4, 0x00000002); + INSTANCE_WR(ctx, 0x02c4c/4, 0x00000001); + INSTANCE_WR(ctx, 0x02c6c/4, 0x00000001); + INSTANCE_WR(ctx, 0x02cec/4, 0x00000011); + INSTANCE_WR(ctx, 0x02d0c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0398c/4, 0x00000002); + INSTANCE_WR(ctx, 0x039cc/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x03b6c/4, 0x00000001); + INSTANCE_WR(ctx, 0x03b8c/4, 0x00000010); + INSTANCE_WR(ctx, 0x03bec/4, 0x00000001); + INSTANCE_WR(ctx, 0x03ccc/4, 0x00000002); + INSTANCE_WR(ctx, 0x03dec/4, 0x00000001); + INSTANCE_WR(ctx, 0x03e04/4, 0x0000000f); + INSTANCE_WR(ctx, 0x03e0c/4, 0x00000010); + INSTANCE_WR(ctx, 0x03e44/4, 0x00000001); + INSTANCE_WR(ctx, 0x03e4c/4, 0x00000001); + INSTANCE_WR(ctx, 0x040cc/4, 0x00000010); + INSTANCE_WR(ctx, 0x042ec/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0430c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0432c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0434c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0436c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0438c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x043ac/4, 0x3f800000); + INSTANCE_WR(ctx, 0x043cc/4, 0x3f800000); + INSTANCE_WR(ctx, 0x043ec/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0440c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0442c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0444c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0446c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0448c/4, 0x3f800000); + INSTANCE_WR(ctx, 0x044ac/4, 0x3f800000); + INSTANCE_WR(ctx, 0x044cc/4, 0x3f800000); + INSTANCE_WR(ctx, 0x0480c/4, 0x00000010); + INSTANCE_WR(ctx, 0x0484c/4, 0x0000003f); + INSTANCE_WR(ctx, 0x0492c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0496c/4, 0x00000001); + INSTANCE_WR(ctx, 0x049a4/4, 0x0000000f); + INSTANCE_WR(ctx, 0x049ac/4, 0x00000001); + INSTANCE_WR(ctx, 0x04b4c/4, 0x00000011); + INSTANCE_WR(ctx, 0x04c4c/4, 0x0000000f); + INSTANCE_WR(ctx, 0x04d4c/4, 0x00000011); + INSTANCE_WR(ctx, 0x04e2c/4, 0x00000001); + INSTANCE_WR(ctx, 0x04e4c/4, 0x00000001); + INSTANCE_WR(ctx, 0x04e6c/4, 0x00000001); + INSTANCE_WR(ctx, 0x04e8c/4, 0x00000002); + INSTANCE_WR(ctx, 0x04eac/4, 0x00000001); + INSTANCE_WR(ctx, 0x04ecc/4, 0x00000002); + INSTANCE_WR(ctx, 0x04eec/4, 0x00000001); + INSTANCE_WR(ctx, 0x04f2c/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x04f6c/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x0522c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0524c/4, 0x00000002); + INSTANCE_WR(ctx, 0x0526c/4, 0x00000001); + INSTANCE_WR(ctx, 0x0528c/4, 0x00000001); + INSTANCE_WR(ctx, 0x052ac/4, 0x00000002); + INSTANCE_WR(ctx, 0x052cc/4, 0x00000001); + INSTANCE_WR(ctx, 0x052ec/4, 0x00000001); + INSTANCE_WR(ctx, 0x0536c/4, 0x00000011); + INSTANCE_WR(ctx, 0x0538c/4, 0x00000001); + INSTANCE_WR(ctx, 0x083a0/4, 0x00000021); + INSTANCE_WR(ctx, 0x083c0/4, 0x00000001); + INSTANCE_WR(ctx, 0x083e0/4, 0x00000002); + INSTANCE_WR(ctx, 0x08400/4, 0x00000100); + INSTANCE_WR(ctx, 0x08420/4, 0x00000100); + INSTANCE_WR(ctx, 0x08440/4, 0x00000001); + INSTANCE_WR(ctx, 0x084a0/4, 0x00000001); + INSTANCE_WR(ctx, 0x084c0/4, 0x00000002); + INSTANCE_WR(ctx, 0x084e0/4, 0x00000100); + INSTANCE_WR(ctx, 0x08500/4, 0x00000100); + INSTANCE_WR(ctx, 0x08520/4, 0x00000001); + INSTANCE_WR(ctx, 0x11e40/4, 0x00000004); + INSTANCE_WR(ctx, 0x11e60/4, 0x00000004); + INSTANCE_WR(ctx, 0x15044/4, 0x0000000f); + INSTANCE_WR(ctx, 0x152e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x15304/4, 0x00000100); + INSTANCE_WR(ctx, 0x15324/4, 0x00000100); + INSTANCE_WR(ctx, 0x15344/4, 0x00000011); + INSTANCE_WR(ctx, 0x15384/4, 0x00000008); + INSTANCE_WR(ctx, 0x15444/4, 0x00000001); + INSTANCE_WR(ctx, 0x15484/4, 0x00000001); + INSTANCE_WR(ctx, 0x154a4/4, 0x00000001); + INSTANCE_WR(ctx, 0x154c4/4, 0x00000001); + INSTANCE_WR(ctx, 0x154e4/4, 0x000000cf); + INSTANCE_WR(ctx, 0x15504/4, 0x00000002); + INSTANCE_WR(ctx, 0x155e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x15624/4, 0x00000001); + INSTANCE_WR(ctx, 0x15644/4, 0x00000001); + INSTANCE_WR(ctx, 0x15664/4, 0x00000001); + INSTANCE_WR(ctx, 0x15704/4, 0x00000004); + INSTANCE_WR(ctx, 0x15744/4, 0x00000001); + INSTANCE_WR(ctx, 0x15764/4, 0x00000015); + INSTANCE_WR(ctx, 0x157e4/4, 0x04444480); + INSTANCE_WR(ctx, 0x15f64/4, 0x08100c12); + INSTANCE_WR(ctx, 0x16004/4, 0x00000100); + INSTANCE_WR(ctx, 0x16064/4, 0x00010001); + INSTANCE_WR(ctx, 0x160a4/4, 0x00010001); + INSTANCE_WR(ctx, 0x160c4/4, 0x00000001); + INSTANCE_WR(ctx, 0x160e4/4, 0x00010001); + INSTANCE_WR(ctx, 0x16104/4, 0x00000001); + INSTANCE_WR(ctx, 0x16124/4, 0x00000004); + INSTANCE_WR(ctx, 0x16144/4, 0x00000002); + INSTANCE_WR(ctx, 0x161b0/4, 0x00000004); + INSTANCE_WR(ctx, 0x161c8/4, 0x003fffff); + INSTANCE_WR(ctx, 0x161d0/4, 0x00000003); + INSTANCE_WR(ctx, 0x16228/4, 0x00001fff); + INSTANCE_WR(ctx, 0x16408/4, 0x3f800000); + INSTANCE_WR(ctx, 0x16410/4, 0x0000000f); + INSTANCE_WR(ctx, 0x164e8/4, 0x00000004); + INSTANCE_WR(ctx, 0x16508/4, 0x0000001a); + INSTANCE_WR(ctx, 0x16568/4, 0x00000001); + INSTANCE_WR(ctx, 0x16590/4, 0x00000004); + INSTANCE_WR(ctx, 0x165b0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x165d0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x165f0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x16610/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x16730/4, 0x00000001); + INSTANCE_WR(ctx, 0x167b0/4, 0x00000001); + INSTANCE_WR(ctx, 0x167c8/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x16870/4, 0x00000001); + INSTANCE_WR(ctx, 0x168a8/4, 0x0000000f); + INSTANCE_WR(ctx, 0x169a8/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x169c8/4, 0x00000011); + INSTANCE_WR(ctx, 0x16a10/4, 0x00000001); + INSTANCE_WR(ctx, 0x16a30/4, 0x00000001); + INSTANCE_WR(ctx, 0x16a50/4, 0x00000002); + INSTANCE_WR(ctx, 0x16a70/4, 0x00000001); + INSTANCE_WR(ctx, 0x16a90/4, 0x00000001); + INSTANCE_WR(ctx, 0x16ab0/4, 0x00000002); + INSTANCE_WR(ctx, 0x16ad0/4, 0x00000001); + INSTANCE_WR(ctx, 0x16b10/4, 0x00000011); + INSTANCE_WR(ctx, 0x16bc8/4, 0x00000004); + INSTANCE_WR(ctx, 0x16c10/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x16c68/4, 0x00000002); + INSTANCE_WR(ctx, 0x16c70/4, 0x00000004); + INSTANCE_WR(ctx, 0x16c88/4, 0x04000000); + INSTANCE_WR(ctx, 0x16ca8/4, 0x04000000); + INSTANCE_WR(ctx, 0x16cf0/4, 0x00000011); + INSTANCE_WR(ctx, 0x16d10/4, 0x00000001); + INSTANCE_WR(ctx, 0x16d28/4, 0x00000005); + INSTANCE_WR(ctx, 0x16d48/4, 0x00000052); + INSTANCE_WR(ctx, 0x16d50/4, 0x000000cf); + INSTANCE_WR(ctx, 0x16d70/4, 0x000000cf); + INSTANCE_WR(ctx, 0x16d90/4, 0x000000cf); + INSTANCE_WR(ctx, 0x16de8/4, 0x00000001); + INSTANCE_WR(ctx, 0x16ef0/4, 0x00000001); + INSTANCE_WR(ctx, 0x16f10/4, 0x00000001); + INSTANCE_WR(ctx, 0x16f30/4, 0x00000002); + INSTANCE_WR(ctx, 0x16f50/4, 0x00000001); + INSTANCE_WR(ctx, 0x16f70/4, 0x00000001); + INSTANCE_WR(ctx, 0x16f90/4, 0x00000002); + INSTANCE_WR(ctx, 0x16fb0/4, 0x00000001); + INSTANCE_WR(ctx, 0x16ff0/4, 0x00000001); + INSTANCE_WR(ctx, 0x17008/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17010/4, 0x00000001); + INSTANCE_WR(ctx, 0x17028/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17030/4, 0x00000001); + INSTANCE_WR(ctx, 0x17048/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17050/4, 0x00000001); + INSTANCE_WR(ctx, 0x17068/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17070/4, 0x00000001); + INSTANCE_WR(ctx, 0x17088/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17090/4, 0x00000001); + INSTANCE_WR(ctx, 0x170a8/4, 0x3f800000); + INSTANCE_WR(ctx, 0x170b0/4, 0x00000001); + INSTANCE_WR(ctx, 0x170c8/4, 0x3f800000); + INSTANCE_WR(ctx, 0x170d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x170e8/4, 0x3f800000); + INSTANCE_WR(ctx, 0x170f0/4, 0x00000011); + INSTANCE_WR(ctx, 0x17108/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17128/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17148/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17168/4, 0x3f800000); + INSTANCE_WR(ctx, 0x17188/4, 0x3f800000); + INSTANCE_WR(ctx, 0x171a8/4, 0x3f800000); + INSTANCE_WR(ctx, 0x171c8/4, 0x3f800000); + INSTANCE_WR(ctx, 0x171e8/4, 0x3f800000); + INSTANCE_WR(ctx, 0x171f0/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x17208/4, 0x00000010); + INSTANCE_WR(ctx, 0x17210/4, 0x0000000f); + INSTANCE_WR(ctx, 0x17310/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x17370/4, 0x00000011); + INSTANCE_WR(ctx, 0x17390/4, 0x00000001); + INSTANCE_WR(ctx, 0x17410/4, 0x00000004); + INSTANCE_WR(ctx, 0x174d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x17570/4, 0x00000011); + INSTANCE_WR(ctx, 0x17670/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x176e8/4, 0x08100c12); + INSTANCE_WR(ctx, 0x176f0/4, 0x00000011); + INSTANCE_WR(ctx, 0x17708/4, 0x00000005); + INSTANCE_WR(ctx, 0x17710/4, 0x00000001); + INSTANCE_WR(ctx, 0x17750/4, 0x00000001); + INSTANCE_WR(ctx, 0x17768/4, 0x00000001); + INSTANCE_WR(ctx, 0x17790/4, 0x00000001); + INSTANCE_WR(ctx, 0x177a8/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x177c8/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x177d0/4, 0x000007ff); + INSTANCE_WR(ctx, 0x177e8/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x17808/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x17810/4, 0x00000001); + INSTANCE_WR(ctx, 0x17828/4, 0x00000003); + INSTANCE_WR(ctx, 0x17850/4, 0x00000001); + INSTANCE_WR(ctx, 0x17bc4/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x17be4/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x17c28/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x17c48/4, 0x0000001a); + INSTANCE_WR(ctx, 0x17c84/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x17c88/4, 0x00000003); + INSTANCE_WR(ctx, 0x17db0/4, 0x00000008); + INSTANCE_WR(ctx, 0x17dd0/4, 0x00000008); + INSTANCE_WR(ctx, 0x17df0/4, 0x00000008); + INSTANCE_WR(ctx, 0x17e04/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x17e10/4, 0x00000008); + INSTANCE_WR(ctx, 0x17e24/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x17e30/4, 0x00000008); + INSTANCE_WR(ctx, 0x17e50/4, 0x00000008); + INSTANCE_WR(ctx, 0x17e70/4, 0x00000008); + INSTANCE_WR(ctx, 0x17e90/4, 0x00000008); + INSTANCE_WR(ctx, 0x17eb0/4, 0x00000011); + INSTANCE_WR(ctx, 0x17fb0/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x17fd0/4, 0x00000400); + INSTANCE_WR(ctx, 0x17ff0/4, 0x00000400); + INSTANCE_WR(ctx, 0x18010/4, 0x00000400); + INSTANCE_WR(ctx, 0x18030/4, 0x00000400); + INSTANCE_WR(ctx, 0x18050/4, 0x00000400); + INSTANCE_WR(ctx, 0x18070/4, 0x00000400); + INSTANCE_WR(ctx, 0x18090/4, 0x00000400); + INSTANCE_WR(ctx, 0x180b0/4, 0x00000400); + INSTANCE_WR(ctx, 0x180d0/4, 0x00000300); + INSTANCE_WR(ctx, 0x180f0/4, 0x00000300); + INSTANCE_WR(ctx, 0x18110/4, 0x00000300); + INSTANCE_WR(ctx, 0x18130/4, 0x00000300); + INSTANCE_WR(ctx, 0x18150/4, 0x00000300); + INSTANCE_WR(ctx, 0x18168/4, 0x00000102); + INSTANCE_WR(ctx, 0x18170/4, 0x00000300); + INSTANCE_WR(ctx, 0x18190/4, 0x00000300); + INSTANCE_WR(ctx, 0x181a8/4, 0x00000004); + INSTANCE_WR(ctx, 0x181b0/4, 0x00000300); + INSTANCE_WR(ctx, 0x181c8/4, 0x00000004); + INSTANCE_WR(ctx, 0x181d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x181e8/4, 0x00000004); + INSTANCE_WR(ctx, 0x181f0/4, 0x0000000f); + INSTANCE_WR(ctx, 0x18208/4, 0x00000004); + INSTANCE_WR(ctx, 0x18228/4, 0x00000004); + INSTANCE_WR(ctx, 0x18248/4, 0x00000004); + INSTANCE_WR(ctx, 0x18288/4, 0x000007ff); + INSTANCE_WR(ctx, 0x182c8/4, 0x00000102); + INSTANCE_WR(ctx, 0x182f0/4, 0x00000020); + INSTANCE_WR(ctx, 0x18310/4, 0x00000011); + INSTANCE_WR(ctx, 0x18330/4, 0x00000100); + INSTANCE_WR(ctx, 0x18370/4, 0x00000001); + INSTANCE_WR(ctx, 0x183d0/4, 0x00000040); + INSTANCE_WR(ctx, 0x183f0/4, 0x00000100); + INSTANCE_WR(ctx, 0x18408/4, 0x00000004); + INSTANCE_WR(ctx, 0x18428/4, 0x00000004); + INSTANCE_WR(ctx, 0x18430/4, 0x00000003); + INSTANCE_WR(ctx, 0x18448/4, 0x00000004); + INSTANCE_WR(ctx, 0x18468/4, 0x00000004); + INSTANCE_WR(ctx, 0x184d0/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x18550/4, 0x00000002); + INSTANCE_WR(ctx, 0x18570/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x186b0/4, 0x00000001); + INSTANCE_WR(ctx, 0x18750/4, 0x00000004); + INSTANCE_WR(ctx, 0x18790/4, 0x00000001); + INSTANCE_WR(ctx, 0x187b0/4, 0x00000400); + INSTANCE_WR(ctx, 0x187d0/4, 0x00000300); + INSTANCE_WR(ctx, 0x187f0/4, 0x00001001); + INSTANCE_WR(ctx, 0x18870/4, 0x00000011); + INSTANCE_WR(ctx, 0x18970/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x18990/4, 0x0000000f); + INSTANCE_WR(ctx, 0x18aa8/4, 0x00080c14); + INSTANCE_WR(ctx, 0x18b08/4, 0x00000804); + INSTANCE_WR(ctx, 0x18b48/4, 0x00000004); + INSTANCE_WR(ctx, 0x18b68/4, 0x00000004); + INSTANCE_WR(ctx, 0x18b88/4, 0x08100c12); + INSTANCE_WR(ctx, 0x18bc8/4, 0x00000004); + INSTANCE_WR(ctx, 0x18be8/4, 0x00000004); + INSTANCE_WR(ctx, 0x18c28/4, 0x00000010); + INSTANCE_WR(ctx, 0x18c90/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x18cc8/4, 0x00000804); + INSTANCE_WR(ctx, 0x18ce8/4, 0x00000001); + INSTANCE_WR(ctx, 0x18d08/4, 0x0000001a); + INSTANCE_WR(ctx, 0x18d10/4, 0x00000011); + INSTANCE_WR(ctx, 0x18d28/4, 0x0000007f); + INSTANCE_WR(ctx, 0x18d68/4, 0x00000001); + INSTANCE_WR(ctx, 0x18d70/4, 0x00000004); + INSTANCE_WR(ctx, 0x18d88/4, 0x00080c14); + INSTANCE_WR(ctx, 0x18db0/4, 0x00000001); + INSTANCE_WR(ctx, 0x18dc8/4, 0x08100c12); + INSTANCE_WR(ctx, 0x18dd0/4, 0x00000001); + INSTANCE_WR(ctx, 0x18de8/4, 0x00000004); + INSTANCE_WR(ctx, 0x18e08/4, 0x00000004); + INSTANCE_WR(ctx, 0x18e48/4, 0x00000010); + INSTANCE_WR(ctx, 0x18e50/4, 0x00000001); + INSTANCE_WR(ctx, 0x18ec8/4, 0x00000001); + INSTANCE_WR(ctx, 0x18ee8/4, 0x08100c12); + INSTANCE_WR(ctx, 0x18ef0/4, 0x00000001); + INSTANCE_WR(ctx, 0x18f30/4, 0x00000001); + INSTANCE_WR(ctx, 0x18fb0/4, 0x2a712488); + INSTANCE_WR(ctx, 0x18fc8/4, 0x000007ff); + INSTANCE_WR(ctx, 0x18fe8/4, 0x00080c14); + INSTANCE_WR(ctx, 0x18ff0/4, 0x4085c000); + INSTANCE_WR(ctx, 0x19010/4, 0x00000040); + INSTANCE_WR(ctx, 0x19030/4, 0x00000100); + INSTANCE_WR(ctx, 0x19050/4, 0x00010100); + INSTANCE_WR(ctx, 0x19070/4, 0x02800000); + INSTANCE_WR(ctx, 0x192d0/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x192f0/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x19310/4, 0x00000001); + INSTANCE_WR(ctx, 0x19350/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x19370/4, 0x00000001); + INSTANCE_WR(ctx, 0x193d0/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x194f0/4, 0x00000001); + INSTANCE_WR(ctx, 0x19530/4, 0x00000001); + INSTANCE_WR(ctx, 0x19550/4, 0x30201000); + INSTANCE_WR(ctx, 0x19570/4, 0x70605040); + INSTANCE_WR(ctx, 0x19590/4, 0xb8a89888); + INSTANCE_WR(ctx, 0x195b0/4, 0xf8e8d8c8); + INSTANCE_WR(ctx, 0x195f0/4, 0x0000001a); + INSTANCE_WR(ctx, 0x19630/4, 0x00000004); + INSTANCE_WR(ctx, 0x19708/4, 0x00000001); + INSTANCE_WR(ctx, 0x19768/4, 0x00000010); + INSTANCE_WR(ctx, 0x198f0/4, 0x00000004); + INSTANCE_WR(ctx, 0x19910/4, 0x00000004); + INSTANCE_WR(ctx, 0x19930/4, 0x00608080); + INSTANCE_WR(ctx, 0x199d0/4, 0x00000004); + INSTANCE_WR(ctx, 0x19a30/4, 0x00000004); + INSTANCE_WR(ctx, 0x19a50/4, 0x00000004); + INSTANCE_WR(ctx, 0x19a70/4, 0x00000080); + INSTANCE_WR(ctx, 0x19a90/4, 0x00000004); + INSTANCE_WR(ctx, 0x19e88/4, 0x00000088); + INSTANCE_WR(ctx, 0x19ea8/4, 0x00000088); + INSTANCE_WR(ctx, 0x19f08/4, 0x00000004); + INSTANCE_WR(ctx, 0x19f30/4, 0x00000004); + INSTANCE_WR(ctx, 0x19f50/4, 0x00000080); + INSTANCE_WR(ctx, 0x19f70/4, 0x00000004); + INSTANCE_WR(ctx, 0x19f90/4, 0x03020100); + INSTANCE_WR(ctx, 0x19fb0/4, 0x00000003); + INSTANCE_WR(ctx, 0x19fd0/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a070/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a090/4, 0x00000003); + INSTANCE_WR(ctx, 0x1a110/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a1e8/4, 0x00000026); + INSTANCE_WR(ctx, 0x1a248/4, 0x3f800000); + INSTANCE_WR(ctx, 0x1a2c8/4, 0x0000001a); + INSTANCE_WR(ctx, 0x1a2e8/4, 0x00000010); + INSTANCE_WR(ctx, 0x1a808/4, 0x00000052); + INSTANCE_WR(ctx, 0x1a848/4, 0x00000026); + INSTANCE_WR(ctx, 0x1a888/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a8a8/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a8e8/4, 0x0000001a); + INSTANCE_WR(ctx, 0x1a948/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x1a988/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a9a8/4, 0x00000004); + INSTANCE_WR(ctx, 0x1a9e8/4, 0x00000080); + INSTANCE_WR(ctx, 0x1aa08/4, 0x00000004); + INSTANCE_WR(ctx, 0x1aa28/4, 0x00080c14); + INSTANCE_WR(ctx, 0x1aa68/4, 0x000007ff); + INSTANCE_WR(ctx, 0x2d2c8/4, 0x00000004); + INSTANCE_WR(ctx, 0x2d2e8/4, 0x00000004); + INSTANCE_WR(ctx, 0x2d328/4, 0x00000080); + INSTANCE_WR(ctx, 0x2d348/4, 0x00000004); + INSTANCE_WR(ctx, 0x2d368/4, 0x00000001); + INSTANCE_WR(ctx, 0x2d3a8/4, 0x00000027); + INSTANCE_WR(ctx, 0x2d3e8/4, 0x00000026); + INSTANCE_WR(ctx, 0x2d468/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d488/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d4a8/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d4c8/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d4e8/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d508/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d528/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d548/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d568/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d588/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d5a8/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d5c8/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d5e8/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d608/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d628/4, 0x04000000); + INSTANCE_WR(ctx, 0x2d648/4, 0x04000000); + INSTANCE_WR(ctx, 0x2dae8/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x2db08/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x2db68/4, 0x0001fe21); + INSTANCE_WR(ctx, 0x2e5b0/4, 0x00000004); + INSTANCE_WR(ctx, 0x2e5d0/4, 0x00000003); + INSTANCE_WR(ctx, 0x2e810/4, 0x0000000f); + INSTANCE_WR(ctx, 0x2e990/4, 0x00000004); + INSTANCE_WR(ctx, 0x2e9b0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x2e9d0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x2e9f0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x2ea10/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x2eb30/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ebb0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ec70/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ee10/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ee30/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ee50/4, 0x00000002); + INSTANCE_WR(ctx, 0x2ee70/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ee90/4, 0x00000001); + INSTANCE_WR(ctx, 0x2eeb0/4, 0x00000002); + INSTANCE_WR(ctx, 0x2eed0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2ef10/4, 0x00000011); + INSTANCE_WR(ctx, 0x2f010/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x2f070/4, 0x00000004); + INSTANCE_WR(ctx, 0x2f0f0/4, 0x00000011); + INSTANCE_WR(ctx, 0x2f110/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f150/4, 0x000000cf); + INSTANCE_WR(ctx, 0x2f170/4, 0x000000cf); + INSTANCE_WR(ctx, 0x2f190/4, 0x000000cf); + INSTANCE_WR(ctx, 0x2f2f0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f310/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f330/4, 0x00000002); + INSTANCE_WR(ctx, 0x2f350/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f370/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f390/4, 0x00000002); + INSTANCE_WR(ctx, 0x2f3b0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f3f0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f410/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f430/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f450/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f470/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f490/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f4b0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f4d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f4f0/4, 0x00000011); + INSTANCE_WR(ctx, 0x2f5f0/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x2f610/4, 0x0000000f); + INSTANCE_WR(ctx, 0x2f710/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x2f770/4, 0x00000011); + INSTANCE_WR(ctx, 0x2f790/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f810/4, 0x00000004); + INSTANCE_WR(ctx, 0x2f8d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x2f970/4, 0x00000011); + INSTANCE_WR(ctx, 0x2fa70/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x2faf0/4, 0x00000011); + INSTANCE_WR(ctx, 0x2fb10/4, 0x00000001); + INSTANCE_WR(ctx, 0x2fb50/4, 0x00000001); + INSTANCE_WR(ctx, 0x2fb90/4, 0x00000001); + INSTANCE_WR(ctx, 0x2fbd0/4, 0x000007ff); + INSTANCE_WR(ctx, 0x2fc10/4, 0x00000001); + INSTANCE_WR(ctx, 0x2fc50/4, 0x00000001); + INSTANCE_WR(ctx, 0x301b0/4, 0x00000008); + INSTANCE_WR(ctx, 0x301d0/4, 0x00000008); + INSTANCE_WR(ctx, 0x301f0/4, 0x00000008); + INSTANCE_WR(ctx, 0x30210/4, 0x00000008); + INSTANCE_WR(ctx, 0x30230/4, 0x00000008); + INSTANCE_WR(ctx, 0x30250/4, 0x00000008); + INSTANCE_WR(ctx, 0x30270/4, 0x00000008); + INSTANCE_WR(ctx, 0x30290/4, 0x00000008); + INSTANCE_WR(ctx, 0x302b0/4, 0x00000011); + INSTANCE_WR(ctx, 0x303b0/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x303d0/4, 0x00000400); + INSTANCE_WR(ctx, 0x303f0/4, 0x00000400); + INSTANCE_WR(ctx, 0x30410/4, 0x00000400); + INSTANCE_WR(ctx, 0x30430/4, 0x00000400); + INSTANCE_WR(ctx, 0x30450/4, 0x00000400); + INSTANCE_WR(ctx, 0x30470/4, 0x00000400); + INSTANCE_WR(ctx, 0x30490/4, 0x00000400); + INSTANCE_WR(ctx, 0x304b0/4, 0x00000400); + INSTANCE_WR(ctx, 0x304d0/4, 0x00000300); + INSTANCE_WR(ctx, 0x304f0/4, 0x00000300); + INSTANCE_WR(ctx, 0x30510/4, 0x00000300); + INSTANCE_WR(ctx, 0x30530/4, 0x00000300); + INSTANCE_WR(ctx, 0x30550/4, 0x00000300); + INSTANCE_WR(ctx, 0x30570/4, 0x00000300); + INSTANCE_WR(ctx, 0x30590/4, 0x00000300); + INSTANCE_WR(ctx, 0x305b0/4, 0x00000300); + INSTANCE_WR(ctx, 0x305d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x305f0/4, 0x0000000f); + INSTANCE_WR(ctx, 0x306f0/4, 0x00000020); + INSTANCE_WR(ctx, 0x30710/4, 0x00000011); + INSTANCE_WR(ctx, 0x30730/4, 0x00000100); + INSTANCE_WR(ctx, 0x30770/4, 0x00000001); + INSTANCE_WR(ctx, 0x307d0/4, 0x00000040); + INSTANCE_WR(ctx, 0x307f0/4, 0x00000100); + INSTANCE_WR(ctx, 0x30830/4, 0x00000003); + INSTANCE_WR(ctx, 0x308d0/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x30950/4, 0x00000002); + INSTANCE_WR(ctx, 0x30970/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x30ab0/4, 0x00000001); + INSTANCE_WR(ctx, 0x30b50/4, 0x00000004); + INSTANCE_WR(ctx, 0x30b90/4, 0x00000001); + INSTANCE_WR(ctx, 0x30bb0/4, 0x00000400); + INSTANCE_WR(ctx, 0x30bd0/4, 0x00000300); + INSTANCE_WR(ctx, 0x30bf0/4, 0x00001001); + INSTANCE_WR(ctx, 0x30c70/4, 0x00000011); + INSTANCE_WR(ctx, 0x30d70/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x30d90/4, 0x0000000f); + INSTANCE_WR(ctx, 0x31090/4, 0x001ffe67); + INSTANCE_WR(ctx, 0x31110/4, 0x00000011); + INSTANCE_WR(ctx, 0x31170/4, 0x00000004); + INSTANCE_WR(ctx, 0x311b0/4, 0x00000001); + INSTANCE_WR(ctx, 0x311d0/4, 0x00000001); + INSTANCE_WR(ctx, 0x31250/4, 0x00000001); + INSTANCE_WR(ctx, 0x312f0/4, 0x00000001); + INSTANCE_WR(ctx, 0x31330/4, 0x00000001); + INSTANCE_WR(ctx, 0x313b0/4, 0x2a712488); + INSTANCE_WR(ctx, 0x313f0/4, 0x4085c000); + INSTANCE_WR(ctx, 0x31410/4, 0x00000040); + INSTANCE_WR(ctx, 0x31430/4, 0x00000100); + INSTANCE_WR(ctx, 0x31450/4, 0x00010100); + INSTANCE_WR(ctx, 0x31470/4, 0x02800000); + INSTANCE_WR(ctx, 0x316d0/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x316f0/4, 0x04e3bfdf); + INSTANCE_WR(ctx, 0x31710/4, 0x00000001); + INSTANCE_WR(ctx, 0x31750/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x31770/4, 0x00000001); + INSTANCE_WR(ctx, 0x317d0/4, 0x00ffff00); + INSTANCE_WR(ctx, 0x318f0/4, 0x00000001); + INSTANCE_WR(ctx, 0x31930/4, 0x00000001); + INSTANCE_WR(ctx, 0x31950/4, 0x30201000); + INSTANCE_WR(ctx, 0x31970/4, 0x70605040); + INSTANCE_WR(ctx, 0x31990/4, 0xb8a89888); + INSTANCE_WR(ctx, 0x319b0/4, 0xf8e8d8c8); + INSTANCE_WR(ctx, 0x319f0/4, 0x0000001a); + INSTANCE_WR(ctx, 0x4a7e0/4, 0x00000004); + INSTANCE_WR(ctx, 0x4a800/4, 0x00000004); + INSTANCE_WR(ctx, 0x4a820/4, 0x08100c12); + INSTANCE_WR(ctx, 0x4a840/4, 0x00000003); + INSTANCE_WR(ctx, 0x4a880/4, 0x08100c12); + INSTANCE_WR(ctx, 0x4a8c0/4, 0x00080c14); + INSTANCE_WR(ctx, 0x4a8e0/4, 0x00000001); + INSTANCE_WR(ctx, 0x4a900/4, 0x00080c14); + INSTANCE_WR(ctx, 0x4a960/4, 0x08100c12); + INSTANCE_WR(ctx, 0x4a980/4, 0x00000027); + INSTANCE_WR(ctx, 0x4a9e0/4, 0x00000001); + INSTANCE_WR(ctx, 0x52220/4, 0x00000001); + INSTANCE_WR(ctx, 0x52500/4, 0x08100c12); + INSTANCE_WR(ctx, 0x526a0/4, 0x04000000); + INSTANCE_WR(ctx, 0x526c0/4, 0x04000000); + INSTANCE_WR(ctx, 0x52700/4, 0x00000080); + INSTANCE_WR(ctx, 0x52780/4, 0x00000080); + INSTANCE_WR(ctx, 0x527c0/4, 0x0000003f); + INSTANCE_WR(ctx, 0x52920/4, 0x00000002); + INSTANCE_WR(ctx, 0x52940/4, 0x04000000); + INSTANCE_WR(ctx, 0x52960/4, 0x04000000); + INSTANCE_WR(ctx, 0x52a80/4, 0x00000004); + INSTANCE_WR(ctx, 0x52b00/4, 0x00000004); + INSTANCE_WR(ctx, 0x52d40/4, 0x00000001); + INSTANCE_WR(ctx, 0x52d60/4, 0x00001001); + INSTANCE_WR(ctx, 0x52d80/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x52da0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x52dc0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x52de0/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53200/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53220/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53240/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53260/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53280/4, 0x3f800000); + INSTANCE_WR(ctx, 0x532a0/4, 0x3f800000); + INSTANCE_WR(ctx, 0x532c0/4, 0x3f800000); + INSTANCE_WR(ctx, 0x532e0/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53300/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53320/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53340/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53360/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53380/4, 0x3f800000); + INSTANCE_WR(ctx, 0x533a0/4, 0x3f800000); + INSTANCE_WR(ctx, 0x533c0/4, 0x3f800000); + INSTANCE_WR(ctx, 0x533e0/4, 0x3f800000); + INSTANCE_WR(ctx, 0x53400/4, 0x00000010); + INSTANCE_WR(ctx, 0x53460/4, 0x00000003); + INSTANCE_WR(ctx, 0x53500/4, 0x08100c12); + INSTANCE_WR(ctx, 0x53524/4, 0x00000080); + INSTANCE_WR(ctx, 0x53540/4, 0x00000080); + INSTANCE_WR(ctx, 0x53544/4, 0x80007004); + INSTANCE_WR(ctx, 0x53560/4, 0x80007004); + INSTANCE_WR(ctx, 0x53564/4, 0x04000400); + INSTANCE_WR(ctx, 0x53580/4, 0x04000400); + INSTANCE_WR(ctx, 0x53584/4, 0x00001000); + INSTANCE_WR(ctx, 0x535a0/4, 0x00001000); + INSTANCE_WR(ctx, 0x535e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x53600/4, 0x00000001); + INSTANCE_WR(ctx, 0x53644/4, 0x00000001); + INSTANCE_WR(ctx, 0x53660/4, 0x00000001); + INSTANCE_WR(ctx, 0x53684/4, 0x00000004); + INSTANCE_WR(ctx, 0x536a0/4, 0x00000004); + INSTANCE_WR(ctx, 0x536a4/4, 0x00000002); + INSTANCE_WR(ctx, 0x536c0/4, 0x00000002); + INSTANCE_WR(ctx, 0x53824/4, 0x00000080); + INSTANCE_WR(ctx, 0x53840/4, 0x00000080); + INSTANCE_WR(ctx, 0x53844/4, 0x80007004); + INSTANCE_WR(ctx, 0x53860/4, 0x80007004); + INSTANCE_WR(ctx, 0x53864/4, 0x04000400); + INSTANCE_WR(ctx, 0x53880/4, 0x04000400); + INSTANCE_WR(ctx, 0x53884/4, 0x00001000); + INSTANCE_WR(ctx, 0x538a0/4, 0x00001000); + INSTANCE_WR(ctx, 0x538e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x53900/4, 0x00000001); + INSTANCE_WR(ctx, 0x53944/4, 0x00000001); + INSTANCE_WR(ctx, 0x53960/4, 0x00000001); + INSTANCE_WR(ctx, 0x53984/4, 0x00000004); + INSTANCE_WR(ctx, 0x539a0/4, 0x00000004); + INSTANCE_WR(ctx, 0x539a4/4, 0x00000002); + INSTANCE_WR(ctx, 0x539c0/4, 0x00000002); + INSTANCE_WR(ctx, 0x53b04/4, 0x08100c12); + INSTANCE_WR(ctx, 0x53b20/4, 0x08100c12); + INSTANCE_WR(ctx, 0x53be4/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c00/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c04/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c20/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c24/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c40/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c44/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c60/4, 0x0000ffff); + INSTANCE_WR(ctx, 0x53c64/4, 0x00000001); + INSTANCE_WR(ctx, 0x53c80/4, 0x00000001); + INSTANCE_WR(ctx, 0x53c84/4, 0x00010001); + INSTANCE_WR(ctx, 0x53ca0/4, 0x00010001); + INSTANCE_WR(ctx, 0x53ca4/4, 0x00010001); + INSTANCE_WR(ctx, 0x53cc0/4, 0x00010001); + INSTANCE_WR(ctx, 0x53cc4/4, 0x00000001); + INSTANCE_WR(ctx, 0x53ce0/4, 0x00000001); + INSTANCE_WR(ctx, 0x53d04/4, 0x0001fe21); + INSTANCE_WR(ctx, 0x53d20/4, 0x0001fe21); + INSTANCE_WR(ctx, 0x53dc4/4, 0x08100c12); + INSTANCE_WR(ctx, 0x53de0/4, 0x08100c12); + INSTANCE_WR(ctx, 0x53de4/4, 0x00000004); + INSTANCE_WR(ctx, 0x53e00/4, 0x00000004); + INSTANCE_WR(ctx, 0x53e24/4, 0x00000002); + INSTANCE_WR(ctx, 0x53e40/4, 0x00000002); + INSTANCE_WR(ctx, 0x53e44/4, 0x00000011); + INSTANCE_WR(ctx, 0x53e60/4, 0x00000011); + INSTANCE_WR(ctx, 0x53f64/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x53f80/4, 0x0fac6881); + INSTANCE_WR(ctx, 0x54004/4, 0x00000004); + INSTANCE_WR(ctx, 0x54020/4, 0x00000004); + INSTANCE_WR(ctx, 0x54144/4, 0x00000002); + INSTANCE_WR(ctx, 0x54160/4, 0x00000002); + INSTANCE_WR(ctx, 0x54164/4, 0x00000001); + INSTANCE_WR(ctx, 0x54180/4, 0x00000001); + INSTANCE_WR(ctx, 0x54184/4, 0x00000001); + INSTANCE_WR(ctx, 0x541a0/4, 0x00000001); + INSTANCE_WR(ctx, 0x541a4/4, 0x00000002); + INSTANCE_WR(ctx, 0x541c0/4, 0x00000002); + INSTANCE_WR(ctx, 0x541c4/4, 0x00000001); + INSTANCE_WR(ctx, 0x541e0/4, 0x00000001); + INSTANCE_WR(ctx, 0x541e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x54200/4, 0x00000001); + INSTANCE_WR(ctx, 0x54204/4, 0x00000001); + INSTANCE_WR(ctx, 0x54220/4, 0x00000001); + INSTANCE_WR(ctx, 0x54244/4, 0x00000004); + INSTANCE_WR(ctx, 0x54260/4, 0x00000004); + INSTANCE_WR(ctx, 0x5b6a4/4, 0x00000011); + INSTANCE_WR(ctx, 0x5b6c0/4, 0x00000011); + INSTANCE_WR(ctx, 0x5b6e4/4, 0x00000001); + INSTANCE_WR(ctx, 0x5b700/4, 0x00000001); +} + int nv50_graph_create_context(struct nouveau_channel *chan) { struct drm_device *dev = chan->dev; struct drm_nouveau_private *dev_priv = dev->dev_private; - struct nouveau_engine *engine = &dev_priv->Engine; struct nouveau_gpuobj *ramin = chan->ramin->gpuobj; + struct nouveau_engine *engine = &dev_priv->Engine; int grctx_size = 0x60000, hdr; int ret; @@ -958,23 +2088,31 @@ nv50_graph_create_context(struct nouveau_channel *chan) INSTANCE_WR(ramin, (hdr + 0x10)/4, 0); INSTANCE_WR(ramin, (hdr + 0x14)/4, 0x00010000); - switch (dev_priv->chipset) { - case 0x86: - nv86_graph_init_ctxvals(dev, chan->ramin_grctx); - break; - default: - ret = engine->graph.load_context(chan); - if (ret) { - DRM_ERROR("Error hacking up initial context: %d\n", ret); - return ret; - } - break; - } - INSTANCE_WR(chan->ramin_grctx->gpuobj, 0x00000/4, chan->ramin->instance >> 12); INSTANCE_WR(chan->ramin_grctx->gpuobj, 0x0011c/4, 0x00000002); + switch (dev_priv->chipset) { + case 0x84: + nv84_graph_init_ctxvals(dev, chan->ramin_grctx); + break; + case 0x86: + nv86_graph_init_ctxvals(dev, chan->ramin_grctx); + break; + default: + /* This is complete crack, it accidently used to make at + * least some G8x cards work partially somehow, though there's + * no good reason why - and it stopped working as the rest + * of the code got off the drugs.. + */ + ret = engine->graph.load_context(chan); + if (ret) { + DRM_ERROR("Error hacking up context: %d\n", ret); + return ret; + } + break; + } + return 0; } -- cgit v1.2.3 From e317dfdabfb836165fbe3b006e53a88a1bc7c264 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 2 May 2008 00:06:22 +1000 Subject: nv50: PGRAPH exception handling completely different from earlier chips --- shared-core/nouveau_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c index ec158d82..3e1e6e30 100644 --- a/shared-core/nouveau_irq.c +++ b/shared-core/nouveau_irq.c @@ -432,6 +432,49 @@ nouveau_pgraph_irq_handler(struct drm_device *dev) NV_WRITE(NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); } +static void +nv50_pgraph_irq_handler(struct drm_device *dev) +{ + struct drm_nouveau_private *dev_priv = dev->dev_private; + uint32_t status; + + status = NV_READ(NV03_PGRAPH_INTR); + + if (status & 0x00000020) { + nouveau_pgraph_intr_error(dev, + NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD); + + status &= ~0x00000020; + NV_WRITE(NV03_PGRAPH_INTR, 0x00000020); + } + + if (status & 0x00100000) { + nouveau_pgraph_intr_error(dev, + NV03_PGRAPH_NSOURCE_DATA_ERROR); + + status &= ~0x00100000; + NV_WRITE(NV03_PGRAPH_INTR, 0x00100000); + } + + if (status & 0x00200000) { + nouveau_pgraph_intr_error(dev, + NV03_PGRAPH_NSOURCE_PROTECTION_ERROR); + + status &= ~0x00200000; + NV_WRITE(NV03_PGRAPH_INTR, 0x00200000); + } + + if (status) { + DRM_INFO("Unhandled PGRAPH_INTR - 0x%08x\n", status); + NV_WRITE(NV03_PGRAPH_INTR, status); + } + + if ((NV_READ(0x400500) & (1 << 16)) == 0) + NV_WRITE(0x400500, NV_READ(0x400500) | (1 << 16)); + + NV_WRITE(NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); +} + static void nouveau_crtc_irq_handler(struct drm_device *dev, int crtc) { @@ -485,7 +528,11 @@ nouveau_irq_handler(DRM_IRQ_ARGS) } if (status & NV_PMC_INTR_0_PGRAPH_PENDING) { - nouveau_pgraph_irq_handler(dev); + if (dev_priv->card_type >= NV_50) + nv50_pgraph_irq_handler(dev); + else + nouveau_pgraph_irq_handler(dev); + status &= ~NV_PMC_INTR_0_PGRAPH_PENDING; } -- cgit v1.2.3 From bfbe4ade3253330bd0c625d50fa2e7b5cb62dada Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 2 May 2008 00:50:21 +1000 Subject: nouveau: gather nsource in trap_info() The IRQ handling stuff really is a mess.. On the TODO :) --- shared-core/nouveau_irq.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c index 3e1e6e30..85a70b55 100644 --- a/shared-core/nouveau_irq.c +++ b/shared-core/nouveau_irq.c @@ -251,6 +251,7 @@ struct nouveau_pgraph_trap { int class; int subc, mthd, size; uint32_t data, data2; + uint32_t nsource, nstatus; }; static void @@ -260,6 +261,12 @@ nouveau_graph_trap_info(struct drm_device *dev, struct drm_nouveau_private *dev_priv = dev->dev_private; uint32_t address; + trap->nsource = trap->nstatus = 0; + if (dev_priv->card_type < NV_50) { + trap->nsource = NV_READ(NV03_PGRAPH_NSOURCE); + trap->nstatus = NV_READ(NV03_PGRAPH_NSTATUS); + } + if (nouveau_graph_trapped_channel(dev, &trap->channel)) trap->channel = -1; address = NV_READ(NV04_PGRAPH_TRAPPED_ADDR); @@ -289,10 +296,7 @@ nouveau_graph_dump_trap_info(struct drm_device *dev, const char *id, struct nouveau_pgraph_trap *trap) { struct drm_nouveau_private *dev_priv = dev->dev_private; - uint32_t nsource, nstatus; - - nsource = NV_READ(NV03_PGRAPH_NSOURCE); - nstatus = NV_READ(NV03_PGRAPH_NSTATUS); + uint32_t nsource = trap->nsource, nstatus = trap->nstatus; DRM_INFO("%s - nSource:", id); nouveau_print_bitfield_names(nsource, nouveau_nsource_names, @@ -347,6 +351,7 @@ nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource) int unhandled = 0; nouveau_graph_trap_info(dev, &trap); + trap.nsource = nsource; if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) { if (trap.channel >= 0 && trap.mthd == 0x0150) { -- cgit v1.2.3 From 5c4c778c0d7d3f4749efade3b1023b8b22c029a9 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 2 May 2008 00:52:21 +1000 Subject: nouveau: restore original NV_PFIFO_CACHES_REASSIGN value in fifo handler Doesn't fix any issue I've seen, but is a potential issue if a FIFO IRQ occurs during channel creation/takedown. --- shared-core/nouveau_irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c index 85a70b55..ccbc7420 100644 --- a/shared-core/nouveau_irq.c +++ b/shared-core/nouveau_irq.c @@ -71,8 +71,9 @@ nouveau_fifo_irq_handler(struct drm_device *dev) { struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_engine *engine = &dev_priv->Engine; - uint32_t status; + uint32_t status, reassign; + reassign = NV_READ(NV03_PFIFO_CACHES) & 1; while ((status = NV_READ(NV03_PFIFO_INTR_0))) { uint32_t chid, get; @@ -121,7 +122,7 @@ nouveau_fifo_irq_handler(struct drm_device *dev) NV_WRITE(NV03_PFIFO_INTR_0, status); } - NV_WRITE(NV03_PFIFO_CACHES, 1); + NV_WRITE(NV03_PFIFO_CACHES, reassign); } NV_WRITE(NV03_PMC_INTR_0, NV_PMC_INTR_0_PFIFO_PENDING); -- cgit v1.2.3 From 77d20928b330acda5b6ceb469f50757b5300702b Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 2 May 2008 00:53:42 +1000 Subject: nouveau: disable all card interrupts when unknown PFIFO IRQ occurs. This is possibly temporary. I can trigger an unending IRQ storm on G8x in some circumstances, and have no idea how to handle that particular PFIFO exception correctly yet. --- shared-core/nouveau_irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c index ccbc7420..103fd96b 100644 --- a/shared-core/nouveau_irq.c +++ b/shared-core/nouveau_irq.c @@ -120,6 +120,7 @@ nouveau_fifo_irq_handler(struct drm_device *dev) if (status) { DRM_INFO("Unhandled PFIFO_INTR - 0x%08x\n", status); NV_WRITE(NV03_PFIFO_INTR_0, status); + NV_WRITE(NV03_PMC_INTR_EN_0, 0); } NV_WRITE(NV03_PFIFO_CACHES, reassign); -- cgit v1.2.3 From 6d8062ac1e048c3643d3a9d2432e497e17f717de Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 2 May 2008 01:03:51 +1000 Subject: nouveau: guard against channels potentially not having a context, fix nv50 --- shared-core/nouveau_irq.c | 79 +++++++++++++++++++++++------------------------ shared-core/nv50_graph.c | 2 -- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c index 103fd96b..d002f642 100644 --- a/shared-core/nouveau_irq.c +++ b/shared-core/nouveau_irq.c @@ -191,55 +191,54 @@ nouveau_print_bitfield_names(uint32_t value, } static int -nouveau_graph_trapped_channel(struct drm_device *dev, int *channel_ret) +nouveau_graph_chid_from_grctx(struct drm_device *dev) { struct drm_nouveau_private *dev_priv = dev->dev_private; - struct nouveau_engine *engine = &dev_priv->Engine; - int channel; + uint32_t inst; + int i; - if (dev_priv->card_type < NV_10) { - channel = (NV_READ(NV04_PGRAPH_TRAPPED_ADDR) >> 24) & 0xf; - } else if (dev_priv->card_type < NV_40) { - channel = (NV_READ(NV04_PGRAPH_TRAPPED_ADDR) >> 20) & 0x1f; - } else - if (dev_priv->card_type < NV_50) { - uint32_t cur_grctx = (NV_READ(0x40032C) & 0xfffff) << 4; + if (dev_priv->card_type < NV_40) + return dev_priv->Engine.fifo.channels; + else + if (dev_priv->card_type < NV_50) + inst = (NV_READ(0x40032c) & 0xfffff) << 4; + else + inst = NV_READ(0x40032c) & 0xfffff; - /* 0x400704 *sometimes* contains a sensible channel ID, but - * mostly not.. for now lookup which channel owns the active - * PGRAPH context. Probably a better way, but this'll do - * for now. - */ - for (channel = 0; channel < 32; channel++) { - if (dev_priv->fifos[channel] == NULL) - continue; - if (cur_grctx == - dev_priv->fifos[channel]->ramin_grctx->instance) - break; - } - if (channel == 32) { - DRM_ERROR("AIII, unable to determine active channel " - "from PGRAPH context 0x%08x\n", cur_grctx); - return -EINVAL; - } - } else { - uint32_t cur_grctx = (NV_READ(0x40032C) & 0xfffff) << 12; + for (i = 0; i < dev_priv->Engine.fifo.channels; i++) { + struct nouveau_channel *chan = dev_priv->fifos[i]; + + if (!chan || !chan->ramin_grctx) + continue; - for (channel = 0; channel < 128; channel++) { - if (dev_priv->fifos[channel] == NULL) - continue; - if (cur_grctx == - dev_priv->fifos[channel]->ramin_grctx->instance) + if (dev_priv->card_type < NV_50) { + if (inst == chan->ramin_grctx->instance) + break; + } else { + if (inst == INSTANCE_RD(chan->ramin_grctx->gpuobj, 0)) break; - } - if (channel == 128) { - DRM_ERROR("AIII, unable to determine active channel " - "from PGRAPH context 0x%08x\n", cur_grctx); - return -EINVAL; } } - if (channel > engine->fifo.channels || !dev_priv->fifos[channel]) { + return i; +} + +static int +nouveau_graph_trapped_channel(struct drm_device *dev, int *channel_ret) +{ + struct drm_nouveau_private *dev_priv = dev->dev_private; + struct nouveau_engine *engine = &dev_priv->Engine; + int channel; + + if (dev_priv->card_type < NV_10) + channel = (NV_READ(NV04_PGRAPH_TRAPPED_ADDR) >> 24) & 0xf; + else + if (dev_priv->card_type < NV_40) + channel = (NV_READ(NV04_PGRAPH_TRAPPED_ADDR) >> 20) & 0x1f; + else + channel = nouveau_graph_chid_from_grctx(dev); + + if (channel >= engine->fifo.channels || !dev_priv->fifos[channel]) { DRM_ERROR("AIII, invalid/inactive channel id %d\n", channel); return -EINVAL; } diff --git a/shared-core/nv50_graph.c b/shared-core/nv50_graph.c index ebe4b1f6..1300c83a 100644 --- a/shared-core/nv50_graph.c +++ b/shared-core/nv50_graph.c @@ -251,7 +251,6 @@ nv86_graph_init_ctxvals(struct drm_device *dev, struct nouveau_gpuobj_ref *ref) struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_gpuobj *ctx = ref->gpuobj; - INSTANCE_WR(ctx, 0x0/4, 0x1); INSTANCE_WR(ctx, 0x10C/4, 0x30); INSTANCE_WR(ctx, 0x1D4/4, 0x3); INSTANCE_WR(ctx, 0x1D8/4, 0x1000); @@ -937,7 +936,6 @@ nv84_graph_init_ctxvals(struct drm_device *dev, struct nouveau_gpuobj_ref *ref) struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_gpuobj *ctx = ref->gpuobj; - INSTANCE_WR(ctx, 0x00000/4, 0x00000001); INSTANCE_WR(ctx, 0x0010c/4, 0x00000030); INSTANCE_WR(ctx, 0x00130/4, 0x00000002); INSTANCE_WR(ctx, 0x001d4/4, 0x00000003); -- cgit v1.2.3 From 3ac74f3208ed15a990a0a26742fbfe566f08aa80 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 2 May 2008 01:36:30 +1000 Subject: nv50: enable 0x400500 bit 0 after PGRAPH exception also No solid idea about what these 2 bits do, but nv50 can now survive a few PGRAPH exceptions just as nv40 does :) --- shared-core/nouveau_irq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c index d002f642..2a3d8a0b 100644 --- a/shared-core/nouveau_irq.c +++ b/shared-core/nouveau_irq.c @@ -475,8 +475,12 @@ nv50_pgraph_irq_handler(struct drm_device *dev) NV_WRITE(NV03_PGRAPH_INTR, status); } - if ((NV_READ(0x400500) & (1 << 16)) == 0) - NV_WRITE(0x400500, NV_READ(0x400500) | (1 << 16)); + { + const int isb = (1 << 16) | (1 << 0); + + if ((NV_READ(0x400500) & isb) != isb) + NV_WRITE(0x400500, NV_READ(0x400500) | isb); + } NV_WRITE(NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); } -- cgit v1.2.3 From d015219bd0b25f367be23e5df8355f479ee53a0f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 5 May 2008 16:49:04 +1000 Subject: r500: add allowed range for us config/pixsize --- shared-core/r300_cmdbuf.c | 1 + shared-core/r300_reg.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/shared-core/r300_cmdbuf.c b/shared-core/r300_cmdbuf.c index 0a789014..e7149bd9 100644 --- a/shared-core/r300_cmdbuf.c +++ b/shared-core/r300_cmdbuf.c @@ -235,6 +235,7 @@ void r300_init_reg_flags(struct drm_device *dev) ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8); if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) { + ADD_RANGE(R500_US_CONFIG, 2); ADD_RANGE(R500_RS_IP_0, 16); ADD_RANGE(R500_RS_INST_0, 16); } else { diff --git a/shared-core/r300_reg.h b/shared-core/r300_reg.h index 578e7e93..1fce3529 100644 --- a/shared-core/r300_reg.h +++ b/shared-core/r300_reg.h @@ -1632,6 +1632,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_RS_IP_0 0x4074 #define R500_RS_INST_0 0x4320 +#define R500_US_CONFIG 0x4600 + #endif /* _R300_REG_H */ /* *INDENT-ON* */ -- cgit v1.2.3 From b44f2da380e78769b58c751e81f376f0fa1f48aa Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 7 May 2008 15:10:23 +1000 Subject: drm: nopage compat fixup for drm_vm The kernel has removed nopage so move the old nopage codepaths into a compat vm file and switch to using the fault paths. nopfn is on its way out in the future also, so we should switch to using fault for that path as well soon --- linux-core/Makefile.kernel | 2 +- linux-core/drm_compat.c | 1 + linux-core/drm_compat.h | 19 +++ linux-core/drm_vm.c | 142 +++++++++----------- linux-core/drm_vm_nopage_compat.c | 267 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 349 insertions(+), 82 deletions(-) create mode 100644 linux-core/drm_vm_nopage_compat.c diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel index f012262d..7a477a10 100644 --- a/linux-core/Makefile.kernel +++ b/linux-core/Makefile.kernel @@ -14,7 +14,7 @@ drm-objs := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \ drm_memory_debug.o ati_pcigart.o drm_sman.o \ drm_hashtab.o drm_mm.o drm_object.o drm_compat.o \ drm_fence.o drm_ttm.o drm_bo.o drm_bo_move.o drm_bo_lock.o \ - drm_regman.o + drm_regman.o drm_vm_nopage_compat.o tdfx-objs := tdfx_drv.o r128-objs := r128_drv.o r128_cce.o r128_state.o r128_irq.o mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c index 23e5028a..3d082e7e 100644 --- a/linux-core/drm_compat.c +++ b/linux-core/drm_compat.c @@ -758,3 +758,4 @@ void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, EXPORT_SYMBOL(kmap_atomic_prot_pfn); #endif + diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 3b1287e1..30834f33 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -343,4 +343,23 @@ extern void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1) #endif +#ifndef VM_CAN_NONLINEAR +#define DRM_VM_NOPAGE 1 +#endif + +#ifdef DRM_VM_NOPAGE + +extern struct page *drm_vm_nopage(struct vm_area_struct *vma, + unsigned long address, int *type); + +extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address, int *type); + +extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address, int *type); + +extern struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, + unsigned long address, int *type); +#endif + #endif diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index b85b4c13..6618c0ae 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -81,8 +81,9 @@ static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma) return tmp; } +#ifndef DRM_VM_NOPAGE /** - * \c nopage method for AGP virtual memory. + * \c fault method for AGP virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -92,8 +93,7 @@ static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma) * map, get the page, increment the use count and return it. */ #if __OS_HAS_AGP -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_file *priv = vma->vm_file->private_data; struct drm_device *dev = priv->minor->dev; @@ -105,19 +105,24 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, * Find the right map */ if (!drm_core_has_AGP(dev)) - goto vm_nopage_error; + goto vm_fault_error; if (!dev->agp || !dev->agp->cant_use_aperture) - goto vm_nopage_error; + goto vm_fault_error; if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) - goto vm_nopage_error; + goto vm_fault_error; r_list = drm_hash_entry(hash, struct drm_map_list, hash); map = r_list->map; if (map && map->type == _DRM_AGP) { - unsigned long offset = address - vma->vm_start; + /* + * Using vm_pgoff as a selector forces us to use this unusual + * addressing scheme. + */ + unsigned long offset = (unsigned long)vmf->virtual_address - + vma->vm_start; unsigned long baddr = map->offset + offset; struct drm_agp_mem *agpmem; struct page *page; @@ -139,7 +144,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, } if (!agpmem) - goto vm_nopage_error; + goto vm_fault_error; /* * Get the page, inc the use count, and return it @@ -147,25 +152,21 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, offset = (baddr - agpmem->bound) >> PAGE_SHIFT; page = virt_to_page(__va(agpmem->memory->memory[offset])); get_page(page); + vmf->page = page; -#if 0 - /* page_count() not defined everywhere */ DRM_DEBUG ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", baddr, __va(agpmem->memory->memory[offset]), offset, page_count(page)); -#endif - - return page; + return 0; } - vm_nopage_error: - return NOPAGE_SIGBUS; /* Disallow mremap */ +vm_fault_error: + return VM_FAULT_SIGBUS; /* Disallow mremap */ } #else /* __OS_HAS_AGP */ -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; } #endif /* __OS_HAS_AGP */ @@ -179,29 +180,28 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, * Get the mapping, find the real physical page to map, get the page, and * return it. */ -static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address) +static int drm_do_vm_shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_map *map = (struct drm_map *) vma->vm_private_data; unsigned long offset; unsigned long i; struct page *page; - if (address > vma->vm_end) - return NOPAGE_SIGBUS; /* Disallow mremap */ if (!map) - return NOPAGE_SIGBUS; /* Nothing allocated */ + return VM_FAULT_SIGBUS; /* Nothing allocated */ - offset = address - vma->vm_start; + offset = (unsigned long)vmf->virtual_address - vma->vm_start; i = (unsigned long)map->handle + offset; page = vmalloc_to_page((void *)i); if (!page) - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; get_page(page); + vmf->page = page; - DRM_DEBUG("0x%lx\n", address); - return page; + DRM_DEBUG("shm_fault 0x%lx\n", offset); + return 0; } +#endif /** * \c close method for shared virtual memory. @@ -283,8 +283,9 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) mutex_unlock(&dev->struct_mutex); } +#ifndef DRM_VM_NOPAGE /** - * \c nopage method for DMA virtual memory. + * \c fault method for DMA virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -292,8 +293,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) * * Determine the page number from the page offset and get it from drm_device_dma::pagelist. */ -static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, - unsigned long address) +static int drm_do_vm_dma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_file *priv = vma->vm_file->private_data; struct drm_device *dev = priv->minor->dev; @@ -303,24 +303,23 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, struct page *page; if (!dma) - return NOPAGE_SIGBUS; /* Error */ - if (address > vma->vm_end) - return NOPAGE_SIGBUS; /* Disallow mremap */ + return VM_FAULT_SIGBUS; /* Error */ if (!dma->pagelist) - return NOPAGE_SIGBUS; /* Nothing allocated */ + return VM_FAULT_SIGBUS; /* Nothing allocated */ - offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ - page_nr = offset >> PAGE_SHIFT; + offset = (unsigned long)vmf->virtual_address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ + page_nr = offset >> PAGE_SHIFT; /* page_nr could just be vmf->pgoff */ page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK)))); get_page(page); + vmf->page = page; - DRM_DEBUG("0x%lx (page %lu)\n", address, page_nr); - return page; + DRM_DEBUG("dma_fault 0x%lx (page %lu)\n", offset, page_nr); + return 0; } /** - * \c nopage method for scatter-gather virtual memory. + * \c fault method for scatter-gather virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -328,8 +327,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, * * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist. */ -static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, - unsigned long address) +static int drm_do_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_map *map = (struct drm_map *) vma->vm_private_data; struct drm_file *priv = vma->vm_file->private_data; @@ -340,80 +338,62 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, unsigned long page_offset; struct page *page; - DRM_DEBUG("\n"); if (!entry) - return NOPAGE_SIGBUS; /* Error */ - if (address > vma->vm_end) - return NOPAGE_SIGBUS; /* Disallow mremap */ + return VM_FAULT_SIGBUS; /* Error */ if (!entry->pagelist) - return NOPAGE_SIGBUS; /* Nothing allocated */ + return VM_FAULT_SIGBUS; /* Nothing allocated */ - offset = address - vma->vm_start; + offset = (unsigned long)vmf->virtual_address - vma->vm_start; map_offset = map->offset - (unsigned long)dev->sg->virtual; page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); page = entry->pagelist[page_offset]; get_page(page); + vmf->page = page; - return page; -} - -static struct page *drm_vm_nopage(struct vm_area_struct *vma, - unsigned long address, int *type) -{ - if (type) - *type = VM_FAULT_MINOR; - return drm_do_vm_nopage(vma, address); -} - -static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address, int *type) -{ - if (type) - *type = VM_FAULT_MINOR; - return drm_do_vm_shm_nopage(vma, address); -} - -static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, - unsigned long address, int *type) -{ - if (type) - *type = VM_FAULT_MINOR; - return drm_do_vm_dma_nopage(vma, address); -} - -static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, - unsigned long address, int *type) -{ - if (type) - *type = VM_FAULT_MINOR; - return drm_do_vm_sg_nopage(vma, address); + return 0; } - +#endif /** AGP virtual memory operations */ static struct vm_operations_struct drm_vm_ops = { +#ifdef DRM_VM_NOPAGE .nopage = drm_vm_nopage, +#else + .fault = drm_do_vm_fault, +#endif .open = drm_vm_open, .close = drm_vm_close, }; /** Shared virtual memory operations */ static struct vm_operations_struct drm_vm_shm_ops = { +#ifdef DRM_VM_NOPAGE .nopage = drm_vm_shm_nopage, +#else + .fault = drm_do_vm_shm_fault, +#endif .open = drm_vm_open, .close = drm_vm_shm_close, }; /** DMA virtual memory operations */ static struct vm_operations_struct drm_vm_dma_ops = { +#ifdef DRM_VM_NOPAGE .nopage = drm_vm_dma_nopage, +#else + .fault = drm_do_vm_dma_fault, +#endif .open = drm_vm_open, .close = drm_vm_close, }; /** Scatter-gather virtual memory operations */ static struct vm_operations_struct drm_vm_sg_ops = { +#ifdef DRM_VM_NOPAGE .nopage = drm_vm_sg_nopage, +#else + .fault = drm_do_vm_sg_fault, +#endif .open = drm_vm_open, .close = drm_vm_close, }; diff --git a/linux-core/drm_vm_nopage_compat.c b/linux-core/drm_vm_nopage_compat.c new file mode 100644 index 00000000..be8d6c1c --- /dev/null +++ b/linux-core/drm_vm_nopage_compat.c @@ -0,0 +1,267 @@ +/** + * \file drm_vm.c + * Memory mapping for DRM + * + * \author Rickard E. (Rik) Faith + * \author Gareth Hughes + */ + +/* + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "drmP.h" + +#ifdef DRM_VM_NOPAGE +/** + * \c nopage method for AGP virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Find the right map and if it's AGP memory find the real physical page to + * map, get the page, increment the use count and return it. + */ +#if __OS_HAS_AGP +static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + struct drm_file *priv = vma->vm_file->private_data; + struct drm_device *dev = priv->minor->dev; + struct drm_map *map = NULL; + struct drm_map_list *r_list; + struct drm_hash_item *hash; + + /* + * Find the right map + */ + if (!drm_core_has_AGP(dev)) + goto vm_nopage_error; + + if (!dev->agp || !dev->agp->cant_use_aperture) + goto vm_nopage_error; + + if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) + goto vm_nopage_error; + + r_list = drm_hash_entry(hash, struct drm_map_list, hash); + map = r_list->map; + + if (map && map->type == _DRM_AGP) { + unsigned long offset = address - vma->vm_start; + unsigned long baddr = map->offset + offset; + struct drm_agp_mem *agpmem; + struct page *page; + +#ifdef __alpha__ + /* + * Adjust to a bus-relative address + */ + baddr -= dev->hose->mem_space->start; +#endif + + /* + * It's AGP memory - find the real physical page to map + */ + list_for_each_entry(agpmem, &dev->agp->memory, head) { + if (agpmem->bound <= baddr && + agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) + break; + } + + if (!agpmem) + goto vm_nopage_error; + + /* + * Get the page, inc the use count, and return it + */ + offset = (baddr - agpmem->bound) >> PAGE_SHIFT; + page = virt_to_page(__va(agpmem->memory->memory[offset])); + get_page(page); + +#if 0 + /* page_count() not defined everywhere */ + DRM_DEBUG + ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", + baddr, __va(agpmem->memory->memory[offset]), offset, + page_count(page)); +#endif + + return page; + } + vm_nopage_error: + return NOPAGE_SIGBUS; /* Disallow mremap */ +} +#else /* __OS_HAS_AGP */ +static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + return NOPAGE_SIGBUS; +} +#endif /* __OS_HAS_AGP */ + +/** + * \c nopage method for shared virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Get the mapping, find the real physical page to map, get the page, and + * return it. + */ +static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + struct drm_map *map = (struct drm_map *) vma->vm_private_data; + unsigned long offset; + unsigned long i; + struct page *page; + + if (address > vma->vm_end) + return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!map) + return NOPAGE_SIGBUS; /* Nothing allocated */ + + offset = address - vma->vm_start; + i = (unsigned long)map->handle + offset; + page = vmalloc_to_page((void *)i); + if (!page) + return NOPAGE_SIGBUS; + get_page(page); + + DRM_DEBUG("0x%lx\n", address); + return page; +} + +/** + * \c nopage method for DMA virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Determine the page number from the page offset and get it from drm_device_dma::pagelist. + */ +static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + struct drm_file *priv = vma->vm_file->private_data; + struct drm_device *dev = priv->minor->dev; + struct drm_device_dma *dma = dev->dma; + unsigned long offset; + unsigned long page_nr; + struct page *page; + + if (!dma) + return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) + return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!dma->pagelist) + return NOPAGE_SIGBUS; /* Nothing allocated */ + + offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ + page_nr = offset >> PAGE_SHIFT; + page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK)))); + + get_page(page); + + DRM_DEBUG("0x%lx (page %lu)\n", address, page_nr); + return page; +} + +/** + * \c nopage method for scatter-gather virtual memory. + * + * \param vma virtual memory area. + * \param address access address. + * \return pointer to the page structure. + * + * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist. + */ +static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, + unsigned long address) +{ + struct drm_map *map = (struct drm_map *) vma->vm_private_data; + struct drm_file *priv = vma->vm_file->private_data; + struct drm_device *dev = priv->minor->dev; + struct drm_sg_mem *entry = dev->sg; + unsigned long offset; + unsigned long map_offset; + unsigned long page_offset; + struct page *page; + + DRM_DEBUG("\n"); + if (!entry) + return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) + return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!entry->pagelist) + return NOPAGE_SIGBUS; /* Nothing allocated */ + + offset = address - vma->vm_start; + map_offset = map->offset - (unsigned long)dev->sg->virtual; + page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); + page = entry->pagelist[page_offset]; + get_page(page); + + return page; +} + + +struct page *drm_vm_nopage(struct vm_area_struct *vma, + unsigned long address, int *type) +{ + if (type) + *type = VM_FAULT_MINOR; + return drm_do_vm_nopage(vma, address); +} + +struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address, int *type) +{ + if (type) + *type = VM_FAULT_MINOR; + return drm_do_vm_shm_nopage(vma, address); +} + +struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address, int *type) +{ + if (type) + *type = VM_FAULT_MINOR; + return drm_do_vm_dma_nopage(vma, address); +} + +struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, + unsigned long address, int *type) +{ + if (type) + *type = VM_FAULT_MINOR; + return drm_do_vm_sg_nopage(vma, address); +} +#endif -- cgit v1.2.3