Skip to content

Commit 1a94a90

Browse files
committed
ect: add full memory dump
1 parent 650cfa1 commit 1a94a90

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

drivers/soc/samsung/ect_parser.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static phys_addr_t ect_size;
3636

3737
static struct vm_struct ect_early_vm;
3838
static void ect_dump_raw_blob(void);
39+
static void ect_dump_full_memory(void);
3940

4041

4142
/* API for internal */
@@ -2555,6 +2556,8 @@ int ect_parse_binary_header(void)
25552556
ect_init_map_io();
25562557

25572558
ect_dump_raw_blob();
2559+
2560+
ect_dump_full_memory();
25582561

25592562
address = (void *)ect_address;
25602563
if (address == NULL)
@@ -2574,6 +2577,7 @@ int ect_parse_binary_header(void)
25742577

25752578
ect_dump_raw_blob();
25762579

2580+
ect_dump_full_memory();
25772581

25782582
ect_present_test_data(ect_header->version);
25792583

@@ -2601,6 +2605,8 @@ int ect_parse_binary_header(void)
26012605

26022606
ect_dump_raw_blob();
26032607

2608+
2609+
ect_dump_full_memory();
26042610

26052611
ect_header_info.block_handle = ect_header;
26062612

@@ -2696,3 +2702,64 @@ static void ect_dump_raw_blob(void)
26962702

26972703
iounmap(base);
26982704
}
2705+
2706+
2707+
static void ect_dump_full_memory(void)
2708+
{
2709+
void __iomem *base;
2710+
size_t size = ect_size;
2711+
size_t offset = 0;
2712+
size_t chunk_size = 256; // Dump 256 bytes per chunk to avoid log overflow
2713+
u8 *data;
2714+
int i, j;
2715+
2716+
if (!ect_address) {
2717+
pr_err("[ECT] : ECT memory not initialized\n");
2718+
return;
2719+
}
2720+
2721+
base = (void __iomem *)ect_address;
2722+
if (!base) {
2723+
pr_err("[ECT] : Failed to access ECT memory\n");
2724+
return;
2725+
}
2726+
2727+
pr_info("=== ECT FULL MEMORY DUMP (size: 0x%zx) ===\n", size);
2728+
pr_info("Physical address: 0x%llx, Virtual address: %p\n",
2729+
(unsigned long long)ect_early_vm.phys_addr, base);
2730+
2731+
data = (u8 *)base;
2732+
2733+
// Dump in chunks to avoid overwhelming the log buffer
2734+
while (offset < size) {
2735+
size_t bytes_remaining = size - offset;
2736+
size_t current_chunk = (bytes_remaining < chunk_size) ? bytes_remaining : chunk_size;
2737+
2738+
pr_info("[ECT] Offset 0x%04zx:", offset);
2739+
2740+
// Hex dump
2741+
for (i = 0; i < current_chunk; i++) {
2742+
if (i % 16 == 0) {
2743+
pr_cont("\n[ECT] %04zx: ", offset + i);
2744+
}
2745+
pr_cont("%02x ", data[offset + i]);
2746+
}
2747+
2748+
// ASCII dump
2749+
pr_cont("\n[ECT] ASCII: ");
2750+
for (i = 0; i < current_chunk; i++) {
2751+
u8 c = data[offset + i];
2752+
pr_cont("%c", (c >= 0x20 && c <= 0x7E) ? c : '.');
2753+
}
2754+
pr_cont("\n");
2755+
2756+
offset += current_chunk;
2757+
2758+
// Add separator between chunks
2759+
if (offset < size) {
2760+
pr_info("[ECT] ---\n");
2761+
}
2762+
}
2763+
2764+
pr_info("=== END ECT MEMORY DUMP ===\n");
2765+
}

0 commit comments

Comments
 (0)