summaryrefslogtreecommitdiff
path: root/core/nds32/switch.S
Commit message (Collapse)AuthorAgeFilesLines
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tree: Files should end with single newlineTom Hughes2022-06-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes additional files not included in https://crrev.com/c/3229797 by running the following: for f in $(find . -name '*.mk'); do printf '%s\n' "$(cat ${f})" > ${f}; done for f in $(find . -name '*.S'); do printf '%s\n' "$(cat ${f})" > ${f} done BRANCH=none BUG=b:172020503, b:234181908 TEST=./util/compare_build.sh -b all -j 120 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ib4e4d0e74bf3b00a0b2c81505fef65e2c1b7401f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3705766 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* it83xx: pull more functions into __ram_code sectionDino Li2020-11-181-1/+2
| | | | | | | | | | | | | | | | | | Because we have space in the section, so we pulled more functions into the section. If a function is cached in __ram_code section (static cache), we can save latency of fetching code of the function from flash. (Fetching 64 bytes code from flash takes about 4us latency) BUG=none BRANCH=none TEST=buildall. Asurada and Drawcia are both able to boot to kernel. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I8b413bd577c4e5b73a5c67018d17955da1ed0c55 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535899 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* nds32/task: return invalid task id if task scheduling is not yet startDino Li2020-11-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | The send_to_cr50() uses task_disable_task() to disable console task, and task_disable_task() will also suspend a task if it is the current task (tskid == task_get_current()). But send_to_cr50() is called in main routine (task scheduling is not yet start). If a specified FW image hits condition of "tskid == task_get_current()", EC will start scheduling with unexpected status. (eg. at CL:2540390: current_task=0x80880, tasks=0x877a8, and uint8_t current_task - tasks = 9 ) BUG=b:172460745 BRANCH=none TEST=No WDT loops on drawcia Change-Id: If42ef14a198ab5f99686f8e7212151b2d6b573f5 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2544291 Tested-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* core/nds32: remove unnecessary conditionDino Li2020-09-151-1/+2
| | | | | | | | | | | | | | | | | In the previous implementation, we added conditions to prevent stack overflow panic or memory get overwritten at first context switch. Actually, we won't hit these two situation if scratchpad size is correct. Let's remove them. BUG=none BRANCH=none TEST=EC boots, and the "runtime" is saved in scratchpad at first context switch. Change-Id: I647e1ebb01dbb8fe24adc9f22b6581bb8f8f97fb Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1980097 Reviewed-by: Jett Rink <jettrink@chromium.org>
* ec: change usage of dummySam Hurst2020-08-051-2/+2
| | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "dummy" with inclusive alternatives. BUG=b:162781382 BRANCH=None TEST=make -j buildall `grep -ir dummy *` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I6a42183d998e4db4bb61625f962867fda10722e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335737 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* nds32: task: allow context switching if task_start() is calledDino Li2018-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We got a symptom that keyboard didn't work without connecting servo board after this change (CL:897315) was merged. This is because our uart RX will receive a data (0) with framing error if RX level is low and trigger a re-scheduling request in uart ISR (HOOKS task will be wake at later and then start the task scheduling). And that will cause we don't return to main() function to finish all operations of initialization after uart_init() is called. I think we will get the same symptom if GPIO/peripheral interrupts are enabled and wake some task at initialization. This change makes sure we will start the task scheduling if task_start() is called. BUG=none BRANCH=none TEST=With this change, keyboard works after EC reboot without servo board connected. Change-Id: I0bda84b1cb56ced6aad2a38b0786d1b336e77211 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/956794 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* nds32: start_irq_handler() use system stackDino Li2015-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [symptom] The 'vboot_hash_start()' always return busy error and variable 'in_progress' got a strange value(should be 0 or 1). 'start_irq_handler()' causes scratchpad overflow in first context switch. It must be called after SP switch to system stack in ISR. NOTE: The scratchpad is still also need more size even if 'start_irq_handler()' is using system stack. following is detail: 1. uint32_t scratchpad[19] 0x81d34 ~ 0x81d7f [__task_start:] 2. /* put the dummy stack pointer at the top of the stack in scratchpad */ addi $sp, $r3, 4 * 18 -> SP 0x81d7c 3. syscall push return address (-4) -> SP 0x81d78 [ISR:] 4. push r15, fp, lp, and sp (-0x10) -> SP 0x81d68 5. push r0 ~ r5 (-0x18) -> SP 0x81d50 [__switch_task:] 6. /* save ipsw, ipc, r6, r7, r8, r9, r10 on the current process stack */ (-0x1C) -> SP 0x81d34 Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=1. hash done. 2. console command 'taskinfo'. 3. the scratchpad does not overflow after first context switch. Change-Id: If5d89ff5c945a777010492fcfb54bf41f434ed69 Reviewed-on: https://chromium-review.googlesource.com/317468 Commit-Ready: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* it8380dev: fix hw timer and related function.Dino Li2015-10-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [chip config] 1. No hardware specific udelay(). 2. Enable watchdog. [watchdog] 3. Watchdog period is "CONFIG_WATCHDOG_PERIOD_MS" of config.h. 4. Watchdog auxiliary timer period is "CONFIG_AUX_TIMER_PERIOD_MS". [task and irq] 5. Write 1 to clear interrupt pending status, no |. 6. A global variable for store interrupt number of software interrupt. [uart] 7. Always reset UART module before config it. [hwtimer] 8. Use more external timers for HW timer module. [task] 9. Fix task profiling. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=[watchdog] 1. console "waitms 1100", only pre-watchdog warning message. 2. console "waitms 1600", warning message and watchdog reset. [hwtimer] 3. console commands "gettime", "timerinfo", and "forcetime". 4. enable hook debug and there is no delayed by more than 10% warning message over 48 hours. 5. There is no watchdog reset too. [task] 6. console 'taskinfo' Task Ready Name Events Time (s) StkUsed 0 R << idle >> 00000000 32.927724 308/512 1 HOOKS 00000000 0.034267 372/768 2 R CONSOLE 00000000 0.116763 468/768 3 HOSTCMD 00000000 0.000641 372/512 4 KEYPROTO 00000000 0.000042 212/512 5 KEYSCAN 00000000 0.000908 356/512 IRQ counts by type: 38 2932 155 1 158 261 160 67 Service calls: 87 Total exceptions: 3348 Task switches: 167 Task switching started: 0.001999 s Time in tasks: 33.282819 s Time in exceptions: 0.164717 s Change-Id: I234085cec231cd855d2a5e639ea1b0966c61d796 Reviewed-on: https://chromium-review.googlesource.com/296939 Commit-Ready: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ite: Port OS layer to Andestar v3m architectureVincent Palatin2013-12-101-0/+99
This will be used to support ITE IT8380 chip which contains an Andes N801 core. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:23574 TEST=make BOARD=it8380dev Change-Id: I91f9380c51c7712aa6a6418223a11551ab0091ce Reviewed-on: https://chromium-review.googlesource.com/175480 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>