intel_extreme: Take a register dump for intel_reg

This commit is contained in:
Alexander von Gluck IV
2015-11-24 16:47:02 -06:00
parent d7a8a21fa5
commit 7217bb117b
3 changed files with 41 additions and 18 deletions
@@ -37,6 +37,7 @@
struct accelerant_info* gInfo;
uint32 gDumpCount;
class AreaCloner {
@@ -89,6 +90,36 @@ AreaCloner::Keep()
// #pragma mark -
// intel_reg --mmio=ie-0001.bin --devid=27a2 dump
void
dump_registers()
{
char filename[255];
sprintf(filename, "/boot/system/cache/tmp/ie-%04" B_PRId32 ".bin",
gDumpCount);
ERROR("%s: Taking register dump #%" B_PRId32 "\n", __func__, gDumpCount);
int fd = open(filename, O_CREAT | O_WRONLY, 0644);
uint32 data = 0;
if (fd >= 0) {
for (int32 i = 0; i < 0x80000; i += sizeof(data)) {
//char line[512];
//int length = sprintf(line, "%05" B_PRIx32 ": "
// "%08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 " %08" B_PRIx32 "\n",
// i, read32(i), read32(i + 4), read32(i + 8), read32(i + 12));
data = read32(i);
write(fd, &data, sizeof(data));
}
close(fd);
sync();
}
gDumpCount++;
}
/*! This is the common accelerant_info initializer. It is called by
both, the first accelerant and all clones.
*/
@@ -97,6 +128,9 @@ init_common(int device, bool isClone)
{
// initialize global accelerant info structure
// Number of register dumps we have... taken.
gDumpCount = 0;
gInfo = (accelerant_info*)malloc(sizeof(accelerant_info));
if (gInfo == NULL)
return B_NO_MEMORY;
@@ -101,6 +101,7 @@ write32(uint32 encodedRegister, uint32 value)
+ REGISTER_REGISTER(encodedRegister)) = value;
}
void dump_registers(void);
// dpms.cpp
extern void enable_display_plane(bool enable);
+6 -18
View File
@@ -470,27 +470,12 @@ intel_set_display_mode(display_mode* mode)
// This would avoid the screen being off when switching workspaces when they
// have the same resolution.
#if 0
static bool first = true;
if (first) {
int fd = open("/boot/home/ie_.regs", O_CREAT | O_WRONLY, 0644);
if (fd >= 0) {
for (int32 i = 0; i < 0x80000; i += 16) {
char line[512];
int length = sprintf(line, "%05lx: %08lx %08lx %08lx %08lx\n",
i, read32(i), read32(i + 4), read32(i + 8), read32(i + 12));
write(fd, line, length);
}
close(fd);
sync();
}
first = false;
}
#endif
intel_shared_info &sharedInfo = *gInfo->shared_info;
Autolock locker(sharedInfo.accelerant_lock);
// First register dump
dump_registers();
// TODO: This may not be neccesary
set_display_power_mode(B_DPMS_OFF);
@@ -640,6 +625,9 @@ if (first) {
set_frame_buffer_base();
// triggers writing back double-buffered registers
// Second register dump
dump_registers();
return B_OK;
}