Commit Graph

1918 Commits

Author SHA1 Message Date
Nathaniel Mitchell 6cdfd54d6e Fix UEFI shell issue with new config loading
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
1.12.0
2023-07-28 15:00:27 -07:00
Nathaniel Mitchell 025e15548f Update to 1.12.0
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-28 13:49:15 -07:00
Nathaniel Mitchell 145351d150 Add workaround for config loading bug
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-28 13:15:14 -07:00
brentholtsclaw 53a6221af4 Fix typehint
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-07-28 09:40:12 -07:00
brentholtsclaw b40384ffb4 Propogate ability for files not being within LOGPATH
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-07-28 09:40:12 -07:00
Nathaniel Mitchell 483f9d99f6 Update unittests to match config parsing update
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-28 09:34:00 -07:00
Dan Scott b3d974b51a Update modules and utils to match config parsing update
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-07-28 09:34:00 -07:00
Dan Scott 67fbb3c591 Update hals to match config parsing update
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-07-28 09:34:00 -07:00
Dan Scott 395d713cca Update configs to match config parsing update
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-07-28 09:34:00 -07:00
Dan Scott 009622740d Update config parsing
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-07-28 09:34:00 -07:00
Nathaniel Mitchell fe3202cde9 Update utils to match chipsec_util update
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-27 11:39:28 -07:00
Nathaniel Mitchell 96d5409688 Update BaseCommand, chipsec_util with new util structure
Additional changes to enhance utils usage

Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-27 11:39:28 -07:00
Nathaniel Mitchell 435bf2ab06 Add cfg checking tests (non-unittest)
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-26 16:17:38 -07:00
brentholtsclaw 8378bff01b Add ability to log outside of LOGPATH
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-07-26 15:32:19 -07:00
Nathaniel Mitchell c3b27e7870 Add record and replay helpers
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-26 15:31:56 -07:00
Nathaniel Mitchell 9a09eaed07 Fix 'self._get_driver_handle()' function calls in windowshelper.py
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-25 16:38:50 -07:00
Nathaniel Mitchell 27ee5eeb66 Clean up helper create/start/stop/delete functions
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-19 16:33:59 -07:00
jun2zhou e143924fdd Cpuinfo unittest (#1887)
* Add test cpu info unittest cases

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>

* Add __init__.py to this folder to be picked up by cmd "py setup.py test"

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>

* Remove unused import

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>

---------

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-07-11 16:37:29 -07:00
Nicolas Iooss d04cabd02d Remove invalid escape sequences in Windows path
`windowshelper.py` uses a path with backslashes without proper escaping.
While this works because `\s` and `\c` are not valid escape sequences,
this makes flake8 report:

   /chipsec/helper/windows/windowshelper.py:71:53: W605 invalid escape sequence '\s'
   /chipsec/helper/windows/windowshelper.py:71:67: W605 invalid escape sequence '\c'

Fix this by splitting the path when invoking `os.path.join`.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-07-11 16:37:03 -07:00
Nicolas Iooss f1dfa2dcdd Remove from_file from method start in base helper
Commit 99f9052438 ("Remove filehelper") removed `from_file` and
`to_file` from `OsHelper` but it remained in `BaseHelper`. Remove these
parameters too.

While at it, remove the similar parameters from the mock helper used in
tests.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-07-10 16:42:07 -07:00
Nicolas Iooss f2afb34220 Add typehints to exceptions.py
This helps type-checking other Python files.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-07-10 16:41:59 -07:00
Nicolas Iooss 518b7df6a0 Use raw string in the regular expression used in chipsec/module.py
`chipsec/module.py` uses a normal string to define a regular expression,
which makes flake8 report:

    chipsec/module.py:34:27: W605 invalid escape sequence '\w'
    chipsec/module.py:34:31: W605 invalid escape sequence '\.'
    chipsec/module.py:34:33: W605 invalid escape sequence '\w'

To prevent the Python interpreter from trying to interpret the escape
sequences, use a raw string.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-07-10 16:41:49 -07:00
Jason Zhou 7f58472655 Fix test_pch_invalid() test failing on internal builds
the test invalid pch mock helper returned fake pch id, but valid plat id,
if plat id matched xml file defined reqs_pch=true, will cause exception,
the mocked plat id corresponding xml is reqs_pch=true.

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-07-10 16:41:29 -07:00
brentholtsclaw 2f393edd62 Fix infinite loop condition
if size returns 0 the code will go into an infinate loop

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-07-10 16:41:18 -07:00
Nathaniel Mitchell a6ec8e0dd3 Update remap.py for when IBECC is enabled (EHL)
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-05 16:37:36 -07:00
Sara Batllori f5d4cc29c1 Add else clause to try block for better flow control
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-07-05 16:37:17 -07:00
Nathaniel Mitchell 190655b290 Fixup how -i, -n and --skip_config are used
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-05 16:36:58 -07:00
Nathaniel Mitchell d3285ee2c5 Update to 1.11.1
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
1.11.1
2023-06-28 11:11:52 -07:00
Jason Zhou 491b951f5b Add PCI filter Windows driver build integration
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-06-28 10:52:19 -07:00
Sara Batllori 318b361621 WIP: Add return codes changes to module_common and testcase plus remap support
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-06-27 17:47:46 -07:00
Jason Zhou aaf1a3f9a8 The legacy PCI config access will cause windows BSOD with following conditions:
windows version >= (OS Build 19041.423), && Secure Devices (SDEV) ACPI table && VBS enabled,
introduce the new PCI filter bus driver for PCI config access.

https://learn.microsoft.com/en-us/troubleshoot/windows-client/performance/stop-error-lenovo-thinkpad-kb4568831-uefi

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-06-27 16:36:09 -07:00
Sara Batllori 9b2e491597 Add return codes mode option to main and util
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-06-27 09:30:04 -07:00
Nathaniel Mitchell cec7e4b7b1 Fix write_mmio_reg call with wrong number of arguments
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-26 16:37:01 -07:00
Nathaniel Mitchell ede85bfcbf Fix mocked module scoping issue in unittest
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-26 16:36:48 -07:00
Nathaniel Mitchell dc3f78d38d Update useage help messages and help documentation
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-26 11:54:00 -07:00
Frinzell, Aaron 41ecf2cdb1 Implement basehelper.py as an ABC
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-06-23 08:27:17 -07:00
Sara Batllori 1d30937086 Fix issues with empty log file names and logs folder creation
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-06-22 16:49:52 -07:00
Nathaniel Mitchell 2fbfb5fb89 Add initial set of linuxhelper unittests
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-21 16:41:46 -07:00
Nathaniel Mitchell 5940959a19 Refactor msgbus_send_read/write_message to use msgbus_send_message
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-21 16:41:21 -07:00
Nathaniel Mitchell a1f8bcc4ed Update readme.md links
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-21 16:40:56 -07:00
Dan Scott 7e3ccae375 Add typehints and fstrings to igd_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-21 16:40:36 -07:00
Dan Scott 1107435bf3 Add typehints and fstrings to ec_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-21 16:40:20 -07:00
brentholtsclaw cdfa91b840 Add -nl option to chipsec_util
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-06-20 16:37:26 -07:00
Sara Batllori 474bbfd0d9 Change default log level to INFO
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-06-20 16:37:11 -07:00
Nicolas Iooss 6d52c2c54f Add type hints to helper.linuxnative.cpuid
With these annotations, mypy no longer report any issues in strict mode:

    $ mypy --strict chipsec/helper/linuxnative/cpuid.py
    Success: no issues found in 1 source file

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss f0ebbe01cc Simplify CPUID code mapping in linuxnative helper
Make the machine code `bytes` instead of `list`. This makes it no longer
necessary to cast it to `c_ubyte * size` before using it.

While at it, add `mmap.MAP_PRIVATE` flag to the mapping, as it is not
needed to create a `MAP_SHARED` mapping for the code (which is the
default flag).

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss fb80548746 Remove print_function import
Now that chipsec is no longer compatible with Python2, this import is no
longer useful.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss 14c5f7c314 Directly import chipsec.helper.linuxnative.cpuid in linuxnative
There is no point in doing a lazy-import with
`chipsec.helper.linuxnative.cpuid`, as the `cpuid` function is almost
always called when starting chipsec, to display the banner.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss 470820d464 Use c_void_p instead of c_voidp
`ctypes.c_voidp` was a bug which is kept in ctypes for backward
compatibility. This is documented in
https://github.com/python/cpython/blob/3.10/Lib/ctypes/__init__.py#L246
:

    c_voidp = c_void_p # backwards compatibility (to a bug)

Replace the use of `c_voidp` with `c_void_p`.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Dan Scott 2872f2fd90 Add typehints and fstrings to interrupts_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-20 16:36:48 -07:00