Skip to content
Snippets Groups Projects
Commit 7b0aaff3 authored by Aditya Degwekar's avatar Aditya Degwekar Committed by Sarangdhar Joshi
Browse files

linux-ramdump-parser-v2: Parse socinfo only if needed

If user specified --force-hardware, then skip the socinfo parsing to
determine the hardware/board information. The user is warned about
using the force-hardware option any way.

Checking for valid swapper_pg_dir in the vmlinux also ensures that
the parsing doesn't trip over when --force-hardware is used along with
a bad or stripped vmlinux.

Change-Id: Icce1556b39a7533418668a7f38af30f4463c32e5
parent 2ba094e2
Branches
No related tags found
No related merge requests found
# Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
# Copyright (c) 2012-2015, 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
......@@ -500,7 +500,14 @@ class RamDump():
# extra 4k is needed for LPAE. If it's 0x5000 below
# PAGE_OFFSET + TEXT_OFFSET then we know we're using LPAE. For
# non-LPAE it should be 0x4000 below PAGE_OFFSET + TEXT_OFFSET
self.swapper_pg_dir_addr = self.addr_lookup('swapper_pg_dir') - self.page_offset
swapper_pg_dir = self.addr_lookup('swapper_pg_dir')
if swapper_pg_dir is None:
print_out_str('!!! Could not get the swapper page directory!')
print_out_str(
'!!! Your vmlinux is probably wrong for these dumps')
print_out_str('!!! Exiting now')
sys.exit(1)
self.swapper_pg_dir_addr = swapper_pg_dir - self.page_offset
self.kernel_text_offset = self.addr_lookup('stext') - self.page_offset
pg_dir_size = self.kernel_text_offset - self.swapper_pg_dir_addr
if self.arm64:
......@@ -845,6 +852,15 @@ class RamDump():
return self.read_word(self.tz_addr, False)
def get_hw_id(self, add_offset=True):
socinfo_format = -1
socinfo_id = -1
socinfo_version = 0
socinfo_build_id = 'DUMMY'
chosen_board = None
boards = get_supported_boards()
if (self.hw_id is None):
heap_toc_offset = self.field_offset('struct smem_shared', 'heap_toc')
if heap_toc_offset is None:
print_out_str(
......@@ -857,15 +873,6 @@ class RamDump():
smem_heap_entry_size = self.sizeof('struct smem_heap_entry')
offset_offset = self.field_offset('struct smem_heap_entry', 'offset')
socinfo_format = -1
socinfo_id = -1
socinfo_version = 0
socinfo_build_id = 'DUMMY'
chosen_board = None
boards = get_supported_boards()
if (self.hw_id is None):
for board in boards:
trace = board.trace_soc
if trace:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment