summaryrefslogtreecommitdiffstats
path: root/libpdbg/device.c
Commit message (Collapse)AuthorAgeFilesLines
* libpdbg: Remove zalloc macroAlistair Popple2018-12-031-2/+1
| | | | | Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* device.c: Fix pdbg_target_addressAlistair Popple2018-11-091-5/+4
| | | | | | | | | | | | | | | | Commit 936dbdcedb27 ("libpdbg: Rework target addressing") introduced a bug leading to the following assertion failing: pdbg: libpdbg/device.c:634: pdbg_target_address: Assertion `(pos + n) <= p->len' failed. When this function was reworked the index parameter was dropped as every caller set index == 0. Removal should have also resulted in the local pos variable being removed. Instead it was set as if index == 1 resulting in the above violation. Fix the bug and add a test to check pdbg_target_address(). Signed-off-by: Alistair Popple <alistair@popple.id.au>
* libpdbg: Remove device.hAlistair Popple2018-11-091-2/+4
| | | | | Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Make dt_root privateAlistair Popple2018-11-091-4/+9
| | | | | Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Rework target compatibleAlistair Popple2018-11-091-26/+22
| | | | | | | | | Rework the target compatible code to reuse existing libpdbg code where possible. Renames and exports these functions for use by external libraries. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Remove old dt_prop functionsAlistair Popple2018-11-091-37/+2
| | | | | | | | | | The dt_prop functions were copied over from Skiboot. Rework and rename these to make use of the existing libpdbg property functions. These should not have been used by external projects so maintaining backwards compatibility is not a concern. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Rework target addressingAlistair Popple2018-11-091-6/+5
| | | | | | | | Clean up the target addressing functions and rename them to be consistent with other libpdbg function names. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Rework chip-id functionsAlistair Popple2018-11-091-19/+0
| | | | | | | | | Rename the chip-id functions to be consistent with other libpdbg function names and move them in with the rest of the general libpdbg code. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Rename property functionsAlistair Popple2018-11-091-3/+3
| | | | | | | | | | Some of the functions dealing with target properties have somewhat inconsistent naming. This patch renames them and adds #defines for backwards compatibility for external projects. These will be removed once older projects have moved over to the new names. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Move property code into libpdbg/device.cAlistair Popple2018-11-091-13/+59
| | | | | Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Make more declarations staticAlistair Popple2018-11-091-17/+39
| | | | | | | | Many of the functions in device.c are only used within that file and should be made static. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Remove unused codeAlistair Popple2018-11-091-262/+4
| | | | | | | | Much of the code in device.c was originally copied over from Skiboot and is not applicable or used by pdbg. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Rename dt_new_root to dt_new_nodeAmitay Isaacs2018-09-071-7/+2
| | | | | | | dt_new_root is not really creating a new root node. It's just creating a new node that is not attached to the tree. Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg/device: Add new targets in the order of traversalAmitay Isaacs2018-05-241-1/+1
| | | | | | This automatically sorts targets in increasing index order. Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Start using pdbg logging apiAmitay Isaacs2018-05-181-2/+1
| | | | Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
* libpdbg: Lazy probingCyril Bur2018-04-261-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When libpdbg runs though the device tree and calls probe() on all the targets it marks any node (and all its children) which fails to probe as "disabled". When pdbg recieves arguments to specifiy a pib, core or thread (-p -c -t) it runs though the device tree and marks nodes which do not match the specified -p -c or -t as "disabled". These two scenarios are related - that is we don't want to be operating on any disabled nodes. However, they are not the same. Consider HTM wanting to know if the machine has powersave disabled. A simple way would be to loop through all the threads and if any of them are not in "active" state then powersave must be enabled. In this scenario HTM want to be able to get the status of every thread on the machine regardless of -p -c -t flags but if the machine isn't fully speced out and has cores which didn't probe, HTM wants to know to ignore those threads. This patch introduces a "nonexistant" pdbg target status which is set during libpdbg probe() time. Later pdbg can mark nodes to targets that do 'exist' but it would like to avoid as "disabled". Attempting to solve the above problem with only a "nonexistant" flag would also require everything to be probed before selecting out chips and threads that the user is not interested in. This would be highly inefficient. This patch probes the system lazily. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
* libpdbg: Move struct dt_node into struct pdbg_targetCyril Bur2018-04-241-78/+124
| | | | | | | | | | | Currently we have this terrible mess of dt_nodes pointing to targets and targets pointing to dt_nodes. This has been the cause of bugs due to folling NULL pointers from a target expecting a node and vice versa. Consolidating these structs means that there must be a node for a target. Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
* libpdbg/device: Remove unused device tree functionsCyril Bur2018-04-241-106/+0
| | | | | | None of these are likely to ever get used 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-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>
* Look for 'chip-id' as opposed to 'ibm,chip-id'Cyril Bur2017-09-221-1/+1
| | | | | | | | | 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>
* Makefile.am: Enable -Wall -Werror for libpdbgAlistair Popple2017-07-141-1/+1
| | | | | | | 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>
* Clean-up target configuration in preparation for adding P9 supportAlistair Popple2017-03-301-0/+943
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>
OpenPOWER on IntegriCloud