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_INITIALIZE_AT_BOOT
80	bool "Initialize the host command subsystem automacitlly"
81	default y
82	help
83	  Automatically initialize the host command subsystem with the chosen backend.
84	  The ec_host_cmd_init function is called by the chosen backend.
85
86config EC_HOST_CMD_DEDICATED_THREAD
87	bool "Create a new task for host command"
88	help
89	  The ec_host_cmd_init function creates a new thread dedicated for Host Command.
90	  Otherwise the ec_host_cmd_task function has to be called within another thread.
91
92config EC_HOST_CMD_IN_PROGRESS_STATUS
93	bool "Save status of last IN_PROGRESS command"
94	default y if EC_HOST_CMD_BACKEND_SHI
95	help
96	  Enable support for saving final status of a last command that has sent
97	  EC_HOST_CMD_IN_PROGRESS status. The saved status can be get with the
98	  ec_host_cmd_send_in_progress_status function.
99
100source "subsys/mgmt/ec_host_cmd/Kconfig.logging"
101source "subsys/mgmt/ec_host_cmd/backends/Kconfig"
102
103endif # EC_HOST_CMD
104
105endmenu
106