Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Wed, 15 Oct 2008 15:07:35 +0000 (08:07 -0700)]
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (158 commits)
  powerpc: Fix CHRP PCI config access for indirect_pci
  powerpc/chrp: Fix detection of Python PCI host bridge on IBM CHRPs
  powerpc: Fix 32-bit SMP boot on CHRP
  powerpc: Fix link errors on 32-bit machines using legacy DMA
  powerpc/pci: Improve detection of unassigned bridge resources
  hvc_console: Fix free_irq in spinlocked section
  powerpc: Get USE_STRICT_MM_TYPECHECKS working again
  powerpc: Reflect the used arguments in machine_init() prototype
  powerpc: Fix DMA offset for non-coherent DMA
  powerpc: fix fsl_upm nand driver modular build
  powerpc/83xx: add NAND support for the MPC8360E-RDK boards
  powerpc: FPGA support for GE Fanuc SBC610
  i2c: MPC8349E-mITX Power Management and GPIO expander driver
  powerpc: reserve two DMA channels for audio in MPC8610 HPCD device tree
  powerpc: document the "fsl,ssi-dma-channel" compatible property
  powerpc: disable CHRP and PMAC support in various defconfigs
  OF: add fsl,mcu-mpc8349emitx to the exception list
  powerpc/83xx: add DS1374 RTC support for the MPC837xE-MDS boards
  powerpc: remove support for bootmem-allocated memory for the DIU driver
  powerpc: remove non-dependent load fsl_booke PTE_64BIT
  ...

326 files changed:
Documentation/powerpc/00-INDEX
Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt [new file with mode: 0644]
Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt [new file with mode: 0644]
Documentation/powerpc/dts-bindings/fsl/dma.txt
Documentation/powerpc/dts-bindings/fsl/ssi.txt
Documentation/powerpc/ppc_htab.txt [deleted file]
Documentation/powerpc/smp.txt [deleted file]
arch/powerpc/Kconfig
arch/powerpc/Kconfig.debug
arch/powerpc/Makefile
arch/powerpc/boot/Makefile
arch/powerpc/boot/addnote.c
arch/powerpc/boot/dtc-src/Makefile.dtc
arch/powerpc/boot/dtc-src/checks.c
arch/powerpc/boot/dtc-src/data.c
arch/powerpc/boot/dtc-src/dtc-lexer.l
arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped
arch/powerpc/boot/dtc-src/dtc-parser.y
arch/powerpc/boot/dtc-src/dtc.c
arch/powerpc/boot/dtc-src/dtc.h
arch/powerpc/boot/dtc-src/flattree.c
arch/powerpc/boot/dtc-src/fstree.c
arch/powerpc/boot/dtc-src/libfdt_env.h [new file with mode: 0644]
arch/powerpc/boot/dtc-src/livetree.c
arch/powerpc/boot/dtc-src/srcpos.c
arch/powerpc/boot/dtc-src/srcpos.h
arch/powerpc/boot/dtc-src/treesource.c
arch/powerpc/boot/dtc-src/version_gen.h
arch/powerpc/boot/dts/arches.dts [new file with mode: 0644]
arch/powerpc/boot/dts/asp834x-redboot.dts
arch/powerpc/boot/dts/gef_sbc610.dts [new file with mode: 0644]
arch/powerpc/boot/dts/glacier.dts
arch/powerpc/boot/dts/mgcoge.dts [new file with mode: 0644]
arch/powerpc/boot/dts/mgsuvd.dts [new file with mode: 0644]
arch/powerpc/boot/dts/mpc5121ads.dts
arch/powerpc/boot/dts/mpc8313erdb.dts
arch/powerpc/boot/dts/mpc8315erdb.dts
arch/powerpc/boot/dts/mpc832x_mds.dts
arch/powerpc/boot/dts/mpc832x_rdb.dts
arch/powerpc/boot/dts/mpc8349emitx.dts
arch/powerpc/boot/dts/mpc8349emitxgp.dts
arch/powerpc/boot/dts/mpc834x_mds.dts
arch/powerpc/boot/dts/mpc836x_mds.dts
arch/powerpc/boot/dts/mpc836x_rdk.dts
arch/powerpc/boot/dts/mpc8377_mds.dts
arch/powerpc/boot/dts/mpc8377_rdb.dts
arch/powerpc/boot/dts/mpc8378_mds.dts
arch/powerpc/boot/dts/mpc8378_rdb.dts
arch/powerpc/boot/dts/mpc8379_mds.dts
arch/powerpc/boot/dts/mpc8379_rdb.dts
arch/powerpc/boot/dts/mpc8536ds.dts
arch/powerpc/boot/dts/mpc8610_hpcd.dts
arch/powerpc/boot/dts/sbc8349.dts
arch/powerpc/boot/dts/sequoia.dts
arch/powerpc/boot/dts/yosemite.dts
arch/powerpc/boot/elf_util.c
arch/powerpc/boot/libfdt/Makefile.libfdt
arch/powerpc/boot/libfdt/fdt.c
arch/powerpc/boot/libfdt/fdt_ro.c
arch/powerpc/boot/libfdt/fdt_rw.c
arch/powerpc/boot/libfdt/fdt_strerror.c
arch/powerpc/boot/libfdt/fdt_sw.c
arch/powerpc/boot/libfdt/fdt_wip.c
arch/powerpc/boot/libfdt/libfdt.h
arch/powerpc/boot/libfdt/libfdt_internal.h
arch/powerpc/boot/libfdt_env.h
arch/powerpc/boot/wrapper
arch/powerpc/configs/44x/arches_defconfig [new file with mode: 0644]
arch/powerpc/configs/83xx/asp8347_defconfig
arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
arch/powerpc/configs/83xx/mpc832x_mds_defconfig
arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
arch/powerpc/configs/83xx/mpc834x_itx_defconfig
arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
arch/powerpc/configs/83xx/mpc834x_mds_defconfig
arch/powerpc/configs/83xx/mpc836x_mds_defconfig
arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
arch/powerpc/configs/83xx/mpc837x_mds_defconfig
arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
arch/powerpc/configs/83xx/sbc834x_defconfig
arch/powerpc/configs/86xx/gef_sbc610_defconfig [copied from arch/powerpc/configs/sbc8641d_defconfig with 76% similarity]
arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig [moved from arch/powerpc/configs/mpc8610_hpcd_defconfig with 99% similarity]
arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig [copied from arch/powerpc/configs/mpc8641_hpcn_defconfig with 99% similarity]
arch/powerpc/configs/86xx/sbc8641d_defconfig [moved from arch/powerpc/configs/sbc8641d_defconfig with 99% similarity]
arch/powerpc/configs/ep8248e_defconfig
arch/powerpc/configs/mgcoge_defconfig [new file with mode: 0644]
arch/powerpc/configs/mgsuvd_defconfig [new file with mode: 0644]
arch/powerpc/configs/mpc8272_ads_defconfig
arch/powerpc/configs/mpc83xx_defconfig
arch/powerpc/configs/mpc86xx_defconfig [moved from arch/powerpc/configs/mpc8641_hpcn_defconfig with 97% similarity]
arch/powerpc/configs/pq2fads_defconfig
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/dcr-regs.h
arch/powerpc/include/asm/device.h
arch/powerpc/include/asm/dma-mapping.h
arch/powerpc/include/asm/exception.h
arch/powerpc/include/asm/fsl_lbc.h
arch/powerpc/include/asm/highmem.h
arch/powerpc/include/asm/io.h
arch/powerpc/include/asm/irq.h
arch/powerpc/include/asm/machdep.h
arch/powerpc/include/asm/mman.h
arch/powerpc/include/asm/mmu-hash64.h
arch/powerpc/include/asm/mpic.h
arch/powerpc/include/asm/msi_bitmap.h [new file with mode: 0644]
arch/powerpc/include/asm/of_device.h
arch/powerpc/include/asm/of_platform.h
arch/powerpc/include/asm/paca.h
arch/powerpc/include/asm/page.h
arch/powerpc/include/asm/page_32.h
arch/powerpc/include/asm/pci.h
arch/powerpc/include/asm/pgtable-ppc32.h
arch/powerpc/include/asm/pgtable-ppc64.h
arch/powerpc/include/asm/ppc_asm.h
arch/powerpc/include/asm/reg_booke.h
arch/powerpc/include/asm/sections.h
arch/powerpc/include/asm/sfp-machine.h [moved from arch/powerpc/math-emu/sfp-machine.h with 83% similarity]
arch/powerpc/include/asm/smp.h
arch/powerpc/include/asm/systbl.h
arch/powerpc/include/asm/tlbflush.h
arch/powerpc/include/asm/types.h
arch/powerpc/kernel/.gitignore [new file with mode: 0644]
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/btext.c
arch/powerpc/kernel/cpu_setup_ppc970.S
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/dma-iommu.c [new file with mode: 0644]
arch/powerpc/kernel/dma.c [new file with mode: 0644]
arch/powerpc/kernel/dma_64.c [deleted file]
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/head_32.S
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/head_fsl_booke.S
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/lparcfg.c
arch/powerpc/kernel/misc.S
arch/powerpc/kernel/misc_32.S
arch/powerpc/kernel/misc_64.S
arch/powerpc/kernel/of_device.c
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/pci-common.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/ppc_ksyms.c
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/reloc_64.S [new file with mode: 0644]
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/swsusp_asm64.S
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/sysfs.c
arch/powerpc/kernel/vio.c
arch/powerpc/kernel/vmlinux.lds.S
arch/powerpc/lib/copypage_64.S
arch/powerpc/lib/dma-noncoherent.c
arch/powerpc/math-emu/Makefile
arch/powerpc/math-emu/double.h [deleted file]
arch/powerpc/math-emu/fadd.c
arch/powerpc/math-emu/fadds.c
arch/powerpc/math-emu/fcmpo.c
arch/powerpc/math-emu/fcmpu.c
arch/powerpc/math-emu/fctiw.c
arch/powerpc/math-emu/fctiwz.c
arch/powerpc/math-emu/fdiv.c
arch/powerpc/math-emu/fdivs.c
arch/powerpc/math-emu/fmadd.c
arch/powerpc/math-emu/fmadds.c
arch/powerpc/math-emu/fmsub.c
arch/powerpc/math-emu/fmsubs.c
arch/powerpc/math-emu/fmul.c
arch/powerpc/math-emu/fmuls.c
arch/powerpc/math-emu/fnmadd.c
arch/powerpc/math-emu/fnmadds.c
arch/powerpc/math-emu/fnmsub.c
arch/powerpc/math-emu/fnmsubs.c
arch/powerpc/math-emu/frsp.c
arch/powerpc/math-emu/fsel.c
arch/powerpc/math-emu/fsqrt.c
arch/powerpc/math-emu/fsqrts.c
arch/powerpc/math-emu/fsub.c
arch/powerpc/math-emu/fsubs.c
arch/powerpc/math-emu/lfd.c
arch/powerpc/math-emu/lfs.c
arch/powerpc/math-emu/math.c
arch/powerpc/math-emu/mcrfs.c
arch/powerpc/math-emu/mffs.c
arch/powerpc/math-emu/mtfsb0.c
arch/powerpc/math-emu/mtfsb1.c
arch/powerpc/math-emu/mtfsf.c
arch/powerpc/math-emu/mtfsfi.c
arch/powerpc/math-emu/op-1.h [deleted file]
arch/powerpc/math-emu/op-2.h [deleted file]
arch/powerpc/math-emu/op-4.h [deleted file]
arch/powerpc/math-emu/op-common.h [deleted file]
arch/powerpc/math-emu/single.h [deleted file]
arch/powerpc/math-emu/soft-fp.h [deleted file]
arch/powerpc/math-emu/stfs.c
arch/powerpc/math-emu/types.c [deleted file]
arch/powerpc/math-emu/udivmodti4.c
arch/powerpc/mm/fsl_booke_mmu.c
arch/powerpc/mm/gup.c
arch/powerpc/mm/hash_low_32.S
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/hugetlbpage.c
arch/powerpc/mm/init_64.c
arch/powerpc/mm/mem.c
arch/powerpc/mm/numa.c
arch/powerpc/mm/pgtable_32.c
arch/powerpc/mm/tlb_32.c
arch/powerpc/oprofile/cell/vma_map.c
arch/powerpc/oprofile/op_model_power4.c
arch/powerpc/platforms/44x/Kconfig
arch/powerpc/platforms/44x/Makefile
arch/powerpc/platforms/44x/bamboo.c [deleted file]
arch/powerpc/platforms/44x/canyonlands.c [deleted file]
arch/powerpc/platforms/44x/katmai.c [deleted file]
arch/powerpc/platforms/44x/ppc44x_simple.c [new file with mode: 0644]
arch/powerpc/platforms/44x/rainier.c [deleted file]
arch/powerpc/platforms/44x/sequoia.c [deleted file]
arch/powerpc/platforms/44x/taishan.c [deleted file]
arch/powerpc/platforms/512x/Kconfig
arch/powerpc/platforms/512x/mpc5121_ads.c
arch/powerpc/platforms/52xx/mpc52xx_common.c
arch/powerpc/platforms/52xx/mpc52xx_pci.c
arch/powerpc/platforms/82xx/Kconfig
arch/powerpc/platforms/82xx/Makefile
arch/powerpc/platforms/82xx/mgcoge.c [new file with mode: 0644]
arch/powerpc/platforms/83xx/Kconfig
arch/powerpc/platforms/83xx/mpc837x_mds.c
arch/powerpc/platforms/85xx/Kconfig
arch/powerpc/platforms/85xx/mpc85xx_ads.c
arch/powerpc/platforms/85xx/sbc8560.c
arch/powerpc/platforms/86xx/Kconfig
arch/powerpc/platforms/86xx/Makefile
arch/powerpc/platforms/86xx/gef_pic.c [new file with mode: 0644]
arch/powerpc/platforms/86xx/gef_pic.h [new file with mode: 0644]
arch/powerpc/platforms/86xx/gef_sbc610.c [new file with mode: 0644]
arch/powerpc/platforms/86xx/mpc8610_hpcd.c
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
arch/powerpc/platforms/86xx/sbc8641d.c
arch/powerpc/platforms/8xx/Kconfig
arch/powerpc/platforms/8xx/Makefile
arch/powerpc/platforms/8xx/mgsuvd.c [new file with mode: 0644]
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/cell/iommu.c
arch/powerpc/platforms/cell/spufs/inode.c
arch/powerpc/platforms/chrp/pci.c
arch/powerpc/platforms/chrp/time.c
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
arch/powerpc/platforms/iseries/exception.S
arch/powerpc/platforms/iseries/mf.c
arch/powerpc/platforms/maple/time.c
arch/powerpc/platforms/powermac/feature.c
arch/powerpc/platforms/powermac/smp.c
arch/powerpc/platforms/powermac/time.c
arch/powerpc/platforms/ps3/system-bus.c
arch/powerpc/platforms/pseries/cmm.c
arch/powerpc/platforms/pseries/eeh_driver.c
arch/powerpc/platforms/pseries/hotplug-memory.c
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/platforms/pseries/rtasd.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/platforms/pseries/xics.c
arch/powerpc/platforms/pseries/xics.h
arch/powerpc/sysdev/Kconfig
arch/powerpc/sysdev/Makefile
arch/powerpc/sysdev/cpm1.c
arch/powerpc/sysdev/fsl_lbc.c
arch/powerpc/sysdev/fsl_msi.c
arch/powerpc/sysdev/fsl_msi.h
arch/powerpc/sysdev/fsl_pci.c
arch/powerpc/sysdev/fsl_soc.c
arch/powerpc/sysdev/fsl_soc.h
arch/powerpc/sysdev/mpc8xxx_gpio.c [new file with mode: 0644]
arch/powerpc/sysdev/mpic.h
arch/powerpc/sysdev/mpic_msi.c
arch/powerpc/sysdev/mpic_pasemi_msi.c
arch/powerpc/sysdev/mpic_u3msi.c
arch/powerpc/sysdev/msi_bitmap.c [new file with mode: 0644]
arch/powerpc/sysdev/ppc4xx_pci.c
arch/powerpc/sysdev/qe_lib/Kconfig
drivers/ata/pata_of_platform.c
drivers/block/floppy.c
drivers/block/viodasd.c
drivers/char/hvc_console.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/hwmon/ams/ams.h
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-pca-isa.c
drivers/i2c/chips/Kconfig
drivers/i2c/chips/Makefile
drivers/i2c/chips/mcu_mpc8349emitx.c [new file with mode: 0644]
drivers/input/serio/i8042-io.h
drivers/net/ibm_newemac/Kconfig
drivers/net/ibm_newemac/core.c
drivers/net/ibm_newemac/core.h
drivers/net/ibm_newemac/mal.c
drivers/net/ibm_newemac/mal.h
drivers/net/ibm_newemac/phy.c
drivers/net/ibm_newemac/phy.h
drivers/of/base.c
drivers/of/gpio.c
drivers/pci/hotplug/rpaphp_slot.c
drivers/pnp/isapnp/core.c
drivers/pnp/pnpbios/core.c
drivers/serial/Kconfig
drivers/serial/cpm_uart/cpm_uart_core.c
drivers/serial/cpm_uart/cpm_uart_cpm1.c
drivers/serial/cpm_uart/cpm_uart_cpm2.c
drivers/serial/mpc52xx_uart.c
drivers/serial/ucc_uart.c
drivers/spi/mpc52xx_psc_spi.c
include/linux/of.h
include/linux/proc_fs.h
include/math-emu/op-2.h
include/math-emu/op-common.h
include/math-emu/soft-fp.h
sound/aoa/soundbus/soundbus.h

index 29d839c..e3960b8 100644 (file)
@@ -18,10 +18,6 @@ mpc52xx.txt
        - Linux 2.6.x on MPC52xx family
 mpc52xx-device-tree-bindings.txt
        - MPC5200 Device Tree Bindings
-ppc_htab.txt
-       - info about the Linux/PPC /proc/ppc_htab entry
-smp.txt
-       - use and state info about Linux/PPC on MP machines
 sound.txt
        - info on sound support under Linux/PPC
 zImage_layout.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt b/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt
new file mode 100644 (file)
index 0000000..35a4653
--- /dev/null
@@ -0,0 +1,40 @@
+* Freescale 83xx and 512x PCI bridges
+
+Freescale 83xx and 512x SOCs include the same pci bridge core.
+
+83xx/512x specific notes:
+- reg: should contain two address length tuples
+    The first is for the internal pci bridge registers
+    The second is for the pci config space access registers
+
+Example (MPC8313ERDB)
+       pci0: pci@e0008500 {
+               cell-index = <1>;
+               interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+               interrupt-map = <
+                               /* IDSEL 0x0E -mini PCI */
+                                0x7000 0x0 0x0 0x1 &ipic 18 0x8
+                                0x7000 0x0 0x0 0x2 &ipic 18 0x8
+                                0x7000 0x0 0x0 0x3 &ipic 18 0x8
+                                0x7000 0x0 0x0 0x4 &ipic 18 0x8
+
+                               /* IDSEL 0x0F - PCI slot */
+                                0x7800 0x0 0x0 0x1 &ipic 17 0x8
+                                0x7800 0x0 0x0 0x2 &ipic 18 0x8
+                                0x7800 0x0 0x0 0x3 &ipic 17 0x8
+                                0x7800 0x0 0x0 0x4 &ipic 18 0x8>;
+               interrupt-parent = <&ipic>;
+               interrupts = <66 0x8>;
+               bus-range = <0x0 0x0>;
+               ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0 0x10000000
+                         0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000
+                         0x01000000 0x0 0x00000000 0xe2000000 0x0 0x00100000>;
+               clock-frequency = <66666666>;
+               #interrupt-cells = <1>;
+               #size-cells = <2>;
+               #address-cells = <3>;
+               reg = <0xe0008500 0x100         /* internal registers */
+                      0xe0008300 0x8>;         /* config space access registers */
+               compatible = "fsl,mpc8349-pci";
+               device_type = "pci";
+       };
diff --git a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt
new file mode 100644 (file)
index 0000000..d015dce
--- /dev/null
@@ -0,0 +1,40 @@
+GPIO controllers on MPC8xxx SoCs
+
+This is for the non-QE/CPM/GUTs GPIO controllers as found on
+8349, 8572, 8610 and compatible.
+
+Every GPIO controller node must have #gpio-cells property defined,
+this information will be used to translate gpio-specifiers.
+
+Required properties:
+- compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for
+  83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters (currently unused).
+ - interrupts : Interrupt mapping for GPIO IRQ (currently unused).
+ - interrupt-parent : Phandle for the interrupt controller that
+   services interrupts for this device.
+- gpio-controller : Marks the port as GPIO controller.
+
+Example of gpio-controller nodes for a MPC8347 SoC:
+
+       gpio1: gpio-controller@c00 {
+               #gpio-cells = <2>;
+               compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio";
+               reg = <0xc00 0x100>;
+               interrupts = <74 0x8>;
+               interrupt-parent = <&ipic>;
+               gpio-controller;
+       };
+
+       gpio2: gpio-controller@d00 {
+               #gpio-cells = <2>;
+               compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio";
+               reg = <0xd00 0x100>;
+               interrupts = <75 0x8>;
+               interrupt-parent = <&ipic>;
+               gpio-controller;
+       };
+
+See booting-without-of.txt for details of how to specify GPIO
+information for devices.
index 86826df..cc45311 100644 (file)
@@ -20,7 +20,7 @@ Required properties:
         - compatible        : compatible list, contains 2 entries, first is
                         "fsl,CHIP-dma-channel", where CHIP is the processor
                         (mpc8349, mpc8350, etc.) and the second is
-                        "fsl,elo-dma-channel"
+                        "fsl,elo-dma-channel". However, see note below.
         - reg               : <registers mapping for channel>
         - cell-index        : dma channel index starts at 0.
 
@@ -82,7 +82,7 @@ Required properties:
         - compatible        : compatible list, contains 2 entries, first is
                         "fsl,CHIP-dma-channel", where CHIP is the processor
                         (mpc8540, mpc8560, etc.) and the second is
-                        "fsl,eloplus-dma-channel"
+                        "fsl,eloplus-dma-channel". However, see note below.
         - cell-index        : dma channel index starts at 0.
         - reg               : <registers mapping for channel>
         - interrupts        : <interrupt mapping for DMA channel IRQ>
@@ -125,3 +125,12 @@ Example:
                        interrupts = <17 2>;
                };
        };
+
+Note on DMA channel compatible properties: The compatible property must say
+"fsl,elo-dma-channel" or "fsl,eloplus-dma-channel" to be used by the Elo DMA
+driver (fsldma).  Any DMA channel used by fsldma cannot be used by another
+DMA driver, such as the SSI sound drivers for the MPC8610.  Therefore, any DMA
+channel that should be used for another driver should not use
+"fsl,elo-dma-channel" or "fsl,eloplus-dma-channel".  For the SSI drivers, for
+example, the compatible property should be "fsl,ssi-dma-channel".  See ssi.txt
+for more information.
index d100555..a2d9639 100644 (file)
@@ -24,6 +24,12 @@ Required properties:
                    "rj-master" - r.j., SSI is clock master
                    "ac97-slave" - AC97 mode, SSI is clock slave
                    "ac97-master" - AC97 mode, SSI is clock master
+- fsl,playback-dma: phandle to a node for the DMA channel to use for
+                    playback of audio.  This is typically dictated by SOC
+                    design.  See the notes below.
+- fsl,capture-dma:  phandle to a node for the DMA channel to use for
+                    capture (recording) of audio.  This is typically dictated
+                    by SOC design.  See the notes below.
 
 Optional properties:
 - codec-handle   : phandle to a 'codec' node that defines an audio
@@ -36,3 +42,20 @@ Child 'codec' node required properties:
 Child 'codec' node optional properties:
 - clock-frequency  : The frequency of the input clock, which typically
                      comes from an on-board dedicated oscillator.
