summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig
blob: 5c0ef4fcd2ba7c641ad02400abdb20d548a71ac6 (plain)
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# 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"

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 "Kconfig.battery"
rsource "Kconfig.led"
rsource "Kconfig.powerseq"
rsource "Kconfig.motionsense"
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_BOOT_RAM_SIZE
	hex "The total size required for the boot loader"
	default 0x0
	help
	  This is the size (in bytes) required by the boot loader. It will count
	  against the data section of the RAM. Not all chips require this value.
	  See the datasheet for the npcx chip family for example. If not needed,
	  this can simple be left at 0x0.

config PLATFORM_EC_ACPI
	bool "Enable the ACPI module"
	default y if AP_X86 && PLATFORM_EC_ESPI
	help
	  Enable shimming the ACPI handler, which will handle the Host data from
	  the ACPI I/O port for X86 AP.

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_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_BOARD_RESET_AFTER_POWER_ON
	bool "Work around H1 reset issue"
	default y
	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_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_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.

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

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 "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.

# TODO(b/176828988): enable by default once the code can compile
config PLATFORM_EC_FLASH
	bool "Enable flash support"
	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.

if PLATFORM_EC_FLASH

config PLATFORM_EC_CONSOLE_CMD_FLASH
	bool "Console commands: flasherase, flashread, flashwp, flashwrite"
	default y
	help
	  Enables various console commands:

	     flasherase - erase flash region
	     flashread - read from flash to memory
	     flashwp - change write-protection settings
	     flashwrite - write memory to flash

config PLATFORM_EC_EXTERNAL_STORAGE
	bool "Flash is stored external to the EC"
	default y if SOC_FAMILY_NPCX
	help
	  This indicates that the EC's flash is stored separately and is it
	  not possible execute directly from it. Code must be loaded from
	  the flash into internal SRAM before it can be executed. It is still
	  possible to read and write the flash.

config PLATFORM_EC_MAPPED_STORAGE
	bool "Flash is mapped into the EC's address space"
	default y if SOC_FAMILY_NPCX
	help
	  This indicates that the EC's flash is directly mapped into
	  its address space. This makes it easier to read and write the flash.
	  If this is not defined, the flash driver must implement
	  flash_physical_read().

endif # PLATFORM_EC_FLASH

menuconfig PLATFORM_EC_KEYBOARD
	bool "Keyboard support"
	select HAS_TASK_KEYSCAN
	default n if ARCH_POSIX
	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).

	  Enabling this automatically enables HAS_TASK_KEYSCAN since keyboard
	  scanning must run in its own task.

if PLATFORM_EC_KEYBOARD

choice "Protocol select"
	prompt "Select the keyboard protocol to use"

config PLATFORM_EC_KEYBOARD_PROTOCOL_8042
	bool "i8042"
	select HAS_TASK_KEYPROTO
	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 "Console command: i8042"
	default y if PLATFORM_EC_KEYBOARD_PROTOCOL_8042
	help
	  This command prints the state of the i8042 keyboard protocol and
	  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 "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.

config PLATFORM_EC_I2C
	bool "I2C shim"
	default n if ARCH_POSIX
	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 "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_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_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)

if PLATFORM_EC_MKBP_EVENT

choice
    prompt "MKBP delivery method"
    default PLATFORM_EC_MKBP_USE_GPIO
    help
      Select MKBP delivery method

config PLATFORM_EC_MKBP_USE_GPIO
    bool "Use GPIO"
    help
      Select to send MKBP events via GPIO. You should define GPIO_EC_INT_L
      in gpio_map.h as output from the EC. The GPIO is used to indicate an
      event is ready for serving by the AP.

config PLATFORM_EC_MKBP_USE_HOST_EVENT
    bool "Use host event"
    help
      Select to send MKBP events via host event.

config PLATFORM_EC_MKBP_USE_GPIO_AND_HOST_EVENT
    bool "Use GPIO and host event"
    help
      MKBP events are notified by using both a GPIO and a host event.

      You should use this if you are using a GPIO to notify the AP of an MKBP
      event, and you need an MKBP event to wake the AP in suspend and the
      AP cannot wake from the GPIO.  Since you are using both a GPIO and
      a hostevent for the notification, make sure that the S0 hostevent mask
      does NOT include MKBP events.  Otherwise, you will have multiple
      consumers for a single event. However, make sure to configure the
      host event *sleep* mask in coreboot to include MKBP events. In order to
      prevent all MKBP events from waking the AP, use
      CONFIG_MKBP_EVENT_WAKEUP_MASK to filter the events.

