Enscript Output

extractedLnx/linux-2.6.36/drivers/gpu/drm/nouveau/nv50_grctx.c_nv50_graph_construct_mmio.c

static void
nv50_graph_construct_mmio(struct nouveau_grctx *ctx)
{
	struct drm_nouveau_private *dev_priv = ctx->dev->dev_private;
	int i, j;
	int offset, base;
	uint32_t units = nv_rd32 (ctx->dev, 0x1540);

	/* 0800: DISPATCH */
	cp_ctx(ctx, 0x400808, 7);
	gr_def(ctx, 0x400814, 0x00000030);
	cp_ctx(ctx, 0x400834, 0x32);
	if (dev_priv->chipset == 0x50) {
		gr_def(ctx, 0x400834, 0xff400040);
		gr_def(ctx, 0x400838, 0xfff00080);
		gr_def(ctx, 0x40083c, 0xfff70090);
		gr_def(ctx, 0x400840, 0xffe806a8);
	}
	gr_def(ctx, 0x400844, 0x00000002);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa)
		gr_def(ctx, 0x400894, 0x00001000);
	gr_def(ctx, 0x4008e8, 0x00000003);
	gr_def(ctx, 0x4008ec, 0x00001000);
	if (dev_priv->chipset == 0x50)
		cp_ctx(ctx, 0x400908, 0xb);
	else if (dev_priv->chipset < 0xa0)
		cp_ctx(ctx, 0x400908, 0xc);
	else
		cp_ctx(ctx, 0x400908, 0xe);

	if (dev_priv->chipset >= 0xa0)
		cp_ctx(ctx, 0x400b00, 0x1);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa) {
		cp_ctx(ctx, 0x400b10, 0x1);
		gr_def(ctx, 0x400b10, 0x0001629d);
		cp_ctx(ctx, 0x400b20, 0x1);
		gr_def(ctx, 0x400b20, 0x0001629d);
	}

	/* 0C00: VFETCH */
	cp_ctx(ctx, 0x400c08, 0x2);
	gr_def(ctx, 0x400c08, 0x0000fe0c);

	/* 1000 */
	if (dev_priv->chipset < 0xa0) {
		cp_ctx(ctx, 0x401008, 0x4);
		gr_def(ctx, 0x401014, 0x00001000);
	} else if (dev_priv->chipset == 0xa0 || dev_priv->chipset >= 0xaa) {
		cp_ctx(ctx, 0x401008, 0x5);
		gr_def(ctx, 0x401018, 0x00001000);
	} else {
		cp_ctx(ctx, 0x401008, 0x5);
		gr_def(ctx, 0x401018, 0x00004000);
	}

	/* 1400 */
	cp_ctx(ctx, 0x401400, 0x8);
	cp_ctx(ctx, 0x401424, 0x3);
	if (dev_priv->chipset == 0x50)
		gr_def(ctx, 0x40142c, 0x0001fd87);
	else
		gr_def(ctx, 0x40142c, 0x00000187);
	cp_ctx(ctx, 0x401540, 0x5);
	gr_def(ctx, 0x401550, 0x00001018);

	/* 1800: STREAMOUT */
	cp_ctx(ctx, 0x401814, 0x1);
	gr_def(ctx, 0x401814, 0x000000ff);
	if (dev_priv->chipset == 0x50) {
		cp_ctx(ctx, 0x40181c, 0xe);
		gr_def(ctx, 0x401850, 0x00000004);
	} else if (dev_priv->chipset < 0xa0) {
		cp_ctx(ctx, 0x40181c, 0xf);
		gr_def(ctx, 0x401854, 0x00000004);
	} else {
		cp_ctx(ctx, 0x40181c, 0x13);
		gr_def(ctx, 0x401864, 0x00000004);
	}

	/* 1C00 */
	cp_ctx(ctx, 0x401c00, 0x1);
	switch (dev_priv->chipset) {
	case 0x50:
		gr_def(ctx, 0x401c00, 0x0001005f);
		break;
	case 0x84:
	case 0x86:
	case 0x94:
		gr_def(ctx, 0x401c00, 0x044d00df);
		break;
	case 0x92:
	case 0x96:
	case 0x98:
	case 0xa0:
	case 0xaa:
	case 0xac:
		gr_def(ctx, 0x401c00, 0x042500df);
		break;
	case 0xa3:
	case 0xa5:
	case 0xa8:
		gr_def(ctx, 0x401c00, 0x142500df);
		break;
	}

	/* 2400 */
	cp_ctx(ctx, 0x402400, 0x1);
	if (dev_priv->chipset == 0x50)
		cp_ctx(ctx, 0x402408, 0x1);
	else
		cp_ctx(ctx, 0x402408, 0x2);
	gr_def(ctx, 0x402408, 0x00000600);

	/* 2800 */
	cp_ctx(ctx, 0x402800, 0x1);
	if (dev_priv->chipset == 0x50)
		gr_def(ctx, 0x402800, 0x00000006);

	/* 2C00 */
	cp_ctx(ctx, 0x402c08, 0x6);
	if (dev_priv->chipset != 0x50)
		gr_def(ctx, 0x402c14, 0x01000000);
	gr_def(ctx, 0x402c18, 0x000000ff);
	if (dev_priv->chipset == 0x50)
		cp_ctx(ctx, 0x402ca0, 0x1);
	else
		cp_ctx(ctx, 0x402ca0, 0x2);
	if (dev_priv->chipset < 0xa0)
		gr_def(ctx, 0x402ca0, 0x00000400);
	else if (dev_priv->chipset == 0xa0 || dev_priv->chipset >= 0xaa)
		gr_def(ctx, 0x402ca0, 0x00000800);
	else
		gr_def(ctx, 0x402ca0, 0x00000400);
	cp_ctx(ctx, 0x402cac, 0x4);

	/* 3000 */
	cp_ctx(ctx, 0x403004, 0x1);
	gr_def(ctx, 0x403004, 0x00000001);

	/* 3404 */
	if (dev_priv->chipset >= 0xa0) {
		cp_ctx(ctx, 0x403404, 0x1);
		gr_def(ctx, 0x403404, 0x00000001);
	}

	/* 5000 */
	cp_ctx(ctx, 0x405000, 0x1);
	switch (dev_priv->chipset) {
	case 0x50:
		gr_def(ctx, 0x405000, 0x00300080);
		break;
	case 0x84:
	case 0xa0:
	case 0xa3:
	case 0xa5:
	case 0xa8:
	case 0xaa:
	case 0xac:
		gr_def(ctx, 0x405000, 0x000e0080);
		break;
	case 0x86:
	case 0x92:
	case 0x94:
	case 0x96:
	case 0x98:
		gr_def(ctx, 0x405000, 0x00000080);
		break;
	}
	cp_ctx(ctx, 0x405014, 0x1);
	gr_def(ctx, 0x405014, 0x00000004);
	cp_ctx(ctx, 0x40501c, 0x1);
	cp_ctx(ctx, 0x405024, 0x1);
	cp_ctx(ctx, 0x40502c, 0x1);

	/* 5400 or maybe 4800 */
	if (dev_priv->chipset == 0x50) {
		offset = 0x405400;
		cp_ctx(ctx, 0x405400, 0xea);
	} else if (dev_priv->chipset < 0x94) {
		offset = 0x405400;
		cp_ctx(ctx, 0x405400, 0xcb);
	} else if (dev_priv->chipset < 0xa0) {
		offset = 0x405400;
		cp_ctx(ctx, 0x405400, 0xcc);
	} else if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa) {
		offset = 0x404800;
		cp_ctx(ctx, 0x404800, 0xda);
	} else {
		offset = 0x405400;
		cp_ctx(ctx, 0x405400, 0xd4);
	}
	gr_def(ctx, offset + 0x0c, 0x00000002);
	gr_def(ctx, offset + 0x10, 0x00000001);
	if (dev_priv->chipset >= 0x94)
		offset += 4;
	gr_def(ctx, offset + 0x1c, 0x00000001);
	gr_def(ctx, offset + 0x20, 0x00000100);
	gr_def(ctx, offset + 0x38, 0x00000002);
	gr_def(ctx, offset + 0x3c, 0x00000001);
	gr_def(ctx, offset + 0x40, 0x00000001);
	gr_def(ctx, offset + 0x50, 0x00000001);
	gr_def(ctx, offset + 0x54, 0x003fffff);
	gr_def(ctx, offset + 0x58, 0x00001fff);
	gr_def(ctx, offset + 0x60, 0x00000001);
	gr_def(ctx, offset + 0x64, 0x00000001);
	gr_def(ctx, offset + 0x6c, 0x00000001);
	gr_def(ctx, offset + 0x70, 0x00000001);
	gr_def(ctx, offset + 0x74, 0x00000001);
	gr_def(ctx, offset + 0x78, 0x00000004);
	gr_def(ctx, offset + 0x7c, 0x00000001);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa)
		offset += 4;
	gr_def(ctx, offset + 0x80, 0x00000001);
	gr_def(ctx, offset + 0x84, 0x00000001);
	gr_def(ctx, offset + 0x88, 0x00000007);
	gr_def(ctx, offset + 0x8c, 0x00000001);
	gr_def(ctx, offset + 0x90, 0x00000007);
	gr_def(ctx, offset + 0x94, 0x00000001);
	gr_def(ctx, offset + 0x98, 0x00000001);
	gr_def(ctx, offset + 0x9c, 0x00000001);
	if (dev_priv->chipset == 0x50) {
		 gr_def(ctx, offset + 0xb0, 0x00000001);
		 gr_def(ctx, offset + 0xb4, 0x00000001);
		 gr_def(ctx, offset + 0xbc, 0x00000001);
		 gr_def(ctx, offset + 0xc0, 0x0000000a);
		 gr_def(ctx, offset + 0xd0, 0x00000040);
		 gr_def(ctx, offset + 0xd8, 0x00000002);
		 gr_def(ctx, offset + 0xdc, 0x00000100);
		 gr_def(ctx, offset + 0xe0, 0x00000001);
		 gr_def(ctx, offset + 0xe4, 0x00000100);
		 gr_def(ctx, offset + 0x100, 0x00000001);
		 gr_def(ctx, offset + 0x124, 0x00000004);
		 gr_def(ctx, offset + 0x13c, 0x00000001);
		 gr_def(ctx, offset + 0x140, 0x00000100);
		 gr_def(ctx, offset + 0x148, 0x00000001);
		 gr_def(ctx, offset + 0x154, 0x00000100);
		 gr_def(ctx, offset + 0x158, 0x00000001);
		 gr_def(ctx, offset + 0x15c, 0x00000100);
		 gr_def(ctx, offset + 0x164, 0x00000001);
		 gr_def(ctx, offset + 0x170, 0x00000100);
		 gr_def(ctx, offset + 0x174, 0x00000001);
		 gr_def(ctx, offset + 0x17c, 0x00000001);
		 gr_def(ctx, offset + 0x188, 0x00000002);
		 gr_def(ctx, offset + 0x190, 0x00000001);
		 gr_def(ctx, offset + 0x198, 0x00000001);
		 gr_def(ctx, offset + 0x1ac, 0x00000003);
		 offset += 0xd0;
	} else {
		gr_def(ctx, offset + 0xb0, 0x00000001);
		gr_def(ctx, offset + 0xb4, 0x00000100);
		gr_def(ctx, offset + 0xbc, 0x00000001);
		gr_def(ctx, offset + 0xc8, 0x00000100);
		gr_def(ctx, offset + 0xcc, 0x00000001);
		gr_def(ctx, offset + 0xd0, 0x00000100);
		gr_def(ctx, offset + 0xd8, 0x00000001);
		gr_def(ctx, offset + 0xe4, 0x00000100);
	}
	gr_def(ctx, offset + 0xf8, 0x00000004);
	gr_def(ctx, offset + 0xfc, 0x00000070);
	gr_def(ctx, offset + 0x100, 0x00000080);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa)
		offset += 4;
	gr_def(ctx, offset + 0x114, 0x0000000c);
	if (dev_priv->chipset == 0x50)
		offset -= 4;
	gr_def(ctx, offset + 0x11c, 0x00000008);
	gr_def(ctx, offset + 0x120, 0x00000014);
	if (dev_priv->chipset == 0x50) {
		gr_def(ctx, offset + 0x124, 0x00000026);
		offset -= 0x18;
	} else {
		gr_def(ctx, offset + 0x128, 0x00000029);
		gr_def(ctx, offset + 0x12c, 0x00000027);
		gr_def(ctx, offset + 0x130, 0x00000026);
		gr_def(ctx, offset + 0x134, 0x00000008);
		gr_def(ctx, offset + 0x138, 0x00000004);
		gr_def(ctx, offset + 0x13c, 0x00000027);
	}
	gr_def(ctx, offset + 0x148, 0x00000001);
	gr_def(ctx, offset + 0x14c, 0x00000002);
	gr_def(ctx, offset + 0x150, 0x00000003);
	gr_def(ctx, offset + 0x154, 0x00000004);
	gr_def(ctx, offset + 0x158, 0x00000005);
	gr_def(ctx, offset + 0x15c, 0x00000006);
	gr_def(ctx, offset + 0x160, 0x00000007);
	gr_def(ctx, offset + 0x164, 0x00000001);
	gr_def(ctx, offset + 0x1a8, 0x000000cf);
	if (dev_priv->chipset == 0x50)
		offset -= 4;
	gr_def(ctx, offset + 0x1d8, 0x00000080);
	gr_def(ctx, offset + 0x1dc, 0x00000004);
	gr_def(ctx, offset + 0x1e0, 0x00000004);
	if (dev_priv->chipset == 0x50)
		offset -= 4;
	else
		gr_def(ctx, offset + 0x1e4, 0x00000003);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa) {
		gr_def(ctx, offset + 0x1ec, 0x00000003);
		offset += 8;
	}
	gr_def(ctx, offset + 0x1e8, 0x00000001);
	if (dev_priv->chipset == 0x50)
		offset -= 4;
	gr_def(ctx, offset + 0x1f4, 0x00000012);
	gr_def(ctx, offset + 0x1f8, 0x00000010);
	gr_def(ctx, offset + 0x1fc, 0x0000000c);
	gr_def(ctx, offset + 0x200, 0x00000001);
	gr_def(ctx, offset + 0x210, 0x00000004);
	gr_def(ctx, offset + 0x214, 0x00000002);
	gr_def(ctx, offset + 0x218, 0x00000004);
	if (dev_priv->chipset >= 0xa0)
		offset += 4;
	gr_def(ctx, offset + 0x224, 0x003fffff);
	gr_def(ctx, offset + 0x228, 0x00001fff);
	if (dev_priv->chipset == 0x50)
		offset -= 0x20;
	else if (dev_priv->chipset >= 0xa0) {
		gr_def(ctx, offset + 0x250, 0x00000001);
		gr_def(ctx, offset + 0x254, 0x00000001);
		gr_def(ctx, offset + 0x258, 0x00000002);
		offset += 0x10;
	}
	gr_def(ctx, offset + 0x250, 0x00000004);
	gr_def(ctx, offset + 0x254, 0x00000014);
	gr_def(ctx, offset + 0x258, 0x00000001);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa)
		offset += 4;
	gr_def(ctx, offset + 0x264, 0x00000002);
	if (dev_priv->chipset >= 0xa0)
		offset += 8;
	gr_def(ctx, offset + 0x270, 0x00000001);
	gr_def(ctx, offset + 0x278, 0x00000002);
	gr_def(ctx, offset + 0x27c, 0x00001000);
	if (dev_priv->chipset == 0x50)
		offset -= 0xc;
	else {
		gr_def(ctx, offset + 0x280, 0x00000e00);
		gr_def(ctx, offset + 0x284, 0x00001000);
		gr_def(ctx, offset + 0x288, 0x00001e00);
	}
	gr_def(ctx, offset + 0x290, 0x00000001);
	gr_def(ctx, offset + 0x294, 0x00000001);
	gr_def(ctx, offset + 0x298, 0x00000001);
	gr_def(ctx, offset + 0x29c, 0x00000001);
	gr_def(ctx, offset + 0x2a0, 0x00000001);
	gr_def(ctx, offset + 0x2b0, 0x00000200);
	if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa) {
		gr_def(ctx, offset + 0x2b4, 0x00000200);
		offset += 4;
	}
	if (dev_priv->chipset < 0xa0) {
		gr_def(ctx, offset + 0x2b8, 0x00000001);
		gr_def(ctx, offset + 0x2bc, 0x00000070);
		gr_def(ctx, offset + 0x2c0, 0x00000080);
		gr_def(ctx, offset + 0x2cc, 0x00000001);
		gr_def(ctx, offset + 0x2d0, 0x00000070);
		gr_def(ctx, offset + 0x2d4, 0x00000080);
	} else {
		gr_def(ctx, offset + 0x2b8, 0x00000001);
		gr_def(ctx, offset + 0x2bc, 0x000000f0);
		gr_def(ctx, offset + 0x2c0, 0x000000ff);
		gr_def(ctx, offset + 0x2cc, 0x00000001);
		gr_def(ctx, offset + 0x2d0, 0x000000f0);
		gr_def(ctx, offset + 0x2d4, 0x000000ff);
		gr_def(ctx, offset + 0x2dc, 0x00000009);
		offset += 4;
	}
	gr_def(ctx, offset + 0x2e4, 0x00000001);
	gr_def(ctx, offset + 0x2e8, 0x000000cf);
	gr_def(ctx, offset + 0x2f0, 0x00000001);
	gr_def(ctx, offset + 0x300, 0x000000cf);
	gr_def(ctx, offset + 0x308, 0x00000002);
	gr_def(ctx, offset + 0x310, 0x00000001);
	gr_def(ctx, offset + 0x318, 0x00000001);
	gr_def(ctx, offset + 0x320, 0x000000cf);
	gr_def(ctx, offset + 0x324, 0x000000cf);
	gr_def(ctx, offset + 0x328, 0x00000001);

	/* 6000? */
	if (dev_priv->chipset == 0x50)
		cp_ctx(ctx, 0x4063e0, 0x1);

	/* 6800: M2MF */
	if (dev_priv->chipset < 0x90) {
		cp_ctx(ctx, 0x406814, 0x2b);
		gr_def(ctx, 0x406818, 0x00000f80);
		gr_def(ctx, 0x406860, 0x007f0080);
		gr_def(ctx, 0x40689c, 0x007f0080);
	} else {
		cp_ctx(ctx, 0x406814, 0x4);
		if (dev_priv->chipset == 0x98)
			gr_def(ctx, 0x406818, 0x00000f80);
		else
			gr_def(ctx, 0x406818, 0x00001f80);
		if (dev_priv->chipset > 0xa0 && dev_priv->chipset < 0xaa)
			gr_def(ctx, 0x40681c, 0x00000030);
		cp_ctx(ctx, 0x406830, 0x3);
	}

	/* 7000: per-ROP group state */
	for (i = 0; i < 8; i++) {
		if (units & (1<<(i+16))) {
			cp_ctx(ctx, 0x407000 + (i<<8), 3);
			if (dev_priv->chipset == 0x50)
				gr_def(ctx, 0x407000 + (i<<8), 0x1b74f820);
			else if (dev_priv->chipset != 0xa5)
				gr_def(ctx, 0x407000 + (i<<8), 0x3b74f821);
			else
				gr_def(ctx, 0x407000 + (i<<8), 0x7b74f821);
			gr_def(ctx, 0x407004 + (i<<8), 0x89058001);

			if (dev_priv->chipset == 0x50) {
				cp_ctx(ctx, 0x407010 + (i<<8), 1);
			} else if (dev_priv->chipset < 0xa0) {
				cp_ctx(ctx, 0x407010 + (i<<8), 2);
				gr_def(ctx, 0x407010 + (i<<8), 0x00001000);
				gr_def(ctx, 0x407014 + (i<<8), 0x0000001f);
			} else {
				cp_ctx(ctx, 0x407010 + (i<<8), 3);
				gr_def(ctx, 0x407010 + (i<<8), 0x00001000);
				if (dev_priv->chipset != 0xa5)
					gr_def(ctx, 0x407014 + (i<<8), 0x000000ff);
				else
					gr_def(ctx, 0x407014 + (i<<8), 0x000001ff);
			}

			cp_ctx(ctx, 0x407080 + (i<<8), 4);
			if (dev_priv->chipset != 0xa5)
				gr_def(ctx, 0x407080 + (i<<8), 0x027c10fa);
			else
				gr_def(ctx, 0x407080 + (i<<8), 0x827c10fa);
			if (dev_priv->chipset == 0x50)
				gr_def(ctx, 0x407084 + (i<<8), 0x000000c0);
			else
				gr_def(ctx, 0x407084 + (i<<8), 0x400000c0);
			gr_def(ctx, 0x407088 + (i<<8), 0xb7892080);

			if (dev_priv->chipset < 0xa0)
				cp_ctx(ctx, 0x407094 + (i<<8), 1);
			else if (dev_priv->chipset <= 0xa0 || dev_priv->chipset >= 0xaa)
				cp_ctx(ctx, 0x407094 + (i<<8), 3);
			else {
				cp_ctx(ctx, 0x407094 + (i<<8), 4);
				gr_def(ctx, 0x4070a0 + (i<<8), 1);
			}
		}
	}

	cp_ctx(ctx, 0x407c00, 0x3);
	if (dev_priv->chipset < 0x90)
		gr_def(ctx, 0x407c00, 0x00010040);
	else if (dev_priv->chipset < 0xa0)
		gr_def(ctx, 0x407c00, 0x00390040);
	else
		gr_def(ctx, 0x407c00, 0x003d0040);
	gr_def(ctx, 0x407c08, 0x00000022);
	if (dev_priv->chipset >= 0xa0) {
		cp_ctx(ctx, 0x407c10, 0x3);
		cp_ctx(ctx, 0x407c20, 0x1);
		cp_ctx(ctx, 0x407c2c, 0x1);
	}

	if (dev_priv->chipset < 0xa0) {
		cp_ctx(ctx, 0x407d00, 0x9);
	} else {
		cp_ctx(ctx, 0x407d00, 0x15);
	}
	if (dev_priv->chipset == 0x98)
		gr_def(ctx, 0x407d08, 0x00380040);
	else {
		if (dev_priv->chipset < 0x90)
			gr_def(ctx, 0x407d08, 0x00010040);
		else if (dev_priv->chipset < 0xa0)
			gr_def(ctx, 0x407d08, 0x00390040);
		else
			gr_def(ctx, 0x407d08, 0x003d0040);
		gr_def(ctx, 0x407d0c, 0x00000022);
	}

	/* 8000+: per-TP state */
	for (i = 0; i < 10; i++) {
		if (units & (1<<i)) {
			if (dev_priv->chipset < 0xa0)
				base = 0x408000 + (i<<12);
			else
				base = 0x408000 + (i<<11);
			if (dev_priv->chipset < 0xa0)
				offset = base + 0xc00;
			else
				offset = base + 0x80;
			cp_ctx(ctx, offset + 0x00, 1);
			gr_def(ctx, offset + 0x00, 0x0000ff0a);
			cp_ctx(ctx, offset + 0x08, 1);

			/* per-MP state */
			for (j = 0; j < (dev_priv->chipset < 0xa0 ? 2 : 4); j++) {
				if (!(units & (1 << (j+24)))) continue;
				if (dev_priv->chipset < 0xa0)
					offset = base + 0x200 + (j<<7);
				else
					offset = base + 0x100 + (j<<7);
				cp_ctx(ctx, offset, 0x20);
				gr_def(ctx, offset + 0x00, 0x01800000);
				gr_def(ctx, offset + 0x04, 0x00160000);
				gr_def(ctx, offset + 0x08, 0x01800000);
				gr_def(ctx, offset + 0x18, 0x0003ffff);
				switch (dev_priv->chipset) {
				case 0x50:
					gr_def(ctx, offset + 0x1c, 0x00080000);
					break;
				case 0x84:
					gr_def(ctx, offset + 0x1c, 0x00880000);
					break;
				case 0x86:
					gr_def(ctx, offset + 0x1c, 0x008c0000);
					break;
				case 0x92:
				case 0x96:
				case 0x98:
					gr_def(ctx, offset + 0x1c, 0x118c0000);
					break;
				case 0x94:
					gr_def(ctx, offset + 0x1c, 0x10880000);
					break;
				case 0xa0:
				case 0xa5:
					gr_def(ctx, offset + 0x1c, 0x310c0000);
					break;
				case 0xa3:
				case 0xa8:
				case 0xaa:
				case 0xac:
					gr_def(ctx, offset + 0x1c, 0x300c0000);
					break;
				}
				gr_def(ctx, offset + 0x40, 0x00010401);
				if (dev_priv->chipset == 0x50)
					gr_def(ctx, offset + 0x48, 0x00000040);
				else
					gr_def(ctx, offset + 0x48, 0x00000078);
				gr_def(ctx, offset + 0x50, 0x000000bf);
				gr_def(ctx, offset + 0x58, 0x00001210);
				if (dev_priv->chipset == 0x50)
					gr_def(ctx, offset + 0x5c, 0x00000080);
				else
					gr_def(ctx, offset + 0x5c, 0x08000080);
				if (dev_priv->chipset >= 0xa0)
					gr_def(ctx, offset + 0x68, 0x0000003e);
			}

			if (dev_priv->chipset < 0xa0)
				cp_ctx(ctx, base + 0x300, 0x4);
			else
				cp_ctx(ctx, base + 0x300, 0x5);
			if (dev_priv->chipset == 0x50)
				gr_def(ctx, base + 0x304, 0x00007070);
			else if (dev_priv->chipset < 0xa0)
				gr_def(ctx, base + 0x304, 0x00027070);
			else if (dev_priv->chipset <= 0xa0 || dev_priv->chipset >= 0xaa)
				gr_def(ctx, base + 0x304, 0x01127070);
			else
				gr_def(ctx, base + 0x304, 0x05127070);

			if (dev_priv->chipset < 0xa0)
				cp_ctx(ctx, base + 0x318, 1);
			else
				cp_ctx(ctx, base + 0x320, 1);
			if (dev_priv->chipset == 0x50)
				gr_def(ctx, base + 0x318, 0x0003ffff);
			else if (dev_priv->chipset < 0xa0)
				gr_def(ctx, base + 0x318, 0x03ffffff);
			else
				gr_def(ctx, base + 0x320, 0x07ffffff);

			if (dev_priv->chipset < 0xa0)
				cp_ctx(ctx, base + 0x324, 5);
			else
				cp_ctx(ctx, base + 0x328, 4);

			if (dev_priv->chipset < 0xa0) {
				cp_ctx(ctx, base + 0x340, 9);
				offset = base + 0x340;
			} else if (dev_priv->chipset <= 0xa0 || dev_priv->chipset >= 0xaa) {
				cp_ctx(ctx, base + 0x33c, 0xb);
				offset = base + 0x344;
			} else {
				cp_ctx(ctx, base + 0x33c, 0xd);
				offset = base + 0x344;
			}
			gr_def(ctx, offset + 0x0, 0x00120407);
			gr_def(ctx, offset + 0x4, 0x05091507);
			if (dev_priv->chipset == 0x84)
				gr_def(ctx, offset + 0x8, 0x05100202);
			else
				gr_def(ctx, offset + 0x8, 0x05010202);
			gr_def(ctx, offset + 0xc, 0x00030201);
			if (dev_priv->chipset == 0xa3)
				cp_ctx(ctx, base + 0x36c, 1);

			cp_ctx(ctx, base + 0x400, 2);
			gr_def(ctx, base + 0x404, 0x00000040);
			cp_ctx(ctx, base + 0x40c, 2);
			gr_def(ctx, base + 0x40c, 0x0d0c0b0a);
			gr_def(ctx, base + 0x410, 0x00141210);

			if (dev_priv->chipset < 0xa0)
				offset = base + 0x800;
			else
				offset = base + 0x500;
			cp_ctx(ctx, offset, 6);
			gr_def(ctx, offset + 0x0, 0x000001f0);
			gr_def(ctx, offset + 0x4, 0x00000001);
			gr_def(ctx, offset + 0x8, 0x00000003);
			if (dev_priv->chipset == 0x50 || dev_priv->chipset >= 0xaa)
				gr_def(ctx, offset + 0xc, 0x00008000);
			gr_def(ctx, offset + 0x14, 0x00039e00);
			cp_ctx(ctx, offset + 0x1c, 2);
			if (dev_priv->chipset == 0x50)
				gr_def(ctx, offset + 0x1c, 0x00000040);
			else
				gr_def(ctx, offset + 0x1c, 0x00000100);
			gr_def(ctx, offset + 0x20, 0x00003800);

			if (dev_priv->chipset >= 0xa0) {
				cp_ctx(ctx, base + 0x54c, 2);
				if (dev_priv->chipset <= 0xa0 || dev_priv->chipset >= 0xaa)
					gr_def(ctx, base + 0x54c, 0x003fe006);
				else
					gr_def(ctx, base + 0x54c, 0x003fe007);
				gr_def(ctx, base + 0x550, 0x003fe000);
			}

			if (dev_priv->chipset < 0xa0)
				offset = base + 0xa00;
			else
				offset = base + 0x680;
			cp_ctx(ctx, offset, 1);
			gr_def(ctx, offset, 0x00404040);

			if (dev_priv->chipset < 0xa0)
				offset = base + 0xe00;
			else
				offset = base + 0x700;
			cp_ctx(ctx, offset, 2);
			if (dev_priv->chipset < 0xa0)
				gr_def(ctx, offset, 0x0077f005);
			else if (dev_priv->chipset == 0xa5)
				gr_def(ctx, offset, 0x6cf7f007);
			else if (dev_priv->chipset == 0xa8)
				gr_def(ctx, offset, 0x6cfff007);
			else if (dev_priv->chipset == 0xac)
				gr_def(ctx, offset, 0x0cfff007);
			else
				gr_def(ctx, offset, 0x0cf7f007);
			if (dev_priv->chipset == 0x50)
				gr_def(ctx, offset + 0x4, 0x00007fff);
			else if (dev_priv->chipset < 0xa0)
				gr_def(ctx, offset + 0x4, 0x003f7fff);
			else
				gr_def(ctx, offset + 0x4, 0x02bf7fff);
			cp_ctx(ctx, offset + 0x2c, 1);
			if (dev_priv->chipset == 0x50) {
				cp_ctx(ctx, offset + 0x50, 9);
				gr_def(ctx, offset + 0x54, 0x000003ff);
				gr_def(ctx, offset + 0x58, 0x00000003);
				gr_def(ctx, offset + 0x5c, 0x00000003);
				gr_def(ctx, offset + 0x60, 0x000001ff);
				gr_def(ctx, offset + 0x64, 0x0000001f);
				gr_def(ctx, offset + 0x68, 0x0000000f);
				gr_def(ctx, offset + 0x6c, 0x0000000f);
			} else if(dev_priv->chipset < 0xa0) {
				cp_ctx(ctx, offset + 0x50, 1);
				cp_ctx(ctx, offset + 0x70, 1);
			} else {
				cp_ctx(ctx, offset + 0x50, 1);
				cp_ctx(ctx, offset + 0x60, 5);
			}
		}
	}
}

Generated by GNU enscript 1.6.4.