Files
chipsec-chipsec/tests/software/test_reg.py
T
c7zero 16af0c7dfd More operation in chipsec_util reg command (#238)
* More operation in chipsec_util reg command

Added write, read_field, write_field, get_control, set_control
operations

* reg read util command updated

Returned back "chipsec_util reg read" syntax and added tests.

* Commented out test_reg_get_control

Need to implement get_MMIO_BAR_base_address or read_pci_reg for SPIBAR
in mock_helper.py
2017-07-20 13:05:51 -07:00

46 lines
1.5 KiB
Python

#!/usr/bin/python
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2017, Google
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; Version 2.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
import unittest
from tests.software import mock_helper, util
class TestRegChipsecUtil(util.TestChipsecUtil):
"""Test the reg commands exposed by chipsec_utils."""
def test_reg_read(self):
self._chipsec_util("reg read PCI0.0.0_VID")
self._assertLogValue("PCI0.0.0_VID", "0x8086")
def test_reg_read_field(self):
self._chipsec_util("reg read PCI0.0.0_TOUUD LOCK")
self._assertLogValue("PCI0.0.0_TOUUD.LOCK", "0x0")
def test_reg_read_field1(self):
self._chipsec_util("reg read_field PCI0.0.0_TOUUD LOCK")
self._assertLogValue("PCI0.0.0_TOUUD.LOCK", "0x0")
#def test_reg_get_control(self):
# self._chipsec_util("reg get_control FlashLockDown")
# self._assertLogValue("FlashLockDown", "0x0")
if __name__ == '__main__':
unittest.main()