diff --git a/chipsec/cfg/parsers/core_parsers.py b/chipsec/cfg/parsers/core_parsers.py index a4ce8354..7f81ee11 100644 --- a/chipsec/cfg/parsers/core_parsers.py +++ b/chipsec/cfg/parsers/core_parsers.py @@ -135,20 +135,21 @@ class CoreConfig(BaseConfigParser): if 'did' in dev_attr: for did in dev_attr['did']: did_str = self.cfg._make_hex_key_str(did) - if did_str in self.cfg.CONFIG_PCI_RAW[vid_str]: + if vid_str in self.cfg.CONFIG_PCI_RAW and did_str in self.cfg.CONFIG_PCI_RAW[vid_str]: pci_data = self.cfg.CONFIG_PCI_RAW[vid_str][did_str] self._add_dev(vid_str, dev_name, pci_data, dev_attr) device_added = True break else: - for did_str in self.cfg.CONFIG_PCI_RAW[vid_str]: - pci_data = self.cfg.CONFIG_PCI_RAW[vid_str][did_str] - - if dev_attr['bus'] in pci_data['bus'] and dev_attr['dev'] == pci_data['dev'] and \ - dev_attr['fun'] == pci_data['fun']: - self._add_dev(vid_str, dev_name, pci_data, dev_attr) - device_added = True - break + if vid_str in self.cfg.CONFIG_PCI_RAW: + for did_str in self.cfg.CONFIG_PCI_RAW[vid_str]: + pci_data = self.cfg.CONFIG_PCI_RAW[vid_str][did_str] + + if dev_attr['bus'] in pci_data['bus'] and dev_attr['dev'] == pci_data['dev'] and \ + dev_attr['fun'] == pci_data['fun']: + self._add_dev(vid_str, dev_name, pci_data, dev_attr) + device_added = True + break if not device_added: self._add_dev(vid_str, dev_name, None, dev_attr) diff --git a/chipsec/chipset.py b/chipsec/chipset.py index 38c5f370..19b47f61 100644 --- a/chipsec/chipset.py +++ b/chipsec/chipset.py @@ -120,7 +120,7 @@ class Chipset: # platform detection # get cpuid only if driver using driver (otherwise it will cause problems) - self.cpuid = None + self.cpuid = 0 if start_helper: self.load_helper(helper_name) self.start_helper() @@ -133,7 +133,7 @@ class Chipset: if not ignore_platform: self.Cfg.platform_detection(platform_code, req_pch_code, self.cpuid) _unknown_proc = not bool(self.Cfg.get_chipset_code()) - if self.Cfg.is_pch_req() == False or self.Cfg.get_pch_code() != CHIPSET_CODE_UNKNOWN: + if self.Cfg.is_pch_req() is False or self.Cfg.get_pch_code() != CHIPSET_CODE_UNKNOWN: _unknown_pch = False if _unknown_proc: msg = f'Unknown Platform: VID = 0x{self.Cfg.vid:04X}, DID = 0x{self.Cfg.did:04X}, RID = 0x{self.Cfg.rid:02X}, CPUID = 0x{self.cpuid:X}' diff --git a/chipsec/config.py b/chipsec/config.py index 1e6e9ed4..43e392ac 100644 --- a/chipsec/config.py +++ b/chipsec/config.py @@ -222,7 +222,7 @@ class Cfg: else: for did in sku['did']: did_str = self._make_hex_key_str(did) - if did_str in self.CONFIG_PCI_RAW[vid_str]: + if vid_str in self.CONFIG_PCI_RAW and did_str in self.CONFIG_PCI_RAW[vid_str]: return did return 0xFFFF