blob: e26ae4a73b50c1784f6c74afa2717cf4533ea9e1 (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#!/bin/bash
#
# This file is part of the coreboot project.
#
# Copyright (C) 2015 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc.
#
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 "$@"
|