aboutsummaryrefslogtreecommitdiff
path: root/external
AgeCommit message (Collapse)AuthorFilesLines
2019-03-28external/mambo: Error out if kernel is too largeRussell Currey1-0/+4
If you're trying to boot a gigantic kernel in mambo (which you can reproduce by building a kernel with CONFIG_MODULES=n) you'll get misleading errors like: WARNING: 0: (0): [0:0]: Invalid/unsupported instr 0x00000000[INVALID] WARNING: 0: (0): PC(EA): 0x0000000030000010 PC(RA):0x0000000030000010 MSR: 0x9000000000000000 LR: 0x0000000000000000 WARNING: 0: (0): numInstructions = 0 WARNING: 1: (1): [0:0]: Invalid/unsupported instr 0x00000000[INVALID] WARNING: 1: (1): PC(EA): 0x0000000000000E40 PC(RA):0x0000000000000E40 MSR: 0x9000000000000000 LR: 0x0000000000000000 WARNING: 1: (1): numInstructions = 1 WARNING: 1: (1): Interrupt to 0x0000000000000E40 from 0x0000000000000E40 INFO: 1: (2): ** Execution stopped: Continuous Interrupt, Instruction caused exception, ** So add an error to skiboot.tcl to warn the user before this happens. Making PAYLOAD_ADDR further back is one way to do this but if there's a less gross way to generally work around this very niche problem, I can suggest that instead. Signed-off-by: Russell Currey <ruscur@russell.cc> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-03-28external/mambo: Populate kernel-base-address in the DTRussell Currey1-1/+4
skiboot.tcl defines PAYLOAD_ADDR as 0x20000000, which is the default in skiboot. This is also the default in skiboot unless kernel-base-address is set in the device tree. If you change PAYLOAD_ADDR to something else for mambo, skiboot won't see it because it doesn't set that DT property, so fix it so that it does. Signed-off-by: Russell Currey <ruscur@russell.cc> Acked-by: Michael Neuling <mikey@neuling.org> [stewart: fix up mambo hacks for STB] Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-21Makefile: Paper over gard and pflash coverage issuesAndrew Jeffery2-0/+8
`make coverage-report` gave the following error: (cd external/pflash; lcov -q -c -d . -o pflash.info --rc lcov_branch_coverage=1; sed -i -e 's%external/pflash/libflash%libflash%; s%external/pflash/ccan%ccan%' pflash.info) (cd external/gard; lcov -q -c -d . -o gard.info --rc lcov_branch_coverage=1; sed -i -e 's%external/gard/libflash%libflash%; s%external/gard/ccan%ccan%' gard.info) geninfo: WARNING: no .gcda files found in . - skipping! geninfo: WARNING: no .gcda files found in . - skipping! lcov -q -c -d . -d ccan/check_type/test/ -d ccan/str/test/ -d ccan/str/test/ -d ccan/list/test/ -d ccan/list/test/ -d ccan/list/test/ -d ccan/list/test/ -d ccan/list/test/ -d ccan/build_assert/test/ -d ccan/short_types/test/ -d ccan/short_types/test/ -d ccan/array_size/test/ -d ccan/container_of/test/ -d ccan/endian/test/ -d libc/test/ -d libc/test/ -d libc/test/ -d libc/test/ -o skiboot.info --rc lcov_branch_coverage=1 lcov -q -r skiboot.info 'external/pflash/*' -o skiboot.info lcov -q -r skiboot.info 'external/gard/*' -o skiboot.info lcov -q -a skiboot.info -a external/pflash/pflash.info -o skiboot.info lcov: ERROR: no valid records found in tracefile external/pflash/pflash.info make: *** [/home/andrew/src/open-power/skiboot/Makefile.main:315: skiboot.info] Error 255 And similar again for the gard tool. We should really untangle the build strategy for tools in external/, but in the mean time paper over the problem of generating the lcov output at the top level by ensuring we have a means to generate the necessary gcda files for lcov to consume. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-21gard: Fix warnings from gcc 8.2.0Andrew Jeffery1-2/+3
gard.c:285:5: error: no previous prototype for ‘parse_path’ [-Werror=missing-prototypes] int parse_path(const char *str, struct entity_path *parsed) ^~~~~~~~~~ gard.c: In function ‘do_list’: gard.c:459:46: error: unused parameter ‘argc’ [-Werror=unused-parameter] static int do_list(struct gard_ctx *ctx, int argc, char **argv) ~~~~^~~~ gard.c:459:59: error: unused parameter ‘argv’ [-Werror=unused-parameter] static int do_list(struct gard_ctx *ctx, int argc, char **argv) ~~~~~~~^~~~ Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-21pflash: Increase stack frame size warning thresholdAndrew Jeffery1-0/+1
pflash is a userspace tool, stack space isn't really a constraint that we care about. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-21ffspart, libflash: Fix stack size warningsAndrew Jeffery1-1/+3
libflash/file.c: In function 'file_erase': libflash/file.c:134:1: error: the frame size of 4128 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] } ^ and ffspart.c: In function ‘main’: ffspart.c:529:1: error: the frame size of 4864 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] } ^ In both cases, mark the local variables as static to avoid the stack. The static approach is valid for file.c as the buffer is always filled with `~0`. Given it's now going to be in .bss due to static we have to still perform the memset(), but racing memset()s in this fashion won't be harmful, just wasteful. For ffspart.c's main(), there are bigger problems if that needs to be re-entrant. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-18pflash: Don't try update RO ToCAndrew Jeffery1-8/+34
In the future it's likely the ToC will be marked as read-only. Don't error out by assuming its writable. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-18devicetree: Add Makefile to build dtb binariesReza Arbab2-0/+11
Add a simple Makefile to build external/devicetree/*.dtb. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-18devicetree: Add p9-simics.dtsReza Arbab1-0/+16
Add a p9-based devicetree that's suitable for use with Simics. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-18devicetree: Move power9-phb4.dtsReza Arbab1-0/+221
Clean up the formatting of power9-phb4.dts and move it to external/devicetree/p9.dts. This sets us up to include it as the basis for other trees. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-14pflash: Support encoding/decoding ECC'd partitionsStewart Smith3-10/+41
With the new --ecc option, pflash can add/remove ECC when reading/writing flash partitions protected by ECC. This is *not* flawless with current PNORs out in the wild though, as they do not typically fill the whole partition with valid ECC data, so you have to know how big the valid ECC'd data is and specify the size manually. Note that for some partitions this is pratically impossible without knowing the details of the content of the partition. A future patch is likely to introduce an option to "stop reading data when ECC starts failing and assume everything is okay rather than error out" to support reading the "valid" data from existing PNOR images. Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-12external/mambo: allow CPU targeting for most debug utilsNicholas Piggin1-97/+229
Debug util functions target CPU 0:0:0 by default Some can be overidden explicitly per invocation, and others can't at all. Even for those that can be overidden, it is a pain to type them out when you're debugging a particular thread. Provide a new 'target' function that allows the default CPU target to be changed. Wire that up that default to all other utils. Provide a new 'S' step command which only steps the target CPU. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-10Add PVR_TYPE_P9PReza Arbab1-0/+2
Enable a new PVR to get us running on another p9 variant. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-12-11opal-prd: hservice: Enable hservice->wakeup() in BMCShilpasri G Bhat2-4/+3
This patch enables HBRT to use HYP special wakeup register in openBMC which until now was only used in FSP based machines. This patch also adds a capability check for opal-prd so that HBRT can decide if the host special wakeup register can be used. Fixes: 49999302251b("opal-prd: Add support for runtime OCC reset in ZZ") Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-12-11ffspart: Support flashing already ECC protected imagesStewart Smith5-5/+17
We do this by assuming filenames with '.ecc' in them are already ECC protected. This solves a practical problem in transitioning op-build to use ffspart for pnor assembly rather than three perl scripts and a lot of XML. We also update the ffspart tests to take into account ECC requirements. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-12-11ffspart: Increase MAX_LINE to above PATH_MAXStewart Smith1-1/+1
Otherwise we saw failures in CI and the ~221 character paths Jankins likes to have. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-11-28ffspart: Add test for eraseblock sizeJoel Stanley2-0/+47
This test checks that the partitions are correctly laid out when the eraseblock size is greater than the start of the first partition. Currently ffspart fails to create a valid image in this case. There are two tests. The second is expected to fail but it is marked as passing for now. This test requires pflash to work. Currently we leave that as an exercise for the user. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-11-28ffspart: Add toc testJoel Stanley3-0/+20
This test specifies a toc in the configuration file. There are no tests or documentation for the toc syntax, so this exists to describe how specify a toc. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-10-25pflash: Add --skip option for readingAdriana Kobylak3-3/+29
Add a --skip=N option to pflash to skip N number of bytes when reading. This would allow users to print the VERSION partition without the STB header by specifying the --skip=4096 argument, and it's a more generic solution rather than making pflash depend on secure/trusted boot code. Signed-off-by: Adriana Kobylak <anoo@linux.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> [stewart: fix up pflash test] Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-10-23external/mambo: Check for qtrace_utils.tcl before sourcing itMadhavan Srinivasan1-1/+3
Commit cb835dbdf875 ('external/mambo: conditionally source qtrace script') added qtrace_utils.tcl sourcing in skiboot.tcl without a check to see whether it exists in the current directory. This broke running mambo from another directory using skiboot.tcl. Patch adds a check. Fixes: cb835dbdf875 ('external/mambo: conditionally source qtrace script') Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-09-20mambo: Merge PMEM_DISK and PMEM_VOLATILE codeMichael Neuling1-46/+31
PMEM_VOLATILE and PMEM_DISK can't be used together and are basically copies of the same code. This merges the two and allows them used together. Same API is kept. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-09-20xscom-utils: Rework getsramOliver O'Halloran1-7/+47
Allow specifying a file on the command line to read OCC SRAM data into. If no file is specified then we print it to stdout as text. This is a bit inconsistent, but it retains compatibility with the existing tool. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-09-20xscom-utils/getsram: Make it work on P9Oliver O'Halloran1-23/+58
The XSCOM base address of the OCC control registers changed slightly between P8 and P9. Fix this up and add a bit of PVR checking so we look in the right place. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-09-13xscom-utils/adu_scoms.py: run 2to3 over itStewart Smith1-21/+21
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-08-15don't fail fatally if qtrace can't be loadedStewart Smith1-1/+3
Helps with p9 public mambo on fedora at least Fixes: cb835dbdf8758b1fb0cae0ef2f93b324d1c4c96e Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-08-13external/mambo: conditionally source qtrace scriptNicholas Piggin2-7/+10
This automatically gives qtrace commads if the simulator provides the capability. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-08-01opal-prd: Fix opal-prd crashVasant Hegde1-3/+3
Presently callback function from HBRT uses r11 to point to target function pointer. r12 is garbage. This works fine when we compile with "-no-pie" option (as we don't use r12 to calculate TOC). As per ABIv2 : "r12 : Function entry address at global entry point" With "-pie" compilation option, we have to set r12 to point to global function entry point. So that we can calculate TOC properly. Crash log without this patch: opal-prd[2864]: unhandled signal 11 at 0000000000029320 nip 00000 00102012830 lr 0000000102016890 code 1 Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> CC: Jeremy Kerr <jk@ozlabs.org> CC: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Acked-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-07-18Fixup pflash build for ast refactorStewart Smith1-1/+4
Fixes: 5b1bc2ffe791ae94361d86b2ae063ee543bf2df5 Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-06-27pmem: volatile bindings for the poorly enabledBalbir singh1-0/+26
PMEM_DISK bindings were added, but they rely on a rather recent mmap feature. This patch steals from those bindings to add volatile bindings. I've used these bindings with PMEM_VOLATILE to launch an instance with the publicly available systemsim-p9. The bindings are volatile and one should not expect any data to be saved/retrieved. Signed-off-by: Balbir singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-06-18external/xscom-utils: Add python library for xscom accessMadhavan Srinivasan1-0/+312
Patch adds a simple python library module for xscom access. It directly manipulate the '/access' file for scom read and write from debugfs 'scom' directory. Example on how to generate a getscom using this module: #!/usr/bin/python from adu_scoms import * getscom = GetSCom() getscom.parse_args() getscom.run_command() Sample output for above getscom.py: # ./getscom.py -l Chip ID | Rev | Chip type ---------|-------|----------- 00000008 | DD2.0 | P9 (Nimbus) processor 00000000 | DD2.0 | P9 (Nimbus) processor Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-06-01ffspart: Don't require user to create blank partitions manuallySamuel Mendoza-Jonas7-11/+64
Add '--allow-empty' which allows the filename for a given partition to be blank. If set ffspart will set that part of the PNOR file 'blank' and set ECC bits if required. Without this option behaviour is unchanged and ffspart will return an error if it can not find the partition file. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-06-01pflash: Use correct prefix when installingJoel Stanley1-1/+1
pflash uses lowercase prefix when running make install in it's direcetory, but uppercase PREFIX when running it in shared. Use lowercase everywhere. With this the OpenBMC bitbake recipie can drop an out of tree patch it's been carrying for years. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-29Add -Wno-stringop-truncation for GCC8Stewart Smith1-1/+1
This warning appears to not be particularly useful if you ever actually *want* to truncate a string. Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-29Add prepare_hbrt_update to hbrt interfacesDan Crowell2-1/+15
Add placeholder support for prepare_hbrt_update call into hostboot runtime (opal-prd) code. This interface is only called as part of a concurrent code update on a FSP based system. Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-24external/mambo: Add support for readline if it existsBalbir Singh1-1/+14
Add support for tclreadline package if it is present. This patch loads the package and uses it when the simulation stops for any reason. Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-24opal-prd: Do not error out on first failure for soft/hard offline.Mahesh Salgaonkar1-3/+3
The memory errors (CEs and UEs) that are detected as part of background memory scrubbing are reported by PRD asynchronously to opal-prd along with affected memory ranges. hservice_memory_error() converts these ranges into page granularity before hooking up them to soft/hard offline-ing infrastructure. But the current implementation of hservice_memory_error() does not hookup all the pages to soft/hard offline-ing if any of the page offline action fails. e.g hard offline can fail for: - Pages that are not part of buddy managed pool. - Pages that are reserved by kernel using memblock_reserved() - Pages that are in use by kernel. But for the pages that are in use by user space application, the hard offline marks the page as hwpoison, sends SIGBUS signal to kill the affected application as recovery action and returns success. Hence, It is possible that some of the pages in that memory range are in use by application or free. By stopping on first error we loose the opportunity to hwpoison the subsequent pages which may be free or in use by application. This patch fixes this issue. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-09mambo: Enable XER CA32 and OV32 bits on P9Anton Blanchard1-1/+1
POWER9 adds 32 bit carry and overflow bits to the XER, but we need to set the relevant CTRL1 bit to enable them. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-02external/mambo: simplify implementation of diBalbir singh1-9/+3
We've got a great disassembly function built-in, reuse that to implement di (as in xmon). Improves 1bcd6d84: (external/mambo: Add di command to decode instructions) Signed-off-by: Balbir singh <bsingharora@gmail.com> Acked-By: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-29mambo: Add persistent memory disk supportMichael Neuling1-0/+29
This adds support to for mapping disks images using persistent memory. Disks can be added by setting this ENV variable: PMEM_DISK="/mydisks/disk1.img,/mydisks/disk2.img" These will show up in Linux as /dev/pmem0 and /dev/pmem1. This uses a new feature in mambo "mysim memory mmap .." which is only available since mambo commit 0131f0fc08 (from 24/4/2018). This also needs the of_pmem.c driver in Linux which is only available since v4.17. It works with powernv_defconfig + CONFIG_OF_PMEM. ie --- a/arch/powerpc/configs/powernv_defconfig +++ b/arch/powerpc/configs/powernv_defconfig @@ -238,6 +238,8 @@ CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_GENERIC=y CONFIG_VIRTIO_PCI=m CONFIG_VIRTIO_BALLOON=m +CONFIG_LIBNVDIMM=y +# CONFIG_ND_BLK is not set CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y CONFIG_EXT2_FS_POSIX_ACL=y Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-24external/mambo: Add di command to decode instructionsMichael Neuling1-0/+11
By default you get 16 instructions but you can specify the number you want. ie systemsim % di 0x100 4 0x0000000000000100: Enc:0xA64BB17D : mtspr HSPRG1,r13 0x0000000000000104: Enc:0xA64AB07D : mfspr r13,HSPRG0 0x0000000000000108: Enc:0xF0092DF9 : std r9,0x9F0(r13) 0x000000000000010C: Enc:0xA6E2207D : mfspr r9,PPR Using di since it's what xmon uses. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-19mambo/mambo_utils.tcl: Inject an MCE at a specified addressBalbir Singh1-1/+15
Currently we don't support injecting an MCE on a specific address. This is useful for testing functionality like memcpy_mcsafe() (see https://patchwork.ozlabs.org/cover/893339/) The core of the functionality is a routine called inject_mce_ue_on_addr, which takes an addr argument and injects an MCE (load/store with UE) when the specified address is accessed by code. This functionality can easily be enhanced to cover instruction UE's as well. A sample use case to create an MCE on stack access would be set addr [mysim display gpr 1] inject_mce_ue_on_addr $addr This would cause an mce on any r1 or r1 based access Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-19external/mambo: improve helper for machine checksNicholas Piggin1-9/+53
Improve workarounds for stop injection, because mambo often will trigger on 0x104/204 when injecting sreset/mces. This also adds a workaround to skip injecting on reservations to avoid infinite loops when doing inject_mce_step. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Acked-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-19external: Add "lpc" toolBenjamin Herrenschmidt2-0/+193
This is a little front-end to the lpc debugfs files to access the LPC bus from userspace on the host. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-18external/trace: fix makefileStewart Smith1-1/+1
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-10opal-prd: Insert powernv_flash moduleVasant Hegde1-1/+8
Explictly load powernv_flash module on BMC based system so that we are sure that flash device is created before starting opal-prd daemon. Note that I have replaced pnor_available() check with is_fsp_system(). As we want to load module on BMC system only. Also pnor_init has enough logic to detect flash device. Hence pnor_available() becomes redundant check. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> CC: Jeremy Kerr <jeremy.kerr@au1.ibm.com> CC: Stewart Smith <stewart@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-09libflash/blocklevel: Make read/write be ECC agnostic for callersCyril Bur1-32/+17
The blocklevel abstraction allows for regions of the backing store to be marked as ECC protected so that blocklevel can decode/encode the ECC bytes into the buffer automatically without the caller having to be ECC aware. Unfortunately this abstraction is far from perfect, this is only useful if reads and writes are performed at the start of the ECC region or in some circumstances at an ECC aligned position - which requires the caller be aware of the ECC regions. The problem that has arisen is that the blocklevel abstraction is initialised somewhere but when it is later called the caller is unaware if ECC exists in the region it wants to arbitrarily read and write to. This should not have been a problem since blocklevel knows. Currently misaligned reads will fail ECC checks and misaligned writes will overwrite ECC bytes and the backing store will become corrupted. This patch add the smarts to blocklevel_read() and blocklevel_write() to cope with the problem. Note that ECC can always be bypassed by calling blocklevel_raw_() functions. All this work means that the gard tool can can safely call blocklevel_read() and blocklevel_write() and as long as the blocklevel knows of the presence of ECC then it will deal with all cases. This also commit removes code in the gard tool which compensated for inadequacies no longer present in blocklevel. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Tested-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> [stewart: core/flash: Adapt to new libflash ECC API Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-09external/ffspart: Improve error outputCyril Bur1-2/+2
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-09external/ffspart: Use new interfaceCyril Bur59-399/+481
This also updated the pflash tests which use ffspart to generate pnors Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-09libflash/libffs: Allow caller to specifiy header partitionCyril Bur1-1/+1
An FFS TOC is comprised of two parts. A small header which has a magic and very minimmal information about the TOC which will be common to all partitions, things like number of patritions, block sizes and the like. Following this small header are a series of entries. Importantly there is always an entry which encompases the TOC its self, this is usually called the 'part' partition. Currently libffs always assumes that the 'part' partition is at zero. While there is always a TOC and zero there doesn't actually have to be. PNORs may have multiple TOCs within them, therefore libffs needs to be flexible enough to allow callers to specify TOCs not at zero. The 'part' partition is otherwise a regular partition which may have flags associated with it. libffs should allow the user to set the flags for the 'part' partition. This patch achieves both by allowing the caller to specify the 'part' partition. The caller can not and libffs will provide a sensible default. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-09libflash/libffs: Refcount ffs entriesCyril Bur2-1/+3
Currently consumers can add an new ffs entry to multiple headers, this is fine but freeing any of the headers will cause the entry to be freed, this causes double free problems. Even if only one header is uses, the consumer of the library still has a reference to the entry, which they may well reuse at some other point. libffs will now refcount entries and only free when there are no more references. This patch also removes the pointless return value of ffs_hdr_free() Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>