Skip to content

Commit 3dfc3c2

Browse files
BrentHoltsclawnpmitche
authored andcommitted
Minor bug fixes
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
1 parent 914219e commit 3dfc3c2

File tree

4 files changed

+369
-93
lines changed

4 files changed

+369
-93
lines changed

chipsec/hal/common/mmio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ def get_MMIO_BAR_base_address(self, bar_name: str, instance: Optional['PCIObj']
252252
mmioaddr <<= bar.mmio_align
253253
base += mmioaddr
254254

255-
if bar.limit_register and bar.limit_field and bar.limit_align:
255+
if bar.limit_register and bar.limit_field and bar.limit_align and instance is not None:
256256
limit_field = bar.limit_field
257257
limit_bar = bar.limit_register
258-
lim_reg = self.cs.Cfg.get_register_obj(limit_bar, instance)
258+
lim_reg = self.cs.register.get_instance_by_name(limit_bar, instance)
259259
limit = lim_reg.read_field(limit_field)
260260
if bar.limit_align:
261261
limit_align = bar.limit_align
@@ -276,7 +276,7 @@ def get_MMIO_BAR_base_address(self, bar_name: str, instance: Optional['PCIObj']
276276
if size == 0:
277277
size = DEFAULT_MMIO_BAR_SIZE
278278
self.logger.log_hal('[mmio] {}: 0x{:016X} (size = 0x{:X})'.format(bar_name, base, size))
279-
if base == 0:
279+
if base == 0 and bar.fixed_address is None:
280280
self.logger.log_hal('[mmio] Base address was determined to be 0.')
281281
raise CSReadError('[mmio] Base address was determined to be 0')
282282

@@ -387,7 +387,7 @@ def is_MMIO_BAR_valid(self, bar_name, instance=None):
387387
if bar.register:
388388
if bar.valid:
389389
bar_en_field = bar.valid
390-
bar_reg = self.cs.Cfg.register.get_list_by_name(bar.register).filter_by_instance(instance)
390+
bar_reg = self.cs.register.get_list_by_name(bar.register).filter_by_instance(instance)
391391
is_valid = bar_reg.is_all_field_value(1, bar_en_field)
392392
return is_valid
393393

chipsec/hal/intel/spi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def set_instance(self, instance: 'PCIObj') -> None:
169169
def get_SPI_MMIO_base(self) -> int:
170170
spi_base = 0
171171
if self.mmio.is_MMIO_BAR_defined('8086.SPI.SPIBAR'):
172-
(spi_base, _) = self.mmio.get_MMIO_BAR_base_address('8086.SPI.SPIBAR')
172+
(spi_base, _) = self.mmio.get_MMIO_BAR_base_address('8086.SPI.SPIBAR', self.instance)
173173
else:
174174
self.logger.log_hal('[spi] get_SPI_MMIO_base(): SPIBAR not defined. Returning spi_base = 0.')
175175
self.logger.log_hal(f'[spi] SPI MMIO base: 0x{spi_base:016X} (assuming below 4GB)')
@@ -717,6 +717,7 @@ def get_SPI_SFDP(self) -> bool:
717717
#
718718

719719
def get_SPI_JEDEC_ID(self) -> int:
720+
720721
if self.hsfs.has_field('FCYCLE'):
721722
self.check_hardware_sequencing()
722723

chipsec/library/acpi_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ def parseGHESS(self, table_content: bytes, _type: int) -> int:
17381738
title = 'Generic Hardware Error Source Version 2'
17391739
readAckReg_str = self.parseAddress(table_content[64:76])
17401740
readAckPresv = struct.unpack('<Q', table_content[76:84])[0]
1741-
readAckWr = struct.unpack('<Q', table_content[84:88])[0]
1741+
readAckWr = struct.unpack('<Q', table_content[84:92])[0]
17421742
extra_str = f'''
17431743
Read Ack Register - {readAckReg_str}
17441744
Read Ack Preserve : 0x{readAckPresv:016X}

0 commit comments

Comments
 (0)