summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-3.19/overlay-patches
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2014-12-15 17:24:06 -0600
committerMike Fiore <mfiore@multitech.com>2014-12-15 17:24:06 -0600
commitdf21d61b75407f35600b6108563b1674ca24ee3d (patch)
treee8f76b5023e60192ce2f29ce5eecb80bfbf19258 /recipes-kernel/linux/linux-3.19/overlay-patches
parentc11fab577a5abefb6cc9e5a3e9e8d931613936cd (diff)
downloadmeta-multitech-3.19-dt-overlay.tar.gz
meta-multitech-3.19-dt-overlay.tar.bz2
meta-multitech-3.19-dt-overlay.zip
changes for building 3.19 kernel with complete DT Overlay support3.19-dt-overlay
Diffstat (limited to 'recipes-kernel/linux/linux-3.19/overlay-patches')
-rwxr-xr-xrecipes-kernel/linux/linux-3.19/overlay-patches/configfs-Implement-binary-attributes-v3.patch780
-rwxr-xr-xrecipes-kernel/linux/linux-3.19/overlay-patches/dtc-dynamic-support.patch5167
-rwxr-xr-xrecipes-kernel/linux/linux-3.19/overlay-patches/v8-3-8-OF-DT-Overlay-configfs-interface-v2.patch374
3 files changed, 6321 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-3.19/overlay-patches/configfs-Implement-binary-attributes-v3.patch b/recipes-kernel/linux/linux-3.19/overlay-patches/configfs-Implement-binary-attributes-v3.patch
new file mode 100755
index 0000000..dacfa71
--- /dev/null
+++ b/recipes-kernel/linux/linux-3.19/overlay-patches/configfs-Implement-binary-attributes-v3.patch
@@ -0,0 +1,780 @@
+diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
+index b40fec9..eb4204c 100644
+--- a/Documentation/filesystems/configfs/configfs.txt
++++ b/Documentation/filesystems/configfs/configfs.txt
+@@ -51,15 +51,27 @@ configfs tree is always there, whether mounted on /config or not.
+ An item is created via mkdir(2). The item's attributes will also
+ appear at this time. readdir(3) can determine what the attributes are,
+ read(2) can query their default values, and write(2) can store new
+-values. Like sysfs, attributes should be ASCII text files, preferably
+-with only one value per file. The same efficiency caveats from sysfs
+-apply. Don't mix more than one attribute in one attribute file.
+-
+-Like sysfs, configfs expects write(2) to store the entire buffer at
+-once. When writing to configfs attributes, userspace processes should
+-first read the entire file, modify the portions they wish to change, and
+-then write the entire buffer back. Attribute files have a maximum size
+-of one page (PAGE_SIZE, 4096 on i386).
++values. Don't mix more than one attribute in one attribute file.
++
++There are two types of configfs attributes:
++
++* Normal attributes, which similar to sysfs attributes, are small ASCII text
++files, with a maximum size of one page (PAGE_SIZE, 4096 on i386). Preferably
++only one value per file should be used, and the same caveats from sysfs apply.
++Configfs expects write(2) to store the entire buffer at once. When writing to
++normal configfs attributes, userspace processes should first read the entire
++file, modify the portions they wish to change, and then write the entire
++buffer back.
++
++* Binary attributes, which are somewhat similar to sysfs binary attributes,
++but with a few slight changes to semantics. The PAGE_SIZE limitation does not
++apply, but the whole binary item must fit in single kernel vmalloc'ed buffer.
++The write(2) calls from user space are buffered, and the attributes'
++write_bin_attribute method will be invoked on the final close, therefore it is
++imperative for user-space to check the return code of close(2) in order to
++verify that the operation finished successfully.
++To avoid a malicious user OOMing the kernel, there's a per-binary attribute
++maximum buffer value.
+
+ When an item needs to be destroyed, remove it with rmdir(2). An
+ item cannot be destroyed if any other item has a link to it (via
+@@ -166,6 +178,12 @@ among other things. For that, it needs a type.
+ ssize_t (*store_attribute)(struct config_item *,
+ struct configfs_attribute *,
+ const char *, size_t);
++ ssize_t (*read_bin_attribute)(struct config_item *,
++ struct configfs_bin_attribute *,
++ void *, size_t);
++ ssize_t (*write_bin_attribute)(struct config_item *,
++ struct configfs_bin_attribute *,
++ const void *, size_t);
+ int (*allow_link)(struct config_item *src,
+ struct config_item *target);
+ int (*drop_link)(struct config_item *src,
+@@ -177,15 +195,18 @@ among other things. For that, it needs a type.
+ struct configfs_item_operations *ct_item_ops;
+ struct configfs_group_operations *ct_group_ops;
+ struct configfs_attribute **ct_attrs;
++ struct configfs_bin_attribute **ct_bin_attrs;
+ };
+
+ The most basic function of a config_item_type is to define what
+ operations can be performed on a config_item. All items that have been
+ allocated dynamically will need to provide the ct_item_ops->release()
+ method. This method is called when the config_item's reference count
+-reaches zero. Items that wish to display an attribute need to provide
+-the ct_item_ops->show_attribute() method. Similarly, storing a new
+-attribute value uses the store_attribute() method.
++reaches zero. Items that wish to display an normal attribute need to provide
++the ct_item_ops->show_attribute() method, while binary attributes provide the
++ct_item_ops->read_bin_attribute(). Similarly, storing a new normal attribute
++value uses the store_attribute() method, while the binarys' attribute equivalent
++is the ct_item_ops->write_bin_attribute() method.
+
+ [struct configfs_attribute]
+
+@@ -207,6 +228,32 @@ ct_item_ops->show_attribute() method, that method will be called
+ whenever userspace asks for a read(2) on the attribute. The converse
+ will happen for write(2).
+
++[struct configfs_bin_attribute]
++
++ struct configfs_attribute {
++ struct configfs_attribute cb_attr;
++ void *cb_private;
++ size_t cb_max_size;
++ };
++
++The binary attribute is used when the one needs to use binary blob to
++appear as the contents of a file in the item's configfs directory.
++To do so add the binary attribute to the NULL-terminated array
++config_item_type->ct_bin_attrs, and the item appears in configfs, the
++attribute file will appear with the configfs_bin_attribute->cb_attr.ca_name
++filename. configfs_bin_attribute->cb_attr.ca_mode specifies the file
++permissions.
++The cb_private member is provided for use by the driver, while the
++cb_max_size member specifies the maximum amount of vmalloc buffer
++to be used.
++
++If binary attribute is readable and the config_item provides a
++ct_item_ops->read_bin_attribute() method, that method will be called
++whenever userspace asks for a read(2) on the attribute. The converse
++will happen for write(2). The reads/writes are bufferred so only a
++single read/write will occur; the attributes' need not concern itself
++with it.
++
+ [struct config_group]
+
+ A config_item cannot live in a vacuum. The only way one can be created
+diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
+index bd4a3c1..b0517b3 100644
+--- a/fs/configfs/configfs_internal.h
++++ b/fs/configfs/configfs_internal.h
+@@ -53,13 +53,14 @@ struct configfs_dirent {
+ #define CONFIGFS_ROOT 0x0001
+ #define CONFIGFS_DIR 0x0002
+ #define CONFIGFS_ITEM_ATTR 0x0004
++#define CONFIGFS_ITEM_BIN_ATTR 0x0008
+ #define CONFIGFS_ITEM_LINK 0x0020
+ #define CONFIGFS_USET_DIR 0x0040
+ #define CONFIGFS_USET_DEFAULT 0x0080
+ #define CONFIGFS_USET_DROPPING 0x0100
+ #define CONFIGFS_USET_IN_MKDIR 0x0200
+ #define CONFIGFS_USET_CREATING 0x0400
+-#define CONFIGFS_NOT_PINNED (CONFIGFS_ITEM_ATTR)
++#define CONFIGFS_NOT_PINNED (CONFIGFS_ITEM_ATTR | CONFIGFS_ITEM_BIN_ATTR)
+
+ extern struct mutex configfs_symlink_mutex;
+ extern spinlock_t configfs_dirent_lock;
+@@ -74,11 +75,15 @@ extern int configfs_inode_init(void);
+ extern void configfs_inode_exit(void);
+
+ extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
++extern int configfs_create_bin_file(struct config_item *,
++ const struct configfs_bin_attribute *);
+ extern int configfs_make_dirent(struct configfs_dirent *,
+ struct dentry *, void *, umode_t, int);
+ extern int configfs_dirent_is_ready(struct configfs_dirent *);
+
+ extern int configfs_add_file(struct dentry *, const struct configfs_attribute *, int);
++extern int configfs_add_bin_file(struct dentry *,
++ const struct configfs_bin_attribute *, int);
+ extern void configfs_hash_and_remove(struct dentry * dir, const char * name);
+
+ extern const unsigned char * configfs_get_name(struct configfs_dirent *sd);
+@@ -91,7 +96,7 @@ extern void configfs_release_fs(void);
+ extern struct rw_semaphore configfs_rename_sem;
+ extern const struct file_operations configfs_dir_operations;
+ extern const struct file_operations configfs_file_operations;
+-extern const struct file_operations bin_fops;
++extern const struct file_operations configfs_bin_file_operations;
+ extern const struct inode_operations configfs_dir_inode_operations;
+ extern const struct inode_operations configfs_root_inode_operations;
+ extern const struct inode_operations configfs_symlink_inode_operations;
+@@ -122,6 +127,13 @@ static inline struct configfs_attribute * to_attr(struct dentry * dentry)
+ return ((struct configfs_attribute *) sd->s_element);
+ }
+
++static inline struct configfs_bin_attribute *to_bin_attr(struct dentry *dentry)
++{
++ struct configfs_attribute *attr = to_attr(dentry);
++
++ return container_of(attr, struct configfs_bin_attribute, cb_attr);
++}
++
+ static inline struct config_item *configfs_get_config_item(struct dentry *dentry)
+ {
+ struct config_item * item = NULL;
+diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
+index 668dcab..b086153 100644
+--- a/fs/configfs/dir.c
++++ b/fs/configfs/dir.c
+@@ -257,6 +257,13 @@ static int configfs_init_file(struct inode * inode)
+ return 0;
+ }
+
++static int configfs_init_bin_file(struct inode *inode)
++{
++ inode->i_size = 0;
++ inode->i_fop = &configfs_bin_file_operations;
++ return 0;
++}
++
+ static int init_symlink(struct inode * inode)
+ {
+ inode->i_op = &configfs_symlink_inode_operations;
+@@ -431,7 +438,9 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
+ spin_unlock(&configfs_dirent_lock);
+
+ error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG,
+- configfs_init_file);
++ (sd->s_type & CONFIGFS_ITEM_ATTR) ?
++ configfs_init_file :
++ configfs_init_bin_file);
+ if (error) {
+ configfs_put(sd);
+ return error;
+@@ -591,6 +600,7 @@ static int populate_attrs(struct config_item *item)
+ {
+ struct config_item_type *t = item->ci_type;
+ struct configfs_attribute *attr;
++ struct configfs_bin_attribute *bin_attr;
+ int error = 0;
+ int i;
+
+@@ -602,6 +612,13 @@ static int populate_attrs(struct config_item *item)
+ break;
+ }
+ }
++ if (t->ct_bin_attrs) {
++ for (i = 0; (bin_attr = t->ct_bin_attrs[i]) != NULL; i++) {
++ error = configfs_create_bin_file(item, bin_attr);
++ if (error)
++ break;
++ }
++ }
+
+ if (error)
+ detach_attrs(item);
+diff --git a/fs/configfs/file.c b/fs/configfs/file.c
+index 1d1c41f..8f49090 100644
+--- a/fs/configfs/file.c
++++ b/fs/configfs/file.c
+@@ -28,6 +28,7 @@
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/mutex.h>
++#include <linux/vmalloc.h>
+ #include <asm/uaccess.h>
+
+ #include <linux/configfs.h>
+@@ -48,6 +49,10 @@ struct configfs_buffer {
+ struct configfs_item_operations * ops;
+ struct mutex mutex;
+ int needs_read_fill;
++ int read_in_progress;
++ int write_in_progress;
++ char *bin_buffer;
++ int bin_buffer_size;
+ };
+
+
+@@ -107,8 +112,16 @@ static ssize_t
+ configfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
+ {
+ struct configfs_buffer * buffer = file->private_data;
++ struct configfs_dirent *sd;
+ ssize_t retval = 0;
+
++ sd = file->f_path.dentry->d_fsdata;
++ if (WARN_ON(sd == NULL))
++ return -EINVAL;
++
++ if (WARN_ON(!(sd->s_type & CONFIGFS_ITEM_ATTR)))
++ return -EINVAL;
++
+ mutex_lock(&buffer->mutex);
+ if (buffer->needs_read_fill) {
+ if ((retval = fill_read_buffer(file->f_path.dentry,buffer)))
+@@ -123,6 +136,97 @@ out:
+ return retval;
+ }
+
++/**
++ * configfs_read_bin_file - read a binary attribute.
++ * @file: file pointer.
++ * @buf: buffer to fill.
++ * @count: number of bytes to read.
++ * @ppos: starting offset in file.
++ *
++ * Userspace wants to read a binary attribute file. The attribute
++ * descriptor is in the file's ->d_fsdata. The target item is in the
++ * directory's ->d_fsdata.
++ *
++ * We check whether we need to refill the buffer. If so we will
++ * call the attributes' ops->read_bin_attribute() twice. The first time we
++ * will pass a NULL as a buffer pointer, which the attributes' method
++ * will use to return the size of the buffer required. If no error
++ * occurs we will allocate the buffer using vmalloc and call
++ * ops->read_bin_atribute() again passing that buffer as an argument.
++ * Then we just copy to user-space using simple_read_from_buffer.
++ */
++
++static ssize_t
++configfs_read_bin_file(struct file *file, char __user *buf,
++ size_t count, loff_t *ppos)
++{
++ struct configfs_buffer *buffer = file->private_data;
++ struct dentry *dentry = file->f_path.dentry;
++ struct configfs_dirent *sd = dentry->d_fsdata;
++ struct config_item *item = to_item(dentry->d_parent);
++ struct configfs_item_operations *ops = buffer->ops;
++ struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry);
++ ssize_t retval = 0;
++ ssize_t len = min_t(size_t, count, PAGE_SIZE);
++
++ if (WARN_ON(sd == NULL))
++ return -EINVAL;
++
++ if (WARN_ON(!(sd->s_type & CONFIGFS_ITEM_BIN_ATTR)))
++ return -EINVAL;
++
++ mutex_lock(&buffer->mutex);
++
++ /* we don't support switching read/write modes */
++ if (buffer->write_in_progress) {
++ retval = -EINVAL;
++ goto out;
++ }
++ buffer->read_in_progress = 1;
++
++ if (buffer->needs_read_fill) {
++
++ /* perform first read with buf == NULL to get extent */
++ len = ops->read_bin_attribute(item, bin_attr, NULL, 0);
++ if (len < 0) {
++ retval = len;
++ goto out;
++ }
++
++ /* do not exceed the maximum value */
++ if (bin_attr->cb_max_size && len > bin_attr->cb_max_size) {
++ retval = -EFBIG;
++ goto out;
++ }
++
++ buffer->bin_buffer = vmalloc(len);
++ if (buffer->bin_buffer == NULL) {
++ retval = -ENOMEM;
++ goto out;
++ }
++ buffer->bin_buffer_size = len;
++
++ /* perform second read to fill buffer */
++ len = ops->read_bin_attribute(item, bin_attr,
++ buffer->bin_buffer, len);
++ if (len < 0) {
++ retval = len;
++ vfree(buffer->bin_buffer);
++ buffer->bin_buffer_size = 0;
++ buffer->bin_buffer = NULL;
++ goto out;
++ }
++
++ buffer->needs_read_fill = 0;
++ }
++
++ retval = simple_read_from_buffer(buf, count, ppos, buffer->bin_buffer,
++ buffer->bin_buffer_size);
++out:
++ mutex_unlock(&buffer->mutex);
++ return retval;
++}
++
+
+ /**
+ * fill_write_buffer - copy buffer from userspace.
+@@ -197,9 +301,16 @@ flush_write_buffer(struct dentry * dentry, struct configfs_buffer * buffer, size
+ static ssize_t
+ configfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+ {
+- struct configfs_buffer * buffer = file->private_data;
++ struct configfs_buffer *buffer = file->private_data;
++ struct configfs_dirent *sd = file->f_path.dentry->d_fsdata;
+ ssize_t len;
+
++ if (WARN_ON(sd == NULL))
++ return -EINVAL;
++
++ if (WARN_ON(!(sd->s_type & CONFIGFS_ITEM_ATTR)))
++ return -EINVAL;
++
+ mutex_lock(&buffer->mutex);
+ len = fill_write_buffer(buffer, buf, count);
+ if (len > 0)
+@@ -210,10 +321,86 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
+ return len;
+ }
+
+-static int check_perm(struct inode * inode, struct file * file)
++/**
++ * configfs_write_bin_file - write a binary attribute.
++ * @file: file pointer
++ * @buf: data to write
++ * @count: number of bytes
++ * @ppos: starting offset
++ *
++ * Writing to a binary attribute file is similar to a normal read.
++ * We buffer the consecutive writes (binary attribute files do not
++ * support lseek) in a continuously growing buffer, but we don't
++ * commit until the close of the file.
++ */
++
++static ssize_t
++configfs_write_bin_file(struct file *file, const char __user *buf,
++ size_t count, loff_t *ppos)
++{
++ struct configfs_buffer *buffer = file->private_data;
++ struct dentry *dentry = file->f_path.dentry;
++ struct configfs_dirent *sd = dentry->d_fsdata;
++ struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry);
++ void *tbuf = NULL;
++ ssize_t len;
++
++ if (WARN_ON(sd == NULL))
++ return -EINVAL;
++
++ if (WARN_ON(!(sd->s_type & CONFIGFS_ITEM_BIN_ATTR)))
++ return -EINVAL;
++
++ mutex_lock(&buffer->mutex);
++
++ /* we don't support switching read/write modes */
++ if (buffer->read_in_progress) {
++ len = -EINVAL;
++ goto out;
++ }
++ buffer->write_in_progress = 1;
++
++ /* buffer grows? */
++ if (*ppos + count > buffer->bin_buffer_size) {
++
++ if (bin_attr->cb_max_size &&
++ *ppos + count > bin_attr->cb_max_size) {
++ len = -EFBIG;
++ }
++
++ tbuf = vmalloc(*ppos + count);
++ if (tbuf == NULL) {
++ len = -ENOMEM;
++ goto out;
++ }
++
++ /* copy old contents */
++ if (buffer->bin_buffer) {
++ memcpy(tbuf, buffer->bin_buffer,
++ buffer->bin_buffer_size);
++ vfree(buffer->bin_buffer);
++ }
++
++ /* clear the new area */
++ memset(tbuf + buffer->bin_buffer_size, 0,
++ *ppos + count - buffer->bin_buffer_size);
++ buffer->bin_buffer = tbuf;
++ buffer->bin_buffer_size = *ppos + count;
++ }
++
++ len = simple_write_to_buffer(buffer->bin_buffer,
++ buffer->bin_buffer_size, ppos, buf, count);
++ if (len > 0)
++ *ppos += len;
++out:
++ mutex_unlock(&buffer->mutex);
++ return len;
++}
++
++static int check_perm(struct inode *inode, struct file *file,
++ struct config_item *item, struct configfs_attribute *attr,
++ int type)
+ {
+- struct config_item *item = configfs_get_config_item(file->f_path.dentry->d_parent);
+- struct configfs_attribute * attr = to_attr(file->f_path.dentry);
+ struct configfs_buffer * buffer;
+ struct configfs_item_operations * ops = NULL;
+ int error = 0;
+@@ -238,9 +425,16 @@ static int check_perm(struct inode * inode, struct file * file)
+ */
+ if (file->f_mode & FMODE_WRITE) {
+
+- if (!(inode->i_mode & S_IWUGO) || !ops->store_attribute)
++ if (!(inode->i_mode & S_IWUGO))
++ goto Eaccess;
++
++ if ((type & CONFIGFS_ITEM_ATTR) &&
++ !ops->store_attribute)
+ goto Eaccess;
+
++ if ((type & CONFIGFS_ITEM_BIN_ATTR) &&
++ !ops->write_bin_attribute)
++ goto Eaccess;
+ }
+
+ /* File needs read support.
+@@ -248,7 +442,13 @@ static int check_perm(struct inode * inode, struct file * file)
+ * must be a show method for it.
+ */
+ if (file->f_mode & FMODE_READ) {
+- if (!(inode->i_mode & S_IRUGO) || !ops->show_attribute)
++ if (!(inode->i_mode & S_IRUGO))
++ goto Eaccess;
++
++ if ((type & CONFIGFS_ITEM_ATTR) && !ops->show_attribute)
++ goto Eaccess;
++
++ if ((type & CONFIGFS_ITEM_BIN_ATTR) && !ops->read_bin_attribute)
+ goto Eaccess;
+ }
+
+@@ -262,6 +462,8 @@ static int check_perm(struct inode * inode, struct file * file)
+ }
+ mutex_init(&buffer->mutex);
+ buffer->needs_read_fill = 1;
++ buffer->read_in_progress = 0;
++ buffer->write_in_progress = 0;
+ buffer->ops = ops;
+ file->private_data = buffer;
+ goto Done;
+@@ -279,17 +481,12 @@ static int check_perm(struct inode * inode, struct file * file)
+ return error;
+ }
+
+-static int configfs_open_file(struct inode * inode, struct file * filp)
+-{
+- return check_perm(inode,filp);
+-}
+-
+-static int configfs_release(struct inode * inode, struct file * filp)
++static int do_release(struct inode *inode, struct file *filp,
++ struct config_item *item, struct configfs_attribute *attr,
++ int type)
+ {
+- struct config_item * item = to_item(filp->f_path.dentry->d_parent);
+- struct configfs_attribute * attr = to_attr(filp->f_path.dentry);
+- struct module * owner = attr->ca_owner;
+- struct configfs_buffer * buffer = filp->private_data;
++ struct module *owner = attr->ca_owner;
++ struct configfs_buffer *buffer = filp->private_data;
+
+ if (item)
+ config_item_put(item);
+@@ -305,14 +502,87 @@ static int configfs_release(struct inode * inode, struct file * filp)
+ return 0;
+ }
+
++static int configfs_open_file(struct inode *inode, struct file *filp)
++{
++ return check_perm(inode, filp,
++ configfs_get_config_item(filp->f_path.dentry->d_parent),
++ to_attr(filp->f_path.dentry), CONFIGFS_ITEM_ATTR);
++}
++
++static int configfs_release_file(struct inode *inode, struct file *filp)
++{
++ return do_release(inode, filp,
++ to_item(filp->f_path.dentry->d_parent),
++ to_attr(filp->f_path.dentry), CONFIGFS_ITEM_ATTR);
++}
++
++static int configfs_open_bin_file(struct inode *inode, struct file *filp)
++{
++ return check_perm(inode, filp,
++ configfs_get_config_item(filp->f_path.dentry->d_parent),
++ to_attr(filp->f_path.dentry), CONFIGFS_ITEM_BIN_ATTR);
++}
++
++/**
++ * configfs_release_bin_file - write a binary attribute.
++ * @inode: inode pointer
++ * @filp: file pointer
++ *
++ * Releasing a binary attribute file is similar for a read op
++ * to the normal attribute file. When writing we call the
++ * attributes' ops->write_bin_attribute() method to commit the
++ * changes to the attribute.
++ */
++
++static int configfs_release_bin_file(struct inode *inode, struct file *filp)
++{
++ struct configfs_buffer *buffer = filp->private_data;
++ struct dentry *dentry = filp->f_path.dentry;
++ struct config_item *item = to_item(dentry->d_parent);
++ struct configfs_item_operations *ops = buffer->ops;
++ struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry);
++ ssize_t len = 0;
++ int ret;
++
++ buffer->read_in_progress = 0;
++
++ if (buffer->write_in_progress) {
++ buffer->write_in_progress = 0;
++
++ len = ops->write_bin_attribute(item, bin_attr,
++ buffer->bin_buffer, buffer->bin_buffer_size);
++
++ /* vfree on NULL is safe */
++ vfree(buffer->bin_buffer);
++ buffer->bin_buffer = NULL;
++ buffer->bin_buffer_size = 0;
++ buffer->needs_read_fill = 1;
++ }
++
++ ret = do_release(inode, filp,
++ to_item(filp->f_path.dentry->d_parent),
++ to_attr(filp->f_path.dentry), CONFIGFS_ITEM_BIN_ATTR);
++ if (len < 0)
++ return len;
++ return ret;
++}
++
++
+ const struct file_operations configfs_file_operations = {
+ .read = configfs_read_file,
+ .write = configfs_write_file,
+ .llseek = generic_file_llseek,
+ .open = configfs_open_file,
+- .release = configfs_release,
++ .release = configfs_release_file,
+ };
+
++const struct file_operations configfs_bin_file_operations = {
++ .read = configfs_read_bin_file,
++ .write = configfs_write_bin_file,
++ .llseek = NULL, /* bin file is not seekable */
++ .open = configfs_open_bin_file,
++ .release = configfs_release_bin_file,
++};
+
+ int configfs_add_file(struct dentry * dir, const struct configfs_attribute * attr, int type)
+ {
+@@ -342,3 +612,17 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib
+ CONFIGFS_ITEM_ATTR);
+ }
+
++/**
++ * configfs_create_bin_file - create a binary attribute file for an item.
++ * @item: item we're creating for.
++ * @attr: atrribute descriptor.
++ */
++
++int configfs_create_bin_file(struct config_item *item,
++ const struct configfs_bin_attribute *bin_attr)
++{
++ BUG_ON(!item || !item->ci_dentry || !bin_attr);
++
++ return configfs_add_file(item->ci_dentry, &bin_attr->cb_attr,
++ CONFIGFS_ITEM_BIN_ATTR);
++}
+diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
+index 5946ad9..dd9c24b 100644
+--- a/fs/configfs/inode.c
++++ b/fs/configfs/inode.c
+@@ -231,7 +231,7 @@ const unsigned char * configfs_get_name(struct configfs_dirent *sd)
+ if (sd->s_type & (CONFIGFS_DIR | CONFIGFS_ITEM_LINK))
+ return sd->s_dentry->d_name.name;
+
+- if (sd->s_type & CONFIGFS_ITEM_ATTR) {
++ if (sd->s_type & (CONFIGFS_ITEM_ATTR | CONFIGFS_ITEM_BIN_ATTR)) {
+ attr = sd->s_element;
+ return attr->ca_name;
+ }
+diff --git a/include/linux/configfs.h b/include/linux/configfs.h
+index 34025df..2e416b4 100644
+--- a/include/linux/configfs.h
++++ b/include/linux/configfs.h
+@@ -51,6 +51,7 @@ struct module;
+ struct configfs_item_operations;
+ struct configfs_group_operations;
+ struct configfs_attribute;
++struct configfs_bin_attribute;
+ struct configfs_subsystem;
+
+ struct config_item {
+@@ -84,6 +85,7 @@ struct config_item_type {
+ struct configfs_item_operations *ct_item_ops;
+ struct configfs_group_operations *ct_group_ops;
+ struct configfs_attribute **ct_attrs;
++ struct configfs_bin_attribute **ct_bin_attrs;
+ };
+
+ /**
+@@ -207,6 +209,96 @@ static ssize_t _item##_attr_store(struct config_item *item, \
+ return ret; \
+ }
+
++struct file;
++struct vm_area_struct;
++
++struct configfs_bin_attribute {
++ struct configfs_attribute cb_attr; /* std. attribute */
++ void *cb_private; /* for user */
++ size_t cb_max_size; /* max core size */
++};
++
++/*
++ * Similar to CONFIGFS_ATTR_STRUCT
++ */
++#define CONFIGFS_BIN_ATTR_STRUCT(_item) \
++struct _item##_bin_attribute { \
++ struct configfs_bin_attribute bin_attr; \
++ ssize_t (*read)(struct _item *, void *, size_t); \
++ ssize_t (*write)(struct _item *, const void *, size_t); \
++}
++
++/* macros to create static binary attributes easier */
++#define __CONFIGFS_BIN_ATTR(_name, _mode, _read, _write, _priv, _max) \
++{ \
++ .bin_attr = { \
++ .cb_attr = { \
++ .ca_name = __stringify(_name), \
++ .ca_mode = _mode, \
++ .ca_owner = THIS_MODULE, \
++ }, \
++ .cb_private = _priv, \
++ .cb_max_size = _max, \
++ }, \
++ .read = _read, \
++ .write = _write, \
++}
++
++#define __CONFIGFS_BIN_ATTR_RO(_name, _priv, _max) { \
++ .bin_attr = { \
++ .cb_attr = { \
++ .ca_name = __stringify(_name), \
++ .ca_mode = _mode, \
++ .ca_owner = THIS_MODULE, \
++ }, \
++ .cb_private = _priv, \
++ .cb_max_size = _max, \
++ }, \
++ .read = _read, \
++}
++
++#define __CONFIGFS_BIN_ATTR_RW(_name) \
++ __CONFIGFS_BIN_ATTR(_name, (S_IWUSR | S_IRUGO), \
++ _name##_read, _name##_write)
++
++#define CONFIGFS_BIN_ATTR(_name, _mode, _read, _write) \
++struct configfs_bin_attribute bin_attr_##_name = \
++ __CONFIGFS_BIN_ATTR(_name, _mode, _read, _write)
++
++#define CONFIGFS_BIN_ATTR_RO(_name) \
++struct configfs_bin_attribute bin_attr_##_name = \
++ __CONFIGFS_BIN_ATTR_RO(_name)
++
++#define CONFIGFS_BIN_ATTR_OPS(_item) \
++static ssize_t _item##_bin_attr_read(struct config_item *item, \
++ struct configfs_bin_attribute *bin_attr, \
++ void *buf, size_t max_count) \
++{ \
++ struct _item *_item = to_##_item(item); \
++ struct _item##_bin_attribute *_item##_bin_attr = \
++ container_of(bin_attr, struct _item##_bin_attribute, \
++ bin_attr); \
++ ssize_t ret = 0; \
++ \
++ if (_item##_bin_attr->read) \
++ ret = _item##_bin_attr->read(_item, buf, max_count); \
++ return ret; \
++} \
++static ssize_t _item##_bin_attr_write(struct config_item *item, \
++ struct configfs_bin_attribute *bin_attr, \
++ const void *buf, size_t count) \
++{ \
++ struct _item *_item = to_##_item(item); \
++ struct _item##_bin_attribute *_item##_bin_attr = \
++ container_of(bin_attr, struct _item##_bin_attribute, \
++ bin_attr); \
++ ssize_t ret = -EINVAL; \
++ \
++ if (_item##_bin_attr->write) \
++ ret = _item##_bin_attr->write(_item, buf, count); \
++ return ret; \
++}
++
+ /*
+ * If allow_link() exists, the item can symlink(2) out to other
+ * items. If the item is a group, it may support mkdir(2).
+@@ -225,6 +317,12 @@ struct configfs_item_operations {
+ void (*release)(struct config_item *);
+ ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *);
+ ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t);
++ ssize_t (*read_bin_attribute)(struct config_item *,
++ struct configfs_bin_attribute *,
++ void *, size_t);
++ ssize_t (*write_bin_attribute)(struct config_item *,
++ struct configfs_bin_attribute *,
++ const void *, size_t);
+ int (*allow_link)(struct config_item *src, struct config_item *target);
+ int (*drop_link)(struct config_item *src, struct config_item *target);
+ };
diff --git a/recipes-kernel/linux/linux-3.19/overlay-patches/dtc-dynamic-support.patch b/recipes-kernel/linux/linux-3.19/overlay-patches/dtc-dynamic-support.patch
new file mode 100755
index 0000000..730add5
--- /dev/null
+++ b/recipes-kernel/linux/linux-3.19/overlay-patches/dtc-dynamic-support.patch
@@ -0,0 +1,5167 @@
+diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
+index ee96a25..59d46bc 100644
+--- a/scripts/dtc/checks.c
++++ b/scripts/dtc/checks.c
+@@ -53,7 +53,7 @@ struct check {
+ void *data;
+ bool warn, error;
+ enum checkstatus status;
+- int inprogress;
++ bool inprogress;
+ int num_prereqs;
+ struct check **prereq;
+ };
+@@ -141,9 +141,9 @@ static void check_nodes_props(struct check *c, struct node *dt, struct node *nod
+ check_nodes_props(c, dt, child);
+ }
+
+-static int run_check(struct check *c, struct node *dt)
++static bool run_check(struct check *c, struct node *dt)
+ {
+- int error = 0;
++ bool error = false;
+ int i;
+
+ assert(!c->inprogress);
+@@ -151,11 +151,11 @@ static int run_check(struct check *c, struct node *dt)
+ if (c->status != UNCHECKED)
+ goto out;
+
+- c->inprogress = 1;
++ c->inprogress = true;
+
+ for (i = 0; i < c->num_prereqs; i++) {
+ struct check *prq = c->prereq[i];
+- error |= run_check(prq, dt);
++ error = error || run_check(prq, dt);
+ if (prq->status != PASSED) {
+ c->status = PREREQ;
+ check_msg(c, "Failed prerequisite '%s'",
+@@ -177,9 +177,9 @@ static int run_check(struct check *c, struct node *dt)
+ TRACE(c, "\tCompleted, status %d", c->status);
+
+ out:
+- c->inprogress = 0;
++ c->inprogress = false;
+ if ((c->status != PASSED) && (c->error))
+- error = 1;
++ error = true;
+ return error;
+ }
+
+@@ -457,6 +457,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
+ struct node *node, struct property *prop)
+ {
+ struct marker *m = prop->val.markers;
++ struct fixup *f, **fp;
++ struct fixup_entry *fe, **fep;
+ struct node *refnode;
+ cell_t phandle;
+
+@@ -465,14 +467,73 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
+
+ refnode = get_node_by_ref(dt, m->ref);
+ if (! refnode) {
+- FAIL(c, "Reference to non-existent node or label \"%s\"\n",
+- m->ref);
++ if (!dt->is_plugin) {
++ FAIL(c, "Reference to non-existent node or label \"%s\"\n",
++ m->ref);
++ continue;
++ }
++
++ /* allocate fixup entry */
++ fe = xmalloc(sizeof(*fe));
++
++ fe->node = node;
++ fe->prop = prop;
++ fe->offset = m->offset;
++ fe->next = NULL;
++
++ /* search for an already existing fixup */
++ for_each_fixup(dt, f)
++ if (strcmp(f->ref, m->ref) == 0)
++ break;
++
++ /* no fixup found, add new */
++ if (f == NULL) {
++ f = xmalloc(sizeof(*f));
++ f->ref = m->ref;
++ f->entries = NULL;
++ f->next = NULL;
++
++ /* add it to the tree */
++ fp = &dt->fixups;
++ while (*fp)
++ fp = &(*fp)->next;
++ *fp = f;
++ }
++
++ /* and now append fixup entry */
++ fep = &f->entries;
++ while (*fep)
++ fep = &(*fep)->next;
++ *fep = fe;
++
++ /* mark the entry as unresolved */
++ *((cell_t *)(prop->val.val + m->offset)) =
++ cpu_to_fdt32(0xdeadbeef);
+ continue;
+ }
+
++ /* if it's a local reference, we need to record it */
++ if (symbol_fixup_support) {
++
++ /* allocate a new local fixup entry */
++ fe = xmalloc(sizeof(*fe));
++
++ fe->node = node;
++ fe->prop = prop;
++ fe->offset = m->offset;
++ fe->next = NULL;
++
++ /* append it to the local fixups */
++ fep = &dt->local_fixups;
++ while (*fep)
++ fep = &(*fep)->next;
++ *fep = fe;
++ }
++
+ phandle = get_node_phandle(dt, refnode);
+ *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
+ }
++
+ }
+ ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
+ &duplicate_node_names, &explicit_phandles);
+@@ -651,6 +712,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
+ }
+ TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
+
++static void check_auto_label_phandles(struct check *c, struct node *dt,
++ struct node *node)
++{
++ struct label *l;
++ struct symbol *s, **sp;
++ int has_label;
++
++ if (!symbol_fixup_support)
++ return;
++
++ has_label = 0;
++ for_each_label(node->labels, l) {
++ has_label = 1;
++ break;
++ }
++
++ if (!has_label)
++ return;
++
++ /* force allocation of a phandle for this node */
++ (void)get_node_phandle(dt, node);
++
++ /* add the symbol */
++ for_each_label(node->labels, l) {
++
++ s = xmalloc(sizeof(*s));
++ s->label = l;
++ s->node = node;
++ s->next = NULL;
++
++ /* add it to the symbols list */
++ sp = &dt->symbols;
++ while (*sp)
++ sp = &((*sp)->next);
++ *sp = s;
++ }
++}
++NODE_WARNING(auto_label_phandles, NULL);
++
+ static struct check *check_table[] = {
+ &duplicate_node_names, &duplicate_property_names,
+ &node_name_chars, &node_name_format, &property_name_chars,
+@@ -669,6 +769,8 @@ static struct check *check_table[] = {
+ &avoid_default_addr_size,
+ &obsolete_chosen_interrupt_controller,
+
++ &auto_label_phandles,
++
+ &always_fail,
+ };
+
+@@ -706,15 +808,15 @@ static void disable_warning_error(struct check *c, bool warn, bool error)
+ c->error = c->error && !error;
+ }
+
+-void parse_checks_option(bool warn, bool error, const char *optarg)
++void parse_checks_option(bool warn, bool error, const char *arg)
+ {
+ int i;
+- const char *name = optarg;
++ const char *name = arg;
+ bool enable = true;
+
+- if ((strncmp(optarg, "no-", 3) == 0)
+- || (strncmp(optarg, "no_", 3) == 0)) {
+- name = optarg + 3;
++ if ((strncmp(arg, "no-", 3) == 0)
++ || (strncmp(arg, "no_", 3) == 0)) {
++ name = arg + 3;
+ enable = false;
+ }
+
+@@ -733,7 +835,7 @@ void parse_checks_option(bool warn, bool error, const char *optarg)
+ die("Unrecognized check name \"%s\"\n", name);
+ }
+
+-void process_checks(int force, struct boot_info *bi)
++void process_checks(bool force, struct boot_info *bi)
+ {
+ struct node *dt = bi->dt;
+ int i;
+diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c
+index 4a40c5b..8cae237 100644
+--- a/scripts/dtc/data.c
++++ b/scripts/dtc/data.c
+@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
+ struct data d;
+ char *q;
+
+- d = data_grow_for(empty_data, strlen(s)+1);
++ d = data_grow_for(empty_data, len + 1);
+
+ q = d.val;
+ while (i < len) {
+@@ -250,20 +250,20 @@ struct data data_add_marker(struct data d, enum markertype type, char *ref)
+ return data_append_markers(d, m);
+ }
+
+-int data_is_one_string(struct data d)
++bool data_is_one_string(struct data d)
+ {
+ int i;
+ int len = d.len;
+
+ if (len == 0)
+- return 0;
++ return false;
+
+ for (i = 0; i < len-1; i++)
+ if (d.val[i] == '\0')
+- return 0;
++ return false;
+
+ if (d.val[len-1] != '\0')
+- return 0;
++ return false;
+
+- return 1;
++ return true;
+ }
+diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
+index 3b41bfc..dd44ba2 100644
+--- a/scripts/dtc/dtc-lexer.l
++++ b/scripts/dtc/dtc-lexer.l
+@@ -20,7 +20,6 @@
+
+ %option noyywrap nounput noinput never-interactive
+
+-%x INCLUDE
+ %x BYTESTRING
+ %x PROPNODENAME
+ %s V1
+@@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
+ #include "dtc-parser.tab.h"
+
+ YYLTYPE yylloc;
++extern bool treesource_error;
+
+ /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
+ #define YY_USER_ACTION \
+@@ -61,7 +61,8 @@ static int dts_version = 1;
+ BEGIN(V1); \
+
+ static void push_input_file(const char *filename);
+-static int pop_input_file(void);
++static bool pop_input_file(void);
++static void lexical_error(const char *fmt, ...);
+ %}
+
+ %%
+@@ -75,11 +76,11 @@ static int pop_input_file(void);
+ char *line, *tmp, *fn;
+ /* skip text before line # */
+ line = yytext;
+- while (!isdigit(*line))
++ while (!isdigit((unsigned char)*line))
+ line++;
+ /* skip digits in line # */
+ tmp = line;
+- while (!isspace(*tmp))
++ while (!isspace((unsigned char)*tmp))
+ tmp++;
+ /* "NULL"-terminate line # */
+ *tmp = '\0';
+@@ -112,6 +113,11 @@ static int pop_input_file(void);
+ return DT_V1;
+ }
+
++<*>"/plugin/" {
++ DPRINT("Keyword: /plugin/\n");
++ return DT_PLUGIN;
++ }
++
+ <*>"/memreserve/" {
+ DPRINT("Keyword: /memreserve/\n");
+ BEGIN_DEFAULT();
+@@ -146,15 +152,42 @@ static int pop_input_file(void);
+ }
+
+ <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
+- yylval.literal = xstrdup(yytext);
+- DPRINT("Literal: '%s'\n", yylval.literal);
++ char *e;
++ DPRINT("Integer Literal: '%s'\n", yytext);
++
++ errno = 0;
++ yylval.integer = strtoull(yytext, &e, 0);
++
++ assert(!(*e) || !e[strspn(e, "UL")]);
++
++ if (errno == ERANGE)
++ lexical_error("Integer literal '%s' out of range",
++ yytext);
++ else
++ /* ERANGE is the only strtoull error triggerable
++ * by strings matching the pattern */
++ assert(errno == 0);
+ return DT_LITERAL;
+ }
+
+ <*>{CHAR_LITERAL} {
+- yytext[yyleng-1] = '\0';
+- yylval.literal = xstrdup(yytext+1);
+- DPRINT("Character literal: %s\n", yylval.literal);
++ struct data d;
++ DPRINT("Character literal: %s\n", yytext);
++
++ d = data_copy_escape_string(yytext+1, yyleng-2);
++ if (d.len == 1) {
++ lexical_error("Empty character literal");
++ yylval.integer = 0;
++ return DT_CHAR_LITERAL;
++ }
++
++ yylval.integer = (unsigned char)d.val[0];
++
++ if (d.len > 2)
++ lexical_error("Character literal has %d"
++ " characters instead of 1",
++ d.len - 1);
++
+ return DT_CHAR_LITERAL;
+ }
+
+@@ -164,7 +197,7 @@ static int pop_input_file(void);
+ return DT_REF;
+ }
+
+-<*>"&{/"{PATHCHAR}+\} { /* new-style path reference */
++<*>"&{/"{PATHCHAR}*\} { /* new-style path reference */
+ yytext[yyleng-1] = '\0';
+ DPRINT("Ref: %s\n", yytext+2);
+ yylval.labelref = xstrdup(yytext+2);
+@@ -238,13 +271,24 @@ static void push_input_file(const char *filename)
+ }
+
+
+-static int pop_input_file(void)
++static bool pop_input_file(void)
+ {
+ if (srcfile_pop() == 0)
+- return 0;
++ return false;
+
+ yypop_buffer_state();
+ yyin = current_srcfile->f;
+
+- return 1;
++ return true;
++}
++
++static void lexical_error(const char *fmt, ...)
++{
++ va_list ap;
++
++ va_start(ap, fmt);
++ srcpos_verror(&yylloc, "Lexical error", fmt, ap);
++ va_end(ap);
++
++ treesource_error = true;
+ }
+diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
+index 2d30f41..1518525 100644
+--- a/scripts/dtc/dtc-lexer.lex.c_shipped
++++ b/scripts/dtc/dtc-lexer.lex.c_shipped
+@@ -372,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] );
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+-#define YY_NUM_RULES 30
+-#define YY_END_OF_BUFFER 31
++#define YY_NUM_RULES 31
++#define YY_END_OF_BUFFER 32
+ /* This struct is not used in this scanner,
+ but its presence is necessary. */
+ struct yy_trans_info
+@@ -381,25 +381,26 @@ struct yy_trans_info
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+-static yyconst flex_int16_t yy_accept[161] =
++static yyconst flex_int16_t yy_accept[166] =
+ { 0,
++ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
++ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
++ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
++ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
++ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
++ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
++ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
++ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
++ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
++
++ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
++ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+- 31, 29, 18, 18, 29, 29, 29, 29, 29, 29,
+- 29, 29, 29, 29, 29, 29, 29, 29, 15, 16,
+- 16, 29, 16, 10, 10, 18, 26, 0, 3, 0,
+- 27, 12, 0, 0, 11, 0, 0, 0, 0, 0,
+- 0, 0, 21, 23, 25, 24, 22, 0, 9, 28,
+- 0, 0, 0, 14, 14, 16, 16, 16, 10, 10,
+- 10, 0, 12, 0, 11, 0, 0, 0, 20, 0,
+- 0, 0, 0, 0, 0, 0, 0, 16, 10, 10,
+- 10, 0, 19, 0, 0, 0, 0, 0, 0, 0,
+-
+- 0, 0, 16, 13, 0, 0, 0, 0, 0, 0,
+- 0, 0, 0, 16, 6, 0, 0, 0, 0, 0,
+- 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+- 4, 17, 0, 0, 2, 0, 0, 0, 0, 0,
+- 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+- 0, 0, 5, 8, 0, 0, 0, 0, 7, 0
++ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
++ 0, 0, 0, 8, 0
+ } ;
+
+ static yyconst flex_int32_t yy_ec[256] =
+@@ -415,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] =
+ 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
+ 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
+
+- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
+- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
+- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
++ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
++ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
++ 44, 22, 45, 46, 47, 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,
+@@ -434,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] =
+ 1, 1, 1, 1, 1
+ } ;
+
+-static yyconst flex_int32_t yy_meta[47] =
++static yyconst flex_int32_t yy_meta[48] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
+ 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
+ 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
+ 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+- 8, 8, 8, 3, 1, 1
++ 8, 8, 8, 8, 3, 1, 4
+ } ;
+
+-static yyconst flex_int16_t yy_base[175] =
++static yyconst flex_int16_t yy_base[180] =
+ { 0,
+- 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
+- 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
+- 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
+- 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
+- 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
+- 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
+- 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
+- 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
+- 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
+- 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
+-
+- 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
+- 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
+- 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
+- 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
+- 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
+- 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
+- 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
+- 304, 310, 318, 326
++ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
++ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
++ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
++ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
++ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
++ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
++ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
++ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
++ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
++ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
++
++ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
++ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
++ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
++ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
++ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
++ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
++ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
++ 281, 288, 292, 300, 308, 312, 318, 326, 334
+ } ;
+
+-static yyconst flex_int16_t yy_def[175] =
++static yyconst flex_int16_t yy_def[180] =
+ { 0,
+- 160, 1, 1, 1, 1, 5, 160, 7, 1, 1,
+- 160, 160, 160, 160, 160, 161, 162, 163, 160, 160,
+- 160, 160, 164, 160, 160, 160, 165, 164, 160, 166,
+- 167, 166, 166, 160, 160, 160, 160, 161, 160, 161,
+- 160, 168, 160, 163, 160, 163, 169, 170, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 164, 160, 160,
+- 160, 160, 160, 160, 164, 166, 167, 166, 160, 160,
+- 160, 171, 168, 172, 163, 169, 169, 170, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 166, 160, 160,
+- 171, 172, 160, 160, 160, 160, 160, 160, 160, 160,
+-
+- 160, 160, 166, 160, 160, 160, 160, 160, 160, 160,
+- 160, 173, 160, 166, 160, 160, 160, 160, 160, 160,
+- 173, 160, 173, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 174, 160, 160, 160, 174, 160, 174, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160
++ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
++ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
++ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
++ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
++ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
++ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
++ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
++ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
++
++ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
++ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
++ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
++ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165
+ } ;
+
+-static yyconst flex_int16_t yy_nxt[440] =
++static yyconst flex_int16_t yy_nxt[449] =
+ { 0,
+- 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
+- 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
+- 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
+- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+- 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
+- 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
+- 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
+- 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
+- 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
+- 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
+-
+- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+- 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
+- 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
+- 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
+- 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
+- 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
+- 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
+- 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
+- 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
+- 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
+-
+- 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
+- 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
+- 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
+- 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
+- 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
+- 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
+- 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
+- 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
+- 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
+- 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
+-
+- 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
+- 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
+- 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
+- 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
+- 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
+- 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
+- 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
+- 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
+- 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
+- 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
+-
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160
++ 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
++ 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
++ 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
++ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
++ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
++ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
++ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
++ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
++ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
++ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
++
++ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
++ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
++ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
++ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
++ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
++ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
++ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
++ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
++ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
++ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
++
++ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
++ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
++ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
++ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
++ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
++ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
++ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
++ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
++ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
++ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
++
++ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
++ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
++ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
++ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
++ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
++ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
++ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
++ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
++ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
++ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
++
++ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165
+ } ;
+
+-static yyconst flex_int16_t yy_chk[440] =
++static yyconst flex_int16_t yy_chk[449] =
+ { 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, 1, 1, 1, 1, 1,
+- 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
+- 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
+- 50, 5, 13, 13, 13, 20, 20, 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, 7, 7, 7, 7,
+- 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
+- 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
+- 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
+- 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
+- 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
+- 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
+- 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
+- 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
+- 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
+-
+- 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
+- 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
+- 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
+- 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
+- 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
+- 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
+- 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
+- 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
+- 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
+- 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
+-
+- 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
+- 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
+- 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
+- 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
+- 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
+- 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
+- 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
+- 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
+- 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
+- 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
+-
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+- 160, 160, 160, 160, 160, 160, 160, 160, 160
++ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
++ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
++ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
++ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
++ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
++ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
++
++ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
++ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
++ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
++ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
++ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
++ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
++ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
++ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
++ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
++ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
++
++ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
++ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
++ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
++ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
++ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
++ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
++ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
++ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
++ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
++ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
++
++ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
++ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
++ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
++ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
++ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
++ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
++ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
++ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
++ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
++ 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
++
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
++ 165, 165, 165, 165, 165, 165, 165, 165
+ } ;
+
+ static yy_state_type yy_last_accepting_state;
+@@ -631,13 +634,13 @@ char *yytext;
+
+
+
+-
+-#line 38 "dtc-lexer.l"
++#line 37 "dtc-lexer.l"
+ #include "dtc.h"
+ #include "srcpos.h"
+ #include "dtc-parser.tab.h"
+
+ YYLTYPE yylloc;
++extern bool treesource_error;
+
+ /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
+ #define YY_USER_ACTION \
+@@ -659,14 +662,14 @@ static int dts_version = 1;
+ BEGIN(V1); \
+
+ static void push_input_file(const char *filename);
+-static int pop_input_file(void);
+-#line 664 "dtc-lexer.lex.c"
++static bool pop_input_file(void);
++static void lexical_error(const char *fmt, ...);
++#line 668 "dtc-lexer.lex.c"
+
+ #define INITIAL 0
+-#define INCLUDE 1
+-#define BYTESTRING 2
+-#define PROPNODENAME 3
+-#define V1 4
++#define BYTESTRING 1
++#define PROPNODENAME 2
++#define V1 3
+
+ #ifndef YY_NO_UNISTD_H
+ /* Special case for "unistd.h", since it is non-ANSI. We include it way
+@@ -852,9 +855,9 @@ YY_DECL
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+-#line 67 "dtc-lexer.l"
++#line 68 "dtc-lexer.l"
+
+-#line 858 "dtc-lexer.lex.c"
++#line 861 "dtc-lexer.lex.c"
+
+ if ( !(yy_init) )
+ {
+@@ -908,13 +911,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 >= 161 )
++ if ( yy_current_state >= 166 )
+ 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_current_state != 160 );
++ while ( yy_current_state != 165 );
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+
+@@ -937,7 +940,7 @@ do_action: /* This label is used only to access EOF actions. */
+ case 1:
+ /* rule 1 can match eol */
+ YY_RULE_SETUP
+-#line 68 "dtc-lexer.l"
++#line 69 "dtc-lexer.l"
+ {
+ char *name = strchr(yytext, '\"') + 1;
+ yytext[yyleng-1] = '\0';
+@@ -947,16 +950,16 @@ YY_RULE_SETUP
+ case 2:
+ /* rule 2 can match eol */
+ YY_RULE_SETUP
+-#line 74 "dtc-lexer.l"
++#line 75 "dtc-lexer.l"
+ {
+ char *line, *tmp, *fn;
+ /* skip text before line # */
+ line = yytext;
+- while (!isdigit(*line))
++ while (!isdigit((unsigned char)*line))
+ line++;
+ /* skip digits in line # */
+ tmp = line;
+- while (!isspace(*tmp))
++ while (!isspace((unsigned char)*tmp))
+ tmp++;
+ /* "NULL"-terminate line # */
+ *tmp = '\0';
+@@ -970,11 +973,10 @@ YY_RULE_SETUP
+ }
+ YY_BREAK
+ case YY_STATE_EOF(INITIAL):
+-case YY_STATE_EOF(INCLUDE):
+ case YY_STATE_EOF(BYTESTRING):
+ case YY_STATE_EOF(PROPNODENAME):
+ case YY_STATE_EOF(V1):
+-#line 95 "dtc-lexer.l"
++#line 96 "dtc-lexer.l"
+ {
+ if (!pop_input_file()) {
+ yyterminate();
+@@ -984,7 +986,7 @@ case YY_STATE_EOF(V1):
+ case 3:
+ /* rule 3 can match eol */
+ YY_RULE_SETUP
+-#line 101 "dtc-lexer.l"
++#line 102 "dtc-lexer.l"
+ {
+ DPRINT("String: %s\n", yytext);
+ yylval.data = data_copy_escape_string(yytext+1,
+@@ -994,7 +996,7 @@ YY_RULE_SETUP
+ YY_BREAK
+ case 4:
+ YY_RULE_SETUP
+-#line 108 "dtc-lexer.l"
++#line 109 "dtc-lexer.l"
+ {
+ DPRINT("Keyword: /dts-v1/\n");
+ dts_version = 1;
+@@ -1004,25 +1006,33 @@ YY_RULE_SETUP
+ YY_BREAK
+ case 5:
+ YY_RULE_SETUP
+-#line 115 "dtc-lexer.l"
++#line 116 "dtc-lexer.l"
++{
++ DPRINT("Keyword: /plugin/\n");
++ return DT_PLUGIN;
++ }
++ YY_BREAK
++case 6:
++YY_RULE_SETUP
++#line 121 "dtc-lexer.l"
+ {
+ DPRINT("Keyword: /memreserve/\n");
+ BEGIN_DEFAULT();
+ return DT_MEMRESERVE;
+ }
+ YY_BREAK
+-case 6:
++case 7:
+ YY_RULE_SETUP
+-#line 121 "dtc-lexer.l"
++#line 127 "dtc-lexer.l"
+ {
+ DPRINT("Keyword: /bits/\n");
+ BEGIN_DEFAULT();
+ return DT_BITS;
+ }
+ YY_BREAK
+-case 7:
++case 8:
+ YY_RULE_SETUP
+-#line 127 "dtc-lexer.l"
++#line 133 "dtc-lexer.l"
+ {
+ DPRINT("Keyword: /delete-property/\n");
+ DPRINT("<PROPNODENAME>\n");
+@@ -1030,9 +1040,9 @@ YY_RULE_SETUP
+ return DT_DEL_PROP;
+ }
+ YY_BREAK
+-case 8:
++case 9:
+ YY_RULE_SETUP
+-#line 134 "dtc-lexer.l"
++#line 140 "dtc-lexer.l"
+ {
+ DPRINT("Keyword: /delete-node/\n");
+ DPRINT("<PROPNODENAME>\n");
+@@ -1040,9 +1050,9 @@ YY_RULE_SETUP
+ return DT_DEL_NODE;
+ }
+ YY_BREAK
+-case 9:
++case 10:
+ YY_RULE_SETUP
+-#line 141 "dtc-lexer.l"
++#line 147 "dtc-lexer.l"
+ {
+ DPRINT("Label: %s\n", yytext);
+ yylval.labelref = xstrdup(yytext);
+@@ -1050,38 +1060,65 @@ YY_RULE_SETUP
+ return DT_LABEL;
+ }
+ YY_BREAK
+-case 10:
++case 11:
+ YY_RULE_SETUP
+-#line 148 "dtc-lexer.l"
++#line 154 "dtc-lexer.l"
+ {
+- yylval.literal = xstrdup(yytext);
+- DPRINT("Literal: '%s'\n", yylval.literal);
++ char *e;
++ DPRINT("Integer Literal: '%s'\n", yytext);
++
++ errno = 0;
++ yylval.integer = strtoull(yytext, &e, 0);
++
++ assert(!(*e) || !e[strspn(e, "UL")]);
++
++ if (errno == ERANGE)
++ lexical_error("Integer literal '%s' out of range",
++ yytext);
++ else
++ /* ERANGE is the only strtoull error triggerable
++ * by strings matching the pattern */
++ assert(errno == 0);
+ return DT_LITERAL;
+ }
+ YY_BREAK
+-case 11:
+-/* rule 11 can match eol */
++case 12:
++/* rule 12 can match eol */
+ YY_RULE_SETUP
+-#line 154 "dtc-lexer.l"
++#line 173 "dtc-lexer.l"
+ {
+- yytext[yyleng-1] = '\0';
+- yylval.literal = xstrdup(yytext+1);
+- DPRINT("Character literal: %s\n", yylval.literal);
++ struct data d;
++ DPRINT("Character literal: %s\n", yytext);
++
++ d = data_copy_escape_string(yytext+1, yyleng-2);
++ if (d.len == 1) {
++ lexical_error("Empty character literal");
++ yylval.integer = 0;
++ return DT_CHAR_LITERAL;
++ }
++
++ yylval.integer = (unsigned char)d.val[0];
++
++ if (d.len > 2)
++ lexical_error("Character literal has %d"
++ " characters instead of 1",
++ d.len - 1);
++
+ return DT_CHAR_LITERAL;
+ }
+ YY_BREAK
+-case 12:
++case 13:
+ YY_RULE_SETUP
+-#line 161 "dtc-lexer.l"
++#line 194 "dtc-lexer.l"
+ { /* label reference */
+ DPRINT("Ref: %s\n", yytext+1);
+ yylval.labelref = xstrdup(yytext+1);
+ return DT_REF;
+ }
+ YY_BREAK
+-case 13:
++case 14:
+ YY_RULE_SETUP
+-#line 167 "dtc-lexer.l"
++#line 200 "dtc-lexer.l"
+ { /* new-style path reference */
+ yytext[yyleng-1] = '\0';
+ DPRINT("Ref: %s\n", yytext+2);
+@@ -1089,27 +1126,27 @@ YY_RULE_SETUP
+ return DT_REF;
+ }
+ YY_BREAK
+-case 14:
++case 15:
+ YY_RULE_SETUP
+-#line 174 "dtc-lexer.l"
++#line 207 "dtc-lexer.l"
+ {
+ yylval.byte = strtol(yytext, NULL, 16);
+ DPRINT("Byte: %02x\n", (int)yylval.byte);
+ return DT_BYTE;
+ }
+ YY_BREAK
+-case 15:
++case 16:
+ YY_RULE_SETUP
+-#line 180 "dtc-lexer.l"
++#line 213 "dtc-lexer.l"
+ {
+ DPRINT("/BYTESTRING\n");
+ BEGIN_DEFAULT();
+ return ']';
+ }
+ YY_BREAK
+-case 16:
++case 17:
+ YY_RULE_SETUP
+-#line 186 "dtc-lexer.l"
++#line 219 "dtc-lexer.l"
+ {
+ DPRINT("PropNodeName: %s\n", yytext);
+ yylval.propnodename = xstrdup((yytext[0] == '\\') ?
+@@ -1118,75 +1155,75 @@ YY_RULE_SETUP
+ return DT_PROPNODENAME;
+ }
+ YY_BREAK
+-case 17:
++case 18:
+ YY_RULE_SETUP
+-#line 194 "dtc-lexer.l"
++#line 227 "dtc-lexer.l"
+ {
+ DPRINT("Binary Include\n");
+ return DT_INCBIN;
+ }
+ YY_BREAK
+-case 18:
+-/* rule 18 can match eol */
+-YY_RULE_SETUP
+-#line 199 "dtc-lexer.l"
+-/* eat whitespace */
+- YY_BREAK
+ case 19:
+ /* rule 19 can match eol */
+ YY_RULE_SETUP
+-#line 200 "dtc-lexer.l"
+-/* eat C-style comments */
++#line 232 "dtc-lexer.l"
++/* eat whitespace */
+ YY_BREAK
+ case 20:
+ /* rule 20 can match eol */
+ YY_RULE_SETUP
+-#line 201 "dtc-lexer.l"
+-/* eat C++-style comments */
++#line 233 "dtc-lexer.l"
++/* eat C-style comments */
+ YY_BREAK
+ case 21:
++/* rule 21 can match eol */
+ YY_RULE_SETUP
+-#line 203 "dtc-lexer.l"
+-{ return DT_LSHIFT; };
++#line 234 "dtc-lexer.l"
++/* eat C++-style comments */
+ YY_BREAK
+ case 22:
+ YY_RULE_SETUP
+-#line 204 "dtc-lexer.l"
+-{ return DT_RSHIFT; };
++#line 236 "dtc-lexer.l"
++{ return DT_LSHIFT; };
+ YY_BREAK
+ case 23:
+ YY_RULE_SETUP
+-#line 205 "dtc-lexer.l"
+-{ return DT_LE; };
++#line 237 "dtc-lexer.l"
++{ return DT_RSHIFT; };
+ YY_BREAK
+ case 24:
+ YY_RULE_SETUP
+-#line 206 "dtc-lexer.l"
+-{ return DT_GE; };
++#line 238 "dtc-lexer.l"
++{ return DT_LE; };
+ YY_BREAK
+ case 25:
+ YY_RULE_SETUP
+-#line 207 "dtc-lexer.l"
+-{ return DT_EQ; };
++#line 239 "dtc-lexer.l"
++{ return DT_GE; };
+ YY_BREAK
+ case 26:
+ YY_RULE_SETUP
+-#line 208 "dtc-lexer.l"
+-{ return DT_NE; };
++#line 240 "dtc-lexer.l"
++{ return DT_EQ; };
+ YY_BREAK
+ case 27:
+ YY_RULE_SETUP
+-#line 209 "dtc-lexer.l"
+-{ return DT_AND; };
++#line 241 "dtc-lexer.l"
++{ return DT_NE; };
+ YY_BREAK
+ case 28:
+ YY_RULE_SETUP
+-#line 210 "dtc-lexer.l"
+-{ return DT_OR; };
++#line 242 "dtc-lexer.l"
++{ return DT_AND; };
+ YY_BREAK
+ case 29:
+ YY_RULE_SETUP
+-#line 212 "dtc-lexer.l"
++#line 243 "dtc-lexer.l"
++{ return DT_OR; };
++ YY_BREAK
++case 30:
++YY_RULE_SETUP
++#line 245 "dtc-lexer.l"
+ {
+ DPRINT("Char: %c (\\x%02x)\n", yytext[0],
+ (unsigned)yytext[0]);
+@@ -1202,12 +1239,12 @@ YY_RULE_SETUP
+ return yytext[0];
+ }
+ YY_BREAK
+-case 30:
++case 31:
+ YY_RULE_SETUP
+-#line 227 "dtc-lexer.l"
++#line 260 "dtc-lexer.l"
+ ECHO;
+ YY_BREAK
+-#line 1211 "dtc-lexer.lex.c"
++#line 1248 "dtc-lexer.lex.c"
+
+ case YY_END_OF_BUFFER:
+ {
+@@ -1499,7 +1536,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 >= 161 )
++ if ( yy_current_state >= 166 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+@@ -1527,11 +1564,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 >= 161 )
++ if ( yy_current_state >= 166 )
+ 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 == 160);
++ yy_is_jam = (yy_current_state == 165);
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+@@ -2166,7 +2203,7 @@ void yyfree (void * ptr )
+
+ #define YYTABLES_NAME "yytables"
+
+-#line 227 "dtc-lexer.l"
++#line 260 "dtc-lexer.l"
+
+
+
+@@ -2182,14 +2219,25 @@ static void push_input_file(const char *filename)
+ }
+
+
+-static int pop_input_file(void)
++static bool pop_input_file(void)
+ {
+ if (srcfile_pop() == 0)
+- return 0;
++ return false;
+
+ yypop_buffer_state();
+ yyin = current_srcfile->f;
+
+- return 1;
++ return true;
++}
++
++static void lexical_error(const char *fmt, ...)
++{
++ va_list ap;
++
++ va_start(ap, fmt);
++ srcpos_verror(&yylloc, "Lexical error", fmt, ap);
++ va_end(ap);
++
++ treesource_error = true;
+ }
+
+diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped
+index c8769d5..3c29a77 100644
+--- a/scripts/dtc/dtc-parser.tab.c_shipped
++++ b/scripts/dtc/dtc-parser.tab.c_shipped
+@@ -1,8 +1,10 @@
+-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
+
+-/* Bison implementation for Yacc-like parsers in C
++/* A Bison parser, made by GNU Bison 2.4.1. */
++
++/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
++ Free Software Foundation, 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
+@@ -44,7 +46,7 @@
+ #define YYBISON 1
+
+ /* Bison version. */
+-#define YYBISON_VERSION "2.7.12-4996"
++#define YYBISON_VERSION "2.4.1"
+
+ /* Skeleton name. */
+ #define YYSKELETON_NAME "yacc.c"
+@@ -58,40 +60,41 @@
+ /* Pull parsers. */
+ #define YYPULL 1
+
++/* Using locations. */
++#define YYLSP_NEEDED 1
+
+
+
+ /* Copy the first part of user declarations. */
+-/* Line 371 of yacc.c */
+-#line 21 "dtc-parser.y"
++
++/* Line 189 of yacc.c */
++#line 20 "dtc-parser.y"
+
+ #include <stdio.h>
++#include <inttypes.h>
+
+ #include "dtc.h"
+ #include "srcpos.h"
+
+-YYLTYPE yylloc;
+-
+ extern int yylex(void);
+-extern void print_error(char const *fmt, ...);
+ extern void yyerror(char const *s);
++#define ERROR(loc, ...) \
++ do { \
++ srcpos_error((loc), "Error", __VA_ARGS__); \
++ treesource_error = true; \
++ } while (0)
+
+ extern struct boot_info *the_boot_info;
+-extern int treesource_error;
++extern bool treesource_error;
+
+-static unsigned long long eval_literal(const char *s, int base, int bits);
+-static unsigned char eval_char_literal(const char *s);
+
+-/* Line 371 of yacc.c */
+-#line 87 "dtc-parser.tab.c"
++/* Line 189 of yacc.c */
++#line 93 "dtc-parser.tab.c"
+
+-# ifndef YY_NULL
+-# if defined __cplusplus && 201103L <= __cplusplus
+-# define YY_NULL nullptr
+-# else
+-# define YY_NULL 0
+-# endif
+-# endif
++/* Enabling traces. */
++#ifndef YYDEBUG
++# define YYDEBUG 0
++#endif
+
+ /* Enabling verbose error messages. */
+ #ifdef YYERROR_VERBOSE
+@@ -101,18 +104,12 @@ static unsigned char eval_char_literal(const char *s);
+ # define YYERROR_VERBOSE 0
+ #endif
+
+-/* In a future release of Bison, this section will be replaced
+- by #include "dtc-parser.tab.h". */
+-#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
+-# define YY_YY_DTC_PARSER_TAB_H_INCLUDED
+-/* Enabling traces. */
+-#ifndef YYDEBUG
+-# define YYDEBUG 0
+-#endif
+-#if YYDEBUG
+-extern int yydebug;
++/* Enabling the token table. */
++#ifndef YYTOKEN_TABLE
++# define YYTOKEN_TABLE 0
+ #endif
+
++
+ /* Tokens. */
+ #ifndef YYTOKENTYPE
+ # define YYTOKENTYPE
+@@ -120,22 +117,22 @@ extern int yydebug;
+ know about them. */
+ enum yytokentype {
+ DT_V1 = 258,
+- DT_MEMRESERVE = 259,
+- DT_LSHIFT = 260,
+- DT_RSHIFT = 261,
+- DT_LE = 262,
+- DT_GE = 263,
+- DT_EQ = 264,
+- DT_NE = 265,
+- DT_AND = 266,
+- DT_OR = 267,
+- DT_BITS = 268,
+- DT_DEL_PROP = 269,
+- DT_DEL_NODE = 270,
+- DT_PROPNODENAME = 271,
+- DT_LITERAL = 272,
+- DT_CHAR_LITERAL = 273,
+- DT_BASE = 274,
++ DT_PLUGIN = 259,
++ DT_MEMRESERVE = 260,
++ DT_LSHIFT = 261,
++ DT_RSHIFT = 262,
++ DT_LE = 263,
++ DT_GE = 264,
++ DT_EQ = 265,
++ DT_NE = 266,
++ DT_AND = 267,
++ DT_OR = 268,
++ DT_BITS = 269,
++ DT_DEL_PROP = 270,
++ DT_DEL_NODE = 271,
++ DT_PROPNODENAME = 272,
++ DT_LITERAL = 273,
++ DT_CHAR_LITERAL = 274,
+ DT_BYTE = 275,
+ DT_STRING = 276,
+ DT_LABEL = 277,
+@@ -145,16 +142,16 @@ extern int yydebug;
+ #endif
+
+
++
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+ typedef union YYSTYPE
+ {
+-/* Line 387 of yacc.c */
+-#line 40 "dtc-parser.y"
++
++/* Line 214 of yacc.c */
++#line 39 "dtc-parser.y"
+
+ char *propnodename;
+- char *literal;
+ char *labelref;
+- unsigned int cbase;
+ uint8_t byte;
+ struct data data;
+
+@@ -169,38 +166,37 @@ typedef union YYSTYPE
+ struct node *nodelist;
+ struct reserve_info *re;
+ uint64_t integer;
++ bool is_plugin;
+
+
+-/* Line 387 of yacc.c */
+-#line 176 "dtc-parser.tab.c"
++
++/* Line 214 of yacc.c */
++#line 175 "dtc-parser.tab.c"
+ } YYSTYPE;
+ # define YYSTYPE_IS_TRIVIAL 1
+ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
+ # define YYSTYPE_IS_DECLARED 1
+ #endif
+
+-extern YYSTYPE yylval;
+-
+-#ifdef YYPARSE_PARAM
+-#if defined __STDC__ || defined __cplusplus
+-int yyparse (void *YYPARSE_PARAM);
+-#else
+-int yyparse ();
+-#endif
+-#else /* ! YYPARSE_PARAM */
+-#if defined __STDC__ || defined __cplusplus
+-int yyparse (void);
+-#else
+-int yyparse ();
++#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
++typedef struct YYLTYPE
++{
++ int first_line;
++ int first_column;
++ int last_line;
++ int last_column;
++} YYLTYPE;
++# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
++# define YYLTYPE_IS_DECLARED 1
++# define YYLTYPE_IS_TRIVIAL 1
+ #endif
+-#endif /* ! YYPARSE_PARAM */
+
+-#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
+
+ /* Copy the second part of user declarations. */
+
+-/* Line 390 of yacc.c */
+-#line 204 "dtc-parser.tab.c"
++
++/* Line 264 of yacc.c */
++#line 200 "dtc-parser.tab.c"
+
+ #ifdef short
+ # undef short
+@@ -250,36 +246,27 @@ typedef short int yytype_int16;
+ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+ #ifndef YY_
+-# if defined YYENABLE_NLS && YYENABLE_NLS
++# if YYENABLE_NLS
+ # if ENABLE_NLS
+ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
++# define YY_(msgid) dgettext ("bison-runtime", msgid)
+ # endif
+ # endif
+ # ifndef YY_
+-# define YY_(Msgid) Msgid
+-# endif
+-#endif
+-
+-#ifndef __attribute__
+-/* This feature is available in gcc versions 2.5 and later. */
+-# if (! defined __GNUC__ || __GNUC__ < 2 \
+- || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+-# define __attribute__(Spec) /* empty */
++# define YY_(msgid) msgid
+ # endif
+ #endif
+
+ /* Suppress unused-variable warnings by "using" E. */
+ #if ! defined lint || defined __GNUC__
+-# define YYUSE(E) ((void) (E))
++# define YYUSE(e) ((void) (e))
+ #else
+-# define YYUSE(E) /* empty */
++# define YYUSE(e) /* empty */
+ #endif
+
+-
+ /* Identity function, used to suppress warnings about constant conditions. */
+ #ifndef lint
+-# define YYID(N) (N)
++# define YYID(n) (n)
+ #else
+ #if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+@@ -312,12 +299,11 @@ YYID (yyi)
+ # define alloca _alloca
+ # else
+ # define YYSTACK_ALLOC alloca
+-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
++# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+-# ifndef EXIT_SUCCESS
+-# define EXIT_SUCCESS 0
++# ifndef _STDLIB_H
++# define _STDLIB_H 1
+ # endif
+ # endif
+ # endif
+@@ -340,24 +326,24 @@ YYID (yyi)
+ # ifndef YYSTACK_ALLOC_MAXIMUM
+ # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+ # endif
+-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
++# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+-# ifndef EXIT_SUCCESS
+-# define EXIT_SUCCESS 0
++# ifndef _STDLIB_H
++# define _STDLIB_H 1
+ # endif
+ # endif
+ # ifndef YYMALLOC
+ # define YYMALLOC malloc
+-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
++# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+ # endif
+ # endif
+ # ifndef YYFREE
+ # define YYFREE free
+-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
++# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ void free (void *); /* INFRINGES ON USER NAME SPACE */
+ # endif
+@@ -368,13 +354,15 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
+
+ #if (! defined yyoverflow \
+ && (! defined __cplusplus \
+- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
++ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
++ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+ /* A type that is properly aligned for any stack member. */
+ union yyalloc
+ {
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
++ YYLTYPE yyls_alloc;
+ };
+
+ /* The size of the maximum gap between one aligned stack and the next. */
+@@ -383,10 +371,26 @@ union yyalloc
+ /* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+ # define YYSTACK_BYTES(N) \
+- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+- + YYSTACK_GAP_MAXIMUM)
++ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
++ + 2 * YYSTACK_GAP_MAXIMUM)
+
+-# define YYCOPY_NEEDED 1
++/* Copy COUNT objects from FROM to TO. The source and destination do
++ not overlap. */
++# ifndef YYCOPY
++# if defined __GNUC__ && 1 < __GNUC__
++# define YYCOPY(To, From, Count) \
++ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
++# else
++# define YYCOPY(To, From, Count) \
++ do \
++ { \
++ YYSIZE_T yyi; \
++ for (yyi = 0; yyi < (Count); yyi++) \
++ (To)[yyi] = (From)[yyi]; \
++ } \
++ while (YYID (0))
++# endif
++# endif
+
+ /* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+@@ -406,39 +410,19 @@ union yyalloc
+
+ #endif
+
+-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+-/* Copy COUNT objects from SRC to DST. The source and destination do
+- not overlap. */
+-# ifndef YYCOPY
+-# if defined __GNUC__ && 1 < __GNUC__
+-# define YYCOPY(Dst, Src, Count) \
+- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+-# else
+-# define YYCOPY(Dst, Src, Count) \
+- do \
+- { \
+- YYSIZE_T yyi; \
+- for (yyi = 0; yyi < (Count); yyi++) \
+- (Dst)[yyi] = (Src)[yyi]; \
+- } \
+- while (YYID (0))
+-# endif
+-# endif
+-#endif /* !YYCOPY_NEEDED */
+-
+ /* YYFINAL -- State number of the termination state. */
+ #define YYFINAL 4
+ /* YYLAST -- Last index in YYTABLE. */
+-#define YYLAST 133
++#define YYLAST 135
+
+ /* YYNTOKENS -- Number of terminals. */
+ #define YYNTOKENS 48
+ /* YYNNTS -- Number of nonterminals. */
+-#define YYNNTS 28
++#define YYNNTS 29
+ /* YYNRULES -- Number of rules. */
+-#define YYNRULES 79
++#define YYNRULES 81
+ /* YYNRULES -- Number of states. */
+-#define YYNSTATES 141
++#define YYNSTATES 144
+
+ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+ #define YYUNDEFTOK 2
+@@ -485,80 +469,82 @@ static const yytype_uint8 yytranslate[] =
+ YYRHS. */
+ static const yytype_uint16 yyprhs[] =
+ {
+- 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
+- 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
+- 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
+- 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
+- 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
+- 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
+- 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
+- 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
++ 0, 0, 3, 9, 10, 13, 14, 17, 22, 25,
++ 28, 32, 36, 41, 47, 48, 51, 56, 59, 63,
++ 66, 69, 73, 78, 81, 91, 97, 100, 101, 104,
++ 107, 111, 113, 116, 119, 122, 124, 126, 130, 132,
++ 134, 140, 142, 146, 148, 152, 154, 158, 160, 164,
++ 166, 170, 172, 176, 180, 182, 186, 190, 194, 198,
++ 202, 206, 208, 212, 216, 218, 222, 226, 230, 232,
++ 234, 237, 240, 243, 244, 247, 250, 251, 254, 257,
++ 260, 264
+ };
+
+ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
+ static const yytype_int8 yyrhs[] =
+ {
+- 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
+- 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
+- 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
+- -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
+- 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
+- -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
+- -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
+- 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
+- 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
+- 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
+- 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
+- -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
+- -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
+- 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
+- -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
+- 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
+- -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
+- -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
+- -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
+- 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
+- -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
+- -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
+- -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
+- 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
+- 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
+- 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
+- 75, -1
++ 49, 0, -1, 3, 25, 50, 51, 53, -1, -1,
++ 4, 25, -1, -1, 52, 51, -1, 5, 60, 60,
++ 25, -1, 22, 52, -1, 26, 54, -1, 53, 26,
++ 54, -1, 53, 23, 54, -1, 53, 16, 23, 25,
++ -1, 27, 55, 75, 28, 25, -1, -1, 55, 56,
++ -1, 17, 29, 57, 25, -1, 17, 25, -1, 15,
++ 17, 25, -1, 22, 56, -1, 58, 21, -1, 58,
++ 59, 30, -1, 58, 31, 74, 32, -1, 58, 23,
++ -1, 58, 24, 33, 21, 34, 60, 34, 60, 35,
++ -1, 58, 24, 33, 21, 35, -1, 57, 22, -1,
++ -1, 57, 34, -1, 58, 22, -1, 14, 18, 36,
++ -1, 36, -1, 59, 60, -1, 59, 23, -1, 59,
++ 22, -1, 18, -1, 19, -1, 33, 61, 35, -1,
++ 62, -1, 63, -1, 63, 37, 61, 38, 62, -1,
++ 64, -1, 63, 13, 64, -1, 65, -1, 64, 12,
++ 65, -1, 66, -1, 65, 39, 66, -1, 67, -1,
++ 66, 40, 67, -1, 68, -1, 67, 41, 68, -1,
++ 69, -1, 68, 10, 69, -1, 68, 11, 69, -1,
++ 70, -1, 69, 36, 70, -1, 69, 30, 70, -1,
++ 69, 8, 70, -1, 69, 9, 70, -1, 70, 6,
++ 71, -1, 70, 7, 71, -1, 71, -1, 71, 42,
++ 72, -1, 71, 43, 72, -1, 72, -1, 72, 44,
++ 73, -1, 72, 26, 73, -1, 72, 45, 73, -1,
++ 73, -1, 60, -1, 43, 73, -1, 46, 73, -1,
++ 47, 73, -1, -1, 74, 20, -1, 74, 22, -1,
++ -1, 76, 75, -1, 76, 56, -1, 17, 54, -1,
++ 16, 17, 25, -1, 22, 76, -1
+ };
+
+ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ static const yytype_uint16 yyrline[] =
+ {
+- 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
+- 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
+- 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
+- 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
++ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151,
++ 155, 159, 169, 184, 192, 195, 202, 206, 210, 214,
++ 222, 226, 230, 234, 238, 254, 264, 272, 275, 279,
++ 286, 302, 307, 326, 340, 347, 348, 349, 356, 360,
+ 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
+- 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
+- 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
+- 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
++ 386, 390, 391, 392, 396, 397, 398, 399, 400, 404,
++ 405, 406, 410, 411, 412, 416, 417, 418, 419, 423,
++ 424, 425, 426, 431, 434, 438, 446, 449, 453, 461,
++ 465, 469
+ };
+ #endif
+
+-#if YYDEBUG || YYERROR_VERBOSE || 0
++#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+ /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+ static const char *const yytname[] =
+ {
+- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
+- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
+- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
+- "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
++ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
++ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
++ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
++ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
+- "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
+- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
+- "integer_expr", "integer_trinary", "integer_or", "integer_and",
+- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
+- "integer_rela", "integer_shift", "integer_add", "integer_mul",
+- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL
++ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef",
++ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix",
++ "integer_prim", "integer_expr", "integer_trinary", "integer_or",
++ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand",
++ "integer_eq", "integer_rela", "integer_shift", "integer_add",
++ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", 0
+ };
+ #endif
+
+@@ -578,154 +564,151 @@ static const yytype_uint16 yytoknum[] =
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+ static const yytype_uint8 yyr1[] =
+ {
+- 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
+- 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
+- 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
+- 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
++ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53,
++ 53, 53, 53, 54, 55, 55, 56, 56, 56, 56,
++ 57, 57, 57, 57, 57, 57, 57, 58, 58, 58,
++ 59, 59, 59, 59, 59, 60, 60, 60, 61, 62,
+ 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
+- 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
+- 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
+- 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
++ 67, 68, 68, 68, 69, 69, 69, 69, 69, 70,
++ 70, 70, 71, 71, 71, 72, 72, 72, 72, 73,
++ 73, 73, 73, 74, 74, 74, 75, 75, 75, 76,
++ 76, 76
+ };
+
+ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+ static const yytype_uint8 yyr2[] =
+ {
+- 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
+- 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
+- 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
+- 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
+- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
+- 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
+- 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
+- 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
++ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2,
++ 3, 3, 4, 5, 0, 2, 4, 2, 3, 2,
++ 2, 3, 4, 2, 9, 5, 2, 0, 2, 2,
++ 3, 1, 2, 2, 2, 1, 1, 3, 1, 1,
++ 5, 1, 3, 1, 3, 1, 3, 1, 3, 1,
++ 3, 1, 3, 3, 1, 3, 3, 3, 3, 3,
++ 3, 1, 3, 3, 1, 3, 3, 3, 1, 1,
++ 2, 2, 2, 0, 2, 2, 0, 2, 2, 2,
++ 3, 2
+ };
+
+-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+- Performed when YYTABLE doesn't specify something else to do. Zero
++/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
++ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+ static const yytype_uint8 yydefact[] =
+ {
+- 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
+- 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
+- 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
+- 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
+- 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0,
++ 0, 5, 35, 36, 0, 0, 8, 0, 2, 6,
++ 0, 0, 0, 69, 0, 38, 39, 41, 43, 45,
++ 47, 49, 51, 54, 61, 64, 68, 0, 14, 9,
++ 0, 0, 0, 70, 71, 72, 37, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+- 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
+- 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
+- 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
+- 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
+- 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
+- 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
+- 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
+- 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
+- 22
++ 0, 0, 0, 0, 0, 0, 7, 76, 0, 11,
++ 10, 42, 0, 44, 46, 48, 50, 52, 53, 57,
++ 58, 56, 55, 59, 60, 62, 63, 66, 65, 67,
++ 0, 0, 0, 0, 15, 0, 76, 12, 0, 0,
++ 0, 17, 27, 79, 19, 81, 0, 78, 77, 40,
++ 18, 80, 0, 0, 13, 26, 16, 28, 0, 20,
++ 29, 23, 0, 73, 31, 0, 0, 0, 0, 34,
++ 33, 21, 32, 30, 0, 74, 75, 22, 0, 25,
++ 0, 0, 0, 24
+ };
+
+ /* YYDEFGOTO[NTERM-NUM]. */
+-static const yytype_int8 yydefgoto[] =
++static const yytype_int16 yydefgoto[] =
+ {
+- -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
+- 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+- 29, 30, 31, 32, 33, 125, 92, 93
++ -1, 2, 6, 10, 11, 18, 39, 67, 94, 112,
++ 113, 125, 23, 24, 25, 26, 27, 28, 29, 30,
++ 31, 32, 33, 34, 35, 36, 128, 95, 96
+ };
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+-#define YYPACT_NINF -78
++#define YYPACT_NINF -41
+ static const yytype_int8 yypact[] =
+ {
+- 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
+- -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
+- -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
+- 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
+- -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
+- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
+- -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
+- 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
+- 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
+- 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
+- -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
+- -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
+- -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
+- -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
+- -78
++ 37, 10, 24, 78, -41, 20, 9, -41, 8, 9,
++ 59, 9, -41, -41, -10, 8, -41, 60, 39, -41,
++ -10, -10, -10, -41, 51, -41, -7, 76, 50, 52,
++ 53, 49, 2, 65, 32, -1, -41, 66, -41, -41,
++ 67, 60, 60, -41, -41, -41, -41, -10, -10, -10,
++ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
++ -10, -10, -10, -10, -10, -10, -41, 41, 68, -41,
++ -41, 76, 57, 50, 52, 53, 49, 2, 2, 65,
++ 65, 65, 65, 32, 32, -1, -1, -41, -41, -41,
++ 79, 80, -12, 41, -41, 70, 41, -41, -10, 74,
++ 75, -41, -41, -41, -41, -41, 77, -41, -41, -41,
++ -41, -41, 17, -2, -41, -41, -41, -41, 83, -41,
++ -41, -41, 71, -41, -41, 31, 69, 82, -4, -41,
++ -41, -41, -41, -41, 42, -41, -41, -41, 8, -41,
++ 72, 8, 73, -41
+ };
+
+ /* YYPGOTO[NTERM-NUM]. */
+ static const yytype_int8 yypgoto[] =
+ {
+- -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
+- -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
+- 34, 20, 26, 28, -14, -78, 18, 24
++ -41, -41, -41, 96, 100, -41, -40, -41, -23, -41,
++ -41, -41, -8, 62, 13, -41, 81, 63, 64, 84,
++ 61, 25, 11, 21, 22, -17, -41, 19, 23
+ };
+
+ /* 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 YYTABLE_NINF, syntax error. */
++ number is the opposite. If zero, do what YYDEFACT says.
++ If YYTABLE_NINF, syntax error. */
+ #define YYTABLE_NINF -1
+ static const yytype_uint8 yytable[] =
+ {
+- 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
+- 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
+- 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
+- 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
+- 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
+- 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
+- 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
+- 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
+- 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
+- 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
+- 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
+- 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
+- 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
+- 137, 0, 73, 139
++ 15, 69, 70, 43, 44, 45, 47, 37, 12, 13,
++ 55, 56, 118, 101, 8, 38, 135, 102, 136, 119,
++ 120, 121, 122, 14, 4, 63, 12, 13, 137, 123,
++ 48, 9, 57, 20, 124, 3, 21, 22, 58, 115,
++ 1, 14, 116, 64, 65, 7, 87, 88, 89, 12,
++ 13, 117, 103, 129, 130, 40, 90, 91, 92, 53,
++ 54, 131, 41, 93, 14, 42, 79, 80, 81, 82,
++ 104, 59, 60, 107, 61, 62, 138, 139, 77, 78,
++ 83, 84, 5, 85, 86, 17, 46, 38, 49, 50,
++ 68, 66, 51, 97, 52, 98, 99, 100, 106, 110,
++ 111, 126, 114, 134, 127, 133, 141, 19, 143, 16,
++ 72, 109, 73, 76, 74, 108, 105, 132, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
++ 140, 0, 0, 142, 0, 75
+ };
+
+-#define yypact_value_is_default(Yystate) \
+- (!!((Yystate) == (-78)))
+-
+-#define yytable_value_is_error(Yytable_value) \
+- YYID (0)
+-
+ static const yytype_int16 yycheck[] =
+ {
+- 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
+- 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
+- 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
+- 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
+- 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
+- 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
+- 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
+- 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
+- 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
+- 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
+- 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
+- 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
+- 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
+- 135, -1, 49, 138
++ 8, 41, 42, 20, 21, 22, 13, 15, 18, 19,
++ 8, 9, 14, 25, 5, 27, 20, 29, 22, 21,
++ 22, 23, 24, 33, 0, 26, 18, 19, 32, 31,
++ 37, 22, 30, 43, 36, 25, 46, 47, 36, 22,
++ 3, 33, 25, 44, 45, 25, 63, 64, 65, 18,
++ 19, 34, 92, 22, 23, 16, 15, 16, 17, 10,
++ 11, 30, 23, 22, 33, 26, 55, 56, 57, 58,
++ 93, 6, 7, 96, 42, 43, 34, 35, 53, 54,
++ 59, 60, 4, 61, 62, 26, 35, 27, 12, 39,
++ 23, 25, 40, 25, 41, 38, 17, 17, 28, 25,
++ 25, 18, 25, 21, 33, 36, 34, 11, 35, 9,
++ 48, 98, 49, 52, 50, 96, 93, 125, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, 47, -1,
++ 138, -1, -1, 141, -1, 51
+ };
+
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+ static const yytype_uint8 yystos[] =
+ {
+- 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
+- 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
+- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+- 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
+- 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
+- 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
+- 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
+- 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
+- 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
+- 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
+- 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
+- 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
+- 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
+- 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
+- 35
++ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22,
++ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51,
++ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66,
++ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54,
++ 16, 23, 26, 73, 73, 73, 35, 13, 37, 12,
++ 39, 40, 41, 10, 11, 8, 9, 30, 36, 6,
++ 7, 42, 43, 26, 44, 45, 25, 55, 23, 54,
++ 54, 64, 61, 65, 66, 67, 68, 69, 69, 70,
++ 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
++ 15, 16, 17, 22, 56, 75, 76, 25, 38, 17,
++ 17, 25, 29, 54, 56, 76, 28, 56, 75, 62,
++ 25, 25, 57, 58, 25, 22, 25, 34, 14, 21,
++ 22, 23, 24, 31, 36, 59, 18, 33, 74, 22,
++ 23, 30, 60, 36, 21, 20, 22, 32, 34, 35,
++ 60, 34, 60, 35
+ };
+
+ #define yyerrok (yyerrstatus = 0)
+@@ -740,50 +723,78 @@ static const yytype_uint8 yystos[] =
+
+ /* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+- Once GCC version 2 has supplanted version 1, this can go. However,
+- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+- discussed. */
++ Once GCC version 2 has supplanted version 1, this can go. */
+
+ #define YYFAIL goto yyerrlab
+-#if defined YYFAIL
+- /* This is here to suppress warnings from the GCC cpp's
+- -Wunused-macros. Normally we don't worry about that warning, but
+- some users do, and we want to make it easy for users to remove
+- YYFAIL uses, which will produce warnings from Bison 2.5. */
+-#endif
+
+ #define YYRECOVERING() (!!yyerrstatus)
+
+-#define YYBACKUP(Token, Value) \
+-do \
+- if (yychar == YYEMPTY) \
+- { \
+- yychar = (Token); \
+- yylval = (Value); \
+- YYPOPSTACK (yylen); \
+- yystate = *yyssp; \
+- goto yybackup; \
+- } \
+- else \
+- { \
++#define YYBACKUP(Token, Value) \
++do \
++ if (yychar == YYEMPTY && yylen == 1) \
++ { \
++ yychar = (Token); \
++ yylval = (Value); \
++ yytoken = YYTRANSLATE (yychar); \
++ YYPOPSTACK (1); \
++ goto yybackup; \
++ } \
++ else \
++ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (YYID (0))
+
+-/* Error token number */
++
+ #define YYTERROR 1
+ #define YYERRCODE 256
+
+
+-/* This macro is provided for backward compatibility. */
++/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
++ If N is 0, then set CURRENT to the empty location which ends
++ the previous symbol: RHS[0] (always defined). */
++
++#define YYRHSLOC(Rhs, K) ((Rhs)[K])
++#ifndef YYLLOC_DEFAULT
++# define YYLLOC_DEFAULT(Current, Rhs, N) \
++ do \
++ if (YYID (N)) \
++ { \
++ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
++ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
++ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
++ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
++ } \
++ else \
++ { \
++ (Current).first_line = (Current).last_line = \
++ YYRHSLOC (Rhs, 0).last_line; \
++ (Current).first_column = (Current).last_column = \
++ YYRHSLOC (Rhs, 0).last_column; \
++ } \
++ while (YYID (0))
++#endif
++
++
++/* YY_LOCATION_PRINT -- Print the location on the stream.
++ This macro was not mandated originally: define only if we know
++ we won't break user code: when these are the locations we know. */
++
+ #ifndef YY_LOCATION_PRINT
+-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
++# if YYLTYPE_IS_TRIVIAL
++# define YY_LOCATION_PRINT(File, Loc) \
++ fprintf (File, "%d.%d-%d.%d", \
++ (Loc).first_line, (Loc).first_column, \
++ (Loc).last_line, (Loc).last_column)
++# else
++# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
++# endif
+ #endif
+
+
+ /* YYLEX -- calling `yylex' with the right arguments. */
++
+ #ifdef YYLEX_PARAM
+ # define YYLEX yylex (YYLEX_PARAM)
+ #else
+@@ -810,7 +821,7 @@ do { \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+- Type, Value); \
++ Type, Value, Location); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+ } while (YYID (0))
+@@ -824,26 +835,30 @@ do { \
+ #if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ static void
+-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
++yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
+ #else
+ static void
+-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
++yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
++ YYLTYPE const * const yylocationp;
+ #endif
+ {
+- FILE *yyo = yyoutput;
+- YYUSE (yyo);
+ if (!yyvaluep)
+ return;
++ YYUSE (yylocationp);
+ # ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ # else
+ YYUSE (yyoutput);
+ # endif
+- YYUSE (yytype);
++ switch (yytype)
++ {
++ default:
++ break;
++ }
+ }
+
+
+@@ -854,13 +869,14 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ #if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ static void
+-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
++yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
+ #else
+ static void
+-yy_symbol_print (yyoutput, yytype, yyvaluep)
++yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
++ YYLTYPE const * const yylocationp;
+ #endif
+ {
+ if (yytype < YYNTOKENS)
+@@ -868,7 +884,9 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
++ YY_LOCATION_PRINT (yyoutput, *yylocationp);
++ YYFPRINTF (yyoutput, ": ");
++ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
+ YYFPRINTF (yyoutput, ")");
+ }
+
+@@ -911,11 +929,12 @@ do { \
+ #if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ static void
+-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
++yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
+ #else
+ static void
+-yy_reduce_print (yyvsp, yyrule)
++yy_reduce_print (yyvsp, yylsp, yyrule)
+ YYSTYPE *yyvsp;
++ YYLTYPE *yylsp;
+ int yyrule;
+ #endif
+ {
+@@ -930,7 +949,7 @@ yy_reduce_print (yyvsp, yyrule)
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+- );
++ , &(yylsp[(yyi + 1) - (yynrhs)]) );
+ YYFPRINTF (stderr, "\n");
+ }
+ }
+@@ -938,7 +957,7 @@ yy_reduce_print (yyvsp, yyrule)
+ # define YY_REDUCE_PRINT(Rule) \
+ do { \
+ if (yydebug) \
+- yy_reduce_print (yyvsp, Rule); \
++ yy_reduce_print (yyvsp, yylsp, Rule); \
+ } while (YYID (0))
+
+ /* Nonzero means print parse trace. It is left uninitialized so that
+@@ -968,6 +987,7 @@ int yydebug;
+ # define YYMAXDEPTH 10000
+ #endif
+
++
+
+ #if YYERROR_VERBOSE
+
+@@ -1070,145 +1090,115 @@ yytnamerr (char *yyres, const char *yystr)
+ }
+ # endif
+
+-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+- about the unexpected token YYTOKEN for the state stack whose top is
+- YYSSP.
+-
+- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+- not large enough to hold the message. In that case, also set
+- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+- required number of bytes is too large to store. */
+-static int
+-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+- yytype_int16 *yyssp, int yytoken)
++/* Copy into YYRESULT an error message about the unexpected token
++ YYCHAR while in state YYSTATE. Return the number of bytes copied,
++ including the terminating null byte. If YYRESULT is null, do not
++ copy anything; just return the number of bytes that would be
++ copied. As a special case, return 0 if an ordinary "syntax error"
++ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
++ size calculation. */
++static YYSIZE_T
++yysyntax_error (char *yyresult, int yystate, int yychar)
+ {
+- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+- YYSIZE_T yysize = yysize0;
+- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+- /* Internationalized format string. */
+- const char *yyformat = YY_NULL;
+- /* Arguments of yyformat. */
+- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+- /* Number of reported tokens (one for the "unexpected", one per
+- "expected"). */
+- int yycount = 0;
+-
+- /* There are many possibilities here to consider:
+- - Assume YYFAIL is not used. It's too flawed to consider. See
+- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+- for details. YYERROR is fine as it does not invoke this
+- function.
+- - If this state is a consistent state with a default action, then
+- the only way this function was invoked is if the default action
+- is an error action. In that case, don't check for expected
+- tokens because there are none.
+- - The only way there can be no lookahead present (in yychar) is if
+- this state is a consistent state with a default action. Thus,
+- detecting the absence of a lookahead is sufficient to determine
+- that there is no unexpected or expected token to report. In that
+- case, just report a simple "syntax error".
+- - Don't assume there isn't a lookahead just because this state is a
+- consistent state with a default action. There might have been a
+- previous inconsistent state, consistent state with a non-default
+- action, or user semantic action that manipulated yychar.
+- - Of course, the expected token list depends on states to have
+- correct lookahead information, and it depends on the parser not
+- to perform extra reductions after fetching a lookahead from the
+- scanner and before detecting a syntax error. Thus, state merging
+- (from LALR or IELR) and default reductions corrupt the expected
+- token list. However, the list is correct for canonical LR with
+- one exception: it will still contain any token that will not be
+- accepted due to an error action in a later state.
+- */
+- if (yytoken != YYEMPTY)
+- {
+- int yyn = yypact[*yyssp];
+- yyarg[yycount++] = yytname[yytoken];
+- if (!yypact_value_is_default (yyn))
+- {
+- /* Start YYX at -YYN if negative to avoid negative indexes in
+- YYCHECK. In other words, skip the first -YYN actions for
+- this state because they are default actions. */
+- int yyxbegin = yyn < 0 ? -yyn : 0;
+- /* Stay within bounds of both yycheck and yytname. */
+- int yychecklim = YYLAST - yyn + 1;
+- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+- int yyx;
+-
+- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+- && !yytable_value_is_error (yytable[yyx + yyn]))
+- {
+- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+- {
+- yycount = 1;
+- yysize = yysize0;
+- break;
+- }
+- yyarg[yycount++] = yytname[yyx];
+- {
+- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+- if (! (yysize <= yysize1
+- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+- return 2;
+- yysize = yysize1;
+- }
+- }
+- }
+- }
++ int yyn = yypact[yystate];
+
+- switch (yycount)
++ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
++ return 0;
++ else
+ {
+-# define YYCASE_(N, S) \
+- case N: \
+- yyformat = S; \
+- break
+- YYCASE_(0, YY_("syntax error"));
+- YYCASE_(1, YY_("syntax error, unexpected %s"));
+- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+-# undef YYCASE_
+- }
++ int yytype = YYTRANSLATE (yychar);
++ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
++ YYSIZE_T yysize = yysize0;
++ YYSIZE_T yysize1;
++ int yysize_overflow = 0;
++ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
++ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
++ int yyx;
++
++# if 0
++ /* This is so xgettext sees the translatable formats that are
++ constructed on the fly. */
++ YY_("syntax error, unexpected %s");
++ YY_("syntax error, unexpected %s, expecting %s");
++ YY_("syntax error, unexpected %s, expecting %s or %s");
++ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
++ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
++# endif
++ char *yyfmt;
++ char const *yyf;
++ static char const yyunexpected[] = "syntax error, unexpected %s";
++ static char const yyexpecting[] = ", expecting %s";
++ static char const yyor[] = " or %s";
++ char yyformat[sizeof yyunexpected
++ + sizeof yyexpecting - 1
++ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
++ * (sizeof yyor - 1))];
++ char const *yyprefix = yyexpecting;
++
++ /* Start YYX at -YYN if negative to avoid negative indexes in
++ YYCHECK. */
++ int yyxbegin = yyn < 0 ? -yyn : 0;
++
++ /* Stay within bounds of both yycheck and yytname. */
++ int yychecklim = YYLAST - yyn + 1;
++ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
++ int yycount = 1;
++
++ yyarg[0] = yytname[yytype];
++ yyfmt = yystpcpy (yyformat, yyunexpected);
++
++ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
++ {
++ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
++ {
++ yycount = 1;
++ yysize = yysize0;
++ yyformat[sizeof yyunexpected - 1] = '\0';
++ break;
++ }
++ yyarg[yycount++] = yytname[yyx];
++ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
++ yysize_overflow |= (yysize1 < yysize);
++ yysize = yysize1;
++ yyfmt = yystpcpy (yyfmt, yyprefix);
++ yyprefix = yyor;
++ }
+
+- {
+- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+- return 2;
+- yysize = yysize1;
+- }
++ yyf = YY_(yyformat);
++ yysize1 = yysize + yystrlen (yyf);
++ yysize_overflow |= (yysize1 < yysize);
++ yysize = yysize1;
+
+- if (*yymsg_alloc < yysize)
+- {
+- *yymsg_alloc = 2 * yysize;
+- if (! (yysize <= *yymsg_alloc
+- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+- return 1;
+- }
++ if (yysize_overflow)
++ return YYSIZE_MAXIMUM;
+
+- /* Avoid sprintf, as that infringes on the user's name space.
+- Don't have undefined behavior even if the translation
+- produced a string with the wrong number of "%s"s. */
+- {
+- char *yyp = *yymsg;
+- int yyi = 0;
+- while ((*yyp = *yyformat) != '\0')
+- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+- {
+- yyp += yytnamerr (yyp, yyarg[yyi++]);
+- yyformat += 2;
+- }
+- else
+- {
+- yyp++;
+- yyformat++;
+- }
+- }
+- return 0;
++ if (yyresult)
++ {
++ /* Avoid sprintf, as that infringes on the user's name space.
++ Don't have undefined behavior even if the translation
++ produced a string with the wrong number of "%s"s. */
++ char *yyp = yyresult;
++ int yyi = 0;
++ while ((*yyp = *yyf) != '\0')
++ {
++ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
++ {
++ yyp += yytnamerr (yyp, yyarg[yyi++]);
++ yyf += 2;
++ }
++ else
++ {
++ yyp++;
++ yyf++;
++ }
++ }
++ }
++ return yysize;
++ }
+ }
+ #endif /* YYERROR_VERBOSE */
++
+
+ /*-----------------------------------------------.
+ | Release the memory associated to this symbol. |
+@@ -1218,49 +1208,64 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ #if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+ static void
+-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
++yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
+ #else
+ static void
+-yydestruct (yymsg, yytype, yyvaluep)
++yydestruct (yymsg, yytype, yyvaluep, yylocationp)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
++ YYLTYPE *yylocationp;
+ #endif
+ {
+ YYUSE (yyvaluep);
++ YYUSE (yylocationp);
+
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+- YYUSE (yytype);
+-}
++ switch (yytype)
++ {
+
++ default:
++ break;
++ }
++}
+
++/* Prevent warnings from -Wmissing-prototypes. */
++#ifdef YYPARSE_PARAM
++#if defined __STDC__ || defined __cplusplus
++int yyparse (void *YYPARSE_PARAM);
++#else
++int yyparse ();
++#endif
++#else /* ! YYPARSE_PARAM */
++#if defined __STDC__ || defined __cplusplus
++int yyparse (void);
++#else
++int yyparse ();
++#endif
++#endif /* ! YYPARSE_PARAM */
+
+
+ /* The lookahead symbol. */
+ int yychar;
+
+-
+-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+-#endif
+-#ifndef YY_INITIAL_VALUE
+-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+-#endif
+-
+ /* The semantic value of the lookahead symbol. */
+-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
++YYSTYPE yylval;
++
++/* Location data for the lookahead symbol. */
++YYLTYPE yylloc;
+
+ /* Number of syntax errors so far. */
+ int yynerrs;
+
+
+-/*----------.
+-| yyparse. |
+-`----------*/
++
++/*-------------------------.
++| yyparse or yypush_parse. |
++`-------------------------*/
+
+ #ifdef YYPARSE_PARAM
+ #if (defined __STDC__ || defined __C99__FUNC__ \
+@@ -1284,6 +1289,8 @@ yyparse ()
+ #endif
+ #endif
+ {
++
++
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+@@ -1291,8 +1298,9 @@ yyparse ()
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
++ `yyls': related to locations.
+
+- Refer to the stacks through separate pointers, to allow yyoverflow
++ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+@@ -1305,15 +1313,24 @@ yyparse ()
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
++ /* The location stack. */
++ YYLTYPE yylsa[YYINITDEPTH];
++ YYLTYPE *yyls;
++ YYLTYPE *yylsp;
++
++ /* The locations where the error started and ended. */
++ YYLTYPE yyerror_range[2];
++
+ YYSIZE_T yystacksize;
+
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+- int yytoken = 0;
++ int yytoken;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
++ YYLTYPE yyloc;
+
+ #if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+@@ -1322,14 +1339,16 @@ yyparse ()
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+ #endif
+
+-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
++#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+- yyssp = yyss = yyssa;
+- yyvsp = yyvs = yyvsa;
++ yytoken = 0;
++ yyss = yyssa;
++ yyvs = yyvsa;
++ yyls = yylsa;
+ yystacksize = YYINITDEPTH;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+@@ -1338,6 +1357,21 @@ yyparse ()
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
++
++ /* Initialize stack pointers.
++ Waste one element of value and location stack
++ so that they stay on the same level as the state stack.
++ The wasted elements are never initialized. */
++ yyssp = yyss;
++ yyvsp = yyvs;
++ yylsp = yyls;
++
++#if YYLTYPE_IS_TRIVIAL
++ /* Initialize the default location before parsing starts. */
++ yylloc.first_line = yylloc.last_line = 1;
++ yylloc.first_column = yylloc.last_column = 1;
++#endif
++
+ goto yysetstate;
+
+ /*------------------------------------------------------------.
+@@ -1363,6 +1397,7 @@ yyparse ()
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
++ YYLTYPE *yyls1 = yyls;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+@@ -1371,8 +1406,10 @@ yyparse ()
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
++ &yyls1, yysize * sizeof (*yylsp),
+ &yystacksize);
+
++ yyls = yyls1;
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+@@ -1395,6 +1432,7 @@ yyparse ()
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
++ YYSTACK_RELOCATE (yyls_alloc, yyls);
+ # undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+@@ -1404,6 +1442,7 @@ yyparse ()
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
++ yylsp = yyls + yysize - 1;
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+@@ -1429,7 +1468,7 @@ yybackup:
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+- if (yypact_value_is_default (yyn))
++ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+@@ -1460,8 +1499,8 @@ yybackup:
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+- if (yytable_value_is_error (yyn))
+- goto yyerrlab;
++ if (yyn == 0 || yyn == YYTABLE_NINF)
++ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+@@ -1478,10 +1517,8 @@ yybackup:
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+- YY_IGNORE_MAYBE_UNINITIALIZED_END
+-
++ *++yylsp = yylloc;
+ goto yynewstate;
+
+
+@@ -1512,210 +1549,252 @@ yyreduce:
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+-
++ /* Default location. */
++ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+-/* Line 1787 of yacc.c */
+-#line 110 "dtc-parser.y"
++
++/* Line 1455 of yacc.c */
++#line 109 "dtc-parser.y"
+ {
+- the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
+- guess_boot_cpuid((yyvsp[(4) - (4)].node)));
+- }
++ (yyvsp[(5) - (5)].node)->is_plugin = (yyvsp[(3) - (5)].is_plugin);
++ the_boot_info = build_boot_info((yyvsp[(4) - (5)].re), (yyvsp[(5) - (5)].node),
++ guess_boot_cpuid((yyvsp[(5) - (5)].node)));
++ ;}
+ break;
+
+ case 3:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 118 "dtc-parser.y"
+ {
+- (yyval.re) = NULL;
+- }
++ (yyval.is_plugin) = false;
++ ;}
+ break;
+
+ case 4:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 122 "dtc-parser.y"
+ {
+- (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
+- }
++ (yyval.is_plugin) = true;
++ ;}
+ break;
+
+ case 5:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 129 "dtc-parser.y"
+ {
+- (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
+- }
++ (yyval.re) = NULL;
++ ;}
+ break;
+
+ case 6:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 133 "dtc-parser.y"
+ {
++ (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
++ ;}
++ break;
++
++ case 7:
++
++/* Line 1455 of yacc.c */
++#line 140 "dtc-parser.y"
++ {
++ (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
++ ;}
++ break;
++
++ case 8:
++
++/* Line 1455 of yacc.c */
++#line 144 "dtc-parser.y"
++ {
+ add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
+ (yyval.re) = (yyvsp[(2) - (2)].re);
+- }
++ ;}
+ break;
+
+- case 7:
+-/* Line 1787 of yacc.c */
+-#line 141 "dtc-parser.y"
++ case 9:
++
++/* Line 1455 of yacc.c */
++#line 152 "dtc-parser.y"
+ {
+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
+- }
++ ;}
+ break;
+
+- case 8:
+-/* Line 1787 of yacc.c */
+-#line 145 "dtc-parser.y"
++ case 10:
++
++/* Line 1455 of yacc.c */
++#line 156 "dtc-parser.y"
+ {
+ (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
+- }
++ ;}
+ break;
+
+- case 9:
+-/* Line 1787 of yacc.c */
+-#line 149 "dtc-parser.y"
++ case 11:
++
++/* Line 1455 of yacc.c */
++#line 160 "dtc-parser.y"
+ {
+ struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
+
+ if (target)
+ merge_nodes(target, (yyvsp[(3) - (3)].node));
+ else
+- print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
++ ERROR(&(yylsp[(2) - (3)]), "Label or path %s not found", (yyvsp[(2) - (3)].labelref));
+ (yyval.node) = (yyvsp[(1) - (3)].node);
+- }
++ ;}
+ break;
+
+- case 10:
+-/* Line 1787 of yacc.c */
+-#line 159 "dtc-parser.y"
++ case 12:
++
++/* Line 1455 of yacc.c */
++#line 170 "dtc-parser.y"
+ {
+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
+
+- if (!target)
+- print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
+- else
++ if (target)
+ delete_node(target);
++ else
++ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref));
++
+
+ (yyval.node) = (yyvsp[(1) - (4)].node);
+- }
++ ;}
+ break;
+
+- case 11:
+-/* Line 1787 of yacc.c */
+-#line 173 "dtc-parser.y"
++ case 13:
++
++/* Line 1455 of yacc.c */
++#line 185 "dtc-parser.y"
+ {
+ (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
+- }
++ ;}
+ break;
+
+- case 12:
+-/* Line 1787 of yacc.c */
+-#line 180 "dtc-parser.y"
++ case 14:
++
++/* Line 1455 of yacc.c */
++#line 192 "dtc-parser.y"
+ {
+ (yyval.proplist) = NULL;
+- }
++ ;}
+ break;
+
+- case 13:
+-/* Line 1787 of yacc.c */
+-#line 184 "dtc-parser.y"
++ case 15:
++
++/* Line 1455 of yacc.c */
++#line 196 "dtc-parser.y"
+ {
+ (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
+- }
++ ;}
+ break;
+
+- case 14:
+-/* Line 1787 of yacc.c */
+-#line 191 "dtc-parser.y"
++ case 16:
++
++/* Line 1455 of yacc.c */
++#line 203 "dtc-parser.y"
+ {
+ (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
+- }
++ ;}
+ break;
+
+- case 15:
+-/* Line 1787 of yacc.c */
+-#line 195 "dtc-parser.y"
++ case 17:
++
++/* Line 1455 of yacc.c */
++#line 207 "dtc-parser.y"
+ {
+ (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
+- }
++ ;}
+ break;
+
+- case 16:
+-/* Line 1787 of yacc.c */
+-#line 199 "dtc-parser.y"
++ case 18:
++
++/* Line 1455 of yacc.c */
++#line 211 "dtc-parser.y"
+ {
+ (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
+- }
++ ;}
+ break;
+
+- case 17:
+-/* Line 1787 of yacc.c */
+-#line 203 "dtc-parser.y"
++ case 19:
++
++/* Line 1455 of yacc.c */
++#line 215 "dtc-parser.y"
+ {
+ add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
+ (yyval.prop) = (yyvsp[(2) - (2)].prop);
+- }
++ ;}
+ break;
+
+- case 18:
+-/* Line 1787 of yacc.c */
+-#line 211 "dtc-parser.y"
++ case 20:
++
++/* Line 1455 of yacc.c */
++#line 223 "dtc-parser.y"
+ {
+ (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
+- }
++ ;}
+ break;
+
+- case 19:
+-/* Line 1787 of yacc.c */
+-#line 215 "dtc-parser.y"
++ case 21:
++
++/* Line 1455 of yacc.c */
++#line 227 "dtc-parser.y"
+ {
+ (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
+- }
++ ;}
+ break;
+
+- case 20:
+-/* Line 1787 of yacc.c */
+-#line 219 "dtc-parser.y"
++ case 22:
++
++/* Line 1455 of yacc.c */
++#line 231 "dtc-parser.y"
+ {
+ (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
+- }
++ ;}
+ break;
+
+- case 21:
+-/* Line 1787 of yacc.c */
+-#line 223 "dtc-parser.y"
++ case 23:
++
++/* Line 1455 of yacc.c */
++#line 235 "dtc-parser.y"
+ {
+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
+- }
++ ;}
+ break;
+
+- case 22:
+-/* Line 1787 of yacc.c */
+-#line 227 "dtc-parser.y"
++ case 24:
++
++/* Line 1455 of yacc.c */
++#line 239 "dtc-parser.y"
+ {
+ FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
+ struct data d;
+
+ if ((yyvsp[(6) - (9)].integer) != 0)
+ if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
+- print_error("Couldn't seek to offset %llu in \"%s\": %s",
+- (unsigned long long)(yyvsp[(6) - (9)].integer),
+- (yyvsp[(4) - (9)].data).val,
+- strerror(errno));
++ die("Couldn't seek to offset %llu in \"%s\": %s",
++ (unsigned long long)(yyvsp[(6) - (9)].integer), (yyvsp[(4) - (9)].data).val,
++ strerror(errno));
+
+ d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
+
+ (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
+ fclose(f);
+- }
++ ;}
+ break;
+
+- case 23:
+-/* Line 1787 of yacc.c */
+-#line 244 "dtc-parser.y"
++ case 25:
++
++/* Line 1455 of yacc.c */
++#line 255 "dtc-parser.y"
+ {
+ FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
+ struct data d = empty_data;
+@@ -1724,72 +1803,80 @@ yyreduce:
+
+ (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
+ fclose(f);
+- }
++ ;}
+ break;
+
+- case 24:
+-/* Line 1787 of yacc.c */
+-#line 254 "dtc-parser.y"
++ case 26:
++
++/* Line 1455 of yacc.c */
++#line 265 "dtc-parser.y"
+ {
+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
+- }
++ ;}
+ break;
+
+- case 25:
+-/* Line 1787 of yacc.c */
+-#line 261 "dtc-parser.y"
++ case 27:
++
++/* Line 1455 of yacc.c */
++#line 272 "dtc-parser.y"
+ {
+ (yyval.data) = empty_data;
+- }
++ ;}
+ break;
+
+- case 26:
+-/* Line 1787 of yacc.c */
+-#line 265 "dtc-parser.y"
++ case 28:
++
++/* Line 1455 of yacc.c */
++#line 276 "dtc-parser.y"
+ {
+ (yyval.data) = (yyvsp[(1) - (2)].data);
+- }
++ ;}
+ break;
+
+- case 27:
+-/* Line 1787 of yacc.c */
+-#line 269 "dtc-parser.y"
++ case 29:
++
++/* Line 1455 of yacc.c */
++#line 280 "dtc-parser.y"
+ {
+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
+- }
++ ;}
+ break;
+
+- case 28:
+-/* Line 1787 of yacc.c */
+-#line 276 "dtc-parser.y"
++ case 30:
++
++/* Line 1455 of yacc.c */
++#line 287 "dtc-parser.y"
+ {
+- (yyval.array).data = empty_data;
+- (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
+-
+- if (((yyval.array).bits != 8) &&
+- ((yyval.array).bits != 16) &&
+- ((yyval.array).bits != 32) &&
+- ((yyval.array).bits != 64))
+- {
+- print_error("Only 8, 16, 32 and 64-bit elements"
+- " are currently supported");
+- (yyval.array).bits = 32;
++ unsigned long long bits;
++
++ bits = (yyvsp[(2) - (3)].integer);
++
++ if ((bits != 8) && (bits != 16) &&
++ (bits != 32) && (bits != 64)) {
++ ERROR(&(yylsp[(2) - (3)]), "Array elements must be"
++ " 8, 16, 32 or 64-bits");
++ bits = 32;
+ }
+- }
++
++ (yyval.array).data = empty_data;
++ (yyval.array).bits = bits;
++ ;}
+ break;
+
+- case 29:
+-/* Line 1787 of yacc.c */
+-#line 291 "dtc-parser.y"
++ case 31:
++
++/* Line 1455 of yacc.c */
++#line 303 "dtc-parser.y"
+ {
+ (yyval.array).data = empty_data;
+ (yyval.array).bits = 32;
+- }
++ ;}
+ break;
+
+- case 30:
+-/* Line 1787 of yacc.c */
+-#line 296 "dtc-parser.y"
++ case 32:
++
++/* Line 1455 of yacc.c */
++#line 308 "dtc-parser.y"
+ {
+ if ((yyvsp[(1) - (2)].array).bits < 64) {
+ uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
+@@ -1802,18 +1889,18 @@ yyreduce:
+ * mask), all bits are one.
+ */
+ if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
+- print_error(
+- "integer value out of range "
+- "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
++ ERROR(&(yylsp[(2) - (2)]), "Value out of range for"
++ " %d-bit array element", (yyvsp[(1) - (2)].array).bits);
+ }
+
+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
+- }
++ ;}
+ break;
+
+- case 31:
+-/* Line 1787 of yacc.c */
+-#line 316 "dtc-parser.y"
++ case 33:
++
++/* Line 1455 of yacc.c */
++#line 327 "dtc-parser.y"
+ {
+ uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
+
+@@ -1822,267 +1909,274 @@ yyreduce:
+ REF_PHANDLE,
+ (yyvsp[(2) - (2)].labelref));
+ else
+- print_error("References are only allowed in "
++ ERROR(&(yylsp[(2) - (2)]), "References are only allowed in "
+ "arrays with 32-bit elements.");
+
+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
+- }
+- break;
+-
+- case 32:
+-/* Line 1787 of yacc.c */
+-#line 330 "dtc-parser.y"
+- {
+- (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
+- }
+- break;
+-
+- case 33:
+-/* Line 1787 of yacc.c */
+-#line 337 "dtc-parser.y"
+- {
+- (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
+- }
++ ;}
+ break;
+
+ case 34:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 341 "dtc-parser.y"
+ {
+- (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
+- }
++ (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
++ ;}
+ break;
+
+- case 35:
+-/* Line 1787 of yacc.c */
+-#line 345 "dtc-parser.y"
++ case 37:
++
++/* Line 1455 of yacc.c */
++#line 350 "dtc-parser.y"
+ {
+ (yyval.integer) = (yyvsp[(2) - (3)].integer);
+- }
+- break;
+-
+- case 38:
+-/* Line 1787 of yacc.c */
+-#line 356 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); }
++ ;}
+ break;
+
+ case 40:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 361 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); ;}
+ break;
+
+ case 42:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 366 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 44:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 371 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 46:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 376 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 48:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 381 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 50:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 386 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+- case 51:
+-/* Line 1787 of yacc.c */
+-#line 387 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
++ case 52:
++
++/* Line 1455 of yacc.c */
++#line 391 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 53:
+-/* Line 1787 of yacc.c */
+-#line 392 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
+- break;
+
+- case 54:
+-/* Line 1787 of yacc.c */
+-#line 393 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); }
++/* Line 1455 of yacc.c */
++#line 392 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 55:
+-/* Line 1787 of yacc.c */
+-#line 394 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); }
++
++/* Line 1455 of yacc.c */
++#line 397 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 56:
+-/* Line 1787 of yacc.c */
+-#line 395 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); }
++
++/* Line 1455 of yacc.c */
++#line 398 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 57:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 399 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 58:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 400 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); ;}
++ break;
++
++ case 59:
++
++/* Line 1455 of yacc.c */
++#line 404 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 60:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
+ #line 405 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+- case 61:
+-/* Line 1787 of yacc.c */
+-#line 406 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
++ case 62:
++
++/* Line 1455 of yacc.c */
++#line 410 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 63:
+-/* Line 1787 of yacc.c */
+-#line 411 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
+- break;
+
+- case 64:
+-/* Line 1787 of yacc.c */
+-#line 412 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
++/* Line 1455 of yacc.c */
++#line 411 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 65:
+-/* Line 1787 of yacc.c */
+-#line 413 "dtc-parser.y"
+- { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); }
++
++/* Line 1455 of yacc.c */
++#line 416 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+- case 68:
+-/* Line 1787 of yacc.c */
+-#line 419 "dtc-parser.y"
+- { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
++ case 66:
++
++/* Line 1455 of yacc.c */
++#line 417 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+- case 69:
+-/* Line 1787 of yacc.c */
+-#line 420 "dtc-parser.y"
+- { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
++ case 67:
++
++/* Line 1455 of yacc.c */
++#line 418 "dtc-parser.y"
++ { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); ;}
+ break;
+
+ case 70:
+-/* Line 1787 of yacc.c */
+-#line 421 "dtc-parser.y"
+- { (yyval.integer) = !(yyvsp[(2) - (2)].integer); }
++
++/* Line 1455 of yacc.c */
++#line 424 "dtc-parser.y"
++ { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
+ break;
+
+ case 71:
+-/* Line 1787 of yacc.c */
++
++/* Line 1455 of yacc.c */
++#line 425 "dtc-parser.y"
++ { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); ;}
++ break;
++
++ case 72:
++
++/* Line 1455 of yacc.c */
+ #line 426 "dtc-parser.y"
++ { (yyval.integer) = !(yyvsp[(2) - (2)].integer); ;}
++ break;
++
++ case 73:
++
++/* Line 1455 of yacc.c */
++#line 431 "dtc-parser.y"
+ {
+ (yyval.data) = empty_data;
+- }
++ ;}
+ break;
+
+- case 72:
+-/* Line 1787 of yacc.c */
+-#line 430 "dtc-parser.y"
++ case 74:
++
++/* Line 1455 of yacc.c */
++#line 435 "dtc-parser.y"
+ {
+ (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
+- }
++ ;}
+ break;
+
+- case 73:
+-/* Line 1787 of yacc.c */
+-#line 434 "dtc-parser.y"
++ case 75:
++
++/* Line 1455 of yacc.c */
++#line 439 "dtc-parser.y"
+ {
+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
+- }
++ ;}
+ break;
+
+- case 74:
+-/* Line 1787 of yacc.c */
+-#line 441 "dtc-parser.y"
++ case 76:
++
++/* Line 1455 of yacc.c */
++#line 446 "dtc-parser.y"
+ {
+ (yyval.nodelist) = NULL;
+- }
++ ;}
+ break;
+
+- case 75:
+-/* Line 1787 of yacc.c */
+-#line 445 "dtc-parser.y"
++ case 77:
++
++/* Line 1455 of yacc.c */
++#line 450 "dtc-parser.y"
+ {
+ (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
+- }
++ ;}
+ break;
+
+- case 76:
+-/* Line 1787 of yacc.c */
+-#line 449 "dtc-parser.y"
++ case 78:
++
++/* Line 1455 of yacc.c */
++#line 454 "dtc-parser.y"
+ {
+- print_error("syntax error: properties must precede subnodes");
++ ERROR(&(yylsp[(2) - (2)]), "Properties must precede subnodes");
+ YYERROR;
+- }
++ ;}
+ break;
+
+- case 77:
+-/* Line 1787 of yacc.c */
+-#line 457 "dtc-parser.y"
++ case 79:
++
++/* Line 1455 of yacc.c */
++#line 462 "dtc-parser.y"
+ {
+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
+- }
++ ;}
+ break;
+
+- case 78:
+-/* Line 1787 of yacc.c */
+-#line 461 "dtc-parser.y"
++ case 80:
++
++/* Line 1455 of yacc.c */
++#line 466 "dtc-parser.y"
+ {
+ (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
+- }
++ ;}
+ break;
+
+- case 79:
+-/* Line 1787 of yacc.c */
+-#line 465 "dtc-parser.y"
++ case 81:
++
++/* Line 1455 of yacc.c */
++#line 470 "dtc-parser.y"
+ {
+ add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
+ (yyval.node) = (yyvsp[(2) - (2)].node);
+- }
++ ;}
+ break;
+
+
+-/* Line 1787 of yacc.c */
+-#line 2073 "dtc-parser.tab.c"
++
++/* Line 1455 of yacc.c */
++#line 2178 "dtc-parser.tab.c"
+ default: break;
+ }
+- /* User semantic actions sometimes alter yychar, and that requires
+- that yytoken be updated with the new translation. We take the
+- approach of translating immediately before every use of yytoken.
+- One alternative is translating here after every semantic action,
+- but that translation would be missed if the semantic action invokes
+- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+- incorrect destructor might then be invoked immediately. In the
+- case of YYERROR or YYBACKUP, subsequent parser actions might lead
+- to an incorrect destructor call or verbose syntax error message
+- before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+@@ -2090,6 +2184,7 @@ yyreduce:
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
++ *++yylsp = yyloc;
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+@@ -2110,10 +2205,6 @@ yyreduce:
+ | yyerrlab -- here on detecting error |
+ `------------------------------------*/
+ yyerrlab:
+- /* Make sure we have latest lookahead translation. See comments at
+- user semantic actions for why this is necessary. */
+- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+-
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+@@ -2121,40 +2212,41 @@ yyerrlab:
+ #if ! YYERROR_VERBOSE
+ yyerror (YY_("syntax error"));
+ #else
+-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+- yyssp, yytoken)
+ {
+- char const *yymsgp = YY_("syntax error");
+- int yysyntax_error_status;
+- yysyntax_error_status = YYSYNTAX_ERROR;
+- if (yysyntax_error_status == 0)
+- yymsgp = yymsg;
+- else if (yysyntax_error_status == 1)
+- {
+- if (yymsg != yymsgbuf)
+- YYSTACK_FREE (yymsg);
+- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+- if (!yymsg)
+- {
+- yymsg = yymsgbuf;
+- yymsg_alloc = sizeof yymsgbuf;
+- yysyntax_error_status = 2;
+- }
+- else
+- {
+- yysyntax_error_status = YYSYNTAX_ERROR;
+- yymsgp = yymsg;
+- }
+- }
+- yyerror (yymsgp);
+- if (yysyntax_error_status == 2)
+- goto yyexhaustedlab;
++ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
++ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
++ {
++ YYSIZE_T yyalloc = 2 * yysize;
++ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
++ yyalloc = YYSTACK_ALLOC_MAXIMUM;
++ if (yymsg != yymsgbuf)
++ YYSTACK_FREE (yymsg);
++ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
++ if (yymsg)
++ yymsg_alloc = yyalloc;
++ else
++ {
++ yymsg = yymsgbuf;
++ yymsg_alloc = sizeof yymsgbuf;
++ }
++ }
++
++ if (0 < yysize && yysize <= yymsg_alloc)
++ {
++ (void) yysyntax_error (yymsg, yystate, yychar);
++ yyerror (yymsg);
++ }
++ else
++ {
++ yyerror (YY_("syntax error"));
++ if (yysize != 0)
++ goto yyexhaustedlab;
++ }
+ }
+-# undef YYSYNTAX_ERROR
+ #endif
+ }
+
+-
++ yyerror_range[0] = yylloc;
+
+ if (yyerrstatus == 3)
+ {
+@@ -2170,7 +2262,7 @@ yyerrlab:
+ else
+ {
+ yydestruct ("Error: discarding",
+- yytoken, &yylval);
++ yytoken, &yylval, &yylloc);
+ yychar = YYEMPTY;
+ }
+ }
+@@ -2191,6 +2283,7 @@ yyerrorlab:
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
++ yyerror_range[0] = yylsp[1-yylen];
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+@@ -2209,7 +2302,7 @@ yyerrlab1:
+ for (;;)
+ {
+ yyn = yypact[yystate];
+- if (!yypact_value_is_default (yyn))
++ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+@@ -2224,18 +2317,21 @@ yyerrlab1:
+ if (yyssp == yyss)
+ YYABORT;
+
+-
++ yyerror_range[0] = *yylsp;
+ yydestruct ("Error: popping",
+- yystos[yystate], yyvsp);
++ yystos[yystate], yyvsp, yylsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+- YY_IGNORE_MAYBE_UNINITIALIZED_END
+
++ yyerror_range[1] = yylloc;
++ /* Using YYLLOC is tempting, but would change the location of
++ the lookahead. YYLOC is available though. */
++ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
++ *++yylsp = yyloc;
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+@@ -2258,7 +2354,7 @@ yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+-#if !defined yyoverflow || YYERROR_VERBOSE
++#if !defined(yyoverflow) || YYERROR_VERBOSE
+ /*-------------------------------------------------.
+ | yyexhaustedlab -- memory exhaustion comes here. |
+ `-------------------------------------------------*/
+@@ -2270,13 +2366,8 @@ yyexhaustedlab:
+
+ yyreturn:
+ if (yychar != YYEMPTY)
+- {
+- /* Make sure we have latest lookahead translation. See comments at
+- user semantic actions for why this is necessary. */
+- yytoken = YYTRANSLATE (yychar);
+- yydestruct ("Cleanup: discarding lookahead",
+- yytoken, &yylval);
+- }
++ yydestruct ("Cleanup: discarding lookahead",
++ yytoken, &yylval, &yylloc);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+@@ -2284,7 +2375,7 @@ yyreturn:
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+- yystos[*yyssp], yyvsp);
++ yystos[*yyssp], yyvsp, yylsp);
+ YYPOPSTACK (1);
+ }
+ #ifndef yyoverflow
+@@ -2300,67 +2391,13 @@ yyreturn:
+ }
+
+
+-/* Line 2050 of yacc.c */
+-#line 471 "dtc-parser.y"
+-
+-
+-void print_error(char const *fmt, ...)
+-{
+- va_list va;
+-
+- va_start(va, fmt);
+- srcpos_verror(&yylloc, fmt, va);
+- va_end(va);
+
+- treesource_error = 1;
+-}
++/* Line 1675 of yacc.c */
++#line 476 "dtc-parser.y"
+
+-void yyerror(char const *s) {
+- print_error("%s", s);
+-}
+
+-static unsigned long long eval_literal(const char *s, int base, int bits)
++void yyerror(char const *s)
+ {
+- unsigned long long val;
+- char *e;
+-
+- errno = 0;
+- val = strtoull(s, &e, base);
+- if (*e) {
+- size_t uls = strspn(e, "UL");
+- if (e[uls])
+- print_error("bad characters in literal");
+- }
+- if ((errno == ERANGE)
+- || ((bits < 64) && (val >= (1ULL << bits))))
+- print_error("literal out of range");
+- else if (errno != 0)
+- print_error("bad literal");
+- return val;
++ ERROR(&yylloc, "%s", s);
+ }
+
+-static unsigned char eval_char_literal(const char *s)
+-{
+- int i = 1;
+- char c = s[0];
+-
+- if (c == '\0')
+- {
+- print_error("empty character literal");
+- return 0;
+- }
+-
+- /*
+- * If the first character in the character literal is a \ then process
+- * the remaining characters as an escape encoding. If the first
+- * character is neither an escape or a terminator it should be the only
+- * character in the literal and will be returned.
+- */
+- if (c == '\\')
+- c = get_escape_char(s, &i);
+-
+- if (s[i] != '\0')
+- print_error("malformed character literal");
+-
+- return c;
+-}
+diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped
+index b2e7a86..38f7b36 100644
+--- a/scripts/dtc/dtc-parser.tab.h_shipped
++++ b/scripts/dtc/dtc-parser.tab.h_shipped
+@@ -1,8 +1,10 @@
+-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
+
+-/* Bison interface for Yacc-like parsers in C
++/* A Bison parser, made by GNU Bison 2.4.1. */
++
++/* Skeleton interface for Bison's Yacc-like parsers in C
+
+- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
++ Free Software Foundation, 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
+@@ -30,15 +32,6 @@
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+-#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
+-# define YY_YY_DTC_PARSER_TAB_H_INCLUDED
+-/* Enabling traces. */
+-#ifndef YYDEBUG
+-# define YYDEBUG 0
+-#endif
+-#if YYDEBUG
+-extern int yydebug;
+-#endif
+
+ /* Tokens. */
+ #ifndef YYTOKENTYPE
+@@ -47,22 +40,22 @@ extern int yydebug;
+ know about them. */
+ enum yytokentype {
+ DT_V1 = 258,
+- DT_MEMRESERVE = 259,
+- DT_LSHIFT = 260,
+- DT_RSHIFT = 261,
+- DT_LE = 262,
+- DT_GE = 263,
+- DT_EQ = 264,
+- DT_NE = 265,
+- DT_AND = 266,
+- DT_OR = 267,
+- DT_BITS = 268,
+- DT_DEL_PROP = 269,
+- DT_DEL_NODE = 270,
+- DT_PROPNODENAME = 271,
+- DT_LITERAL = 272,
+- DT_CHAR_LITERAL = 273,
+- DT_BASE = 274,
++ DT_PLUGIN = 259,
++ DT_MEMRESERVE = 260,
++ DT_LSHIFT = 261,
++ DT_RSHIFT = 262,
++ DT_LE = 263,
++ DT_GE = 264,
++ DT_EQ = 265,
++ DT_NE = 266,
++ DT_AND = 267,
++ DT_OR = 268,
++ DT_BITS = 269,
++ DT_DEL_PROP = 270,
++ DT_DEL_NODE = 271,
++ DT_PROPNODENAME = 272,
++ DT_LITERAL = 273,
++ DT_CHAR_LITERAL = 274,
+ DT_BYTE = 275,
+ DT_STRING = 276,
+ DT_LABEL = 277,
+@@ -72,16 +65,16 @@ extern int yydebug;
+ #endif
+
+
++
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+ typedef union YYSTYPE
+ {
+-/* Line 2053 of yacc.c */
+-#line 40 "dtc-parser.y"
++
++/* Line 1676 of yacc.c */
++#line 39 "dtc-parser.y"
+
+ char *propnodename;
+- char *literal;
+ char *labelref;
+- unsigned int cbase;
+ uint8_t byte;
+ struct data data;
+
+@@ -96,10 +89,12 @@ typedef union YYSTYPE
+ struct node *nodelist;
+ struct reserve_info *re;
+ uint64_t integer;
++ bool is_plugin;
+
+
+-/* Line 2053 of yacc.c */
+-#line 103 "dtc-parser.tab.h"
++
++/* Line 1676 of yacc.c */
++#line 98 "dtc-parser.tab.h"
+ } YYSTYPE;
+ # define YYSTYPE_IS_TRIVIAL 1
+ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
+@@ -108,18 +103,18 @@ typedef union YYSTYPE
+
+ extern YYSTYPE yylval;
+
+-#ifdef YYPARSE_PARAM
+-#if defined __STDC__ || defined __cplusplus
+-int yyparse (void *YYPARSE_PARAM);
+-#else
+-int yyparse ();
+-#endif
+-#else /* ! YYPARSE_PARAM */
+-#if defined __STDC__ || defined __cplusplus
+-int yyparse (void);
+-#else
+-int yyparse ();
++#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
++typedef struct YYLTYPE
++{
++ int first_line;
++ int first_column;
++ int last_line;
++ int last_column;
++} YYLTYPE;
++# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
++# define YYLTYPE_IS_DECLARED 1
++# define YYLTYPE_IS_TRIVIAL 1
+ #endif
+-#endif /* ! YYPARSE_PARAM */
+
+-#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
++extern YYLTYPE yylloc;
++
+diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y
+index f412460..776fdd5 100644
+--- a/scripts/dtc/dtc-parser.y
++++ b/scripts/dtc/dtc-parser.y
+@@ -17,31 +17,28 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+-
+ %{
+ #include <stdio.h>
++#include <inttypes.h>
+
+ #include "dtc.h"
+ #include "srcpos.h"
+
+-YYLTYPE yylloc;
+-
+ extern int yylex(void);
+-extern void print_error(char const *fmt, ...);
+ extern void yyerror(char const *s);
++#define ERROR(loc, ...) \
++ do { \
++ srcpos_error((loc), "Error", __VA_ARGS__); \
++ treesource_error = true; \
++ } while (0)
+
+ extern struct boot_info *the_boot_info;
+-extern int treesource_error;
+-
+-static unsigned long long eval_literal(const char *s, int base, int bits);
+-static unsigned char eval_char_literal(const char *s);
++extern bool treesource_error;
+ %}
+
+ %union {
+ char *propnodename;
+- char *literal;
+ char *labelref;
+- unsigned int cbase;
+ uint8_t byte;
+ struct data data;
+
+@@ -56,18 +53,19 @@ static unsigned char eval_char_literal(const char *s);
+ struct node *nodelist;
+ struct reserve_info *re;
+ uint64_t integer;
++ bool is_plugin;
+ }
+
+ %token DT_V1
++%token DT_PLUGIN
+ %token DT_MEMRESERVE
+ %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
+ %token DT_BITS
+ %token DT_DEL_PROP
+ %token DT_DEL_NODE
+ %token <propnodename> DT_PROPNODENAME
+-%token <literal> DT_LITERAL
+-%token <literal> DT_CHAR_LITERAL
+-%token <cbase> DT_BASE
++%token <integer> DT_LITERAL
++%token <integer> DT_CHAR_LITERAL
+ %token <byte> DT_BYTE
+ %token <data> DT_STRING
+ %token <labelref> DT_LABEL
+@@ -76,6 +74,7 @@ static unsigned char eval_char_literal(const char *s);
+
+ %type <data> propdata
+ %type <data> propdataprefix
++%type <is_plugin> plugindecl
+ %type <re> memreserve
+ %type <re> memreserves
+ %type <array> arrayprefix
+@@ -106,10 +105,22 @@ static unsigned char eval_char_literal(const char *s);
+ %%
+
+ sourcefile:
+- DT_V1 ';' memreserves devicetree
++ DT_V1 ';' plugindecl memreserves devicetree
++ {
++ $5->is_plugin = $3;
++ the_boot_info = build_boot_info($4, $5,
++ guess_boot_cpuid($5));
++ }
++ ;
++
++plugindecl:
++ /* empty */
++ {
++ $$ = false;
++ }
++ | DT_PLUGIN ';'
+ {
+- the_boot_info = build_boot_info($3, $4,
+- guess_boot_cpuid($4));
++ $$ = true;
+ }
+ ;
+
+@@ -152,17 +163,18 @@ devicetree:
+ if (target)
+ merge_nodes(target, $3);
+ else
+- print_error("label or path, '%s', not found", $2);
++ ERROR(&@2, "Label or path %s not found", $2);
+ $$ = $1;
+ }
+ | devicetree DT_DEL_NODE DT_REF ';'
+ {
+ struct node *target = get_node_by_ref($1, $3);
+
+- if (!target)
+- print_error("label or path, '%s', not found", $3);
+- else
++ if (target)
+ delete_node(target);
++ else
++ ERROR(&@3, "Label or path %s not found", $3);
++
+
+ $$ = $1;
+ }
+@@ -230,10 +242,9 @@ propdata:
+
+ if ($6 != 0)
+ if (fseek(f, $6, SEEK_SET) != 0)
+- print_error("Couldn't seek to offset %llu in \"%s\": %s",
+- (unsigned long long)$6,
+- $4.val,
+- strerror(errno));
++ die("Couldn't seek to offset %llu in \"%s\": %s",
++ (unsigned long long)$6, $4.val,
++ strerror(errno));
+
+ d = data_copy_file(f, $8);
+
+@@ -274,18 +285,19 @@ propdataprefix:
+ arrayprefix:
+ DT_BITS DT_LITERAL '<'
+ {
+- $$.data = empty_data;
+- $$.bits = eval_literal($2, 0, 7);
+-
+- if (($$.bits != 8) &&
+- ($$.bits != 16) &&
+- ($$.bits != 32) &&
+- ($$.bits != 64))
+- {
+- print_error("Only 8, 16, 32 and 64-bit elements"
+- " are currently supported");
+- $$.bits = 32;
++ unsigned long long bits;
++
++ bits = $2;
++
++ if ((bits != 8) && (bits != 16) &&
++ (bits != 32) && (bits != 64)) {
++ ERROR(&@2, "Array elements must be"
++ " 8, 16, 32 or 64-bits");
++ bits = 32;
+ }
++
++ $$.data = empty_data;
++ $$.bits = bits;
+ }
+ | '<'
+ {
+@@ -305,9 +317,8 @@ arrayprefix:
+ * mask), all bits are one.
+ */
+ if (($2 > mask) && (($2 | mask) != -1ULL))
+- print_error(
+- "integer value out of range "
+- "%016lx (%d bits)", $1.bits);
++ ERROR(&@2, "Value out of range for"
++ " %d-bit array element", $1.bits);
+ }
+
+ $$.data = data_append_integer($1.data, $2, $1.bits);
+@@ -321,7 +332,7 @@ arrayprefix:
+ REF_PHANDLE,
+ $2);
+ else
+- print_error("References are only allowed in "
++ ERROR(&@2, "References are only allowed in "
+ "arrays with 32-bit elements.");
+
+ $$.data = data_append_integer($1.data, val, $1.bits);
+@@ -334,13 +345,7 @@ arrayprefix:
+
+ integer_prim:
+ DT_LITERAL
+- {
+- $$ = eval_literal($1, 0, 64);
+- }
+ | DT_CHAR_LITERAL
+- {
+- $$ = eval_char_literal($1);
+- }
+ | '(' integer_expr ')'
+ {
+ $$ = $2;
+@@ -447,7 +452,7 @@ subnodes:
+ }
+ | subnode propdef
+ {
+- print_error("syntax error: properties must precede subnodes");
++ ERROR(&@2, "Properties must precede subnodes");
+ YYERROR;
+ }
+ ;
+@@ -470,63 +475,7 @@ subnode:
+
+ %%
+
+-void print_error(char const *fmt, ...)
+-{
+- va_list va;
+-
+- va_start(va, fmt);
+- srcpos_verror(&yylloc, fmt, va);
+- va_end(va);
+-
+- treesource_error = 1;
+-}
+-
+-void yyerror(char const *s) {
+- print_error("%s", s);
+-}
+-
+-static unsigned long long eval_literal(const char *s, int base, int bits)
+-{
+- unsigned long long val;
+- char *e;
+-
+- errno = 0;
+- val = strtoull(s, &e, base);
+- if (*e) {
+- size_t uls = strspn(e, "UL");
+- if (e[uls])
+- print_error("bad characters in literal");
+- }
+- if ((errno == ERANGE)
+- || ((bits < 64) && (val >= (1ULL << bits))))
+- print_error("literal out of range");
+- else if (errno != 0)
+- print_error("bad literal");
+- return val;
+-}
+-
+-static unsigned char eval_char_literal(const char *s)
++void yyerror(char const *s)
+ {
+- int i = 1;
+- char c = s[0];
+-
+- if (c == '\0')
+- {
+- print_error("empty character literal");
+- return 0;
+- }
+-
+- /*
+- * If the first character in the character literal is a \ then process
+- * the remaining characters as an escape encoding. If the first
+- * character is neither an escape or a terminator it should be the only
+- * character in the literal and will be returned.
+- */
+- if (c == '\\')
+- c = get_escape_char(s, &i);
+-
+- if (s[i] != '\0')
+- print_error("malformed character literal");
+-
+- return c;
++ ERROR(&yylloc, "%s", s);
+ }
+diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
+index e3c9653..91e91e7 100644
+--- a/scripts/dtc/dtc.c
++++ b/scripts/dtc/dtc.c
+@@ -29,6 +29,7 @@ int reservenum; /* Number of memory reservation slots */
+ int minsize; /* Minimum blob size */
+ int padsize; /* Additional padding to blob */
+ int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
++int symbol_fixup_support = 0;
+
+ static void fill_fullpaths(struct node *tree, const char *prefix)
+ {
+@@ -48,8 +49,10 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
+ }
+
+ /* Usage related data. */
++#define FDT_VERSION(version) _FDT_VERSION(version)
++#define _FDT_VERSION(version) #version
+ static const char usage_synopsis[] = "dtc [options] <input file>";
+-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv";
+ static struct option const usage_long_opts[] = {
+ {"quiet", no_argument, NULL, 'q'},
+ {"in-format", a_argument, NULL, 'I'},
+@@ -67,6 +70,7 @@ static struct option const usage_long_opts[] = {
+ {"phandle", a_argument, NULL, 'H'},
+ {"warning", a_argument, NULL, 'W'},
+ {"error", a_argument, NULL, 'E'},
++ {"symbols", no_argument, NULL, '@'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'v'},
+ {NULL, no_argument, NULL, 0x0},
+@@ -82,9 +86,9 @@ static const char * const usage_opts_help[] = {
+ "\t\tdts - device tree source text\n"
+ "\t\tdtb - device tree blob\n"
+ "\t\tasm - assembler source",
+- "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
++ "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
+ "\n\tOutput dependency file",
+- "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
++ "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
+ "\n\tMake the blob at least <bytes> long (extra space)",
+ "\n\tAdd padding to the blob of <bytes> long (extra space)",
+ "\n\tSet the physical boot cpu",
+@@ -97,6 +101,7 @@ static const char * const usage_opts_help[] = {
+ "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
+ "\n\tEnable/disable warnings (prefix with \"no-\")",
+ "\n\tEnable/disable errors (prefix with \"no-\")",
++ "\n\tEnable symbols/fixup support",
+ "\n\tPrint this help and exit",
+ "\n\tPrint version and exit",
+ NULL,
+@@ -109,7 +114,7 @@ int main(int argc, char *argv[])
+ const char *outform = "dts";
+ const char *outname = "-";
+ const char *depname = NULL;
+- int force = 0, sort = 0;
++ bool force = false, sort = false;
+ const char *arg;
+ int opt;
+ FILE *outf = NULL;
+@@ -148,7 +153,7 @@ int main(int argc, char *argv[])
+ padsize = strtol(optarg, NULL, 0);
+ break;
+ case 'f':
+- force = 1;
++ force = true;
+ break;
+ case 'q':
+ quiet++;
+@@ -174,7 +179,7 @@ int main(int argc, char *argv[])
+ break;
+
+ case 's':
+- sort = 1;
++ sort = true;
+ break;
+
+ case 'W':
+@@ -184,7 +189,9 @@ int main(int argc, char *argv[])
+ case 'E':
+ parse_checks_option(false, true, optarg);
+ break;
+-
++ case '@':
++ symbol_fixup_support = 1;
++ break;
+ case 'h':
+ usage(NULL);
+ default:
+@@ -237,7 +244,7 @@ int main(int argc, char *argv[])
+ if (streq(outname, "-")) {
+ outf = stdout;
+ } else {
+- outf = fopen(outname, "w");
++ outf = fopen(outname, "wb");
+ if (! outf)
+ die("Couldn't open output file %s: %s\n",
+ outname, strerror(errno));
+diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
+index 264a20c..f163b22 100644
+--- a/scripts/dtc/dtc.h
++++ b/scripts/dtc/dtc.h
+@@ -38,9 +38,9 @@
+ #include "util.h"
+
+ #ifdef DEBUG
+-#define debug(fmt,args...) printf(fmt, ##args)
++#define debug(...) printf(__VA_ARGS__)
+ #else
+-#define debug(fmt,args...)
++#define debug(...)
+ #endif
+
+
+@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */
+ extern int minsize; /* Minimum blob size */
+ extern int padsize; /* Additional padding to blob */
+ extern int phandle_format; /* Use linux,phandle or phandle properties */
++extern int symbol_fixup_support;/* enable symbols & fixup support */
+
+ #define PHANDLE_LEGACY 0x1
+ #define PHANDLE_EPAPR 0x2
+@@ -88,7 +89,7 @@ struct data {
+ };
+
+
+-#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
++#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
+
+ #define for_each_marker(m) \
+ for (; (m); (m) = (m)->next)
+@@ -118,7 +119,7 @@ struct data data_append_align(struct data d, int align);
+
+ struct data data_add_marker(struct data d, enum markertype type, char *ref);
+
+-int data_is_one_string(struct data d);
++bool data_is_one_string(struct data d);
+
+ /* DT constraints */
+
+@@ -127,13 +128,33 @@ int data_is_one_string(struct data d);
+
+ /* Live trees */
+ struct label {
+- int deleted;
++ bool deleted;
+ char *label;
+ struct label *next;
+ };
+
++struct fixup_entry {
++ int offset;
++ struct node *node;
++ struct property *prop;
++ struct fixup_entry *next;
++ bool local_fixup_generated;
++};
++
++struct fixup {
++ char *ref;
++ struct fixup_entry *entries;
++ struct fixup *next;
++};
++
++struct symbol {
++ struct label *label;
++ struct node *node;
++ struct symbol *next;
++};
++
+ struct property {
+- int deleted;
++ bool deleted;
+ char *name;
+ struct data val;
+
+@@ -143,7 +164,7 @@ struct property {
+ };
+
+ struct node {
+- int deleted;
++ bool deleted;
+ char *name;
+ struct property *proplist;
+ struct node *children;
+@@ -158,6 +179,13 @@ struct node {
+ int addr_cells, size_cells;
+
+ struct label *labels;
++
++ struct symbol *symbols;
++ struct fixup_entry *local_fixups;
++ bool emit_local_fixup_node;
++
++ bool is_plugin;
++ struct fixup *fixups;
+ };
+
+ #define for_each_label_withdel(l0, l) \
+@@ -181,6 +209,18 @@ struct node {
+ for_each_child_withdel(n, c) \
+ if (!(c)->deleted)
+
++#define for_each_fixup(n, f) \
++ for ((f) = (n)->fixups; (f); (f) = (f)->next)
++
++#define for_each_fixup_entry(f, fe) \
++ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
++
++#define for_each_symbol(n, s) \
++ for ((s) = (n)->symbols; (s); (s) = (s)->next)
++
++#define for_each_local_fixup_entry(n, fe) \
++ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
++
+ void add_label(struct label **labels, char *label);
+ void delete_labels(struct label **labels);
+
+@@ -247,8 +287,8 @@ void sort_tree(struct boot_info *bi);
+
+ /* Checks */
+
+-void parse_checks_option(bool warn, bool error, const char *optarg);
+-void process_checks(int force, struct boot_info *bi);
++void parse_checks_option(bool warn, bool error, const char *arg);
++void process_checks(bool force, struct boot_info *bi);
+
+ /* Flattened trees */
+
+diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c
+index 665dad7..2385137 100644
+--- a/scripts/dtc/flattree.c
++++ b/scripts/dtc/flattree.c
+@@ -255,13 +255,211 @@ static int stringtable_insert(struct data *d, const char *str)
+ return i;
+ }
+
++static void emit_local_fixups(struct node *tree, struct emitter *emit,
++ void *etarget, struct data *strbuf, struct version_info *vi,
++ struct node *node)
++{
++ struct fixup_entry *fe, *fen;
++ struct node *child;
++ int nameoff, count;
++ cell_t *buf;
++ struct data d;
++
++ if (node->emit_local_fixup_node) {
++
++ /* emit the external fixups (do not emit /) */
++ if (node != tree) {
++ emit->beginnode(etarget, NULL);
++ emit->string(etarget, node->name, 0);
++ emit->align(etarget, sizeof(cell_t));
++ }
++
++ for_each_local_fixup_entry(tree, fe) {
++ if (fe->node != node || fe->local_fixup_generated)
++ continue;
++
++ /* count the number of fixup entries */
++ count = 0;
++ for_each_local_fixup_entry(tree, fen) {
++ if (fen->prop != fe->prop)
++ continue;
++ fen->local_fixup_generated = true;
++ count++;
++ }
++
++ /* allocate buffer */
++ buf = xmalloc(count * sizeof(cell_t));
++
++ /* collect all the offsets in buffer */
++ count = 0;
++ for_each_local_fixup_entry(tree, fen) {
++ if (fen->prop != fe->prop)
++ continue;
++ fen->local_fixup_generated = true;
++ buf[count++] = cpu_to_fdt32(fen->offset);
++ }
++ d = empty_data;
++ d.len = count * sizeof(cell_t);
++ d.val = (char *)buf;
++
++ nameoff = stringtable_insert(strbuf, fe->prop->name);
++ emit->property(etarget, fe->prop->labels);
++ emit->cell(etarget, count * sizeof(cell_t));
++ emit->cell(etarget, nameoff);
++
++ if ((vi->flags & FTF_VARALIGN) &&
++ (count * sizeof(cell_t)) >= 8)
++ emit->align(etarget, 8);
++
++ emit->data(etarget, d);
++ emit->align(etarget, sizeof(cell_t));
++
++ free(buf);
++ }
++ }
++
++ for_each_child(node, child)
++ emit_local_fixups(tree, emit, etarget, strbuf, vi, child);
++
++ if (node->emit_local_fixup_node && node != tree)
++ emit->endnode(etarget, tree->labels);
++}
++
++static void emit_symbols_node(struct node *tree, struct emitter *emit,
++ void *etarget, struct data *strbuf,
++ struct version_info *vi)
++{
++ struct symbol *sym;
++ int nameoff, vallen;
++
++ /* do nothing if no symbols */
++ if (!tree->symbols)
++ return;
++
++ emit->beginnode(etarget, NULL);
++ emit->string(etarget, "__symbols__", 0);
++ emit->align(etarget, sizeof(cell_t));
++
++ for_each_symbol(tree, sym) {
++
++ vallen = strlen(sym->node->fullpath);
++
++ nameoff = stringtable_insert(strbuf, sym->label->label);
++
++ emit->property(etarget, NULL);
++ emit->cell(etarget, vallen + 1);
++ emit->cell(etarget, nameoff);
++
++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
++ emit->align(etarget, 8);
++
++ emit->string(etarget, sym->node->fullpath,
++ strlen(sym->node->fullpath));
++ emit->align(etarget, sizeof(cell_t));
++ }
++
++ emit->endnode(etarget, NULL);
++}
++
++static void emit_local_fixups_node(struct node *tree, struct emitter *emit,
++ void *etarget, struct data *strbuf,
++ struct version_info *vi)
++{
++ struct fixup_entry *fe;
++ struct node *node;
++
++ /* do nothing if no local fixups */
++ if (!tree->local_fixups)
++ return;
++
++ /* mark all nodes that need a local fixup generated (and parents) */
++ for_each_local_fixup_entry(tree, fe) {
++ node = fe->node;
++ while (node != NULL && !node->emit_local_fixup_node) {
++ node->emit_local_fixup_node = true;
++ node = node->parent;
++ }
++ }
++
++ /* emit the local fixups node now */
++ emit->beginnode(etarget, NULL);
++ emit->string(etarget, "__local_fixups__", 0);
++ emit->align(etarget, sizeof(cell_t));
++
++ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree);
++
++ emit->endnode(etarget, tree->labels);
++}
++
++static void emit_fixups_node(struct node *tree, struct emitter *emit,
++ void *etarget, struct data *strbuf,
++ struct version_info *vi)
++{
++ struct fixup *f;
++ struct fixup_entry *fe;
++ char *name, *s;
++ const char *fullpath;
++ int namesz, nameoff, vallen;
++
++ /* do nothing if no fixups */
++ if (!tree->fixups)
++ return;
++
++ /* emit the external fixups */
++ emit->beginnode(etarget, NULL);
++ emit->string(etarget, "__fixups__", 0);
++ emit->align(etarget, sizeof(cell_t));
++
++ for_each_fixup(tree, f) {
++
++ namesz = 0;
++ for_each_fixup_entry(f, fe) {
++ fullpath = fe->node->fullpath;
++ if (fullpath[0] == '\0')
++ fullpath = "/";
++ namesz += strlen(fullpath) + 1;
++ namesz += strlen(fe->prop->name) + 1;
++ namesz += 32; /* space for :<number> + '\0' */
++ }
++
++ name = xmalloc(namesz);
++
++ s = name;
++ for_each_fixup_entry(f, fe) {
++ fullpath = fe->node->fullpath;
++ if (fullpath[0] == '\0')
++ fullpath = "/";
++ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath,
++ fe->prop->name, fe->offset);
++ s += strlen(s) + 1;
++ }
++
++ nameoff = stringtable_insert(strbuf, f->ref);
++ vallen = s - name - 1;
++
++ emit->property(etarget, NULL);
++ emit->cell(etarget, vallen + 1);
++ emit->cell(etarget, nameoff);
++
++ if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
++ emit->align(etarget, 8);
++
++ emit->string(etarget, name, vallen);
++ emit->align(etarget, sizeof(cell_t));
++
++ free(name);
++ }
++
++ emit->endnode(etarget, tree->labels);
++}
++
+ static void flatten_tree(struct node *tree, struct emitter *emit,
+ void *etarget, struct data *strbuf,
+ struct version_info *vi)
+ {
+ struct property *prop;
+ struct node *child;
+- int seen_name_prop = 0;
++ bool seen_name_prop = false;
+
+ if (tree->deleted)
+ return;
+@@ -279,7 +477,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
+ int nameoff;
+
+ if (streq(prop->name, "name"))
+- seen_name_prop = 1;
++ seen_name_prop = true;
+
+ nameoff = stringtable_insert(strbuf, prop->name);
+
+@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
+ flatten_tree(child, emit, etarget, strbuf, vi);
+ }
+
++ emit_symbols_node(tree, emit, etarget, strbuf, vi);
++ emit_local_fixups_node(tree, emit, etarget, strbuf, vi);
++ emit_fixups_node(tree, emit, etarget, strbuf, vi);
++
+ emit->endnode(etarget, tree->labels);
+ }
+
+diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c
+index e464727..6d1beec 100644
+--- a/scripts/dtc/fstree.c
++++ b/scripts/dtc/fstree.c
+@@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname)
+ tree = build_node(NULL, NULL);
+
+ while ((de = readdir(d)) != NULL) {
+- char *tmpnam;
++ char *tmpname;
+
+ if (streq(de->d_name, ".")
+ || streq(de->d_name, ".."))
+ continue;
+
+- tmpnam = join_path(dirname, de->d_name);
++ tmpname = join_path(dirname, de->d_name);
+
+- if (lstat(tmpnam, &st) < 0)
+- die("stat(%s): %s\n", tmpnam, strerror(errno));
++ if (lstat(tmpname, &st) < 0)
++ die("stat(%s): %s\n", tmpname, strerror(errno));
+
+ if (S_ISREG(st.st_mode)) {
+ struct property *prop;
+ FILE *pfile;
+
+- pfile = fopen(tmpnam, "r");
++ pfile = fopen(tmpname, "rb");
+ if (! pfile) {
+ fprintf(stderr,
+ "WARNING: Cannot open %s: %s\n",
+- tmpnam, strerror(errno));
++ tmpname, strerror(errno));
+ } else {
+ prop = build_property(xstrdup(de->d_name),
+ data_copy_file(pfile,
+@@ -67,12 +67,12 @@ static struct node *read_fstree(const char *dirname)
+ } else if (S_ISDIR(st.st_mode)) {
+ struct node *newchild;
+
+- newchild = read_fstree(tmpnam);
++ newchild = read_fstree(tmpname);
+ newchild = name_node(newchild, xstrdup(de->d_name));
+ add_child(tree, newchild);
+ }
+
+- free(tmpnam);
++ free(tmpname);
+ }
+
+ closedir(d);
+@@ -88,3 +88,4 @@ struct boot_info *dt_from_fs(const char *dirname)
+
+ return build_boot_info(NULL, tree, guess_boot_cpuid(tree));
+ }
++
+diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
+index b61465f..e229b84 100644
+--- a/scripts/dtc/livetree.c
++++ b/scripts/dtc/livetree.c
+@@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle)
+
+ struct node *get_node_by_ref(struct node *tree, const char *ref)
+ {
+- if (ref[0] == '/')
++ if (streq(ref, "/"))
++ return tree;
++ else if (ref[0] == '/')
+ return get_node_by_path(tree, ref);
+ else
+ return get_node_by_label(tree, ref);
+diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c
+index c20bc53..f534c22 100644
+--- a/scripts/dtc/srcpos.c
++++ b/scripts/dtc/srcpos.c
+@@ -34,7 +34,7 @@ struct search_path {
+ static struct search_path *search_path_head, **search_path_tail;
+
+
+-static char *dirname(const char *path)
++static char *get_dirname(const char *path)
+ {
+ const char *slash = strrchr(path, '/');
+
+@@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp)
+ else
+ fullname = join_path(dirname, fname);
+
+- *fp = fopen(fullname, "r");
++ *fp = fopen(fullname, "rb");
+ if (!*fp) {
+ free(fullname);
+ fullname = NULL;
+@@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
+ srcfile = xmalloc(sizeof(*srcfile));
+
+ srcfile->f = srcfile_relative_open(fname, &srcfile->name);
+- srcfile->dir = dirname(srcfile->name);
++ srcfile->dir = get_dirname(srcfile->name);
+ srcfile->prev = current_srcfile;
+
+ srcfile->lineno = 1;
+@@ -159,7 +159,7 @@ void srcfile_push(const char *fname)
+ current_srcfile = srcfile;
+ }
+
+-int srcfile_pop(void)
++bool srcfile_pop(void)
+ {
+ struct srcfile_state *srcfile = current_srcfile;
+
+@@ -177,7 +177,7 @@ int srcfile_pop(void)
+ * fix this we could either allocate all the files from a
+ * table, or use a pool allocator. */
+
+- return current_srcfile ? 1 : 0;
++ return current_srcfile ? true : false;
+ }
+
+ void srcfile_add_search_path(const char *dirname)
+@@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos)
+ return pos_str;
+ }
+
+-void
+-srcpos_verror(struct srcpos *pos, char const *fmt, va_list va)
++void srcpos_verror(struct srcpos *pos, const char *prefix,
++ const char *fmt, va_list va)
+ {
+- const char *srcstr;
+-
+- srcstr = srcpos_string(pos);
++ char *srcstr;
+
+- fprintf(stderr, "Error: %s ", srcstr);
+- vfprintf(stderr, fmt, va);
+- fprintf(stderr, "\n");
+-}
++ srcstr = srcpos_string(pos);
+
+-void
+-srcpos_error(struct srcpos *pos, char const *fmt, ...)
+-{
+- va_list va;
++ fprintf(stderr, "%s: %s ", prefix, srcstr);
++ vfprintf(stderr, fmt, va);
++ fprintf(stderr, "\n");
+
+- va_start(va, fmt);
+- srcpos_verror(pos, fmt, va);
+- va_end(va);
++ free(srcstr);
+ }
+
+-
+-void
+-srcpos_warn(struct srcpos *pos, char const *fmt, ...)
++void srcpos_error(struct srcpos *pos, const char *prefix,
++ const char *fmt, ...)
+ {
+- const char *srcstr;
+ va_list va;
+- va_start(va, fmt);
+-
+- srcstr = srcpos_string(pos);
+-
+- fprintf(stderr, "Warning: %s ", srcstr);
+- vfprintf(stderr, fmt, va);
+- fprintf(stderr, "\n");
+
++ va_start(va, fmt);
++ srcpos_verror(pos, prefix, fmt, va);
+ va_end(va);
+ }
+
+diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h
+index 93a2712..f81827b 100644
+--- a/scripts/dtc/srcpos.h
++++ b/scripts/dtc/srcpos.h
+@@ -21,6 +21,7 @@
+ #define _SRCPOS_H_
+
+ #include <stdio.h>
++#include <stdbool.h>
+
+ struct srcfile_state {
+ FILE *f;
+@@ -55,7 +56,7 @@ extern struct srcfile_state *current_srcfile; /* = NULL */
+ FILE *srcfile_relative_open(const char *fname, char **fullnamep);
+
+ void srcfile_push(const char *fname);
+-int srcfile_pop(void);
++bool srcfile_pop(void);
+
+ /**
+ * Add a new directory to the search path for input files
+@@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct srcpos *pos);
+ extern char *srcpos_string(struct srcpos *pos);
+ extern void srcpos_dump(struct srcpos *pos);
+
+-extern void srcpos_verror(struct srcpos *pos, char const *, va_list va)
+- __attribute__((format(printf, 2, 0)));
+-extern void srcpos_error(struct srcpos *pos, char const *, ...)
+- __attribute__((format(printf, 2, 3)));
+-extern void srcpos_warn(struct srcpos *pos, char const *, ...)
+- __attribute__((format(printf, 2, 3)));
++extern void srcpos_verror(struct srcpos *pos, const char *prefix,
++ const char *fmt, va_list va)
++ __attribute__((format(printf, 3, 0)));
++extern void srcpos_error(struct srcpos *pos, const char *prefix,
++ const char *fmt, ...)
++ __attribute__((format(printf, 3, 4)));
+
+ extern void srcpos_set_line(char *f, int l);
+
+diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c
+index 5740e69..a55d1d1 100644
+--- a/scripts/dtc/treesource.c
++++ b/scripts/dtc/treesource.c
+@@ -26,12 +26,12 @@ extern int yyparse(void);
+ extern YYLTYPE yylloc;
+
+ struct boot_info *the_boot_info;
+-int treesource_error;
++bool treesource_error;
+
+ struct boot_info *dt_from_source(const char *fname)
+ {
+ the_boot_info = NULL;
+- treesource_error = 0;
++ treesource_error = false;
+
+ srcfile_push(fname);
+ yyin = current_srcfile->f;
+@@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int level)
+ fputc('\t', f);
+ }
+
+-static int isstring(char c)
++static bool isstring(char c)
+ {
+- return (isprint(c)
++ return (isprint((unsigned char)c)
+ || (c == '\0')
+ || strchr("\a\b\t\n\v\f\r", c));
+ }
+@@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val)
+ break;
+ case '\0':
+ fprintf(f, "\", ");
+- while (m && (m->offset < i)) {
++ while (m && (m->offset <= (i + 1))) {
+ if (m->type == LABEL) {
+ assert(m->offset == (i+1));
+ fprintf(f, "%s: ", m->ref);
+@@ -119,7 +119,7 @@ static void write_propval_string(FILE *f, struct data val)
+ fprintf(f, "\"");
+ break;
+ default:
+- if (isprint(c))
++ if (isprint((unsigned char)c))
+ fprintf(f, "%c", c);
+ else
+ fprintf(f, "\\x%02hhx", c);
+@@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val)
+ m = m->next;
+ }
+
+- fprintf(f, "%02hhx", *bp++);
++ fprintf(f, "%02hhx", (unsigned char)(*bp++));
+ if ((const void *)bp >= propend)
+ break;
+ fprintf(f, " ");
+@@ -281,3 +281,4 @@ void dt_to_source(FILE *f, struct boot_info *bi)
+
+ write_tree_source_node(f, bi->dt, 0);
+ }
++
+diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
+index 3055c16..9d65226 100644
+--- a/scripts/dtc/util.c
++++ b/scripts/dtc/util.c
+@@ -39,11 +39,11 @@
+ char *xstrdup(const char *s)
+ {
+ int len = strlen(s) + 1;
+- char *dup = xmalloc(len);
++ char *d = xmalloc(len);
+
+- memcpy(dup, s, len);
++ memcpy(d, s, len);
+
+- return dup;
++ return d;
+ }
+
+ char *join_path(const char *path, const char *name)
+@@ -70,7 +70,7 @@ char *join_path(const char *path, const char *name)
+ return str;
+ }
+
+-int util_is_printable_string(const void *data, int len)
++bool util_is_printable_string(const void *data, int len)
+ {
+ const char *s = data;
+ const char *ss, *se;
+@@ -87,7 +87,7 @@ int util_is_printable_string(const void *data, int len)
+
+ while (s < se) {
+ ss = s;
+- while (s < se && *s && isprint(*s))
++ while (s < se && *s && isprint((unsigned char)*s))
+ s++;
+
+ /* not zero, or not done yet */
+@@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len)
+ if (offset == bufsize) {
+ bufsize *= 2;
+ buf = xrealloc(buf, bufsize);
+- if (!buf) {
+- ret = ENOMEM;
+- break;
+- }
+ }
+
+ ret = read(fd, &buf[offset], bufsize - offset);
+@@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data, int len)
+ const uint32_t *cell = (const uint32_t *)data;
+
+ printf(" = <");
+- for (i = 0; i < len; i += 4)
++ for (i = 0, len /= 4; i < len; i++)
+ printf("0x%08x%s", fdt32_to_cpu(cell[i]),
+- i < (len - 4) ? " " : "");
++ i < (len - 1) ? " " : "");
+ printf(">");
+ } else {
+ printf(" = [");
+diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h
+index 8f40b44..ccfdf4b 100644
+--- a/scripts/dtc/util.h
++++ b/scripts/dtc/util.h
+@@ -2,6 +2,7 @@
+ #define _UTIL_H
+
+ #include <stdarg.h>
++#include <stdbool.h>
+ #include <getopt.h>
+
+ /*
+@@ -68,7 +69,7 @@ extern char *join_path(const char *path, const char *name);
+ * @param len The string length including terminator
+ * @return 1 if a valid printable string, 0 if not
+ */
+-int util_is_printable_string(const void *data, int len);
++bool util_is_printable_string(const void *data, int len);
+
+ /*
+ * Parse an escaped character starting at index i in string s. The resulting
+diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h
+index 54d4e90..571f1f5 100644
+--- a/scripts/dtc/version_gen.h
++++ b/scripts/dtc/version_gen.h
+@@ -1 +1 @@
+-#define DTC_VERSION "DTC 1.4.0-dirty"
++#define DTC_VERSION "DTC 1.4.0-g5b11b842-dirty"
diff --git a/recipes-kernel/linux/linux-3.19/overlay-patches/v8-3-8-OF-DT-Overlay-configfs-interface-v2.patch b/recipes-kernel/linux/linux-3.19/overlay-patches/v8-3-8-OF-DT-Overlay-configfs-interface-v2.patch
new file mode 100755
index 0000000..8ede583
--- /dev/null
+++ b/recipes-kernel/linux/linux-3.19/overlay-patches/v8-3-8-OF-DT-Overlay-configfs-interface-v2.patch
@@ -0,0 +1,374 @@
+diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
+index aa315c4..d59ba40 100644
+--- a/drivers/of/Kconfig
++++ b/drivers/of/Kconfig
+@@ -90,4 +90,11 @@ config OF_OVERLAY
+ select OF_DEVICE
+ select OF_RESOLVE
+
++config OF_CONFIGFS
++ bool "OpenFirmware Overlay ConfigFS interface"
++ select CONFIGFS_FS
++ select OF_OVERLAY
++ help
++ Enable a simple user-space driver DT overlay interface.
++
+ endmenu # OF
+diff --git a/drivers/of/Makefile b/drivers/of/Makefile
+index 1bfe462..6d12949 100644
+--- a/drivers/of/Makefile
++++ b/drivers/of/Makefile
+@@ -15,6 +15,7 @@ obj-$(CONFIG_OF_MTD) += of_mtd.o
+ obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
+ obj-$(CONFIG_OF_RESOLVE) += resolver.o
+ obj-$(CONFIG_OF_OVERLAY) += overlay.o
++obj-$(CONFIG_OF_CONFIGFS) += configfs.o
+
+ CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
+ CFLAGS_fdt_address.o = -I$(src)/../../scripts/dtc/libfdt
+diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
+new file mode 100644
+index 0000000..932f572
+--- /dev/null
++++ b/drivers/of/configfs.c
+@@ -0,0 +1,340 @@
++/*
++ * Configfs entries for device-tree
++ *
++ * Copyright (C) 2013 - Pantelis Antoniou <panto@antoniou-consulting.com>
++ *
++ * 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.
++ */
++#include <linux/ctype.h>
++#include <linux/cpu.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/of_fdt.h>
++#include <linux/spinlock.h>
++#include <linux/slab.h>
++#include <linux/proc_fs.h>
++#include <linux/configfs.h>
++#include <linux/types.h>
++#include <linux/stat.h>
++#include <linux/limits.h>
++#include <linux/file.h>
++#include <linux/vmalloc.h>
++#include <linux/firmware.h>
++
++#include "of_private.h"
++
++#ifdef CONFIG_OF_OVERLAY
++
++struct cfs_overlay_item {
++ struct config_item item;
++
++ char path[PATH_MAX];
++
++ const struct firmware *fw;
++ struct device_node *overlay;
++ int ov_id;
++
++ void *dtbo;
++ int dtbo_size;
++};
++
++static int create_overlay(struct cfs_overlay_item *overlay, void *blob)
++{
++ int err;
++
++ /* unflatten the tree */
++ of_fdt_unflatten_tree((void *)blob, &overlay->overlay);
++ if (overlay->overlay == NULL) {
++ pr_err("%s: failed to unflatten tree\n", __func__);
++ err = -EINVAL;
++ goto out_err;
++ }
++ pr_debug("%s: unflattened OK\n", __func__);
++
++ /* mark it as detached */
++ of_node_set_flag(overlay->overlay, OF_DETACHED);
++
++ /* perform resolution */
++ err = of_resolve_phandles(overlay->overlay);
++ if (err != 0) {
++ pr_err("%s: Failed to resolve tree\n", __func__);
++ goto out_err;
++ }
++ pr_debug("%s: resolved OK\n", __func__);
++
++ err = of_overlay_create(overlay->overlay);
++ if (err < 0) {
++ pr_err("%s: Failed to create overlay (err=%d)\n",
++ __func__, err);
++ goto out_err;
++ }
++ overlay->ov_id = err;
++
++out_err:
++ return err;
++}
++
++static inline struct cfs_overlay_item *to_cfs_overlay_item(
++ struct config_item *item)
++{
++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL;
++}
++
++CONFIGFS_ATTR_STRUCT(cfs_overlay_item);
++#define CFS_OVERLAY_ITEM_ATTR(_name, _mode, _show, _store) \
++struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
++ __CONFIGFS_ATTR(_name, _mode, _show, _store)
++#define CFS_OVERLAY_ITEM_ATTR_RO(_name, _show) \
++struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
++ __CONFIGFS_ATTR_RO(_name, _show)
++
++CONFIGFS_BIN_ATTR_STRUCT(cfs_overlay_item);
++#define CFS_OVERLAY_ITEM_BIN_ATTR(_name, _mode, _read, _write, _priv, _max) \
++struct cfs_overlay_item_bin_attribute cfs_overlay_item_bin_attr_##_name = \
++ __CONFIGFS_BIN_ATTR(_name, _mode, _read, _write, _priv, _max)
++#define CFS_OVERLAY_ITEM_BIN_ATTR_RO(_name, _read, _priv, _max) \
++struct cfs_overlay_item_bin_attribute cfs_overlay_item_bin_attr_##_name = \
++ __CONFIGFS_BIN_ATTR_RO(_name, _read, _priv, _max)
++
++static ssize_t cfs_overlay_item_path_show(struct cfs_overlay_item *overlay,
++ char *page)
++{
++ return sprintf(page, "%s\n", overlay->path);
++}
++
++static ssize_t cfs_overlay_item_path_store(struct cfs_overlay_item *overlay,
++ const char *page, size_t count)
++{
++ const char *p = page;
++ char *s;
++ int err;
++
++ /* if it's set do not allow changes */
++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0)
++ return -EPERM;
++
++ /* copy to path buffer (and make sure it's always zero terminated */
++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p);
++ overlay->path[sizeof(overlay->path) - 1] = '\0';
++
++ /* strip trailing newlines */
++ s = overlay->path + strlen(overlay->path);
++ while (s > overlay->path && *--s == '\n')
++ *s = '\0';
++
++ pr_debug("%s: path is '%s'\n", __func__, overlay->path);
++
++ err = request_firmware(&overlay->fw, overlay->path, NULL);
++ if (err != 0)
++ goto out_err;
++
++ err = create_overlay(overlay, (void *)overlay->fw->data);
++ if (err != 0)
++ goto out_err;
++
++ return count;
++
++out_err:
++
++ release_firmware(overlay->fw);
++ overlay->fw = NULL;
++
++ overlay->path[0] = '\0';
++ return err;
++}
++
++static ssize_t cfs_overlay_item_status_show(struct cfs_overlay_item *overlay,
++ char *page)
++{
++ return sprintf(page, "%s\n",
++ overlay->ov_id >= 0 ? "applied" : "unapplied");
++}
++
++CFS_OVERLAY_ITEM_ATTR(path, S_IRUGO | S_IWUSR,
++ cfs_overlay_item_path_show, cfs_overlay_item_path_store);
++CFS_OVERLAY_ITEM_ATTR_RO(status, cfs_overlay_item_status_show);
++
++static struct configfs_attribute *cfs_overlay_attrs[] = {
++ &cfs_overlay_item_attr_path.attr,
++ &cfs_overlay_item_attr_status.attr,
++ NULL,
++};
++
++ssize_t cfs_overlay_item_dtbo_read(struct cfs_overlay_item *overlay,
++ void *buf, size_t max_count)
++{
++ pr_debug("%s: buf=%p max_count=%u\n", __func__,
++ buf, max_count);
++
++ if (overlay->dtbo == NULL)
++ return 0;
++
++ /* copy if buffer provided */
++ if (buf != NULL) {
++ /* the buffer must be large enough */
++ if (overlay->dtbo_size > max_count)
++ return -ENOSPC;
++
++ memcpy(buf, overlay->dtbo, overlay->dtbo_size);
++ }
++
++ return overlay->dtbo_size;
++}
++
++ssize_t cfs_overlay_item_dtbo_write(struct cfs_overlay_item *overlay,
++ const void *buf, size_t count)
++{
++ int err;
++
++ /* if it's set do not allow changes */
++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0)
++ return -EPERM;
++
++ /* copy the contents */
++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL);
++ if (overlay->dtbo == NULL)
++ return -ENOMEM;
++
++ overlay->dtbo_size = count;
++
++ err = create_overlay(overlay, overlay->dtbo);
++ if (err != 0)
++ goto out_err;
++
++ return count;
++
++out_err:
++ kfree(overlay->dtbo);
++ overlay->dtbo = NULL;
++ overlay->dtbo_size = 0;
++
++ return err;
++}
++
++CFS_OVERLAY_ITEM_BIN_ATTR(dtbo, S_IRUGO | S_IWUSR,
++ cfs_overlay_item_dtbo_read, cfs_overlay_item_dtbo_write,
++ NULL, SZ_1M);
++
++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = {
++ &cfs_overlay_item_bin_attr_dtbo.bin_attr,
++ NULL,
++};
++
++static void cfs_overlay_release(struct config_item *item)
++{
++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
++
++ if (overlay->ov_id >= 0)
++ of_overlay_destroy(overlay->ov_id);
++ if (overlay->fw)
++ release_firmware(overlay->fw);
++ /* kfree with NULL is safe */
++ kfree(overlay->dtbo);
++ kfree(overlay);
++}
++
++CONFIGFS_ATTR_OPS(cfs_overlay_item);
++CONFIGFS_BIN_ATTR_OPS(cfs_overlay_item);
++static struct configfs_item_operations cfs_overlay_item_ops = {
++ .release = cfs_overlay_release,
++ .show_attribute = cfs_overlay_item_attr_show,
++ .store_attribute = cfs_overlay_item_attr_store,
++ .read_bin_attribute = cfs_overlay_item_bin_attr_read,
++ .write_bin_attribute = cfs_overlay_item_bin_attr_write,
++};
++
++static struct config_item_type cfs_overlay_type = {
++ .ct_item_ops = &cfs_overlay_item_ops,
++ .ct_attrs = cfs_overlay_attrs,
++ .ct_bin_attrs = cfs_overlay_bin_attrs,
++ .ct_owner = THIS_MODULE,
++};
++
++static struct config_item *cfs_overlay_group_make_item(
++ struct config_group *group, const char *name)
++{
++ struct cfs_overlay_item *overlay;
++
++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
++ if (!overlay)
++ return ERR_PTR(-ENOMEM);
++ overlay->ov_id = -1;
++
++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type);
++ return &overlay->item;
++}
++
++static void cfs_overlay_group_drop_item(struct config_group *group,
++ struct config_item *item)
++{
++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
++
++ config_item_put(&overlay->item);
++}
++
++static struct configfs_group_operations overlays_ops = {
++ .make_item = cfs_overlay_group_make_item,
++ .drop_item = cfs_overlay_group_drop_item,
++};
++
++static struct config_item_type overlays_type = {
++ .ct_group_ops = &overlays_ops,
++ .ct_owner = THIS_MODULE,
++};
++
++#endif /* CONFIG_OF_OVERLAY */
++
++static struct configfs_group_operations of_cfs_ops = {
++ /* empty - we don't allow anything to be created */
++};
++
++static struct config_item_type of_cfs_type = {
++ .ct_group_ops = &of_cfs_ops,
++ .ct_owner = THIS_MODULE,
++};
++
++struct config_group of_cfs_overlay_group;
++
++struct config_group *of_cfs_def_groups[] = {
++#ifdef CONFIG_OF_OVERLAY
++ &of_cfs_overlay_group,
++#endif
++ NULL
++};
++
++static struct configfs_subsystem of_cfs_subsys = {
++ .su_group = {
++ .cg_item = {
++ .ci_namebuf = "device-tree",
++ .ci_type = &of_cfs_type,
++ },
++ .default_groups = of_cfs_def_groups,
++ },
++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex),
++};
++
++static int __init of_cfs_init(void)
++{
++ int ret;
++
++ pr_info("%s\n", __func__);
++
++ config_group_init(&of_cfs_subsys.su_group);
++#ifdef CONFIG_OF_OVERLAY
++ config_group_init_type_name(&of_cfs_overlay_group, "overlays",
++ &overlays_type);
++#endif
++
++ ret = configfs_register_subsystem(&of_cfs_subsys);
++ if (ret != 0) {
++ pr_err("%s: failed to register subsys\n", __func__);
++ goto out;
++ }
++ pr_info("%s: OK\n", __func__);
++out:
++ return ret;
++}
++late_initcall(of_cfs_init);