Tim Lee | 48d80bd | 2021-01-25 15:41:37 +0800 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Module to test npcm750 JTAG Master. |
| 3 | |
Stanley Chu | bc28435 | 2021-06-08 10:48:48 +0800 | [diff] [blame] | 4 | Resource ../../lib/openbmc_ffdc.robot |
| 5 | Resource ../../lib/connection_client.robot |
Tim Lee | 48d80bd | 2021-01-25 15:41:37 +0800 | [diff] [blame] | 6 | |
| 7 | Suite Setup Suite Setup Execution |
| 8 | |
| 9 | *** Variables *** |
| 10 | ${wrong_cpld} 0 |
| 11 | ${program_cpld} 0 |
| 12 | |
| 13 | *** Test Cases *** |
| 14 | |
| 15 | Test Read CPLD ID |
| 16 | [Documentation] Test Read CPLD ID. |
| 17 | [Tags] Test_Read_CPLD_ID |
| 18 | |
| 19 | ${cmd}= Catenate loadsvf -d ${jtag_dev} -s /var/${readid_svf} |
| 20 | ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} |
| 21 | Set Global Variable ${wrong_cpld} 1 |
| 22 | Should Not Contain ${stderr} tdo check error |
| 23 | Set Global Variable ${wrong_cpld} 0 |
| 24 | |
| 25 | |
| 26 | Test Program CPLD |
| 27 | [Documentation] Test Program CPLD. |
| 28 | [Tags] Test_Program_CPLD |
| 29 | |
| 30 | Pass Execution If ${wrong_cpld}==1 Wrong CPLD chip |
| 31 | Pass Execution If ${program_cpld}==0 skip programming cpld |
| 32 | |
| 33 | Program CPLD ${cpld_firmware2} ${firmware_version2} |
| 34 | Program CPLD ${cpld_firmware1} ${firmware_version1} |
| 35 | |
| 36 | *** Keywords *** |
| 37 | |
| 38 | Get File From SFTP Server |
| 39 | [Documentation] SCP Get File. |
| 40 | [Arguments] ${filename} |
| 41 | |
| 42 | # Description of argument(s): |
| 43 | # filename The file to be downloaded. |
| 44 | |
| 45 | Shell Cmd |
| 46 | ... scp ${SFTP_USER}@${SFTP_SERVER}:${SFTP_PATH}/${filename} ${filename} |
| 47 | |
| 48 | |
| 49 | Put File To BMC |
| 50 | [Documentation] SCP Put File. |
| 51 | [Arguments] ${filename} |
| 52 | |
| 53 | # Description of argument(s): |
| 54 | # filename The file to be uploaded. |
| 55 | |
| 56 | scp.Put File ${filename} /var/${filename} |
| 57 | |
| 58 | Suite Setup Execution |
George Keishing | 3fb7558 | 2021-02-10 05:00:09 -0600 | [diff] [blame] | 59 | [Documentation] Suite Setup Execution. |
Tim Lee | 48d80bd | 2021-01-25 15:41:37 +0800 | [diff] [blame] | 60 | |
| 61 | ${status}= Run Keyword And Return Status Variable Should Exist |
| 62 | ... ${TEST_PROGRAM_CPLD} |
| 63 | ${value}= Set Variable if ${status} == ${TRUE} ${TEST_PROGRAM_CPLD} 0 |
| 64 | Set Global Variable ${program_cpld} ${value} |
| 65 | |
| 66 | ${code_base_dir_path}= Get Code Base Dir Path |
| 67 | ${olympus_json}= Evaluate |
| 68 | ... json.load(open('${code_base_dir_path}data/oem/nuvoton/olympus.json')) modules=json |
| 69 | |
| 70 | ${cpld_firmware1}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw1"]} |
| 71 | ${cpld_firmware2}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw2"]} |
| 72 | ${firmware_version1}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw1ver"]} |
| 73 | ${firmware_version2}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw2ver"]} |
| 74 | ${readusercode_svf}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["readusercode"]} |
| 75 | ${readid_svf}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["readid"]} |
| 76 | ${jtag_dev}= Set Variable ${olympus_json["npcm7xx"]["jtag_dev"]} |
| 77 | ${power_cycle_cmd}= Set Variable ${olympus_json["npcm7xx"]["power_cycle_cmd"]} |
| 78 | |
| 79 | Set Suite Variable ${cpld_firmware1} |
| 80 | Set Suite Variable ${cpld_firmware2} |
| 81 | Set Suite Variable ${firmware_version1} |
| 82 | Set Suite Variable ${firmware_version2} |
| 83 | Set Suite Variable ${readusercode_svf} |
| 84 | Set Suite Variable ${readid_svf} |
| 85 | Set Suite Variable ${jtag_dev} |
| 86 | Set Suite Variable ${power_cycle_cmd} |
| 87 | |
| 88 | Get File From SFTP Server ${readid_svf} |
| 89 | Run KeyWord If ${program_cpld} == 1 Get File From SFTP Server ${readusercode_svf} |
| 90 | Run KeyWord If ${program_cpld} == 1 Get File From SFTP Server ${cpld_firmware1} |
| 91 | Run KeyWord If ${program_cpld} == 1 Get File From SFTP Server ${cpld_firmware2} |
| 92 | |
| 93 | scp.Open connection ${OPENBMC_HOST} username=${OPENBMC_USERNAME} |
| 94 | ... password=${OPENBMC_PASSWORD} |
| 95 | Put File To BMC ${readid_svf} |
| 96 | Run KeyWord If ${program_cpld} == 1 Put File To BMC ${readusercode_svf} |
| 97 | Run KeyWord If ${program_cpld} == 1 Put File To BMC ${cpld_firmware1} |
| 98 | Run KeyWord If ${program_cpld} == 1 Put File To BMC ${cpld_firmware2} |
| 99 | Sleep 5s |
| 100 | scp.Close Connection |
| 101 | |
| 102 | Program CPLD |
| 103 | [Documentation] Program CPLD. |
| 104 | [Arguments] ${svf_file} ${version} |
| 105 | |
| 106 | # Description of argument(s): |
| 107 | # svf_file The firmware file. |
| 108 | # version The firmware version. |
| 109 | |
| 110 | ${cmd}= Catenate loadsvf -d ${jtag_dev} -s /var/${svf_file} |
| 111 | ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} |
| 112 | Should Not Contain ${stderr} tdo check error |
| 113 | |
| 114 | # control hot swap controller to power cycle whole system |
| 115 | BMC Execute Command ${power_cycle_cmd} ignore_err=1 fork=1 |
| 116 | |
| 117 | Sleep 10s |
| 118 | Run Keyword Wait For Host To Ping ${OPENBMC_HOST} 5 mins |
| 119 | ${cmd}= Catenate loadsvf -d ${jtag_dev} -s /var/${readusercode_svf} |
| 120 | ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} |
| 121 | Should Contain ${output} ${version} |