162306a36Sopenharmony_ci#!/bin/sh
262306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci# amd-pstate-ut is a test module for testing the amd-pstate driver.
562306a36Sopenharmony_ci# It can only run on x86 architectures and current cpufreq driver
662306a36Sopenharmony_ci# must be amd-pstate.
762306a36Sopenharmony_ci# (1) It can help all users to verify their processor support
862306a36Sopenharmony_ci# (SBIOS/Firmware or Hardware).
962306a36Sopenharmony_ci# (2) Kernel can have a basic function test to avoid the kernel
1062306a36Sopenharmony_ci# regression during the update.
1162306a36Sopenharmony_ci# (3) We can introduce more functional or performance tests to align
1262306a36Sopenharmony_ci# the result together, it will benefit power and performance scale optimization.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci# protect against multiple inclusion
1562306a36Sopenharmony_ciif [ $FILE_BASIC ]; then
1662306a36Sopenharmony_ci	return 0
1762306a36Sopenharmony_cielse
1862306a36Sopenharmony_ci	FILE_BASIC=DONE
1962306a36Sopenharmony_cifi
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciamd_pstate_basic()
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	printf "\n---------------------------------------------\n"
2462306a36Sopenharmony_ci	printf "*** Running AMD P-state ut                ***"
2562306a36Sopenharmony_ci	printf "\n---------------------------------------------\n"
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci	if ! /sbin/modprobe -q -n amd-pstate-ut; then
2862306a36Sopenharmony_ci		echo "amd-pstate-ut: module amd-pstate-ut is not found [SKIP]"
2962306a36Sopenharmony_ci		exit $ksft_skip
3062306a36Sopenharmony_ci	fi
3162306a36Sopenharmony_ci	if /sbin/modprobe -q amd-pstate-ut; then
3262306a36Sopenharmony_ci		/sbin/modprobe -q -r amd-pstate-ut
3362306a36Sopenharmony_ci		echo "amd-pstate-basic: ok"
3462306a36Sopenharmony_ci	else
3562306a36Sopenharmony_ci		echo "amd-pstate-basic: [FAIL]"
3662306a36Sopenharmony_ci		exit 1
3762306a36Sopenharmony_ci	fi
3862306a36Sopenharmony_ci}
39