Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
vendor
qcom-opensource
tools
Commits
d89f691d
Commit
d89f691d
authored
10 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "linux-ramdump-parser-v2: Add support to parse PMIC register dump."
parents
2e372172
2e069d07
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
linux-ramdump-parser-v2/debug_image_v2.py
+15
-0
15 additions, 0 deletions
linux-ramdump-parser-v2/debug_image_v2.py
linux-ramdump-parser-v2/pmic.py
+98
-0
98 additions, 0 deletions
linux-ramdump-parser-v2/pmic.py
with
113 additions
and
0 deletions
linux-ramdump-parser-v2/debug_image_v2.py
+
15
−
0
View file @
d89f691d
...
@@ -17,6 +17,7 @@ import os
...
@@ -17,6 +17,7 @@ import os
import
platform
import
platform
import
subprocess
import
subprocess
from
pmic
import
PmicRegDump
from
print_out
import
print_out_str
from
print_out
import
print_out_str
from
qdss
import
QDSSDump
from
qdss
import
QDSSDump
from
watchdog_v2
import
TZRegDump_v2
from
watchdog_v2
import
TZRegDump_v2
...
@@ -51,6 +52,7 @@ client_table = {
...
@@ -51,6 +52,7 @@ client_table = {
'
MSM_DUMP_DATA_L2_CACHE
'
:
'
parse_l2_cache
'
,
'
MSM_DUMP_DATA_L2_CACHE
'
:
'
parse_l2_cache
'
,
'
MSM_DUMP_DATA_L3_CACHE
'
:
'
parse_l3_cache
'
,
'
MSM_DUMP_DATA_L3_CACHE
'
:
'
parse_l3_cache
'
,
'
MSM_DUMP_DATA_OCMEM
'
:
'
parse_ocmem
'
,
'
MSM_DUMP_DATA_OCMEM
'
:
'
parse_ocmem
'
,
'
MSM_DUMP_DATA_PMIC
'
:
'
parse_pmic
'
,
'
MSM_DUMP_DATA_TMC_ETF
'
:
'
parse_qdss_common
'
,
'
MSM_DUMP_DATA_TMC_ETF
'
:
'
parse_qdss_common
'
,
'
MSM_DUMP_DATA_TMC_REG
'
:
'
parse_qdss_common
'
,
'
MSM_DUMP_DATA_TMC_REG
'
:
'
parse_qdss_common
'
,
'
MSM_DUMP_DATA_L2_TLB
'
:
'
parse_l2_tlb
'
,
'
MSM_DUMP_DATA_L2_TLB
'
:
'
parse_l2_tlb
'
,
...
@@ -82,6 +84,19 @@ class DebugImage_v2():
...
@@ -82,6 +84,19 @@ class DebugImage_v2():
regs
.
dump_core_pc
(
ram_dump
)
regs
.
dump_core_pc
(
ram_dump
)
regs
.
dump_all_regs
(
ram_dump
)
regs
.
dump_all_regs
(
ram_dump
)
def
parse_pmic
(
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
))
regs
=
PmicRegDump
(
start
,
end
)
if
regs
.
parse_all_regs
(
ram_dump
)
is
False
:
print_out_str
(
'
!!! Could not get registers from PMIC dump
'
)
return
regs
.
dump_all_regs
(
ram_dump
)
def
parse_qdss_common
(
self
,
version
,
start
,
end
,
client_id
,
ram_dump
):
def
parse_qdss_common
(
self
,
version
,
start
,
end
,
client_id
,
ram_dump
):
client_name
=
self
.
dump_data_id_lookup_table
[
client_id
]
client_name
=
self
.
dump_data_id_lookup_table
[
client_id
]
...
...
This diff is collapsed.
Click to expand it.
linux-ramdump-parser-v2/pmic.py
0 → 100644
+
98
−
0
View file @
d89f691d
# Copyright (c) 2014, 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.
from
datetime
import
datetime
from
print_out
import
print_out_str
from
ramparse
import
VERSION
from
time
import
strftime
class
PmicRegData
():
def
__init__
(
self
,
regoffs
,
val
):
self
.
regoffs
=
regoffs
self
.
val
=
val
class
PmicRegDump
():
def
__init__
(
self
,
start
,
end
):
self
.
start_addr
=
start
self
.
end_addr
=
end
self
.
num_entries
=
0
self
.
pmic_list
=
{}
def
parse_all_regs
(
self
,
ram_dump
):
if
(
self
.
start_addr
+
4
)
>
self
.
end_addr
:
return
False
# Read number of entries
self
.
num_entries
=
ram_dump
.
read_u32
(
self
.
start_addr
,
False
)
self
.
start_addr
+=
4
print_out_str
(
'
Dumping {0} PMIC registers
'
.
format
(
self
.
num_entries
))
for
i
in
range
(
0
,
self
.
num_entries
):
if
(
self
.
start_addr
+
12
)
>
self
.
end_addr
:
return
False
# Read slave ID
slaveid
=
ram_dump
.
read_u32
(
self
.
start_addr
,
False
)
self
.
start_addr
+=
4
;
# Read register offset
regoffs
=
0xFFFF
&
(
ram_dump
.
read_u32
(
self
.
start_addr
,
False
))
self
.
start_addr
+=
4
;
# Read register value
val
=
ram_dump
.
read_u32
(
self
.
start_addr
,
False
)
self
.
start_addr
+=
4
;
if
slaveid
>
0xf
:
print_out_str
(
"
Maximum value of slave id is 0xF but found {0:x}. Aborting PMIC dump!
"
.
format
(
slaveid
))
return
False
;
pmic_num
=
slaveid
/
2
;
if
pmic_num
not
in
self
.
pmic_list
:
pmic_reg_list
=
[]
self
.
pmic_list
[
pmic_num
]
=
pmic_reg_list
else
:
pmic_reg_list
=
self
.
pmic_list
[
pmic_num
]
# For odd slave id prepend 0x10000 to offset
if
slaveid
%
2
!=
0
:
regoffs
|=
0x10000
regData
=
PmicRegData
(
regoffs
,
val
)
pmic_reg_list
.
append
(
regData
)
return
True
def
dump_all_regs
(
self
,
ram_dump
):
outfile
=
ram_dump
.
open_file
(
'
pmicdump.xml
'
)
outfile
.
write
(
'
<pmicDump version=
\'
1
\'
>
\n
'
)
outfile
.
write
(
'
\t
<timestamp>{0}</timestamp>
\n
'
.
format
(
datetime
.
now
().
strftime
(
'
%d. %b %Y, %H:%M:%S
'
)))
outfile
.
write
(
'
\t
<generator>Linux Ram Dump Parser Version {0}</generator>
\n
'
.
format
(
VERSION
))
outfile
.
write
(
'
\t
<target name=
\'
{0}
\'
>
\n
'
.
format
(
ram_dump
.
hw_id
))
for
pmic
in
self
.
pmic_list
.
iterkeys
():
dump_pmic_reg_list
=
self
.
pmic_list
[
pmic
]
if
not
dump_pmic_reg_list
:
continue
outfile
.
write
(
'
\t\t
<pmic>
\n
'
)
outfile
.
write
(
'
\t\t\t
<bus type=
\'
spmi
\'
slaveid0=
\'
{0}
\'
slaveid1=
\'
{1}
\'
/>
\n
'
.
format
(
pmic
,
(
pmic
+
1
)))
for
reg_data
in
dump_pmic_reg_list
:
outfile
.
write
(
'
\t\t\t
<register address=
\'
0x{0:x}
\'
value=
\'
0x{1:x}
\'
/>
\n
'
.
format
(
reg_data
.
regoffs
,
reg_data
.
val
))
outfile
.
write
(
'
\t\t
</pmic>
\n
'
)
outfile
.
write
(
'
\t
</target>
\n
'
)
outfile
.
write
(
'
</pmicDump>
\n
'
)
outfile
.
close
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment