aboutsummaryrefslogtreecommitdiff
path: root/external
AgeCommit message (Collapse)AuthorFilesLines
2017-08-22external/pflash: Fix not checking return values in set_ecc().Cyril Bur1-2/+11
When writing ECC bytes to ECC regions we don't check that blocklevel_write() succeeds nor we check that the region was correctly erased prior to setting the ECC bytes. Fixes: CID 163737 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-22external/pflash: Fix resource leak CID 163745Cyril Bur1-0/+1
Thanks Coverity. Fixes: CID 163745 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-22external/pflash: Fix resource leak CID 163742Cyril Bur1-0/+1
Thanks Coverity. Fixes: CID 163742 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-22external/pflash: Silence false positive Coverity CID 163739Cyril Bur1-0/+6
Several of the cases in the getopt loop take the optarg pointer and pass it to functions which will dereference it. There is currently no bug as all of these are marked to getopt as having a requirement argument so optarg will never be null. The rationale for this patch is firstly to silence coverity as it is fairly simple to do. More importantly having a brand new version of this Coverity error appear in the event of a future mistake with optional arguments to getopt will be useful. Fixes: CID 163739 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-21external/xscom-utils: Add --list-bitsOliver O'Halloran4-9/+50
When using getscom/putscom it's helpful to know what bits are set in the register. This patch adds an option to print out which bits are set along with the value that was read/written to the register. Note that this output indicates which bits are set using the IBM bit ordering since that's what the XSCOM documentation uses. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-15opal-prd: Do not pass pnor file while starting daemonVasant Hegde1-1/+1
We do not have pnor support on all the system. Also we have logic to autodetect PNOR. Hence do not pass --pnor by default. CC: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-15opal-prd: Disable pnor access interface on FSP systemVasant Hegde3-4/+30
On FSP system host does not have access to PNOR. Hence disable PNOR access interfaces. CC: Jeremy Kerr <jk@ozlabs.org> CC: Daniel M Crowell <dcrowell@us.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: tests: Move the test-miscprint to pflash testsCyril Bur4-0/+77
New code that is very much pflash functionality was added in commit f2c87a3d2f6 "pflash option to retrieve PNOR partition flags". Unfortunately at the time there wasn't an easy way to test pflash. The previous patch adds pflash infrastructure and plumbs it into `make check` nicely. This commit converts the tests originally added to libflash tests. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Add testsCyril Bur29-4/+991
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external: Consolidate Makefile.check for external toolsCyril Bur3-46/+31
The reason for this is that check targets for one tool will start to depend on other tools. For example, future pflash tests will rely on ffspart to generate pnors. The current method is too racey and results in races cleaning/building ffspart for its tests and for pflash tests. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Reinstate the progress barsCyril Bur1-16/+63
Recent work did some optimising which unfortunately removed some of the progress bars in pflash. It turns out that there's only one thing people prefer to correctly programmed flash chips, it is the ability to watch little equals characters go across their screens for potentially minutes. Personally I don't understand the appeal but I have received strongly worded requests for the reinstatement of the progress bars in pflash and I fear for the stability of our society if pflash doesn't promptly regain its most unimportant feature. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Make the progress bar safe for big numbersCyril Bur2-17/+24
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Remove use of exit() and fix memory leaksCyril Bur1-169/+213
Using exit() all over the place has lead to a huge mess of leaving all sorts of dangling references to malloc()ed memory, to blocklevel_devices and even sometimes file descriptors. Stop using exit() and simply report everything back to the main where everything can be freed on the way back out. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Move write and read size calculation togetherCyril Bur1-13/+11
Very simple rework, makes sense to calculate those at the same time. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Update the code pathes for "--tune"Cyril Bur1-3/+11
It doesn't make sense for --tune to do anything unless --direct was passed. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Remove global flash detailsCyril Bur1-59/+63
Currently all the flash details including the pointer to the blocklevel_device to access the flash is global. This is annoying since it makes it hard to know when it was allocated, some of the code just changes it which makes tracking difficult. Rather than have it globally accessible, pass it around as a structure so better control who modifies it and where and when. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Correct erase alignment checksCyril Bur1-27/+13
pflash should check the alignment of addresses and sizes when asked to erase. There are two possibilities: 1. The user has specified sizes manually in which case pflash should be as flexible as possible, blocklevel_smart_erase() permits this. To prevent possible mistakes pflash will require --force to perform a manual erase of unaligned sizes. 2. The user used -P to specify a partition, partitions aren't necessarily erase granule aligned anymore, blocklevel_smart_erase() can handle. In this it doesn't make sense to warn/error about misalignment since the misalignment is inherent to the FFS partition and not really user input. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Stop using exit() in the mainCyril Bur1-23/+49
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Check the result of strtoulCyril Bur1-8/+27
Also add 0x in front of --info output to avoid a copy and paste mistake. Reported-by: Michael Neuling <mikey@neuling.org> Suggested-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/pflash: Add description of flagsCyril Bur1-2/+4
Recent reworks of pflash expose more partition flags, the --info command only prints them in their one character short names. It isn't obvious what they all are, add a little description Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01libflash/libffs: Don't require 'part' size to be known by callersCyril Bur10-22/+15
Currently the FFS header/TOC generation code requires that consumers know the size of their TOC beforehand. While this may be advantageous in some circumstances if there are known limitations of other software. It should not be a requirement. Knowing the size of the FFS header/TOC partially breaks the abstraction since it would require consumers of the library to be aware of/have some idea of the on flash structure and size. Future work may introduce functions to force sizes but the default behaviour should be to calculate it behind the scenes. This patch also addresses an off by one issue in checking for TOC overflow. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01external/ffspart: Add .gitignoreCyril Bur1-0/+7
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01libflash: Adding debugging outputCyril Bur1-0/+2
Also add usage text to pflash. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01Makefile.check: Fix `make check`Cyril Bur2-7/+23
Recent reworks were tested on the travis-ci system. Unfortunately, there are configurations of running `make check` which the travis-ci doesn't do. On some systems extra problems crop up. Removing the stack size check is only done for the host compiler as the check is only critical for skiboot its self where stack space is contained. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-20boot_tests: add PFLASH_TO_COPY for OpenBMCStewart Smith1-0/+6
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-19gcov: properly handle gard and pflash code coverageStewart Smith1-1/+7
We end up with a bit of a nasty hack to count the libflash symlinks in gard and pflash as part of libflash code coverage, but it does work and is unlikely to break anytime soon. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-19gard: enable building with -DDEBUG for ccan listStewart Smith1-1/+8
Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-19gard: enable building with skiboot HOSTCFLAGS warningsStewart Smith1-1/+21
Mostly unused parameter warnings due to callbacks Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-19pflash: include ccan/list/list.c to be able to build -DDEBUGStewart Smith1-1/+9
This enables some extra linked list checking Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-19pflash: build with skiboot HOSTCFLAGS warningsStewart Smith4-4/+12
mostly missing prototypes and unused parameters. Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-19pflash option to retrieve PNOR partition flagsMichael Tritz1-11/+123
This commit extends pflash with an option to retrieve and print information for a particular partition, including the content from "pflash -i" and a verbose list of set miscellaneous flags. -i option is also updated to print a short list of flags in addition to the ECC flag, with one character per flag. A test of the new option is included in libflash/test. Signed-off-by: Michael Tritz <mtritz@us.ibm.com> Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com> [stewart@linux.vnet.ibm.com: various test fixes, enable gcov] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-20boot-tests: add OpenBMC supportStewart Smith2-2/+125
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-19mambo: Update P9 PVR to reflect Scale out 24 core chipsMichael Neuling1-2/+2
The P9 PVR bits 48:51 don't indicate a revision but instead different configurations. From BookIV we have: Bits: Configuration 0: Scale out 12 cores 1: Scale out 24 cores 2: Scale up 12 cores 3: Scale up 24 cores Skiboot will mostly the use "Scale out 24 core" configuration (ie. SMT4 not SMT8) so reflect this in mambo. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-14mambo: Create multiple chips when we have multiple CPUsMichael Ellerman1-1/+11
Currently when we boot mambo with multiple CPUs, we create multiple CPU nodes in the device tree, and each claims to be on a separate chip. However we don't create multiple xscom nodes, which means skiboot only knows about a single chip, and all CPUs end up on it. At the moment mambo is not able to create multiple xscom controllers. We can create fake ones, just by faking the device tree up, but that seems uglier than this solution. So create a mambo-chip for each CPU other than 0, to tell skiboot we want a separate chip created. This then enables Linux to see multiple chips: smp: Brought up 2 nodes, 2 CPUs numa: Node 0 CPUs: 0 numa: Node 1 CPUs: 1 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-08opal-prd: Handle SBE passthrough message passingVasant Hegde1-0/+24
This patch adds support to send SBE pass through command to HBRT. HBRT interface details provided by Daniel M. Crowell (<dcrowell@us.ibm.com>). CC: Daniel M Crowell <dcrowell@us.ibm.com> CC: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-08mambo: fix cpio/initramfs reservationStewart Smith1-0/+1
We didn't init cpio_size in the no cpio case. Fixes: 52aed80bddd5eed94c537f2bb0b846e4b5683728 Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-08mambo: Add a reservation for the initramfsOliver O'Halloran1-0/+5
On most systems the initramfs is loaded inside the part of memory reserved for the OS [0x0-0x30000000] and skiboot will never touch it. On mambo it's loaded at 0x80000000 and if you're unlucky skiboot can allocate over the top of it and corrupt the initramfs blob. There might be the downside that the kernel cannot re-use the initramfs memory since it's marked as reserved, but the kernel might also free it anyway. Fixes: 65612f120735 Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Tested-by: Michael Ellerman <mpe@ellerman.id.au> [stewart@linux.vnet.ibm.com: add Fixes] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06mambo: Match whole string when looking up symbols with linsym/skisymMichael Ellerman1-2/+2
linsym/skisym use a regex to match the symbol name, and accepts a partial match against the entry in the symbol map, which can lead to somewhat confusing results, eg: systemsim % linsym early_setup 0xc000000000027890 systemsim % linsym early_setup$ 0xc000000000aa8054 systemsim % linsym early_setup_secondary 0xc000000000027890 I don't think that's the behaviour we want, so append a $ to the name so that the symbol has to match against the whole entry, eg: systemsim % linsym early_setup 0xc000000000aa8054 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Tested-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06boot_test.sh: Add SMC BMC supportStewart Smith4-7/+149
Your BMC needs a special debug image flashed to use this, the exact image and methods aren't something I can publish here, but if you work for IBM or SMC you can find out from the right sources. A few things are needed to move around to be able to flash to a SMC BMC. For a start, the SSH daemon will only accept connections after a special incantation (which I also can't share), but you should put that in the ~/.skiboot_boot_tests file along with some other default login information we don't publicise too broadly (because Security Through Obscurity is *obviously* a good idea....) We also can't just directly "ssh /bin/true", we need an expect script, and we can't scp, but we can anonymous rsync! You also need a pflash binary to copy over. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: hook up reset_pm_complexJeremy Kerr1-15/+32
This change provides the facility to invoke HBRT's reset_pm_complex, in the same manner is done with process_occ_reset previously. We add a control command for `opal-prd pm-complex reset`, which is just an alias for occ_reset at this stage. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: Add firmware_request & firmware_notify implementationsJeremy Kerr2-2/+157
This change adds the implementation of firmware_request() and firmware_notify(). To do this, we need to add a message queue, so that we can properly handle out-of-order messages coming from firmware. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: split prd message reading from handlingJeremy Kerr1-19/+28
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: Add support for variable-sized messagesJeremy Kerr1-12/+66
With the introductuion of the opaque firmware channel, we want to support variable-sized messages. Rather than expecting to read an entire 'struct opal_prd_msg' in one read() call, we can split this over mutiple reads, potentially expanding our message buffer. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: use get_ipoll_mask() callbackJeremy Kerr1-1/+9
This change hooks-up the get_ipoll_mask callback, and use a HBRT-provided mask if it's present. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: Sync hostboot interfaces with HBRTJeremy Kerr2-4/+203
This change adds new callbacks defined for p9, and the base thunks for the added calls. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> CC: Daniel M Crowell <dcrowell@us.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: interpret log level prefixes from HBRTJeremy Kerr1-1/+19
Interpret the (optional) *_MRK log prefixes on HBRT messages, and set the syslog log priority to suit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: Add occ reset to usage textJeremy Kerr1-1/+1
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: allow different chips for occ control actionsJeremy Kerr1-27/+68
The `occ reset` and `occ error` actions can both take a chip id argument, but we're currently just using zero. This change changes the control message format to pass the chip ID from the control process to the opal-prd daemon. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: split type-specific fields of control messagesJeremy Kerr1-5/+10
We'd like to add other type-specific fields, so introduce a union to populate with these. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-06opal-prd: Simplify optind handlingJeremy Kerr1-9/+9
Increment once, rather than having to use 'optind + 1' on every subsequent usage. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>