Subversion Repositories Kolibri OS

Rev

Rev 2160 | Rev 3764 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2160 Rev 2997
Line 275... Line 275...
275
		val = U32(idx + gctx->data_block);
275
		val = U32(idx + gctx->data_block);
276
		break;
276
		break;
277
	case ATOM_ARG_FB:
277
	case ATOM_ARG_FB:
278
		idx = U8(*ptr);
278
		idx = U8(*ptr);
279
		(*ptr)++;
279
		(*ptr)++;
-
 
280
		if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
-
 
281
			DRM_ERROR("ATOM: fb read beyond scratch region: %d vs. %d\n",
-
 
282
				  gctx->fb_base + (idx * 4), gctx->scratch_size_bytes);
-
 
283
			val = 0;
-
 
284
		} else
280
		val = gctx->scratch[((gctx->fb_base + idx) / 4)];
285
			val = gctx->scratch[(gctx->fb_base / 4) + idx];
281
		if (print)
286
		if (print)
282
			DEBUG("FB[0x%02X]", idx);
287
			DEBUG("FB[0x%02X]", idx);
283
		break;
288
		break;
284
	case ATOM_ARG_IMM:
289
	case ATOM_ARG_IMM:
285
		switch (align) {
290
		switch (align) {
Line 529... Line 534...
529
		}
534
		}
530
		break;
535
		break;
531
	case ATOM_ARG_FB:
536
	case ATOM_ARG_FB:
532
		idx = U8(*ptr);
537
		idx = U8(*ptr);
533
		(*ptr)++;
538
		(*ptr)++;
-
 
539
		if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
-
 
540
			DRM_ERROR("ATOM: fb write beyond scratch region: %d vs. %d\n",
-
 
541
				  gctx->fb_base + (idx * 4), gctx->scratch_size_bytes);
-
 
542
		} else
534
		gctx->scratch[((gctx->fb_base + idx) / 4)] = val;
543
			gctx->scratch[(gctx->fb_base / 4) + idx] = val;
535
		DEBUG("FB[0x%02X]", idx);
544
		DEBUG("FB[0x%02X]", idx);
536
		break;
545
		break;
537
	case ATOM_ARG_PLL:
546
	case ATOM_ARG_PLL:
538
		idx = U8(*ptr);
547
		idx = U8(*ptr);
539
		(*ptr)++;
548
		(*ptr)++;
Line 712... Line 721...
712
		break;
721
		break;
713
	}
722
	}
714
	if (arg != ATOM_COND_ALWAYS)
723
	if (arg != ATOM_COND_ALWAYS)
715
		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
724
		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
716
	SDEBUG("   target: 0x%04X\n", target);
725
	SDEBUG("   target: 0x%04X\n", target);
717
	if (execute)
726
	if (execute) {
-
 
727
		if (ctx->last_jump == (ctx->start + target)) {
-
 
728
			cjiffies = GetTimerTicks();
-
 
729
			if (time_after(cjiffies, ctx->last_jump_jiffies)) {
-
 
730
				cjiffies -= ctx->last_jump_jiffies;
-
 
731
				if ((jiffies_to_msecs(cjiffies) > 5000)) {
-
 
732
					DRM_ERROR("atombios stuck in loop for more than 5secs aborting\n");
-
 
733
					ctx->abort = true;
-
 
734
				}
-
 
735
			} else {
-
 
736
				/* jiffies wrap around we will just wait a little longer */
-
 
737
				ctx->last_jump_jiffies = GetTimerTicks();
-
 
738
			}
-
 
739
		} else {
-
 
740
			ctx->last_jump = ctx->start + target;
-
 
741
			ctx->last_jump_jiffies = GetTimerTicks();
-
 
742
		}
718
		*ptr = ctx->start + target;
743
		*ptr = ctx->start + target;
719
}
744
	}
-
 
745
}
Line 720... Line 746...
720
 
746
 
721
static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg)
747
static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg)
722
{
748
{
723
	uint8_t attr = U8((*ptr)++);
749
	uint8_t attr = U8((*ptr)++);
Line 1276... Line 1302...
1276
	return ctx;
1302
	return ctx;
1277
}
1303
}
Line 1278... Line 1304...
1278
 
1304
 
1279
int atom_asic_init(struct atom_context *ctx)
1305
int atom_asic_init(struct atom_context *ctx)
-
 
1306
{
1280
{
1307
	struct radeon_device *rdev = ctx->card->dev->dev_private;
1281
	int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR);
1308
	int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR);
-
 
1309
	uint32_t ps[16];
-
 
1310
	int ret;
1282
	uint32_t ps[16];
1311
 
Line 1283... Line 1312...
1283
	memset(ps, 0, 64);
1312
	memset(ps, 0, 64);
1284
 
1313
 
1285
	ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR));
1314
	ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR));
1286
	ps[1] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFMCLK_PTR));
1315
	ps[1] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFMCLK_PTR));
Line 1287... Line 1316...
1287
	if (!ps[0] || !ps[1])
1316
	if (!ps[0] || !ps[1])
1288
		return 1;
1317
		return 1;
1289
 
1318
 
-
 
1319
	if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT))
-
 
1320
		return 1;
-
 
1321
	ret = atom_execute_table(ctx, ATOM_CMD_INIT, ps);
-
 
1322
	if (ret)
-
 
1323
		return ret;
-
 
1324
 
-
 
1325
	memset(ps, 0, 64);
-
 
1326
 
-
 
1327
	if (rdev->family < CHIP_R600) {
-
 
1328
		if (CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_SPDFANCNTL))
1290
	if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT))
1329
			atom_execute_table(ctx, ATOM_CMD_SPDFANCNTL, ps);
Line 1291... Line 1330...
1291
		return 1;
1330
	}
1292
	return atom_execute_table(ctx, ATOM_CMD_INIT, ps);
1331
	return ret;
1293
}
1332
}
Line 1351... Line 1390...
1351
		  firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware,
1390
		  firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware,
1352
		  firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb);
1391
		  firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb);
Line 1353... Line 1392...
1353
 
1392
 
1354
	usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024;
1393
	usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024;
-
 
1394
	}
1355
	}
1395
	ctx->scratch_size_bytes = 0;
1356
	if (usage_bytes == 0)
1396
	if (usage_bytes == 0)
1357
		usage_bytes = 20 * 1024;
1397
		usage_bytes = 20 * 1024;
1358
	/* allocate some scratch memory */
1398
	/* allocate some scratch memory */
1359
	ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL);
1399
	ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL);
1360
	if (!ctx->scratch)
1400
	if (!ctx->scratch)
-
 
1401
		return -ENOMEM;
1361
		return -ENOMEM;
1402
	ctx->scratch_size_bytes = usage_bytes;
1362
	return 0;
1403
	return 0;