summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* template.S: fix to build on architecture with non-empty __USER_LABEL_PREFIX__Thomas Petazzoni2017-12-082-10/+21
| | | | | | | | | | | Blackfin has a non-empty __USER_LABEL_PREFIX__, which means that a symbol called "foo" in C must be named "_foo" in assembler. We now use the preprocessor to set the variables in template.S instead of using sed. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Joel Stanley <joel@jms.id.au>
* Refactor for an exportable APIAlistair Popple2017-12-089-223/+442
| | | | | | | | | | The existing API between libpdbg and pdbg was poorly defined. Other programs are beginning to utilise libpdbg so a more strictly defined API would be beneficial. This patch introduces a new header (libpdbg.h) which includes the definition of a public API for libpdbg and updates pdbg to only depend on this. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Rename struct target to struct pdbg_targetAlistair Popple2017-12-0616-112/+112
| | | | | | | In preparation for a better defined libpdbg API rename "struct target" to something less generic so that we can export the name. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/target.c: Stop probing target multiple timesAlistair Popple2017-12-061-4/+1
| | | | | | | | | | | A lot of the device-tree parsing code was borrowed from Skiboot. This includes dt_for_each_node() which iterates over all the child device-tree nodes. It was incorrectly assumed this only iterated over direct children, rather than every child in the tree. This lead to each target being probed multiple times when the children were explicitly (and incorrectly) iterated over. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* i2c: Update i2c device node in dt when specifiedJoel Stanley2017-11-241-1/+11
| | | | | | | | When the user specifies a device node on the command line, use that value to update the entry in the pib node. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Alistair Popple <alistair@popple.id.au>
* lipdbg/i2c: Get bus path from device treeJoel Stanley2017-11-241-1/+1
| | | | | | | This was not implemented, so the user always got the default /dev/i2c4 no matter what the device tree specified. Signed-off-by: Joel Stanley <joel@jms.id.au>
* libpdbg: Fix incorrect restore of r1 in ram_instructions()Cyril Bur2017-11-241-1/+1
| | | | Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
* Rework generation of .dtb.oThomas Petazzoni2017-11-223-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .dtb.o files are currently generated by compiling the .dts into .dtb, and then making a pass of objcopy to turn them into an ELF file that can be linked with the rest of pdbg. Unfortunately, this objcopy logic doesn't work on all platforms, because it doesn't generate an object file with the correct ABI flags. For example, on mips32r6, it fails to build with: mipsel-buildroot-linux-gnu/bin/ld: fake.dtb.o: warning: linking abicalls files with non-abicalls files mipsel-buildroot-linux-gnu/bin/ld: fake.dtb.o: linking -mnan=legacy module with previous -mnan=2008 modules mipsel-buildroot-linux-gnu/bin/ld: failed to merge target specific data of file fake.dtb.o mipsel-buildroot-linux-gnu/bin/ld: p8-fsi.dtb.o: warning: linking abicalls files with non-abicalls files In order to fix this, we want to generate a proper object file with gcc instead of playing tricks with objcopy, and this is what this commit implement. We have a template.S file, which gets sed'ed on the fly to point to the right file / use the right symbol name, and then is fed to gcc. This allows to remove all the objdump/objcopy logic from the configure.ac script as well. This fixes build issues of pdbg seems inside the Buildroot project: http://autobuild.buildroot.net/?reason=pdbg-77158819158d1d7053a737ac090d04fdfbfe9265 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Cyril Bur <cyrilbur@gmail.com> [joel: - integrate Cyril/Stephen's tr change - fix out of tree builds] Signed-off-by: Joel Stanley <joel@jms.id.au>
* Error out when no device type is specifiedJoel Stanley2017-11-221-0/+8
| | | | | | | The host and FSI backend require the device type to be specified. When a user forgets, we pass a null pointer to strcmp and segfault. Signed-off-by: Joel Stanley <joel@jms.id.au>
* libpdbg: Remove unused __unused from compiler.hJoel Stanley2017-11-221-1/+0
| | | | | | | | | | | | | | | The compiler.h header contains a macro that defines __unused. When building against uClibc this collides with uClibc_stdio.h: In file included from /usr/include/stdio.h:71:0, from libpdbg/fake.c:17: /usr/include/bits/uClibc_stdio.h:149:16: error: expected identifier or ‘(’ before ‘;’ token void *__unused; /* Placeholder for codeset binding. */ ^ As it is unused in pdbg, remove it. Signed-off-by: Joel Stanley <joel@jms.id.au>
* Merge pull request #22 from cyrilbur-ibm/docsapopple2017-10-231-0/+24
|\ | | | | docs: Add HTM to README.md
| * docs: Add HTM to README.mdCyril Bur2017-10-041-0/+24
| | | | | | | | Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
* | libpdbg/device.c: Remove usage of libfdt internal functionsAlistair Popple2017-10-201-3/+4
|/ | | | | | | | | | The code in device.c was largely based on code from Skiboot which included calls to _fdt_check_node_offset and _fdt_offset_ptr which are internal libfdt functions. This makes packaging difficult so remove the usage of these functions and call the correct public library API equivalents. Signed-off-by: Alistair Popple <alistair@popple.id.au> Suggested-by: Frédéric Bonnard <frederic@fr.ibm.com>
* device: remove use of ccan's endianJoel Stanley2017-09-226-522/+2
| | | | | | | | | | | | | | | | | | | | | | | | | When cross compiling with uclibc under buildroot, we get the following clash: ./ccan/endian/endian.h:84:24: error: redefinition of ‘__bswap_32’ static inline uint32_t bswap_32(uint32_t val) ^ In file included from usr/include/bits/byteswap.h:1:0, from usr/include/byteswap.h:22, from usr/include/endian.h:59, from usr/include/bits/pthreadtypes.h:21, from usr/include/bits/uClibc_stdio.h:92, from usr/include/stdio.h:71, from libpdbg/device.c:18: usr/include/bits/byteswap-common.h:44:1: note: previous definition of ‘__bswap_32’ was here __bswap_32 (unsigned int __bsx) ^~~~~~~~~~ Work around it by not using ccan's endian. There's only one call site, and we can use a libc function instead. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Alistair Popple <alistair@popple.id.au>
* kernel: Include endian.h for htobe32 and be32tohJoel Stanley2017-09-221-0/+1
| | | | | | | This fixes a compile failure when cross compiling with musl libc under buildroot. Signed-off-by: Joel Stanley <joel@jms.id.au>
* Hardware Trace Macro (HTM)Cyril Bur2017-09-225-2/+1129
| | | | | | | | | | | | This is not Hardware Transactional Memory, rather it is the Hardware Trace Macro (HTM) which can be used to gather data about hardware activity. Currently only Nest HTM is implemented. Only runs on a PPC host on a kernel built with CONFIG_PPC_MEMTRACE and CONFIG_PPC_SCOM. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Add Hardware Trace Macro (HTM) to device treesCyril Bur2017-09-221-0/+12
| | | | | Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Look for 'chip-id' as opposed to 'ibm,chip-id'Cyril Bur2017-09-222-2/+2
| | | | | | | | | The device trees inside pdbg use 'chip-id'. This function can tell the consumer of any target what chip it is on, if it searches for the correct attribute. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Alistair Popple <alistair@popple.id.au>
* fake.dts: Whitespace cleanupCyril Bur2017-09-221-3/+3
| | | | Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
* Add *.dtsi to .gitignoreCyril Bur2017-09-221-0/+1
| | | | Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
* Allow command line to override GIT_SHA1Joel Stanley2017-09-201-1/+1
| | | | | | | This allows tools that do tarball builds from git (eg. buildroot) to manually set the GIT SHA1. Signed-off-by: Joel Stanley <joel@jms.id.au>
* Do not redefine _LARGEFILE64_SOURCEJoel Stanley2017-09-201-0/+2
| | | | Signed-off-by: Joel Stanley <joel@jms.id.au>
* Add indirect SCOM accessAlistair Popple2017-08-161-4/+87
| | | | | | | Allows access to scom addresses with IBM bit 0 set (ie. indirect scom addresses). Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Add backend for host based debugfsAlistair Popple2017-08-146-2/+186
| | | | | | | | Linux kernels configured with CONFIG_SCOM_DEBUGFS can be used to access SCOM registers on the PowerPC machine running pdbg. Add a backend which can be use to access SCOM registers via debugfs. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Rework POWER9 device-trees to share common definitionsAlistair Popple2017-08-143-109/+68
| | | | | | | | | The description of the PIB is the same regardless of access mechanism (OpenFSI, direct, etc.) so to ease updates move the common definitions into a seperate file which can be easily shared between backends similar to how P8 works. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/target.c: Probe all root nodes in the device-treeAlistair Popple2017-08-141-1/+4
| | | | | | | When multiple device tree nodes exist at the top level subsequent nodes were not getting probed. Fix this. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg: Add sreset commandAlistair Popple2017-07-315-1/+40
| | | | Signed-off-by: Alistair Popple <alistair@popple.id.au>
* build: Update to do both an in and out of tree buildJoel Stanley2017-07-171-12/+21
| | | | | | | | | | The OpenBMC Yocto build process uses an out of tree build model. Now that pdbg supports that, add it to the Travis build so it does not regress. This also updates to an Ubuntu 17.04 container. Signed-off-by: Joel Stanley <joel@jms.id.au>
* configure.ac: Enable silent build rulesJoel Stanley2017-07-171-0/+1
| | | | | | ssssshhh. Signed-off-by: Joel Stanley <joel@jms.id.au>
* Makefile.am: Set foreignJoel Stanley2017-07-171-0/+2
| | | | | | This avoids warnings about GNU make extensions. Signed-off-by: Joel Stanley <joel@jms.id.au>
* Makefile.am: Add missing target rulesAlistair Popple2017-07-171-0/+2
| | | | Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Add output directory as an include path to dtcAlistair Popple2017-07-171-1/+1
| | | | | | | Out of tree builds would occasionally fail due to not finding a generated include file for the device-tree. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* configure.ac: Use host objcopyAlistair Popple2017-07-172-1/+4
| | | | | | | We were using the system objcopy which doesn't always recognise the host file formats. Instead use the target objcopy. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Use absolute paths to source directoriesAlistair Popple2017-07-171-2/+2
| | | | | | | The m4 targets had include directories based on relative paths. This broke out-of-tree builds so turn them into absolute paths. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* src/main.c: Check result of writing to stdoutAlistair Popple2017-07-141-2/+4
| | | | | | Fixes a compilation error due to an unused result on some systems. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* configure.ac: Tag version 1.0Alistair Popple2017-07-141-1/+1
| | | | | | | | | | | Changes: - Move to a generic description of the hw topography using device-tree - General build bugfixes - Build libpdbg as a shared library - Complete support for POWER9 including get/putmem and register operations - Minor code clean-ups Signed-off-by: Alistair Popple <alistair@popple.id.au>
* README.md: Update documentationAlistair Popple2017-07-141-90/+214
| | | | | | Update documentation to match latest usage patterns. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Enable -Wall -Werror for libpdbgAlistair Popple2017-07-1411-34/+45
| | | | | | | Several minor fixes were required to enable building on both x64 and ARM with -Wall -Werror, mostly related to unused variables and bad printf string formats. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* src/main.c: Add error message when no command could be runAlistair Popple2017-07-141-15/+23
| | | | | | | | All commands need a target to operate on. Running a command with no target would produce no output which can be confusing. Instead return an error message and a hint. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* configure.ac: Detect architecture objcopy parametersAlistair Popple2017-07-132-3/+10
| | | | | | | | | The objcopy parameters required to turn device-tree blobs into elf objects for linking are architecture specific but were hard-coded. This required manual updates to Makefile.am when compiling for other architectures. Instead detect the parameters using an autoconf test. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Fix build target dependenciesAlistair Popple2017-07-131-4/+5
| | | | | | | | | | Libraries were incorrectly added in pdbg_LDFLAGS. This means the pdbg build target was not dependent on libpdbg and libfdt so make would occasionally try to link to them before building them resulting in a build failure (especially during parallel building). Instead the libraries should have been added to pdbg_LDADD. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Remove -g from CFLAGSAlistair Popple2017-07-131-1/+1
| | | | | | | It should be set when configuring the program rather than hardcoded in the Makefile. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Allow static linkingAlistair Popple2017-07-131-1/+1
| | | | | | | | | Previously static linking did not work as the linker was not able to work out that the HW units were referenced so it would throw that code away resulting in the probing code finding no valid targets. This is fixed by adding some linker flags to ensure the relevant code is always added to the binary. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg: Add a more complete fake backendAlistair Popple2017-07-135-39/+75
| | | | | | | The fake backend we had couldn't be used as src/main.c was missing the option to enable it. It was also missing an implementation of a fake pib so add that too. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* kernel: Fix paths for upstream kernel fsi driverJoel Stanley2017-07-071-2/+2
| | | | | | | | | While this may break users of the old kernel driver ABI, in reality they are already broken since d4f73e9be635 ("Reads and writes to the FSI bus are in bus-endian format, so we need to convert.") which hardcodes the modern ABI's endian requirements. Signed-off-by: Joel Stanley <joel@jms.id.au>
* src/main.c: Fixup thread step callAlistair Popple2017-06-281-5/+1
| | | | | | Fixes a compiler warning due to passing the wrong pointer type. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/cfam.c: Enable hmfsi portsAlistair Popple2017-06-285-1/+15
| | | | | | | | Errors on the hmfsi port can cause them to be disabled. So rather than relying on the host to enable the corresponding FSI ports enable them during probing of the downstream FSI link. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* pdbg: Re-add probe commandAlistair Popple2017-06-281-0/+46
| | | | | | | The update to targeting with device-tree broke probe function which shows detected/available targets. This was a useful function so add it back in. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg: Add support for P9 thread operationsAlistair Popple2017-06-2810-362/+781
| | | | | | | This patch adds support for starting and stopping threads on POWER9 as well as instruction ramming which is required to read/write GPRs, etc. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg: Add target index cacheAlistair Popple2017-06-283-8/+12
| | | | | | | | The target index is needed multiple times by code using the library. Rather than requiring parsing the device-tree each time it makes sense to cache the parsed value in the struct target. Signed-off-by: Alistair Popple <alistair@popple.id.au>
OpenPOWER on IntegriCloud