blob: 48f5360ed365567e5b4fa1472ff3986d118fc0bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/usr/bin/env bash
# This file is part of the coreboot project.
#
# SPDX-License-Identifier: GPL-2.0-only
mma_results_op_bin="${1}"
mma_results_op_bin_tmp="${mma_results_op_bin}".tmp
mma_cbmem_id="0x4d4d4144"
show_usage() {
printf "usage: $(basename "${0}") <output_results.bin>\n"
printf "pass path of a bin file where you want to save results.\n"
}
#
# main entry point
#
main() {
if [ ! "${mma_results_op_bin}" ];then
show_usage
exit -1
fi
printf "Reading cbmem ...\n"
cbmem -r ${mma_cbmem_id} > "${mma_results_op_bin_tmp}" || \
{
printf "error in executing cbmem utility\n" ;
exit -1;
}
#format of o/p is :
# <mma_signature><mma_test_header+data>
#
# where,
# <mma_signature> is 32bit length string "MMAD"
#
# <mma_test_header+data> is the FULL HOB which coreboot
# receives from FSP
# <mma_test_header> is 22 bytes long at the start of the HOB.
# MMA data starts right after 26 bytes
# 26 bytes = (4 bytes of "MMAD"
# + 22 bytes of mma_test_header)
#
mma_signature=$(dd if="${mma_results_op_bin_tmp}" bs=1 count=4 )
if [[ ${mma_signature} != "MMAD" ]];then
printf "MMA signature mismatch" > "${mma_results_op_bin}"
rm -r "${mma_results_op_bin_tmp}"
cbmem -l >> "${mma_results_op_bin}"
printf "MMA signature mismatch\n"
exit -1
fi
dd if="${mma_results_op_bin_tmp}" of="${mma_results_op_bin}" bs=1 skip=26 || \
{
printf "error in generating "${mma_results_op_bin}"\n" ;
exit -1;
}
rm -r "${mma_results_op_bin_tmp}"
printf "MMA data saved to "${mma_results_op_bin}"\n"
}
main "$@"
|