+
+Notes on fsl,playback-dma and fsl,capture-dma:
+
+On SOCs that have an SSI, specific DMA channels are hard-wired for playback
+and capture.  On the MPC8610, for example, SSI1 must use DMA channel 0 for
+playback and DMA channel 1 for capture.  SSI2 must use DMA channel 2 for
+playback and DMA channel 3 for capture.  The developer can choose which
+DMA controller to use, but the channels themselves are hard-wired.  The
+purpose of these two properties is to represent this hardware design.
+
+The device tree nodes for the DMA channels that are referenced by
+"fsl,playback-dma" and "fsl,capture-dma" must be marked as compatible with
+"fsl,ssi-dma-channel".  The SOC-specific compatible string (e.g.
+"fsl,mpc8610-dma-channel") can remain.  If these nodes are left as
+"fsl,elo-dma-channel" or "fsl,eloplus-dma-channel", then the generic Elo DMA
+drivers (fsldma) will attempt to use them, and it will conflict with the
+sound drivers.
diff --git a/Documentation/powerpc/ppc_htab.txt b/Documentation/powerpc/ppc_htab.txt
deleted file mode 100644 (file)
index 8b8c7df..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-                 Information about /proc/ppc_htab
-=====================================================================
-
-This document and the related code was written by me (Cort Dougan), please
-email me (cort@fsmlabs.com) if you have questions, comments or corrections.
-
-Last Change: 2.16.98
-
-This entry in the proc directory is readable by all users but only
-writable by root.
-
-The ppc_htab interface is a user level way of accessing the
-performance monitoring registers as well as providing information
-about the PTE hash table.
-
-1. Reading
-
-  Reading this file will give you information about the memory management
-  hash table that serves as an extended tlb for page translation on the
-  powerpc.  It will also give you information about performance measurement
-  specific to the cpu that you are using.
-
-  Explanation of the 604 Performance Monitoring Fields:
-    MMCR0 - the current value of the MMCR0 register
-    PMC1
-    PMC2 - the value of the performance counters and a
-           description of what events they are counting
-           which are based on MMCR0 bit settings.
-  Explanation of the PTE Hash Table fields:
-
-    Size - hash table size in Kb.
-    Buckets -  number of buckets in the table.
-    Address - the virtual kernel address of the hash table base.
-    Entries - the number of ptes that can be stored in the hash table.
-    User/Kernel - how many pte's are in use by the kernel or user at that time.
-    Overflows - How many of the entries are in their secondary hash location.
-    Percent full - ratio of free pte entries to in use entries.
-    Reloads - Count of how many hash table misses have occurred
-              that were fixed with a reload from the linux tables.
-              Should always be 0 on 603 based machines.
-    Non-error Misses - Count of how many hash table misses have occurred
-              that were completed with the creation of a pte in the linux
-              tables with a call to do_page_fault().
-    Error Misses - Number of misses due to errors such as bad address
-              and permission violations.  This includes kernel access of
-              bad user addresses that are fixed up by the trap handler.
-
-  Note that calculation of the data displayed from /proc/ppc_htab takes
-  a long time and spends a great deal of time in the kernel.  It would
-  be quite hard on performance to read this file constantly.  In time
-  there may be a counter in the kernel that allows successive reads from
-  this file only after a given amount of time has passed to reduce the
-  possibility of a user slowing the system by reading this file.
-
-2. Writing
-
-  Writing to the ppc_htab allows you to change the characteristics of
-  the powerpc PTE hash table and setup performance monitoring.
-
-  Resizing the PTE hash table is not enabled right now due to many
-  complications with moving the hash table, rehashing the entries
-  and many many SMP issues that would have to be dealt with.
-
-  Write options to ppc_htab:
-  
-   - To set the size of the hash table to 64Kb:
-
-      echo 'size 64' > /proc/ppc_htab
-
-     The size must be a multiple of 64 and must be greater than or equal to
-     64.
-
-   - To turn off performance monitoring:
-
-      echo 'off' > /proc/ppc_htab
-
-   - To reset the counters without changing what they're counting:
-
-      echo 'reset' > /proc/ppc_htab
-
-     Note that counting will continue after the reset if it is enabled.
-
-   - To count only events in user mode or only in kernel mode:
-
-      echo 'user' > /proc/ppc_htab
-       ...or...
-      echo 'kernel' > /proc/ppc_htab
-
-     Note that these two options are exclusive of one another and the
-     lack of either of these options counts user and kernel.
-     Using 'reset' and 'off' reset these flags.
-
-   - The 604 has 2 performance counters which can each count events from
-     a specific set of events.  These sets are disjoint so it is not
-     possible to count _any_ combination of 2 events.  One event can
-     be counted by PMC1 and one by PMC2.
-
-     To start counting a particular event use:
-
-      echo 'event' > /proc/ppc_htab
-
-     and choose from these events:
-
-     PMC1
-     ----
-      'ic miss' - instruction cache misses
-      'dtlb' - data tlb misses (not hash table misses)
-
-     PMC2
-     ----
-      'dc miss' - data cache misses
-      'itlb' - instruction tlb misses (not hash table misses)
-      'load miss time' - cycles to complete a load miss
-
-3. Bugs
-
-  The PMC1 and PMC2 counters can overflow and give no indication of that
-  in /proc/ppc_htab.
diff --git a/Documentation/powerpc/smp.txt b/Documentation/powerpc/smp.txt
deleted file mode 100644 (file)
index 5b581b8..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-                 Information about Linux/PPC SMP mode
-=====================================================================
-
-This document and the related code was written by me
-(Cort Dougan, cort@fsmlabs.com) please email me if you have questions,
-comments or corrections.
-
-Last Change: 3.31.99
-
-If you want to help by writing code or testing different hardware please
-email me!
-
-1. State of Supported Hardware
-
-  PowerSurge Architecture - tested on UMAX s900, Apple 9600
-    The second processor on this machine boots up just fine and
-    enters its idle loop.  Hopefully a completely working SMP kernel
-    on this machine will be done shortly.
-
-    The code makes the assumption of only two processors.  The changes
-    necessary to work with any number would not be overly difficult but
-    I don't have any machines with >2 processors so it's not high on my
-    list of priorities.  If anyone else would like do to the work email
-    me and I can point out the places that need changed.  If you have >2
-    processors and don't want to add support yourself let me know and I
-    can take a look into it.
-
-  BeBox
-    BeBox support hasn't been added to the 2.1.X kernels from 2.0.X
-    but work is being done and SMP support for BeBox is in the works.
-
-  CHRP
-    CHRP SMP works and is fairly solid.  It's been tested on the IBM F50
-    with 4 processors for quite some time now.
index 587da5e..c171f5b 100644 (file)
@@ -415,8 +415,11 @@ config PPC_64K_PAGES
 
 config FORCE_MAX_ZONEORDER
        int "Maximum zone order"
+       range 9 64 if PPC_64K_PAGES
        default "9" if PPC_64K_PAGES
+       range 13 64 if PPC64 && !PPC_64K_PAGES
        default "13" if PPC64 && !PPC_64K_PAGES
+       range 11 64
        default "11"
        help
          The kernel memory allocator divides physically contiguous memory
@@ -806,6 +809,19 @@ config PIN_TLB
 endmenu
 
 if PPC64
+config RELOCATABLE
+       bool "Build a relocatable kernel"
+       help
+         This builds a kernel image that is capable of running anywhere
+         in the RMA (real memory area) at any 16k-aligned base address.
+         The kernel is linked as a position-independent executable (PIE)
+         and contains dynamic relocations which are processed early
+         in the bootup process.
+
+         One use is for the kexec on panic case where the recovery kernel
+         must live at a different physical address than the primary
+         kernel.
+
 config PAGE_OFFSET
        hex
        default "0xc000000000000000"
index 4ebc52a..15eb278 100644 (file)
@@ -51,6 +51,11 @@ config FTR_FIXUP_SELFTEST
        depends on DEBUG_KERNEL
        default n
 
+config MSI_BITMAP_SELFTEST
+       bool "Run self-tests of the MSI bitmap code."
+       depends on DEBUG_KERNEL
+       default n
+
 config XMON
        bool "Include xmon kernel debugger"
        depends on DEBUG_KERNEL
index c6be19e..24dd1a3 100644 (file)
@@ -63,7 +63,9 @@ override CC   += -m$(CONFIG_WORD_SIZE)
 override AR    := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR)
 endif
 
-LDFLAGS_vmlinux        := -Bstatic
+LDFLAGS_vmlinux-yy := -Bstatic
+LDFLAGS_vmlinux-$(CONFIG_PPC64)$(CONFIG_RELOCATABLE) := -pie
+LDFLAGS_vmlinux        := $(LDFLAGS_vmlinux-yy)
 
 CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none  -mcall-aixdesc
 CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
@@ -102,7 +104,10 @@ endif
 KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
 
 # No SPE instruction when building kernel
+# (We use all available options to help semi-broken compilers)
 KBUILD_CFLAGS += $(call cc-option,-mno-spe)
+KBUILD_CFLAGS += $(call cc-option,-mspe=no)
+KBUILD_CFLAGS += $(call cc-option,-mabi=no-spe)
 
 # Enable unit-at-a-time mode when possible. It shrinks the
 # kernel considerably.
index 65d1a84..aac1406 100644 (file)
@@ -310,8 +310,11 @@ $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
 $(obj)/vmlinux.strip: vmlinux
        $(STRIP) -s -R .comment $< -o $@
 
+# The iseries hypervisor won't take an ET_DYN executable, so this
+# changes the type (byte 17) in the file to ET_EXEC (2).
 $(obj)/zImage.iseries: vmlinux
        $(STRIP) -s -R .comment $< -o $@
+       printf "\x02" | dd of=$@ conv=notrunc bs=1 seek=17
 
 $(obj)/uImage: vmlinux $(wrapperbits)
        $(call if_changed,wrap,uboot)
index b1e5611..dcc9ab2 100644 (file)
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  *
- * Usage: addnote zImage
+ * Usage: addnote zImage [note.elf]
+ *
+ * If note.elf is supplied, it is the name of an ELF file that contains
+ * an RPA note to use instead of the built-in one.  Alternatively, the
+ * note.elf file may be empty, in which case the built-in RPA note is
+ * used (this is to simplify how this is invoked from the wrapper script).
  */
 #include <stdio.h>
 #include <stdlib.h>
@@ -43,27 +48,29 @@ char rpaname[] = "IBM,RPA-Client-Config";
  */
 #define N_RPA_DESCR    8
 unsigned int rpanote[N_RPA_DESCR] = {
-       0,                      /* lparaffinity */
-       64,                     /* min_rmo_size */
+       1,                      /* lparaffinity */
+       128,                    /* min_rmo_size */
        0,                      /* min_rmo_percent */
-       40,                     /* max_pft_size */
+       46,                     /* max_pft_size */
        1,                      /* splpar */
        -1,                     /* min_load */
-       0,                      /* new_mem_def */
-       1,                      /* ignore_my_client_config */
+       1,                      /* new_mem_def */
+       0,                      /* ignore_my_client_config */
 };
 
 #define ROUNDUP(len)   (((len) + 3) & ~3)
 
 unsigned char buf[512];
+unsigned char notebuf[512];
 
-#define GET_16BE(off)  ((buf[off] << 8) + (buf[(off)+1]))
-#define GET_32BE(off)  ((GET_16BE(off) << 16) + GET_16BE((off)+2))
+#define GET_16BE(b, off)       (((b)[off] << 8) + ((b)[(off)+1]))
+#define GET_32BE(b, off)       ((GET_16BE((b), (off)) << 16) + \
+                                GET_16BE((b), (off)+2))
 
-#define PUT_16BE(off, v)       (buf[off] = ((v) >> 8) & 0xff, \
-                                buf[(off) + 1] = (v) & 0xff)
-#define PUT_32BE(off, v)       (PUT_16BE((off), (v) >> 16), \
-                                PUT_16BE((off) + 2, (v)))
+#define PUT_16BE(b, off, v)    ((b)[off] = ((v) >> 8) & 0xff, \
+                                (b)[(off) + 1] = (v) & 0xff)
+#define PUT_32BE(b, off, v)    (PUT_16BE((b), (off), (v) >> 16), \
+                                PUT_16BE((b), (off) + 2, (v)))
 
 /* Structure of an ELF file */
 #define E_IDENT                0       /* ELF header */
@@ -88,15 +95,71 @@ unsigned char buf[512];
 
 unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' };
 
+unsigned char *read_rpanote(const char *fname, int *nnp)
+{
+       int notefd, nr, i;
+       int ph, ps, np;
+       int note, notesize;
+
+       notefd = open(fname, O_RDONLY);
+       if (notefd < 0) {
+               perror(fname);
+               exit(1);
+       }
+       nr = read(notefd, notebuf, sizeof(notebuf));
+       if (nr < 0) {
+               perror("read note");
+               exit(1);
+       }
+       if (nr == 0)            /* empty file */
+               return NULL;
+       if (nr < E_HSIZE ||
+           memcmp(&notebuf[E_IDENT+EI_MAGIC], elf_magic, 4) != 0 ||
+           notebuf[E_IDENT+EI_CLASS] != ELFCLASS32 ||
+           notebuf[E_IDENT+EI_DATA] != ELFDATA2MSB)
+               goto notelf;
+       close(notefd);
+
+       /* now look for the RPA-note */
+       ph = GET_32BE(notebuf, E_PHOFF);
+       ps = GET_16BE(notebuf, E_PHENTSIZE);
+       np = GET_16BE(notebuf, E_PHNUM);
+       if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
+               goto notelf;
+
+       for (i = 0; i < np; ++i, ph += ps) {
+               if (GET_32BE(notebuf, ph + PH_TYPE) != PT_NOTE)
+                       continue;
+               note = GET_32BE(notebuf, ph + PH_OFFSET);
+               notesize = GET_32BE(notebuf, ph + PH_FILESZ);
+               if (notesize < 34 || note + notesize > nr)
+                       continue;
+               if (GET_32BE(notebuf, note) != strlen(rpaname) + 1 ||
+                   GET_32BE(notebuf, note + 8) != 0x12759999 ||
+                   strcmp((char *)&notebuf[note + 12], rpaname) != 0)
+                       continue;
+               /* looks like an RPA note, return it */
+               *nnp = notesize;
+               return &notebuf[note];
+       }
+       /* no RPA note found */
+       return NULL;
+
+ notelf:
+       fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n", fname);
+       exit(1);
+}
+
 int
 main(int ac, char **av)
 {
        int fd, n, i;
        int ph, ps, np;
        int nnote, nnote2, ns;
+       unsigned char *rpap;
 
-       if (ac != 2) {
-               fprintf(stderr, "Usage: %s elf-file\n", av[0]);
+       if (ac != 2 && ac != 3) {
+               fprintf(stderr, "Usage: %s elf-file [rpanote.elf]\n", av[0]);
                exit(1);
        }
        fd = open(av[1], O_RDWR);
@@ -107,6 +170,7 @@ main(int ac, char **av)
 
        nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr);
        nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote);
+       rpap = NULL;
 
        n = read(fd, buf, sizeof(buf));
        if (n < 0) {
@@ -124,16 +188,19 @@ main(int ac, char **av)
                exit(1);
        }
 
-       ph = GET_32BE(E_PHOFF);
-       ps = GET_16BE(E_PHENTSIZE);
-       np = GET_16BE(E_PHNUM);
+       if (ac == 3)
+               rpap = read_rpanote(av[2], &nnote2);
+
+       ph = GET_32BE(buf, E_PHOFF);
+       ps = GET_16BE(buf, E_PHENTSIZE);
+       np = GET_16BE(buf, E_PHNUM);
        if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
                goto notelf;
        if (ph + (np + 2) * ps + nnote + nnote2 > n)
                goto nospace;
 
        for (i = 0; i < np; ++i) {
-               if (GET_32BE(ph + PH_TYPE) == PT_NOTE) {
+               if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) {
                        fprintf(stderr, "%s already has a note entry\n",
                                av[1]);
                        exit(0);
@@ -148,37 +215,42 @@ main(int ac, char **av)
 
        /* fill in the program header entry */
        ns = ph + 2 * ps;
-       PUT_32BE(ph + PH_TYPE, PT_NOTE);
-       PUT_32BE(ph + PH_OFFSET, ns);
-       PUT_32BE(ph + PH_FILESZ, nnote);
+       PUT_32BE(buf, ph + PH_TYPE, PT_NOTE);
+       PUT_32BE(buf, ph + PH_OFFSET, ns);
+       PUT_32BE(buf, ph + PH_FILESZ, nnote);
 
        /* fill in the note area we point to */
        /* XXX we should probably make this a proper section */
-       PUT_32BE(ns, strlen(arch) + 1);
-       PUT_32BE(ns + 4, N_DESCR * 4);
-       PUT_32BE(ns + 8, 0x1275);
+       PUT_32BE(buf, ns, strlen(arch) + 1);
+       PUT_32BE(buf, ns + 4, N_DESCR * 4);
+       PUT_32BE(buf, ns + 8, 0x1275);
        strcpy((char *) &buf[ns + 12], arch);
        ns += 12 + strlen(arch) + 1;
        for (i = 0; i < N_DESCR; ++i, ns += 4)
-               PUT_32BE(ns, descr[i]);
+               PUT_32BE(buf, ns, descr[i]);
 
        /* fill in the second program header entry and the RPA note area */
        ph += ps;
-       PUT_32BE(ph + PH_TYPE, PT_NOTE);
-       PUT_32BE(ph + PH_OFFSET, ns);
-       PUT_32BE(ph + PH_FILESZ, nnote2);
+       PUT_32BE(buf, ph + PH_TYPE, PT_NOTE);
+       PUT_32BE(buf, ph + PH_OFFSET, ns);
+       PUT_32BE(buf, ph + PH_FILESZ, nnote2);
 
        /* fill in the note area we point to */
-       PUT_32BE(ns, strlen(rpaname) + 1);
-       PUT_32BE(ns + 4, sizeof(rpanote));
-       PUT_32BE(ns + 8, 0x12759999);
-       strcpy((char *) &buf[ns + 12], rpaname);
-       ns += 12 + ROUNDUP(strlen(rpaname) + 1);
-       for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
-               PUT_32BE(ns, rpanote[i]);
+       if (rpap) {
+               /* RPA note supplied in file, just copy the whole thing over */
+               memcpy(buf + ns, rpap, nnote2);
+       } else {
+               PUT_32BE(buf, ns, strlen(rpaname) + 1);
+               PUT_32BE(buf, ns + 4, sizeof(rpanote));
+               PUT_32BE(buf, ns + 8, 0x12759999);
+               strcpy((char *) &buf[ns + 12], rpaname);
+               ns += 12 + ROUNDUP(strlen(rpaname) + 1);
+               for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
+                       PUT_32BE(buf, ns, rpanote[i]);
+       }
 
        /* Update the number of program headers */
-       PUT_16BE(E_PHNUM, np + 2);
+       PUT_16BE(buf, E_PHNUM, np + 2);
 
        /* write back */
        lseek(fd, (long) 0, SEEK_SET);
index d607fdb..6ddf9ec 100644 (file)
@@ -5,21 +5,5 @@
 #
 DTC_SRCS = dtc.c flattree.c fstree.c data.c livetree.c treesource.c srcpos.c \
        checks.c
-DTC_EXTRA = dtc.h srcpos.h
-DTC_LEXFILES = dtc-lexer.l
-DTC_BISONFILES = dtc-parser.y
-
-DTC_LEX_SRCS = $(DTC_LEXFILES:%.l=%.lex.c)
-DTC_BISON_SRCS = $(DTC_BISONFILES:%.y=%.tab.c)
-DTC_BISON_INCLUDES = $(DTC_BISONFILES:%.y=%.tab.h)
-
-DTC_GEN_SRCS = $(DTC_LEX_SRCS) $(DTC_BISON_SRCS)
-DTC_GEN_ALL = $(DTC_GEN_SRCS) $(DTC_BISON_INCLUDES)
+DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c
 DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
-
-DTC_CLEANFILES = $(DTC_GEN_ALL)
-
-# We assume the containing Makefile system can do auto-dependencies for most
-# things, but we supply the dependencies on generated header files explicitly
-
-$(addprefix $(DTC_objdir)/,$(DTC_GEN_SRCS:%.c=%.o)): $(addprefix $(DTC_objdir)/,$(DTC_BISON_INCLUDES))
index 2ce961c..9548579 100644 (file)
@@ -242,6 +242,42 @@ static void check_duplicate_property_names(struct check *c, struct node *dt,
 }
 NODE_CHECK(duplicate_property_names, NULL, ERROR);
 
+#define LOWERCASE      "abcdefghijklmnopqrstuvwxyz"
+#define UPPERCASE      "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define DIGITS         "0123456789"
+#define PROPNODECHARS  LOWERCASE UPPERCASE DIGITS ",._+*#?-"
+
+static void check_node_name_chars(struct check *c, struct node *dt,
+                                 struct node *node)
+{
+       int n = strspn(node->name, c->data);
+
+       if (n < strlen(node->name))
+               FAIL(c, "Bad character '%c' in node %s",
+                    node->name[n], node->fullpath);
+}
+NODE_CHECK(node_name_chars, PROPNODECHARS "@", ERROR);
+
+static void check_node_name_format(struct check *c, struct node *dt,
+                                  struct node *node)
+{
+       if (strchr(get_unitname(node), '@'))
+               FAIL(c, "Node %s has multiple '@' characters in name",
+                    node->fullpath);
+}
+NODE_CHECK(node_name_format, NULL, ERROR, &node_name_chars);
+
+static void check_property_name_chars(struct check *c, struct node *dt,
+                                     struct node *node, struct property *prop)
+{
+       int n = strspn(prop->name, c->data);
+
+       if (n < strlen(prop->name))
+               FAIL(c, "Bad character '%c' in property name \"%s\", node %s",
+                    prop->name[n], prop->name, node->fullpath);
+}
+PROP_CHECK(property_name_chars, PROPNODECHARS, ERROR);
+
 static void check_explicit_phandles(struct check *c, struct node *root,
                                          struct node *node)
 {
@@ -280,16 +316,29 @@ NODE_CHECK(explicit_phandles, NULL, ERROR);
 static void check_name_properties(struct check *c, struct node *root,
                                  struct node *node)
 {
-       struct property *prop;
+       struct property **pp, *prop = NULL;
+
+       for (pp = &node->proplist; *pp; pp = &((*pp)->next))
+               if (streq((*pp)->name, "name")) {
+                       prop = *pp;
+                       break;
+               }
 
-       prop = get_property(node, "name");
        if (!prop)
                return; /* No name property, that's fine */
 
        if ((prop->val.len != node->basenamelen+1)
-           || (memcmp(prop->val.val, node->name, node->basenamelen) != 0))
+           || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) {
                FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead"
                     " of base node name)", node->fullpath, prop->val.val);
+       } else {
+               /* The name property is correct, and therefore redundant.
+                * Delete it */
+               *pp = prop->next;
+               free(prop->name);
+               data_free(prop->val);
+               free(prop);
+       }
 }
 CHECK_IS_STRING(name_is_string, "name", ERROR);
 NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);
@@ -301,23 +350,23 @@ NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);
 static void fixup_phandle_references(struct check *c, struct node *dt,
                                     struct node *node, struct property *prop)
 {
-      struct marker *m = prop->val.markers;
-      struct node *refnode;
-      cell_t phandle;
-
-      for_each_marker_of_type(m, REF_PHANDLE) {
-             assert(m->offset + sizeof(cell_t) <= prop->val.len);
-
-             refnode = get_node_by_ref(dt, m->ref);
-             if (! refnode) {
-                     FAIL(c, "Reference to non-existent node or label \"%s\"\n",
-                          m->ref);
-                     continue;
-             }
-
-             phandle = get_node_phandle(dt, refnode);
-             *((cell_t *)(prop->val.val + m->offset)) = cpu_to_be32(phandle);
-      }
+       struct marker *m = prop->val.markers;
+       struct node *refnode;
+       cell_t phandle;
+
+       for_each_marker_of_type(m, REF_PHANDLE) {
+               assert(m->offset + sizeof(cell_t) <= prop->val.len);
+
+               refnode = get_node_by_ref(dt, m->ref);
+               if (! refnode) {
+                       FAIL(c, "Reference to non-existent node or label \"%s\"\n",
+                            m->ref);
+                       continue;
+               }
+
+               phandle = get_node_phandle(dt, refnode);
+               *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
+       }
 }
 CHECK(phandle_references, NULL, NULL, fixup_phandle_references, NULL, ERROR,
       &duplicate_node_names, &explicit_phandles);
