| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
|
|
|
|
|
| |
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
This automatically sorts targets in increasing index order.
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
None of these are likely to ever get used
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
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>
|