1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# 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.
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 "Enable building code from the platform/ec Zephyr module"
imply PRINTK
imply SHELL
help
The platform/ec Zephyr module allows some code from the
existing Chrome OS EC project to be "shimmed" into Zephyr.
if PLATFORM_EC
rsource "Kconfig.battery"
rsource "Kconfig.powerseq"
rsource "Kconfig.tasks"
rsource "Kconfig.usbc"
# Below is a hack to use CONFIG_ZEPHYR in platform/ec code before
# config.h has been included. There is some tricky ordering in some
# header files that we cannot use config.h (e.g., common.h and
# compile_time_macros.h), as many board.h and config_chip.h files
# use these macros, and thus would be included by an include of
# config.h. We work around this by initially defining CONFIG_ZEPHYR
# in Kconfig as an invisible symbol (it should always be enabled).
# Then, once config.h gets included, it subsequently gets undef'ed by
# config.h, and then redefined by config_chip.h in the Zephyr shim.
config ZEPHYR
bool
default y
help
This should always be enabled. It's a workaround for
config.h not being available in some headers.
# 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_CBI
bool "Enable the CBI EEPROM module"
depends on PLATFORM_EC_I2C
help
Enables various CBI accessors and host and console commands. One must
specify both I2C_PORT_EEPROM and I2C_ADDR_EEPROM_FLAGS to the CBI
EEPROM's i2c port and 7-bit i2c address.
menuconfig PLATFORM_EC_ESPI
bool "Enable eSPI compatibility in platform/ec"
depends on ESPI && AP
default y
help
Enable eSPI shim layer.
if PLATFORM_EC_ESPI
config PLATFORM_EC_ESPI_VW_SLP_S3
bool "SLP_S3 is an eSPI virtual wire instead of a GPIO"
help
For power sequencing, use an eSPI virtual wire instead of
defining GPIO_PCH_SLP_S3 in gpio_map.h.
config PLATFORM_EC_ESPI_VW_SLP_S4
bool "SLP_S4 is an eSPI virtual wire instead of a GPIO"
help
For power sequencing, use an eSPI virtual wire instead of
defining GPIO_PCH_SLP_S4 in gpio_map.h.
endif # PLATFORM_EC_ESPI
config PLATFORM_EC_EXTPOWER_GPIO
bool "Enable the GPIO-based external power detection module"
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.
menuconfig PLATFORM_EC_KEYBOARD
bool "Enable keyboard support"
default y
help
Enable compilation of support for scanning a keyboard and providing
the resulting input to the AP over the host interface. This consists
of a keyboard-scanning task which provides key scans via it calling
keyboard_state_changed() (for i8042) or its client calling
keyboard_scan_get_state() (for MKBP). This implies HAS_TASK_KEYSCAN.
if PLATFORM_EC_KEYBOARD
config TASK_KEYSCAN_STACK_SIZE
hex "keyscan task stack size"
default 0x200
help
The size of the keyboard scan task stack.
choice "Protocol select"
prompt "Select the keyboard protocol to use"
config PLATFORM_EC_KEYBOARD_PROTOCOL_8042
bool "i8042"
help
Use the i8042 protocol to communicate with the AP. This dates from the
Intel 8042 keyboard controller chip released in 1976. It uses two-way
communication via a few 8-bit registers, allowing key codes to be
sent to the AP when keys are pressed and released.
See here for docs: https://wiki.osdev.org/%228042%22_PS/2_Controller
endchoice # PLATFORM_EC_KEYBOARD
config PLATFORM_EC_KEYBOARD_COL2_INVERTED
bool "A mechanism for passing KSO2 to H1 which inverts the signal."
help
This option enables a mechanism for passing the column 2
to H1 which inverts the signal. The signal passing through H1
adds more delay. Need a larger delay value. Otherwise, pressing
Refresh key will also trigger T key, which is in the next scanning
column line. See http://b/156007029.
config PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042
bool "Enable the keyboard commands"
default y if PLATFORM_EC_KEYBOARD_PROTOCOL_8042
help
Enable the '8042' command, which includes the following subcommands:
codeset - Get/set keyboard codeset
ctrlram - Get/set keyboard controller RAM
internal - Show internal information
kbd - Print or toggle keyboard info
kblog - Print or toggle keyboard event log (current disabled)
typematic - Get/set typematic delays
endif # PLATFORM_EC_KEYBOARD
config PLATFORM_EC_HOOKS
bool "Enable hooks and deferred compatibility shim"
default y
help
Enable translation of DECLARE_DEFERRED and
hook_call_deferred to Zephyr's work queues, and a compatible
DECLARE_HOOK implementation.
config PLATFORM_EC_I2C
bool "Enable the EC i2c module"
default y
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.
menuconfig PLATFORM_EC_HOSTCMD
bool "Enable host commands shim"
default y if AP
help
Enable the host commands shim in platform/ec.
if PLATFORM_EC_HOSTCMD
config TASK_HOSTCMD_STACK_SIZE
hex "hostcmd task stack size"
default 0x200
help
The size of the host command task stack.
endif # PLATFORM_EC_HOSTCMD
config PLATFORM_EC_LID_SWITCH
bool "Enable the lid switch module"
help
Enable shimming the lid switch implementation and related
commands in platform/ec. This requires a GPIO named
GPIO_LID_OPEN to be defined in gpio_map.h.
config PLATFORM_EC_PORT80
bool "Enable the port80 module"
default y if AP_X86 && PLATFORM_EC_POWERSEQ
help
Enable the port80 module, which will buffer calls to port_80_write and
occasionally print when there's new writes.
config PLATFORM_EC_POWER_BUTTON
bool "Enable the power button module"
depends on PLATFORM_EC_HOSTCMD
help
Enable shimming the power button implementation and related
commands in platform/ec. This requires a GPIO named
GPIO_POWER_BUTTON_L in gpio_map.h.
config PLATFORM_EC_CONSOLE_CMD_SHMEM
bool "Enable the 'shmem' command"
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.
menuconfig PLATFORM_EC_TIMER
bool "Enable the EC timer module"
default y
help
Enable compilation of the EC timer module
if PLATFORM_EC_TIMER
config PLATFORM_EC_TIMER_CMD_GETTIME
bool "Enable the gettime command"
default y
help
Enable the "gettime" command
config PLATFORM_EC_TIMER_CMD_TIMERINFO
bool "Enable the timerinfo command"
default y
help
Enable the "timerinfo" command
config PLATFORM_EC_TIMER_CMD_WAITMS
bool "Enable the waitms command"
default y
help
Enable the "waitms" command
endif # PLATFORM_EC_TIMER
endif # PLATFORM_EC
|