# Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. rsource "app/Kconfig" rsource "drivers/Kconfig" rsource "emul/Kconfig" if ZTEST config HAS_TEST_TASKS bool "Whether or not this test includes custom tasks" help This enables custom tasks for tests. When set to 'y', the file "shimmed_test_tasks.h" will be included and is expected to set CROS_EC_TASK_LIST. endif # ZTEST menuconfig PLATFORM_EC bool "Chromium OS EC shim" imply PRINTK imply SHELL help The platform/ec Zephyr module allows some code from the existing Chromium OS EC project to be "shimmed" into Zephyr. With this it is possible to use the existing code base within Zephyr. Once we manage to get a platform fully running with Zephyr we will progressively upstream components and turn off the shim for each one until eventually all code is on the Zephyr side. if PLATFORM_EC rsource "shim/chip/npcx/Kconfig.npcx" rsource "Kconfig.adc" rsource "Kconfig.battery" rsource "Kconfig.board_version" rsource "Kconfig.console" rsource "Kconfig.console_cmd_mem" rsource "Kconfig.debug_assert" rsource "Kconfig.defaults" rsource "Kconfig.espi" rsource "Kconfig.flash" rsource "Kconfig.header" rsource "Kconfig.init_priority" rsource "Kconfig.keyboard" rsource "Kconfig.led" rsource "Kconfig.panic" rsource "Kconfig.port80" rsource "Kconfig.powerseq" rsource "Kconfig.pmic" rsource "Kconfig.mkbp_event" rsource "Kconfig.motionsense" rsource "Kconfig.rtc" rsource "Kconfig.stacks" rsource "Kconfig.system" rsource "Kconfig.tasks" rsource "Kconfig.temperature" rsource "Kconfig.timer" rsource "Kconfig.throttle_ap" rsource "Kconfig.usbc" rsource "Kconfig.watchdog" # Define PLATFORM_EC_... options to enable EC features. Each Kconfig should be # matched by a line in zephyr/shim/include/config_chip.h which #defines the # corresponding EC CONFIG if this Kconfig is enabled. # # Please keep these in alphabetical order config PLATFORM_EC_ACPI bool "Advanced Confiugration and Power Interface (ACPI)" default y if AP_X86 && PLATFORM_EC_ESPI help Enable the Advanced Configuration and Power Interface (ACPI) in the EC. ACPI is a standard interface to the Application Processor (AP) that abstracts the hardware specific details for controlling and managing the board. This includes interfaces for monitoring or controlling features, including: keyboard backlight fan speed temperature sensors charging properties device orientation (tablet or laptop mode) https://uefi.org/sites/default/files/resources/ACPI_Spec_6_4_Jan22.pdf config PLATFORM_EC_AP_RESET_LOG bool "Enable the Application Processor reset log" depends on PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO default y if PLATFORM_EC_POWERSEQ help Enable logging of AP reset events. This information is provided in response to the EC_CMD_GET_UPTIME_INFO host command. config PLATFORM_EC_BACKLIGHT_LID bool "Control the display backlight based on the lid switch" depends on PLATFORM_EC_HOSTCMD default y help Support controlling the display backlight based on the state of the lid switch. The EC will disable the backlight when the lid is closed. This option enables the EC_CMD_SWITCH_ENABLE_BKLIGHT host command, which allows the AP to override the backlight setting until the next change in the lid state. config PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON bool "Work around H1 reset issue" help Enable this if H1 resets the EC after power-on. This is needed so the EC can delay its start-up until the reset happens. Without this option the EC starts up, performs some amount of processing and then gets a reset that it is not expecting. config PLATFORM_EC_BOARD_VERSION bool "Support the notion of board version" default y help Enable support for a board version, used to distinguish different revisions of the same base design. Each board goes through a number of development phases on the way to launch. Sometimes different boards have different quirks and this version number can provide a way for the EC to handle several board versions, avoiding the problem of having to flash different images to different board versions. config PLATFORM_EC_BRINGUP bool "Enable early bringup debugging features" help Enable the CONFIG_BRINGUP platform/ec configuration option, turning on a variety of miscellaneous early bringup debugging features. These features include: - The device will not power on when the EC starts. The power button will need to be pressed, or the "powerbtn" command issued. - Enable power signal logging, showing relative timestamps for each power signal change. - And more! You can search the codebase for CONFIG_BRINGUP to see all of the features this flag will toggle. config PLATFORM_EC_BYPASS_CBI_EEPROM_WP_CHECK bool "Bypass CBI EEPROM Write Protect" help Bypass the CBI EEPROM write protect checks. This should ONLY be defined during bringup, and should never be defined on a shipping or release platform. When defined, ectool can be used to reprogram all CBI fields, regardless of the state of the hardware write protect. config PLATFORM_EC_CBI bool "CBI EEPROM support" depends on PLATFORM_EC_I2C help Enables various Chromium OS Board Info (CBI) accessors as well as host and console commands. CBI is a means for accessing information about a board, typically written during the factory process. One must specify both I2C_PORT_EEPROM and I2C_ADDR_EEPROM_FLAGS to the CBI EEPROM's i2c port and 7-bit i2c address. See here for information on CBI: https://chromium.googlesource.com/chromiumos/docs/+/master/design_docs/cros_board_info.md config PLATFORM_EC_CHIPSET_RESET_HOOK bool "Provide a hook for when the AP resets" default y help Enables support for the HOOK_CHIPSET_RESET hook. This can be used by code that needs to run before a programmatic reset actually happens. Note that these hooks don't run with a cold reset, only when the AP decides to reset itself. You can declare a hook like this: DECLARE_HOOK(HOOK_CHIPSET_RESET, do_something, HOOK_PRIO_DEFAULT); Then do_something() will be called just before the reset happens. config PLATFORM_EC_CONSOLE_CMD_HCDEBUG bool "Console command: hcdebug" default y depends on PLATFORM_EC_HOSTCMD help Enable the 'hcdebug' console command. This comamnd is used to change, at runtime, the amount of debug generated by the host command processing. hcdebug [off | normal | every | params] off - No host command debug messages are shown. normal - Display host commands receieved from the AP. Repeated commands are shown with a "+" and "++" symbol. every - Display all host commands received from the AP, including repeated commands. params - Display all host commands and the parameters received from the AP. config PLATFORM_EC_CONSOLE_CMD_MEM bool "Console command: md, rw" default y help Enable memory related console commands. md - dump memory values rw - read or write in memory config PLATFORM_EC_CONSOLE_CMD_SLEEPMASK bool "Console command: sleepmask read" default y if PM help Enable the 'sleepmask' console command. This command is used to display the state of the sleep mask, which controls whether the EC chip is allowed to enter deep sleep states to save power. config PLATFORM_EC_CONSOLE_CMD_SLEEPMASK_SET bool "Console command: sleepmask set" depends on PLATFORM_EC_CONSOLE_CMD_SLEEPMASK default y help Enable changing the state of the current sleep mask. sleepmask on - Sets the SLEEP_MASK_FORCE_NO_DSLEEP bit in the sleep mask, preventing the system from entering sleep. sleepmask off - Clears the SLEEP_MASK_FORCE_NO_DSLEEP bit in the sleep mask. The system may enter deep sleep depending on the state of other mask bits. sleepmask - Sets the sleepmask to , overriding all bits with the specified value. config PLATFORM_EC_CONSOLE_CMD_S5_TIMEOUT bool "Console command: s5_timeout" default n help This command allows the user to specify a time to remain in S5 before dropping to G3, in order to help power testing. config PLATFORM_EC_CONSOLE_CMD_SHMEM bool "Console command: shmem" default y help This command prints basic information about the EC shared memory, located at the top of RAM, above all RAM symbols: total size, bytes used and the maximum number of bytes that have been used since the EC started running. config PLATFORM_EC_DEBUG_ASSERT bool "Enable assertion failures" default y help Assertion failures are used to flag conditions which should not occur and thus indicate the software is unable to continue execution. This option can be disabled so that the assert() macro becomes a NOP. In this case, execution will continue but the results are unpredictable. Messages are of the form: ASSERTION FAILURE '' in function() at file:line Note: There is also ASSERT() which is an alias of assert(), used in host code where cstdlib is used. menuconfig PLATFORM_EC_ESPI bool "eSPI" depends on ESPI && AP default y help Enable the Enhanced Serial Peripheral Interface (eSPI) shim layer. eSPI supports a shared physical connection between several on-board devices, similar to SPI. It adds a few optional signals and a protocol layer to provide independent 'channels' for each device to communicate over. eSPI is the replacement for LPC (Low-Pin-Count bus). See here for information about eSPI: https://www.intel.com/content/dam/support/us/en/documents/software/chipset-software/327432-004_espi_base_specification_rev1.0_cb.pdf config PLATFORM_EC_EXTPOWER_GPIO bool "GPIO-based external power detection" depends on PLATFORM_EC_HOOKS && PLATFORM_EC_HOSTCMD help Enable shimming the extpower_gpio module, which provides GPIO-based external power presence detection features. The project should define a GPIO pin named GPIO_AC_PRESENT, with extpower_interrupt configured as the handler in gpio_map.h. config PLATFORM_EC_FLASH_CROS bool "Enable flash support" default y if FLASH_SIZE > 0 help Enables access to the device's flash through a simple API. With this is it possible for the EC to update its flash while running, e.g. to support auto-update. Various write-protection features are also provided. config PLATFORM_EC_FPU bool "Support floating point" depends on FPU && CPU_CORTEX_M && !NEWLIB_LIBC default y help This enables support for floating point. This is generally already provided in Zephyr, but the EC side expects a few functions to be available which are not available with Zephyr's minimal lib: sqrtf() and fabsf(). Enabling this options defines them. For now this is only supported on Cortex-M4. config PLATFORM_EC_HOOKS bool "Hooks and deferred compatibility shim" default y help Enable translation of DECLARE_DEFERRED() and hook_call_deferred() to Zephyr's work queues, along with a compatible DECLARE_HOOK implementation. This option is needed by many features in the EC. Disabling it will likely cause build errors. menuconfig PLATFORM_EC_HOSTCMD bool "Host commands" default n if ARCH_POSIX default y if AP select HAS_TASK_HOSTCMD help Enable the host commands shim in platform/ec. This handles communication with the AP. The AP sends a command to the EC and it responds when able. An interrupt can be used to indicate to the AP that the EC has something for it. config PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO bool "Host command: EC_CMD_GET_UPTIME_INFO" default PLATFORM_EC_HOSTCMD help Enable the EC_CMD_GET_UPTIME_INFO host command which reports the time the EC has been powered up, the number of AP resets, an optional log of AP-reset events and some flags. config PLATFORM_EC_I2C bool "I2C shim" default n if ARCH_POSIX default y imply I2C help Enable compilation of the EC i2c module. Once enabled, it will be possible to make calls using the old platform/ec i2c APIs defined in include/i2c.h and implemented in common/i2c_master.c. Doing so should make shimming other platform/ec modules which rely on i2c communication "just work" without requiring any further code changes. config PLATFORM_EC_LID_SWITCH bool "Lid switch" help Enable shimming the lid switch implementation and related commands in platform/ec. The lid switch can affect power-on behaviour. For example, when the lid is opened, the device may automatically power on. This requires a GPIO named GPIO_LID_OPEN to be defined in gpio_map.h. config PLATFORM_EC_MKBP_INPUT_DEVICES bool "Input devices via MKBP" help Enable passing events from various input sources to AP via MKBP. This include buttons (power, volume); switches (lid, tablet mode) and sysrq. config PLATFORM_EC_LOW_POWER_IDLE bool default y if PM help Enable low power idle modes in the EC chipset. This is automatically enabled when the Zephyr power management options are enabled with the PM option. config PLATFORM_EC_MKBP_EVENT bool "MKBP event" help Enable this to support MKBP event. MKBP event is used not only for matrix keyboard but also for other many events like button, switch, fingerprint, and etc. This requires a MKBP event delivery method(GPIO, HOST_EVENT, and etc) config PLATFORM_EC_MPU bool "Support Memory-Protection Unit (MPU)" depends on CPU_CORTEX_M && CPU_HAS_MPU default y help This enables support a Memory-Protection Unit which can limit access to certain areas of memory. This can be used to protect code or data from being written to improve security or to find bugs. It causes any code in the iram.text section to be protected when system jump is disabled (see system_disable_jump()). It also stops execution of the image that is not currently being executed (read-only or read-write). If internal storage is used, this is achieved by not allowing code execution in that area. For external storage, it disallows loading any code into RAM. config PLATFORM_EC_PANIC bool "Panic output" default y help Enable support for collecting and reporting panic information, caused by exceptions in the EC. This can be the result of a watchdog firing, a division by zero, unaligned access, stack overflow or assertion failure. The panic information is made available to the AP via the EC_CMD_GET_PANIC_INFO host command and a 'panicinfo' console command config PLATFORM_EC_PORT80 bool "Port 80 support" default y if AP_X86 && PLATFORM_EC_POWERSEQ help Enable the port80 module, a way to report progress of the AP's boot sequence, assuming that the EC can detect these writes on the I/O bus. The EC buffers calls to port_80_write() and occasionally prints a message when there are new writes. See here for more information: https://en.wikipedia.org/wiki/Power-on_self-test#Progress_and_error_reporting config PLATFORM_EC_POWER_BUTTON bool "Power-button support" depends on PLATFORM_EC_HOSTCMD help Enable shimming the power button implementation and related commands in platform/ec. This is used to implement the Chromium OS shutdown sequence. This requires a GPIO named GPIO_POWER_BUTTON_L in gpio_map.h. config PLATFORM_EC_PWM bool "PWM (Pulse Width Modulation) module" help Enable the PWM (Pulse Width Modulation) module. This module is used to support variable brightness LEDs, backlight controls, and variable-speed fans. config PLATFORM_EC_PWM_DISPLIGHT bool "PWM display backlight" depends on PLATFORM_EC_PWM help Enables display backlight controlled by a PWM signal connected directly to the EC chipset. The board files must define the C reference PWM_CH_DISPLIGHT to the PWM channel used for the display backlight control. config PLATFORM_EC_RTC bool "Real-time clock (RTC)" help Enable support for a real-time clock. Typically this is available on-chip in the EC. It provides a way to track the passage of time in terms of second and minutes. Once set, and provided that it has a suitable power source, it should be able to keep reasonably accurate time over a period of days and weeks. The starting EC clock is typically set by the AP, since it has access to the outside world and can often obtain the current time when desired. choice "SHA256 method" prompt "Select method to use for computing SHA256 hashes" help The verified boot mechanism requests the hash of the entire read-write portion of the EC image. This is typically done using a hashing block in the EC, so that it is as fast as possible. A fallback software algorithm is available if needed. config PLATFORM_EC_SHA256_SW bool "Compute SHA256 in software" help Enable this if your EC chip does not support hardware-accelerated SHA256 computation. This enables the software algorithm which is quite slow but will work in a pinch. config PLATFORM_EC_SHA256_HW_ACCELERATE bool "Compute SHA256 in hardware" help Enable this if your EC chip supports hardware-accelerated SHA256 computation. This is faster than running the algorithm in software, so is desirable. The chip support must implement the functions in sha256.h endchoice # SHA256 method config PLATFORM_EC_SWITCH bool "Memory mapped switches" depends on PLATFORM_EC_HOSTCMD default y help Enable the reporting of the platform switches state to the AP using memory mapped storage provided by the host command interface. The platform switches include: LID open power button pressed write protect disabled recovery switch This also enables the "mmapinfo" console command to report the current state of all switches. config PLATFORM_EC_SWITCHCAP_LN9310 bool "LN9310 switchcap driver" depends on PLATFORM_EC_I2C help Enable support for the LION Semiconductor LN9310 switched capacitor converter. This will export definitions for ln9310_init, ln9310_interrupt, and ln9310_power_good, which project-specific code should call appropriately. config PLATFORM_EC_SYSTEM_UNLOCKED bool "System unlocked: allow dangerous commands while in development" default y if PLATFORM_EC_BRINGUP help System should remain unlocked even if write protect is enabled. NOTE: This should ONLY be defined during bringup, and should never be defined on a shipping / released platform. When defined, CBI allows ectool to reprogram all the fields. Normally, it refuses to change certain fields. (e.g. board version, OEM ID) Also, this enables PD in RO for TCPMv2. config PLATFORM_EC_THROTTLE_AP bool "CPU throttling" default y if PLATFORM_EC_POWERSEQ help Enable throttling the CPU based on the temperature sensors. When they detect that the CPU is getting too hot, the CPU is throttled to a lower speed. This reduce the CPU's power output and eventually results in a lower temperature. menuconfig PLATFORM_EC_TIMER bool "Timer module" default y help Enable compilation of the EC timer module. This provides support for delays, getting the current time and setting alarms. This option is needed by many features in the EC. Disabling it will likely cause build errors. config PLATFORM_EC_VBOOT bool "Enable Chromium OS verified boot" default y if !SOC_POSIX help Enables Early Firmware Selection v2 (EFS2) verified boot. When booting a Chromium OS image we're actually packing both an RO image and an RW image into flash. The RO image is loaded first. EFS2 runs at boot and verifies the integrity of the RW image by sending a hash of the image to the Google Security Chip (GSC). Once the GSC verifies the hash, EFS2 calls sysjump and reboot the EC using the RW image. config PLATFORM_EC_VBOOT_HASH bool "Host command: EC_CMD_VBOOT_HASH" depends on PLATFORM_EC_HOSTCMD default y help Allows the AP to request hashing functions from the EC. Verified boot can update the EC's read/write code when it detects that it is an incorrect version. It detects this by asking the EC to hash itself. If the hash is incorrect, new code is write to the EC's read/write area. config PLATFORM_EC_VSTORE bool "Secure temporary storage for verified boot" default y help Enable support for storing a block of data received from the AP so it can be read back later by the AP. This is helpful since the AP may reboot or resume and want the data early in its start-up before it has access to SDRAM. There are a fixed number of slots and each can hold a fixed amount of data (EC_VSTORE_SLOT_SIZE bytes). Once a slot is written it is locked and cannot be written again unless explicitly unlocked. Stored data is preserved when the EC moved from RO to RW. config PLATFORM_EC_VSTORE_SLOT_COUNT int "Number of slots" depends on PLATFORM_EC_VSTORE default 1 help Set the number of slots available in the verified-boot store. The number required depends on the AP firmware. Typically the vstore is used only for recording a hash of the read-write AP firmware for checking on resume. For this, one slot is enough. menuconfig PLATFORM_EC_WATCHDOG bool "Watchdog" depends on WATCHDOG default y help Enable the watchdog functionality. The watchdog timer will reboot the system if the hook task (which is the lowest-priority task on the system) gets starved for CPU time and isn't able to fire its HOOK_TICK event. Chromium EC system uses an auxiliary timer to handle the system warning event. This leaves some time to the system for preparing & printing the debug information. The interval between reloads of the watchdog timer should be less than half of the auxiliary timer (PLATFORM_EC_WATCHDOG_PERIOD_MS - PLATFORM_EC_WATCHDOG_WARNING_LEADING_TIME_MS). endif # PLATFORM_EC