[RFC,12/12] libpdbg: Split system and backend definitions
diff mbox series

Message ID 20190806013723.4047-13-alistair@popple.id.au
State New
Headers show
Series
  • Split backends from system description
Related show

Checks

Context Check Description
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d0a0d919cccbd69631aaef0d37f1dba8d53e86e0)

Commit Message

Alistair Popple Aug. 6, 2019, 1:37 a.m. UTC
Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 Makefile.am            | 33 ++++++--------
 cronus-backend.dts.m4  | 28 ++++++++++++
 host-backend.dts.m4    | 46 ++++++++++++++++++++
 libpdbg/dtb.c          | 97 +++++++++++++++++++++++++++++-------------
 obmc-backend.dts.m4    | 36 ++++++++++++++++
 p8-fsi-backend.dts.m4  | 32 ++++++++++++++
 p8-i2c-backend.dts.m4  | 22 ++++++++++
 p8-pib.dts.m4          | 17 ++++++++
 p8.dts.m4              | 71 +++++++++++++++++++++++++++++++
 p9-fsi.dtsi.m4         | 43 -------------------
 p9-pib.dts.m4          |  4 ++
 p9.dts.m4              | 80 ++++++++++++++++++++++++++++++++++
 p9r-fsi-backend.dts.m4 | 32 ++++++++++++++
 p9r-fsi.dts.m4         | 16 -------
 p9w-fsi-backend.dts.m4 | 32 ++++++++++++++
 p9w-fsi.dts.m4         | 16 -------
 p9z-fsi-backend.dts.m4 | 32 ++++++++++++++
 p9z-fsi.dts.m4         | 16 -------
 src/main.c             |  1 +
 19 files changed, 514 insertions(+), 140 deletions(-)
 create mode 100644 cronus-backend.dts.m4
 create mode 100644 host-backend.dts.m4
 create mode 100644 obmc-backend.dts.m4
 create mode 100644 p8-fsi-backend.dts.m4
 create mode 100644 p8-i2c-backend.dts.m4
 create mode 100644 p8.dts.m4
 delete mode 100644 p9-fsi.dtsi.m4
 create mode 100644 p9.dts.m4
 create mode 100644 p9r-fsi-backend.dts.m4
 delete mode 100644 p9r-fsi.dts.m4
 create mode 100644 p9w-fsi-backend.dts.m4
 delete mode 100644 p9w-fsi.dts.m4
 create mode 100644 p9z-fsi-backend.dts.m4
 delete mode 100644 p9z-fsi.dts.m4

Comments

Amitay Isaacs Aug. 20, 2019, 4:14 a.m. UTC | #1
I like the renaming of device trees to appropriate backends.

The actual contents of the device trees need a bit of work as per the
new scheme.  For now, each backend should be complete with chip-level
targets and having the right hierarchy (based on the backend).

We need sbefifo backend as well.  Now I have a libsbefifo library
(similar to libcronus) which implements all the marshalling details and
implements all the chip-ops.

I can post the patches with libsbefifo once we add the sbefifo backend.


