From: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
To: "Zhang, Rui" <rui.zhang@intel.com>,
"rafael@kernel.org" <rafael@kernel.org>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
"todd.e.brandt@linux.intel.com" <todd.e.brandt@linux.intel.com>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Brandt, Todd E" <todd.e.brandt@intel.com>
Subject: Re: [PATCH 2/2] simple python script for testing PSVT table
Date: Tue, 23 May 2023 22:01:57 +0000 [thread overview]
Message-ID: <70b98a91dd823b235fbabba58c23c56a6e9f7f41.camel@intel.com> (raw)
In-Reply-To: <ec67f5a343dbcdfd337eb192c178dc4578819b29.1432082423.git.todd.e.brandt@linux.intel.com>
Sent by mistake please ignore.
Thanks,
Srinivas
On Tue, 2023-05-23 at 15:01 -0700, Srinivas Pandruvada wrote:
> From: Todd Brandt <todd.e.brandt@linux.intel.com>
>
> Added a simple python script for testing the thermal tables.
>
> ACPI Thermal Table Test
> Usage: therm-table-test.py <options>
> Description:
> Python script for quick testing of thermal table availablity
> Options:
> -h Print this help text
> -art Test the ART table
> -trt Test the TRT table
> -psvt Test the PSVT table
> (none) Test all tables
>
> Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
> ---
> scripts/acpi-thermal-rel-test.py | 148
> +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 148 insertions(+)
> create mode 100644 scripts/acpi-thermal-rel-test.py
>
> diff --git a/scripts/acpi-thermal-rel-test.py b/scripts/acpi-thermal-
> rel-test.py
> new file mode 100644
> index 0000000..9a82777
> --- /dev/null
> +++ b/scripts/acpi-thermal-rel-test.py
> @@ -0,0 +1,148 @@
> +#!/usr/bin/python
> +
> +import sys
> +import os
> +from fcntl import ioctl
> +import array
> +import struct
> +
> +def i(x):
> + return x - 2**32
> +
> +ACPI_THERMAL_GET_TRT_LEN = i(0x80087301)
> +ACPI_THERMAL_GET_ART_LEN = i(0x80087302)
> +ACPI_THERMAL_GET_TRT_COUNT = i(0x80087303)
> +ACPI_THERMAL_GET_ART_COUNT = i(0x80087304)
> +ACPI_THERMAL_GET_TRT = i(0x80087305)
> +ACPI_THERMAL_GET_ART = i(0x80087306)
> +ACPI_THERMAL_GET_PSVT_REV = i(0x80087307)
> +ACPI_THERMAL_GET_PSVT_LEN = i(0x80087308)
> +ACPI_THERMAL_GET_PSVT_COUNT = i(0x80087309)
> +ACPI_THERMAL_GET_PSVT = i(0x8008730a)
> +
> +def toInt(buf):
> + return struct.unpack('Q', buf)[0]
> +
> +def toStr(buf):
> + return buf.tostring()
> +
> +def testART():
> + f = os.open('/dev/acpi_thermal_rel', os.O_RDWR)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_ART_COUNT, buf)
> + count = buf[0]
> + print('ACPI_THERMAL_GET_ART_COUNT = %d' % count)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_ART_LEN, buf)
> + length = buf[0]
> + print('ACPI_THERMAL_GET_ART_LEN = %d' % length)
> + buf = array.array('c', '\0'*length)
> + ioctl(f, ACPI_THERMAL_GET_ART, buf)
> + print('ACPI_THERMAL_GET_ART')
> + plen = length/count
> + for i in range(count):
> + package = buf[(i*plen):((i+1)*plen)]
> + print(' package %d' % i)
> + print(' source: %s' % toStr(package[0:8]))
> + print(' target: %s' % toStr(package[8:16]))
> + print(' weight: %d' % toInt(package[16:24]))
> +
> +def testTRT():
> + f = os.open('/dev/acpi_thermal_rel', os.O_RDWR)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_TRT_COUNT, buf)
> + count = buf[0]
> + print('ACPI_THERMAL_GET_TRT_COUNT = %d' % count)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_TRT_LEN, buf)
> + length = buf[0]
> + print('ACPI_THERMAL_GET_TRT_LEN = %d' % length)
> + buf = array.array('c', '\0'*length)
> + ioctl(f, ACPI_THERMAL_GET_TRT, buf)
> + print('ACPI_THERMAL_GET_TRT')
> + plen = length/count
> + for i in range(count):
> + package = buf[(i*plen):((i+1)*plen)]
> + print(' package %d' % i)
> + print(' source: %s' % toStr(package[0:8]))
> + print(' target: %s' % toStr(package[8:16]))
> + print(' influence: %d' % toInt(package[16:24]))
> + print(' sample_period: %d' %
> toInt(package[24:32]))
> +
> +def testPSVT():
> + f = os.open('/dev/acpi_thermal_rel', os.O_RDWR)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_PSVT_REV, buf)
> + rev = buf[0]
> + print('ACPI_THERMAL_GET_PSVT_REV = %d' % rev)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_PSVT_COUNT, buf)
> + count = buf[0]
> + print('ACPI_THERMAL_GET_PSVT_COUNT = %d' % count)
> + buf = array.array('h', [0])
> + ioctl(f, ACPI_THERMAL_GET_PSVT_LEN, buf)
> + length = buf[0]
> + print('ACPI_THERMAL_GET_PSVT_LEN = %d' % length)
> + buf = array.array('c', '\0'*length)
> + ioctl(f, ACPI_THERMAL_GET_PSVT, buf)
> + print('ACPI_THERMAL_GET_PSVT')
> + plen = length/count
> + for i in range(count):
> + package = buf[(i*plen):((i+1)*plen)]
> + knobtype = toInt(package[88:96])
> + print(' package %d' % i)
> + print(' source: %s' % toStr(package[0:8]))
> + print(' target: %s' % toStr(package[8:16]))
> + print(' priority: %d' % toInt(package[16:24]))
> + print(' sample_period: %d' %
> toInt(package[24:32]))
> + print(' target_domain: %d' %
> toInt(package[32:40]))
> + print(' passive_temp: %d' % toInt(package[40:48]))
> + print(' source_domain: %d' %
> toInt(package[48:56]))
> + if(knobtype == 2):
> + print(' control_knob: %s' %
> toStr(package[56:64]))
> + else:
> + print(' control_knob: %d' %
> toInt(package[56:64]))
> + print(' limit: %d' % toInt(package[64:72]))
> + print(' limit_step_size: %d' %
> toInt(package[72:80]))
> + print(' unlimit_step_size: %d' %
> toInt(package[80:88]))
> +
> +def printHelp():
> + print('ACPI Thermal Table Test')
> + print('Usage: therm-table-test.py <options>')
> + print('Description:')
> + print(' Python script for quick testing of thermal table
> availablity')
> + print('Options:')
> + print(' -h Print this help text')
> + print(' -art Test the ART table')
> + print(' -trt Test the TRT table')
> + print(' -psvt Test the PSVT table')
> + print(' (none) Test all tables')
> +
> +if __name__ == '__main__':
> + tests = {'art':False, 'trt':False, 'psvt':False}
> + args = iter(sys.argv[1:])
> + for arg in args:
> + if(arg == '-h'):
> + printHelp()
> + sys.exit()
> + elif(arg == '-art'):
> + tests['art'] = True
> + elif(arg == '-trt'):
> + tests['trt'] = True
> + elif(arg == '-psvt'):
> + tests['psvt'] = True
> + else:
> + printHelp()
> + print('Invalid argument: %s' % arg)
> + sys.exit()
> +
> + if not tests['art'] and not tests['trt'] and not
> tests['psvt']:
> + for i in tests:
> + tests[i] = True
> +
> + if tests['art']:
> + testART()
> + if tests['trt']:
> + testTRT()
> + if tests['psvt']:
> + testPSVT()
next prev parent reply other threads:[~2023-05-23 22:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 22:00 [PATCH] thermal: intel: int340x_thermal: New IOCTLs for thermal Srinivas Pandruvada
[not found] ` <cover.1432082423.git.todd.e.brandt@linux.intel.com>
[not found] ` <ec67f5a343dbcdfd337eb192c178dc4578819b29.1432082423.git.todd.e.brandt@linux.intel.com>
2023-05-23 22:01 ` Pandruvada, Srinivas [this message]
[not found] ` <a3773670b3317d5a784d915759865cddaf8a0900.1432082423.git.todd.e.brandt@linux.intel.com>
2023-05-23 22:02 ` [PATCH v2 1/2] ACPI PSVT table addition to acpi_thermal_rel Pandruvada, Srinivas
2023-05-23 22:03 ` [PATCH 0/2] ACPI PSVT table exported to userspace Pandruvada, Srinivas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=70b98a91dd823b235fbabba58c23c56a6e9f7f41.camel@intel.com \
--to=srinivas.pandruvada@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=todd.e.brandt@intel.com \
--cc=todd.e.brandt@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®