Writing Your Own Modules¶
Your module class should subclass BaseModule and implement at least the methods named
run. When chipsec_main runs, it will first run
is_supported and if that returns true, then it will call
As of CHIPSEC version 1.2.0, CHIPSEC implements an abstract name for platform controls. Module authors are encouraged to create controls in the XML configuration files for important platform configuration information and then use
set_control within modules. This abstraction allows modules to test for the abstract control without knowing which register provides it. (This is especially important for test reuse across platform generations.)
Most modules read some platform configuration and then pass or fail based on the result. For example:
Define the control in the platform XML file (in
<control name="BiosLockEnable" register="BC" field="BLE" desc="BIOS Lock Enable"/>
Get the current status of the control:
ble = self.cs.get_control('BiosLockEnable')
React based on the status of the control:
if ble: self.logger.log_passed("BIOS Lock is set.") else: self.logger.log_failed("BIOS Lock is not set.")
Set and Return
if ble: self.res = ModuleResult.PASSED else: self.res = ModuleResult.FAILED return self.res
The CHIPSEC HAL and other APIs are also available within these modules. See the next sections for details about the available functionality.
Copy your module into the
chipsec/modules/ directory structure.
Modules specific to a certain platform should implement
is_supportedfunction which returns
Truefor the platforms the module is applicable to.
Modules specific to a certain platform can also be located in
chipsec/modules/<platform_code>directory, for example
chipsec/modules/hsw. Supported platforms and their code can be found by running
Modules common to all platform which CHIPSEC supports can be located in
If a new platform needs to be added:
Review the platform datasheet and include appropriate information in an XML configuration file for the platform. Place this file in chipsec/cfg/8086. Registers that are correctly defined in
common.xmlwill be inherited and do not need to be added. Use
common.xmlas an example. It is based on the 4th Generation Intel Core platform (Haswell).