@@ -498,6 +547,7 @@ TREE_CHECK(obsolete_chosen_interrupt_controller, NULL, WARN);
 
 static struct check *check_table[] = {
        &duplicate_node_names, &duplicate_property_names,
+       &node_name_chars, &node_name_format, &property_name_chars,
        &name_is_string, &name_properties,
        &explicit_phandles,
        &phandle_references, &path_references,
@@ -511,10 +561,7 @@ static struct check *check_table[] = {
        &obsolete_chosen_interrupt_controller,
 };
 
-int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
-
-void process_checks(int force, struct boot_info *bi,
-                   int checkflag, int outversion, int boot_cpuid_phys)
+void process_checks(int force, struct boot_info *bi)
 {
        struct node *dt = bi->dt;
        int i;
@@ -537,214 +584,4 @@ void process_checks(int force, struct boot_info *bi,
                                "output forced\n");
                }
        }
-
-       if (checkflag) {
-               if (error) {
-                       fprintf(stderr, "Warning: Skipping semantic checks due to structural errors\n");
-               } else {
-                       if (!check_semantics(bi->dt, outversion,
-                                            boot_cpuid_phys))
-                               fprintf(stderr, "Warning: Input tree has semantic errors\n");
-               }
-       }
-}
-
-/*
- * Semantic check functions
- */
-
-#define ERRMSG(...) if (quiet < 2) fprintf(stderr, "ERROR: " __VA_ARGS__)
-#define WARNMSG(...) if (quiet < 1) fprintf(stderr, "Warning: " __VA_ARGS__)
-
-#define DO_ERR(...) do {ERRMSG(__VA_ARGS__); ok = 0; } while (0)
-
-#define CHECK_HAVE(node, propname) \
-       do { \
-               if (! (prop = get_property((node), (propname)))) \
-                       DO_ERR("Missing \"%s\" property in %s\n", (propname), \
-                               (node)->fullpath); \
-       } while (0);
-
-#define CHECK_HAVE_WARN(node, propname) \
-       do { \
-               if (! (prop  = get_property((node), (propname)))) \
-                       WARNMSG("%s has no \"%s\" property\n", \
-                               (node)->fullpath, (propname)); \
-       } while (0)
-
-#define CHECK_HAVE_STRING(node, propname) \
-       do { \
-               CHECK_HAVE((node), (propname)); \
-               if (prop && !data_is_one_string(prop->val)) \
-                       DO_ERR("\"%s\" property in %s is not a string\n", \
-                               (propname), (node)->fullpath); \
-       } while (0)
-
-#define CHECK_HAVE_STREQ(node, propname, value) \
-       do { \
-               CHECK_HAVE_STRING((node), (propname)); \
-               if (prop && !streq(prop->val.val, (value))) \
-                       DO_ERR("%s has wrong %s, %s (should be %s\n", \
-                               (node)->fullpath, (propname), \
-                               prop->val.val, (value)); \
-       } while (0)
-
-#define CHECK_HAVE_ONECELL(node, propname) \
-       do { \
-               CHECK_HAVE((node), (propname)); \
-               if (prop && (prop->val.len != sizeof(cell_t))) \
-                       DO_ERR("\"%s\" property in %s has wrong size %d (should be 1 cell)\n", (propname), (node)->fullpath, prop->val.len); \
-       } while (0)
-
-#define CHECK_HAVE_WARN_ONECELL(node, propname) \
-       do { \
-               CHECK_HAVE_WARN((node), (propname)); \
-               if (prop && (prop->val.len != sizeof(cell_t))) \
-                       DO_ERR("\"%s\" property in %s has wrong size %d (should be 1 cell)\n", (propname), (node)->fullpath, prop->val.len); \
-       } while (0)
-
-#define CHECK_HAVE_WARN_PHANDLE(xnode, propname, root) \
-       do { \
-               struct node *ref; \
-               CHECK_HAVE_WARN_ONECELL((xnode), (propname)); \
-               if (prop) {\
-                       cell_t phandle = propval_cell(prop); \
-                       if ((phandle == 0) || (phandle == -1)) { \
-                               DO_ERR("\"%s\" property in %s contains an invalid phandle %x\n", (propname), (xnode)->fullpath, phandle); \
-                       } else { \
-                               ref = get_node_by_phandle((root), propval_cell(prop)); \
-                               if (! ref) \
-                                       DO_ERR("\"%s\" property in %s refers to non-existant phandle %x\n", (propname), (xnode)->fullpath, propval_cell(prop)); \
-                       } \
-               } \
-       } while (0)
-
-#define CHECK_HAVE_WARN_STRING(node, propname) \
-       do { \
-               CHECK_HAVE_WARN((node), (propname)); \
-               if (prop && !data_is_one_string(prop->val)) \
-                       DO_ERR("\"%s\" property in %s is not a string\n", \
-                               (propname), (node)->fullpath); \
-       } while (0)
-
-static int check_root(struct node *root)
-{
-       struct property *prop;
-       int ok = 1;
-
-       CHECK_HAVE_STRING(root, "model");
-       CHECK_HAVE_WARN(root, "compatible");
-
-       return ok;
-}
-
-static int check_cpus(struct node *root, int outversion, int boot_cpuid_phys)
-{
-       struct node *cpus, *cpu;
-       struct property *prop;
-       struct node *bootcpu = NULL;
-       int ok = 1;
-
-       cpus = get_subnode(root, "cpus");
-       if (! cpus) {
-               ERRMSG("Missing /cpus node\n");
-               return 0;
-       }
-
-       if (cpus->addr_cells != 1)
-               DO_ERR("%s has bad #address-cells value %d (should be 1)\n",
-                      cpus->fullpath, cpus->addr_cells);
-       if (cpus->size_cells != 0)
-               DO_ERR("%s has bad #size-cells value %d (should be 0)\n",
-                      cpus->fullpath, cpus->size_cells);
-
-       for_each_child(cpus, cpu) {
-               CHECK_HAVE_STREQ(cpu, "device_type", "cpu");
-
-               CHECK_HAVE_ONECELL(cpu, "reg");
-               if (prop) {
-                       cell_t unitnum;
-                       char *eptr;
-
-                       unitnum = strtol(get_unitname(cpu), &eptr, 16);
-                       if (*eptr) {
-                               WARNMSG("%s has bad format unit name %s (should be CPU number\n",
-                                       cpu->fullpath, get_unitname(cpu));
-                       } else if (unitnum != propval_cell(prop)) {
-                               WARNMSG("%s unit name \"%s\" does not match \"reg\" property <%x>\n",
-                                      cpu->fullpath, get_unitname(cpu),
-                                      propval_cell(prop));
-                       }
-               }
-
-/*             CHECK_HAVE_ONECELL(cpu, "d-cache-line-size"); */
-/*             CHECK_HAVE_ONECELL(cpu, "i-cache-line-size"); */
-               CHECK_HAVE_ONECELL(cpu, "d-cache-size");
-               CHECK_HAVE_ONECELL(cpu, "i-cache-size");
-
-               CHECK_HAVE_WARN_ONECELL(cpu, "clock-frequency");
-               CHECK_HAVE_WARN_ONECELL(cpu, "timebase-frequency");
-
-               prop = get_property(cpu, "linux,boot-cpu");
-               if (prop) {
-                       if (prop->val.len)
-                               WARNMSG("\"linux,boot-cpu\" property in %s is non-empty\n",
-                                       cpu->fullpath);
-                       if (bootcpu)
-                               DO_ERR("Multiple boot cpus (%s and %s)\n",
-                                      bootcpu->fullpath, cpu->fullpath);
-                       else
-                               bootcpu = cpu;
-               }
-       }
-
-       if (outversion < 2) {
-               if (! bootcpu)
-                       WARNMSG("No cpu has \"linux,boot-cpu\" property\n");
-       } else {
-               if (bootcpu)
-                       WARNMSG("\"linux,boot-cpu\" property is deprecated in blob version 2 or higher\n");
-               if (boot_cpuid_phys == 0xfeedbeef)
-                       WARNMSG("physical boot CPU not set.  Use -b option to set\n");
-       }
-
-       return ok;
-}
-
-static int check_memory(struct node *root)
-{
-       struct node *mem;
-       struct property *prop;
-       int nnodes = 0;
-       int ok = 1;
-
-       for_each_child(root, mem) {
-               if (! strneq(mem->name, "memory", mem->basenamelen))
-                       continue;
-
-               nnodes++;
-
-               CHECK_HAVE_STREQ(mem, "device_type", "memory");
-               CHECK_HAVE(mem, "reg");
-       }
-
-       if (nnodes == 0) {
-               ERRMSG("No memory nodes\n");
-               return 0;
-       }
-
-       return ok;
-}
-
-int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys)
-{
-       int ok = 1;
-
-       ok = ok && check_root(dt);
-       ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
-       ok = ok && check_memory(dt);
-       if (! ok)
-               return 0;
-
-       return 1;
 }
index a94718c..dd2e3d3 100644 (file)
@@ -32,8 +32,6 @@ void data_free(struct data d)
                m = nm;
        }
 
-       assert(!d.val || d.asize);
-
        if (d.val)
                free(d.val);
 }
@@ -43,9 +41,6 @@ struct data data_grow_for(struct data d, int xlen)
        struct data nd;
        int newsize;
 
-       /* we must start with an allocated datum */
-       assert(!d.val || d.asize);
-
        if (xlen == 0)
                return d;
 
@@ -56,11 +51,8 @@ struct data data_grow_for(struct data d, int xlen)
        while ((d.len + xlen) > newsize)
                newsize *= 2;
 
-       nd.asize = newsize;
        nd.val = xrealloc(d.val, newsize);
 
-       assert(nd.asize >= (d.len + xlen));
-
        return nd;
 }
 
@@ -83,16 +75,11 @@ static char get_oct_char(const char *s, int *i)
        long val;
 
        x[3] = '\0';
-       x[0] = s[(*i)];
-       if (x[0]) {
-               x[1] = s[(*i)+1];
-               if (x[1])
-                       x[2] = s[(*i)+2];
-       }
+       strncpy(x, s + *i, 3);
 
        val = strtol(x, &endx, 8);
-       if ((endx - x) == 0)
-               fprintf(stderr, "Empty \\nnn escape\n");
+
+       assert(endx > x);
 
        (*i) += endx - x;
        return val;
@@ -105,13 +92,11 @@ static char get_hex_char(const char *s, int *i)
        long val;
 
        x[2] = '\0';
-       x[0] = s[(*i)];
-       if (x[0])
-               x[1] = s[(*i)+1];
+       strncpy(x, s + *i, 2);
 
        val = strtol(x, &endx, 16);
-       if ((endx - x) == 0)
-               fprintf(stderr, "Empty \\x escape\n");
+       if (!(endx  > x))
+               die("\\x used with no following hex digits\n");
 
        (*i) += endx - x;
        return val;
@@ -182,14 +167,29 @@ struct data data_copy_escape_string(const char *s, int len)
        return d;
 }
 
-struct data data_copy_file(FILE *f, size_t len)
+struct data data_copy_file(FILE *f, size_t maxlen)
 {
-       struct data d;
+       struct data d = empty_data;
 
-       d = data_grow_for(empty_data, len);
+       while (!feof(f) && (d.len < maxlen)) {
+               size_t chunksize, ret;
 
-       d.len = len;
-       fread(d.val, len, 1, f);
+               if (maxlen == -1)
+                       chunksize = 4096;
+               else
+                       chunksize = maxlen - d.len;
+
+               d = data_grow_for(d, chunksize);
+               ret = fread(d.val + d.len, 1, chunksize, f);
+
+               if (ferror(f))
+                       die("Error reading file into data: %s", strerror(errno));
+
+               if (d.len + ret < d.len)
+                       die("Overflow reading file into data\n");
+
+               d.len += ret;
+       }
 
        return d;
 }
@@ -247,7 +247,7 @@ struct data data_merge(struct data d1, struct data d2)
 
 struct data data_append_cell(struct data d, cell_t word)
 {
-       cell_t beword = cpu_to_be32(word);
+       cell_t beword = cpu_to_fdt32(word);
 
        return data_append_data(d, &beword, sizeof(beword));
 }
@@ -256,15 +256,15 @@ struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
 {
        struct fdt_reserve_entry bere;
 
-       bere.address = cpu_to_be64(re->address);
-       bere.size = cpu_to_be64(re->size);
+       bere.address = cpu_to_fdt64(re->address);
+       bere.size = cpu_to_fdt64(re->size);
 
        return data_append_data(d, &bere, sizeof(bere));
 }
 
-struct data data_append_addr(struct data d, u64 addr)
+struct data data_append_addr(struct data d, uint64_t addr)
 {
-       u64 beaddr = cpu_to_be64(addr);
+       uint64_t beaddr = cpu_to_fdt64(addr);
 
        return data_append_data(d, &beaddr, sizeof(beaddr));
 }
index c811b22..44dbfd3 100644 (file)
 PROPNODECHAR   [a-zA-Z0-9,._+*#?@-]
 PATHCHAR       ({PROPNODECHAR}|[/])
 LABEL          [a-zA-Z_][a-zA-Z0-9_]*
+STRING         \"([^\\"]|\\.)*\"
+WS             [[:space:]]
+COMMENT                "/*"([^*]|\*+[^*/])*\*+"/"
+LINECOMMENT    "//".*\n
 
 %{
 #include "dtc.h"
@@ -52,29 +56,26 @@ static int dts_version; /* = 0 */
                                DPRINT("<V1>\n"); \
                                BEGIN(V1); \
                        }
+
+static void push_input_file(const char *filename);
+static int pop_input_file(void);
 %}
 
 %%
-<*>"/include/"         BEGIN(INCLUDE);
-
-<INCLUDE>\"[^"\n]*\"   {
-                       yytext[strlen(yytext) - 1] = 0;
-                       if (!push_input_file(yytext + 1)) {
-                               /* Some unrecoverable error.*/
-                               exit(1);
-                       }
-                       BEGIN_DEFAULT();
+<*>"/include/"{WS}*{STRING} {
+                       char *name = strchr(yytext, '\"') + 1;
+                       yytext[yyleng-1] = '\0';
+                       push_input_file(name);
                }
 
-
 <*><<EOF>>             {
                        if (!pop_input_file()) {
                                yyterminate();
                        }
                }
 
-<*>\"([^\\"]|\\.)*\"   {
-                       yylloc.filenum = srcpos_filenum;
+<*>{STRING}    {
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("String: %s\n", yytext);
                        yylval.data = data_copy_escape_string(yytext+1,
@@ -84,7 +85,7 @@ static int dts_version; /* = 0 */
                }
 
 <*>"/dts-v1/"  {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Keyword: /dts-v1/\n");
                        dts_version = 1;
@@ -93,7 +94,7 @@ static int dts_version; /* = 0 */
                }
 
 <*>"/memreserve/"      {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Keyword: /memreserve/\n");
                        BEGIN_DEFAULT();
@@ -101,7 +102,7 @@ static int dts_version; /* = 0 */
                }
 
 <*>{LABEL}:    {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Label: %s\n", yytext);
                        yylval.labelref = strdup(yytext);
@@ -110,7 +111,7 @@ static int dts_version; /* = 0 */
                }
 
 <INITIAL>[bodh]# {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        if (*yytext == 'b')
                                yylval.cbase = 2;
@@ -125,7 +126,7 @@ static int dts_version; /* = 0 */
                }
 
 <INITIAL>[0-9a-fA-F]+  {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yylval.literal = strdup(yytext);
                        DPRINT("Literal: '%s'\n", yylval.literal);
@@ -133,7 +134,7 @@ static int dts_version; /* = 0 */
                }
 
 <V1>[0-9]+|0[xX][0-9a-fA-F]+      {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yylval.literal = strdup(yytext);
                        DPRINT("Literal: '%s'\n", yylval.literal);
@@ -141,7 +142,7 @@ static int dts_version; /* = 0 */
                }
 
 \&{LABEL}      {       /* label reference */
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Ref: %s\n", yytext+1);
                        yylval.labelref = strdup(yytext+1);
@@ -149,7 +150,7 @@ static int dts_version; /* = 0 */
                }
 
 "&{/"{PATHCHAR}+\}     {       /* new-style path reference */
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yytext[yyleng-1] = '\0';
                        DPRINT("Ref: %s\n", yytext+2);
@@ -158,7 +159,7 @@ static int dts_version; /* = 0 */
                }
 
 <INITIAL>"&/"{PATHCHAR}+ {     /* old-style path reference */
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Ref: %s\n", yytext+1);
                        yylval.labelref = strdup(yytext+1);
@@ -166,7 +167,7 @@ static int dts_version; /* = 0 */
                }
 
 <BYTESTRING>[0-9a-fA-F]{2} {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yylval.byte = strtol(yytext, NULL, 16);
                        DPRINT("Byte: %02x\n", (int)yylval.byte);
@@ -174,7 +175,7 @@ static int dts_version; /* = 0 */
                }
 
 <BYTESTRING>"]"        {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("/BYTESTRING\n");
                        BEGIN_DEFAULT();
@@ -182,7 +183,7 @@ static int dts_version; /* = 0 */
                }
 
 <PROPNODENAME>{PROPNODECHAR}+ {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("PropNodeName: %s\n", yytext);
                        yylval.propnodename = strdup(yytext);
@@ -190,20 +191,19 @@ static int dts_version; /* = 0 */
                        return DT_PROPNODENAME;
                }
 
-
-<*>[[:space:]]+        /* eat whitespace */
-
-<*>"/*"([^*]|\*+[^*/])*\*+"/"  {
-                       yylloc.filenum = srcpos_filenum;
+"/incbin/"     {
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
-                       DPRINT("Comment: %s\n", yytext);
-                       /* eat comments */
+                       DPRINT("Binary Include\n");
+                       return DT_INCBIN;
                }
 
-<*>"//".*\n    /* eat line comments */
+<*>{WS}+       /* eat whitespace */
+<*>{COMMENT}+  /* eat C-style comments */
+<*>{LINECOMMENT}+ /* eat C++-style comments */
 
 <*>.           {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Char: %c (\\x%02x)\n", yytext[0],
                                (unsigned)yytext[0]);
@@ -227,14 +227,13 @@ static int dts_version; /* = 0 */
  */
 
 struct incl_file {
-       int filenum;
-       FILE *file;
+       struct dtc_file *file;
        YY_BUFFER_STATE yy_prev_buf;
        int yy_prev_lineno;
        struct incl_file *prev;
 };
 
-struct incl_file *incl_file_stack;
+static struct incl_file *incl_file_stack;
 
 
 /*
@@ -245,36 +244,34 @@ struct incl_file *incl_file_stack;
 static int incl_depth = 0;
 
 
-int push_input_file(const char *filename)
+static void push_input_file(const char *filename)
 {
-       FILE *f;
        struct incl_file *incl_file;
+       struct dtc_file *newfile;
+       struct search_path search, *searchptr = NULL;
 
-       if (!filename) {
-               yyerror("No include file name given.");
-               return 0;
-       }
+       assert(filename);
 
-       if (incl_depth++ >= MAX_INCLUDE_DEPTH) {
-               yyerror("Includes nested too deeply");
-               return 0;
+       if (incl_depth++ >= MAX_INCLUDE_DEPTH)
+               die("Includes nested too deeply");
+
+       if (srcpos_file) {
+               search.dir = srcpos_file->dir;
+               search.next = NULL;
+               search.prev = NULL;
+               searchptr = &search;
        }
 
-       f = dtc_open_file(filename);
+       newfile = dtc_open_file(filename, searchptr);
 
-       incl_file = malloc(sizeof(struct incl_file));
-       if (!incl_file) {
-               yyerror("Can not allocate include file space.");
-               return 0;
-       }
+       incl_file = xmalloc(sizeof(struct incl_file));
 
        /*
         * Save current context.
         */
        incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
        incl_file->yy_prev_lineno = yylineno;
-       incl_file->filenum = srcpos_filenum;
-       incl_file->file = yyin;
+       incl_file->file = srcpos_file;
        incl_file->prev = incl_file_stack;
 
        incl_file_stack = incl_file;
@@ -282,23 +279,21 @@ int push_input_file(const char *filename)
        /*
         * Establish new context.
         */
-       srcpos_filenum = lookup_file_name(filename, 0);
+       srcpos_file = newfile;
        yylineno = 1;
-       yyin = f;
+       yyin = newfile->file;
        yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
-
-       return 1;
 }
 
 
-int pop_input_file(void)
+static int pop_input_file(void)
 {
        struct incl_file *incl_file;
 
        if (incl_file_stack == 0)
                return 0;
 
-       fclose(yyin);
+       dtc_close_file(srcpos_file);
 
        /*
         * Pop.
@@ -313,16 +308,13 @@ int pop_input_file(void)
        yy_delete_buffer(YY_CURRENT_BUFFER);
        yy_switch_to_buffer(incl_file->yy_prev_buf);
        yylineno = incl_file->yy_prev_lineno;
-       srcpos_filenum = incl_file->filenum;
-       yyin = incl_file->file;
+       srcpos_file = incl_file->file;
+       yyin = incl_file->file ? incl_file->file->file : NULL;
 
        /*
         * Free old state.
         */
        free(incl_file);
 
-       if (YY_CURRENT_BUFFER == 0)
-               return 0;
-
        return 1;
 }
index d0f7424..ac392cb 100644 (file)
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 34
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -31,7 +31,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -94,11 +94,12 @@ typedef unsigned int flex_uint32_t;
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
 #endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -194,11 +195,13 @@ extern FILE *yyin, *yyout;
 /* The following is because we cannot portably get our hands on size_t
  * (without autoconf's help, which isn't available because we want
  * flex-generated scanners to compile on their own).
+ * Given that the standard has decreed that size_t exists since 1989,
+ * I guess we can afford to depend on it. Manoj.
  */
 
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -349,7 +352,7 @@ void yyfree (void *  );
 
 /* Begin user sect3 */
 
-#define yywrap() 1
+#define yywrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -389,19 +392,20 @@ struct yy_trans_info
        flex_int32_t yy_verify;
        flex_int32_t yy_nxt;
        };
-static yyconst flex_int16_t yy_accept[94] =
+static yyconst flex_int16_t yy_accept[104] =
     {   0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       21,   19,   16,   16,   19,   19,   19,    8,    8,   19,
-        8,   19,   19,   19,   19,   14,   15,   15,   19,    9,
-        9,   16,    0,    3,    0,    0,   10,    0,    0,    0,
-        0,    0,    0,    8,    8,    6,    0,    7,    0,    2,
-        0,   13,   13,   15,   15,    9,    0,   12,   10,    0,
-        0,    0,    0,   18,    0,    0,    0,    2,    9,    0,
-       17,    0,    0,    0,   11,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    4,    0,    0,    1,    0,    0,
-        0,    5,    0
-
+       21,   19,   16,   16,   19,   19,   19,    7,    7,   19,
+        7,   19,   19,   19,   19,   13,   14,   14,   19,    8,
+        8,   16,    0,    2,    0,    0,    9,    0,    0,    0,
+        0,    0,    0,    7,    7,    5,    0,    6,    0,   12,
+       12,   14,   14,    8,    0,   11,    9,    0,    0,    0,
+        0,   18,    0,    0,    0,    0,    8,    0,   17,    0,
+        0,    0,    0,    0,   10,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    3,   15,
+        0,    0,    0,    0,    0,    0,    0,    0,    1,    0,
+
+        0,    4,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -444,122 +448,126 @@ static yyconst flex_int32_t yy_meta[36] =
         7,    7,    7,    8,    1
     } ;
 
