1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Merge pull request #1 from derkling/drk-fixups

Fixup some modules initialization
This commit is contained in:
setrofim 2015-10-16 10:45:35 +01:00
commit db14589886
5 changed files with 33 additions and 4 deletions

View File

@ -29,7 +29,20 @@ class CpufreqModule(Module):
@staticmethod @staticmethod
def probe(target): def probe(target):
# x86 with Intel P-State driver
if target.abi == 'x86_64':
path = '/sys/devices/system/cpu/intel_pstate'
if target.file_exists(path):
return True
# Generic CPUFreq support (single policy)
path = '/sys/devices/system/cpu/cpufreq' path = '/sys/devices/system/cpu/cpufreq'
if target.file_exists(path):
return True
# Generic CPUFreq support (per CPU policy)
path = '/sys/devices/system/cpu/cpu0/cpufreq'
return target.file_exists(path) return target.file_exists(path)
def __init__(self, target): def __init__(self, target):

View File

@ -8,7 +8,10 @@ class HotplugModule(Module):
@classmethod @classmethod
def probe(cls, target): # pylint: disable=arguments-differ def probe(cls, target): # pylint: disable=arguments-differ
path = cls._cpu_path(target, 0) # If a system has just 1 CPU, it makes not sense to hotplug it.
# If a system has more than 1 CPU, CPU0 could be configured to be not
# hotpluggable. Thus, check for hotplug support by looking at CPU1
path = cls._cpu_path(target, 1)
return target.file_exists(path) and target.is_rooted return target.file_exists(path) and target.is_rooted
@classmethod @classmethod
@ -30,6 +33,8 @@ class HotplugModule(Module):
def hotplug(self, cpu, online): def hotplug(self, cpu, online):
path = self._cpu_path(self.target, cpu) path = self._cpu_path(self.target, cpu)
if not self.target.file_exists(path):
return
value = 1 if online else 0 value = 1 if online else 0
self.target.write_value(path, value) self.target.write_value(path, value)

View File

@ -177,8 +177,8 @@ class Target(object):
tid = id(threading.current_thread()) tid = id(threading.current_thread())
self._connections[tid] = self.get_connection(timeout=timeout) self._connections[tid] = self.get_connection(timeout=timeout)
self.busybox = self.get_installed('busybox') self.busybox = self.get_installed('busybox')
self._update_modules('connected')
self.platform.update_from_target(self) self.platform.update_from_target(self)
self._update_modules('connected')
if self.platform.big_core and self.load_default_modules: if self.platform.big_core and self.load_default_modules:
self._install_module(get_module('bl')) self._install_module(get_module('bl'))

View File

@ -19,7 +19,13 @@ from contextlib import contextmanager
from logging import Logger from logging import Logger
import serial import serial
import fdpexpect
import pexpect
from distutils.version import StrictVersion as V
if V(pexpect.__version__) < V('4.0.0'):
import fdpexpect
else:
from pexpect import fdpexpect
# Adding pexpect exceptions into this module's namespace # Adding pexpect exceptions into this module's namespace
from pexpect import EOF, TIMEOUT # NOQA pylint: disable=W0611 from pexpect import EOF, TIMEOUT # NOQA pylint: disable=W0611

View File

@ -23,7 +23,12 @@ import threading
import tempfile import tempfile
import shutil import shutil
import pxssh import pexpect
from distutils.version import StrictVersion as V
if V(pexpect.__version__) < V('4.0.0'):
import pxssh
else:
from pexpect import pxssh
from pexpect import EOF, TIMEOUT, spawn from pexpect import EOF, TIMEOUT, spawn
from devlib.exception import HostError, TargetError, TimeoutError from devlib.exception import HostError, TargetError, TimeoutError