On Tue, 2019-08-06 at 11:37 +1000, Alistair Popple wrote:
> Signed-off-by: Alistair Popple <alistair@popple.id.au>
> ---
>  Makefile.am            | 33 ++++++--------
>  cronus-backend.dts.m4  | 28 ++++++++++++
>  host-backend.dts.m4    | 46 ++++++++++++++++++++
>  libpdbg/dtb.c          | 97 +++++++++++++++++++++++++++++-----------
> --
>  obmc-backend.dts.m4    | 36 ++++++++++++++++
>  p8-fsi-backend.dts.m4  | 32 ++++++++++++++
>  p8-i2c-backend.dts.m4  | 22 ++++++++++
>  p8-pib.dts.m4          | 17 ++++++++
>  p8.dts.m4              | 71 +++++++++++++++++++++++++++++++
>  p9-fsi.dtsi.m4         | 43 -------------------
>  p9-pib.dts.m4          |  4 ++
>  p9.dts.m4              | 80 ++++++++++++++++++++++++++++++++++
>  p9r-fsi-backend.dts.m4 | 32 ++++++++++++++
>  p9r-fsi.dts.m4         | 16 -------
>  p9w-fsi-backend.dts.m4 | 32 ++++++++++++++
>  p9w-fsi.dts.m4         | 16 -------
>  p9z-fsi-backend.dts.m4 | 32 ++++++++++++++
>  p9z-fsi.dts.m4         | 16 -------
>  src/main.c             |  1 +
>  19 files changed, 514 insertions(+), 140 deletions(-)
>  create mode 100644 cronus-backend.dts.m4
>  create mode 100644 host-backend.dts.m4
>  create mode 100644 obmc-backend.dts.m4
>  create mode 100644 p8-fsi-backend.dts.m4
>  create mode 100644 p8-i2c-backend.dts.m4
>  create mode 100644 p8.dts.m4
>  delete mode 100644 p9-fsi.dtsi.m4
>  create mode 100644 p9.dts.m4
>  create mode 100644 p9r-fsi-backend.dts.m4
>  delete mode 100644 p9r-fsi.dts.m4
>  create mode 100644 p9w-fsi-backend.dts.m4
>  delete mode 100644 p9w-fsi.dts.m4
>  create mode 100644 p9z-fsi-backend.dts.m4
>  delete mode 100644 p9z-fsi.dts.m4
> 
> diff --git a/Makefile.am b/Makefile.am
> index 0f2906a..14b0a6c 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -35,19 +35,17 @@ AM_CFLAGS = -I$(top_srcdir)/ccan/array_size -Wall
> -Werror -O2
>  
>  EXTRA_DIST = \
>  	fake.dts.m4 \
> -	backend.dts.m4 \
> -	p8-fsi.dts.m4 \
> -	p8-host.dts.m4 \
> -	p8-i2c.dts.m4 \
> -	p8-kernel.dts.m4 \
>  	p8-pib.dts.m4 \
> -	p9-fsi.dtsi.m4 \
> -	p9-host.dts.m4 \
> -	p9-kernel.dts.m4 \
>  	p9-pib.dts.m4 \
> -	p9r-fsi.dts.m4 \
> -	p9w-fsi.dts.m4 \
> -	p9z-fsi.dts.m4 \
> +	p8-fsi-backend.dts.m4 \
> +	p9r-fsi-backend.dts.m4 \
> +	p9w-fsi-backend.dts.m4 \
> +	p9z-fsi-backend.dts.m4 \
> +	p9.dts.m4 \
> +	p8.dts.m4 \
> +	obmc-backend.dts.m4 \
> +	host-backend.dts.m4 \
> +	cronus-backend.dts.m4 \
>  	template.S \
>  	generate_dt_header.sh \
>  	src/gdb_parser.rl \
> @@ -64,10 +62,10 @@ if TARGET_PPC
>  ARCH_FLAGS="-DTARGET_PPC=1"
>  endif
>  
> -DT = fake.dts backend.dts p8-cronus.dts p9-cronus.dts \
> -     p8-fsi.dts p8-i2c.dts p8-kernel.dts \
> -     p9w-fsi.dts p9r-fsi.dts p9z-fsi.dts p9-kernel.dts \
> -     p8-host.dts p9-host.dts
> +DT = fake.dts \
> +     p9w-fsi-backend.dts p9r-fsi-backend.dts p9z-fsi-backend.dts p8-
> fsi-backend.dts \
> +     p8.dts p9.dts p8-i2c-backend.dts \
> +     obmc-backend.dts host-backend.dts cronus-backend.dts
>  
>  DT_sources = $(DT:.dts=.dtb.S)
>  DT_headers = $(DT:.dts=.dt.h)
> @@ -253,11 +251,6 @@ RAGEL_V_0 = @echo "  RAGEL   " $@;
>  %.dtsi: %.dtsi.m4
>  	$(M4_V)$(M4) -I$(dir $<) $< > $@
>  
> -p9-fsi.dtsi: p9-fsi.dtsi.m4 p9-pib.dts.m4
> -p9w-fsi.dts: p9w-fsi.dts.m4 p9-fsi.dtsi
> -p9r-fsi.dts: p9r-fsi.dts.m4 p9-fsi.dtsi
> -p9z-fsi.dts: p9z-fsi.dts.m4 p9-fsi.dtsi
> -
>  %.dtb: %.dts
>  	$(DTC_V)$(DTC) -i$(dir $@) -I dts $< -O dtb > $@
>  
> diff --git a/cronus-backend.dts.m4 b/cronus-backend.dts.m4
> new file mode 100644
> index 0000000..aa31f85
> --- /dev/null
> +++ b/cronus-backend.dts.m4
> @@ -0,0 +1,28 @@
> +/dts-v1/;
> +
> +/ {
> +	fsi@0 {
> +		compatible = "ibm,cronus-fsi";
> +		system-path = "/proc@0/fsi@0";
> +	};
> +
> +	pib@0 {
> +		compatible = "ibm,cronus-pib";
> +		system-path = "/proc@0/pib@0";
> +	};
> +
> +	mem@0 {
> +		system-path = "/mem@0";
> + 		target = "/proc@0/pib@0/adu@90000";
> +	};
> +
> +	fsi@1 {
> +		compatible = "ibm,cronus-fsi";
> +		system-path = "/proc@1/fsi@0";
> +	};
> +
> +	pib@1 {
> +		compatible = "ibm,cronus-pib";
> +		system-path = "/proc@1/pib@1";
> +	};
> +};
> diff --git a/host-backend.dts.m4 b/host-backend.dts.m4
> new file mode 100644
> index 0000000..a188045
> --- /dev/null
> +++ b/host-backend.dts.m4
> @@ -0,0 +1,46 @@
> +define(`HOST_PIB',`
> +	pib@$1 {
> +	      #address-cells = <0x2>;
> +	      #size-cells = <0x1>;
> +	      compatible = "ibm,host-pib";
> +	      reg = <$1>;
> +	      index = <$1>;
> +	      system-path = "/proc@$1/pib@$1";
> +	}')dnl
> +
> +/dts-v1/;
> +
> +/ {
> +	HOST_PIB(0);
> +	HOST_PIB(1);
> +	HOST_PIB(2);
> +	HOST_PIB(3);
> +	HOST_PIB(4);
> +	HOST_PIB(5);
> +	HOST_PIB(6);
> +	HOST_PIB(7);
> +	HOST_PIB(8);
> +	HOST_PIB(9);
> +	HOST_PIB(10);
> +	HOST_PIB(11);
> +	HOST_PIB(12);
> +	HOST_PIB(13);
> +	HOST_PIB(14);
> +	HOST_PIB(15);
> +	HOST_PIB(16);
> +	HOST_PIB(17);
> +	HOST_PIB(18);
> +	HOST_PIB(19);
> +	HOST_PIB(20);
> +	HOST_PIB(21);
> +	HOST_PIB(22);
> +	HOST_PIB(23);
> +	HOST_PIB(24);
> +	HOST_PIB(25);
> +	HOST_PIB(26);
> +	HOST_PIB(27);
> +	HOST_PIB(28);
> +	HOST_PIB(29);
> +	HOST_PIB(30);
> +	HOST_PIB(31);
> +};
> diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c
> index f6b235f..98ca374 100644
> --- a/libpdbg/dtb.c
> +++ b/libpdbg/dtb.c
> @@ -30,18 +30,17 @@
>  
>  #include "fake.dt.h"
>  
> -#include "p8-i2c.dt.h"
> -#include "p8-fsi.dt.h"
> -#include "p8-kernel.dt.h"
> -#include "p9w-fsi.dt.h"
> -#include "p9r-fsi.dt.h"
> -#include "p9z-fsi.dt.h"
> -#include "p9-kernel.dt.h"
> -#include "p8-host.dt.h"
> -#include "p9-host.dt.h"
> -#include "p8-cronus.dt.h"
> -#include "p9-cronus.dt.h"
> -#include "backend.dt.h"
> +#include "p9.dt.h"
> +#include "p8.dt.h"
> +
> +#include "obmc-backend.dt.h"
> +#include "host-backend.dt.h"
> +#include "cronus-backend.dt.h"
> +#include "p8-fsi-backend.dt.h"
> +#include "p8-i2c-backend.dt.h"
> +#include "p9w-fsi-backend.dt.h"
> +#include "p9r-fsi-backend.dt.h"
> +#include "p9z-fsi-backend.dt.h"
>  
>  #define AMI_BMC "/proc/ractrends/Helper/FwInfo"
>  #define OPENFSI_BMC "/sys/bus/platform/devices/gpio-fsi/fsi0/"
> @@ -85,9 +84,9 @@ static void *ppc_target(void)
>  	FILE *cpuinfo;
>  
>  	if (!strcmp(pdbg_backend_option, "p8"))
> -		return &_binary_p8_host_dtb_o_start;
> +		return &_binary_p8_dtb_o_start;
>  	else if (!strcmp(pdbg_backend_option, "p9"))
> -		return &_binary_p9_host_dtb_o_start;
> +		return &_binary_p9_dtb_o_start;
>  
>  	cpuinfo = fopen("/proc/cpuinfo", "r");
>  	if (!cpuinfo)
> @@ -114,12 +113,12 @@ static void *ppc_target(void)
>  
>  	if (strncmp(pos, "POWER8", 6) == 0) {
>  		pdbg_log(PDBG_INFO, "Found a POWER8 PPC host
> system\n");
> -		return &_binary_p8_host_dtb_o_start;
> +		return &_binary_p8_dtb_o_start;
>  	}
>  
>  	if (strncmp(pos, "POWER9", 6) == 0) {
>  		pdbg_log(PDBG_INFO, "Found a POWER9 PPC host
> system\n");
> -		return &_binary_p9_host_dtb_o_start;
> +		return &_binary_p9_dtb_o_start;
>  	}
>  
>  	pdbg_log(PDBG_ERROR, "Unsupported CPU type '%s'\n", pos);
> @@ -160,13 +159,13 @@ static void *bmc_target(void)
>  	switch(chip_id) {
>  	case CHIP_ID_P9:
>  		pdbg_log(PDBG_INFO, "Found a POWER9 OpenBMC based
> system\n");
> -		return &_binary_p9_kernel_dtb_o_start;
> +		return &_binary_p9_dtb_o_start;
>  		break;
>  
>  	case CHIP_ID_P8:
>  	case CHIP_ID_P8P:
>  		pdbg_log(PDBG_INFO, "Found a POWER8/8+ OpenBMC based
> system\n");
> -		return &_binary_p8_kernel_dtb_o_start;
> +		return &_binary_p8_dtb_o_start;
>  		break;
>  
>  	default:
> @@ -239,7 +238,7 @@ void *pdbg_default_dtb(void)
>  	case PDBG_BACKEND_I2C:
>  		/* I2C is only supported on POWER8 */
>  		pdbg_log(PDBG_INFO, "Found a POWER8 AMI BMC based
> system\n");
> -		return &_binary_p8_i2c_dtb_o_start;
> +		return &_binary_p8_dtb_o_start;
>  		break;
>  
>  	case PDBG_BACKEND_KERNEL:
> @@ -254,13 +253,9 @@ void *pdbg_default_dtb(void)
>  		}
>  
>  		if (!strcmp(pdbg_backend_option, "p8"))
> -			return &_binary_p8_fsi_dtb_o_start;
> -		else if (!strcmp(pdbg_backend_option, "p9w"))
> -			return &_binary_p9w_fsi_dtb_o_start;
> -		else if (!strcmp(pdbg_backend_option, "p9r"))
> -			return &_binary_p9r_fsi_dtb_o_start;
> -		else if (!strcmp(pdbg_backend_option, "p9z"))
> -			return &_binary_p9z_fsi_dtb_o_start;
> +			return &_binary_p8_dtb_o_start;
> +		else if (!strncmp(pdbg_backend_option, "p9", 2))
> +			return &_binary_p9_dtb_o_start;
>  		else {
>  			pdbg_log(PDBG_ERROR, "Invalid device type
> specified\n");
>  			pdbg_log(PDBG_ERROR, "Use 'p8' or
> 'p9r/p9w/p9z'\n");
> @@ -277,9 +272,9 @@ void *pdbg_default_dtb(void)
>  		}
>  
>  		if (!strncmp(pdbg_backend_option, "p8", 2))
> -			return &_binary_p8_cronus_dtb_o_start;
> +			return &_binary_p8_dtb_o_start;
>  		else if (!strncmp(pdbg_backend_option, "p9", 2))
> -			return &_binary_p9_cronus_dtb_o_start;
> +			return &_binary_p9_dtb_o_start;
>  		else {
>  			pdbg_log(PDBG_ERROR, "Invalid device type
> specified\n");
>  			pdbg_log(PDBG_ERROR, "Use p8@<server> or
> p9@<server>\n");
> @@ -300,5 +295,49 @@ void *pdbg_default_dtb(void)
>  
>  void *pdbg_default_backend_dtb(void)
>  {
> -	return &_binary_backend_dtb_o_start;
> +	char *dtb = getenv("PDBG_BACKEND_DTB");
> +
> +	if (dtb)
> +		return mmap_dtb(dtb);
> +
> +	switch(pdbg_backend) {
> +	case PDBG_BACKEND_HOST:
> +		return &_binary_host_backend_dtb_o_start;
> +		break;
> +
> +	case PDBG_BACKEND_I2C:
> +		return &_binary_p8_i2c_backend_dtb_o_start;
> +		break;
> +
> +	case PDBG_BACKEND_KERNEL:
> +		return &_binary_obmc_backend_dtb_o_start;
> +		break;
> +
> +	case PDBG_BACKEND_FSI:
> +		if (!strcmp(pdbg_backend_option, "p9w"))
> +			return &_binary_p9w_fsi_backend_dtb_o_start;
> +		else if (!strcmp(pdbg_backend_option, "p9r"))
> +			return &_binary_p9r_fsi_backend_dtb_o_start;
> +		else if (!strcmp(pdbg_backend_option, "p9z"))
> +			return &_binary_p9z_fsi_backend_dtb_o_start;
> +		else if (!strcmp(pdbg_backend_option, "p8"))
> +			return &_binary_p8_fsi_backend_dtb_o_start;
> +		else
> +			/* pdbg_default_dtb() should already have
> +			 * logged an error */
> +			return NULL;
> +		break;
> +
> +	case PDBG_BACKEND_CRONUS:
> +		return &_binary_cronus_backend_dtb_o_start;
> +		break;
> +
> +	case PDBG_BACKEND_FAKE:
> +		break;
> +
> +	default:
> +		assert(0);
> +	}
> +
> +	return NULL;
>  }
> diff --git a/obmc-backend.dts.m4 b/obmc-backend.dts.m4
> new file mode 100644
> index 0000000..a28ef68
> --- /dev/null
> +++ b/obmc-backend.dts.m4
> @@ -0,0 +1,36 @@
> +/dts-v1/;
> +
> +/ {
> +	fsi@0 {
> +		compatible = "ibm,kernel-fsi";
> +		system-path = "/proc@0/fsi@0";
> +	};
> +
> +	pib@0 {
> +		compatible = "ibm,kernel-pib";
> +		system-path = "/proc@0/pib@0";
> +		device-path = "/dev/scom1";
> +	};
> +
> +	sbefifo@0 {
> +		compatible = "ibm,kernel-sbefifo";
> +		device-path = "/dev/sbefifo1";
> +		system-path = "/proc@0/fsi@0/sbefifo@0";
> +	};
> +
> +	mem@0 {
> +		system-path = "/mem@0";
> + 		target = "/proc@0/fsi@0/sbefifo@0/sbefifo-mem@0";
> +	};
> +
> +	fsi@1 {
> +		compatible = "ibm,kernel-fsi";
> +		system-path = "/proc@1/fsi@0";
> +	};
> +
> +	pib@1 {
> +		compatible = "ibm,kernel-pib";
> +		system-path = "/proc@1/pib@1";
> +		device-path = "/dev/scom2";
> +	};
> +};
> diff --git a/p8-fsi-backend.dts.m4 b/p8-fsi-backend.dts.m4
> new file mode 100644
> index 0000000..fa5f1f4
> --- /dev/null
> +++ b/p8-fsi-backend.dts.m4
> @@ -0,0 +1,32 @@
> +/dts-v1/;
> +
> +/ {
> +	fsi@0 {
> +		compatible = "ibm,bmcfsi";
> +
> +		/* GPIO pin definitions */
> +		fsi_clk = <0x0 0x4>;		/* A4 */
> +		fsi_dat = <0x0 0x5>; 		/* A5 */
> +		fsi_dat_en = <0x20 0x1e>;	/* H6 */
> +		fsi_enable = <0x0 0x18>;	/* D0 */
> +		cronus_sel = <0x0 0x6>;		/* A6 */
> +		clock_delay = <0x14>;
> +
> +		system-path = "/proc@0/fsi@0";
> +	};
> +
> +	pib@0 {
> +		target = "/proc@0/fsi@0/pib@0";
> +		system-path = "/proc@0/pib@0";
> +	};
> +
> +	fsi@1 {
> +		target = "/proc@0/pib@0/opb@0/hmfsi@1";
> +		system-path = "/proc@1/fsi@1";
> +	};
> +
> +	pib@1 {
> +		target = "/proc@1/fsi@1/pib@1";
> +		system-path = "/proc@1/pib@1";
> +	};
> +};
> diff --git a/p8-i2c-backend.dts.m4 b/p8-i2c-backend.dts.m4
> new file mode 100644
> index 0000000..ffd0b06
> --- /dev/null
> +++ b/p8-i2c-backend.dts.m4
> @@ -0,0 +1,22 @@
> +/dts-v1/;
> +
> +/ {
> +	pib@0 {
> +		compatible = "ibm,power8-i2c-slave";
> +		bus = "/dev/i2c4";
> +		reg = <0x50>;
> +		index = <0x0>;
> +
> +		system-path = "/proc@0/pib@0";
> +	};
> +
> +	fsi@1 {
> +		target = "/proc@0/pib@0/opb@20010/hmfsi@0";
> +		system-path = "/proc@1/fsi@1";
> +	};
> +
> +	pib@1 {
> +		target = "/proc@1/fsi@1/pib@1000";
> +		system-path = "/proc@1/pib@1";
> +	};
> +};
> diff --git a/p8-pib.dts.m4 b/p8-pib.dts.m4
> index 82d11d8..b648d3a 100644
> --- a/p8-pib.dts.m4
> +++ b/p8-pib.dts.m4
> @@ -52,4 +52,21 @@ nhtm@2010880 {
>  	index = <0x0>;
>  };
>  
> +opb@0 {
> +	#address-cells = <0x1>;
> +        #size-cells = <0x1>;
> +        reg = <0x0 0x20010 0xa>;
> +        compatible = "ibm,power8-opb";
> +	index = <0x0>;
> +
> +        hmfsi@1 {
> +                #address-cells = <0x2>;
> +                #size-cells = <0x1>;
> +                compatible = "ibm,power8-opb-hmfsi";
> +                reg = <0x180000 0x80000>;
> +                port = <0x2>;
> +                index = <0x1>;
> +	};
> +};
> +
>  PROC_CORES;
> diff --git a/p8.dts.m4 b/p8.dts.m4
> new file mode 100644
> index 0000000..320bd0c
> --- /dev/null
> +++ b/p8.dts.m4
> @@ -0,0 +1,71 @@
> +define(`PIB',`
> +	pib@$1 {
> +	      #address-cells = <0x2>;
> +	      #size-cells = <0x1>;
> +	      reg = <$1>;
> +	      index = <$1>;
> +	      class = "pib";
> +	      include(p8-pib.dts.m4)dnl
> +	}')dnl
> +
> +define(`PROC',`
> +	proc@$1 {
> +		class = "proc";
> +		index = <$1>;
> +		PIB($1);
> +
> +		fsi@$1 {
> +                        #address-cells = <0x2>;
> +                	#size-cells = <0x1>;
> +			class = "fsi";
> +		        index = <$1>;
> +
> +			pib@$1 {
> +                        	#address-cells = <0x2>;
> +                                #size-cells = <0x1>;
> +                                reg = <0x0 0x1000 0x7>;
> +			        index = <$1>;
> +				compatible = "ibm,fsi-pib";
> +		       };
> +		};
> +	}')dnl
> +
> +/dts-v1/;
> +
> +/ {
> +	#address-cells = <0x1>;
> +	#size-cells = <0x0>;
> +
> +	PROC(0);
> +	PROC(1);
> +	PROC(2);
> +	PROC(3);
> +	PROC(4);
> +	PROC(5);
> +	PROC(6);
> +	PROC(7);
> +	PROC(8);
> +	PROC(9);
> +	PROC(10);
> +	PROC(11);
> +	PROC(12);
> +	PROC(13);
> +	PROC(14);
> +	PROC(15);
> +	PROC(16);
> +	PROC(17);
> +	PROC(18);
> +	PROC(19);
> +	PROC(20);
> +	PROC(21);
> +	PROC(22);
> +	PROC(23);
> +	PROC(24);
> +	PROC(25);
> +	PROC(26);
> +	PROC(27);
> +	PROC(28);
> +	PROC(29);
> +	PROC(30);
> +	PROC(31);
> +};
> diff --git a/p9-fsi.dtsi.m4 b/p9-fsi.dtsi.m4
> deleted file mode 100644
> index afa7d39..0000000
> --- a/p9-fsi.dtsi.m4
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -
> -/ {
> -	#address-cells = <0x1>;
> -	#size-cells = <0x0>;
> -
> -	fsi0: fsi@0 {
> -		#address-cells = <0x2>;
> -		#size-cells = <0x1>;
> -		compatible = "ibm,bmcfsi";
> -		reg = <0x0 0x0 0x0>;
> -
> -		index = <0x0>;
> -		status = "mustexist";
> -
> -		pib@1000 {
> -			 #address-cells = <0x2>;
> -			 #size-cells = <0x1>;
> -			 reg = <0x0 0x1000 0x7>;
> -			 index = <0x0>;
> -			 compatible = "ibm,fsi-pib", "ibm,power9-fsi-
> pib";
> -			 include(p9-pib.dts.m4)dnl
> -		};
> -
> -		hmfsi@100000 {
> -			#address-cells = <0x2>;
> -			#size-cells = <0x1>;
> -			compatible = "ibm,fsi-hmfsi";
> -			reg = <0x0 0x100000 0x8000>;
> -			port = <0x1>;
> -			index = <0x1>;
> -
> -			pib@1000 {
> -				#address-cells = <0x2>;
> -				#size-cells = <0x1>;
> -				reg = <0x0 0x1000 0x7>;
> -				index = <0x1>;
> -				compatible = "ibm,fsi-pib",
> "ibm,power9-fsi-pib";
> -				include(p9-pib.dts.m4)dnl
> -			};
> -		};
> -
> -	};
> -};
> diff --git a/p9-pib.dts.m4 b/p9-pib.dts.m4
> index 3a99157..173fa2f 100644
> --- a/p9-pib.dts.m4
> +++ b/p9-pib.dts.m4
> @@ -35,6 +35,10 @@ index = <HEX(eval($1, 16))>;
>  reg = <0x0 HEX(CHIPLET_BASE($1)) 0xfffff>;
>  }')dnl
>  
> +adu@90000 {
> +          compatible = "ibm,power9-adu";
> +          reg = <0x0 0x90000 0x5>;
> +};
>  
>  htm@5012880 {
>  	compatible = "ibm,power9-nhtm";
> diff --git a/p9.dts.m4 b/p9.dts.m4
> new file mode 100644
> index 0000000..25f15c0
> --- /dev/null
> +++ b/p9.dts.m4
> @@ -0,0 +1,80 @@
> +/dts-v1/;
> +
> +/ {
> +	#address-cells = <0x1>;
> +	#size-cells = <0x0>;
> +
> +	proc@0 {
> +		index = <0x0>;
> +		class = "proc";
> +
> +		pib@0 {
> +			#address-cells = <0x2>;
> +			#size-cells = <0x1>;
> +
> +			index = <0x0>;
> +			class = "pib";
> +			include(p9-pib.dts.m4)dnl
> +		};
> +
> +		fsi@0 {
> +			#address-cells = <0x2>;
> +			#size-cells = <0x1>;
> +
> +		      	index = <0x0>;
> +			class = "fsi";
> +
> +			pib@1000 {
> +				 reg = < 0x00 0x1000 0x07 >;
> +				 index = < 0x00 >;
> +				 compatible = "ibm,fsi-pib",
> "ibm,power9-fsi-pib";
> +			};
> +
> +			hmfsi@100000 {
> +				#address-cells = <0x2>;
> +				#size-cells = <0x1>;
> +				compatible = "ibm,fsi-hmfsi";
> +				reg = <0x0 0x100000 0x8000>;
> +				port = <0x1>;
> +				index = <0x1>;
> +			};
> +
> +			sbefifo@2400 {
> +				reg = <0x0 0x2400 0x7>;
> +				index = <0x0>;
> +
> +				sbefifo-mem@0 {
> +					index = <0x0>;
> +					compatible = "ibm,sbefifo-mem";
> +				};
> +			};
> +		};
> +	};
> +
> +	proc@1 {
> +		index = <0x1>;
> +		class = "proc";
> +
> +		pib@1 {
> +			#address-cells = <0x2>;
> +			#size-cells = <0x1>;
> +
> +		      	index = <0x1>;
> +			class = "pib";
> +			include(p9-pib.dts.m4)dnl
> +		};
> +
> +		fsi@0 {
> +			#address-cells = <0x2>;
> +			#size-cells = <0x1>;
> +
> +			index = <0x1>;
> +			class = "fsi";
> +		};
> +	};
> +
> +	mem@0 {
> +	      index = <0x0>;
> +	      class = "mem";
> +	};
> +};
> diff --git a/p9r-fsi-backend.dts.m4 b/p9r-fsi-backend.dts.m4
> new file mode 100644
> index 0000000..1630823
> --- /dev/null
> +++ b/p9r-fsi-backend.dts.m4
> @@ -0,0 +1,32 @@
> +/dts-v1/;
> +
> +/ {
> +	fsi@0 {
> +		compatible = "ibm,bmcfsi";
> +
> +		/* GPIO pin definitions */
> +		fsi_clk = <0x1e0 0x10>;		/* AA0 */
> +		fsi_dat = <0x1e0 0x12>;		/* AA2 */
> +		fsi_dat_en = <0x80 0xa>;	/* R2 */
> +		fsi_enable = <0x0 0x18>;	/* D0 */
> +		cronus_sel = <0x0 0x6>;		/* A6 */
> +		clock_delay = <0x14>;
> +
> +		system-path = "/proc@0/fsi@0";
> +	};
> +
> +	pib@0 {
> +		target = "/proc@0/fsi@0/pib@1000";
> +		system-path = "/proc@0/pib@0";
> +	};
> +
> +	fsi@1 {
> +		target = "/proc@0/fsi@0/hmfsi@0";
> +		system-path = "/proc@1/fsi@1";
> +	};
> +
> +	pib@1 {
> +		target = "/proc@1/fsi@1/pib@1000";
> +		system-path = "/proc@1/pib@1";
> +	};
> +};
> diff --git a/p9r-fsi.dts.m4 b/p9r-fsi.dts.m4
> deleted file mode 100644
> index 2165bae..0000000
> --- a/p9r-fsi.dts.m4
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -/dts-v1/;
> -
> -/include/ "p9-fsi.dtsi"
> -
> -/ {
> -};
> -
> -&fsi0 {
> -	/* GPIO pin definitions */
> -	fsi_clk = <0x1e0 0x10>;		/* AA0 */
> -	fsi_dat = <0x1e0 0x12>;		/* AA2 */
> -	fsi_dat_en = <0x80 0xa>;	/* R2 */
> -	fsi_enable = <0x0 0x18>;	/* D0 */
> -	cronus_sel = <0x0 0x6>;		/* A6 */
> -	clock_delay = <0x14>;
> -};
> diff --git a/p9w-fsi-backend.dts.m4 b/p9w-fsi-backend.dts.m4
> new file mode 100644
> index 0000000..2696459
> --- /dev/null
> +++ b/p9w-fsi-backend.dts.m4
> @@ -0,0 +1,32 @@
> +/dts-v1/;
> +
> +/ {
> +	fsi@0 {
> +		compatible = "ibm,bmcfsi";
> +
> +		/* GPIO pin definitions */
> +		fsi_clk = <0x1e0 0x10>;		/* AA0 */
> +		fsi_dat = <0x20 0x0>; 		/* E0 */
> +		fsi_dat_en = <0x80 0xa>;	/* R2 */
> +		fsi_enable = <0x0 0x18>;	/* D0 */
> +		cronus_sel = <0x0 0x6>;		/* A6 */
> +		clock_delay = <0x14>;
> +
> +		system-path = "/proc@0/fsi@0";
> +	};
> +
> +	pib@0 {
> +		target = "/proc@0/fsi@0/pib@1000";
> +		system-path = "/proc@0/pib@0";
> +	};
> +
> +	fsi@1 {
> +		target = "/proc@0/fsi@0/hmfsi@0";
> +		system-path = "/proc@1/fsi@1";
> +	};
> +
> +	pib@1 {
> +		target = "/proc@1/fsi@1/pib@1000";
> +		system-path = "/proc@1/pib@1";
> +	};
> +};
> diff --git a/p9w-fsi.dts.m4 b/p9w-fsi.dts.m4
> deleted file mode 100644
> index 224c665..0000000
> --- a/p9w-fsi.dts.m4
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -/dts-v1/;
> -
> -/include/ "p9-fsi.dtsi"
> -
> -/ {
> -};
> -
> -&fsi0 {
> -	/* GPIO pin definitions */
> -	fsi_clk = <0x1e0 0x10>;		/* AA0 */
> -	fsi_dat = <0x20 0x0>; 		/* E0 */
> -	fsi_dat_en = <0x80 0xa>;	/* R2 */
> -	fsi_enable = <0x0 0x18>;	/* D0 */
> -	cronus_sel = <0x0 0x6>;		/* A6 */
> -	clock_delay = <0x14>;
> -};
> diff --git a/p9z-fsi-backend.dts.m4 b/p9z-fsi-backend.dts.m4
> new file mode 100644
> index 0000000..d0956cf
> --- /dev/null
> +++ b/p9z-fsi-backend.dts.m4
> @@ -0,0 +1,32 @@
> +/dts-v1/;
> +
> +/ {
> +	fsi@0 {
> +		compatible = "ibm,bmcfsi";
> +
> +		/* GPIO pin definitions */
> +		fsi_clk = <0x0 0x13>;		/* C3 */
> +		fsi_dat = <0x0 0x12>; 		/* C2 */
> +		fsi_dat_en = <0x78 0x16>;	/* O6 */
> +		fsi_enable = <0x0 0x18>;	/* D0 */
> +		cronus_sel = <0x78 0x1e>;	/* P6 */
> +		clock_delay = <0x14>;
> +
> +		system-path = "/proc@0/fsi@0";
> +	};
> +
> +	pib@0 {
> +		target = "/proc@0/fsi@0/pib@1000";
> +		system-path = "/proc@0/pib@0";
> +	};
> +
> +	fsi@1 {
> +		target = "/proc@0/fsi@0/hmfsi@0";
> +		system-path = "/proc@1/fsi@1";
> +	};
> +
> +	pib@1 {
> +		target = "/proc@1/fsi@1/pib@1000";
> +		system-path = "/proc@1/pib@1";
> +	};
> +};
> diff --git a/p9z-fsi.dts.m4 b/p9z-fsi.dts.m4
> deleted file mode 100644
> index 87ad5c2..0000000
> --- a/p9z-fsi.dts.m4
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -/dts-v1/;
> -
> -/include/ "p9-fsi.dtsi"
> -
> -/ {
> -};
> -
> -&fsi0 {
> -	/* GPIO pin definitions */
> -	fsi_clk = <0x0 0x13>;		/* C3 */
> -	fsi_dat = <0x0 0x12>; 		/* C2 */
> -	fsi_dat_en = <0x78 0x16>;	/* O6 */
> -	fsi_enable = <0x0 0x18>;	/* D0 */
> -	cronus_sel = <0x78 0x1e>;	/* P6 */
> -	clock_delay = <0x14>;
> -};
> diff --git a/src/main.c b/src/main.c
> index 3a8b0a0..99e4097 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -582,6 +582,7 @@ int main(int argc, char *argv[])
>  		pdbg_set_backend(backend, device_node);
>  
>  	pdbg_targets_init(NULL);
> +	pdbg_backend_init(NULL);
>  
>  	if (pathsel_count) {
>  		if (!path_target_parse(pathsel, pathsel_count))
> -- 
> 2.20.1
> 

Amitay.

Patch
diff mbox series

diff --git a/Makefile.am b/Makefile.am
index 0f2906a..14b0a6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,19 +35,17 @@  AM_CFLAGS = -I$(top_srcdir)/ccan/array_size -Wall -Werror -O2
 
 EXTRA_DIST = \
 	fake.dts.m4 \
-	backend.dts.m4 \
-	p8-fsi.dts.m4 \
-	p8-host.dts.m4 \
-	p8-i2c.dts.m4 \
-	p8-kernel.dts.m4 \
 	p8-pib.dts.m4 \
-	p9-fsi.dtsi.m4 \
-	p9-host.dts.m4 \
-	p9-kernel.dts.m4 \
 	p9-pib.dts.m4 \
-	p9r-fsi.dts.m4 \
-	p9w-fsi.dts.m4 \
-	p9z-fsi.dts.m4 \
+	p8-fsi-backend.dts.m4 \
+	p9r-fsi-backend.dts.m4 \
+	p9w-fsi-backend.dts.m4 \
+	p9z-fsi-backend.dts.m4 \
+	p9.dts.m4 \
+	p8.dts.m4 \
+	obmc-backend.dts.m4 \
+	host-backend.dts.m4 \
+	cronus-backend.dts.m4 \
 	template.S \
 	generate_dt_header.sh \
 	src/gdb_parser.rl \
@@ -64,10 +62,10 @@  if TARGET_PPC
 ARCH_FLAGS="-DTARGET_PPC=1"
 endif
 
-DT = fake.dts backend.dts p8-cronus.dts p9-cronus.dts \
-     p8-fsi.dts p8-i2c.dts p8-kernel.dts \
-     p9w-fsi.dts p9r-fsi.dts p9z-fsi.dts p9-kernel.dts \
-     p8-host.dts p9-host.dts
+DT = fake.dts \
+     p9w-fsi-backend.dts p9r-fsi-backend.dts p9z-fsi-backend.dts p8-fsi-backend.dts \
+     p8.dts p9.dts p8-i2c-backend.dts \
+     obmc-backend.dts host-backend.dts cronus-backend.dts
 
 DT_sources = $(DT:.dts=.dtb.S)
 DT_headers = $(DT:.dts=.dt.h)
@@ -253,11 +251,6 @@  RAGEL_V_0 = @echo "  RAGEL   " $@;
 %.dtsi: %.dtsi.m4
 	$(M4_V)$(M4) -I$(dir $<) $< > $@
 
-p9-fsi.dtsi: p9-fsi.dtsi.m4 p9-pib.dts.m4
-p9w-fsi.dts: p9w-fsi.dts.m4 p9-fsi.dtsi
-p9r-fsi.dts: p9r-fsi.dts.m4 p9-fsi.dtsi
-p9z-fsi.dts: p9z-fsi.dts.m4 p9-fsi.dtsi
-
 %.dtb: %.dts
 	$(DTC_V)$(DTC) -i$(dir $@) -I dts $< -O dtb > $@
 
diff --git a/cronus-backend.dts.m4 b/cronus-backend.dts.m4
new file mode 100644
index 0000000..aa31f85
--- /dev/null
+++ b/cronus-backend.dts.m4
@@ -0,0 +1,28 @@ 
+/dts-v1/;
+
+/ {
+	fsi@0 {
+		compatible = "ibm,cronus-fsi";
+		system-path = "/proc@0/fsi@0";
+	};
+
+	pib@0 {
+		compatible = "ibm,cronus-pib";
+		system-path = "/proc@0/pib@0";
+	};
+
+	mem@0 {
+		system-path = "/mem@0";
+ 		target = "/proc@0/pib@0/adu@90000";
+	};
+
+	fsi@1 {
+		compatible = "ibm,cronus-fsi";
+		system-path = "/proc@1/fsi@0";
+	};
+
+	pib@1 {
+		compatible = "ibm,cronus-pib";
+		system-path = "/proc@1/pib@1";
+	};
+};
diff --git a/host-backend.dts.m4 b/host-backend.dts.m4
new file mode 100644
index 0000000..a188045
--- /dev/null
+++ b/host-backend.dts.m4
@@ -0,0 +1,46 @@ 
+define(`HOST_PIB',`
+	pib@$1 {
+	      #address-cells = <0x2>;
+	      #size-cells = <0x1>;
+	      compatible = "ibm,host-pib";
+	      reg = <$1>;
+	      index = <$1>;
+	      system-path = "/proc@$1/pib@$1";
+	}')dnl
+
+/dts-v1/;
+
+/ {
+	HOST_PIB(0);
+	HOST_PIB(1);
+	HOST_PIB(2);
+	HOST_PIB(3);
+	HOST_PIB(4);
+	HOST_PIB(5);
+	HOST_PIB(6);
+	HOST_PIB(7);
+	HOST_PIB(8);
+	HOST_PIB(9);
+	HOST_PIB(10);
+	HOST_PIB(11);
+	HOST_PIB(12);
+	HOST_PIB(13);
+	HOST_PIB(14);
+	HOST_PIB(15);
+	HOST_PIB(16);
+	HOST_PIB(17);
+	HOST_PIB(18);
+	HOST_PIB(19);
+	HOST_PIB(20);
+	HOST_PIB(21);
+	HOST_PIB(22);
+	HOST_PIB(23);
+	HOST_PIB(24);
+	HOST_PIB(25);
+	HOST_PIB(26);
+	HOST_PIB(27);
+	HOST_PIB(28);
+	HOST_PIB(29);
+	HOST_PIB(30);
+	HOST_PIB(31);
+};
diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c
index f6b235f..98ca374 100644
--- a/libpdbg/dtb.c
+++ b/libpdbg/dtb.c
@@ -30,18 +30,17 @@ 
 
 #include "fake.dt.h"
 
-#include "p8-i2c.dt.h"
-#include "p8-fsi.dt.h"
-#include "p8-kernel.dt.h"
-#include "p9w-fsi.dt.h"
-#include "p9r-fsi.dt.h"
-#include "p9z-fsi.dt.h"
-#include "p9-kernel.dt.h"
-#include "p8-host.dt.h"
-#include "p9-host.dt.h"
-#include "p8-cronus.dt.h"
-#include "p9-cronus.dt.h"
-#include "backend.dt.h"
+#include "p9.dt.h"
+#include "p8.dt.h"
+
+#include "obmc-backend.dt.h"
+#include "host-backend.dt.h"
+#include "cronus-backend.dt.h"
+#include "p8-fsi-backend.dt.h"
+#include "p8-i2c-backend.dt.h"
+#include "p9w-fsi-backend.dt.h"
+#include "p9r-fsi-backend.dt.h"
+#include "p9z-fsi-backend.dt.h"
 
 #define AMI_BMC "/proc/ractrends/Helper/FwInfo"
 #define OPENFSI_BMC "/sys/bus/platform/devices/gpio-fsi/fsi0/"
@@ -85,9 +84,9 @@  static void *ppc_target(void)
 	FILE *cpuinfo;
 
 	if (!strcmp(pdbg_backend_option, "p8"))
-		return &_binary_p8_host_dtb_o_start;
+		return &_binary_p8_dtb_o_start;
 	else if (!strcmp(pdbg_backend_option, "p9"))
-		return &_binary_p9_host_dtb_o_start;
+		return &_binary_p9_dtb_o_start;
 
 	cpuinfo = fopen("/proc/cpuinfo", "r");
 	if (!cpuinfo)
@@ -114,12 +113,12 @@  static void *ppc_target(void)
 
 	if (strncmp(pos, "POWER8", 6) == 0) {
 		pdbg_log(PDBG_INFO, "Found a POWER8 PPC host system\n");
-		return &_binary_p8_host_dtb_o_start;
+		return &_binary_p8_dtb_o_start;
 	}
 
 	if (strncmp(pos, "POWER9", 6) == 0) {
 		pdbg_log(PDBG_INFO, "Found a POWER9 PPC host system\n");
-		return &_binary_p9_host_dtb_o_start;
+		return &_binary_p9_dtb_o_start;
 	}
 
 	pdbg_log(PDBG_ERROR, "Unsupported CPU type '%s'\n", pos);
@@ -160,13 +159,13 @@  static void *bmc_target(void)
 	switch(chip_id) {
 	case CHIP_ID_P9:
 		pdbg_log(PDBG_INFO, "Found a POWER9 OpenBMC based system\n");
-		return &_binary_p9_kernel_dtb_o_start;
+		return &_binary_p9_dtb_o_start;
 		break;
 
 	case CHIP_ID_P8:
 	case CHIP_ID_P8P:
 		pdbg_log(PDBG_INFO, "Found a POWER8/8+ OpenBMC based system\n");
-		return &_binary_p8_kernel_dtb_o_start;
+		return &_binary_p8_dtb_o_start;
 		break;
 
 	default:
@@ -239,7 +238,7 @@  void *pdbg_default_dtb(void)
 	case PDBG_BACKEND_I2C:
 		/* I2C is only supported on POWER8 */
 		pdbg_log(PDBG_INFO, "Found a POWER8 AMI BMC based system\n");
-		return &_binary_p8_i2c_dtb_o_start;
+		return &_binary_p8_dtb_o_start;
 		break;
 
 	case PDBG_BACKEND_KERNEL:
@@ -254,13 +253,9 @@  void *pdbg_default_dtb(void)
 		}
 
 		if (!strcmp(pdbg_backend_option, "p8"))
-			return &_binary_p8_fsi_dtb_o_start;
-		else if (!strcmp(pdbg_backend_option, "p9w"))
-			return &_binary_p9w_fsi_dtb_o_start;
-		else if (!strcmp(pdbg_backend_option, "p9r"))
-			return &_binary_p9r_fsi_dtb_o_start;
-		else if (!strcmp(pdbg_backend_option, "p9z"))
-			return &_binary_p9z_fsi_dtb_o_start;
+			return &_binary_p8_dtb_o_start;
+		else if (!strncmp(pdbg_backend_option, "p9", 2))
+			return &_binary_p9_dtb_o_start;
 		else {
 			pdbg_log(PDBG_ERROR, "Invalid device type specified\n");
 			pdbg_log(PDBG_ERROR, "Use 'p8' or 'p9r/p9w/p9z'\n");
@@ -277,9 +272,9 @@  void *pdbg_default_dtb(void)
 		}
 
 		if (!strncmp(pdbg_backend_option, "p8", 2))
-			return &_binary_p8_cronus_dtb_o_start;
+			return &_binary_p8_dtb_o_start;
 		else if (!strncmp(pdbg_backend_option, "p9", 2))
-			return &_binary_p9_cronus_dtb_o_start;
+			return &_binary_p9_dtb_o_start;
 		else {
 			pdbg_log(PDBG_ERROR, "Invalid device type specified\n");
 			pdbg_log(PDBG_ERROR, "Use p8@<server> or p9@<server>\n");
@@ -300,5 +295,49 @@  void *pdbg_default_dtb(void)
 
 void *pdbg_default_backend_dtb(void)
 {
-	return &_binary_backend_dtb_o_start;
+	char *dtb = getenv("PDBG_BACKEND_DTB");
+
+	if (dtb)
+		return mmap_dtb(dtb);
+
+	switch(pdbg_backend) {
+	case PDBG_BACKEND_HOST:
+		return &_binary_host_backend_dtb_o_start;
+		break;
+
+	case PDBG_BACKEND_I2C:
+		return &_binary_p8_i2c_backend_dtb_o_start;
+		break;
+
+	case PDBG_BACKEND_KERNEL:
+		return &_binary_obmc_backend_dtb_o_start;
+		break;
+
+	case PDBG_BACKEND_FSI:
+		if (!strcmp(pdbg_backend_option, "p9w"))
+			return &_binary_p9w_fsi_backend_dtb_o_start;
+		else if (!strcmp(pdbg_backend_option, "p9r"))
+			return &_binary_p9r_fsi_backend_dtb_o_start;
+		else if (!strcmp(pdbg_backend_option, "p9z"))
+			return &_binary_p9z_fsi_backend_dtb_o_start;
+		else if (!strcmp(pdbg_backend_option, "p8"))
+			return &_binary_p8_fsi_backend_dtb_o_start;
+		else
+			/* pdbg_default_dtb() should already have
+			 * logged an error */
+			return NULL;
+		break;
+
+	case PDBG_BACKEND_CRONUS:
+		return &_binary_cronus_backend_dtb_o_start;
+		break;
+
+	case PDBG_BACKEND_FAKE:
+		break;
+
+	default:
+		assert(0);
+	}
+
+	return NULL;
 }
diff --git a/obmc-backend.dts.m4 b/obmc-backend.dts.m4
new file mode 100644
index 0000000..a28ef68
--- /dev/null
+++ b/obmc-backend.dts.m4
@@ -0,0 +1,36 @@ 
+/dts-v1/;
+
+/ {
+	fsi@0 {
+		compatible = "ibm,kernel-fsi";
+		system-path = "/proc@0/fsi@0";
+	};
+
+	pib@0 {
+		compatible = "ibm,kernel-pib";
+		system-path = "/proc@0/pib@0";
+		device-path = "/dev/scom1";
+	};
+
+	sbefifo@0 {
+		compatible = "ibm,kernel-sbefifo";
+		device-path = "/dev/sbefifo1";
+		system-path = "/proc@0/fsi@0/sbefifo@0";
+	};
+
+	mem@0 {
+		system-path = "/mem@0";
+ 		target = "/proc@0/fsi@0/sbefifo@0/sbefifo-mem@0";
+	};
+
+	fsi@1 {
+		compatible = "ibm,kernel-fsi";
+		system-path = "/proc@1/fsi@0";
+	};
+
+	pib@1 {
+		compatible = "ibm,kernel-pib";
+		system-path = "/proc@1/pib@1";
+		device-path = "/dev/scom2";
+	};
+};
diff --git a/p8-fsi-backend.dts.m4 b/p8-fsi-backend.dts.m4
new file mode 100644
index 0000000..fa5f1f4
--- /dev/null
+++ b/p8-fsi-backend.dts.m4
@@ -0,0 +1,32 @@ 
+/dts-v1/;
+
+/ {
+	fsi@0 {
+		compatible = "ibm,bmcfsi";
+
+		/* GPIO pin definitions */
+		fsi_clk = <0x0 0x4>;		/* A4 */
+		fsi_dat = <0x0 0x5>; 		/* A5 */
+		fsi_dat_en = <0x20 0x1e>;	/* H6 */
+		fsi_enable = <0x0 0x18>;	/* D0 */
+		cronus_sel = <0x0 0x6>;		/* A6 */
+		clock_delay = <0x14>;
+
+		system-path = "/proc@0/fsi@0";
+	};
+
+	pib@0 {
+		target = "/proc@0/fsi@0/pib@0";
+		system-path = "/proc@0/pib@0";
+	};
+
+	fsi@1 {
+		target = "/proc@0/pib@0/opb@0/hmfsi@1";
+		system-path = "/proc@1/fsi@1";
+	};
+
+	pib@1 {
+		target = "/proc@1/fsi@1/pib@1";
+		system-path = "/proc@1/pib@1";
+	};
+};
diff --git a/p8-i2c-backend.dts.m4 b/p8-i2c-backend.dts.m4
new file mode 100644
index 0000000..ffd0b06
--- /dev/null
+++ b/p8-i2c-backend.dts.m4
@@ -0,0 +1,22 @@ 
+/dts-v1/;
+
+/ {
+	pib@0 {
+		compatible = "ibm,power8-i2c-slave";
+		bus = "/dev/i2c4";
+		reg = <0x50>;
+		index = <0x0>;
+
+		system-path = "/proc@0/pib@0";
+	};
+
+	fsi@1 {
+		target = "/proc@0/pib@0/opb@20010/hmfsi@0";
+		system-path = "/proc@1/fsi@1";
+	};
+
+	pib@1 {
+		target = "/proc@1/fsi@1/pib@1000";
+		system-path = "/proc@1/pib@1";
+	};
+};
diff --git a/p8-pib.dts.m4 b/p8-pib.dts.m4
index 82d11d8..b648d3a 100644
--- a/p8-pib.dts.m4
+++ b/p8-pib.dts.m4
@@ -52,4 +52,21 @@  nhtm@2010880 {
 	index = <0x0>;
 };
 
+opb@0 {
+	#address-cells = <0x1>;
+        #size-cells = <0x1>;
+        reg = <0x0 0x20010 0xa>;
+        compatible = "ibm,power8-opb";
+	index = <0x0>;
+
+        hmfsi@1 {
+                #address-cells = <0x2>;
+                #size-cells = <0x1>;
+                compatible = "ibm,power8-opb-hmfsi";
+                reg = <0x180000 0x80000>;
+                port = <0x2>;
+                index = <0x1>;
+	};
+};
+
 PROC_CORES;
diff --git a/p8.dts.m4 b/p8.dts.m4
new file mode 100644
index 0000000..320bd0c
--- /dev/null
+++ b/p8.dts.m4
@@ -0,0 +1,71 @@ 
+define(`PIB',`
+	pib@$1 {
+	      #address-cells = <0x2>;
+	      #size-cells = <0x1>;
+	      reg = <$1>;
+	      index = <$1>;
+	      class = "pib";
+	      include(p8-pib.dts.m4)dnl
+	}')dnl
+
+define(`PROC',`
+	proc@$1 {
+		class = "proc";
+		index = <$1>;
+		PIB($1);
+
+		fsi@$1 {
+                        #address-cells = <0x2>;
+                	#size-cells = <0x1>;
+			class = "fsi";
+		        index = <$1>;
+
+			pib@$1 {
+                        	#address-cells = <0x2>;
+                                #size-cells = <0x1>;
+                                reg = <0x0 0x1000 0x7>;
+			        index = <$1>;
+				compatible = "ibm,fsi-pib";
+		       };
+		};
+	}')dnl
+
+/dts-v1/;
+
+/ {
+	#address-cells = <0x1>;
+	#size-cells = <0x0>;
+
+	PROC(0);
+	PROC(1);
+	PROC(2);
+	PROC(3);
+	PROC(4);
+	PROC(5);
+	PROC(6);
+	PROC(7);
+	PROC(8);
+	PROC(9);
+	PROC(10);
+	PROC(11);
+	PROC(12);
+	PROC(13);
+	PROC(14);
+	PROC(15);
+	PROC(16);
+	PROC(17);
+	PROC(18);
+	PROC(19);
+	PROC(20);
+	PROC(21);
+	PROC(22);
+	PROC(23);
+	PROC(24);
+	PROC(25);
+	PROC(26);
+	PROC(27);
+	PROC(28);
+	PROC(29);
+	PROC(30);
+	PROC(31);
+};
diff --git a/p9-fsi.dtsi.m4 b/p9-fsi.dtsi.m4
deleted file mode 100644
index afa7d39..0000000
--- a/p9-fsi.dtsi.m4
+++ /dev/null
@@ -1,43 +0,0 @@ 
-
-/ {
-	#address-cells = <0x1>;
-	#size-cells = <0x0>;
-
-	fsi0: fsi@0 {
-		#address-cells = <0x2>;
-		#size-cells = <0x1>;
-		compatible = "ibm,bmcfsi";
-		reg = <0x0 0x0 0x0>;
-
-		index = <0x0>;
-		status = "mustexist";
-
-		pib@1000 {
-			 #address-cells = <0x2>;
-			 #size-cells = <0x1>;
-			 reg = <0x0 0x1000 0x7>;
-			 index = <0x0>;
-			 compatible = "ibm,fsi-pib", "ibm,power9-fsi-pib";
-			 include(p9-pib.dts.m4)dnl
-		};
-
-		hmfsi@100000 {
-			#address-cells = <0x2>;
-			#size-cells = <0x1>;
-			compatible = "ibm,fsi-hmfsi";
-			reg = <0x0 0x100000 0x8000>;
-			port = <0x1>;
-			index = <0x1>;
-
-			pib@1000 {
-				#address-cells = <0x2>;
-				#size-cells = <0x1>;
-				reg = <0x0 0x1000 0x7>;
-				index = <0x1>;
-				compatible = "ibm,fsi-pib", "ibm,power9-fsi-pib";
-				include(p9-pib.dts.m4)dnl
-			};
-		};
-
-	};
-};
diff --git a/p9-pib.dts.m4 b/p9-pib.dts.m4
index 3a99157..173fa2f 100644
--- a/p9-pib.dts.m4
+++ b/p9-pib.dts.m4
@@ -35,6 +35,10 @@  index = <HEX(eval($1, 16))>;
 reg = <0x0 HEX(CHIPLET_BASE($1)) 0xfffff>;
 }')dnl
 
+adu@90000 {
+          compatible = "ibm,power9-adu";
+          reg = <0x0 0x90000 0x5>;
+};
 
 htm@5012880 {
 	compatible = "ibm,power9-nhtm";
diff --git a/p9.dts.m4 b/p9.dts.m4
new file mode 100644
index 0000000..25f15c0
--- /dev/null
+++ b/p9.dts.m4
@@ -0,0 +1,80 @@ 
+/dts-v1/;
+
+/ {
+	#address-cells = <0x1>;
+	#size-cells = <0x0>;
+
+	proc@0 {
+		index = <0x0>;
+		class = "proc";
+
+		pib@0 {
+			#address-cells = <0x2>;
+			#size-cells = <0x1>;
+
+			index = <0x0>;
+			class = "pib";
+			include(p9-pib.dts.m4)dnl
+		};
+
+		fsi@0 {
+			#address-cells = <0x2>;
+			#size-cells = <0x1>;
+
+		      	index = <0x0>;
+			class = "fsi";
+
+			pib@1000 {
+				 reg = < 0x00 0x1000 0x07 >;
+				 index = < 0x00 >;
+				 compatible = "ibm,fsi-pib", "ibm,power9-fsi-pib";
+			};
+
+			hmfsi@100000 {
+				#address-cells = <0x2>;
+				#size-cells = <0x1>;
+				compatible = "ibm,fsi-hmfsi";
+				reg = <0x0 0x100000 0x8000>;
+				port = <0x1>;
+				index = <0x1>;
+			};
+
+			sbefifo@2400 {
+				reg = <0x0 0x2400 0x7>;
+				index = <0x0>;
+
+				sbefifo-mem@0 {
+					index = <0x0>;
+					compatible = "ibm,sbefifo-mem";
+				};
+			};
+		};
+	};
+
+	proc@1 {
+		index = <0x1>;
+		class = "proc";
+
+		pib@1 {
+			#address-cells = <0x2>;
+			#size-cells = <0x1>;
+
+		      	index = <0x1>;
+			class = "pib";
+			include(p9-pib.dts.m4)dnl
+		};
+
+		fsi@0 {
+			#address-cells = <0x2>;
+			#size-cells = <0x1>;
+
+			index = <0x1>;
+			class = "fsi";
+		};
+	};
+
+	mem@0 {
+	      index = <0x0>;
+	      class = "mem";
+	};
+};
diff --git a/p9r-fsi-backend.dts.m4 b/p9r-fsi-backend.dts.m4
new file mode 100644
index 0000000..1630823
--- /dev/null
+++ b/p9r-fsi-backend.dts.m4
@@ -0,0 +1,32 @@ 
+/dts-v1/;
+
+/ {
+	fsi@0 {
+		compatible = "ibm,bmcfsi";
+
+		/* GPIO pin definitions */
+		fsi_clk = <0x1e0 0x10>;		/* AA0 */
+		fsi_dat = <0x1e0 0x12>;		/* AA2 */
+		fsi_dat_en = <0x80 0xa>;	/* R2 */
+		fsi_enable = <0x0 0x18>;	/* D0 */
+		cronus_sel = <0x0 0x6>;		/* A6 */
+		clock_delay = <0x14>;
+
+		system-path = "/proc@0/fsi@0";
+	};
+
+	pib@0 {
+		target = "/proc@0/fsi@0/pib@1000";
+		system-path = "/proc@0/pib@0";
+	};
+
+	fsi@1 {
+		target = "/proc@0/fsi@0/hmfsi@0";
+		system-path = "/proc@1/fsi@1";
+	};
+
+	pib@1 {
+		target = "/proc@1/fsi@1/pib@1000";
+		system-path = "/proc@1/pib@1";
+	};
+};
diff --git a/p9r-fsi.dts.m4 b/p9r-fsi.dts.m4
deleted file mode 100644
index 2165bae..0000000
--- a/p9r-fsi.dts.m4
+++ /dev/null
@@ -1,16 +0,0 @@ 
-/dts-v1/;
-
-/include/ "p9-fsi.dtsi"
-
-/ {
-};
-
-&fsi0 {
-	/* GPIO pin definitions */
-	fsi_clk = <0x1e0 0x10>;		/* AA0 */
-	fsi_dat = <0x1e0 0x12>;		/* AA2 */
-	fsi_dat_en = <0x80 0xa>;	/* R2 */
-	fsi_enable = <0x0 0x18>;	/* D0 */
-	cronus_sel = <0x0 0x6>;		/* A6 */
-	clock_delay = <0x14>;
-};
diff --git a/p9w-fsi-backend.dts.m4 b/p9w-fsi-backend.dts.m4
new file mode 100644
index 0000000..2696459
--- /dev/null
+++ b/p9w-fsi-backend.dts.m4
@@ -0,0 +1,32 @@ 
+/dts-v1/;
+
+/ {
+	fsi@0 {
+		compatible = "ibm,bmcfsi";
+
+		/* GPIO pin definitions */
+		fsi_clk = <0x1e0 0x10>;		/* AA0 */
+		fsi_dat = <0x20 0x0>; 		/* E0 */
+		fsi_dat_en = <0x80 0xa>;	/* R2 */
+		fsi_enable = <0x0 0x18>;	/* D0 */
+		cronus_sel = <0x0 0x6>;		/* A6 */
+		clock_delay = <0x14>;
+
+		system-path = "/proc@0/fsi@0";
+	};
+
+	pib@0 {
+		target = "/proc@0/fsi@0/pib@1000";
+		system-path = "/proc@0/pib@0";
+	};
+
+	fsi@1 {
+		target = "/proc@0/fsi@0/hmfsi@0";
+		system-path = "/proc@1/fsi@1";
+	};
+
+	pib@1 {
+		target = "/proc@1/fsi@1/pib@1000";
+		system-path = "/proc@1/pib@1";
+	};
+};
diff --git a/p9w-fsi.dts.m4 b/p9w-fsi.dts.m4
deleted file mode 100644
index 224c665..0000000
--- a/p9w-fsi.dts.m4
+++ /dev/null
@@ -1,16 +0,0 @@ 
-/dts-v1/;
-
-/include/ "p9-fsi.dtsi"
-
-/ {
-};
-
-&fsi0 {
-	/* GPIO pin definitions */
-	fsi_clk = <0x1e0 0x10>;		/* AA0 */
-	fsi_dat = <0x20 0x0>; 		/* E0 */
-	fsi_dat_en = <0x80 0xa>;	/* R2 */
-	fsi_enable = <0x0 0x18>;	/* D0 */
-	cronus_sel = <0x0 0x6>;		/* A6 */
-	clock_delay = <0x14>;
-};
diff --git a/p9z-fsi-backend.dts.m4 b/p9z-fsi-backend.dts.m4
new file mode 100644
index 0000000..d0956cf
--- /dev/null
+++ b/p9z-fsi-backend.dts.m4
@@ -0,0 +1,32 @@ 
+/dts-v1/;
+
+/ {
+	fsi@0 {
+		compatible = "ibm,bmcfsi";
+
+		/* GPIO pin definitions */
+		fsi_clk = <0x0 0x13>;		/* C3 */
+		fsi_dat = <0x0 0x12>; 		/* C2 */
+		fsi_dat_en = <0x78 0x16>;	/* O6 */
+		fsi_enable = <0x0 0x18>;	/* D0 */
+		cronus_sel = <0x78 0x1e>;	/* P6 */
+		clock_delay = <0x14>;
+
+		system-path = "/proc@0/fsi@0";
+	};
+
+	pib@0 {
+		target = "/proc@0/fsi@0/pib@1000";
+		system-path = "/proc@0/pib@0";
+	};
+
+	fsi@1 {
+		target = "/proc@0/fsi@0/hmfsi@0";
+		system-path = "/proc@1/fsi@1";
+	};
+
+	pib@1 {
+		target = "/proc@1/fsi@1/pib@1000";
+		system-path = "/proc@1/pib@1";
+	};
+};
diff --git a/p9z-fsi.dts.m4 b/p9z-fsi.dts.m4
deleted file mode 100644
index 87ad5c2..0000000
--- a/p9z-fsi.dts.m4
+++ /dev/null
@@ -1,16 +0,0 @@ 
-/dts-v1/;
-
-/include/ "p9-fsi.dtsi"
-
-/ {
-};
-
-&fsi0 {
-	/* GPIO pin definitions */
-	fsi_clk = <0x0 0x13>;		/* C3 */
-	fsi_dat = <0x0 0x12>; 		/* C2 */
-	fsi_dat_en = <0x78 0x16>;	/* O6 */
-	fsi_enable = <0x0 0x18>;	/* D0 */
-	cronus_sel = <0x78 0x1e>;	/* P6 */
-	clock_delay = <0x14>;
-};
diff --git a/src/main.c b/src/main.c
index 3a8b0a0..99e4097 100644
--- a/src/main.c
+++ b/src/main.c
@@ -582,6 +582,7 @@  int main(int argc, char *argv[])
 		pdbg_set_backend(backend, device_node);
 
 	pdbg_targets_init(NULL);
+	pdbg_backend_init(NULL);
 
 	if (pathsel_count) {
 		if (!path_target_parse(pathsel, pathsel_count))