config PLATFORM_EC_MKBP_USE_CUSTOM
    bool "Use custom method"
    help
      Select to send MKBP events using custom method. You need to define
      mkbp_set_host_active_via_custom() which is called when there's a MKBP event
      to be sent. for more about the function, refer to mkbp_event.h.

endchoice

endif # PLATFORM_EC_MKBP_EVENT

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

if PLATFORM_EC_PANIC

config PLATFORM_EC_SOFTWARE_PANIC
	bool "Software panic"
	default y
	help
	  Sometimes the EC has bugs that are provoked by unexpected events.
	  This enables storing a panic log and halt the system for
	  software-related reasons, such as stack overflow or assertion
	  failure.

config PLATFORM_EC_CONSOLE_CMD_CRASH
	bool "Console command: crash"
	default y
	help
	  For testing purposes it is useful to be able to generation exceptions
	  to check that the panic reporting is working correctly. The enables
	  the 'crash' command which supports generating various exceptions,
	  selected by its parameter:

	     assert              - assertion failure (ASSERT() macro)
	     divzero             - division by zero
	     udivzero            - division of unsigned value by zero
	     stack (if enabled)  - stack overflow
	     unaligned           - unaligned access (e.g. word load from 0x123)
	     watchdog            - watchdog timer fired
	     hang                - infinite loop in the EC code

config PLATFORM_EC_STACKOVERFLOW
	bool "Console command: crash stack"
	depends on PLATFORM_EC_CONSOLE_CMD_CRASH
	default y
	help
	  This enables the 'stack' parameter for the 'crash' command. This
	  causes a stack overflow by recursing repeatedly while task switching.
	  This can be used to check that stack-overflow detection is working
	  as expected.

endif # PLATFORM_EC_PANIC

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"
	select HAS_TASK_POWERBTN
	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_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_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.

if PLATFORM_EC_THROTTLE_AP

# TODO(b/177676794): Add the CONFIG_THROTTLE_AP_ON_... options

config PLATFORM_EC_CHIPSET_CAN_THROTTLE
	bool "CPU can support throttling"
	default y
	help
	  Indicates that the SoC supports throttling. This means that a
	  chipset_throttle_cpu() function is provided by the chipset, to be
	  called to set the throttle state. The typical implementation asserts
	  GPIO_CPU_PROCHOT, to make the CPU slow down.

config PLATFORM_EC_CONSOLE_CMD_APTHROTTLE
	bool "Console command: apthrottle"
	default y
	help
	  This command shows the current status of AP throttling. Both soft
	  (type 0) and hard (type 1) throttling are supported. Soft throttling
	  is typically controlled by the AP via a host event. Hard throttling
	  typically uses the PROCHOT (Processor Hot) signal on x86 CPUs.

	  Example output:

	     AP throttling type 0 is off (0x00000000)
	     AP throttling type 1 is off (0x00000000)

endif # PLATFORM_EC_THROTTLE_AP

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.

if PLATFORM_EC_TIMER

config PLATFORM_EC_CONSOLE_CMD_GETTIME
	bool "Console command: gettime"
	default y
	help
	  Enable the "gettime" command. This shows the current time (in
	  microseconds since boot) in both hex and in decimal converted to
	  seconds. For example:

	     Time: 0x0000000002706a62 = 40.921698 s


config PLATFORM_EC_CONSOLE_CMD_TIMERINFO
	bool "Console command: timerinfo"
	default y
	help
	  Enable the "timerinfo" command which shows the current time (in
	  microseconds and seconds since boot), the deadline (next time the EC
	  needs to wake up) and a list of active timers along with when they
	  will next fire.

	  Example:

	    Time:     0x0000000002706a62 us,   40.921698 s
	    Deadline: 0x000000000270774d ->    0.003307 s from now
	    Active timers:
	      Tsk  1  0x000000000271db8f ->    0.094509
	      Tsk  4  0x00000000027396b3 ->    0.207953
	      Tsk 13  0x00000000027133a1 ->    0.051519


config PLATFORM_EC_CONSOLE_CMD_WAITMS
	bool "Console command: waitms"
	default y
	help
	  Enable the "waitms" command. This waits for a given number of
	  milliseconds. For example:

	    waitms 100

	  waits for 100ms. Note that long waits can introduce problems since
	  it stops the EC from executing its normal tasks. For example, a
	  two-second wait can cause the EC to reset.

endif # PLATFORM_EC_TIMER

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.

endif # PLATFORM_EC