soc/intel/xeon_sp: Drop uncore_fill_ssdt
[coreboot2.git] / util / mma / mma_get_result.sh
blob499d91cb742da45ed9812db1ed385633ae1c0a8b
1 #!/usr/bin/env bash
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"
9 show_usage() {
10 printf "usage: $(basename "${0}") <output_results.bin>\n"
11 printf "pass path of a bin file where you want to save results.\n"
15 # main entry point
18 main() {
19 if [ ! "${mma_results_op_bin}" ];then
20 show_usage
21 exit -1
24 printf "Reading cbmem ...\n"
25 cbmem -r ${mma_cbmem_id} > "${mma_results_op_bin_tmp}" || \
27 printf "error in executing cbmem utility\n" ;
28 exit -1;
31 #format of o/p is :
32 # <mma_signature><mma_test_header+data>
34 # where,
35 # <mma_signature> is 32bit length string "MMAD"
37 # <mma_test_header+data> is the FULL HOB which coreboot
38 # receives from FSP
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"
52 exit -1
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" ;
58 exit -1;
60 rm -r "${mma_results_op_bin_tmp}"
61 printf "MMA data saved to "${mma_results_op_bin}"\n"
64 main "$@"