1# Host command handler functionality
2
3# Copyright (c) 2020 Google LLC
4# SPDX-License-Identifier: Apache-2.0
5
6menu "Host command handler subsystem"
7
8config EC_HOST_CMD
9	bool "Support Embedded Controller host command handler subsystem"
10	help
11	  Enable host command processing for embedded controllers on notebook
12	  computers.
13
14if EC_HOST_CMD
15
16module = EC_HC
17module-str = ec-host-commands
18source "subsys/logging/Kconfig.template.log_config"
19
20config EC_HOST_CMD_HANDLER_STACK_SIZE
21	int "Stack size for the EC host command handler thread"
22	default 800
23
24config EC_HOST_CMD_HANDLER_TX_BUFFER_SIZE
25	int "Buffer size in bytes for TX buffer shared by all EC host commands"
26	default 0 if EC_HOST_CMD_BACKEND_ESPI
27	default 0 if EC_HOST_CMD_BACKEND_SHI
28	default 256 if EC_HOST_CMD_BACKEND_UART
29	default 552 if EC_HOST_CMD_BACKEND_SPI
30	default 256
31	help
32	  Buffer size in bytes for TX buffer defined by the host command handler.
33	  Some backend layers can define their own buffer, so the size can be zero to
34	  avoid duplicating buffers. If multiple backends are used, the size has to be
35	  set by user to the largest one.
36
37config EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE
38	int "Buffer size in bytes for RX buffer shared by all EC host commands"
39	default 256 if EC_HOST_CMD_BACKEND_ESPI
40	default 0 if EC_HOST_CMD_BACKEND_SHI
41	default 544 if EC_HOST_CMD_BACKEND_UART
42	default 544 if EC_HOST_CMD_BACKEND_SPI
43	default 256
44	help
45	  Buffer size in bytes for TX buffer defined by the host command handler.
46	  Some backend layers can define their own buffer, so the size can be zero to
47	  avoid duplicating buffers. If multiple backends are used, the size has to be
48	  set by user to the largest one.
49
50config EC_HOST_CMD_HANDLER_PRIO
51	int "Priority of host command task"
52	default 13
53	help
54	  Priority of the kernel task that handles the host commands.
55	  If the priority is too low (high in value), the host commands handler may be unable to
56	  process the command on time and the AP will abort the waiting for response and be unable
57	  to boot the system properly.
58
59config EC_HOST_CMD_INIT_PRIORITY
60	int "Initialization priority"
61	default 80
62	range 0 99
63	help
64	  Initialization priority for Host Command. It must be higher than the initialization
65	  priority of the used backend device.
66
67config EC_HOST_CMD_HANDLER_TX_BUFFER_DEF
68	bool
69	default y if EC_HOST_CMD_HANDLER_TX_BUFFER_SIZE > 0
70	help
71	  The handler defines common tx buffer
72
73config EC_HOST_CMD_HANDLER_RX_BUFFER_DEF
74	bool
75	default y if EC_HOST_CMD_HANDLER_RX_BUFFER_SIZE > 0
76	help
77	  The handler defines common rx buffer
78
79config EC_HOST_CMD_NOCACHE_BUFFERS
80	bool "Place RX and TX buffers in __nocache section"
81	default y if DCACHE && DMA
82	depends on EC_HOST_CMD_HANDLER_TX_BUFFER_DEF || EC_HOST_CMD_HANDLER_RX_BUFFER_DEF
83	help
84	  DMA is often use for communication, however it usually requires
85	  uncached memory. Add possibility to place the RX and TX buffers in the
86	  __nocache section.
87
88config EC_HOST_CMD_INITIALIZE_AT_BOOT
89	bool "Initialize the host command subsystem automacitlly"
90	default y
91	help
92	  Automatically initialize the host command subsystem with the chosen backend.
93	  The ec_host_cmd_init function is called by the chosen backend.
94
95config EC_HOST_CMD_DEDICATED_THREAD
96	bool "Create a new task for host command"
97	help
98	  The ec_host_cmd_init function creates a new thread dedicated for Host Command.
99	  Otherwise the ec_host_cmd_task function has to be called within another thread.
100
101config EC_HOST_CMD_IN_PROGRESS_STATUS
102	bool "Save status of last IN_PROGRESS command"
103	default y if EC_HOST_CMD_BACKEND_SHI
104	help
105	  Enable support for saving final status of a last command that has sent
106	  EC_HOST_CMD_IN_PROGRESS status. The saved status can be get with the
107	  ec_host_cmd_send_in_progress_status function.
108
109source "subsys/mgmt/ec_host_cmd/Kconfig.logging"
110source "subsys/mgmt/ec_host_cmd/backends/Kconfig"
111
112endif # EC_HOST_CMD
113
114endmenu
115