3 # SPDX-License-Identifier: GPL-2.0-only
5 mma_results_op_bin
="${1}"
6 mma_results_op_bin_tmp
="${mma_results_op_bin}".tmp
7 mma_cbmem_id
="0x4d4d4144"
10 printf "usage: $(basename "${0}") <output_results.bin>\n"
11 printf "pass path of a bin file where you want to save results.\n"
19 if [ ! "${mma_results_op_bin}" ];then
24 printf "Reading cbmem ...\n"
25 cbmem
-r ${mma_cbmem_id} > "${mma_results_op_bin_tmp}" || \
27 printf "error in executing cbmem utility\n" ;
32 # <mma_signature><mma_test_header+data>
35 # <mma_signature> is 32bit length string "MMAD"
37 # <mma_test_header+data> is the FULL HOB which coreboot
39 # <mma_test_header> is 22 bytes long at the start of the HOB.
40 # MMA data starts right after 26 bytes
41 # 26 bytes = (4 bytes of "MMAD"
42 # + 22 bytes of mma_test_header)
45 mma_signature
=$
(dd if="${mma_results_op_bin_tmp}" bs
=1 count
=4 )
47 if [[ ${mma_signature} != "MMAD" ]];then
48 printf "MMA signature mismatch" > "${mma_results_op_bin}"
49 rm -r "${mma_results_op_bin_tmp}"
50 cbmem
-l >> "${mma_results_op_bin}"
51 printf "MMA signature mismatch\n"
55 dd if="${mma_results_op_bin_tmp}" of
="${mma_results_op_bin}" bs
=1 skip
=26 || \
57 printf "error in generating "${mma_results_op_bin}"\n" ;
60 rm -r "${mma_results_op_bin_tmp}"
61 printf "MMA data saved to "${mma_results_op_bin}"\n"