diff --git a/linux-ramdump-parser-v2/debug_image_v2.py b/linux-ramdump-parser-v2/debug_image_v2.py index 0c388a6e2ee30304c7f75e4d92bb4e82f7c0fb6d..ca588acd15977366d4c8bee669920a899f2701f9 100644 --- a/linux-ramdump-parser-v2/debug_image_v2.py +++ b/linux-ramdump-parser-v2/debug_image_v2.py @@ -31,6 +31,7 @@ from cachedumplib import lookup_cache_type from tlbdumplib import lookup_tlb_type from vsens import VsensData from sysregs import SysRegDump +from fcmdump import FCM_Dump MEMDUMPV2_MAGIC = 0x42445953 MAX_NUM_ENTRIES = 0x150 @@ -55,6 +56,7 @@ class client(object): MSM_DUMP_DATA_LOG_BUF_FIRST_IDX = 0x111 MSM_DUMP_DATA_L2_TLB = 0x120 MSM_DUMP_DATA_SCANDUMP = 0xEB + MSM_DUMP_DATA_FCMDUMP = 0xEE MSM_DUMP_DATA_SCANDUMP_PER_CPU = 0x130 MSM_DUMP_DATA_LLC_CACHE = 0x140 MSM_DUMP_DATA_MAX = MAX_NUM_ENTRIES @@ -63,6 +65,7 @@ class client(object): client_types = [ ('MSM_DUMP_DATA_SCANDUMP', 'parse_scandump'), ('MSM_DUMP_DATA_SCANDUMP_PER_CPU', 'parse_scandump'), + ('MSM_DUMP_DATA_FCMDUMP', 'parse_fcmdump'), ('MSM_DUMP_DATA_CPU_CTX', 'parse_cpu_ctx'), ('MSM_DUMP_DATA_L1_INST_TLB', 'parse_tlb_common'), ('MSM_DUMP_DATA_L1_DATA_TLB', 'parse_tlb_common'), @@ -162,6 +165,18 @@ class DebugImage_v2(): sv2.dump_all_regs(ram_dump) return + def parse_fcmdump(self, version, start, end, client_id, ram_dump): + client_name = self.dump_data_id_lookup_table[client_id] + + print_out_str( + 'Parsing {0} context start {1:x} end {2:x}'.format(client_name, start, end)) + + fcmdumps = FCM_Dump(start, end) + if fcmdumps.dump_fcm_img(ram_dump) is False: + print_out_str('!!! Could not dump FCM') + + return + def parse_cpu_ctx(self, version, start, end, client_id, ram_dump): core = client_id - client.MSM_DUMP_DATA_CPU_CTX @@ -614,6 +629,9 @@ class DebugImage_v2(): for i in range(0, 4): self.dump_data_id_lookup_table[ client.MSM_DUMP_DATA_LLC_CACHE + i] = 'MSM_DUMP_DATA_LLC_CACHE' + + self.dump_data_id_lookup_table[ + client.MSM_DUMP_DATA_FCMDUMP] = 'MSM_DUMP_DATA_FCMDUMP' # 0x100 - tmc-etr registers and 0x101 - for tmc-etf registers self.dump_data_id_lookup_table[ client.MSM_DUMP_DATA_TMC_REG + 1] = 'MSM_DUMP_DATA_TMC_REG' diff --git a/linux-ramdump-parser-v2/fcmdump.py b/linux-ramdump-parser-v2/fcmdump.py new file mode 100644 index 0000000000000000000000000000000000000000..e66deee760b183236540851cd2d07380e162ea7c --- /dev/null +++ b/linux-ramdump-parser-v2/fcmdump.py @@ -0,0 +1,32 @@ +# Copyright (c) 2017, The Linux Foundation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 and +# only version 2 as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +import struct +import os +from print_out import print_out_str +from ramparse import VERSION + +class FCM_Dump(): + + def __init__(self, start, end): + self.start_addr = start + self.end_addr = end + + def dump_fcm_img(self,ram_dump): + if self.start_addr >= self.end_addr: + return False + rsz = self.end_addr - self.start_addr + fcmfile = ram_dump.open_file('fcm.bin') + for i in range(0, rsz): + val = ram_dump.read_byte(self.start_addr + i, False) + fcmfile.write(struct.pack('<B', val)) + + fcmfile.close()