summaryrefslogtreecommitdiff
path: root/common/console.c
Commit message (Collapse)AuthorAgeFilesLines
* console: Do not flush the console in console_initNicolas Boichat2018-05-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, console_init calls cflush() twice, once before "Console is enabled" string is printed, once afterwards. The reason is that firmware_ECBootTime looks for that string, and it may get corrupted/interleaved with others if the EC is busy during initialization. The problem here is that the CONSOLE task may have higher priority than other tasks (for good reasons), but, on boot, there are other more critical tasks that need to run (e.g. RW image verification), rather than busy-looping waiting for the console to be flushed. By fixing firmware_ECBootTime to not look for the string anymore, we do not need those 2 console flush. BRANCH=poppy BUG=b:35647963 BUG=chromium:687228 CQ-DEPEND=CL:1075832 TEST=Flash staff, see that RW verification starts at 0.001037 instead of 0.028087 (=> 27 ms faster). TEST=test_that -b $BOARD $IP firmware_ECBootTime Change-Id: I794e48eb69cc647c4595fd80265adee4a434d566 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1073180 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Shuffle const aroundPatrick Georgi2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | gcc 8.1 complains about duplicate const, and while some of these really are duplicate, others look like they were supposed to tighten the API contract so that variables are "const pointer to const data", but didn't have that effect. BUG=b:65441143 BRANCH=none TEST=building Chrome EC as part of upstream coreboot's build with a gcc 8.1 compiler now works (better. there are other issues left) Change-Id: I6016c5f282516471746f08d5714ea07ebdd10331 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1039812 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fix inconsistent task function declarationsStefan Reinauer2017-08-081-1/+1
| | | | | | | | | | | | | | | Tasks are defined inconsistently across the code base. Signed-off-by: Stefan Reinauer <reinauer@google.com> BRANCH=none TEST=make buildall -j, also verify kevin boots to OS BUG=none Change-Id: I19a076395a9a8ee1e457e67a89d80d2f70277c97 Reviewed-on: https://chromium-review.googlesource.com/602739 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* task: Wait for HOOK_INIT completion before scheduling tasksShawn Nematbakhsh2017-06-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until HOOK_INIT has completed, do not allow any tasks other than HOOKS or IDLE to be scheduled. Programmers often make the assumption that a HOOK_INIT function is guaranteed to be run before task code that depends on it, so let's make it so. BUG=chromium:649398 BRANCH=None TEST=Manual on kevin, compare boot without patch: ... [0.004 power state 0 = G3, in 0x0008] <-- from chipset task RTC: 0x00000000 (0.00 s) [0.004 power state 4 = G3->S5, in 0x0008] RTC: 0x00000000 (0.00 s) [0.005 clear MKBP fifo] [0.006 clear MKBP fifo] [0.006 KB init state: ... <-- from keyscan task [0.012 SW 0x05] [0.155 hash start 0x00020000 0x00019a38] [0.158 HOOK_INIT DONE!] ... to boot with patch: ... RTC: 0x58cc614c (1489789260.00 s) [0.004 clear MKBP fifo] [0.005 clear MKBP fifo] [0.010 SW 0x05] [0.155 hash start 0x00020000 0x000198e0] [0.157 HOOK_INIT DONE!] ... Also, verify kevin boots to OS and is generally functional through sysjump and basic tasks, and verify elm (stm32f0 / cortex-m0) boots. Change-Id: If56fab05ce9b9650feb93c5cfc2d084aa281e622 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/456628 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* console: ensure "Console is enabled" string is intactphilipchen2017-03-201-0/+2
| | | | | | | | | | | | | BUG=chromium:687228 BRANCH=none TEST=boot 10 times on kevin, and see the complete string "Console is enabled..." Change-Id: I9bb7358eb0a3d8172b5584329b9837cf62def635 Reviewed-on: https://chromium-review.googlesource.com/457421 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Cr50: Mark several console commands as safeBill Richardson2016-08-311-3/+3
| | | | | | | | | | | | | | | | | | | Even when CONFIG_RESTRICTED_CONSOLE_COMMANDS is enabled, there are many commands that can't do anything dangerous. This marks some of those commands as safe to use, even when restrictions are enforced. I'm only marking commands that are used by the Cr50, since that's the only board that has restrictions. BUG=chrome-os-partner:55322 BRANCH=none TEST=make buildall, test on Cr50 hardware Change-Id: I6289d332830175b6adcb6b20cb4c21d01d27a25e Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/376188 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add console support for restricted commandsBill Richardson2016-08-311-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for CONFIG_RESTRICTED_CONSOLE_COMMANDS. If the appropriate options are configured, restricted commands can be prevented from running. Nothing in this CL actually uses that, but it works if you turn it on. BUG=chrome-os-partner:55322 BRANCH=none TEST=make buildall, test on Cr50 hardware I also tested it manually. If you add this to board.h: #define CONFIG_CONSOLE_COMMAND_FLAGS #define CONFIG_RESTRICTED_CONSOLE_COMMANDS #define CONFIG_CONSOLE_COMMAND_FLAGS_DEFAULT CMD_FLAG_RESTRICTED and this to board.c: static int restricted_state; int console_is_restricted(void) { return restricted_state; } static int command_lock(int argc, char **argv) { int enabled; if (argc > 1) { if (!parse_bool(argv[1], &enabled)) return EC_ERROR_PARAM1; restricted_state = enabled; } ccprintf("The restricted console lock is %s\n", restricted_state ? "enabled" : "disabled"); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND_FLAGS(lock, command_lock, "[<BOOLEAN>]", "Get/Set the restricted console lock", 0); /* no restrictions */ then you can use the "lock" command to enable and disable every other console command except for it and "help". Change-Id: Ic9517f9ea7a9867f15e5d14b302246070163d558 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/376186 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add configs to add flags to console commandsBill Richardson2016-08-311-4/+14
| | | | | | | | | | | | | | | | | | If we add a .flags field to the console commands data structure, we can use it to distinguish some commands from others, for example to mark some commands as safe and others as dangerous. This just adds the undefined CONFIG_ options. They aren't used anywhere, so there's no behavioral difference yet. BUG=chrome-os-partner:55322 BRANCH=none TEST=make buildall Change-Id: I17fdf177dcb4324c77565bd95344da1405ea15ed Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/376185 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove unused CONFIG_CONSOLE_RESTRICTED_INPUT optionBill Richardson2016-08-241-30/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Nothing has used this config option since Spring and Skate, back in early 2014. There's nothing in ToT that uses it at all. I want to add something similar for other purposes, and having two similar-sounding options will just cause confusion. NOTE: Although the comments in include/system.h said that the two functions system_get_console_force_enabled() system_set_console_force_enabled() were only useful when CONFIG_CONSOLE_RESTRICTED_INPUT is defined, they were being used in chip/stm32/system.c. But since the bkpdata registers are only accessible to the EC, there was no way to initialize or modify the one relevant bit that those functions cared about, so they almost certainly had no effect. BUG=chrome-os-partner:55322 BRANCH=none TEST=make buildall Change-Id: Id41541193d4559f5c507bdd0268b049166af4497 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374525
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* common: console: Change console_init() string.Aseda Aboagye2016-02-231-0/+4
| | | | | | | | | | | | | | | | | | | | | For enhanced EC images, change the string telling the user that the console is enabled. This is such that EC-3PO can distinguish between non-enhanced ECs and enhanced ECs during EC boot. BUG=chromium:588611 BRANCH=None TEST=Build for chell with CONFIG_EXPERIMENTAL_CONSOLE and verify that the new string is printed. TEST=Repeat above test but without the config option and verify that the old string is printed. TEST=make -j buildall tests Change-Id: Ic8ed0a028ecb701b999fa6c6a376704f375dbc62 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/329161 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ec3po: Add compatibility for older EC images.Aseda Aboagye2015-11-261-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The EC-3PO console and interpreter could be used to talk to EC images which do not have the necessary changes to support the new enhancements. If this was the case, the interpreter would be very confused and the user wouldn't be able to use the console. This commit adds compatibility support for talking to both non-enhanced and enhanced EC images. When the console and interpreter are instantiated, they assume by default that the EC image they are talking to is non-enhanced. When the user presses the carriage return key, the console initiates an interrogation with the EC image. The interrogation is a simple EC_SYN(0xEC) and waits EC_INTERROGATION_TIMEOUT for the correct EC_ACK(0xC0). Enhanced EC images will try to reply immediately to a EC_SYN. Non-enhanced EC images will just ignore the EC_SYN as it's not a printable character. Once the interrogation is complete, the console will either simply pass everything forwards to the EC or provide the console interface itself. BUG=chrome-os-partner:46063 BRANCH=None TEST=Enabled CONFIG_EXPERIMENTAL_CONSOLE on GLaDOS. Entered some commands and verified console was working. Disabled CONFIG_EXPERIMENTAL_CONSOLE on GLaDOS, reflashed, and verified console was still working without restarting the EC-3PO console. TEST=./util/ec3po/console_unittest.py -b TEST=./util/ec3po/interpreter_unittest.py -b TEST=cros lint --debug util/ec3po/console.py TEST=cros lint --debug util/ec3po/console_unittest.py TEST=cros lint --debug util/ec3po/interpreter.py TEST=cros lint --debug util/ec3po/interpreter_unittest.py Change-Id: I4f472afbdd7e898bee308c239b68ace0f4049842 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/313002 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* console: Add support for using EC-3PO console.Aseda Aboagye2015-11-111-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new CONFIG_* option. To utilise the experimental console, simply define the following config option in the board's board.h file. #define CONFIG_EXPERIMENTAL_CONSOLE This is a temporary option which allows the EC console to be work with the EC-3PO interactive console interface. When this option is enabled, the EC expects commands to packed in a particular format. This is for command integrity and allows the interpreter to perform automatic command retrying in the event that a character is dropped from the sent command. It also removes a lot of the console editing methods since they are now being served by EC-3PO. Once the EC-3PO interpreter is pulled into servod, we can enable this feature by default and the config option can go away. BUG=chrome-os-partner:46054 BRANCH=None TEST=make -j buildall tests TEST=Enable CONFIG_EXPERIMENTAL_CONSOLE on GLaDOS; Flash EC and verify that console works via the EC-3PO interactive console interface. TEST=Build and flash on GLaDOS and verify normal console operation on standard EC UART. CQ-DEPEND=CL:308615 Change-Id: I5e66eb94e31299b27ce029b7f7ce6ba0a7fb6816 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/309991 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Only process console input after console task startedVic Yang2015-01-171-1/+2
| | | | | | | | | | | | | | | | | | | | If a character is received between uart_init() and task_start(), we shouldn't try to wake console task. Usually this shouldn't happen because the input shouldn't be floating, but still, the EC should not crash in this case. BRANCH=None BUG=chrome-os-partner:35308 TEST=Boot on Glower without servo connected. Check the LED is not blinking. Change-Id: I62157c3ecd50b5eca6b09c1cf594b65a605546f9 Signed-off-by: Vic Yang <victoryang@google.com> Reviewed-on: https://chromium-review.googlesource.com/241512 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vic Yang <victoryang@chromium.org>
* usb: add USB console driverVincent Palatin2014-07-171-9/+30
| | | | | | | | | | | | | | | | | Provide access to the EC console through 2 USB bulk endpoints. (which can be used through the usbserial driver) Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=run on Fruitpie and use the console over USB Change-Id: Ia897764f3a030972ee2ed323f293c5fca899765a Reviewed-on: https://chromium-review.googlesource.com/204167 Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org>
* Add a few more error messages to the EC consoleBill Richardson2014-03-271-8/+20
| | | | | | | | | | | | | | | | | This adds explanations for all the error codes in enum ec_error_list, so that console commands that fail can print the reason. BUG=none BRANCH=ToT TEST=none I can't find any console commands that return errors without explanations, but I'm planning to add some. This is just preparation. Change-Id: I26a730acb60a73c269c39ae2f24273b7e9920cec Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191781 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lm4: Use low speed clock in deep sleep.Alec Berg2013-10-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Changed the low power idle task to use the low speed clock in deep sleep. The low power idle task is currently only enabled for Peppy, Slippy, and Falco. This change decreases power consumption when the AP is not running. Note that the low speed clock is slow enough that the JTAG cannot be used and the EC console UART cannot be used. To work around that, this commit detects when the JTAG is in use and when the EC console is in use, and will not use the low speed clock if either is in use. The JTAG in use never clears after being set and the console in use clears after a fixed timeout period. BUG=None BRANCH=None TEST=Passes all unit tests. Tested that the EC console works when in deep sleep. Tested that it is possible to run flash_ec when in deep sleep and using the low speed clock. Change-Id: Ia65997eb8e607a5df9b2c7d68e4826bfb1e0194c Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173326 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Move input character processing from UART interrupt to console taskRandall Spangler2013-08-021-12/+388
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, processing of arrow keys and control characters was done in the interrupt handler itself. This increased the impact of UART input on other interrupts and high-priority tasks. It also makes it harder to implement DMA-based UART input on STM32L (in an imminent CL), since the processing affected the circular UART input buffer in-place. This change turns uart_buffering.c back into a dumb I/O buffering module, and puts all the command line editing and history support into console.c. Console history is done via a simple array of input lines instead of a packed circular buffer of characters. This is a little less RAM-efficient, but is easier to implement and read. History depth is controlled via CONFIG_CONSOLE_HISTORY, and is 3 for STM32F and 8 for other platforms. If we really need a greater history depth, we can look into implementing a packed circular buffer again, but this time at task time in console.c. Also added a 'history' command to print the current console history. BUG=chrome-os-partner:20485 BRANCH=none TEST=console_edit unit test passes; 'history' command prints the last commands Change-Id: I142a0be0d67718c58341e4569f4e2908f191d8b0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64363 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Clean up and document UART config optionsRandall Spangler2013-07-241-1/+1
| | | | | | | | | | | | No functional changes, just renaming config options. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I91584cb1f8990dd0f980abd32c04465a66243e71 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63244
* Accept a command if it's a full matchVic Yang2013-06-051-0/+6
| | | | | | | | | | | | | | | | On Spring, we now have commands 'i2c' and 'i2cscan'. Currently if we type 'i2c', it's rejected as it's also the prefix of 'i2cscan'. Since 'i2c' is a full match of a legal command, we should accept it. BUG=None TEST=On Spring, check 'i2c' invokes 'i2c' command, and 'i2cs'/'i2cscan' invokes 'i2cscan' command. Also check 'i2' is still rejected. BRANCH=all Change-Id: I65c4c148a5a3e9b025554fa8165ba76da7bc312f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57576 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add console command to force enable consoleVic Yang2013-05-151-1/+23
| | | | | | | | | | | | | | | | | | | | | | When system is locked, the console is disabled. However, we need console for debugging and testing. This CL uses a bit from back-up register to indicate if the console should always be enabled. (This bit is currently used by fake WP, which is removed in this CL.) With this, we can set this bit with console command 'forceen 1' to ensure console is never disabled. To prevent device shipped in this state, the chip name is postfixed with '-unsafe' so that the device is not able to pass HWID check. BUG=chrome-os-partner:19293 TEST=Manual BRANCH=spring Change-Id: I88556e973ca542c1bdc27ba64988718291e01a26 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51086 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* add option to de-activate EC console input when WP is onVincent Palatin2013-04-301-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | With a Toad cable, the user can access the EC serial console through the micro-B connector. We probably need to de-activate the input on the EC serial console when the Write-Protect is on, since we have fairly "powerful" commands on the EC command-line. Add a new CONFIG_CONSOLE_RESTRICTED_INPUT on platforms with externally accessible EC serial port. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:18716 TEST=on Spring with CONFIG_CONSOLE_RESTRICTED_INPUT set, try with and without write-protect, use successfully the EC console in the former case, and see "Console is DISABLED" in the latter case. Change-Id: Ic9646d5468183f4d8f94b5e5e1d2a727941d7bbe Reviewed-on: https://gerrit.chromium.org/gerrit/49537 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Clean up uart buffering codeRandall Spangler2012-10-261-2/+2
| | | | | | | | | | | | | No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=help version -> prints help on version command Change-Id: I79c4b668513b6037aa6cf3fa1a2a8c0fc9856f41 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36612 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Clean up console moduleRandall Spangler2012-10-241-36/+44
| | | | | | | | | | | | Code cleanup and reformatting. No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=compile code; type a debug command like 'help list'. Change-Id: I641215ba3333628f658eec86d9d99718c43b111f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36387
* Split console output into its own moduleRandall Spangler2012-06-131-107/+0
| | | | | | | | | | | | | | No code changes, just rearranging source in preparation for an experiment to see how much the binary shrinks if we disable the interactive console. BUG=none TEST=none Change-Id: Ie21f1b3dcd04272e80fd40b2ed54d1eaf7fb1cdf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/25232 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add basic SPI support to linkRandall Spangler2012-05-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds SPI transaction support, and a debug command to read a few values from the SPI EEPROM. Note that the SPI controller is normally *disabled* with all its I/Os high-Z, so this will not interfere with main processor or Servo on the SPI bus. The bus is only enabled during the SPIROM command itself. BUG=chrome-os-partner:7844 TEST=manual 1) Reboot system 2) on EC console, 'spirom'. Should print Man/Dev ID : 0xef 0x16 JEDEC ID : 0xef 0x40 0x17 Unique ID : 0xd1 0x61 0x44 0xb0 0x63 0x5d 0x40 0x32 Status reg 1: 0x00 Status reg 2: 0x00 Note that unique ID is, well, unique, so it won't match my value. But it should still be something not all 0xff's. 3) Power on the system. x86 should still boot normally, indicating that the EC isn't interfering with the SPI bus. Change-Id: I53bf5fdbbe7a37949375d0463e30e408cc6fb6a8
* Better help for console commandsRandall Spangler2012-05-251-24/+74
| | | | | | | | | | | | | | | | | | | | Additional help messages and usage are gated by CONFIG_CONSOLE_CMDHELP, so we can turn it on if there's space (adds about 3KB to image size) and turn it off when there isn't. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=manual 1) help 2) help list 3) help gpioset 4) gpioset -> wrong number of params 5) gpioset fred 0 -> param1 bad 6) gpioset cpu_prochot fred -> param2 bad Change-Id: Ibe99f37212020f763ebe65a068e6aa83a809a370
* More debug command cleanup to save spaceRandall Spangler2012-05-211-1/+3
| | | | | | | | | | (saves another 1.5KB) BUG=none TEST=(run the commands) Change-Id: Id3ca58528fa68a4cec606edf2b98b9af38ac228f Signed-off-by: Randall Spangler <rspangler@chromium.org>
* Clean up debug commands to use less spaceRandall Spangler2012-05-211-23/+15
| | | | | | | | BUG=none TEST=(run the commands) Change-Id: I6ed4aee169311825190bcc386b86cdc32ba0866a Signed-off-by: Randall Spangler <rspangler@chromium.org>
* Sort console commands at build timeVincent Palatin2012-05-151-21/+4
| | | | | | | | | | | | Use the linker to sort console commands by name, this saves execution time and memory. BUG=none TEST=generate several images with 5N, 5N+1, 5N-1 commands and check the output of the "help" command. Change-Id: Ib5d8f3bca726621c68ab152f4fa662cee355abb1 Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
* Arrange help output to sort 'column first'Vadim Bendebury2012-05-141-25/+31
| | | | | | | | | | | | | | | Sort the command name index, and then print them in file columns (as before), but ordering columns first. This makes it much easier to examine the 'help' command output. BUG=none TEST=manual . program the new image . execute the 'help' command . observe output printed sorted 'columns first' Change-Id: I7b15cef09a61fe20eb4ba5ee274ba1d72063f1c0 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
* Allow console commands abbreviationVadim Bendebury2012-05-141-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The EC console input handling code is being enhanced to accept abbreviated command names. If the abbreviation is unique, the appropriate command is used, if the abbreviation is ambiguous, the command is handled as nonexistent. The error message is being modified to mention that the command either does not exist or is ambiguous. This change also makes it impossible to have command names matching the beginning of other command names. Two such cases are being fixed (`ch' renamed to `chan' and `thermal' renamed to 'thermalconf'). BUG=none TEST=manual . program the new EC image. Try entering at the console: > h Command 'h' either not found or ambiguous. Command returned error 1 > he Known commands: adc autofan battery ch charger ... > help Known commands: adc autofan battery ch charger ... Change-Id: Iaa3e91e1504e42daefb02d561e00c39003548197 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
* Allow boards to set the default console maskSimon Glass2012-05-101-6/+9
| | | | | | | | | | | | | | Some boards don't like to have every keyboard scan printed, but some devs find this info comforting. Add a way for boards to select the require console mask. BUG=none TEST=manual: build and boot on daisy, see that key scan messages are suppressed. build on all platforms Change-Id: I8e6e640eaabc0a08e5427cd97f7089dda1238025 Signed-off-by: Simon Glass <sjg@chromium.org>
* Fix truncated output from 'ch' commandRandall Spangler2012-05-101-0/+1
| | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST='ch' - prints all the channels now Change-Id: I38ebc3eed2476c44c26fc00d6ea79800ae427722
* Issue warning on fan stall.Vic Yang2012-04-261-0/+1
| | | | | | | | | | | | When PWM module detects fan stall, issue SMI warning and print warning message to console. Signed-off-by: Vic Yang <victoryang@google.com> BUG=chrome-os-partner:7497 TEST=Disconnect fan and power up. See warning message. Change-Id: I4d96595f7f3cdfab5df333afc35206304bacab9d
* Use console output instead of uart output for console commandsRandall Spangler2012-04-241-6/+10
| | | | | | | | | | | | This completes console output cleanup. The remaining calls to uart_puts() and uart_printf() actually need to be that way. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual Change-Id: Ib1d6d370d30429017b3d11994894fece75fab6ea
* Refactor async console outputRandall Spangler2012-04-241-21/+124
| | | | | | | | | | | | | | | | | | This adds a 'ch' command which prints/sets which channels are active This handles all the async output; the remaining debug commands will be refactored to use ccprintf() / ccputs() in a followup CL. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual ch --> all channels active ch 0x100 -> just port80 active powerbtn -> system boots; only port 80 codes shown on console Change-Id: I9efc43acec919b62b78c2c82c61946d32380adfe
* Move externs from .lds file into a header fileRandall Spangler2012-04-191-3/+1
| | | | | | | | | | | Fewer magic externs = good. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=if it boots, it works Change-Id: Ifadeb1701400c5492c40d2eaf8f68f2d70189648
* Change task messages to eventsRandall Spangler2012-04-061-2/+2
| | | | | | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7461 TEST=manual make BOARD={bds,link,daisy} make tests flash link system and make sure it boots Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
* Handle up/down arrow keys for UART console.Vic Yang2012-02-071-9/+1
| | | | | | | | | | | | | | | | | | | | | | Record commands used previously and use up/down arrow key to navigate in the command history. Also removed the command '.' of repeating last command as we can use up arrow key now. Also changed the behaviour of uart_write_char() to be blocking on transmit FIFO full, so that we do not lose echoed character and do not need to flush. BUG=chrome-os-partner:7815 TEST=Type 'help' and enter. Then type 'aaaa' and up arrow key, should show 'help', and pressing enter prints help. Type 'hellp' and enter. Then type 'aaaaaa' and up arrow key, should show 'hellp'. Should be able to use left/right arrow key and backspace to correct it to 'help', and pressing enter prints help. Type 'help' and enter. Then type 'aaa', up arrow key, and down arrow key. Should show 'aaa'. Change-Id: I65c615d61bf63acb31bea329aa91a3202d4db0ad
* Remove useless header includesVincent Palatin2012-01-261-1/+0
| | | | | | | | | | | | | | Preparatory work to introduce a second SoC : 2nd series 2/4 Avoid introducing platform specific dependencies in common files where they are not necessary. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=build for BDS and Link Change-Id: If2ccd022e4956425222b55a5a48ca7522857e7f0
* Help command prints a sorted multi-column list of commandsRandall Spangler2012-01-241-8/+25
| | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=type 'help' from console Change-Id: If88610f35337243ca2550de2851bd1924083344d
* register console commands at compile-timeVincent Palatin2012-01-241-38/+12
| | | | | | | | | | | | | | | Instead of using a runtime callback to register the console commands, put them in a special linker section. So we can do a macro to "register" them during the build. It saves 684 bytes and a few microseconds at startup. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=run a few commands from the BDS command line. Change-Id: Id33ea210b9035bf76ed720373c74c5dd24ccd1b1
* Initial sources import 1/3Randall Spangler2011-12-071-0/+207
source files mainly done by Randall. Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: Iaff83a842b17f3350fb6f2a3f1597ad4c29bd12a