コード例 #1
0
ファイル: bit.c プロジェクト: AlbertJP/envytools
void envy_bios_print_bit (struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_bit *bit = &bios->bit;
	if (!bit->offset || !(mask & ENVY_BIOS_PRINT_BMP_BIT))
		return;
	if (!bit->valid) {
		fprintf(out, "Failed to parse BIT table at 0x%04x version %d\n\n", bit->offset, bit->version);
		return;
	}
	fprintf(out, "BIT table at 0x%04x version %d", bit->offset, bit->version);
	fprintf(out, "\n");
	envy_bios_dump_hex(bios, out, bit->offset, bit->hlen, mask);
	int i;
	for (i = 0; i < bit->entriesnum; i++) {
		struct envy_bios_bit_entry *entry = &bit->entries[i];
		fprintf (out, "BIT table '%c' version %d at 0x%04x length 0x%04x\n", entry->type, entry->version, entry->t_offset, entry->t_len);
		envy_bios_dump_hex(bios, out, entry->offset, bit->rlen, mask);
	}
	fprintf(out, "\n");
	for (i = 0; i < bit->entriesnum; i++) {
		struct envy_bios_bit_entry *entry = &bit->entries[i];
		if (entry->is_unk) {
			fprintf (out, "Unknown BIT table '%c' version %d\n", entry->type, entry->version);
			envy_bios_dump_hex(bios, out, entry->t_offset, entry->t_len, mask);
			fprintf(out, "\n");
		}
	}
}
コード例 #2
0
ファイル: print.c プロジェクト: flaviofaria/envytools
static void print_pcir(struct envy_bios *bios, FILE *out, unsigned mask) {
	int i;
	if (!(mask & ENVY_BIOS_PRINT_PCIR))
		return;
	fprintf(out, "BIOS size 0x%x [orig: 0x%x], %d valid parts:\n", bios->length, bios->origlength, bios->partsnum);
	for (i = 0; i < bios->partsnum; i++) {
		fprintf(out, "\n");
		if (bios->parts[i].pcir_code_type == 0) {
			fprintf(out, "BIOS part %d at 0x%x size 0x%x [init: 0x%x]. Sig:\n", i, bios->parts[i].start, bios->parts[i].length, bios->parts[i].init_length);
			envy_bios_dump_hex(bios, out, bios->parts[i].start, 3, mask);
			if (!bios->parts[i].chksum_pass)
				fprintf(out, "WARN: checksum fail\n");
		} else {
			fprintf(out, "BIOS part %d at 0x%x size 0x%x. Sig:\n", i, bios->parts[i].start, bios->parts[i].length);
			envy_bios_dump_hex(bios, out, bios->parts[i].start, 2, mask);
		}
		fprintf(out, "PCIR [rev 0x%02x]:\n", bios->parts[i].pcir_rev);
		envy_bios_dump_hex(bios, out, bios->parts[i].start + bios->parts[i].pcir_offset, bios->parts[i].pcir_len, mask);
		fprintf(out, "PCI device: 0x%04x:0x%04x, class 0x%02x%02x%02x\n", bios->parts[i].pcir_vendor, bios->parts[i].pcir_device, bios->parts[i].pcir_class[2], bios->parts[i].pcir_class[1], bios->parts[i].pcir_class[0]);
		if (bios->parts[i].pcir_vpd)
			fprintf(out, "VPD: 0x%x\n", bios->parts[i].pcir_vpd);
		fprintf(out, "Code type 0x%02x, rev 0x%04x\n", bios->parts[i].pcir_code_type, bios->parts[i].pcir_code_rev);
		fprintf(out, "PCIR indicator: 0x%02x\n", bios->parts[i].pcir_indi);
	}
	if (bios->broken_part)
		fprintf(out, "\nWARN: Couldn't read part %d!\n", bios->partsnum);
	fprintf(out, "\n");
}
コード例 #3
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_base_clock(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_base_clock *bc = &bios->power.base_clock;
	int i, j;

	if (!bc->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!bc->valid) {
		fprintf(out, "Failed to parse BASE CLOCK table at 0x%x, version %x\n", bc->offset, bc->version);
		return;
	}

	fprintf(out, "BASE CLOCK table at 0x%x, version %x\n", bc->offset, bc->version);
	fprintf(out, "base entry: %i\n", bc->base_entry);
	fprintf(out, "boost entry: %i\n", bc->boost_entry);
	fprintf(out, "tdp entry: %i\n", bc->tdp_entry);

	envy_bios_dump_hex(bios, out, bc->offset, bc->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < bc->entriesnum; i++) {
		struct envy_bios_power_base_clock_entry *bce = &bc->entries[i];

		fprintf(out, "-- entry %i, pstate = %x, unk0 = %i, unk1 = %i", i, bce->pstate, bce->unk0, bce->unk1);
		for (j = 0; j < bc->secount; j++)
			fprintf(out, ", clock%i = %i MHz", j, bce->clock[j]);
		fprintf(out, "\n");
		envy_bios_dump_hex(bios, out, bce->offset, bc->rlen + (bc->selen * bc->secount), mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}

	fprintf(out, "\n");
}
コード例 #4
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_cstep(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_cstep *cstep = &bios->power.cstep;
	int i;

	if (!cstep->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!cstep->valid) {
		fprintf(out, "Failed to parse CSTEP table at 0x%x, version %x\n", cstep->offset, cstep->version);
		return;
	}

	fprintf(out, "CSTEP table at 0x%x, version %x\n", cstep->offset, cstep->version);
	envy_bios_dump_hex(bios, out, cstep->offset, cstep->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < cstep->entriesnum; i++) {
		fprintf(out, "	%i: pstate %x index %d\n", i,
			cstep->ent1[i].pstate, cstep->ent1[i].index);
		envy_bios_dump_hex(bios, out, cstep->ent1[i].offset, cstep->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}
	fprintf(out, "---\n");
	for (i = 0; i < cstep->snr; i++) {
		if (!cstep->ent2[i].valid)
			continue;

		fprintf(out, "	%i: freq %d MHz unkn[0] %x unkn[1] %x voltage %d\n",
			i, cstep->ent2[i].freq, cstep->ent2[i].unkn[0], cstep->ent2[i].unkn[1], cstep->ent2[i].voltage);
		envy_bios_dump_hex(bios, out, cstep->ent2[i].offset, cstep->ssz, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}

	fprintf(out, "\n");
}
コード例 #5
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_budget(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_budget *budget = &bios->power.budget;
	int i;

	extern uint32_t strap;
	uint8_t ram_cfg = strap?(strap & 0x1c) >> 2:0xff;


	if (!budget->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!budget->valid) {
		fprintf(out, "Failed to parse BUDGET table at 0x%x, version %x\n", budget->offset, budget->version);
		return;
	}

	fprintf(out, "POWER BUDGET table at 0x%x, version %x\n", budget->offset, budget->version);
	envy_bios_dump_hex(bios, out, budget->offset, budget->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < budget->entriesnum; i++) {
		fprintf(out, "%s %i: min = %u mW, avg = %u mW, peak = %u mW (unkn12 = %u)\n",
			ram_cfg == i?"*":" ", i, budget->entries[i].min,
			budget->entries[i].avg, budget->entries[i].peak,
			budget->entries[i].unkn12
       		);

		envy_bios_dump_hex(bios, out, budget->entries[i].offset, budget->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}

	fprintf(out, "\n");
}
コード例 #6
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_boost(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_boost *boost = &bios->power.boost;
	int i, j;

	if (!boost->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!boost->valid) {
		fprintf(out, "Failed to parse BOOST table at 0x%x, version %x\n", boost->offset, boost->version);
		return;
	}

	fprintf(out, "BOOST table at 0x%x, version %x\n", boost->offset, boost->version);
	envy_bios_dump_hex(bios, out, boost->offset, boost->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < boost->entriesnum; i++) {
		fprintf(out, "	%i: pstate %x min %d MHz max %d MHz\n", i,
			boost->entries[i].pstate, boost->entries[i].min,
			boost->entries[i].max);
		envy_bios_dump_hex(bios, out, boost->entries[i].offset, boost->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");


		for (j = 0; j < boost->snr; j++) {
			struct envy_bios_power_boost_subentry *sub = &boost->entries[i].entries[j];
			fprintf(stdout, "		%i: domain %x percent %d min %d max %d\n",
				j, sub->domain, sub->percent, sub->min, sub->max);
			envy_bios_dump_hex(bios, out, sub->offset, boost->ssz, mask);
			if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
		}
	}

	fprintf(out, "\n");
}
コード例 #7
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_fan(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_fan *fan = &bios->power.fan;
	const char *fan_type_s = "UNKNOWN";

	if (!fan->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!fan->valid) {
		fprintf(out, "Failed to parse FAN table at 0x%x, version %x\n", fan->offset, fan->version);
		return;
	}

	fprintf(out, "FAN table at 0x%x, version %x\n", fan->offset, fan->version);
	envy_bios_dump_hex(bios, out, fan->offset, fan->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	if (fan->type == 0)
		fan_type_s = "TOGGLE";
	else if (fan->type == 1)
		fan_type_s = "PWM";

	fprintf(out, "-- type: %s, duty_range: [%u:%u]%%, fan_div: %u --\n",
		fan_type_s, fan->duty_min, fan->duty_max, fan->divisor);
	fprintf(out, "-- unk0e: %u, unk10: %u, unboost delay: %u ms, boosted_duty: %u%% --\n",
		fan->unk0e, fan->unk10, fan->unboost_unboost_ms, fan->duty_boosted);

	/* fan boost threshold is set to 96°C but seems to be hardcoded */

	envy_bios_dump_hex(bios, out, fan->offset + fan->hlen, fan->rlen, mask);
	fprintf(out, "\n");
}
コード例 #8
0
ファイル: power.c プロジェクト: Constellation/envytools
void envy_bios_print_power_unk50(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_unk50 *unk50 = &bios->power.unk50;
	int i;

	if (!unk50->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;

	fprintf(out, "UNK50 table at 0x%x, version %x\n", unk50->offset, unk50->version);
	envy_bios_dump_hex(bios, out, unk50->offset, unk50->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < unk50->entriesnum; i++) {
		envy_bios_dump_hex(bios, out, unk50->entries[i].offset, unk50->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}

	fprintf(out, "\n");
}
コード例 #9
0
ファイル: print.c プロジェクト: flaviofaria/envytools
static void print_bmp_nv03(struct envy_bios *bios, FILE *out, unsigned mask) {
	if (!(mask & ENVY_BIOS_PRINT_BMP_BIT) || !bios->bmp_length)
		return;
	fprintf(out, "BMP 0x%02x.%02x at 0x%x\n", bios->bmp_ver_major, bios->bmp_ver_minor, bios->bmp_offset);
	envy_bios_dump_hex(bios, out, bios->bmp_offset, bios->bmp_length, mask);
	fprintf(out, "x86 mode pointer: 0x%x\n", bios->mode_x86);
	fprintf(out, "x86 init pointer: 0x%x\n", bios->init_x86);
	fprintf(out, "init script pointer: 0x%x\n", bios->init_script);
	fprintf(out, "\n");
}
コード例 #10
0
ファイル: mem.c プロジェクト: OscarLGH/envytools
void
envy_bios_print_mem_train(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_mem_train *mt = &bios->mem.train;
	uint8_t ram_cfg = strap?(strap & 0x1c) >> 2:0xff;
	int i, j;

	if (!mt->offset || !(mask & ENVY_BIOS_PRINT_MEM))
		return;

	fprintf(out, "MEM TRAIN table at 0x%x, version %x\n", mt->offset, mt->version);
	fprintf(out, "Training clock: %huMHz\n\n", mt->mclk);
	envy_bios_dump_hex(bios, out, mt->offset, mt->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	fprintf(out, "Type | ");
	for (i = 0; i < mt->subentries; i++)
		if (i == ram_cfg)
			fprintf(out, "%2u* ", i);
		else
			fprintf(out, "%2u  ", i);
	fprintf(out, "\n");
	for (i = 0; i < mt->subentries * 4 + 6; i++)
		fprintf(out,"-");
	fprintf(out, "\n");

	for (i = 0; i < mt->entriesnum; i++) {
		fprintf(out, "  %02hhx |",
			mt->entries[i].u00);

		for (j = 0; j < mt->subentries; j++) {
			fprintf(out, " %02hhx ",
				mt->entries[i].subentry[j]);
		}
		fprintf(out, "\n");

		envy_bios_dump_hex(bios, out, mt->entries[i].offset, mt->rlen, mask);
		envy_bios_dump_hex(bios, out, mt->entries[i].offset+mt->rlen, mt->subentrylen * mt->subentries, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	}

	fprintf(out, "\n");
}
コード例 #11
0
ファイル: power.c プロジェクト: Constellation/envytools
void envy_bios_print_power_sense(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_sense *sense = &bios->power.sense;
	int i;

	if (!sense->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;

	fprintf(out, "SENSE table at 0x%x, version %x\n", sense->offset, sense->version);
	envy_bios_dump_hex(bios, out, sense->offset, sense->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < sense->entriesnum; i++) {
		fprintf(out, "power rail %i: extdev_id/power_rail = %u, shunt resistor = %u mOhm\n",
			i, sense->entries[i].extdev_id, sense->entries[i].resistor_mohm);
		envy_bios_dump_hex(bios, out, sense->entries[i].offset, sense->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}

	fprintf(out, "\n");
}
コード例 #12
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_unk4c(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_unk4c *unk4c = &bios->power.unk4c;
	int i;

	if (!unk4c->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!unk4c->valid) {
		fprintf(out, "Failed to parse UNK4C table at 0x%x, version %x\n", unk4c->offset, unk4c->version);
		return;
	}

	fprintf(out, "UNK4c table at 0x%x, version %x\n", unk4c->offset, unk4c->version);
	envy_bios_dump_hex(bios, out, unk4c->offset, unk4c->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < unk4c->entriesnum; i++) {
		envy_bios_dump_hex(bios, out, unk4c->entries[i].offset, unk4c->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");
	}

	fprintf(out, "\n");
}
コード例 #13
0
ファイル: power.c プロジェクト: kfractal/envytools
void envy_bios_print_power_unk44(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_power_unk44 *unk44 = &bios->power.unk44;

	if (!unk44->offset || !(mask & ENVY_BIOS_PRINT_PERF))
		return;
	if (!unk44->valid) {
		fprintf(out, "Failed to parse UNK44 table at 0x%x, version %x\n", unk44->offset, unk44->version);
		return;
	}

	fprintf(out, "UNK44 table at 0x%x, version %x\n", unk44->offset, unk44->version);
	envy_bios_dump_hex(bios, out, unk44->offset, unk44->hlen, mask);
	fprintf(out, "\n");
}
コード例 #14
0
ファイル: i2cscript.c プロジェクト: donwayo/envytools
void envy_bios_print_i2cscript (struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_i2cscript *i2cscript = &bios->i2cscript;
	if (!i2cscript->bit || !(mask & ENVY_BIOS_PRINT_I2CSCRIPT))
		return;
	if (!i2cscript->valid) {
		fprintf(out, "Failed to parse BIT table '2' at %04x version 1\n\n", i2cscript->bit->t_offset);
		return;
	}
	if ((mask & ENVY_BIOS_PRINT_VERBOSE) || i2cscript->unk00 || i2cscript->script) {
		fprintf(out, "I2C script");
		if (i2cscript->unk00)
			fprintf(out, " unk00 0x%04x", i2cscript->unk00);
		if (i2cscript->script)
			fprintf(out, ":");
		fprintf(out, "\n");
		envy_bios_dump_hex(bios, out, i2cscript->bit->t_offset, i2cscript->bit->t_len, mask);
		if (i2cscript->script)
			printscript(i2cscript->script);
		fprintf(out, "\n");
	}
}
コード例 #15
0
ファイル: print.c プロジェクト: flaviofaria/envytools
void envy_bios_print (struct envy_bios *bios, FILE *out, unsigned mask) {
	print_pcir(bios, out, mask);
	switch (bios->type) {
	case ENVY_BIOS_TYPE_UNKNOWN:
		if (mask & ENVY_BIOS_PRINT_VERSION)
			fprintf(out, "BIOS type: UNKNOWN!\n\n");
		break;
	case ENVY_BIOS_TYPE_NV01:
		if (mask & ENVY_BIOS_PRINT_VERSION)
			fprintf(out, "BIOS type: NV01\n\n");
		if (mask & ENVY_BIOS_PRINT_SCRIPTS) {
			/* XXX: how to find these properly? */
			fprintf(out, "Pre-mem scripts:\n\n");
			print_nv01_init_script(bios, out, 0x17bc, mask);
			print_nv01_init_script(bios, out, 0x17a2, mask);
			print_nv01_init_script(bios, out, 0x18f4, mask);
			fprintf(out, "1MB script:\n\n");
			print_nv01_init_script(bios, out, 0x199a, mask);
			fprintf(out, "2MB script:\n\n");
			print_nv01_init_script(bios, out, 0x19db, mask);
			fprintf(out, "4MB script:\n\n");
			print_nv01_init_script(bios, out, 0x1a1c, mask);
			fprintf(out, "Post-mem scripts:\n\n");
			print_nv01_init_script(bios, out, 0x198d, mask);
			print_nv01_init_script(bios, out, 0x1929, mask);
			fprintf(out, "Unknown scripts:\n\n");
			print_nv01_init_script(bios, out, 0x184f, mask);
		}
		break;
	case ENVY_BIOS_TYPE_NV03:
		if (mask & ENVY_BIOS_PRINT_VERSION)
			fprintf(out, "BIOS type: NV03\n\n");
		if (mask & ENVY_BIOS_PRINT_HWINFO) {
			fprintf(out, "Subsystem id: 0x%04x:0x%04x\n", bios->subsystem_vendor, bios->subsystem_device);
			envy_bios_dump_hex(bios, out, 0x54, 4, mask);
			fprintf(out, "\n");
		}
		print_bmp_nv03(bios, out, mask);
		if (bios->init_script)
			print_nv01_init_script(bios, out, bios->init_script, mask);
		break;
	case ENVY_BIOS_TYPE_NV04:
		if (mask & ENVY_BIOS_PRINT_VERSION)
			fprintf(out, "BIOS type: NV04\n\n");
		if (mask & ENVY_BIOS_PRINT_HWINFO) {
			fprintf(out, "Subsystem id: 0x%04x:0x%04x\n", bios->subsystem_vendor, bios->subsystem_device);
			envy_bios_dump_hex(bios, out, 0x54, 4, mask);
			if (bios->hwinfo_ext_valid) {
				fprintf(out, "Straps 0: select 0x%08x value 0x%08x\n", bios->straps0_select, bios->straps0_value);
				fprintf(out, "Straps 1: select 0x%08x value 0x%08x\n", bios->straps1_select, bios->straps1_value);
				envy_bios_dump_hex(bios, out, 0x58, 0x14, mask);
				int i, j;
				for (i = 0; i < bios->mmioinitsnum; i++) {
					fprintf(out, "Addr 0x%08x len %d\n", bios->mmioinits[i].addr, bios->mmioinits[i].len);
					for (j = 0; j < bios->mmioinits[i].len; j++)
						fprintf(out, "\tR[0x%08x] <= 0x%08x\n", bios->mmioinits[i].addr + j * 4, bios->mmioinits[i].data[j]);
				}
				envy_bios_dump_hex(bios, out, bios->mmioinit_offset, bios->mmioinit_len, mask);
			}
			fprintf(out, "\n");
			if (bios->hwea_offset) {
				fprintf(out, "HWEA at 0x%04x:\n", bios->hwea_offset);
				int i, j;
				for (i = 0; i < bios->hwea_entriesnum; i++) {
					struct envy_bios_hwea_entry *entry = &bios->hwea_entries[i];
					if (bios->hwea_version == 0) {
						for (j = 0; j < entry->len; j++) {
							fprintf(out, "\t");
							switch (entry->type) {
								case 0:
									fprintf(out, "C");
									break;
								case 1:
									fprintf(out, "D");
									break;
								default:
									fprintf(out, "UNK%02X", entry->type);
									break;
							}
							fprintf(out, "[0x%04x] <= 0x%08x\n", entry->base + j * 4, entry->data[j]);
						}
					} else {
						if (entry->type < 2) {
							for (j = 0; j < entry->len; j++) {
								fprintf(out, "\tR[0x%06x] <= 0x%08x\n", entry->base + j * 4 * !entry->type, entry->data[j]);
							}
						} else {
							fprintf(out, "\tR[0x%06x] &= 0x%08x |= 0x%08x\n", entry->base, entry->data[0], entry->data[1]);
						}
					}
				}
				envy_bios_dump_hex(bios, out, bios->hwea_offset, bios->hwea_len, mask);
				fprintf(out, "\n");
			}
		}
		envy_bios_print_bit(bios, stdout, mask);
		envy_bios_print_info(bios, stdout, mask);
		envy_bios_print_dacload(bios, stdout, mask);
		envy_bios_print_iunk21(bios, stdout, mask);
		envy_bios_print_i2cscript(bios, stdout, mask);

		envy_bios_print_dcb(bios, stdout, mask);
		envy_bios_print_odcb(bios, stdout, mask);
		envy_bios_print_i2c(bios, stdout, mask);
		envy_bios_print_gpio(bios, stdout, mask);
		envy_bios_print_dunk0c(bios, stdout, mask);
		envy_bios_print_dunk0e(bios, stdout, mask);
		envy_bios_print_dunk10(bios, stdout, mask);
		envy_bios_print_extdev(bios, stdout, mask);
		envy_bios_print_conn(bios, stdout, mask);
		envy_bios_print_dunk17(bios, stdout, mask);
		envy_bios_print_mux(bios, stdout, mask);
		break;
	}
	if (mask & ENVY_BIOS_PRINT_BLOCKS) {
		qsort(bios->blocks, bios->blocksnum, sizeof *bios->blocks, block_cmp);
		int i;
		unsigned last = 0;
		for (i = 0; i < bios->blocksnum; i++) {
			unsigned start = bios->blocks[i].start;
			unsigned end = start + bios->blocks[i].len;
			if (start > last) {
				fprintf(out, "0x%08x:0x%08x ???\n", last, start);
			}
			if (start < last) {
				fprintf(out, "overlap detected!\n");
			}
			fprintf(out, "0x%08x:0x%08x %s", start, end, bios->blocks[i].name);
			if (bios->blocks[i].idx != -1) {
				if (!strcmp(bios->blocks[i].name, "BIT"))
					fprintf(out, " '%c'", bios->blocks[i].idx);
				else
					fprintf(out, "[%d]", bios->blocks[i].idx);
			}
			fprintf(out, "\n");
			last = end;
		}
		fprintf(out, "\n");
	}
}
コード例 #16
0
ファイル: mem.c プロジェクト: OscarLGH/envytools
void
envy_bios_print_mem_train_ptrn(struct envy_bios *bios, FILE *out, unsigned mask) {
	struct envy_bios_mem_train_ptrn *mtp = &bios->mem.train_ptrn;
	int i, j;
	uint32_t data, idx;
	uint16_t data_off;
	uint8_t bits;

	if (!mtp->offset || !(mask & ENVY_BIOS_PRINT_MEM))
		return;

	fprintf(out, "MEM TRAIN PATTERN table at 0x%x, version %x\n", mtp->offset, mtp->version);
	envy_bios_dump_hex(bios, out, mtp->offset, mtp->hlen, mask);
	if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

	for (i = 0; i < mtp->entriesnum; i++) {
		data_off = mtp->entries[i].offset;
		bits = mtp->entries[i].bits;
		fprintf(out, "Set %2i: %u bits, modulo %u", i, mtp->entries[i].bits, mtp->entries[i].modulo);
		if (mtp->entries[i].indirect) {
			data_off = mtp->entries[mtp->entries[i].indirect_entry].offset;
			bits = mtp->entries[mtp->entries[i].indirect_entry].bits;
			fprintf(out, ". indirect(%2d)\n", mtp->entries[i].indirect_entry);
		} else {
			data_off = mtp->entries[i].offset;
			bits = mtp->entries[i].bits;
			fprintf(out, ". direct(%2d)\n", mtp->entries[i].indirect_entry);
		}
		envy_bios_dump_hex(bios, out, mtp->entries[i].offset, mtp->rlen, mask);
		if (mask & ENVY_BIOS_PRINT_VERBOSE) fprintf(out, "\n");

		for (j = 0; j < mtp->entries[i].modulo; j++) {
			uint32_t p_bits;
			uint32_t mask;
			uint16_t off;
			uint8_t  mod;

			if (mtp->entries[i].indirect) {
				p_bits = j * mtp->entries[i].bits;
				mask = (1ULL << mtp->entries[i].bits) - 1;
				off = p_bits / 8;
				mod = p_bits % 8;

				bios_u32(bios, mtp->entries[i].offset + mtp->rlen + off, &idx);
				idx = idx >> mod;
				idx = idx & mask;
			} else {
				idx = j;
			}

			p_bits = idx * bits;
			mask = (1ULL << bits) - 1;
			off = p_bits / 8;
			mod = p_bits % 8;

			bios_u32(bios, data_off + mtp->rlen + off, &data);
			data = data >> mod;
			data = data & mask;

			fprintf(out, "  %2u: [%08x]\n", idx, data);
		}