4 # This file is part of the coreboot project.
6 # Copyright (C) 2017 Intel Corporation.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; version 2 of the License.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
19 flashrom_temp_image
=/tmp
/flash_image_mma.bin
20 mma_test_metadata_bin
=mma_test_metadata.bin
21 mma_test_metadata_bin_path
=/tmp
/"${mma_test_metadata_bin}"
24 printf '=%.0s' {1.
.80}
29 printf "MMA blobs version : 2.1018\n"
30 printf "usage: $(basename "${0}") %s\n" \
31 "set [<mma_test_name_efi> <mma_test_param_bin>] | reset"
32 printf '=%.0s' {1.
.29}
33 printf "All possible MMA tests"
34 printf '=%.0s' {1.
.29}
37 printf "Test Name \tMargin1D.efi\n"
38 printf "Test Config\n"
39 printf "\t\t%s %s\n" \
40 Margin1DCkAllConfig.bin \
41 Margin1DCmdAllConfig.bin \
42 Margin1DCmdVrefConfig.bin \
43 Margin1DCtlAllConfig.bin \
44 Margin1DRxDqsDelayConfig.bin \
45 Margin1DRxVrefConfig.bin \
46 Margin1DTxDqDelayConfig.bin \
47 Margin1DTxVrefConfig.bin
49 printf "Test Name \tMargin2D.efi\n"
50 printf "Test Config\n"
51 printf "\t\t%s %s\n" \
52 Margin2D_Cmd_Ch0_D0_R0_Config.bin \
53 Margin2D_Cmd_Ch0_D1_R0_Config.bin \
54 Margin2D_Cmd_Ch1_D0_R0_Config.bin \
55 Margin2D_Cmd_Ch1_D1_R0_Config.bin \
56 Margin2D_Rx_Ch0_D0_R0_Config.bin \
57 Margin2D_Rx_Ch0_D0_R1_Config.bin \
58 Margin2D_Rx_Ch0_D1_R0_Config.bin \
59 Margin2D_Rx_Ch0_D1_R1_Config.bin \
60 Margin2D_Rx_Ch1_D0_R0_Config.bin \
61 Margin2D_Rx_Ch1_D0_R1_Config.bin \
62 Margin2D_Rx_Ch1_D1_R0_Config.bin \
63 Margin2D_Rx_Ch1_D1_R1_Config.bin \
64 Margin2D_Tx_Ch0_D0_R0_Config.bin \
65 Margin2D_Tx_Ch0_D0_R1_Config.bin \
66 Margin2D_Tx_Ch0_D1_R0_Config.bin \
67 Margin2D_Tx_Ch0_D1_R1_Config.bin \
68 Margin2D_Tx_Ch1_D0_R0_Config.bin \
69 Margin2D_Tx_Ch1_D0_R1_Config.bin \
70 Margin2D_Tx_Ch1_D1_R0_Config.bin \
71 Margin2D_Tx_Ch1_D1_R1_Config.bin
73 printf "Test name \tMarginMapper.efi\n"
74 printf "Test Config\n"
75 printf "\t\t%s %s\n" \
76 MarginMapperRxVref-RxDqsDelayConfigVCh0ACh0_single_ch.bin \
77 MarginMapperRxVref-RxDqsDelayConfigVCh0ACh1_dual_ch.bin \
78 MarginMapperRxVref-RxDqsDelayConfigVCh1ACh0_dual_ch.bin \
79 MarginMapperRxVref-RxDqsDelayConfigVCh1ACh1_single_ch.bin \
80 MarginMapperTxVref-TxDqDelayConfigVCh0ACh0_single_ch.bin \
81 MarginMapperTxVref-TxDqDelayConfigVCh0ACh1_dual_ch.bin \
82 MarginMapperTxVref-TxDqDelayConfigVCh1ACh0_dual_ch.bin \
83 MarginMapperTxVref-TxDqDelayConfigVCh1ACh1_single_ch.bin \
84 ScoreRxVref-RxDqsDelayConfigVCh0ACh0_single_ch.bin \
85 ScoreRxVref-RxDqsDelayConfigVCh0ACh1_dual_ch.bin \
86 ScoreRxVref-RxDqsDelayConfigVCh1ACh0_dual_ch.bin \
87 ScoreRxVref-RxDqsDelayConfigVCh1ACh1_single_ch.bin \
88 ScoreTxVref-TxDqDelayConfigVCh0ACh0_single_ch.bin \
89 ScoreTxVref-TxDqDelayConfigVCh0ACh1_dual_ch.bin \
90 ScoreTxVref-TxDqDelayConfigVCh1ACh0_dual_ch.bin \
91 ScoreTxVref-TxDqDelayConfigVCh1ACh1_single_ch.bin
93 printf "Test Name \tRMT.efi\n"
94 printf "Test Config\n"
95 printf "\t\t%s %s\n" \
101 printf "Writing back flash contents "${flashrom_temp_image}"\n"
102 flashrom
-p host -w "${flashrom_temp_image}" --fast-verify || \
104 printf "failed to read flash\n" ;
109 remove_file_if_exists
() {
110 if [ -f "${1}" ]; then
111 printf "removing old "${1}"\n"
117 printf "Removing "${mma_test_metadata_bin}" from "${flashrom_temp_image}"\n"
118 cbfstool
"${flashrom_temp_image}" remove
-n ${mma_test_metadata_bin}
119 outout
=$
(cbfstool
"${flashrom_temp_image}" print | \
120 grep ${mma_test_metadata_bin})
122 if [ -z "${outout}" ];then
123 printf "Removed ${mma_test_metadata_bin} from %s\n" \
124 "${flashrom_temp_image}"
126 printf "Failed to remove ${mma_test_metadata_bin} from %s\n" \
127 "${flashrom_temp_image}"
133 generate_metadata
() {
134 remove_file_if_exists
"${mma_test_metadata_bin_path}"
136 printf "Creating "${mma_test_metadata_bin_path}"\n"
138 #Format of $mma_test_metadata_bin
139 #MMA_TEST_NAME=xxxxxx.efi;MMA_TEST_PARAM=xxxxxx.bin;
141 printf "MMA_TEST_NAME=${mma_test_name};MMA_TEST_PARAM=${mma_test_param};" \
142 > "${mma_test_metadata_bin_path}"
145 add_metadata_to_flashfile
() {
146 cbfstool
"${flashrom_temp_image}" add
-f "${mma_test_metadata_bin_path}" \
147 -n ${mma_test_metadata_bin} -t ${file_type_mma} || \
149 printf "failed to add "${mma_test_metadata_bin_path}"\n" ;
155 remove_file_if_exists
"${flashrom_temp_image}"
156 remove_file_if_exists
"${mma_test_metadata_bin_path}"
160 printf "============== SUCCESS ==============\n"
164 printf "============== FAILED ==============\n"
184 if [ "${1}" != "reset" ];then
185 printf "mma_test_name = ${mma_test_name}\n"
186 printf "mma_test_param = ${mma_test_param}\n"
189 remove_file_if_exists
"${flashrom_temp_image}"
191 printf "Reading flash contents to "${flashrom_temp_image}"\n"
192 flashrom
-p host -r "${flashrom_temp_image}" || \
194 printf "failed to read flash\n" ;
198 outdata
=$
(cbfstool
"${flashrom_temp_image}" print | \
199 grep ${mma_test_metadata_bin})
203 [ "${outdata}" ] && remove_metadata
205 add_metadata_to_flashfile
209 if [ -z "${outdata}" ];then
210 printf "${mma_test_metadata_bin} not found at all.\n"