Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Feb 2012 00:52:00 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r231003 - head/sys/powerpc/ofw
Message-ID:  <201202050052.q150q0KL059305@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sun Feb  5 00:51:59 2012
New Revision: 231003
URL: http://svn.freebsd.org/changeset/base/231003

Log:
  Add support for bus_adjust_resource() on all PowerPC/AIM PCI bridges. With
  this change, NEW_PCIB appears to work without incident at least on a G5
  iMac. More testing will be required before it is turned on in GENERIC.

Modified:
  head/sys/powerpc/ofw/ofw_pci.c

Modified: head/sys/powerpc/ofw/ofw_pci.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pci.c	Sun Feb  5 00:31:07 2012	(r231002)
+++ head/sys/powerpc/ofw/ofw_pci.c	Sun Feb  5 00:51:59 2012	(r231003)
@@ -71,6 +71,9 @@ static int		ofw_pci_activate_resource(de
 static int		ofw_pci_deactivate_resource(device_t bus,
     			    device_t child, int type, int rid,
     			    struct resource *res);
+static int		ofw_pci_adjust_resource(device_t bus, device_t child,
+			    int type, struct resource *res, u_long start,
+			    u_long end);
 
 /*
  * pcib interface.
@@ -106,6 +109,7 @@ static device_method_t	ofw_pci_methods[]
 	DEVMETHOD(bus_release_resource,	ofw_pci_release_resource),
 	DEVMETHOD(bus_activate_resource,	ofw_pci_activate_resource),
 	DEVMETHOD(bus_deactivate_resource,	ofw_pci_deactivate_resource),
+	DEVMETHOD(bus_adjust_resource,	ofw_pci_adjust_resource),
 
 	/* pcib interface */
 	DEVMETHOD(pcib_maxslots,	ofw_pci_maxslots),
@@ -421,6 +425,30 @@ ofw_pci_deactivate_resource(device_t bus
 	return (rman_deactivate_resource(res));
 }
 
+static int
+ofw_pci_adjust_resource(device_t bus, device_t child, int type,
+    struct resource *res, u_long start, u_long end)
+{
+	struct rman *rm = NULL;
+	struct ofw_pci_softc *sc = device_get_softc(bus);
+
+	switch (type) {
+	case SYS_RES_MEMORY:
+		rm = &sc->sc_mem_rman;
+		break;
+	case SYS_RES_IOPORT:
+		rm = &sc->sc_io_rman;
+		break;
+	default:
+		return (ENXIO);
+	}
+
+	if (!rman_is_region_manager(res, rm))
+		return (EINVAL);
+	return (rman_adjust_resource(res, start, end));
+}
+	
+
 static phandle_t
 ofw_pci_get_node(device_t bus, device_t dev)
 {



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