Home | History | Annotate | Line # | Download | only in dist
      1 /*	$NetBSD: fdt.h,v 1.1.1.3 2019/12/22 12:30:36 skrll Exp $	*/
      2 
      3 /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
      4 #ifndef FDT_H
      5 #define FDT_H
      6 /*
      7  * libfdt - Flat Device Tree manipulation
      8  * Copyright (C) 2006 David Gibson, IBM Corporation.
      9  * Copyright 2012 Kim Phillips, Freescale Semiconductor.
     10  */
     11 
     12 #ifndef __ASSEMBLY__
     13 
     14 struct fdt_header {
     15 	fdt32_t magic;			 /* magic word FDT_MAGIC */
     16 	fdt32_t totalsize;		 /* total size of DT block */
     17 	fdt32_t off_dt_struct;		 /* offset to structure */
     18 	fdt32_t off_dt_strings;		 /* offset to strings */
     19 	fdt32_t off_mem_rsvmap;		 /* offset to memory reserve map */
     20 	fdt32_t version;		 /* format version */
     21 	fdt32_t last_comp_version;	 /* last compatible version */
     22 
     23 	/* version 2 fields below */
     24 	fdt32_t boot_cpuid_phys;	 /* Which physical CPU id we're
     25 					    booting on */
     26 	/* version 3 fields below */
     27 	fdt32_t size_dt_strings;	 /* size of the strings block */
     28 
     29 	/* version 17 fields below */
     30 	fdt32_t size_dt_struct;		 /* size of the structure block */
     31 };
     32 
     33 struct fdt_reserve_entry {
     34 	fdt64_t address;
     35 	fdt64_t size;
     36 };
     37 
     38 struct fdt_node_header {
     39 	fdt32_t tag;
     40 	char name[0];
     41 };
     42 
     43 struct fdt_property {
     44 	fdt32_t tag;
     45 	fdt32_t len;
     46 	fdt32_t nameoff;
     47 	char data[0];
     48 };
     49 
     50 #endif /* !__ASSEMBLY */
     51 
     52 #define FDT_MAGIC	0xd00dfeed	/* 4: version, 4: total size */
     53 #define FDT_TAGSIZE	sizeof(fdt32_t)
     54 
     55 #define FDT_BEGIN_NODE	0x1		/* Start node: full name */
     56 #define FDT_END_NODE	0x2		/* End node */
     57 #define FDT_PROP	0x3		/* Property: name off,
     58 					   size, content */
     59 #define FDT_NOP		0x4		/* nop */
     60 #define FDT_END		0x9
     61 
     62 #define FDT_V1_SIZE	(7*sizeof(fdt32_t))
     63 #define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(fdt32_t))
     64 #define FDT_V3_SIZE	(FDT_V2_SIZE + sizeof(fdt32_t))
     65 #define FDT_V16_SIZE	FDT_V3_SIZE
     66 #define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(fdt32_t))
     67 
     68 #endif /* FDT_H */
     69