OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import glob, logging, os, re | 5 import glob, logging, os, re |
6 from autotest_lib.client.bin import test | 6 from autotest_lib.client.bin import test, utils |
7 from autotest_lib.client.common_lib import error, site_power_status, utils | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.cros import power_status |
| 9 |
8 | 10 |
9 # Specify registers to check. The format needs to be: | 11 # Specify registers to check. The format needs to be: |
10 # register offset : ('bits', 'expression') | 12 # register offset : ('bits', 'expression') |
11 DMI_BAR_CHECKS = { | 13 DMI_BAR_CHECKS = { |
12 '0x88': [('1:0', 3)], | 14 '0x88': [('1:0', 3)], |
13 '0x200': [('27:26', 0)], | 15 '0x200': [('27:26', 0)], |
14 '0x210': [('2:0', 1), ('15:8', 1)], | 16 '0x210': [('2:0', 1), ('15:8', 1)], |
15 '0xc28': [('5:1', 7)], | 17 '0xc28': [('5:1', 7)], |
16 '0xc2e': [('5', 1)], | 18 '0xc2e': [('5', 1)], |
17 '0xc30': [('11', 0), ('10:8', 4)], | 19 '0xc30': [('11', 0), ('10:8', 4)], |
(...skipping 18 matching lines...) Expand all Loading... |
36 version = 1 | 38 version = 1 |
37 | 39 |
38 def run_once(self): | 40 def run_once(self): |
39 if not self._check_cpu_type(): | 41 if not self._check_cpu_type(): |
40 raise error.TestNAError('Unsupported CPU') | 42 raise error.TestNAError('Unsupported CPU') |
41 | 43 |
42 self._rdmsr_cmd = 'iotools rdmsr 0' | 44 self._rdmsr_cmd = 'iotools rdmsr 0' |
43 self._pci_read32_cmd = 'iotools pci_read32' | 45 self._pci_read32_cmd = 'iotools pci_read32' |
44 self._mmio_read32_cmd = 'iotools mmio_read32' | 46 self._mmio_read32_cmd = 'iotools mmio_read32' |
45 | 47 |
46 power_status = site_power_status.get_status() | 48 status = power_status.get_status() |
47 if power_status.linepower[0].online: | 49 if status.linepower[0].online: |
48 logging.info('AC Power is online') | 50 logging.info('AC Power is online') |
49 self._on_ac = True | 51 self._on_ac = True |
50 else: | 52 else: |
51 logging.info('AC Power is offline') | 53 logging.info('AC Power is offline') |
52 self._on_ac = False | 54 self._on_ac = False |
53 | 55 |
54 failures = '' | 56 failures = '' |
55 | 57 |
56 fail_count = self._verify_dmi_bar() | 58 fail_count = self._verify_dmi_bar() |
57 if fail_count: | 59 if fail_count: |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 276 |
275 | 277 |
276 def _read_mmio_read32(self, address): | 278 def _read_mmio_read32(self, address): |
277 cmd = '%s %s' % (self._mmio_read32_cmd, address) | 279 cmd = '%s %s' % (self._mmio_read32_cmd, address) |
278 return int(utils.system_output(cmd), 16) | 280 return int(utils.system_output(cmd), 16) |
279 | 281 |
280 | 282 |
281 def _read_msr(self, register): | 283 def _read_msr(self, register): |
282 cmd = '%s %s' % (self._rdmsr_cmd, register) | 284 cmd = '%s %s' % (self._rdmsr_cmd, register) |
283 return int(utils.system_output(cmd), 16) | 285 return int(utils.system_output(cmd), 16) |
OLD | NEW |