Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Aug 2017 00:56:29 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322287 - head/sys/dev/ofw
Message-ID:  <201708090056.v790uTv4005760@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Wed Aug  9 00:56:29 2017
New Revision: 322287
URL: https://svnweb.freebsd.org/changeset/base/322287

Log:
  Add support for "compatible" parameter in ofw_fdt_fixup
  
  Sometimes it's convenient to provide fixup to many boards
  that use the same SoC family (eg. Marvell Armada 38x).
  Instead of putting multiple entries in fdt_fixup_table,
  use one entry which refers to all boards with given SoC.
  
  Submitted by: Patryk Duda <pdk@semihalf.com>
  Reviewed by: nwhitehorn, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11878

Modified:
  head/sys/dev/ofw/ofw_fdt.c

Modified: head/sys/dev/ofw/ofw_fdt.c
==============================================================================
--- head/sys/dev/ofw/ofw_fdt.c	Wed Aug  9 00:51:45 2017	(r322286)
+++ head/sys/dev/ofw/ofw_fdt.c	Wed Aug  9 00:56:29 2017	(r322287)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofwvar.h>
 #include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus_subr.h>
 
 #include "ofw_if.h"
 
@@ -450,7 +451,15 @@ ofw_fdt_fixup(ofw_t ofw)
 	for (i = 0; fdt_fixup_table[i].model != NULL; i++) {
 		if (strncmp(model, fdt_fixup_table[i].model,
 		    FDT_MODEL_LEN) != 0)
-			continue;
+			/*
+			 * Sometimes it's convenient to provide one
+			 * fixup entry that refers to many boards.
+			 * To handle this case, simply check if model
+			 * is compatible parameter
+			 */
+			if(!ofw_bus_node_is_compatible(root,
+			    fdt_fixup_table[i].model))
+				continue;
 
 		if (fdt_fixup_table[i].handler != NULL)
 			(*fdt_fixup_table[i].handler)(root);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708090056.v790uTv4005760>