108743dbaSCédric Le Goater#!/usr/bin/env python3 208743dbaSCédric Le Goater# 308743dbaSCédric Le Goater# Functional test that boots the ASPEED machines 408743dbaSCédric Le Goater# 508743dbaSCédric Le Goater# SPDX-License-Identifier: GPL-2.0-or-later 608743dbaSCédric Le Goater 799fb9256SThomas Huthfrom qemu_test import Asset, exec_command_and_wait_for_pattern 808743dbaSCédric Le Goaterfrom aspeed import AspeedTest 95831ed84SDaniel P. Berrangé 1008743dbaSCédric Le Goater 1108743dbaSCédric Le Goaterclass AST2500Machine(AspeedTest): 1208743dbaSCédric Le Goater 13f7ae9612SCédric Le Goater ASSET_BR2_202411_AST2500_FLASH = Asset( 1408743dbaSCédric Le Goater ('https://github.com/legoater/qemu-aspeed-boot/raw/master/' 15f7ae9612SCédric Le Goater 'images/ast2500-evb/buildroot-2024.11/flash.img'), 16f7ae9612SCédric Le Goater '641e6906c18c0f19a2aeb48099d66d4771929c361001d554d0d45c667413e13a') 1708743dbaSCédric Le Goater 1808743dbaSCédric Le Goater def test_arm_ast2500_evb_buildroot(self): 1908743dbaSCédric Le Goater self.set_machine('ast2500-evb') 2008743dbaSCédric Le Goater 21f7ae9612SCédric Le Goater image_path = self.ASSET_BR2_202411_AST2500_FLASH.fetch() 2208743dbaSCédric Le Goater 2308743dbaSCédric Le Goater self.vm.add_args('-device', 24858640eaSThomas Huth 'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test') 2508743dbaSCédric Le Goater self.do_test_arm_aspeed_buildroot_start(image_path, '0x0', 2608743dbaSCédric Le Goater 'ast2500-evb login:') 2708743dbaSCédric Le Goater 2808743dbaSCédric Le Goater exec_command_and_wait_for_pattern(self, 2908743dbaSCédric Le Goater 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device', 30858640eaSThomas Huth 'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d') 3108743dbaSCédric Le Goater exec_command_and_wait_for_pattern(self, 3208743dbaSCédric Le Goater 'cat /sys/class/hwmon/hwmon1/temp1_input', '0') 3308743dbaSCédric Le Goater self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test', 34858640eaSThomas Huth property='temperature', value=18000) 3508743dbaSCédric Le Goater exec_command_and_wait_for_pattern(self, 3608743dbaSCédric Le Goater 'cat /sys/class/hwmon/hwmon1/temp1_input', '18000') 3708743dbaSCédric Le Goater 3808743dbaSCédric Le Goater self.do_test_arm_aspeed_buildroot_poweroff() 3908743dbaSCédric Le Goater 40*9b671ea9SJamin Lin ASSET_SDK_V906_AST2500 = Asset( 41*9b671ea9SJamin Lin 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2500-default-obmc.tar.gz', 42*9b671ea9SJamin Lin '542db84645b4efd8aed50385d7f4dd1caff379a987032311cfa7b563a3addb2a') 4308743dbaSCédric Le Goater 4408743dbaSCédric Le Goater def test_arm_ast2500_evb_sdk(self): 4508743dbaSCédric Le Goater self.set_machine('ast2500-evb') 4608743dbaSCédric Le Goater 47*9b671ea9SJamin Lin self.archive_extract(self.ASSET_SDK_V906_AST2500) 4808743dbaSCédric Le Goater 4908743dbaSCédric Le Goater self.do_test_arm_aspeed_sdk_start( 50beaf88c8SDaniel P. Berrangé self.scratch_file("ast2500-default", "image-bmc")) 5108743dbaSCédric Le Goater 5208743dbaSCédric Le Goater self.wait_for_console_pattern('ast2500-default login:') 5308743dbaSCédric Le Goater 5408743dbaSCédric Le Goater 5508743dbaSCédric Le Goaterif __name__ == '__main__': 5608743dbaSCédric Le Goater AspeedTest.main() 57