Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Aug 2014 14:19:57 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r269625 - projects/arm64/sys/dev/ofw
Message-ID:  <53e2398d.5d9e.599d9717@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Aug  6 14:19:57 2014
New Revision: 269625
URL: http://svnweb.freebsd.org/changeset/base/269625

Log:
  Set the rid correctly when there are multiple ranges and interrupts.
  If the memory ranges or interrupts have multiple values per entry
  the rid will depend on the size of these.

Modified:
  projects/arm64/sys/dev/ofw/ofwbus.c

Modified: projects/arm64/sys/dev/ofw/ofwbus.c
==============================================================================
--- projects/arm64/sys/dev/ofw/ofwbus.c	Wed Aug  6 10:38:06 2014	(r269624)
+++ projects/arm64/sys/dev/ofw/ofwbus.c	Wed Aug  6 14:19:57 2014	(r269625)
@@ -437,7 +437,7 @@ ofwbus_setup_dinfo(device_t dev, phandle
 	uint32_t *reg, *intr, icells;
 	uint64_t phys, size;
 	phandle_t iparent;
-	int i, j;
+	int i, j, rid;
 	int nintr;
 	int nreg;
 
@@ -466,7 +466,7 @@ ofwbus_setup_dinfo(device_t dev, phandle
 		nreg = 0;
 	}
 
-	for (i = 0; i < nreg; i += sc->acells + sc->scells) {
+	for (i = 0, rid = 0; i < nreg; i += sc->acells + sc->scells, rid++) {
 		phys = size = 0;
 		for (j = 0; j < sc->acells; j++) {
 			phys <<= 32;
@@ -478,7 +478,7 @@ ofwbus_setup_dinfo(device_t dev, phandle
 		}
 		/* Skip the dummy reg property of glue devices like ssm(4). */
 		if (size != 0)
-			resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, i,
+			resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, rid,
 			    phys, phys + size - 1, size);
 	}
 	free(reg, M_OFWPROP);
@@ -491,10 +491,10 @@ ofwbus_setup_dinfo(device_t dev, phandle
 		    sizeof(iparent));
 		OF_searchencprop(OF_xref_phandle(iparent), "#interrupt-cells",
 		    &icells, sizeof(icells));
-		for (i = 0; i < nintr; i+= icells) {
+		for (i = 0, rid = 0; i < nintr; i+= icells, rid++) {
 			intr[i] = ofw_bus_map_intr(dev, iparent, icells,
 			    &intr[i]);
-			resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, i, intr[i],
+			resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, rid, intr[i],
 			    intr[i], 1);
 		}
 		free(intr, M_OFWPROP);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e2398d.5d9e.599d9717>