PReP residual to device-tree converter

Started by Paul Mackerras on May 26, 2008 · 5 messages from 2 authors · Last reply Jul 9, 2008

open the first message on its own page

PReP residual to device-tree converter

From: Paul Mackerras <hidden>
Date: 2008-05-26 06:25:34

Here is a program that takes a PReP residual blob as input and
generates a device tree as output.  Currently the back-end uses printf
to output the tree in dts format, but it would be easy to do an
alternative back-end that outputs a dtb.  The idea is that this will
end up in the wrapper (with a dtb back-end), making it straightforward
to support PReP in arch/powerpc.

I would like people that have PReP machines to take a copy of
/proc/residual, run this program on it, and check that the output is
sane.  If it isn't, or if it is missing bits, send me the residual
blob with a description of what's wrong in the generated dts.  Since I
have only tested this with 2 blobs, both from IBM machines, it is very
likely that there are some assumptions in there that break on PRePs
from Motorola or other manufacturers.

To compile this program you'll need residual.h and pnp.h from
include/asm-ppc.  I found it easiest to create a symlink called "asm"
in the current directory, pointing to $kernelsource/include/asm-ppc,
and use -I. on the gcc command line.  Or you can copy residual.h and
pnp.h somewhere and munge the #include lines.

Paul.

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#define __KERNEL__
#include <asm/residual.h>

RESIDUAL resid;

int indent;

void prindent(void)
{
	int i;

738 more lines

Re: PReP residual to device-tree converter

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2008-07-09 10:48:43

I would like people that have PReP machines to take a copy of
/proc/residual, run this program on it, and check that the output is
sane.  If it isn't, or if it is missing bits, send me the residual
blob with a description of what's wrong in the generated dts.
Here's the output from qemu:

/dts-v1/;

/ {
	model = "Qemu";
	compatible = "prep";
	#address-cells = <1>;
	#size-cells = <1>;
	serial-number = "";
	clock-frequency = <100000000>;

	chosen {
	};

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x9000000>;
	};
};

Let me know if you want the blob too (it's ~10k)

johannes

Re: PReP residual to device-tree converter

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2008-07-09 11:30:02

On Wed, 2008-07-09 at 12:48 +0200, Johannes Berg wrote:
quoted
I would like people that have PReP machines to take a copy of
/proc/residual, run this program on it, and check that the output is
sane.  If it isn't, or if it is missing bits, send me the residual
blob with a description of what's wrong in the generated dts.
Here's the output from qemu:
[...]

Milton wanted iomem and ioports, I didn't manage to get userspace
working so I printed them in the kernel (hopefully correctly):

iomem:
c0000000-feffffff : PCI host bridge
  c80000f0-c80000ff : 0000:00:01.0

ioports:
00000000-007fffff : PCI host bridge
  00000000-0000001f : dma1
  00000020-00000021 : 8259 (master)
  00000040-0000005f : timer
  00000080-0000008f : dma page reg
  000000a0-000000a1 : 8259 (slave)
  000000c0-000000df : dma2
  000004d0-000004d1 : 8259 edge control


FWIW, my qemu command line was:

qemu-system-ppc -initrd initrd  -kernel linux/arch/ppc/boot/images/zImage.prep -M prep -cpu 604 -serial stdio

johannes

Re: PReP residual to device-tree converter

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2008-07-09 11:34:30

On Wed, 2008-07-09 at 13:29 +0200, Johannes Berg wrote:
On Wed, 2008-07-09 at 12:48 +0200, Johannes Berg wrote:
quoted
quoted
I would like people that have PReP machines to take a copy of
/proc/residual, run this program on it, and check that the output is
sane.  If it isn't, or if it is missing bits, send me the residual
blob with a description of what's wrong in the generated dts.
Here's the output from qemu:
[...]

Milton wanted iomem and ioports, I didn't manage to get userspace
working so I printed them in the kernel (hopefully correctly):

iomem:
c0000000-feffffff : PCI host bridge
  c80000f0-c80000ff : 0000:00:01.0
Oh and if I attach a virtual ne2k_pci, it changes:

c0000000-feffffff : PCI host bridge
  c1100000-c110000f : 0000:00:02.0
  c80000f0-c80000ff : 0000:00:01.0

johannes

Re: PReP residual to device-tree converter

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2008-07-09 11:39:50

On Wed, 2008-07-09 at 13:29 +0200, Johannes Berg wrote:
On Wed, 2008-07-09 at 12:48 +0200, Johannes Berg wrote:
quoted
quoted
I would like people that have PReP machines to take a copy of
/proc/residual, run this program on it, and check that the output is
sane.  If it isn't, or if it is missing bits, send me the residual
blob with a description of what's wrong in the generated dts.
Here's the output from qemu:
[...]

Milton wanted iomem and ioports, I didn't manage to get userspace
working so I printed them in the kernel (hopefully correctly):
I printed them far too early. After letting it probe drivers first, I
get:

iomem:
c0000000-feffffff : PCI host bridge
  c0000000-c000000f : 0000:00:03.0
  c1100000-c110000f : 0000:00:02.0
  c80000f0-c80000ff : 0000:00:01.0

ioport:
00000000-007fffff : PCI host bridge
  00000000-0000001f : dma1
  00000020-00000021 : 8259 (master)
  00000040-0000005f : timer
  00000080-0000008f : dma page reg
  000000a0-000000a1 : 8259 (slave)
  000000c0-000000df : dma2
  000001f0-000001f7 : ide0
  000003f2-000003f5 : floppy
  000003f6-000003f6 : ide0
  000003f7-000003f7 : floppy DIR
  000003f8-000003ff : serial
  000004d0-000004d1 : 8259 edge control

which was with usb too:

qemu-system-ppc -initrd initrd  -kernel linux/arch/ppc/boot/images/zImage.prep -M prep -cpu 604 -serial stdio -net nic,model=ne2k_pci -usb

johannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help