-static yyconst flex_int16_t yy_base[107] =
+static yyconst flex_int16_t yy_base[117] =
     {   0,
-        0,    0,   32,    0,   53,    0,   76,    0,  108,  111,
-      280,  288,   37,   39,   33,   36,  106,    0,  123,  146,
-      255,  251,   45,    0,  159,  288,    0,   53,  108,  172,
-      114,  127,  158,  288,  245,    0,    0,  234,  235,  236,
-      197,  195,  199,    0,    0,  288,    0,  288,  160,  288,
-      183,  288,    0,    0,  183,  182,    0,    0,    0,    0,
-      204,  189,  207,  288,  179,  187,  180,  194,    0,  171,
-      288,  196,  178,  174,  288,  169,  169,  177,  165,  153,
-      143,  155,  137,  118,  288,  122,   42,  288,   36,   36,
-       40,  288,  288,  212,  218,  223,  229,  234,  239,  245,
-
-      251,  255,  262,  270,  275,  280
+        0,    0,   30,    0,   44,    0,   67,    0,   97,  105,
+      302,  303,   35,   44,   40,   94,  112,    0,  129,  152,
+      296,  295,  159,    0,  176,  303,    0,  116,   95,  165,
+       49,   46,  102,  303,  296,    0,    0,  288,  290,  293,
+      264,  266,  270,    0,    0,  303,    0,  303,  264,  303,
+        0,    0,  195,  101,    0,    0,    0,    0,  284,  125,
+      277,  265,  225,  230,  216,  218,    0,  202,  224,  221,
+      217,  107,  196,  188,  303,  206,  179,  186,  178,  185,
+      183,  162,  161,  150,  169,  160,  145,  125,  303,  303,
+      137,  109,  190,  103,  203,  167,  108,  197,  303,  123,
+
+       29,  303,  303,  215,  221,  226,  229,  234,  240,  246,
+      250,  257,  265,  270,  275,  282
     } ;
 
-static yyconst flex_int16_t yy_def[107] =
+static yyconst flex_int16_t yy_def[117] =
     {   0,
-       93,    1,    1,    3,    3,    5,   93,    7,    3,    3,
-       93,   93,   93,   93,   94,   95,   93,   96,   93,   19,
-       19,   20,   97,   98,   20,   93,   99,  100,   95,   93,
-       93,   93,   94,   93,   94,  101,  102,   93,  103,  104,
-       93,   93,   93,   96,   19,   93,   20,   93,   97,   93,
-       97,   93,   20,   99,  100,   93,  105,  101,  102,  106,
-      103,  103,  104,   93,   93,   93,   93,   94,  105,  106,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-       93,   93,    0,   93,   93,   93,   93,   93,   93,   93,
-
-       93,   93,   93,   93,   93,   93
+      103,    1,    1,    3,    3,    5,  103,    7,    3,    3,
+      103,  103,  103,  103,  104,  105,  103,  106,  103,   19,
+       19,   20,  103,  107,   20,  103,  108,  109,  105,  103,
+      103,  103,  104,  103,  104,  110,  111,  103,  112,  113,
+      103,  103,  103,  106,   19,  103,   20,  103,  103,  103,
+       20,  108,  109,  103,  114,  110,  111,  115,  112,  112,
+      113,  103,  103,  103,  103,  103,  114,  115,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  116,  103,  116,  103,  116,
+
+      103,  103,    0,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103
     } ;
 
-static yyconst flex_int16_t yy_nxt[324] =
+static yyconst flex_int16_t yy_nxt[339] =
     {   0,
        12,   13,   14,   15,   12,   16,   12,   12,   12,   17,
        18,   18,   18,   12,   19,   20,   20,   12,   12,   21,
        19,   21,   19,   22,   20,   20,   20,   20,   20,   20,
-       20,   20,   20,   12,   12,   23,   34,   12,   32,   32,
-       32,   32,   12,   12,   12,   36,   20,   33,   50,   92,
-       35,   20,   20,   20,   20,   20,   15,   54,   91,   54,
-       54,   54,   51,   24,   24,   24,   46,   25,   90,   38,
-       89,   26,   25,   25,   25,   25,   12,   13,   14,   15,
-       27,   12,   27,   27,   27,   17,   27,   27,   27,   12,
-       28,   28,   28,   12,   12,   28,   28,   28,   28,   28,
-
-       28,   28,   28,   28,   28,   28,   28,   28,   28,   12,
-       12,   15,   39,   29,   15,   40,   29,   93,   30,   31,
-       31,   30,   31,   31,   56,   56,   56,   41,   32,   32,
-       42,   88,   43,   45,   45,   45,   46,   45,   47,   47,
-       87,   38,   45,   45,   45,   45,   47,   47,   47,   47,
-       47,   47,   47,   47,   47,   47,   47,   47,   47,   86,
-       47,   34,   33,   50,   85,   47,   47,   47,   47,   53,
-       53,   53,   84,   53,   83,   35,   82,   51,   53,   53,
-       53,   53,   56,   56,   56,   93,   68,   54,   57,   54,
-       54,   54,   56,   56,   56,   62,   46,   34,   71,   81,
-
-       80,   79,   78,   77,   76,   75,   74,   73,   72,   64,
-       62,   35,   33,   33,   33,   33,   33,   33,   33,   33,
-       37,   67,   66,   37,   37,   37,   44,   65,   44,   49,
-       49,   49,   49,   49,   49,   49,   49,   52,   64,   52,
-       54,   62,   54,   60,   54,   54,   55,   93,   55,   55,
-       55,   55,   58,   58,   58,   48,   58,   58,   59,   48,
-       59,   59,   61,   61,   61,   61,   61,   61,   61,   61,
-       63,   63,   63,   63,   63,   63,   63,   63,   69,   93,
-       69,   70,   70,   70,   93,   70,   70,   11,   93,   93,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-       93,   93,   93
+       20,   20,   20,   12,   12,   12,   32,   32,  102,   23,
+       12,   12,   12,   34,   20,   32,   32,   32,   32,   20,
+       20,   20,   20,   20,   24,   24,   24,   35,   25,   54,
+       54,   54,   26,   25,   25,   25,   25,   12,   13,   14,
+       15,   27,   12,   27,   27,   27,   23,   27,   27,   27,
+       12,   28,   28,   28,   12,   12,   28,   28,   28,   28,
+       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
+
+       12,   12,   29,   36,  103,   34,   17,   30,   31,   31,
+       29,   54,   54,   54,   17,   30,   31,   31,   39,   35,
+       52,   40,   52,   52,   52,  103,   78,   38,   38,   46,
+      101,   60,   79,   41,   69,   97,   42,   94,   43,   45,
+       45,   45,   46,   45,   47,   47,   93,   92,   45,   45,
+       45,   45,   47,   47,   47,   47,   47,   47,   47,   47,
+       47,   47,   47,   47,   47,   39,   47,   91,   40,   90,
+       99,   47,   47,   47,   47,   54,   54,   54,   89,   88,
+       41,   55,   87,   49,  100,   43,   51,   51,   51,   86,
+       51,   95,   95,   96,   85,   51,   51,   51,   51,   52,
+
+       99,   52,   52,   52,   95,   95,   96,   84,   46,   83,
+       82,   81,   39,   79,  100,   33,   33,   33,   33,   33,
+       33,   33,   33,   37,   80,   77,   37,   37,   37,   44,
+       40,   44,   50,   76,   50,   52,   75,   52,   74,   52,
+       52,   53,   73,   53,   53,   53,   53,   56,   56,   56,
+       72,   56,   56,   57,   71,   57,   57,   59,   59,   59,
+       59,   59,   59,   59,   59,   61,   61,   61,   61,   61,
+       61,   61,   61,   67,   70,   67,   68,   68,   68,   62,
+       68,   68,   98,   98,   98,   98,   98,   98,   98,   98,
+       60,   66,   65,   64,   63,   62,   60,   58,  103,   48,
+
+       48,  103,   11,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103
     } ;
 
-static yyconst flex_int16_t yy_chk[324] =
+static yyconst flex_int16_t yy_chk[339] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    3,   15,    3,   13,   13,
-       14,   14,    3,    3,    3,   16,    3,   23,   23,   91,
-       15,    3,    3,    3,    3,    3,    5,   28,   90,   28,
-       28,   28,   23,    5,    5,    5,   28,    5,   89,   16,
-       87,    5,    5,    5,    5,    5,    7,    7,    7,    7,
+        1,    1,    1,    1,    1,    3,   13,   13,  101,    3,
+        3,    3,    3,   15,    3,   14,   14,   32,   32,    3,
+        3,    3,    3,    3,    5,    5,    5,   15,    5,   31,
+       31,   31,    5,    5,    5,    5,    5,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-        7,    9,   17,    9,   10,   17,   10,   29,    9,    9,
-        9,   10,   10,   10,   31,   31,   31,   17,   32,   32,
-       17,   86,   17,   19,   19,   19,   19,   19,   19,   19,
-       84,   29,   19,   19,   19,   19,   19,   19,   19,   19,
-       19,   19,   19,   19,   19,   19,   20,   20,   20,   83,
-       20,   33,   49,   49,   82,   20,   20,   20,   20,   25,
-       25,   25,   81,   25,   80,   33,   79,   49,   25,   25,
-       25,   25,   30,   30,   30,   51,   51,   55,   30,   55,
-       55,   55,   56,   56,   56,   62,   55,   68,   62,   78,
-
-       77,   76,   74,   73,   72,   70,   67,   66,   65,   63,
-       61,   68,   94,   94,   94,   94,   94,   94,   94,   94,
-       95,   43,   42,   95,   95,   95,   96,   41,   96,   97,
-       97,   97,   97,   97,   97,   97,   97,   98,   40,   98,
-       99,   39,   99,   38,   99,   99,  100,   35,  100,  100,
-      100,  100,  101,  101,  101,   22,  101,  101,  102,   21,
-      102,  102,  103,  103,  103,  103,  103,  103,  103,  103,
-      104,  104,  104,  104,  104,  104,  104,  104,  105,   11,
-      105,  106,  106,  106,    0,  106,  106,   93,   93,   93,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-       93,   93,   93
+
+        7,    7,    9,   16,   29,   33,    9,    9,    9,    9,
+       10,   54,   54,   54,   10,   10,   10,   10,   17,   33,
+       28,   17,   28,   28,   28,  100,   72,   16,   29,   28,
+       97,   60,   72,   17,   60,   94,   17,   92,   17,   19,
+       19,   19,   19,   19,   19,   19,   91,   88,   19,   19,
+       19,   19,   19,   19,   19,   19,   19,   19,   19,   19,
+       19,   19,   20,   20,   20,   23,   20,   87,   23,   86,
+       96,   20,   20,   20,   20,   30,   30,   30,   85,   84,
+       23,   30,   83,   23,   96,   23,   25,   25,   25,   82,
+       25,   93,   93,   93,   81,   25,   25,   25,   25,   53,
+
+       98,   53,   53,   53,   95,   95,   95,   80,   53,   79,
+       78,   77,   76,   74,   98,  104,  104,  104,  104,  104,
+      104,  104,  104,  105,   73,   71,  105,  105,  105,  106,
+       70,  106,  107,   69,  107,  108,   68,  108,   66,  108,
+      108,  109,   65,  109,  109,  109,  109,  110,  110,  110,
+       64,  110,  110,  111,   63,  111,  111,  112,  112,  112,
+      112,  112,  112,  112,  112,  113,  113,  113,  113,  113,
+      113,  113,  113,  114,   62,  114,  115,  115,  115,   61,
+      115,  115,  116,  116,  116,  116,  116,  116,  116,  116,
+       59,   49,   43,   42,   41,   40,   39,   38,   35,   22,
+
+       21,   11,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,
+      103,  103,  103,  103,  103,  103,  103,  103
     } ;
 
 /* Table of booleans, true if rule could match eol. */
 static yyconst flex_int32_t yy_rule_can_match_eol[21] =
     {   0,
-0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 
+1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 
     0,     };
 
 static yy_state_type yy_last_accepting_state;
@@ -600,7 +608,7 @@ char *yytext;
 
 
 
-#line 33 "dtc-lexer.l"
+#line 37 "dtc-lexer.l"
 #include "dtc.h"
 #include "srcpos.h"
 #include "dtc-parser.tab.h"
@@ -623,7 +631,10 @@ static int dts_version; /* = 0 */
                                DPRINT("<V1>\n"); \
                                BEGIN(V1); \
                        }
-#line 627 "dtc-lexer.lex.c"
+
+static void push_input_file(const char *filename);
+static int pop_input_file(void);
+#line 638 "dtc-lexer.lex.c"
 
 #define INITIAL 0
 #define INCLUDE 1
@@ -685,7 +696,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -696,7 +707,7 @@ static int input (void );
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
                { \
                int c = '*'; \
-               size_t n; \
+               int n; \
                for ( n = 0; n < max_size && \
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
@@ -778,9 +789,9 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
     
-#line 57 "dtc-lexer.l"
+#line 64 "dtc-lexer.l"
 
-#line 784 "dtc-lexer.lex.c"
+#line 795 "dtc-lexer.lex.c"
 
        if ( !(yy_init) )
                {
@@ -833,13 +844,13 @@ yy_match:
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                {
                                yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 94 )
+                               if ( yy_current_state >= 104 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                        ++yy_cp;
                        }
-               while ( yy_base[yy_current_state] != 288 );
+               while ( yy_base[yy_current_state] != 303 );
 
 yy_find_action:
                yy_act = yy_accept[yy_current_state];
@@ -874,20 +885,13 @@ do_action:        /* This label is used only to access EOF actions. */
                        goto yy_find_action;
 
 case 1:
+/* rule 1 can match eol */
 YY_RULE_SETUP
-#line 58 "dtc-lexer.l"
-BEGIN(INCLUDE);
-       YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 60 "dtc-lexer.l"
+#line 65 "dtc-lexer.l"
 {
-                       yytext[strlen(yytext) - 1] = 0;
-                       if (!push_input_file(yytext + 1)) {
-                               /* Some unrecoverable error.*/
-                               exit(1);
-                       }
-                       BEGIN_DEFAULT();
+                       char *name = strchr(yytext, '\"') + 1;
+                       yytext[yyleng-1] = '\0';
+                       push_input_file(name);
                }
        YY_BREAK
 case YY_STATE_EOF(INITIAL):
@@ -895,19 +899,19 @@ case YY_STATE_EOF(INCLUDE):
 case YY_STATE_EOF(BYTESTRING):
 case YY_STATE_EOF(PROPNODENAME):
 case YY_STATE_EOF(V1):
-#line 70 "dtc-lexer.l"
+#line 71 "dtc-lexer.l"
 {
                        if (!pop_input_file()) {
                                yyterminate();
                        }
                }
        YY_BREAK
-case 3:
-/* rule 3 can match eol */
+case 2:
+/* rule 2 can match eol */
 YY_RULE_SETUP
-#line 76 "dtc-lexer.l"
+#line 77 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("String: %s\n", yytext);
                        yylval.data = data_copy_escape_string(yytext+1,
@@ -916,11 +920,11 @@ YY_RULE_SETUP
                        return DT_STRING;
                }
        YY_BREAK
-case 4:
+case 3:
 YY_RULE_SETUP
-#line 86 "dtc-lexer.l"
+#line 87 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Keyword: /dts-v1/\n");
                        dts_version = 1;
@@ -928,22 +932,22 @@ YY_RULE_SETUP
                        return DT_V1;
                }
        YY_BREAK
-case 5:
+case 4:
 YY_RULE_SETUP
-#line 95 "dtc-lexer.l"
+#line 96 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Keyword: /memreserve/\n");
                        BEGIN_DEFAULT();
                        return DT_MEMRESERVE;
                }
        YY_BREAK
-case 6:
+case 5:
 YY_RULE_SETUP
-#line 103 "dtc-lexer.l"
+#line 104 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Label: %s\n", yytext);
                        yylval.labelref = strdup(yytext);
@@ -951,11 +955,11 @@ YY_RULE_SETUP
                        return DT_LABEL;
                }
        YY_BREAK
-case 7:
+case 6:
 YY_RULE_SETUP
-#line 112 "dtc-lexer.l"
+#line 113 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        if (*yytext == 'b')
                                yylval.cbase = 2;
@@ -969,44 +973,44 @@ YY_RULE_SETUP
                        return DT_BASE;
                }
        YY_BREAK
-case 8:
+case 7:
 YY_RULE_SETUP
-#line 127 "dtc-lexer.l"
+#line 128 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yylval.literal = strdup(yytext);
                        DPRINT("Literal: '%s'\n", yylval.literal);
                        return DT_LEGACYLITERAL;
                }
        YY_BREAK
-case 9:
+case 8:
 YY_RULE_SETUP
-#line 135 "dtc-lexer.l"
+#line 136 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yylval.literal = strdup(yytext);
                        DPRINT("Literal: '%s'\n", yylval.literal);
                        return DT_LITERAL;
                }
        YY_BREAK
-case 10:
+case 9:
 YY_RULE_SETUP
-#line 143 "dtc-lexer.l"
+#line 144 "dtc-lexer.l"
 {      /* label reference */
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Ref: %s\n", yytext+1);
                        yylval.labelref = strdup(yytext+1);
                        return DT_REF;
                }
        YY_BREAK
-case 11:
+case 10:
 YY_RULE_SETUP
-#line 151 "dtc-lexer.l"
+#line 152 "dtc-lexer.l"
 {      /* new-style path reference */
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yytext[yyleng-1] = '\0';
                        DPRINT("Ref: %s\n", yytext+2);
@@ -1014,44 +1018,44 @@ YY_RULE_SETUP
                        return DT_REF;
                }
        YY_BREAK
-case 12:
+case 11:
 YY_RULE_SETUP
-#line 160 "dtc-lexer.l"
+#line 161 "dtc-lexer.l"
 {      /* old-style path reference */
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Ref: %s\n", yytext+1);
                        yylval.labelref = strdup(yytext+1);
                        return DT_REF;
                }
        YY_BREAK
-case 13:
+case 12:
 YY_RULE_SETUP
-#line 168 "dtc-lexer.l"
+#line 169 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        yylval.byte = strtol(yytext, NULL, 16);
                        DPRINT("Byte: %02x\n", (int)yylval.byte);
                        return DT_BYTE;
                }
        YY_BREAK
-case 14:
+case 13:
 YY_RULE_SETUP
-#line 176 "dtc-lexer.l"
+#line 177 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("/BYTESTRING\n");
                        BEGIN_DEFAULT();
                        return ']';
                }
        YY_BREAK
-case 15:
+case 14:
 YY_RULE_SETUP
-#line 184 "dtc-lexer.l"
+#line 185 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("PropNodeName: %s\n", yytext);
                        yylval.propnodename = strdup(yytext);
@@ -1059,34 +1063,39 @@ YY_RULE_SETUP
                        return DT_PROPNODENAME;
                }
        YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 194 "dtc-lexer.l"
+{
+                       yylloc.file = srcpos_file;
+                       yylloc.first_line = yylineno;
+                       DPRINT("Binary Include\n");
+                       return DT_INCBIN;
+               }
+       YY_BREAK
 case 16:
 /* rule 16 can match eol */
 YY_RULE_SETUP
-#line 194 "dtc-lexer.l"
+#line 201 "dtc-lexer.l"
 /* eat whitespace */
        YY_BREAK
 case 17:
 /* rule 17 can match eol */
 YY_RULE_SETUP
-#line 196 "dtc-lexer.l"
-{
-                       yylloc.filenum = srcpos_filenum;
-                       yylloc.first_line = yylineno;
-                       DPRINT("Comment: %s\n", yytext);
-                       /* eat comments */
-               }
+#line 202 "dtc-lexer.l"
+/* eat C-style comments */
        YY_BREAK
 case 18:
 /* rule 18 can match eol */
 YY_RULE_SETUP
 #line 203 "dtc-lexer.l"
-/* eat line comments */
+/* eat C++-style comments */
        YY_BREAK
 case 19:
 YY_RULE_SETUP
 #line 205 "dtc-lexer.l"
 {
-                       yylloc.filenum = srcpos_filenum;
+                       yylloc.file = srcpos_file;
                        yylloc.first_line = yylineno;
                        DPRINT("Char: %c (\\x%02x)\n", yytext[0],
                                (unsigned)yytext[0]);
@@ -1107,7 +1116,7 @@ YY_RULE_SETUP
 #line 222 "dtc-lexer.l"
 ECHO;
        YY_BREAK
-#line 1111 "dtc-lexer.lex.c"
+#line 1120 "dtc-lexer.lex.c"
 
        case YY_END_OF_BUFFER:
                {
@@ -1360,6 +1369,14 @@ static int yy_get_next_buffer (void)
        else
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
+       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
+
        (yy_n_chars) += number_to_move;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1389,7 +1406,7 @@ static int yy_get_next_buffer (void)
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 94 )
+                       if ( yy_current_state >= 104 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1417,11 +1434,11 @@ static int yy_get_next_buffer (void)
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                {
                yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 94 )
+               if ( yy_current_state >= 104 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 93);
+       yy_is_jam = (yy_current_state == 103);
 
        return yy_is_jam ? 0 : yy_current_state;
 }
@@ -1743,7 +1760,9 @@ static void yyensure_buffer_stack (void)
                (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
-               
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+                                                                 
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                                
                (yy_buffer_stack_max) = num_to_alloc;
@@ -1761,6 +1780,8 @@ static void yyensure_buffer_stack (void)
                                                                ((yy_buffer_stack),
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
                /* zero only the new slots.*/
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2072,14 +2093,13 @@ void yyfree (void * ptr )
  */
 
 struct incl_file {
-       int filenum;
-       FILE *file;
+       struct dtc_file *file;
        YY_BUFFER_STATE yy_prev_buf;
        int yy_prev_lineno;
        struct incl_file *prev;
 };
 
-struct incl_file *incl_file_stack;
+static struct incl_file *incl_file_stack;
 
 
 /*
@@ -2090,36 +2110,34 @@ struct incl_file *incl_file_stack;
 static int incl_depth = 0;
 
 
-int push_input_file(const char *filename)
+static void push_input_file(const char *filename)
 {
-       FILE *f;
        struct incl_file *incl_file;
+       struct dtc_file *newfile;
+       struct search_path search, *searchptr = NULL;
 
-       if (!filename) {
-               yyerror("No include file name given.");
-               return 0;
-       }
+       assert(filename);
 
-       if (incl_depth++ >= MAX_INCLUDE_DEPTH) {
-               yyerror("Includes nested too deeply");
-               return 0;
+       if (incl_depth++ >= MAX_INCLUDE_DEPTH)
+               die("Includes nested too deeply");
+
+       if (srcpos_file) {
+               search.dir = srcpos_file->dir;
+               search.next = NULL;
+               search.prev = NULL;
+               searchptr = &search;
        }
 
-       f = dtc_open_file(filename);
+       newfile = dtc_open_file(filename, searchptr);
 
-       incl_file = malloc(sizeof(struct incl_file));
-       if (!incl_file) {
-               yyerror("Can not allocate include file space.");
-               return 0;
-       }
+       incl_file = xmalloc(sizeof(struct incl_file));
 
        /*
         * Save current context.
         */
        incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
        incl_file->yy_prev_lineno = yylineno;
-       incl_file->filenum = srcpos_filenum;
-       incl_file->file = yyin;
+       incl_file->file = srcpos_file;
        incl_file->prev = incl_file_stack;
 
        incl_file_stack = incl_file;
@@ -2127,23 +2145,21 @@ int push_input_file(const char *filename)
        /*
         * Establish new context.
         */
-       srcpos_filenum = lookup_file_name(filename, 0);
+       srcpos_file = newfile;
        yylineno = 1;
-       yyin = f;
+       yyin = newfile->file;
        yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
-
-       return 1;
 }
 
 
-int pop_input_file(void)
+static int pop_input_file(void)
 {
        struct incl_file *incl_file;
 
        if (incl_file_stack == 0)
                return 0;
 
-       fclose(yyin);
+       dtc_close_file(srcpos_file);
 
        /*
         * Pop.
@@ -2158,17 +2174,14 @@ int pop_input_file(void)
        yy_delete_buffer(YY_CURRENT_BUFFER);
        yy_switch_to_buffer(incl_file->yy_prev_buf);
        yylineno = incl_file->yy_prev_lineno;
-       srcpos_filenum = incl_file->filenum;
-       yyin = incl_file->file;
+       srcpos_file = incl_file->file;
+       yyin = incl_file->file ? incl_file->file->file : NULL;
 
        /*
         * Free old state.
         */
        free(incl_file);
 
-       if (YY_CURRENT_BUFFER == 0)
-               return 0;
-
        return 1;
 }
 
index 28e6ec0..2712937 100644 (file)
@@ -75,7 +75,8 @@
      DT_BYTE = 264,
      DT_STRING = 265,
      DT_LABEL = 266,
-     DT_REF = 267
+     DT_REF = 267,
+     DT_INCBIN = 268
    };
 #endif
 /* Tokens.  */
@@ -89,6 +90,7 @@
 #define DT_STRING 265
 #define DT_LABEL 266
 #define DT_REF 267
+#define DT_INCBIN 268
 
 
 
 /* Copy the first part of user declarations.  */
 #line 23 "dtc-parser.y"
 
+#include <stdio.h>
+
 #include "dtc.h"
 #include "srcpos.h"
 
-int yylex(void);
-unsigned long long eval_literal(const char *s, int base, int bits);
+extern int yylex(void);
 
 extern struct boot_info *the_boot_info;
+extern int treesource_error;
 
+static unsigned long long eval_literal(const char *s, int base, int bits);
 
 
 /* Enabling traces.  */
@@ -126,16 +131,16 @@ extern struct boot_info *the_boot_info;
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 34 "dtc-parser.y"
+#line 37 "dtc-parser.y"
 {
        char *propnodename;
        char *literal;
        char *labelref;
        unsigned int cbase;
-       u8 byte;
+       uint8_t byte;
        struct data data;
 
-       u64 addr;
+       uint64_t addr;
        cell_t cell;
        struct property *prop;
        struct property *proplist;
@@ -144,7 +149,7 @@ typedef union YYSTYPE
        struct reserve_info *re;
 }
 /* Line 187 of yacc.c.  */
-#line 148 "dtc-parser.tab.c"
+#line 153 "dtc-parser.tab.c"
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -169,7 +174,7 @@ typedef struct YYLTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 173 "dtc-parser.tab.c"
+#line 178 "dtc-parser.tab.c"
 
 #ifdef short
 # undef short
@@ -386,20 +391,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  9
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   60
+#define YYLAST   73
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  24
+#define YYNTOKENS  27
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  20
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  43
+#define YYNRULES  45
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  67
+#define YYNSTATES  76
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   267
+#define YYMAXUTOK   268
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -411,15 +416,15 @@ static const yytype_uint8 yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,    23,    14,     2,    15,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,    13,
-      19,    18,    20,     2,     2,     2,     2,     2,     2,     2,
+      24,    26,     2,     2,    25,    15,     2,    16,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    14,
+      20,    19,    21,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,    21,     2,    22,     2,     2,     2,     2,     2,     2,
+       2,    22,     2,    23,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    16,     2,    17,     2,     2,     2,     2,
+       2,     2,     2,    17,     2,    18,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -433,7 +438,7 @@ static const yytype_uint8 yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12
+       5,     6,     7,     8,     9,    10,    11,    12,    13
 };
 
 #if YYDEBUG
