180 Commits

Author SHA1 Message Date
Nathaniel Mitchell 52231f72ed Add check to see if reg is defined in txt_cmd
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-09-25 16:21:09 -07:00
Nathaniel Mitchell c69509a92f Update functions that read efi variables from rom
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-09-25 12:39:17 -07:00
Dan Scott f19760c63c Replace print() with logger.log()
Signed-off-by: Dan Scott <dan.scott@intel.com>
2024-08-05 16:35:54 -07:00
Nathaniel Mitchell aedaa7531f Fix bug when msgbus_cmd returns wrong value type in windows
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-07-30 14:12:32 -07:00
Nathaniel Mitchell 591c10ec75 Fix missing size when doing ec dump
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-07-30 11:37:34 -07:00
Nathaniel Mitchell 39cf4bb620 Add UTs for ec_cmd and config_cmd
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-05-28 16:42:16 -07:00
Sae86 93bb8b66c6 Add feature so that mmcfg_base reads address for all buses available
Signed-off-by: Sae86 <sara.batllori@intel.com>
2024-05-28 16:40:35 -07:00
Dan Scott 0e8192cfd0 Move files to library folder 2024-03-22 14:26:59 -07:00
Dan Scott a933b1337d Update references to functions in new library files 2024-03-22 14:26:59 -07:00
BrentHoltsclaw 1a632de9f4 Update mmcfg command (#2035)
* Update mmcfg command

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2024-01-16 16:39:28 -08:00
Sae86 2d1866844e Improvements to iommu_cmd list command
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-12-12 16:43:14 -08:00
Jason Zhou 8e90f6c25d Fix except codeql warning
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-11-29 16:37:26 -08:00
Jason Zhou 74a03ac39a Add default cmd options ini config
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-11-29 16:37:26 -08:00
Sae86 c282cd9e2c Add tpm_cmd and txt_cmd unit testing
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-26 08:42:24 -07:00
Nathaniel Mitchell 00c80ff0c3 Update input name to avoid confusion of msr_cmd.py
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-25 16:33:54 -07:00
brentholtsclaw aff7ccc8a4 Update DMAR tables per specification
Intel Virtualization Technology for Directed I/O Revision 4.1 Order Number: D51397-016
sections 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 8.3.1

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-09-20 16:36:21 -07:00
Nathaniel Mitchell 6bbe67a7e6 Update lock_check_cmd to poke 'cs.consistency_checking'
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-08-15 16:39:22 -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
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
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
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
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
Dan Scott daf7d63d9f Add typehints and fstrings to decode_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-14 16:38:34 -07:00
Dan Scott 1841d2f1a2 Add typehints and fstrings to io_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-14 16:38:12 -07:00
Dan Scott d831476c65 Add typehints and fstrings to iommu_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-14 16:38:05 -07:00
Dan Scott 01574b182b Add typehints and fstrings to mem_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-14 16:37:51 -07:00
Dan Scott 2e05fde8e4 Add typehints and fstrings to mmcfg_base_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-14 16:37:38 -07:00
Dan Scott c0adee5d6e Add typehints and fstrings to mmcfg_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-14 16:37:27 -07:00
Dan Scott fda5180304 Add typehints and fstrings to desc_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-13 16:40:07 -07:00
Dan Scott 5c5f334a76 Add typehints and fstrings to deltas_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-13 16:39:49 -07:00
Dan Scott 5696bd9f74 Add typehints and fstrings to cpu_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-13 16:39:13 -07:00
Dan Scott 704685a477 Add typehints and fstrings to cpu_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-13 16:39:13 -07:00
Dan Scott 2e8becedc0 Add typehints and fstrings to cpu_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-06-13 16:39:13 -07:00
Nicolas Iooss e8d41ab9ee Replace binascii.hexlify with bytes.hex
Python 3.5 introduced `bytes.hex` to represent bytes in hexadecimal:
https://docs.python.org/3.5/library/stdtypes.html#bytes.hex

This function directly returns a string, contrary to `binascii.hexlify`
which returns bytes. Using `binascii.hexlify` without transforming the
output to string actually produced buggy output. For example:

    $ ./chipsec_util.py spidesc spi_rom.bin
    ...
    + 0x0000 Reserved : 0xb'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'

This `b'` is not desired. Using `bytes.hex` fixes this issue and makes
the code simpler.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-05 16:43:15 -07:00
Nathaniel Mitchell 4b38d41a29 Move helper.getcwd() from *helper to oshelper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-05 16:41:07 -07:00
Nicolas Iooss 9be66dadbd Replace print_buffer(bytestostring(data)) with print_buffer_bytes
`print_buffer_bytes` can directly handle bytes, instead of converting
them to a string.

While at it, replace buggy calls to `print_buffer(buffer)` (when
`buffer` uses type `bytes`) with `print_buffer_bytes(buffer)`.
This fixes `./chipsec_util.py idt 0`. Before it failed with:

    [CHIPSEC] Dumping IDT of 8 CPU threads
    [cpu0] Physical Address: 0x000000036639E000
    [cpu0] # of entries    : 256
    [cpu0] Contents (4 entries):
    Traceback (most recent call last):
      File "./chipsec_util.py", line 210, in <module>
        sys.exit(main())
      File "./chipsec_util.py", line 205, in main
        return chipsecMain.main()
      File "./chipsec_util.py", line 190, in main
        comm.run()
      File "chipsec/utilcmd/desc_cmd.py", line 84, in run
        self.cs.msr.IDT_all(4)
      File "chipsec/hal/msr.py", line 166, in IDT_all
        self.IDT(tid, num_entries)
      File "chipsec/hal/msr.py", line 158, in IDT
        return self.dump_Descriptor_Table(cpu_thread_id, DESCRIPTOR_TABLE_CODE_IDTR, num_entries)
      File "chipsec/hal/msr.py", line 144, in dump_Descriptor_Table
        print_buffer(dt)
      File "chipsec/logger.py", line 493, in print_buffer
        prt_str = bytes2string(arr, length)
      File "chipsec/logger.py", line 466, in bytes2string
        num_string += [f'{ord(c):02X} ']
    TypeError: ord() expected string of length 1, but int found

There was another bug in `hal/msr.py` where `ord(dt[...])` was used
instead of `dt`.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-31 16:39:35 -07:00
Nicolas Iooss 7806ebd04c Make EC, SMBus and SPD use bytes instead of list of characters
Using a list of unicode characters instead of bytes is strange in Python
3. Replace these lists with bytes, which is the usual type to hold
binary data.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-31 16:39:20 -07:00
Dan Scott 45f945c760 Add typehints and fstrings to cmos_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-05-26 12:03:28 -07:00
Dan Scott 8746808990 Add typehints and fstrings to config_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-05-24 16:36:24 -07:00
Dan Scott 77dc15f900 Add typehints and fstrings to config_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-05-24 16:36:24 -07:00
Dan Scott 7db7f32b2c Add typehints and fstrings to acpi_cmd.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-05-10 16:47:52 -07:00
Sara Batllori a2fcfb742c Remove sphinx warnings and spaces in installation file names
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-03-24 08:57:25 -07:00
Frinzell, Aaron 9d08f37dd1 Update doc-string, add Type Hints & fstrings in lock_check_cmd.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-02-07 16:48:03 -08:00
brentholtsclaw 7af173a43c Module and command changes to work with hal
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2022-12-05 16:34:48 -08:00
Nathaniel Mitchell 291632c0ee Apply flake8 code formatting rules against repo
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2022-07-28 09:17:10 -07:00
Fer-Bar 69b1f8a5c4 Fixed pylint issue R1703
Fixed the simplicity of the return deleting bool() in the hasattr function
2022-07-27 17:51:23 -07:00
Fer-Bar 2444a8fee8 Fixed pylint issue R1719 and E0602
Fix undefined variable and simplifiable-if-statement
2022-07-27 17:51:23 -07:00
Frinzell, Aaron 68b3ab8540 Update logger.error() in utilcmd files
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-06-30 11:29:31 -07:00
Frinzell, Aaron 4b53a058ea Update logging in spi_cmd.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-06-16 16:03:55 -07:00