aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-01-27Add Makefile and shell to run a boot test if zImage.epapr is presentStewart Smith2-0/+59
If you've built a zImage.epapr using op-build, you can now drop it in the top level skiboot source tree, run 'make check' and these test files will pick it up and run a boot test using it. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-27add libc/test/.gitignore for the new libc unit testsStewart Smith1-0/+10
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-22rtc: rtc tod state need to be updated on successNeelesh Gupta1-0/+1
The OPAL rtc read interface currently fails as the tod state is not getting updated in the callback. The patch fixes this issue. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-22rtc: Remove the not used prototypeNeelesh Gupta1-2/+0
This seem to be left behind during the previous commit for creating a generic interface of reading the cached tod on non-fsp systems. So, remove the old prototype fsp_rtc_get_cached_tod(). Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-22PLAT: Use NULL check instead assertionNeelesh Gupta1-17/+25
There could be some processor chips not populated in the system. So, if we are not able to get chip data of given chip id, we should just move on to the next or return instead of aborting (bz 120562). Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-22platforms/firestone: Add Firestone platformJeremy Kerr2-1/+45
Based on Habanero. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-21Unlock rtc cache lock when cache isn't validStewart Smith1-1/+4
Otherwise we crash with recursive lock error during boot on some systems Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-21Don't run pollers when sending fsp msg for op panel op_display(FATAL)Stewart Smith2-3/+10
I got the following recursive lock crash: LOCK ERROR: Invalid recursive lock @0x30108108 (state: 0x0000000000000001) [315691375,0] Aborting! CPU 0000 Backtrace: S: 0000000031a03080 R: 0000000030013508 .backtrace+0x24 S: 0000000031a03100 R: 0000000030017128 .abort+0x64 S: 0000000031a03170 R: 0000000030015d34 .lock_error+0x54 S: 0000000031a031f0 R: 0000000030015de8 .lock+0x50 S: 0000000031a03270 R: 000000003004fc20 .elog_timeout_poll+0x28 <- take elog_write_lock S: 0000000031a03300 R: 0000000030017d48 .opal_run_pollers+0x54 S: 0000000031a03380 R: 0000000030043fdc .fsp_sync_msg+0x74 S: 0000000031a03410 R: 000000003004eaa0 .op_display+0xdc S: 0000000031a034c0 R: 0000000030015d08 .lock_error+0x28 <- printf"LOCK ERROR" S: 0000000031a03540 R: 0000000030015de8 .lock+0x50 <- S: 0000000031a035c0 R: 000000003002413c .rtc_cache_get+0x20 <- rtc_tod_lock INCORRECTLY KEPT LOCK S: 0000000031a03650 R: 000000003002421c .rtc_cache_get_datetime+0x24 S: 0000000031a03700 R: 0000000030023100 .create_pel_log+0x340 S: 0000000031a037f0 R: 000000003004f9dc .opal_send_elog_to_fsp+0x5c <- take elog_write_lock S: 0000000031a03880 R: 00000000300238b4 .log_simple_error+0xe0 S: 0000000031a03a10 R: 00000000300245c8 .__xscom_write+0xb8 S: 0000000031a03aa0 R: 00000000300248c0 .xscom_write+0x138 S: 0000000031a03b60 R: 000000003002af1c .occ_send_dummy_interrupt+0x34 S: 0000000031a03bd0 R: 0000000030017b9c .opal_update_pending_evt+0x68 <- take evt_lock S: 0000000031a03c60 R: 00000000300511c8 .update_opal_dump_notify+0x48 S: 0000000031a03cd0 R: 00000000300517f0 .add_dump_id_to_list+0xe8 S: 0000000031a03d80 R: 00000000300553e4 .ibm_fsp_init+0xd4 S: 0000000031a03e30 R: 00000000300140f0 .main_cpu_entry+0x3ec S: 0000000031a03f00 R: 0000000030002504 boot_entry+0x18c Which is wonderfully fascinating as there are *TWO* lock_error frames in the call stack, which means we lost the original error. This is because op_display() sends an FSP message with fsp_sync_msg() which runs opal_run_pollers() which ended up running a poller that tried to take a lock we already had when we ran into trouble. Basically, running pollers during this kind of fatal error handling is a bad idea. So, instead of doing that, just queue the FSP message and don't wait for a response (we don't really care about the response on a fatal error anyway). Additionally, move op_display() to *after* the printf call on the hope that printf ends up being a bit more foolproof than having to send FSP messages. Now, with this bug fixed, the correct lock_error() will be displayed. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-21i2c: Unify the frequencies to calculate bit rate divisorNeelesh Gupta1-6/+3
Provide the frequencies in same unit (HZ) for calculating the bit rate divisor value. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-21Make building of hdata unit tests quietStewart Smith1-2/+2
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Add skeleton for libc/ctype unit testsStewart Smith3-1/+62
Now it shows up as untested in lcov! Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Add skeleton for libc/stdlib unit testStewart Smith3-1/+62
Now it shows up as untested in lcov! Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Skeleton unit tests for libc memops (libc/string/*)Stewart Smith3-1/+71
This means that it shows up in lcov as untested. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Add some skiboot snprintf test casesStewart Smith4-5/+242
Initial implementation and support for more libc test cases Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-19Merge branch 'update-2.1.1.1'Stewart Smith3-55/+222
2015-01-19opal: Fix buffer overrun in print_* functions.skiboot-2.1.1-fw810.20-4Mahesh Salgaonkar1-55/+108
While running HMI tests I saw a massive corruption in OPAL for one of the HMI test that injects TB error. On investigation I found that vsnprintf()->print_itoa() was the culprit. print_itoa function uses tmp array of size 16 to convert unsigned long value to ASCII. But an unsigned value of 0xffffffffffffffff needs atleast 25 characters to print its ASCII representation. This caused an array to overflow resulting into corruption, unpredictable behavior and finally system termination. We could fix this by increasing the size of tmp[] array but that still won't fix this bug completely. While auditing vsnprintf() function I found that it makes use of print_*() functions to write data to buffer. But none of the print_* function have any check on buffer size before writing data to it. Without size check print_*() can easily overrun buffer passed by vprlog()->vsnprintf()->print_format()->print_*() causing massive corruption leading to unpredictable behavior. This patch fixes this bug by modifying print_*() function to check for buffer size to avoid buffer overrun. - Modified print_format(), print_fill() and print_itoa() to take bufsize as argument and added a size check while writing to buffer. - Remove temporary array from print_itoa(), instead write data directly to buffer. - Added two new function print_str_fill() and print_str() to be used as helper routine for '%s' fmt case in print_format() function. These new routines now has a check on buffer size while copying NULL terminated string to buffer. - Added "!bufsize" check in vsnprintf() to avoid buffer overrun while setting NULL character before returning. I ran HMI tests with this patch successfully. I also tested this patch by reducing size of the buffer (in core/console-log.c:vprlog()) from 320 to 50 and booted the lid successfully with no corruption at all. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-19opal: Add unit test for buffer overrun in prlog/printfMahesh Salgaonkar3-2/+127
Add unit test for buffer overrun in prlog/printf. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> [stewart@linux.vnet.ibm.com: rebased to stable branch] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-24Initial stab at OPAL Spec and some API docs.Stewart Smith4-0/+375
All very early. Comments/review needed. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-24Update gitignore for current test suite binaries etcStewart Smith1-1/+12
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19clean CORE_TEST_NOSTUB binariesStewart Smith1-0/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Add console-log unit testStewart Smith2-0/+87
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Exclude all test cases from coverage-reportStewart Smith4-0/+8
This way we get a true representation from the lcov coverage-report about what firmware code we're testing (besides, test cases are always going to only have 50% of branches hit - we're asserting the tests pass!) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Add another pel test to test user sectionStewart Smith1-0/+33
This increases our code coverage of pel.c from 81.3% to 98.7% Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Increase test coverage of pel testStewart Smith2-2/+6
Cover pel buffer too small case in create_pel_log Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19travis: Install power8 simulator for make checkJoel Stanley1-4/+3
This downloads and installs mambo, the power8 simulator, including some dependencies to ensure it runs on Travis' ancient Ubuntu 12.04. Without the newer libc, you'll see a warning like this: /opt/ibm/systemsim-p8/bin/systemsim-pegasus: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/ibm/systemsim-p8/bin/systemsim-pegasus) Where GLIBCXX_3.4.20 is GCC 4.9. This is why we require libstdc++ from the ppa. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Pretty print make check and coverage outputStewart Smith4-18/+18
Can still get the details with V=1, just like normal make. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-18Run the CCAN unit tests and add to coverage-reportStewart Smith18-5/+150
With some fun Makefile rules, we can pick up all CCAN unit tests. We exclude the unit test source files from the lcov report itself. Add skeleton ccan config.h and tap.h that are enough for us to build and run the test suite. Currently, the minimalist versions should be fine (and we don't need CCAN configurator). Also includes -Werror fixes for ccan tests. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-18test/hello_world: Fix makefile ruleJoel Stanley1-1/+1
powerpc-linux-gnu-gcc -m64 -c -MMD -Itest/hello_world/hello_kernel/ -o test/hello_world/hello_kernel/hello_kernel.o test/hello_world/hello_kernel/hello_kernel.S test/hello_world/hello_kernel/asm-utils.h powerpc-linux-gnu-gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files GCC barfed as we were passing the header and the c file while compiling with -c. Fix the rule to just build source file. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-18test/hello_world: Fix some corner cases in test scriptJoel Stanley1-1/+6
The test for expect would always return true. This change makes it do the correct thing in the presence and absence of expect on my Ubuntu machine. Also, skip the test if the user has KERNEL set. With this set skiboot contains an embedded kernel, and will load that before falling back to our hello_world test kernel, causing all kinds of confusion. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-17Fix compatible match for palmetto & habaneroBenjamin Herrenschmidt2-2/+2
The strings should be "tyan,..." not "ibm,..." Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-12-15Fix makefile dependency generation, especially for HOSTCCStewart Smith7-25/+8
Instead of having individual rules to generate .d, add -MMD to HOSTCC parameters, and just include the generated .d files. This fixes a few weird dependency issues. Also, make the mambo hello_kernel test depend on skiboot.lid Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-15Fix flub in hello_world Makefile.checkStewart Smith1-3/+0
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-15Add hello_world tiny payload to test with mambo (if available)Stewart Smith6-0/+171
Just calls OPAL_CONSOLE_WRITE with "Hello World!" and with mambo we can execute this tiny boot test in not much time at all. Good little sanity check. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-15Makefile: Support CROSS_COMPILE as well as CROSSMichael Ellerman1-0/+3
A lot of projects use CROSS_COMPILE for specifying the cross compile prefix, so support that as well as CROSS. For example this allows a user to set CROSS_COMPILE once in their environment and build both Linux & Skiboot with the same setting. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> [stewart@linux.vnet.ibm.com: only set if env variable is set] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-15mambo: Get the zImage from an environment variableMichael Ellerman1-1/+4
Rather than hard coding /tmp/zImage.epapr, get the zImage from an environment variable. This is a) cleaner, and b) allows running multiple copies of the simulator against different kernels simultaneously. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10FSP: Reset the response outstanding bitmap on reset startAnanth N Mavinakayanahalli1-2/+6
Once we have the FSP in reset, we don't expect it to respond to any outstanding mbox commands for which we are expecting one. Reset the bitmap to reflect the same. While there, remove the stale comment about timeout resets. We use the fsp_cmdclass->timeout as a constant for all classes and a value 0 indicates an invalid class entry in the discontiguous fsp_cmdclass[]. The bitmap is what gates whether we process outstanding messages in the class. Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10PLAT/i2c: Fix the i2c device node name and add target propertyskiboot-4.1Neelesh Gupta1-13/+29
Fix the i2c device node name that should show the functionality and use a dedicated 'target' name property to tell targets being controlled. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Don't add dummy console property if already in dt.Ryan Grimm1-1/+3
generic_platform_init() adds this propery by default in commit 9594a715b50c338f1261e88c12c120cf8e5b8bba . If a platform adds it to the dt, Sapphire detects multiple dt props and dies. So don't add it if already exists in the dt. Signed-off-by: Ryan Grimm <grimm@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Update README with list and patchwork locationsStewart Smith1-0/+22
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Fix bug/warning in hdata/memory.c I introduced in f1a3a19Stewart Smith1-2/+3
Passing the wrong parameter to snprintf (sizeof(char*)) rather than actual length of the string. GCC 4.9 told us about it (and broke make check when I enabled -Werror) hdata/test/../memory.c: In function ‘add_address_range’: hdata/test/../memory.c:144:23: error: argument to ‘sizeof’ in ‘snprintf’ call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Enable -WerrorStewart Smith1-2/+2
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Fix warn_unused_result warnings in fsp-leds.cStewart Smith1-25/+131
We now prerror() for cases where we're failing to send responses. there's likely some better handling of this that can go on, but at least we'll have a log message now. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Fix warning of unbounded stack in libfdt/fdt_sw.cStewart Smith1-1/+6
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Console: Fix unused result warnings in console driverAnanth N Mavinakayanahalli1-22/+79
Fix Wunused-result Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10FSP/EPOW: Fix unused result warnings in EPOW driverVasant Hegde1-3/+34
Commit c36c5607 added warn_unused_result compilation flag to fsp_queue_msg function....which resulted in multiple warnings in EPOW driver. This patch fixes those warnings. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10FSP/DPO: Fix unused result warnings in DPO driverVasant Hegde1-4/+46
Commit c36c5607 added warn_unused_result compilation flag to fsp_queue_msg function....which resulted in multiple warnings in DPO driver. This patch fixes those warnings. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10SURV: Fix unused result warnings in surveillance codeAnanth N Mavinakayanahalli1-6/+14
Fix Wunused_result Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10RTC: Fix unused result warnings in RTC driverAnanth N Mavinakayanahalli1-2/+11
Fix Wunused-result Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10FSP: Fix unused result warnings in fsp driverAnanth N Mavinakayanahalli1-9/+60
Fix Wunused-result Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Enable warn_unused_result for fsp_fetch_data_queue()Vasant Hegde2-9/+22
fsp_fetch_data_queue() internally calls fsp_queue_msg(). So ideally we should consume the result of this function. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>