@@ -443,37 +448,39 @@ static const yytype_uint8 yyprhs[] =
 {
        0,     0,     3,     8,    11,    12,    15,    21,    22,    25,
       27,    34,    36,    38,    41,    47,    48,    51,    57,    61,
-      64,    69,    74,    77,    80,    81,    84,    87,    88,    91,
-      94,    97,    98,   100,   102,   105,   106,   109,   112,   113,
-     116,   119,   123,   124
+      64,    69,    74,    77,    87,    93,    96,    97,   100,   103,
+     104,   107,   110,   113,   114,   116,   118,   121,   122,   125,
+     128,   129,   132,   135,   139,   140
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
-      25,     0,    -1,     3,    13,    26,    31,    -1,    28,    31,
-      -1,    -1,    27,    26,    -1,    43,     4,    30,    30,    13,
-      -1,    -1,    29,    28,    -1,    27,    -1,    43,     4,    30,
-      14,    30,    13,    -1,     6,    -1,     7,    -1,    15,    32,
-      -1,    16,    33,    41,    17,    13,    -1,    -1,    33,    34,
-      -1,    43,     5,    18,    35,    13,    -1,    43,     5,    13,
-      -1,    36,    10,    -1,    36,    19,    37,    20,    -1,    36,
-      21,    40,    22,    -1,    36,    12,    -1,    35,    11,    -1,
-      -1,    35,    23,    -1,    36,    11,    -1,    -1,    37,    39,
-      -1,    37,    12,    -1,    37,    11,    -1,    -1,     8,    -1,
-       6,    -1,    38,     7,    -1,    -1,    40,     9,    -1,    40,
-      11,    -1,    -1,    42,    41,    -1,    42,    34,    -1,    43,
-       5,    32,    -1,    -1,    11,    -1
+      28,     0,    -1,     3,    14,    29,    34,    -1,    31,    34,
+      -1,    -1,    30,    29,    -1,    46,     4,    33,    33,    14,
+      -1,    -1,    32,    31,    -1,    30,    -1,    46,     4,    33,
+      15,    33,    14,    -1,     6,    -1,     7,    -1,    16,    35,
+      -1,    17,    36,    44,    18,    14,    -1,    -1,    36,    37,
+      -1,    46,     5,    19,    38,    14,    -1,    46,     5,    14,
+      -1,    39,    10,    -1,    39,    20,    40,    21,    -1,    39,
+      22,    43,    23,    -1,    39,    12,    -1,    39,    13,    24,
+      10,    25,    33,    25,    33,    26,    -1,    39,    13,    24,
+      10,    26,    -1,    38,    11,    -1,    -1,    38,    25,    -1,
+      39,    11,    -1,    -1,    40,    42,    -1,    40,    12,    -1,
+      40,    11,    -1,    -1,     8,    -1,     6,    -1,    41,     7,
+      -1,    -1,    43,     9,    -1,    43,    11,    -1,    -1,    45,
+      44,    -1,    45,    37,    -1,    46,     5,    35,    -1,    -1,
+      11,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    85,    85,    89,    97,   100,   107,   115,   118,   125,
-     129,   136,   140,   147,   154,   162,   165,   172,   176,   183,
-     187,   191,   195,   199,   207,   210,   214,   222,   225,   229,
-     234,   242,   245,   249,   253,   261,   264,   268,   276,   279,
-     283,   291,   299,   302
+       0,    89,    89,    93,   101,   104,   111,   119,   122,   129,
+     133,   140,   144,   151,   158,   166,   169,   176,   180,   187,
+     191,   195,   199,   203,   220,   231,   239,   242,   246,   254,
+     257,   261,   266,   274,   277,   281,   285,   293,   296,   300,
+     308,   311,   315,   323,   331,   334
 };
 #endif
 
@@ -484,12 +491,12 @@ static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE",
   "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE",
-  "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "';'", "'-'", "'/'", "'{'",
-  "'}'", "'='", "'<'", "'>'", "'['", "']'", "','", "$accept", "sourcefile",
-  "memreserves", "memreserve", "v0_memreserves", "v0_memreserve", "addr",
-  "devicetree", "nodedef", "proplist", "propdef", "propdata",
-  "propdataprefix", "celllist", "cellbase", "cellval", "bytestring",
-  "subnodes", "subnode", "label", 0
+  "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'-'",
+  "'/'", "'{'", "'}'", "'='", "'<'", "'>'", "'['", "']'", "'('", "','",
+  "')'", "$accept", "sourcefile", "memreserves", "memreserve",
+  "v0_memreserves", "v0_memreserve", "addr", "devicetree", "nodedef",
+  "proplist", "propdef", "propdata", "propdataprefix", "celllist",
+  "cellbase", "cellval", "bytestring", "subnodes", "subnode", "label", 0
 };
 #endif
 
@@ -499,19 +506,19 @@ static const char *const yytname[] =
 static const yytype_uint16 yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,    59,    45,    47,   123,   125,    61,    60,
-      62,    91,    93,    44
+     265,   266,   267,   268,    59,    45,    47,   123,   125,    61,
+      60,    62,    91,    93,    40,    44,    41
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    24,    25,    25,    26,    26,    27,    28,    28,    29,
-      29,    30,    30,    31,    32,    33,    33,    34,    34,    35,
-      35,    35,    35,    35,    36,    36,    36,    37,    37,    37,
-      37,    38,    38,    39,    39,    40,    40,    40,    41,    41,
-      41,    42,    43,    43
+       0,    27,    28,    28,    29,    29,    30,    31,    31,    32,
+      32,    33,    33,    34,    35,    36,    36,    37,    37,    38,
+      38,    38,    38,    38,    38,    38,    39,    39,    39,    40,
+      40,    40,    40,    41,    41,    42,    42,    43,    43,    43,
+      44,    44,    44,    45,    46,    46
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -519,9 +526,9 @@ static const yytype_uint8 yyr2[] =
 {
        0,     2,     4,     2,     0,     2,     5,     0,     2,     1,
        6,     1,     1,     2,     5,     0,     2,     5,     3,     2,
-       4,     4,     2,     2,     0,     2,     2,     0,     2,     2,
-       2,     0,     1,     1,     2,     0,     2,     2,     0,     2,
-       2,     3,     0,     1
+       4,     4,     2,     9,     5,     2,     0,     2,     2,     0,
+       2,     2,     2,     0,     1,     1,     2,     0,     2,     2,
+       0,     2,     2,     3,     0,     1
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -529,81 +536,86 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       7,     0,    43,     0,     9,     0,     7,     0,     4,     1,
+       7,     0,    45,     0,     9,     0,     7,     0,     4,     1,
        0,     3,     8,     0,     0,     4,     0,    15,    13,    11,
-      12,     0,     2,     5,     0,    38,     0,     0,     0,    16,
-       0,    38,     0,     0,     6,     0,    40,    39,     0,    10,
-      14,    18,    24,    41,     0,     0,    23,    17,    25,    19,
-      26,    22,    27,    35,    31,     0,    33,    32,    30,    29,
-      20,     0,    28,    36,    37,    21,    34
+      12,     0,     2,     5,     0,    40,     0,     0,     0,    16,
+       0,    40,     0,     0,     6,     0,    42,    41,     0,    10,
+      14,    18,    26,    43,     0,     0,    25,    17,    27,    19,
+      28,    22,     0,    29,    37,     0,    33,     0,     0,    35,
+      34,    32,    31,    20,     0,    30,    38,    39,    21,     0,
+      24,    36,     0,     0,     0,    23
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
       -1,     3,    14,     4,     5,     6,    27,    11,    18,    25,
-      29,    44,    45,    54,    61,    62,    55,    30,    31,     7
+      29,    44,    45,    56,    64,    65,    57,    30,    31,     7
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -13
+#define YYPACT_NINF -14
 static const yytype_int8 yypact[] =
 {
-      23,    11,   -13,    37,   -13,    -4,    18,    39,    18,   -13,
-      28,   -13,   -13,    34,    -4,    18,    41,   -13,   -13,   -13,
-     -13,    25,   -13,   -13,    34,    -3,    34,    33,    34,   -13,
-      30,    -3,    43,    36,   -13,    38,   -13,   -13,    20,   -13,
-     -13,   -13,   -13,   -13,     2,     9,   -13,   -13,   -13,   -13,
-     -13,   -13,   -13,   -13,    -2,    -6,   -13,   -13,   -13,   -13,
-     -13,    45,   -13,   -13,   -13,   -13,   -13
+      30,   -11,   -14,     7,   -14,    -1,    27,    13,    27,   -14,
+       8,   -14,   -14,    40,    -1,    27,    35,   -14,   -14,   -14,
+     -14,    21,   -14,   -14,    40,    24,    40,    28,    40,   -14,
+      32,    24,    46,    38,   -14,    39,   -14,   -14,    26,   -14,
+     -14,   -14,   -14,   -14,    -9,    10,   -14,   -14,   -14,   -14,
+     -14,   -14,    31,   -14,   -14,    44,    -2,     3,    23,   -14,
+     -14,   -14,   -14,   -14,    50,   -14,   -14,   -14,   -14,    40,
+     -14,   -14,    33,    40,    36,   -14
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -13,   -13,    35,    27,    47,   -13,   -12,    40,    17,   -13,
-      26,   -13,   -13,   -13,   -13,   -13,   -13,    29,   -13,    -8
+     -14,   -14,    48,    29,    53,   -14,   -13,    47,    34,   -14,
+      37,   -14,   -14,   -14,   -14,   -14,   -14,    42,   -14,    -7
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -43
+#define YYTABLE_NINF -45
 static const yytype_int8 yytable[] =
 {
-      16,    21,   -42,    63,    56,    64,    57,    16,     2,    58,
-      59,    10,    28,    46,    33,    47,    65,    32,    60,    49,
-      50,    51,   -42,    32,     8,    48,     1,   -42,    52,     2,
-      53,    19,    20,    41,     2,    15,    17,     9,    42,    26,
-      19,    20,    15,    13,    17,    24,    34,    35,    38,    39,
-      23,    40,    66,    12,    22,    43,     0,    36,     0,     0,
-      37
+      21,    16,    46,     8,    59,    47,    60,     9,    16,    61,
+      62,    28,    66,    33,    67,    10,    48,    13,    32,    63,
+      49,    50,    51,    52,    32,    17,    68,    19,    20,   -44,
+      53,   -44,    54,     1,   -44,     2,    26,    15,     2,    24,
+      41,     2,    34,    17,    15,    42,    19,    20,    69,    70,
+      35,    38,    39,    40,    58,    55,    72,    71,    73,    12,
+      74,    22,    75,    23,     0,     0,     0,     0,    36,     0,
+       0,     0,    43,    37
 };
 
 static const yytype_int8 yycheck[] =
 {
-       8,    13,     5,     9,     6,    11,     8,    15,    11,    11,
-      12,    15,    24,    11,    26,    13,    22,    25,    20,    10,
-      11,    12,     4,    31,    13,    23,     3,     4,    19,    11,
-      21,     6,     7,    13,    11,     8,    16,     0,    18,    14,
-       6,     7,    15,     4,    16,     4,    13,    17,     5,    13,
-      15,    13,     7,     6,    14,    38,    -1,    31,    -1,    -1,
-      31
+      13,     8,    11,    14,     6,    14,     8,     0,    15,    11,
+      12,    24,     9,    26,    11,    16,    25,     4,    25,    21,
+      10,    11,    12,    13,    31,    17,    23,     6,     7,     5,
+      20,     4,    22,     3,     4,    11,    15,     8,    11,     4,
+      14,    11,    14,    17,    15,    19,     6,     7,    25,    26,
+      18,     5,    14,    14,    10,    24,    69,     7,    25,     6,
+      73,    14,    26,    15,    -1,    -1,    -1,    -1,    31,    -1,
+      -1,    -1,    38,    31
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,     3,    11,    25,    27,    28,    29,    43,    13,     0,
-      15,    31,    28,     4,    26,    27,    43,    16,    32,     6,
-       7,    30,    31,    26,     4,    33,    14,    30,    30,    34,
-      41,    42,    43,    30,    13,    17,    34,    41,     5,    13,
-      13,    13,    18,    32,    35,    36,    11,    13,    23,    10,
-      11,    12,    19,    21,    37,    40,     6,     8,    11,    12,
-      20,    38,    39,     9,    11,    22,     7
+       0,     3,    11,    28,    30,    31,    32,    46,    14,     0,
+      16,    34,    31,     4,    29,    30,    46,    17,    35,     6,
+       7,    33,    34,    29,     4,    36,    15,    33,    33,    37,
+      44,    45,    46,    33,    14,    18,    37,    44,     5,    14,
+      14,    14,    19,    35,    38,    39,    11,    14,    25,    10,
+      11,    12,    13,    20,    22,    24,    40,    43,    10,     6,
+       8,    11,    12,    21,    41,    42,     9,    11,    23,    25,
+      26,     7,    33,    25,    33,    26
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -1440,289 +1452,323 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 86 "dtc-parser.y"
+#line 90 "dtc-parser.y"
     {
-                       the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node));
+                       the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), 0);
                ;}
     break;
 
   case 3:
-#line 90 "dtc-parser.y"
+#line 94 "dtc-parser.y"
     {
-                       the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node));
+                       the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node), 0);
                ;}
     break;
 
   case 4:
-#line 97 "dtc-parser.y"
+#line 101 "dtc-parser.y"
     {
                        (yyval.re) = NULL;
                ;}
     break;
 
   case 5:
-#line 101 "dtc-parser.y"
+#line 105 "dtc-parser.y"
     {
                        (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
                ;}
     break;
 
   case 6:
-#line 108 "dtc-parser.y"
+#line 112 "dtc-parser.y"
     {
                        (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref));
                ;}
     break;
 
   case 7:
-#line 115 "dtc-parser.y"
+#line 119 "dtc-parser.y"
     {
                        (yyval.re) = NULL;
                ;}
     break;
 
   case 8:
-#line 119 "dtc-parser.y"
+#line 123 "dtc-parser.y"
     {
                        (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
                ;}
     break;
 
   case 9:
-#line 126 "dtc-parser.y"
+#line 130 "dtc-parser.y"
     {
                        (yyval.re) = (yyvsp[(1) - (1)].re);
                ;}
     break;
 
   case 10:
-#line 130 "dtc-parser.y"
+#line 134 "dtc-parser.y"
     {
                        (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref));
                ;}
     break;
 
   case 11:
