summaryrefslogtreecommitdiffstats
path: root/libpdbg
Commit message (Collapse)AuthorAgeFilesLines
* Rename struct target to struct pdbg_targetAlistair Popple2017-12-0615-84/+84
| | | | | | | 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>
* 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>
* 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>
* 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-221-2/+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-223-0/+879
| | | | | | | | | | | | 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>
* 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>
* 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-141-0/+118
| | | | | | | | 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>
* 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-314-0/+28
| | | | Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Makefile.am: Enable -Wall -Werror for libpdbgAlistair Popple2017-07-1410-31/+42
| | | | | | | 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>
* libpdbg: Add a more complete fake backendAlistair Popple2017-07-132-38/+66
| | | | | | | 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>
* libpdbg/cfam.c: Enable hmfsi portsAlistair Popple2017-06-281-1/+11
| | | | | | | | 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>
* libpdbg: Add support for P9 thread operationsAlistair Popple2017-06-286-307/+649
| | | | | | | 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-282-0/+4
| | | | | | | | 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>
* Reads and writes to the FSI bus are in bus-endian format, so we need toAlistair Popple2017-05-191-4/+6
| | | | | | convert. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add support for power9 putmem/getmemAlistair Popple2017-03-303-178/+253
| | | | Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Clean-up target configuration in preparation for adding P9 supportAlistair Popple2017-03-3013-526/+2076
| | | | | | | | | | The previous implementation of targeting was hardcoded, cumbersome and difficult to reconfigure for different chip types. This moves to a method of configuring targets using device-tree which is much easier to maintain and allows methods to be added to support operations like getmem on POWER9. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Merge pull request #17 from shenki/fix-commentapopple2017-03-071-1/+1
|\ | | | | bmcfsi: Fix Romulus pin mapping comment
| * bmcfsi: Fix Romulus pin mapping commentJoel Stanley2017-03-011-1/+1
| | | | | | | | Signed-off-by: Joel Stanley <joel@jms.id.au>
* | Fix CFAM address computing for OpenFSI.Dinesh Chinari2017-02-232-3/+3
|/ | | | | | | Modified the computing of OpenFSI CFAM address masking for putcfam and getcfam. Signed-off-by: Dinesh Chinari <chinari@us.ibm.com>
* libpdbg/kernel.c: Fix FSI address maskingAlistair Popple2017-02-221-2/+2
| | | | | | | | | | The FSI byte address conversion code was copied directly from bmcfsi.c. However the bmcfsi backend needs to set the slave-id directly where as the OpenFSI kernel driver takes it from the given address. So instead of masking off the upper two bits we need to pass them directly through to the kernel driver. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/kernel.c: Don't emit warnings for failure to read 0xc09Alistair Popple2017-02-211-1/+5
| | | | | | | | | The hmfsi attempts to read 0xc09 from every link to check if something is present on the link. This means we expect reads of 0x????c09 to occasionally fail. Future improvments to the probing code should eliminate these reads, but in the meantime silence the warnings. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libdbg: Introduce kernel FSI driver backendJoel Stanley2017-02-182-0/+186
| | | | | | | | | | | | Creatively named 'kernel', this uses the SoftFSI aka OpenFSI aka fsi kernel driver. This backend triggers a probe of all attached FSI devices by the kernel. This assumes a single slave appears in sysfs, and uses the 'raw' device to perform reads and writes directly to the CFAM address space and SCOM space. Signed-off-by: Joel Stanley <joel@jms.id.au>
* libpdbg/bmcfsi.c: Fix selection of p9r device typeAlistair Popple2017-01-191-0/+1
| | | | | | | | | | | Commit 4ecabf7 (libpdbg/bmcfsi.c: Add Zaius gpio pinout) introduced support for the Zaius platform. Unfortunately a break statement was missed which resulted in the Zaius pin mappings also being used for the Romulus target. Add the break statement so that the Romulus platform can be selected. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/bmcfsi: Update Zaius pin assignments for EVT2Xo Wang2017-01-101-2/+2
| | | | | | | | | | Update pin assignments for the board revision that replaces all current Zaius boards. The schematic indicates pins G0 and G1 for clock and data but contains an error that forced rework for all EVT2 and EVT3 boards to use C3 and C2 for FSI. Signed-off-by: Xo Wang <xow@google.com>
* libpdbg/bmcfsi.c: Add Zaius gpio pinoutXo Wang2016-12-132-1/+13
| | | | Signed-off-by: Xo Wang <xow@google.com>
* libpdbg/bmcfsi.c: Add Romulus gpio pinoutAlistair Popple2016-12-132-1/+15
| | | | Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/chip.c: Correct detection of chip typeAlistair Popple2016-12-081-1/+1
| | | | | | | The processor chip type was not being detected correctly resulting in attempts to probe unsupported system components. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* bmcfsi: Report read response CRC errors to stderrXo Wang2016-12-071-1/+1
| | | | | | | Putting CRC error messages into stderr helps with scripting that parses the output of pdbg. Signed-off-by: Xo Wang <xow@google.com>
* Add detection of chip typesAlistair Popple2016-12-028-5/+41
| | | | | | | Support detecting different chip types so we enable chip type dependent behaviour. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/bmcfsi.c: Support multiple GPIO backend mappingsAlistair Popple2016-12-022-68/+92
| | | | | | | Different boards have different FSI GPIO mappings. This adds support for selecting a board variant by passing -d to the bmcfsi backend. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Fix thread status checks during instruction rammingAlistair Popple2016-11-303-13/+5
| | | | | | | | | | | | Instructions can only be rammed into a thread is all threads on a chiplet are quiesced or sleeping. This was not properly enforced which leads to system checkstops when ramming threads if the chip isn't fully quiesced. This adds a check to ensure all threads are quiesced. It also changes the startchip/stopchip behaviour to stop all threads on the given chiplet regards of which threads are selected. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/adu.c: Implement a basic putmemAlistair Popple2016-11-282-0/+70
| | | | Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/chip.c: Add command to read virtual addressesAlistair Popple2016-11-222-10/+46
| | | | | | | | | Adds a command to read a 64-bit word from a given virtual address. The address is read in the current thread context and may cause an exception. In the case of exception it will be raised on the host when thread execution is resumed. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Add support for i2c access to secondary processorsAlistair Popple2016-10-2511-592/+1106
| | | | | | | | This includes better support for selecting targets, probing thread status and a number of other minor bugfixes. Also adds an option to print version numbers. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/adu.c: Remove ADU block sizeAlistair Popple2016-09-122-54/+18
| | | | | | | | The ADU always seems to return data in 8-byte chunks so rework the code to only read 8-byte data chunks and reformat into correct size in the output array. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Add new I2C backendAlistair Popple2016-09-093-1/+189
| | | | | | | | | It is also possible to access the host processor via an I2C bus. This proves to be both more reliable and quicker than bit-banging the FSI bus so add this as a new backend and make it the default access method. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Cleanup backend header fileAlistair Popple2016-09-093-22/+20
| | | | | | Rename bmcfsi.h to backend.h in preparation for adding new backends. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/bmcfsi.c: Fix up cranking of the SBEAlistair Popple2016-04-081-3/+11
| | | | | | | | | | | | The self boot engine (SBE) requires clocking when first powering on the system. The tool attempted to do this but it failed to correctly boot a system. This seemed to be due to sending the FSI break sequence afterwards. Instead move the FSI break sequence to the initialisation so that this tool can be used to boot the system. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg/bmcfsi: argp.h is unusedJoel Stanley2016-03-221-1/+0
| | | | | | | We can't build against ulibc with this. Luckily we don't use it, so remove the include. Signed-off-by: Joel Stanley <joel@jms.id.au>
* Add support for secondary processorsAlistair Popple2016-01-134-42/+69
| | | | | | | Adds the -p option to select secondary processors and the 'probe' command to detect which processors and threads are present. Signed-off-by: Alistair Popple <alistair@popple.id.au>
* Initial release of pdbgAlistair Popple2016-01-117-0/+1263
pdbg is a tool to access P8 host registers and memory from the BMC for kernel and firmware debugging purposes. Signed-off-by: Alistair Popple <alistair@popple.id.au>
OpenPOWER on IntegriCloud