<p>Furquan Shaikh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27206">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">util/sconfig: Add support for overriding base tree properties/node<br><br>This change adds support to allow variants to override the devices and<br>properties in base device tree by providing an override device<br>tree. It works as follows:<br>1. Both base and override device trees are parsed from provided input<br>files.<br>2. Walk through the trees in lockstep fashion using depth-first<br>traversal checking if a node in override tree has a matching node in<br>base tree.<br> - If matching node is found, then update the properties of base node<br> using the override node. Continue walking the children of the nodes.<br> - If matching node is not found, then copy the entire override<br> subtree of the node under the current base parent. In addition to<br> that, chip instance pointers of the nodes in override tree need to be<br> updated if they were pointing to the override parents chip instance.<br><br>Since chip always expects a device to be present, it leads to a<br>side-effect that overriding chip registers requires that a device is<br>always provided for the chip in the override tree as well.<br><br>BUG=b:80081934<br><br>Change-Id: I6604e4f8abe3fc48240e942fea32da96031e1e46<br>Signed-off-by: Furquan Shaikh <furquan@google.com><br>---<br>M util/sconfig/main.c<br>1 file changed, 258 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/27206/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/util/sconfig/main.c b/util/sconfig/main.c</span><br><span>index 91b3ec4..168262d 100644</span><br><span>--- a/util/sconfig/main.c</span><br><span>+++ b/util/sconfig/main.c</span><br><span>@@ -334,6 +334,43 @@</span><br><span> return instance;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void delete_chip_instance(struct chip_instance *ins)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct chip *c = ins->chip;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct chip_instance *i = c->instance;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If chip instance to be deleted is the first instance, then update</span><br><span style="color: hsl(120, 100%, 40%);">+ * instance pointer of the chip as well.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (i == ins) {</span><br><span style="color: hsl(120, 100%, 40%);">+ c->instance = ins->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ free(ins);</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Loop through the instances list of the chip to find and remove the</span><br><span style="color: hsl(120, 100%, 40%);">+ * given instance.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ while (1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (i == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+ printf("ERROR: chip instance not found!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ exit(1);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (i->next != ins) {</span><br><span style="color: hsl(120, 100%, 40%);">+ i = i->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ i->next = ins->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ free(ins);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*</span><br><span> * Allocate a new bus for the provided device.</span><br><span> * - If this is the first bus being allocated under this device, then its id</span><br><span>@@ -402,6 +439,23 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Add given node as child of the provided parent. If this is the first child of</span><br><span style="color: hsl(120, 100%, 40%);">+ * the parent, update parent->children pointer as well.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void set_new_child(struct bus *parent, struct device *child)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct device *c = parent->children;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (c) {</span><br><span style="color: hsl(120, 100%, 40%);">+ while (c->sibling)</span><br><span style="color: hsl(120, 100%, 40%);">+ c = c->sibling;</span><br><span style="color: hsl(120, 100%, 40%);">+ c->sibling = child;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else</span><br><span style="color: hsl(120, 100%, 40%);">+ parent->children = child;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ child->parent = parent;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> struct device *new_device(struct bus *parent,</span><br><span> struct chip_instance *chip_instance,</span><br><span> const int bustype, const char *devnum,</span><br><span>@@ -439,13 +493,7 @@</span><br><span> new_d->enabled = enabled;</span><br><span> new_d->chip_instance = chip_instance;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- struct device *c = parent->children;</span><br><span style="color: hsl(0, 100%, 40%);">- if (c) {</span><br><span style="color: hsl(0, 100%, 40%);">- while (c->sibling)</span><br><span style="color: hsl(0, 100%, 40%);">- c = c->sibling;</span><br><span style="color: hsl(0, 100%, 40%);">- c->sibling = new_d;</span><br><span style="color: hsl(0, 100%, 40%);">- } else</span><br><span style="color: hsl(0, 100%, 40%);">- parent->children = new_d;</span><br><span style="color: hsl(120, 100%, 40%);">+ set_new_child(parent, new_d);</span><br><span> </span><br><span> switch (bustype) {</span><br><span> case PCI:</span><br><span>@@ -500,9 +548,8 @@</span><br><span> return new_d;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void add_resource(struct bus *bus, int type, int index, int base)</span><br><span style="color: hsl(120, 100%, 40%);">+static void new_resource(struct device *dev, int type, int index, int base)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct device *dev = bus->dev;</span><br><span> struct resource *r = S_ALLOC(sizeof(struct resource));</span><br><span> </span><br><span> r->type = type;</span><br><span>@@ -518,6 +565,11 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void add_resource(struct bus *bus, int type, int index, int base)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ new_resource(bus->dev, type, index, base);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void add_register(struct chip_instance *chip_instance, char *name, char *val)</span><br><span> {</span><br><span> struct reg *r = S_ALLOC(sizeof(struct reg));</span><br><span>@@ -911,6 +963,201 @@</span><br><span> fclose(filec);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Match device nodes from base and override tree to see if they are the same</span><br><span style="color: hsl(120, 100%, 40%);">+ * node.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int device_match(struct device *a, struct device *b)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ return ((a->path_a == b->path_a) &&</span><br><span style="color: hsl(120, 100%, 40%);">+ (a->path_b == b->path_b) &&</span><br><span style="color: hsl(120, 100%, 40%);">+ (a->bustype == b->bustype) &&</span><br><span style="color: hsl(120, 100%, 40%);">+ (a->chip_instance->chip ==</span><br><span style="color: hsl(120, 100%, 40%);">+ b->chip_instance->chip));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Walk through the override subtree in breadth-first manner starting at node to</span><br><span style="color: hsl(120, 100%, 40%);">+ * see if chip_instance pointer of the node is same as chip_instance pointer of</span><br><span style="color: hsl(120, 100%, 40%);">+ * override parent that is passed into the function. If yes, then update the</span><br><span style="color: hsl(120, 100%, 40%);">+ * chip_instance pointer of the node to chip_instance pointer of the base</span><br><span style="color: hsl(120, 100%, 40%);">+ * parent.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void update_chip_pointers(struct device *node,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct chip_instance *base_parent_ci,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct chip_instance *override_parent_ci)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct queue_entry *q_head = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ enqueue_tail(&q_head, node);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while ((node = dequeue_head(&q_head))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (node->chip_instance != override_parent_ci)</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ node->chip_instance = base_parent_ci;</span><br><span style="color: hsl(120, 100%, 40%);">+ add_children_to_queue(&q_head, node);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Add resource to device. If resource is already present, then update its base</span><br><span style="color: hsl(120, 100%, 40%);">+ * and index. If not, then add a new resource to the device.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void update_resource(struct device *dev, struct resource *res)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct resource *base_res = dev->res;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while (base_res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (base_res->type == res->type) {</span><br><span style="color: hsl(120, 100%, 40%);">+ base_res->index = res->index;</span><br><span style="color: hsl(120, 100%, 40%);">+ base_res->base = res->base;</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ base_res = base_res->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ new_resource(dev, res->type, res->index, res->base);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Add register to chip instance. If register is already present, then update</span><br><span style="color: hsl(120, 100%, 40%);">+ * its value. If not, then add a new register to the chip instance.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void update_register(struct chip_instance *c, struct reg *reg)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct reg *base_reg = c->reg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while (base_reg) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcmp(base_reg->key, reg->key)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ base_reg->value = reg->value;</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ base_reg = base_reg->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ add_register(c, reg->key, reg->value);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void override_devicetree(struct bus *base_parent,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bus *override_parent);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If a matching device is found in base tree for the override tree device, then</span><br><span style="color: hsl(120, 100%, 40%);">+ * update the base tree device with the properties from override tree</span><br><span style="color: hsl(120, 100%, 40%);">+ * device. Also, call override_devicetree for all the buses under the override</span><br><span style="color: hsl(120, 100%, 40%);">+ * tree device.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void update_device(struct device *base_dev, struct device *override_dev)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ base_dev->enabled = override_dev->enabled;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (override_dev->subsystem_vendor ||</span><br><span style="color: hsl(120, 100%, 40%);">+ override_dev->subsystem_device) {</span><br><span style="color: hsl(120, 100%, 40%);">+ base_dev->subsystem_vendor = override_dev->subsystem_vendor;</span><br><span style="color: hsl(120, 100%, 40%);">+ base_dev->subsystem_device = override_dev->subsystem_device;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (override_dev->inherit_subsystem)</span><br><span style="color: hsl(120, 100%, 40%);">+ base_dev->inherit_subsystem = override_dev->inherit_subsystem;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ struct resource *res = override_dev->res;</span><br><span style="color: hsl(120, 100%, 40%);">+ while (res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ update_resource(base_dev, res);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = res->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ struct reg *reg = override_dev->chip_instance->reg;</span><br><span style="color: hsl(120, 100%, 40%);">+ while (reg) {</span><br><span style="color: hsl(120, 100%, 40%);">+ update_register(base_dev->chip_instance, reg);</span><br><span style="color: hsl(120, 100%, 40%);">+ reg = reg->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bus *override_bus = override_dev->bus;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bus *base_bus = base_dev->bude;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while (override_bus) {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If we have more buses in override tree device, then allocate</span><br><span style="color: hsl(120, 100%, 40%);">+ * a new bus for the base tree device as well.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!base_bus) {</span><br><span style="color: hsl(120, 100%, 40%);">+ alloc_bus(base_dev);</span><br><span style="color: hsl(120, 100%, 40%);">+ base_bus = base_dev->last_bus;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ override_devicetree(base_dev->bus, override_dev->bus);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ override_bus = override_bus->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ base_bus = base_bus->next;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If override tree device isn't using the same chip instance as its</span><br><span style="color: hsl(120, 100%, 40%);">+ * parent dev, then delete the chip instance of the override tree</span><br><span style="color: hsl(120, 100%, 40%);">+ * device since we would have already copied the registers above.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (override_dev->chip_instance !=</span><br><span style="color: hsl(120, 100%, 40%);">+ override_dev->parent->dev->chip_instance)</span><br><span style="color: hsl(120, 100%, 40%);">+ delete_chip_instance(override_dev->chip_instance);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Perform copy of device and properties from override parent to base parent.</span><br><span style="color: hsl(120, 100%, 40%);">+ * This function walks through the override tree in a depth-first manner</span><br><span style="color: hsl(120, 100%, 40%);">+ * performing following actions:</span><br><span style="color: hsl(120, 100%, 40%);">+ * 1. If matching device is found in base tree, then copy the properties of</span><br><span style="color: hsl(120, 100%, 40%);">+ * override device to base tree device. Call override_devicetree recursively on</span><br><span style="color: hsl(120, 100%, 40%);">+ * the bus of override device.</span><br><span style="color: hsl(120, 100%, 40%);">+ * 2. If matching device is not found in base tree, then set override tree</span><br><span style="color: hsl(120, 100%, 40%);">+ * device as new child of base_parent and update the chip pointers in override</span><br><span style="color: hsl(120, 100%, 40%);">+ * device subtree to ensure the nodes do not point to override tree chip</span><br><span style="color: hsl(120, 100%, 40%);">+ * instance.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void override_devicetree(struct bus *base_parent,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bus *override_parent)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct device *base_child;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct device *override_child = override_parent->children;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct device *next_child;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while (override_child) {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Look for a matching device in base tree. */</span><br><span style="color: hsl(120, 100%, 40%);">+ for (base_child = base_parent->children;</span><br><span style="color: hsl(120, 100%, 40%);">+ base_child; base_child = base_child->sibling) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (device_match(base_child, override_child))</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ next_child = override_child->sibling;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If matching device is found, copy properties of</span><br><span style="color: hsl(120, 100%, 40%);">+ * override_child to base_child.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (base_child)</span><br><span style="color: hsl(120, 100%, 40%);">+ update_device(base_child, override_child);</span><br><span style="color: hsl(120, 100%, 40%);">+ else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If matching device is not found, set override_child</span><br><span style="color: hsl(120, 100%, 40%);">+ * as a new child of base_parent.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ set_new_child(base_parent, override_child);</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Ensure all nodes in override tree pointing to</span><br><span style="color: hsl(120, 100%, 40%);">+ * override parent chip_instance now point to base</span><br><span style="color: hsl(120, 100%, 40%);">+ * parent chip_instance.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ update_chip_pointers(override_child,</span><br><span style="color: hsl(120, 100%, 40%);">+ base_parent->dev->chip_instance,</span><br><span style="color: hsl(120, 100%, 40%);">+ override_parent->dev->chip_instance);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ override_child = next_child;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> int main(int argc, char **argv)</span><br><span> {</span><br><span> if ((argc < MANDATORY_ARG_COUNT) || (argc > TOTAL_ARG_COUNT))</span><br><span>@@ -925,6 +1172,8 @@</span><br><span> if (argc == TOTAL_ARG_COUNT) {</span><br><span> override_devtree = argv[OVERRIDE_DEVICEFILE_ARG];</span><br><span> parse_devicetree(override_devtree, &override_root_bus);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ override_devicetree(&base_root_bus, &override_root_bus);</span><br><span> }</span><br><span> </span><br><span> FILE *autogen = fopen(outputc, "w");</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27206">change 27206</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/27206"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I6604e4f8abe3fc48240e942fea32da96031e1e46 </div>
<div style="display:none"> Gerrit-Change-Number: 27206 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Furquan Shaikh <furquan@google.com> </div>