-#line 137 "dtc-parser.y"
+#line 141 "dtc-parser.y"
     {
                        (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
                ;}
     break;
 
   case 12:
-#line 141 "dtc-parser.y"
+#line 145 "dtc-parser.y"
     {
                        (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64);
                ;}
     break;
 
   case 13:
-#line 148 "dtc-parser.y"
+#line 152 "dtc-parser.y"
     {
                        (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL);
                ;}
     break;
 
   case 14:
-#line 155 "dtc-parser.y"
+#line 159 "dtc-parser.y"
     {
                        (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
                ;}
     break;
 
   case 15:
-#line 162 "dtc-parser.y"
+#line 166 "dtc-parser.y"
     {
                        (yyval.proplist) = NULL;
                ;}
     break;
 
   case 16:
-#line 166 "dtc-parser.y"
+#line 170 "dtc-parser.y"
     {
                        (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
                ;}
     break;
 
   case 17:
-#line 173 "dtc-parser.y"
+#line 177 "dtc-parser.y"
     {
                        (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref));
                ;}
     break;
 
   case 18:
-#line 177 "dtc-parser.y"
+#line 181 "dtc-parser.y"
     {
                        (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref));
                ;}
     break;
 
   case 19:
-#line 184 "dtc-parser.y"
+#line 188 "dtc-parser.y"
     {
                        (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
                ;}
     break;
 
   case 20:
-#line 188 "dtc-parser.y"
+#line 192 "dtc-parser.y"
     {
                        (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
                ;}
     break;
 
   case 21:
-#line 192 "dtc-parser.y"
+#line 196 "dtc-parser.y"
     {
                        (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
                ;}
     break;
 
   case 22:
-#line 196 "dtc-parser.y"
+#line 200 "dtc-parser.y"
     {
                        (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
                ;}
     break;
 
   case 23:
-#line 200 "dtc-parser.y"
+#line 204 "dtc-parser.y"
     {
-                       (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
+                       struct search_path path = { srcpos_file->dir, NULL, NULL };
+                       struct dtc_file *file = dtc_open_file((yyvsp[(4) - (9)].data).val, &path);
+                       struct data d = empty_data;
+
+                       if ((yyvsp[(6) - (9)].addr) != 0)
+                               if (fseek(file->file, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0)
+                                       yyerrorf("Couldn't seek to offset %llu in \"%s\": %s",
+                                                (unsigned long long)(yyvsp[(6) - (9)].addr),
+                                                (yyvsp[(4) - (9)].data).val, strerror(errno));
+
+                       d = data_copy_file(file->file, (yyvsp[(8) - (9)].addr));
+
+                       (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
+                       dtc_close_file(file);
                ;}
     break;
 
   case 24:
-#line 207 "dtc-parser.y"
+#line 221 "dtc-parser.y"
     {
-                       (yyval.data) = empty_data;
+                       struct search_path path = { srcpos_file->dir, NULL, NULL };
+                       struct dtc_file *file = dtc_open_file((yyvsp[(4) - (5)].data).val, &path);
+                       struct data d = empty_data;
+
+                       d = data_copy_file(file->file, -1);
+
+                       (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
+                       dtc_close_file(file);
                ;}
     break;
 
   case 25:
-#line 211 "dtc-parser.y"
+#line 232 "dtc-parser.y"
     {
-                       (yyval.data) = (yyvsp[(1) - (2)].data);
+                       (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
                ;}
     break;
 
   case 26:
-#line 215 "dtc-parser.y"
+#line 239 "dtc-parser.y"
     {
-                       (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
+                       (yyval.data) = empty_data;
                ;}
     break;
 
   case 27:
-#line 222 "dtc-parser.y"
+#line 243 "dtc-parser.y"
     {
-                       (yyval.data) = empty_data;
+                       (yyval.data) = (yyvsp[(1) - (2)].data);
                ;}
     break;
 
   case 28:
-#line 226 "dtc-parser.y"
+#line 247 "dtc-parser.y"
     {
-                       (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell));
+                       (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
                ;}
     break;
 
   case 29:
-#line 230 "dtc-parser.y"
+#line 254 "dtc-parser.y"
+    {
+                       (yyval.data) = empty_data;
+               ;}
+    break;
+
+  case 30:
+#line 258 "dtc-parser.y"
+    {
+                       (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell));
+               ;}
+    break;
+
+  case 31:
+#line 262 "dtc-parser.y"
     {
                        (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE,
                                                              (yyvsp[(2) - (2)].labelref)), -1);
                ;}
     break;
 
-  case 30:
-#line 235 "dtc-parser.y"
+  case 32:
+#line 267 "dtc-parser.y"
     {
                        (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
                ;}
     break;
 
-  case 31:
-#line 242 "dtc-parser.y"
+  case 33:
+#line 274 "dtc-parser.y"
     {
                        (yyval.cbase) = 16;
                ;}
     break;
 
-  case 33:
-#line 250 "dtc-parser.y"
+  case 35:
+#line 282 "dtc-parser.y"
     {
                        (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32);
                ;}
     break;
 
-  case 34:
-#line 254 "dtc-parser.y"
+  case 36:
+#line 286 "dtc-parser.y"
     {
                        (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32);
                ;}
     break;
 
-  case 35:
-#line 261 "dtc-parser.y"
+  case 37:
+#line 293 "dtc-parser.y"
     {
                        (yyval.data) = empty_data;
                ;}
     break;
 
-  case 36:
-#line 265 "dtc-parser.y"
+  case 38:
+#line 297 "dtc-parser.y"
     {
                        (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
                ;}
     break;
 
-  case 37:
-#line 269 "dtc-parser.y"
+  case 39:
+#line 301 "dtc-parser.y"
     {
                        (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
                ;}
     break;
 
-  case 38:
-#line 276 "dtc-parser.y"
+  case 40:
+#line 308 "dtc-parser.y"
     {
                        (yyval.nodelist) = NULL;
                ;}
     break;
 
-  case 39:
-#line 280 "dtc-parser.y"
+  case 41:
+#line 312 "dtc-parser.y"
     {
                        (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
                ;}
     break;
 
-  case 40:
-#line 284 "dtc-parser.y"
+  case 42:
+#line 316 "dtc-parser.y"
     {
-                       yyerror("syntax error: properties must precede subnodes\n");
+                       yyerror("syntax error: properties must precede subnodes");
                        YYERROR;
                ;}
     break;
 
-  case 41:
-#line 292 "dtc-parser.y"
+  case 43:
+#line 324 "dtc-parser.y"
     {
                        (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref));
                ;}
     break;
 
-  case 42:
-#line 299 "dtc-parser.y"
+  case 44:
+#line 331 "dtc-parser.y"
     {
                        (yyval.labelref) = NULL;
                ;}
     break;
 
-  case 43:
-#line 303 "dtc-parser.y"
+  case 45:
+#line 335 "dtc-parser.y"
     {
                        (yyval.labelref) = (yyvsp[(1) - (1)].labelref);
                ;}
@@ -1730,7 +1776,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 1734 "dtc-parser.tab.c"
+#line 1780 "dtc-parser.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1950,21 +1996,32 @@ yyreturn:
 }
 
 
-#line 308 "dtc-parser.y"
+#line 340 "dtc-parser.y"
 
 
-void yyerror (char const *s)
+void yyerrorf(char const *s, ...)
 {
-       const char *fname = srcpos_filename_for_num(yylloc.filenum);
+       const char *fname = srcpos_file ? srcpos_file->name : "<no-file>";
+       va_list va;
+       va_start(va, s);
 
        if (strcmp(fname, "-") == 0)
                fname = "stdin";
 
-       fprintf(stderr, "%s:%d %s\n",
-               fname, yylloc.first_line, s);
+       fprintf(stderr, "%s:%d ", fname, yylloc.first_line);
+       vfprintf(stderr, s, va);
+       fprintf(stderr, "\n");
+
+       treesource_error = 1;
+       va_end(va);
+}
+
+void yyerror (char const *s)
+{
+       yyerrorf("%s", s);
 }
 
-unsigned long long eval_literal(const char *s, int base, int bits)
+static unsigned long long eval_literal(const char *s, int base, int bits)
 {
        unsigned long long val;
        char *e;
index 4707b02..ba99100 100644 (file)
@@ -48,7 +48,8 @@
      DT_BYTE = 264,
      DT_STRING = 265,
      DT_LABEL = 266,
-     DT_REF = 267
+     DT_REF = 267,
+     DT_INCBIN = 268
    };
 #endif
 /* Tokens.  */
 #define DT_STRING 265
 #define DT_LABEL 266
 #define DT_REF 267
+#define DT_INCBIN 268
 
 
 
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 34 "dtc-parser.y"
+#line 37 "dtc-parser.y"
 {
        char *propnodename;
        char *literal;
        char *labelref;
        unsigned int cbase;
-       u8 byte;
+       uint8_t byte;
        struct data data;
 
-       u64 addr;
+       uint64_t addr;
        cell_t cell;
        struct property *prop;
        struct property *proplist;
@@ -86,7 +88,7 @@ typedef union YYSTYPE
        struct reserve_info *re;
 }
 /* Line 1489 of yacc.c.  */
-#line 90 "dtc-parser.tab.h"
+#line 92 "dtc-parser.tab.h"
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
index 002ea7f..b2ab562 100644 (file)
 %locations
 
 %{
+#include <stdio.h>
+
 #include "dtc.h"
 #include "srcpos.h"
 
-int yylex(void);
-unsigned long long eval_literal(const char *s, int base, int bits);
+extern int yylex(void);
 
 extern struct boot_info *the_boot_info;
+extern int treesource_error;
 
+static unsigned long long eval_literal(const char *s, int base, int bits);
 %}
 
 %union {
@@ -36,10 +39,10 @@ extern struct boot_info *the_boot_info;
        char *literal;
        char *labelref;
        unsigned int cbase;
-       u8 byte;
+       uint8_t byte;
        struct data data;
 
-       u64 addr;
+       uint64_t addr;
        cell_t cell;
        struct property *prop;
        struct property *proplist;
@@ -58,6 +61,7 @@ extern struct boot_info *the_boot_info;
 %token <data> DT_STRING
 %token <labelref> DT_LABEL
 %token <labelref> DT_REF
+%token DT_INCBIN
 
 %type <data> propdata
 %type <data> propdataprefix
@@ -84,11 +88,11 @@ extern struct boot_info *the_boot_info;
 sourcefile:
          DT_V1 ';' memreserves devicetree
                {
-                       the_boot_info = build_boot_info($3, $4);
+                       the_boot_info = build_boot_info($3, $4, 0);
                }
        | v0_memreserves devicetree
                {
-                       the_boot_info = build_boot_info($1, $2);
+                       the_boot_info = build_boot_info($1, $2, 0);
                }
        ;
 
@@ -196,6 +200,34 @@ propdata:
                {
                        $$ = data_add_marker($1, REF_PATH, $2);
                }
+       | propdataprefix DT_INCBIN '(' DT_STRING ',' addr ',' addr ')'
+               {
+                       struct search_path path = { srcpos_file->dir, NULL, NULL };
+                       struct dtc_file *file = dtc_open_file($4.val, &path);
+                       struct data d = empty_data;
+
+                       if ($6 != 0)
+                               if (fseek(file->file, $6, SEEK_SET) != 0)
+                                       yyerrorf("Couldn't seek to offset %llu in \"%s\": %s",
+                                                (unsigned long long)$6,
+                                                $4.val, strerror(errno));
+
+                       d = data_copy_file(file->file, $8);
+
+                       $$ = data_merge($1, d);
+                       dtc_close_file(file);
+               }
+       | propdataprefix DT_INCBIN '(' DT_STRING ')'
+               {
+                       struct search_path path = { srcpos_file->dir, NULL, NULL };
+                       struct dtc_file *file = dtc_open_file($4.val, &path);
+                       struct data d = empty_data;
+
+                       d = data_copy_file(file->file, -1);
+
+                       $$ = data_merge($1, d);
+                       dtc_close_file(file);
+               }
        | propdata DT_LABEL
                {
                        $$ = data_add_marker($1, LABEL, $2);
@@ -282,7 +314,7 @@ subnodes:
                }
        | subnode propdef
                {
-                       yyerror("syntax error: properties must precede subnodes\n");
+                       yyerror("syntax error: properties must precede subnodes");
                        YYERROR;
                }
        ;
@@ -307,18 +339,29 @@ label:
 
 %%
 
-void yyerror (char const *s)
+void yyerrorf(char const *s, ...)
 {
-       const char *fname = srcpos_filename_for_num(yylloc.filenum);
+       const char *fname = srcpos_file ? srcpos_file->name : "<no-file>";
+       va_list va;
+       va_start(va, s);
 
        if (strcmp(fname, "-") == 0)
                fname = "stdin";
 
-       fprintf(stderr, "%s:%d %s\n",
-               fname, yylloc.first_line, s);
+       fprintf(stderr, "%s:%d ", fname, yylloc.first_line);
+       vfprintf(stderr, s, va);
+       fprintf(stderr, "\n");
+
+       treesource_error = 1;
+       va_end(va);
+}
+
+void yyerror (char const *s)
+{
+       yyerrorf("%s", s);
 }
 
-unsigned long long eval_literal(const char *s, int base, int bits)
+static unsigned long long eval_literal(const char *s, int base, int bits)
 {
        unsigned long long val;
        char *e;
index 01131d7..d8fd43b 100644 (file)
@@ -55,7 +55,7 @@ char *join_path(const char *path, const char *name)
        return str;
 }
 
-void fill_fullpaths(struct node *tree, const char *prefix)
+static void fill_fullpaths(struct node *tree, const char *prefix)
 {
        struct node *child;
        const char *unit;
@@ -106,7 +106,7 @@ static void  __attribute__ ((noreturn)) usage(void)
        fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n");
        fprintf(stderr, "\t-v\n");
        fprintf(stderr, "\t\tPrint DTC version and exit\n");
-       exit(2);
+       exit(3);
 }
 
 int main(int argc, char *argv[])
@@ -118,10 +118,9 @@ int main(int argc, char *argv[])
        int force = 0, check = 0;
        const char *arg;
        int opt;
-       FILE *inf = NULL;
        FILE *outf = NULL;
        int outversion = DEFAULT_FDT_VERSION;
-       int boot_cpuid_phys = 0xfeedbeef;
+       long long cmdline_boot_cpuid = -1;
 
        quiet      = 0;
        reservenum = 0;
@@ -161,11 +160,11 @@ int main(int argc, char *argv[])
                        quiet++;
                        break;
                case 'b':
-                       boot_cpuid_phys = strtol(optarg, NULL, 0);
+                       cmdline_boot_cpuid = strtoll(optarg, NULL, 0);
                        break;
                case 'v':
-                   printf("Version: %s\n", DTC_VERSION);
-                   exit(0);
+                       printf("Version: %s\n", DTC_VERSION);
+                       exit(0);
                case 'h':
                default:
                        usage();
@@ -180,31 +179,27 @@ int main(int argc, char *argv[])
                arg = argv[optind];
 
        /* minsize and padsize are mutually exclusive */
-       if ((minsize) && (padsize)) {
+       if (minsize && padsize)
                die("Can't set both -p and -S\n");
-       }
 
        fprintf(stderr, "DTC: %s->%s  on file \"%s\"\n",
                inform, outform, arg);
 
-       if (streq(inform, "dts")) {
+       if (streq(inform, "dts"))
                bi = dt_from_source(arg);
-       } else if (streq(inform, "fs")) {
+       else if (streq(inform, "fs"))
                bi = dt_from_fs(arg);
-       } else if(streq(inform, "dtb")) {
-               inf = dtc_open_file(arg);
-               bi = dt_from_blob(inf);
-       } else {
+       else if(streq(inform, "dtb"))
+               bi = dt_from_blob(arg);
+       else
                die("Unknown input format \"%s\"\n", inform);
-       }
 
-       if (inf && (inf != stdin))
-               fclose(inf);
+       if (cmdline_boot_cpuid != -1)
+               bi->boot_cpuid_phys = cmdline_boot_cpuid;
 
-       if (! bi || ! bi->dt)
-               die("Couldn't read input tree\n");
+       fill_fullpaths(bi->dt, "");
+       process_checks(force, bi);
 
-       process_checks(force, bi, check, outversion, boot_cpuid_phys);
 
        if (streq(outname, "-")) {
                outf = stdout;
@@ -218,9 +213,9 @@ int main(int argc, char *argv[])
        if (streq(outform, "dts")) {
                dt_to_source(outf, bi);
        } else if (streq(outform, "dtb")) {
-               dt_to_blob(outf, bi, outversion, boot_cpuid_phys);
+               dt_to_blob(outf, bi, outversion);
        } else if (streq(outform, "asm")) {
-               dt_to_asm(outf, bi, outversion, boot_cpuid_phys);
+               dt_to_asm(outf, bi, outversion);
        } else if (streq(outform, "null")) {
                /* do nothing */
        } else {
index 6528177..08d54c8 100644 (file)
 #include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
-#include <netinet/in.h>
-#include <endian.h>
-#include <byteswap.h>
 
+#include <libfdt_env.h>
 #include <fdt.h>
 
 #define DEFAULT_FDT_VERSION    17
@@ -75,25 +73,8 @@ static inline void *xrealloc(void *p, size_t len)
        return new;
 }
 
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef u32 cell_t;
+typedef uint32_t cell_t;
 
-#define cpu_to_be16(x) htons(x)
-#define be16_to_cpu(x) ntohs(x)
-
-#define cpu_to_be32(x) htonl(x)
-#define be32_to_cpu(x) ntohl(x)
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define cpu_to_be64(x) (x)
-#define be64_to_cpu(x) (x)
-#else
-#define cpu_to_be64(x) bswap_64(x)
-#define be64_to_cpu(x) bswap_64(x)
-#endif
 
 #define streq(a, b)    (strcmp((a), (b)) == 0)
 #define strneq(a, b, n)        (strncmp((a), (b), (n)) == 0)
@@ -118,7 +99,6 @@ struct  marker {
 struct data {
        int len;
        char *val;
-       int asize;
        struct marker *markers;
 };
 
@@ -145,7 +125,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
 struct data data_merge(struct data d1, struct data d2);
 struct data data_append_cell(struct data d, cell_t word);
 struct data data_append_re(struct data d, const struct fdt_reserve_entry *re);
-struct data data_append_addr(struct data d, u64 addr);
+struct data data_append_addr(struct data d, uint64_t addr);
 struct data data_append_byte(struct data d, uint8_t byte);
 struct data data_append_zeroes(struct data d, int len);
 struct data data_append_align(struct data d, int align);
@@ -223,7 +203,7 @@ struct reserve_info {
        char *label;
 };
 
-struct reserve_info *build_reserve_entry(u64 start, u64 len, char *label);
+struct reserve_info *build_reserve_entry(uint64_t start, uint64_t len, char *label);
 struct reserve_info *chain_reserve_entry(struct reserve_info *first,
                                         struct reserve_info *list);
 struct reserve_info *add_reserve_entry(struct reserve_info *list,
@@ -233,24 +213,22 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
 struct boot_info {
        struct reserve_info *reservelist;
        struct node *dt;                /* the device tree */
+       uint32_t boot_cpuid_phys;
 };
 
 struct boot_info *build_boot_info(struct reserve_info *reservelist,
-                                 struct node *tree);
+                                 struct node *tree, uint32_t boot_cpuid_phys);
 
 /* Checks */
 
-void process_checks(int force, struct boot_info *bi,
-                   int checkflag, int outversion, int boot_cpuid_phys);
+void process_checks(int force, struct boot_info *bi);
 
 /* Flattened trees */
 
-void dt_to_blob(FILE *f, struct boot_info *bi, int version,
-               int boot_cpuid_phys);
-void dt_to_asm(FILE *f, struct boot_info *bi, int version,
-              int boot_cpuid_phys);
+void dt_to_blob(FILE *f, struct boot_info *bi, int version);
+void dt_to_asm(FILE *f, struct boot_info *bi, int version);
 
-struct boot_info *dt_from_blob(FILE *f);
+struct boot_info *dt_from_blob(const char *fname);
 
 /* Tree source */
 
@@ -264,6 +242,5 @@ struct boot_info *dt_from_fs(const char *dirname);
 /* misc */
 
 char *join_path(const char *path, const char *name);
-void fill_fullpaths(struct node *tree, const char *prefix);
 
 #endif /* _DTC_H */
index a7cfb84..76acd28 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "dtc.h"
+#include "srcpos.h"
 
 #define FTF_FULLPATH   0x1
 #define FTF_VARALIGN   0x2
@@ -162,28 +163,18 @@ static void asm_emit_data(void *e, struct data d)
 {
        FILE *f = e;
        int off = 0;
-       struct marker *m;
+       struct marker *m = d.markers;
 
-       m = d.markers;
-       while (m) {
-               if (m->type == LABEL)
-                       emit_offset_label(f, m->ref, m->offset);
-               m = m->next;
-       }
+       for_each_marker_of_type(m, LABEL)
+               emit_offset_label(f, m->ref, m->offset);
 
-       while ((d.len - off) >= sizeof(u32)) {
+       while ((d.len - off) >= sizeof(uint32_t)) {
                fprintf(f, "\t.long\t0x%x\n",
-                       be32_to_cpu(*((u32 *)(d.val+off))));
-               off += sizeof(u32);
-       }
-
-       if ((d.len - off) >= sizeof(u16)) {
-               fprintf(f, "\t.short\t0x%hx\n",
-                       be16_to_cpu(*((u16 *)(d.val+off))));
-               off += sizeof(u16);
+                       fdt32_to_cpu(*((uint32_t *)(d.val+off))));
+               off += sizeof(uint32_t);
        }
 
-       if ((d.len - off) >= 1) {
+       while ((d.len - off) >= 1) {
                fprintf(f, "\t.byte\t0x%hhx\n", d.val[off]);
                off += 1;
        }
@@ -336,29 +327,28 @@ static void make_fdt_header(struct fdt_header *fdt,
 
        memset(fdt, 0xff, sizeof(*fdt));
 
-       fdt->magic = cpu_to_be32(FDT_MAGIC);
-       fdt->version = cpu_to_be32(vi->version);
-       fdt->last_comp_version = cpu_to_be32(vi->last_comp_version);
+       fdt->magic = cpu_to_fdt32(FDT_MAGIC);
+       fdt->version = cpu_to_fdt32(vi->version);
+       fdt->last_comp_version = cpu_to_fdt32(vi->last_comp_version);
 
        /* Reserve map should be doubleword aligned */
        reserve_off = ALIGN(vi->hdr_size, 8);
 
-       fdt->off_mem_rsvmap = cpu_to_be32(reserve_off);
-       fdt->off_dt_struct = cpu_to_be32(reserve_off + reservesize);
-       fdt->off_dt_strings = cpu_to_be32(reserve_off + reservesize
+       fdt->off_mem_rsvmap = cpu_to_fdt32(reserve_off);
+       fdt->off_dt_struct = cpu_to_fdt32(reserve_off + reservesize);
+       fdt->off_dt_strings = cpu_to_fdt32(reserve_off + reservesize
                                          + dtsize);
-       fdt->totalsize = cpu_to_be32(reserve_off + reservesize + dtsize + strsize);
+       fdt->totalsize = cpu_to_fdt32(reserve_off + reservesize + dtsize + strsize);
 
        if (vi->flags & FTF_BOOTCPUID)
-               fdt->boot_cpuid_phys = cpu_to_be32(boot_cpuid_phys);
+               fdt->boot_cpuid_phys = cpu_to_fdt32(boot_cpuid_phys);
        if (vi->flags & FTF_STRTABSIZE)
-               fdt->size_dt_strings = cpu_to_be32(strsize);
+               fdt->size_dt_strings = cpu_to_fdt32(strsize);
        if (vi->flags & FTF_STRUCTSIZE)
-               fdt->size_dt_struct = cpu_to_be32(dtsize);
+               fdt->size_dt_struct = cpu_to_fdt32(dtsize);
 }
 
-void dt_to_blob(FILE *f, struct boot_info *bi, int version,
-               int boot_cpuid_phys)
+void dt_to_blob(FILE *f, struct boot_info *bi, int version)
 {
        struct version_info *vi = NULL;
        int i;
@@ -383,26 +373,26 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
 
        /* Make header */
        make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len,
-                       boot_cpuid_phys);
+                       bi->boot_cpuid_phys);
 
        /*
         * If the user asked for more space than is used, adjust the totalsize.
         */
        if (minsize > 0) {
-               padlen = minsize - be32_to_cpu(fdt.totalsize);
+               padlen = minsize - fdt32_to_cpu(fdt.totalsize);
                if ((padlen < 0) && (quiet < 1))
                        fprintf(stderr,
                                "Warning: blob size %d >= minimum size %d\n",
-                               be32_to_cpu(fdt.totalsize), minsize);
+                               fdt32_to_cpu(fdt.totalsize), minsize);
        }
 
        if (padsize > 0)
                padlen = padsize;
 
        if (padlen > 0) {
-               int tsize = be32_to_cpu(fdt.totalsize);
+               int tsize = fdt32_to_cpu(fdt.totalsize);
                tsize += padlen;
-               fdt.totalsize = cpu_to_be32(tsize);
+               fdt.totalsize = cpu_to_fdt32(tsize);
        }
 
        /*
@@ -410,7 +400,7 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
         * the reserve buffer, add the reserve map terminating zeroes,
         * the device tree itself, and finally the strings.
         */
-       blob = data_append_data(blob, &fdt, sizeof(fdt));
+       blob = data_append_data(blob, &fdt, vi->hdr_size);
        blob = data_append_align(blob, 8);
        blob = data_merge(blob, reservebuf);
        blob = data_append_zeroes(blob, sizeof(struct fdt_reserve_entry));
@@ -449,7 +439,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf)
        }
 }
 
-void dt_to_asm(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys)
+void dt_to_asm(FILE *f, struct boot_info *bi, int version)
 {
        struct version_info *vi = NULL;
        int i;
@@ -489,7 +479,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys)
 
        if (vi->flags & FTF_BOOTCPUID)
                fprintf(f, "\t.long\t%i\t\t\t\t\t/* boot_cpuid_phys */\n",
-                       boot_cpuid_phys);
+                       bi->boot_cpuid_phys);
 
        if (vi->flags & FTF_STRTABSIZE)
                fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n",
@@ -579,15 +569,15 @@ static void flat_read_chunk(struct inbuf *inb, void *p, int len)
        inb->ptr += len;
 }
 
-static u32 flat_read_word(struct inbuf *inb)
+static uint32_t flat_read_word(struct inbuf *inb)
 {
-       u32 val;
+       uint32_t val;
 
        assert(((inb->ptr - inb->base) % sizeof(val)) == 0);
 
        flat_read_chunk(inb, &val, sizeof(val));
 
-       return be32_to_cpu(val);
+       return fdt32_to_cpu(val);
 }
 
 static void flat_realign(struct inbuf *inb, int align)
@@ -615,7 +605,7 @@ static char *flat_read_string(struct inbuf *inb)
 
        inb->ptr += len;
 
-       flat_realign(inb, sizeof(u32));
+       flat_realign(inb, sizeof(uint32_t));
 
        return str;
 }
@@ -632,7 +622,7 @@ static struct data flat_read_data(struct inbuf *inb, int len)
 
        flat_read_chunk(inb, d.val, len);
 
-       flat_realign(inb, sizeof(u32));
+       flat_realign(inb, sizeof(uint32_t));
 
        return d;
 }
@@ -659,7 +649,7 @@ static char *flat_read_stringtable(struct inbuf *inb, int offset)
 static struct property *flat_read_property(struct inbuf *dtbuf,
                                           struct inbuf *strbuf, int flags)
 {
-       u32 proplen, stroff;
+       uint32_t proplen, stroff;
        char *name;
        struct data val;
 
@@ -693,8 +683,8 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
        p = inb->ptr;
        while (1) {
                flat_read_chunk(inb, &re, sizeof(re));
-               re.address  = be64_to_cpu(re.address);
-               re.size = be64_to_cpu(re.size);
+               re.address  = fdt64_to_cpu(re.address);
+               re.size = fdt64_to_cpu(re.size);
                if (re.size == 0)
                        break;
 
@@ -708,77 +698,37 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
 
 static char *nodename_from_path(const char *ppath, const char *cpath)
 {
-       const char *lslash;
        int plen;
 
-       lslash = strrchr(cpath, '/');
-       if (! lslash)
-               return NULL;
-
-       plen = lslash - cpath;
-
-       if (streq(cpath, "/") && streq(ppath, ""))
-               return "";
-
-       if ((plen == 0) && streq(ppath, "/"))
-               return strdup(lslash+1);
-
-       if (! strneq(ppath, cpath, plen))
-               return NULL;
-
-       return strdup(lslash+1);
-}
-
-static const char PROPCHAR[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,._+*#?-";
-static const char UNITCHAR[] = "0123456789abcdef,";
-
-static int check_node_name(const char *name)
-{
-       const char *atpos;
-       int basenamelen;
+       plen = strlen(ppath);
 
-       atpos = strrchr(name, '@');
+       if (!strneq(ppath, cpath, plen))
+               die("Path \"%s\" is not valid as a child of \"%s\"\n",
+                   cpath, ppath);
 
-       if (atpos)
-               basenamelen = atpos - name;
-       else
-               basenamelen = strlen(name);
-
-       if (strspn(name, PROPCHAR) < basenamelen)
-               return -1;
+       /* root node is a special case */
+       if (!streq(ppath, "/"))
+               plen++;
 
-       if (atpos
-           && ((basenamelen + 1 + strspn(atpos+1, UNITCHAR)) < strlen(name)))
-               return -1;
-
-       return basenamelen;
+       return strdup(cpath + plen);
 }
 
 static struct node *unflatten_tree(struct inbuf *dtbuf,
                                   struct inbuf *strbuf,
-                                  const char *parent_path, int flags)
+                                  const char *parent_flatname, int flags)
 {
        struct node *node;
-       u32 val;
+       char *flatname;
+       uint32_t val;
 
        node = build_node(NULL, NULL);
 
-       if (flags & FTF_FULLPATH) {
-               node->fullpath = flat_read_string(dtbuf);
-               node->name = nodename_from_path(parent_path, node->fullpath);
-
-               if (! node->name)
-                       die("Path \"%s\" is not valid as a child of \"%s\"\n",
-                           node->fullpath, parent_path);
-       } else {
-               node->name = flat_read_string(dtbuf);
-               node->fullpath = join_path(parent_path, node->name);
-       }
+       flatname = flat_read_string(dtbuf);
 
-       node->basenamelen = check_node_name(node->name);
-       if (node->basenamelen < 0) {
-               fprintf(stderr, "Warning \"%s\" has incorrect format\n", node->name);
-       }
+       if (flags & FTF_FULLPATH)
+               node->name = nodename_from_path(parent_flatname, flatname);
+       else
+               node->name = flatname;
 
        do {
                struct property *prop;
@@ -795,8 +745,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
                        break;
 
                case FDT_BEGIN_NODE:
-                       child = unflatten_tree(dtbuf,strbuf, node->fullpath,
-                                              flags);
+                       child = unflatten_tree(dtbuf,strbuf, flatname, flags);
                        add_child(node, child);
                        break;
 
@@ -825,10 +774,11 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
 }
 
 
-struct boot_info *dt_from_blob(FILE *f)
+struct boot_info *dt_from_blob(const char *fname)
 {
-       u32 magic, totalsize, version, size_str, size_dt;
-       u32 off_dt, off_str, off_mem_rsvmap;
+       struct dtc_file *dtcf;
+       uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys;
+       uint32_t off_dt, off_str, off_mem_rsvmap;
        int rc;
        char *blob;
        struct fdt_header *fdt;
@@ -838,54 +788,56 @@ struct boot_info *dt_from_blob(FILE *f)
        int sizeleft;
        struct reserve_info *reservelist;
        struct node *tree;
-       u32 val;
+       uint32_t val;
        int flags = 0;
 
-       rc = fread(&magic, sizeof(magic), 1, f);
-       if (ferror(f))
+       dtcf = dtc_open_file(fname, NULL);
+
+       rc = fread(&magic, sizeof(magic), 1, dtcf->file);
+       if (ferror(dtcf->file))
                die("Error reading DT blob magic number: %s\n",
                    strerror(errno));
        if (rc < 1) {
-               if (feof(f))
+               if (feof(dtcf->file))
                        die("EOF reading DT blob magic number\n");
                else
                        die("Mysterious short read reading magic number\n");
        }
 
-       magic = be32_to_cpu(magic);
+       magic = fdt32_to_cpu(magic);
        if (magic != FDT_MAGIC)
                die("Blob has incorrect magic number\n");
 
-       rc = fread(&totalsize, sizeof(totalsize), 1, f);
-       if (ferror(f))
+       rc = fread(&totalsize, sizeof(totalsize), 1, dtcf->file);
+       if (ferror(dtcf->file))
                die("Error reading DT blob size: %s\n", strerror(errno));
        if (rc < 1) {
-               if (feof(f))
+               if (feof(dtcf->file))
                        die("EOF reading DT blob size\n");
                else
                        die("Mysterious short read reading blob size\n");
        }
 
-       totalsize = be32_to_cpu(totalsize);
+       totalsize = fdt32_to_cpu(totalsize);
        if (totalsize < FDT_V1_SIZE)
                die("DT blob size (%d) is too small\n", totalsize);
 
        blob = xmalloc(totalsize);
 
        fdt = (struct fdt_header *)blob;
-       fdt->magic = cpu_to_be32(magic);
-       fdt->totalsize = cpu_to_be32(totalsize);
+       fdt->magic = cpu_to_fdt32(magic);
+       fdt->totalsize = cpu_to_fdt32(totalsize);
 
        sizeleft = totalsize - sizeof(magic) - sizeof(totalsize);
        p = blob + sizeof(magic)  + sizeof(totalsize);
 
        while (sizeleft) {
-               if (feof(f))
+               if (feof(dtcf->file))
                        die("EOF before reading %d bytes of DT blob\n",
                            totalsize);
 
-               rc = fread(p, 1, sizeleft, f);
-               if (ferror(f))
+               rc = fread(p, 1, sizeleft, dtcf->file);
+               if (ferror(dtcf->file))
                        die("Error reading DT blob: %s\n",
                            strerror(errno));
 
@@ -893,19 +845,11 @@ struct boot_info *dt_from_blob(FILE *f)
                p += rc;
        }
 
-       off_dt = be32_to_cpu(fdt->off_dt_struct);
-       off_str = be32_to_cpu(fdt->off_dt_strings);
-       off_mem_rsvmap = be32_to_cpu(fdt->off_mem_rsvmap);
-       version = be32_to_cpu(fdt->version);
-
-       fprintf(stderr, "\tmagic:\t\t\t0x%x\n", magic);
-       fprintf(stderr, "\ttotalsize:\t\t%d\n", totalsize);
-       fprintf(stderr, "\toff_dt_struct:\t\t0x%x\n", off_dt);
-       fprintf(stderr, "\toff_dt_strings:\t\t0x%x\n", off_str);
-       fprintf(stderr, "\toff_mem_rsvmap:\t\t0x%x\n", off_mem_rsvmap);
-       fprintf(stderr, "\tversion:\t\t0x%x\n", version );
-       fprintf(stderr, "\tlast_comp_version:\t0x%x\n",
-               be32_to_cpu(fdt->last_comp_version));
+       off_dt = fdt32_to_cpu(fdt->off_dt_struct);
+       off_str = fdt32_to_cpu(fdt->off_dt_strings);
+       off_mem_rsvmap = fdt32_to_cpu(fdt->off_mem_rsvmap);
+       version = fdt32_to_cpu(fdt->version);
+       boot_cpuid_phys = fdt32_to_cpu(fdt->boot_cpuid_phys);
 
        if (off_mem_rsvmap >= totalsize)
                die("Mem Reserve structure offset exceeds total size\n");
@@ -916,21 +860,17 @@ struct boot_info *dt_from_blob(FILE *f)
        if (off_str > totalsize)
                die("String table offset exceeds total size\n");
 
-       if (version >= 2)
-               fprintf(stderr, "\tboot_cpuid_phys:\t0x%x\n",
-                       be32_to_cpu(fdt->boot_cpuid_phys));
-
-       size_str = -1;
        if (version >= 3) {
-               size_str = be32_to_cpu(fdt->size_dt_strings);
-               fprintf(stderr, "\tsize_dt_strings:\t%d\n", size_str);
+               uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings);
                if (off_str+size_str > totalsize)
                        die("String table extends past total size\n");
+               inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
+       } else {
+               inbuf_init(&strbuf, blob + off_str, blob + totalsize);
        }
 
        if (version >= 17) {
-               size_dt = be32_to_cpu(fdt->size_dt_struct);
-               fprintf(stderr, "\tsize_dt_struct:\t\t%d\n", size_dt);
+               size_dt = fdt32_to_cpu(fdt->size_dt_struct);
                if (off_dt+size_dt > totalsize)
                        die("Structure block extends past total size\n");
        }
@@ -944,10 +884,6 @@ struct boot_info *dt_from_blob(FILE *f)
        inbuf_init(&memresvbuf,
                   blob + off_mem_rsvmap, blob + totalsize);
        inbuf_init(&dtbuf, blob + off_dt, blob + totalsize);
-       if (size_str >= 0)
-               inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
-       else
-               inbuf_init(&strbuf, blob + off_str, blob + totalsize);
 
        reservelist = flat_read_mem_reserve(&memresvbuf);
 
@@ -964,5 +900,7 @@ struct boot_info *dt_from_blob(FILE *f)
 
        free(blob);
 
-       return build_boot_info(reservelist, tree);
+       dtc_close_file(dtcf);
+
+       return build_boot_info(reservelist, tree, boot_cpuid_phys);
 }
index 2a160a4..766b269 100644 (file)
@@ -31,8 +31,8 @@ static struct node *read_fstree(const char *dirname)
        struct node *tree;
 
        d = opendir(dirname);
-       if (! d)
-               die("opendir(): %s\n", strerror(errno));
+       if (!d)
+               die("Couldn't opendir() \"%s\": %s\n", dirname, strerror(errno));
 
        tree = build_node(NULL, NULL);
 
@@ -87,8 +87,6 @@ struct boot_info *dt_from_fs(const char *dirname)
        tree = read_fstree(dirname);
        tree = name_node(tree, "", NULL);
 
-       fill_fullpaths(tree, "");
-
-       return build_boot_info(NULL, tree);
+       return build_boot_info(NULL, tree, 0);
 }
 
diff --git a/arch/powerpc/boot/dtc-src/libfdt_env.h b/arch/powerpc/boot/dtc-src/libfdt_env.h
new file mode 100644 (file)
index 0000000..449bf60
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#define _B(n)  ((unsigned long long)((uint8_t *)&x)[n])
+static inline uint32_t fdt32_to_cpu(uint32_t x)
+{
+       return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
+}
+#define cpu_to_fdt32(x) fdt32_to_cpu(x)
+
+static inline uint64_t fdt64_to_cpu(uint64_t x)
+{
+       return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
+               | (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
+}
+#define cpu_to_fdt64(x) fdt64_to_cpu(x)
+#undef _B
+
+#endif /* _LIBFDT_ENV_H */
index 6ba0846..0ca3de5 100644 (file)
@@ -115,6 +115,7 @@ void add_child(struct node *parent, struct node *child)
        struct node **p;
 
        child->next_sibling = NULL;
+       child->parent = parent;
 
        p = &parent->children;
        while (*p)
@@ -123,7 +124,8 @@ void add_child(struct node *parent, struct node *child)
        *p = child;
 }
 
-struct reserve_info *build_reserve_entry(u64 address, u64 size, char *label)
+struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size,
+                                        char *label)
 {
        struct reserve_info *new = xmalloc(sizeof(*new));
 
@@ -165,13 +167,14 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
 }
 
 struct boot_info *build_boot_info(struct reserve_info *reservelist,
-                                 struct node *tree)
+                                 struct node *tree, uint32_t boot_cpuid_phys)
 {
        struct boot_info *bi;
 
        bi = xmalloc(sizeof(*bi));
        bi->reservelist = reservelist;
        bi->dt = tree;
+       bi->boot_cpuid_phys = boot_cpuid_phys;
 
        return bi;
 }
@@ -202,7 +205,7 @@ struct property *get_property(struct node *node, const char *propname)
 cell_t propval_cell(struct property *prop)
 {
        assert(prop->val.len == sizeof(cell_t));
-       return be32_to_cpu(*((cell_t *)prop->val.val));
+       return fdt32_to_cpu(*((cell_t *)prop->val.val));
 }
 
 struct node *get_subnode(struct node *node, const char *nodename)
index 352b0fe..9641b76 100644 (file)
 #include "dtc.h"
 #include "srcpos.h"
 
-
-/*
- * Record the complete unique set of opened file names.
- * Primarily used to cache source position file names.
- */
-#define MAX_N_FILE_NAMES       (100)
-
-const char *file_names[MAX_N_FILE_NAMES];
-static int n_file_names = 0;
-
 /*
  * Like yylineno, this is the current open file pos.
  */
 
-int srcpos_filenum = -1;
-
+struct dtc_file *srcpos_file;
 
-
-FILE *dtc_open_file(const char *fname)
+static int dtc_open_one(struct dtc_file *file,
+                        const char *search,
+                        const char *fname)
 {
-       FILE *f;
+       char *fullname;
 
-       if (lookup_file_name(fname, 1) < 0)
-               die("Too many files opened\n");
+       if (search) {
+               fullname = xmalloc(strlen(search) + strlen(fname) + 2);
 
-       if (streq(fname, "-"))
-               f = stdin;
-       else
-               f = fopen(fname, "r");
+               strcpy(fullname, search);
+               strcat(fullname, "/");
+               strcat(fullname, fname);
+       } else {
+               fullname = strdup(fname);
+       }
 
-       if (! f)
-               die("Couldn't open \"%s\": %s\n", fname, strerror(errno));
+       file->file = fopen(fullname, "r");
+       if (!file->file) {
+               free(fullname);
+               return 0;
+       }
 
-       return f;
+       file->name = fullname;
+       return 1;
 }
 
 
+struct dtc_file *dtc_open_file(const char *fname,
+                               const struct search_path *search)
+{
+       static const struct search_path default_search = { NULL, NULL, NULL };
 
-/*
- * Locate and optionally add filename fname in the file_names[] array.
- *
- * If the filename is currently not in the array and the boolean
- * add_it is non-zero, an attempt to add the filename will be made.
- *
- * Returns;
- *    Index [0..MAX_N_FILE_NAMES) where the filename is kept
- *    -1 if the name can not be recorded
- */
+       struct dtc_file *file;
+       const char *slash;
 
-int lookup_file_name(const char *fname, int add_it)
-{
-       int i;
+       file = xmalloc(sizeof(struct dtc_file));
 
-       for (i = 0; i < n_file_names; i++) {
-               if (strcmp(file_names[i], fname) == 0)
-                       return i;
+       slash = strrchr(fname, '/');
+       if (slash) {
+               char *dir = xmalloc(slash - fname + 1);
+
+               memcpy(dir, fname, slash - fname);
+               dir[slash - fname] = 0;
+               file->dir = dir;
+       } else {
+               file->dir = NULL;
        }
 
-       if (add_it) {
-               if (n_file_names < MAX_N_FILE_NAMES) {
-                       file_names[n_file_names] = strdup(fname);
-                       return n_file_names++;
-               }
+       if (streq(fname, "-")) {
+               file->name = "stdin";
+               file->file = stdin;
+               return file;
        }
 
-       return -1;
-}
+       if (fname[0] == '/') {
+               file->file = fopen(fname, "r");
+               if (!file->file)
+                       goto fail;
+
+               file->name = strdup(fname);
+               return file;
+       }
 
+       if (!search)
+               search = &default_search;
 
-const char *srcpos_filename_for_num(int filenum)
-{
-       if (0 <= filenum && filenum < n_file_names) {
-               return file_names[filenum];
+       while (search) {
+               if (dtc_open_one(file, search->dir, fname))
+                       return file;
+
+               if (errno != ENOENT)
+                       goto fail;
+
+               search = search->next;
        }
 
-       return 0;
+fail:
+       die("Couldn't open \"%s\": %s\n", fname, strerror(errno));
 }
 
-
-const char *srcpos_get_filename(void)
+void dtc_close_file(struct dtc_file *file)
 {
-       return srcpos_filename_for_num(srcpos_filenum);
+       if (fclose(file->file))
+               die("Error closing \"%s\": %s\n", file->name, strerror(errno));
+
+       free(file->dir);
+       free(file);
 }
index ce7ab5b..e17c7c0 100644 (file)
  * array of all opened filenames.
  */
 
+#include <stdio.h>
+
+struct dtc_file {
+       char *dir;
+       const char *name;
+       FILE *file;
+};
+
 #if ! defined(YYLTYPE) && ! defined(YYLTYPE_IS_DECLARED)
 typedef struct YYLTYPE {
     int first_line;
     int first_column;
     int last_line;
     int last_column;
-    int filenum;
+    struct dtc_file *file;
 } YYLTYPE;
 
 #define YYLTYPE_IS_DECLARED    1
@@ -48,7 +56,7 @@ typedef struct YYLTYPE {
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
-         (Current).filenum      = YYRHSLOC (Rhs, N).filenum;           \
+         (Current).file         = YYRHSLOC (Rhs, N).file;              \
        }                                                               \
       else                                                             \
        {                                                               \
@@ -56,20 +64,22 @@ typedef struct YYLTYPE {
            YYRHSLOC (Rhs, 0).last_line;                                \
          (Current).first_column = (Current).last_column =              \
            YYRHSLOC (Rhs, 0).last_column;                              \
-         (Current).filenum      = YYRHSLOC (Rhs, 0).filenum;           \
+         (Current).file         = YYRHSLOC (Rhs, 0).file;              \
        }                                                               \
     while (YYID (0))
 
 
 
 extern void yyerror(char const *);
+extern void yyerrorf(char const *, ...) __attribute__((format(printf, 1, 2)));
 
-extern int srcpos_filenum;
+extern struct dtc_file *srcpos_file;
 
-extern int push_input_file(const char *filename);
-extern int pop_input_file(void);
+struct search_path {
+       const char *dir; /* NULL for current directory */
+       struct search_path *prev, *next;
+};
 
-extern FILE *dtc_open_file(const char *fname);
-extern int lookup_file_name(const char *fname, int add_it);
-extern const char *srcpos_filename_for_num(int filenum);
-const char *srcpos_get_filename(void);
+extern struct dtc_file *dtc_open_file(const char *fname,
+                                      const struct search_path *search);
+extern void dtc_close_file(struct dtc_file *file);
index a6a7767..ebeb6eb 100644 (file)
 
 extern FILE *yyin;
 extern int yyparse(void);
-extern void yyerror(char const *);
 
 struct boot_info *the_boot_info;
+int treesource_error;
 
 struct boot_info *dt_from_source(const char *fname)
 {
        the_boot_info = NULL;
+       treesource_error = 0;
 
-       push_input_file(fname);
+       srcpos_file = dtc_open_file(fname, NULL);
+       yyin = srcpos_file->file;
 
        if (yyparse() != 0)
-               return NULL;
+               die("Unable to parse input tree\n");
 
-       fill_fullpaths(the_boot_info->dt, "");
+       if (treesource_error)
+               die("Syntax error parsing input tree\n");
 
        return the_boot_info;
 }
@@ -144,7 +147,7 @@ static void write_propval_cells(FILE *f, struct data val)
                        m = m->next;
                }
 
-               fprintf(f, "0x%x", be32_to_cpu(*cp++));
+               fprintf(f, "0x%x", fdt32_to_cpu(*cp++));
                if ((void *)cp >= propend)
                        break;
                fprintf(f, " ");
@@ -173,7 +176,7 @@ static void write_propval_bytes(FILE *f, struct data val)
                }
 
                fprintf(f, "%02hhx", *bp++);
-               if ((void *)bp >= propend)
+               if ((const void *)bp >= propend)
                        break;
                fprintf(f, " ");
        }
index 6c34303..658ff42 100644 (file)
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.0.0-gd6f9b62f"
+#define DTC_VERSION "DTC 1.2.0"
diff --git a/arch/powerpc/boot/dts/arches.dts b/arch/powerpc/boot/dts/arches.dts
new file mode 100644 (file)
index 0000000..d9113b1
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Device Tree Source for AMCC Arches (dual 460GT board)
+ *
+ * (C) Copyright 2008 Applied Micro Circuits Corporation
+ * Victor Gallardo <vgallardo@amcc.com>
+ * Adam Graham <agraham@amcc.com>
+ *
+ * Based on the glacier.dts file
+ *   Stefan Roese <sr@denx.de>
+ *   Copyright 2008 DENX Software Engineering
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/dts-v1/;
+
+/ {
+       #address-cells = <2>;
+       #size-cells = <1>;
+       model = "amcc,arches";
+       compatible = "amcc,arches";
+       dcr-parent = <&{/cpus/cpu@0}>;
+
+       aliases {
+               ethernet0 = &EMAC0;
+               ethernet1 = &EMAC1;
+               ethernet2 = &EMAC2;
+               serial0 = &UART0;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       model = "PowerPC,460GT";
+                       reg = <0x00000000>;
+                       clock-frequency = <0>; /* Filled in by U-Boot */
+                       timebase-frequency = <0>; /* Filled in by U-Boot */
+                       i-cache-line-size = <32>;
+                       d-cache-line-size = <32>;
+                       i-cache-size = <32768>;
+                       d-cache-size = <32768>;
+                       dcr-controller;
+                       dcr-access-method = "native";
+               };
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x00000000 0x00000000>; /* Filled in by U-Boot */
+       };
+
+       UIC0: interrupt-controller0 {
+               compatible = "ibm,uic-460gt","ibm,uic";
+               interrupt-controller;
+               cell-index = <0>;
+               dcr-reg = <0x0c0 0x009>;
+               #address-cells = <0>;
+               #size-cells = <0>;
+               #interrupt-cells = <2>;
+       };
+
+       UIC1: interrupt-controller1 {
+               compatible = "ibm,uic-460gt","ibm,uic";
+               interrupt-controller;
+               cell-index = <1>;
+               dcr-reg = <0x0d0 0x009>;
+               #address-cells = <0>;
+               #size-cells = <0>;
+               #interrupt-cells = <2>;
+               interrupts = <0x1e 0x4 0x1f 0x4>; /* cascade */
+               interrupt-parent = <&UIC0>;
+       };
+
+       UIC2: interrupt-controller2 {
+               compatible = "ibm,uic-460gt","ibm,uic";
+               interrupt-controller;
+               cell-index = <2>;
+               dcr-reg = <0x0e0 0x009>;
+               #address-cells = <0>;
+               #size-cells = <0>;
+               #interrupt-cells = <2>;
+               interrupts = <0xa 0x4 0xb 0x4>; /* cascade */
+               interrupt-parent = <&UIC0>;
+       };
+
+       UIC3: interrupt-controller3 {
+               compatible = "ibm,uic-460gt","ibm,uic";
+               interrupt-controller;
+               cell-index = <3>;
+               dcr-reg = <0x0f0 0x009>;
+               #address-cells = <0>;
+               #size-cells = <0>;
+               #interrupt-cells = <2>;
+               interrupts = <0x10 0x4 0x11 0x4>; /* cascade */
+               interrupt-parent = <&UIC0>;
+       };
+
+       SDR0: sdr {
+               compatible = "ibm,sdr-460gt";
+               dcr-reg = <0x00e 0x002>;
+       };
+
+       CPR0: cpr {
+               compatible = "ibm,cpr-460gt";
+               dcr-reg = <0x00c 0x002>;
+       };
+
+       plb {
+               compatible = "ibm,plb-460gt", "ibm,plb4";
+               #address-cells = <2>;
+               #size-cells = <1>;
+               ranges;
+               clock-frequency = <0>; /* Filled in by U-Boot */
+
+               SDRAM0: sdram {
+                       compatible = "ibm,sdram-460gt", "ibm,sdram-405gp";
+                       dcr-reg = <0x010 0x002>;
+               };
+
+               MAL0: mcmal {
+                       compatible = "ibm,mcmal-460gt", "ibm,mcmal2";
+                       dcr-reg = <0x180 0x062>;
+                       num-tx-chans = <3>;
+                       num-rx-chans = <24>;
+                       #address-cells = <0>;
+                       #size-cells = <0>;
+                       interrupt-parent = <&UIC2>;
+                       interrupts = <  /*TXEOB*/ 0x6 0x4
+                                       /*RXEOB*/ 0x7 0x4
+                                       /*SERR*/  0x3 0x4
+                                       /*TXDE*/  0x4 0x4
+                                       /*RXDE*/  0x5 0x4>;
+                       desc-base-addr-high = <0x8>;
+               };
+
+               POB0: opb {
+                       compatible = "ibm,opb-460gt", "ibm,opb";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0xb0000000 0x00000004 0xb0000000 0x50000000>;
+                       clock-frequency = <0>; /* Filled in by U-Boot */
+
+                       EBC0: ebc {
+                               compatible = "ibm,ebc-460gt", "ibm,ebc";
+                               dcr-reg = <0x012 0x002>;
+                               #address-cells = <2>;
+                               #size-cells = <1>;
+                               clock-frequency = <0>; /* Filled in by U-Boot */
+                               /* ranges property is supplied by U-Boot */
+                               interrupts = <0x6 0x4>;
+                               interrupt-parent = <&UIC1>;
+                       };
+
+                       UART0: serial@ef600300 {
+                               device_type = "serial";
+                               compatible = "ns16550";
+                               reg = <0xef600300 0x00000008>;
+                               virtual-reg = <0xef600300>;
+                               clock-frequency = <0>; /* Filled in by U-Boot */
+                               current-speed = <0>; /* Filled in by U-Boot */
+                               interrupt-parent = <&UIC1>;
+                               interrupts = <0x1 0x4>;
+                       };
+
+                       IIC0: i2c@ef600700 {
+                               compatible = "ibm,iic-460gt", "ibm,iic";
+                               reg = <0xef600700 0x00000014>;
+                               interrupt-parent = <&UIC0>;
+                               interrupts = <0x2 0x4>;
+                       };
+
+                       IIC1: i2c@ef600800 {
+                               compatible = "ibm,iic-460gt", "ibm,iic";
+                               reg = <0xef600800 0x00000014>;
+                               interrupt-parent = <&UIC0>;
+                               interrupts = <0x3 0x4>;
+                       };
+
+                       TAH0: emac-tah@ef601350 {
+                               compatible = "ibm,tah-460gt", "ibm,tah";
+                               reg = <0xef601350 0x00000030>;
+                       };
+
+                       TAH1: emac-tah@ef601450 {
+                               compatible = "ibm,tah-460gt", "ibm,tah";
+                               reg = <0xef601450 0x00000030>;
+                       };
+
+                       EMAC0: ethernet@ef600e00 {
+                               device_type = "network";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
+                               interrupt-parent = <&EMAC0>;
+                               interrupts = <0x0 0x1>;
+                               #interrupt-cells = <1>;
+                               #address-cells = <0>;
+                               #size-cells = <0>;
+                               interrupt-map = </*Status*/ 0x0 &UIC2 0x10 0x4
+                                                /*Wake*/   0x1 &UIC2 0x14 0x4>;
+                               reg = <0xef600e00 0x000000c4>;
+                               local-mac-address = [000000000000]; /* Filled in by U-Boot */
+                               mal-device = <&MAL0>;
+                               mal-tx-channel = <0>;
+                               mal-rx-channel = <0>;
+                               cell-index = <0>;
+                               max-frame-size = <9000>;
+                               rx-fifo-size = <4096>;
+                               tx-fifo-size = <2048>;
+                               phy-mode = "sgmii";
+                               phy-map = <0xffffffff>;
+                               gpcs-address = <0x0000000a>;
+                               tah-device = <&TAH0>;
+                               tah-channel = <0>;
+                               has-inverted-stacr-oc;
+                               has-new-stacr-staopc;
+                       };
+
+                       EMAC1: ethernet@ef600f00 {
+                               device_type = "network";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
+                               interrupt-parent = <&EMAC1>;
+                               interrupts = <0x0 0x1>;
+                               #interrupt-cells = <1>;
+                               #address-cells = <0>;
+                               #size-cells = <0>;
+                               interrupt-map = </*Status*/ 0x0 &UIC2 0x11 0x4
+                                                /*Wake*/   0x1 &UIC2 0x15 0x4>;
+                               reg = <0xef600f00 0x000000c4>;
+                               local-mac-address = [000000000000]; /* Filled in by U-Boot */
+                               mal-device = <&MAL0>;
+                               mal-tx-channel = <1>;
+                               mal-rx-channel = <8>;
+                               cell-index = <1>;
+                               max-frame-size = <9000>;
+                               rx-fifo-size = <4096>;
+                               tx-fifo-size = <2048>;
+                               phy-mode = "sgmii";
+                               phy-map = <0x00000000>;
+                               gpcs-address = <0x0000000b>;
+                               tah-device = <&TAH1>;
+                               tah-channel = <1>;
+                               has-inverted-stacr-oc;
+                               has-new-stacr-staopc;
+                               mdio-device = <&EMAC0>;
+                       };
+
+                       EMAC2: ethernet@ef601100 {
+                               device_type = "network";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
+                               interrupt-parent = <&EMAC2>;
+                               interrupts = <0x0 0x1>;
+                               #interrupt-cells = <1>;
+                               #address-cells = <0>;
+                               #size-cells = <0>;
+                               interrupt-map = </*Status*/ 0x0 &UIC2 0x12 0x4
+                                                /*Wake*/   0x1 &UIC2 0x16 0x4>;
+                               reg = <0xef601100 0x000000c4>;
+                               local-mac-address = [000000000000]; /* Filled in by U-Boot */
+                               mal-device = <&MAL0>;
+                               mal-tx-channel = <2>;
+                               mal-rx-channel = <16>;
+                               cell-index = <2>;
+                               max-frame-size = <9000>;
+                               rx-fifo-size = <4096>;
+                               tx-fifo-size = <2048>;
+                               phy-mode = "sgmii";
+                               phy-map = <0x00000001>;
+                               gpcs-address = <0x0000000C>;
+                               has-inverted-stacr-oc;
+                               has-new-stacr-staopc;
+                               mdio-device = <&EMAC0>;
+                       };
+               };
+       };
+};
index 8b1bb0e..6235fca 100644 (file)
                        dma-channel@0 {
                                compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
                                reg = <0 0x80>;
+                               cell-index = <0>;
                                interrupt-parent = <&ipic>;
                                interrupts = <71 8>;
                        };
                        dma-channel@80 {
                                compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
                                reg = <0x80 0x80>;
+                               cell-index = <1>;
                                interrupt-parent = <&ipic>;
                                interrupts = <71 8>;
                        };
                        dma-channel@100 {
                                compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
                                reg = <0x100 0x80>;
+                               cell-index = <2>;
                                interrupt-parent = <&ipic>;
                                interrupts = <71 8>;
                        };
                        dma-channel@180 {
                                compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
                                reg = <0x180 0x28>;
+                               cell-index = <3>;
                                interrupt-parent = <&ipic>;
                                interrupts = <71 8>;
                        };
diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts
new file mode 100644 (file)
index 0000000..6ed6083
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * GE Fanuc SBC610 Device Tree Source
+ *
+ * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ * Based on: SBS CM6 Device Tree Source
+ * Copyright 2007 SBS Technologies GmbH & Co. KG
+ * And: mpc8641_hpcn.dts (MPC8641 HPCN Device Tree Source)
+ * Copyright 2006 Freescale Semiconductor Inc.
+ */
+
+/*
+ * Compiled with dtc -I dts -O dtb -o gef_sbc610.dtb gef_sbc610.dts
+ */
+
+/dts-v1/;
+
+/ {
+       model = "GEF_SBC610";
+       compatible = "gef,sbc610";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       aliases {
+               ethernet0 = &enet0;
+               ethernet1 = &enet1;
+               serial0 = &serial0;
+               serial1 = &serial1;
+               pci0 = &pci0;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               PowerPC,8641@0 {
+                       device_type = "cpu";
+                       reg = <0>;
+                       d-cache-line-size = <32>;       // 32 bytes
+                       i-cache-line-size = <32>;       // 32 bytes
+                       d-cache-size = <32768>;         // L1, 32K
+                       i-cache-size = <32768>;         // L1, 32K
+                       timebase-frequency = <0>;       // From uboot
+                       bus-frequency = <0>;            // From uboot
+                       clock-frequency = <0>;          // From uboot
+               };
+               PowerPC,8641@1 {
+                       device_type = "cpu";
+                       reg = <1>;
+                       d-cache-line-size = <32>;       // 32 bytes
+                       i-cache-line-size = <32>;       // 32 bytes
+                       d-cache-size = <32768>;         // L1, 32K
+                       i-cache-size = <32768>;         // L1, 32K
+                       timebase-frequency = <0>;       // From uboot
+                       bus-frequency = <0>;            // From uboot
+                       clock-frequency = <0>;          // From uboot
+               };
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x0 0x40000000>; // set by uboot
+       };
+
+       localbus@fef05000 {
+               #address-cells = <2>;
+               #size-cells = <1>;
+               compatible = "fsl,mpc8641-localbus", "simple-bus";
+               reg = <0xf8005000 0x1000>;
+               interrupts = <19 2>;
+               interrupt-parent = <&mpic>;
+
+               ranges = <0 0 0xff000000 0x01000000     // 16MB Boot flash
+                         1 0 0xe8000000 0x08000000     // Paged Flash 0
+                         2 0 0xe0000000 0x08000000     // Paged Flash 1
+                         3 0 0xfc100000 0x00020000     // NVRAM
+                         4 0 0xfc000000 0x00008000     // FPGA
+                         5 0 0xfc008000 0x00008000     // AFIX FPGA
+                         6 0 0xfd000000 0x00800000     // IO FPGA (8-bit)
+                         7 0 0xfd800000 0x00800000>;   // IO FPGA (32-bit)
+
+               fpga@4,0 {
+                       compatible = "gef,fpga-regs";
+                       reg = <0x4 0x0 0x40>;
+               };
+               gef_pic: pic@4,4000 {
+                       #interrupt-cells = <1>;
+                       interrupt-controller;
+                       compatible = "gef,fpga-pic";
+                       reg = <0x4 0x4000 0x20>;
+                       interrupts = <0x8
+                                     0x9>;
+                       interrupt-parent = <&mpic>;
+
+               };
+       };
+
+       soc@fef00000 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               #interrupt-cells = <2>;
+               device_type = "soc";
+               compatible = "simple-bus";
+               ranges = <0x0 0xfef00000 0x00100000>;
+               reg = <0xfef00000 0x100000>;    // CCSRBAR 1M
+               bus-frequency = <0>;
+
+               i2c1: i2c@3000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "fsl-i2c";
+                       reg = <0x3000 0x100>;
+                       interrupts = <0x2b 0x2>;
+                       interrupt-parent = <&mpic>;
+                       dfsrr;
+
+                       eti@6b {
+                               compatible = "dallas,ds1682";
+                               reg = <0x6b>;
+                       };
+               };
+
+               i2c2: i2c@3100 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "fsl-i2c";
+                       reg = <0x3100 0x100>;
+                       interrupts = <0x2b 0x2>;
+                       interrupt-parent = <&mpic>;
+                       dfsrr;
+               };
+
+               dma@21300 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       compatible = "fsl,mpc8641-dma", "fsl,eloplus-dma";
+                       reg = <0x21300 0x4>;
+                       ranges = <0x0 0x21100 0x200>;
+                       cell-index = <0>;
+                       dma-channel@0 {
+                               compatible = "fsl,mpc8641-dma-channel",
+                                          "fsl,eloplus-dma-channel";
+                               reg = <0x0 0x80>;
+                               cell-index = <0>;
+                               interrupt-parent = <&mpic>;
+                               interrupts = <20 2>;
+                       };
+                       dma-channel@80 {
+                               compatible = "fsl,mpc8641-dma-channel",
+                                          "fsl,eloplus-dma-channel";
+                               reg = <0x80 0x80>;
+                               cell-index = <1>;
+                               interrupt-parent = <&mpic>;
+                               interrupts = <21 2>;
+                       };
+                       dma-channel@100 {
+                               compatible = "fsl,mpc8641-dma-channel",
+                                          "fsl,eloplus-dma-channel";
+                               reg = <0x100 0x80>;
+                               cell-index = <2>;
+                               interrupt-parent = <&mpic>;
+                               interrupts = <22 2>;
+                       };
+                       dma-channel@180 {
+                               compatible = "fsl,mpc8641-dma-channel",
+                                          "fsl,eloplus-dma-channel";
+                               reg = <0x180 0x80>;
+                               cell-index = <3>;
+                               interrupt-parent = <&mpic>;
+                               interrupts = <23 2>;
+                       };
+               };
+
+               mdio@24520 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "fsl,gianfar-mdio";
+                       reg = <0x24520 0x20>;
+
+                       phy0: ethernet-phy@0 {
+                               interrupt-parent = <&gef_pic>;
+                               interrupts = <0x9 0x4>;
+                               reg = <1>;
+                       };
+                       phy2: ethernet-phy@2 {
+                               interrupt-parent = <&gef_pic>;
+                               interrupts = <0x8 0x4>;
+                               reg = <3>;
+                       };
+               };
+
+               enet0: ethernet@24000 {
+                       device_type = "network";
+                       model = "eTSEC";
+                       compatible = "gianfar";
+                       reg = <0x24000 0x1000>;
+                       local-mac-address = [ 00 00 00 00 00 00 ];
+                       interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
+                       interrupt-parent = <&mpic>;
+                       phy-handle = <&phy0>;
+                       phy-connection-type = "gmii";
+               };
+
+               enet1: ethernet@26000 {
+                       device_type = "network";
+                       model = "eTSEC";
+                       compatible = "gianfar";
+                       reg = <0x26000 0x1000>;
+                       local-mac-address = [ 00 00 00 00 00 00 ];
+                       interrupts = <0x1f 0x2 0x20 0x2 0x21 0x2>;
+                       interrupt-parent = <&mpic>;
+                       phy-handle = <&phy2>;
+                       phy-connection-type = "gmii";
+               };
+
+               serial0: serial@4500 {
+                       cell-index = <0>;
+                       device_type = "serial";
+                       compatible = "ns16550";
+                       reg = <0x4500 0x100>;
+                       clock-frequency = <0>;
+                       interrupts = <0x2a 0x2>;
+                       interrupt-parent = <&mpic>;
+               };
+
+               serial1: serial@4600 {
+                       cell-index = <1>;
+                       device_type = "serial";
+                       compatible = "ns16550";
+                       reg = <0x4600 0x100>;
+                       clock-frequency = <0>;
+                       interrupts = <0x1c 0x2>;
+                       interrupt-parent = <&mpic>;
+               };
+
+               mpic: pic@40000 {
+                       clock-frequency = <0>;
+                       interrupt-controller;
+                       #address-cells = <0>;
+                       #interrupt-cells = <2>;
+                       reg = <0x40000 0x40000>;
+                       compatible = "chrp,open-pic";
+                       device_type = "open-pic";
+               };
+
+               global-utilities@e0000 {
+                       compatible = "fsl,mpc8641-guts";
+                       reg = <0xe0000 0x1000>;
+                       fsl,has-rstcr;
+               };
+       };
+
+       pci0: pcie@fef08000 {
+               compatible = "fsl,mpc8641-pcie";
+               device_type = "pci";
+               #interrupt-cells = <1>;
+               #size-cells = <2>;
+               #address-cells = <3>;
+               reg = <0xfef08000 0x1000>;
+               bus-range = <0x0 0xff>;
+               ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x40000000
+                         0x01000000 0x0 0x00000000 0xfe000000 0x0 0x00400000>;
+               clock-frequency = <33333333>;
+               interrupt-parent = <&mpic>;
+               interrupts = <0x18 0x2>;
+               interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+               interrupt-map = <
+                       0x0000 0x0 0x0 0x1 &mpic 0x0 0x1
+                       0x0000 0x0 0x0 0x2 &mpic 0x1 0x1
+                       0x0000 0x0 0x0 0x3 &mpic 0x2 0x1
+                       0x0000 0x0 0x0 0x4 &mpic 0x3 0x1
+               >;
+
+               pcie@0 {
+                       reg = <0 0 0 0 0>;
+                       #size-cells = <2>;
+                       #address-cells = <3>;
+                       device_type = "pci";
+                       ranges = <0x02000000 0x0 0x80000000
+                                 0x02000000 0x0 0x80000000
+                                 0x0 0x40000000
+
+                                 0x01000000 0x0 0x00000000
+                                 0x01000000 0x0 0x00000000
+                                 0x0 0x00400000>;
+               };
+       };
+};
index 24cf0db..f3787a2 100644 (file)
@@ -14,7 +14,7 @@
        #address-cells = <2>;
        #size-cells = <1>;
        model = "amcc,glacier";
-       compatible = "amcc,glacier", "amcc,canyonlands";
+       compatible = "amcc,glacier";
        dcr-parent = <&{/cpus/cpu@0}>;
 
        aliases {
diff --git a/arch/powerpc/boot/dts/mgcoge.dts b/arch/powerpc/boot/dts/mgcoge.dts
new file mode 100644 (file)
index 0000000..633255a
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Device Tree for the MGCOGE plattform from keymile
+ *
+ * Copyright 2008 DENX Software Engineering GmbH
+ * Heiko Schocher <hs@denx.de>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+/ {
+       model = "MGCOGE";
+       compatible = "keymile,mgcoge";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       aliases {
+               ethernet0 = &eth0;
+               serial0 = &smc2;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               PowerPC,8247@0 {
+                       device_type = "cpu";
+                       reg = <0>;
+                       d-cache-line-size = <32>;
+                       i-cache-line-size = <32>;
+                       d-cache-size = <16384>;
+                       i-cache-size = <16384>;
+                       timebase-frequency = <0>; /* Filled in by U-Boot */
+                       clock-frequency = <0>; /* Filled in by U-Boot */
+                       bus-frequency = <0>; /* Filled in by U-Boot */
+               };
+       };
+
+       localbus@f0010100 {
+               compatible = "fsl,mpc8247-localbus",
+                            "fsl,pq2-localbus",
+                            "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <1>;
+               reg = <0xf0010100 0x40>;
+
+               ranges = <0 0 0xfe000000 0x00400000
+                         5 0 0x50000000 0x20000000
+                       >; /* Filled in by U-Boot */
+
+               flash@0,0 {
+                       compatible = "cfi-flash";
+                       reg = <0 0x0 0x400000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       bank-width = <1>;
+                       device-width = <1>;
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0 0x40000>;
+                       };
+                       partition@40000 {
+                               label = "env";
+                               reg = <0x40000 0x20000>;
+                       };
+                       partition@60000 {
+                               label = "kernel";
+                               reg = <0x60000 0x220000>;
+                       };
+                       partition@280000 {
+                               label = "dtb";
+                               reg = <0x280000 0x20000>;
+                       };
+               };
+
+               flash@5,0 {
+                       compatible = "cfi-flash";
+                       reg = <5 0x0 0x2000000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       bank-width = <2>;
+                       device-width = <2>;
+                       partition@0 {
+                               label = "ramdisk";
+                               reg = <0 0x7a0000>;
+                       };
+                       partition@7a0000 {
+                               label = "user";
+                               reg = <0x7a0000 0x1860000>;
+                       };
+               };
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0 0>; /* Filled in by U-Boot */
+       };
+
+       soc@f0000000 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "fsl,mpc8247-immr", "fsl,pq2-soc", "simple-bus";
+               ranges = <0x00000000 0xf0000000 0x00053000>;
+
+               // Temporary until code stops depending on it.
+               device_type = "soc";
+
+               cpm@119c0 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       #interrupt-cells = <2>;
+                       compatible = "fsl,mpc8247-cpm", "fsl,cpm2",
+                                       "simple-bus";
+                       reg = <0x119c0 0x30>;
+                       ranges;
+
+                       muram {
+                               compatible = "fsl,cpm-muram";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               ranges = <0 0 0x10000>;
+
+                               data@0 {
+                                       compatible = "fsl,cpm-muram-data";
+                                       reg = <0x80 0x1f80 0x9800 0x800>;
+                               };
+                       };
+
+                       brg@119f0 {
+                               compatible = "fsl,mpc8247-brg",
+                                            "fsl,cpm2-brg",
+                                            "fsl,cpm-brg";
+                               reg = <0x119f0 0x10 0x115f0 0x10>;
+                       };
+
+                       /* Monitor port/SMC2 */
+                       smc2: serial@11a90 {
+                               device_type = "serial";
+                               compatible = "fsl,mpc8247-smc-uart",
+                                            "fsl,cpm2-smc-uart";
+                               reg = <0x11a90 0x20 0x88fc 0x02>;
+                               interrupts = <5 8>;
+                               interrupt-parent = <&PIC>;
+                               fsl,cpm-brg = <2>;
+                               fsl,cpm-command = <0x21200000>;
+                               current-speed = <0>; /* Filled in by U-Boot */
+                       };
+
+                       eth0: ethernet@11a60 {
+                               device_type = "network";
+                               compatible = "fsl,mpc8247-scc-enet",
+                                            "fsl,cpm2-scc-enet";
+                               reg = <0x11a60 0x20 0x8300 0x100 0x11390 1>;
+                               local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by U-Boot */
+                               interrupts = <43 8>;
+                               interrupt-parent = <&PIC>;
+                               linux,network-index = <0>;
+                               fsl,cpm-command = <0xce00000>;
+                               fixed-link = <0 0 10 0 0>;
+                       };
+
+               };
+
+               PIC: interrupt-controller@10c00 {
+                       #interrupt-cells = <2>;
+                       interrupt-controller;
+                       reg = <0x10c00 0x80>;
+                       compatible = "fsl,mpc8247-pic", "fsl,pq2-pic";
+               };
+       };
+};
diff --git a/arch/powerpc/boot/dts/mgsuvd.dts b/arch/powerpc/boot/dts/mgsuvd.dts
new file mode 100644 (file)
index 0000000..e4fc53a
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * MGSUVD Device Tree Source
+ *
+ * Copyright 2008 DENX Software Engineering GmbH
+ * Heiko Schocher <hs@denx.de>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+/ {
+       model = "MGSUVD";
+       compatible = "keymile,mgsuvd";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               PowerPC,852@0 {
+                       device_type = "cpu";
+                       reg = <0>;
+                       d-cache-line-size = <16>;
+                       i-cache-line-size = <16>;
+                       d-cache-size = <8192>;
+                       i-cache-size = <8192>;
+                       timebase-frequency = <0>;       /* Filled in by u-boot */
+                       bus-frequency = <0>;            /* Filled in by u-boot */
+                       clock-frequency = <0>;          /* Filled in by u-boot */
+                       interrupts = <15 2>;            /* decrementer interrupt */
+                       interrupt-parent = <&PIC>;
+               };
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <00000000 0x4000000>;  /* Filled in by u-boot */
+       };
+
+       localbus@fff00100 {
+               compatible = "fsl,mpc852-localbus", "fsl,pq1-localbus", "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <1>;
+               reg = <0xfff00100 0x40>;
+
+               ranges = <0 0 0xf0000000 0x01000000>;  /* Filled in by u-boot */
+
+               flash@0,0 {
+                       compatible = "cfi-flash";
+                       reg = <0 0 0x1000000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       bank-width = <1>;
+                       device-width = <1>;
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0 0x80000>;
+                       };
+                       partition@80000 {
+                               label = "env";
+                               reg = <0x80000 0x20000>;
+                       };
+                       partition@a0000 {
+                               label = "kernel";
+                               reg = <0xa0000 0x1e0000>;
+                       };
+                       partition@280000 {
+                               label = "dtb";
+                               reg = <0x280000 0x20000>;
+                       };
+                       partition@2a0000 {
+                               label = "root";
+                               reg = <0x2a0000 0x500000>;
+                       };
+                       partition@7a0000 {
+                               label = "user";
+                               reg = <0x7a0000 0x860000>;
+                       };
+               };
+       };
+
+       soc@fff00000 {
+               compatible = "fsl,mpc852", "fsl,pq1-soc", "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               device_type = "soc";
+               ranges = <0 0xfff00000 0x00004000>;
+
+               PIC: interrupt-controller@0 {
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       reg = <0 24>;
+                       compatible = "fsl,mpc852-pic", "fsl,pq1-pic";
+               };
+
+               cpm@9c0 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       compatible = "fsl,mpc852-cpm", "fsl,cpm1", "simple-bus";
+                       interrupts = <0>;       /* cpm error interrupt */
+                       interrupt-parent = <&CPM_PIC>;
+                       reg = <0x9c0 10>;
+                       ranges;
+
+                       muram@2000 {
+                               compatible = "fsl,cpm-muram";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               ranges = <0 0x2000 0x2000>;
+
+                               data@0 {
+                                       compatible = "fsl,cpm-muram-data";
+                                       reg = <0x800 0x1800>;
+                               };
+                       };
+
+                       brg@9f0 {
+                               compatible = "fsl,mpc852-brg",
+                                            "fsl,cpm1-brg",
+                                            "fsl,cpm-brg";
+                               reg = <0x9f0 0x10>;
+                               clock-frequency = <0>; /* Filled in by u-boot */
+                       };
+
+                       CPM_PIC: interrupt-controller@930 {
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupts = <5 2 0 2>;
+                               interrupt-parent = <&PIC>;
+                               reg = <0x930 0x20>;
+                               compatible = "fsl,cpm1-pic";
+                       };
+
+                       /* MON-1 */
+                       serial@a80 {
+                               device_type = "serial";
+                               compatible = "fsl,cpm1-smc-uart";
+                               reg = <0xa80 0x10 0x3fc0 0x40>;
+                               interrupts = <4>;
+                               interrupt-parent = <&CPM_PIC>;
+                               fsl,cpm-brg = <1>;
+                               fsl,cpm-command = <0x0090>;
+                               current-speed = <0>; /* Filled in by u-boot */
+                       };
+
+                       ethernet@a40 {
+                               device_type = "network";
+                               compatible  = "fsl,mpc866-scc-enet",
+                   &nbs