3 # SPDX-License-Identifier: GPL-2.0-only
6 flashrom_temp_image
=/tmp
/flash_image_mma.bin
7 mma_test_metadata_bin
=mma_test_metadata.bin
8 mma_test_metadata_bin_path
=/tmp
/"${mma_test_metadata_bin}"
11 printf '=%.0s' {1.
.80}
16 printf "MMA blobs version : 2.1018\n"
17 printf "usage: $(basename "${0}") %s\n" \
18 "set [<mma_test_name_efi> <mma_test_param_bin>] | reset"
19 printf '=%.0s' {1.
.29}
20 printf "All possible MMA tests"
21 printf '=%.0s' {1.
.29}
24 printf "Test Name \tMargin1D.efi\n"
25 printf "Test Config\n"
26 printf "\t\t%s %s\n" \
27 Margin1DCkAllConfig.bin \
28 Margin1DCmdAllConfig.bin \
29 Margin1DCmdVrefConfig.bin \
30 Margin1DCtlAllConfig.bin \
31 Margin1DRxDqsDelayConfig.bin \
32 Margin1DRxVrefConfig.bin \
33 Margin1DTxDqDelayConfig.bin \
34 Margin1DTxVrefConfig.bin
36 printf "Test Name \tMargin2D.efi\n"
37 printf "Test Config\n"
38 printf "\t\t%s %s\n" \
39 Margin2D_Cmd_Ch0_D0_R0_Config.bin \
40 Margin2D_Cmd_Ch0_D1_R0_Config.bin \
41 Margin2D_Cmd_Ch1_D0_R0_Config.bin \
42 Margin2D_Cmd_Ch1_D1_R0_Config.bin \
43 Margin2D_Rx_Ch0_D0_R0_Config.bin \
44 Margin2D_Rx_Ch0_D0_R1_Config.bin \
45 Margin2D_Rx_Ch0_D1_R0_Config.bin \
46 Margin2D_Rx_Ch0_D1_R1_Config.bin \
47 Margin2D_Rx_Ch1_D0_R0_Config.bin \
48 Margin2D_Rx_Ch1_D0_R1_Config.bin \
49 Margin2D_Rx_Ch1_D1_R0_Config.bin \
50 Margin2D_Rx_Ch1_D1_R1_Config.bin \
51 Margin2D_Tx_Ch0_D0_R0_Config.bin \
52 Margin2D_Tx_Ch0_D0_R1_Config.bin \
53 Margin2D_Tx_Ch0_D1_R0_Config.bin \
54 Margin2D_Tx_Ch0_D1_R1_Config.bin \
55 Margin2D_Tx_Ch1_D0_R0_Config.bin \
56 Margin2D_Tx_Ch1_D0_R1_Config.bin \
57 Margin2D_Tx_Ch1_D1_R0_Config.bin \
58 Margin2D_Tx_Ch1_D1_R1_Config.bin
60 printf "Test name \tMarginMapper.efi\n"
61 printf "Test Config\n"
62 printf "\t\t%s %s\n" \
63 MarginMapperRxVref-RxDqsDelayConfigVCh0ACh0_single_ch.bin \
64 MarginMapperRxVref-RxDqsDelayConfigVCh0ACh1_dual_ch.bin \
65 MarginMapperRxVref-RxDqsDelayConfigVCh1ACh0_dual_ch.bin \
66 MarginMapperRxVref-RxDqsDelayConfigVCh1ACh1_single_ch.bin \
67 MarginMapperTxVref-TxDqDelayConfigVCh0ACh0_single_ch.bin \
68 MarginMapperTxVref-TxDqDelayConfigVCh0ACh1_dual_ch.bin \
69 MarginMapperTxVref-TxDqDelayConfigVCh1ACh0_dual_ch.bin \
70 MarginMapperTxVref-TxDqDelayConfigVCh1ACh1_single_ch.bin \
71 ScoreRxVref-RxDqsDelayConfigVCh0ACh0_single_ch.bin \
72 ScoreRxVref-RxDqsDelayConfigVCh0ACh1_dual_ch.bin \
73 ScoreRxVref-RxDqsDelayConfigVCh1ACh0_dual_ch.bin \
74 ScoreRxVref-RxDqsDelayConfigVCh1ACh1_single_ch.bin \
75 ScoreTxVref-TxDqDelayConfigVCh0ACh0_single_ch.bin \
76 ScoreTxVref-TxDqDelayConfigVCh0ACh1_dual_ch.bin \
77 ScoreTxVref-TxDqDelayConfigVCh1ACh0_dual_ch.bin \
78 ScoreTxVref-TxDqDelayConfigVCh1ACh1_single_ch.bin
80 printf "Test Name \tRMT.efi\n"
81 printf "Test Config\n"
82 printf "\t\t%s %s\n" \
88 printf "Writing back flash contents "${flashrom_temp_image}"\n"
89 flashrom
-p internal
-w "${flashrom_temp_image}" --noverify-all || \
91 printf "failed to read flash\n" ;
96 remove_file_if_exists
() {
97 if [ -f "${1}" ]; then
98 printf "removing old "${1}"\n"
104 printf "Removing "${mma_test_metadata_bin}" from "${flashrom_temp_image}"\n"
105 cbfstool
"${flashrom_temp_image}" remove
-n ${mma_test_metadata_bin}
106 outout
=$
(cbfstool
"${flashrom_temp_image}" print | \
107 grep ${mma_test_metadata_bin})
109 if [ -z "${outout}" ];then
110 printf "Removed ${mma_test_metadata_bin} from %s\n" \
111 "${flashrom_temp_image}"
113 printf "Failed to remove ${mma_test_metadata_bin} from %s\n" \
114 "${flashrom_temp_image}"
120 generate_metadata
() {
121 remove_file_if_exists
"${mma_test_metadata_bin_path}"
123 printf "Creating "${mma_test_metadata_bin_path}"\n"
125 #Format of $mma_test_metadata_bin
126 #MMA_TEST_NAME=xxxxxx.efi;MMA_TEST_PARAM=xxxxxx.bin;
128 printf "MMA_TEST_NAME=${mma_test_name};MMA_TEST_PARAM=${mma_test_param};" \
129 > "${mma_test_metadata_bin_path}"
132 add_metadata_to_flashfile
() {
133 cbfstool
"${flashrom_temp_image}" add
-f "${mma_test_metadata_bin_path}" \
134 -n ${mma_test_metadata_bin} -t ${file_type_mma} || \
136 printf "failed to add "${mma_test_metadata_bin_path}"\n" ;
142 remove_file_if_exists
"${flashrom_temp_image}"
143 remove_file_if_exists
"${mma_test_metadata_bin_path}"
147 printf "============== SUCCESS ==============\n"
151 printf "============== FAILED ==============\n"
171 if [ "${1}" != "reset" ];then
172 printf "mma_test_name = ${mma_test_name}\n"
173 printf "mma_test_param = ${mma_test_param}\n"
176 remove_file_if_exists
"${flashrom_temp_image}"
178 printf "Reading flash contents to "${flashrom_temp_image}"\n"
179 flashrom
-p internal
-r "${flashrom_temp_image}" || \
181 printf "failed to read flash\n" ;
185 outdata
=$
(cbfstool
"${flashrom_temp_image}" print | \
186 grep ${mma_test_metadata_bin})
190 [ "${outdata}" ] && remove_metadata
192 add_metadata_to_flashfile
196 if [ -z "${outdata}" ];then
197 printf "${mma_test_metadata_bin} not found at all.\n"