345 Commits

Author SHA1 Message Date
Carles Pey 19e2553138 Add SMI enumeration mode to the smm_ptr module (#2141)
* Add SMI enumeration mode to the smm_ptr module

Signed-off-by: Carles Pey <carles.pey@nccgroup.com>
2024-05-29 10:19:42 -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
Nathaniel Mitchell ed9c6e2896 Update how ACPI Tables are found
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-04-17 15:27:21 -07:00
Nathaniel Mitchell 55582449c9 Fix logger references in pci hal
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-04-16 16:35:05 -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
Sae86 f7524c32f5 Return status in all write port functions
Signed-off-by: Sae86 <sara.batllori@intel.com>
2024-03-18 16:38:21 -07:00
Sae86 b1828240a6 Remove int conversion since bus is already an int
Add items to bus_data with extend

Signed-off-by: Sae86 <sara.batllori@intel.com>
2024-02-27 16:37:21 -08:00
Nathaniel Mitchell ae0bd2a053 Fix hal.cpu to not call set_affinity in single threaded env
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-02-12 16:36:17 -08:00
Nathaniel Mitchell 105a222c37 Fix issues with mmio list command
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-01-31 16:34:24 -08:00
Nathaniel Mitchell 838f87a0e7 Resolve mismatch type comp in uefi_search.py
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-01-25 11:45:29 -08: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
Plato Mavropoulos 2ad9cfb795 Fix bad efi_data_search calls at build_efi_file_tree 2023-12-18 11:11:06 -08:00
brentholtsclaw f530b70174 Changes per #1790
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-12-11 08:48:48 -08:00
brentholtsclaw 9d067a41cd Add function to search for data within EFI padding and large sections
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-12-11 08:48:48 -08:00
brentholtsclaw 854ecfe0fd Add ability to parse padding section and raw section
change on line 276 from @platomav

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-12-11 08:48:48 -08:00
brentholtsclaw f00ad55384 Add ability to parse non-UEFI section data
Attempt to address #1790.  Add ability to parse for modules when a large
section of unidentified data is found.

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-12-11 08:48:48 -08:00
Nathaniel Mitchell 674097ecdc Fix casting issue in tpm hal
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-16 16:37:54 -07:00
William Leara 87c71c5f4c fix flake8 whitespace errors on smbios.py
No semantic change.  Fix:  E125, E252, E303, E305
2023-10-09 16:36:35 -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 dc37d01b92 Fix uefi_search cpuid.upper call as cpuid is an int
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-09-20 16:36:03 -07:00
William Leara fafbbd7695 fix misspelling of "Parameter" 2023-09-18 16:37:50 -07:00
Nathaniel Mitchell cda2f448ac Fix the issue with the bus lists
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-09-15 10:07:44 -07:00
Dan Scott cdf0a374db Add PCIe extended capabilities functionality
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-08-30 10:23:24 -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 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
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 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
Frinzell, Aaron 31db8c3bab Consistent variable return types in uefi_platform.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-06-14 16:38:45 -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
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
Nicolas Iooss a8fb150415 Fix SPI write when data size is not a multiple of 4
In `SPI.write_spi`, When `len(buf) % 4 != 0`, a dword value to be
written is computed with `ord(buf[...])`. This does not work, as in
Python 3, `buf[...]` directly gives an integer.

Fix this issue by removing the call to `ord`.

Fixes: https://github.com/chipsec/chipsec/issues/1775
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-31 16:39:08 -07:00
Nicolas Iooss cebe2ff1e9 Import UnimplementedAPIError from chipsec.exceptions
`oshelper.UnimplementedAPIError` is actually imported from
`chipsec.exceptions`. Importing it directly fixes warnings reported by
Mypy such as:

    chipsec/hal/spi.py:201: error: Module has no attribute "UnimplementedAPIError"

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-31 16:38:51 -07:00
Frinzell, Aaron 5484e6e7e4 Fix search_efi_tree() return in spi_uefi.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-05-31 09:29:04 -07:00
Nicolas Iooss 53fd93f946 Fix spidesc table of Master Read/Write Access to Flash Regions
Currently, `chipsec_util.py spidesc spi_rom.bin` displays:

    Master Read/Write Access to Flash Regions
    --------------------------------------------------------
     Region                 | CPU      | ME
    --------------------------------------------------------
    f{r:-2d} {spi.SPI_REGION_NAMES[r]:20s} |          |

The `f` was not positioned correctly in the formatted string.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-30 16:38:18 -07:00
Nathaniel Mitchell 745ae9084e Clean up HALs and Helpers
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-26 18:33:08 -07:00
Plato Mavropoulos cb52a09c06 Removed old incomplete logic which attempts to parse Dell PFS proprietary format
3rd-party utilities exist (e.g. Dell PFS Update Extractor) to handle Dell PFS prior to Chipsec
2023-05-24 16:37:08 -07:00
Nathaniel Mitchell 89be1b4ad8 Remove native and add linuxnative as seperate helper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-17 16:36:30 -07:00
brentholtsclaw 9e2982cc7b Add LZMAF86
Found that F86 option adds a conversion routine prior to encode and post
decode.  Added the functionality to the EfiCompressor code within
chipsec_tools.

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2023-05-10 08:22:39 -07:00
Nathaniel Mitchell f458f8494a Add flag and check for efi_var_enhanced_auth_access
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-09 16:39:30 -07:00
Nathaniel Mitchell 46b226f4b9 Fix helpers to return correct value for swsmi util
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-09 16:37:19 -07:00
nstarke b41a2bfd61 Removing extraneous variable left over from when this function handled strings 2023-05-08 09:26:24 -07:00
nstarke f46c07f2df Bug fixes for SPI Write. Fixes #1775 2023-05-08 09:26:24 -07:00
nstarke 40754bd0c7 ading 2.80 system table revision to fix 'uefi tables' from not working on new platform 2023-05-08 09:04:57 -07:00
Nathaniel Mitchell 6f7f97753e Add workaround if lzma is not importable.
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-04-26 16:52:43 -07:00
Nathaniel Mitchell b74183824d Update uefi variable test to not require dbx
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-04-24 14:03:19 -07:00
Frinzell, Aaron 5b52003819 Fix try-except using finially instead of except in paging.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-03-22 16:38:15 -07:00
Frinzell, Aaron e72c0efae0 Type Hint and fstring updates to paging.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-03-22 16:38:15 -07:00
Frinzell, Aaron 6cc5747a4c Type Hint and fstring updates to spi_uefi.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-03-20 16:39:29 -07:00