Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2014 18:46:58 +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: r260327 - in head/sys: arm/arm arm/include arm/mv dev/fdt dev/uart mips/include powerpc/include x86/include
Message-ID:  <201401051846.s05IkwE3022468@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sun Jan  5 18:46:58 2014
New Revision: 260327
URL: http://svnweb.freebsd.org/changeset/base/260327

Log:
  Retire machine/fdt.h as a header used by MI code, as its function is now
  obsolete. This involves the following pieces:
  - Remove it entirely on PowerPC, where it is not used by MD code either
  - Remove all references to machine/fdt.h in non-architecture-specific code
    (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
    non-arch-specific).
  - Fix code relying on header pollution from machine/fdt.h includes
  - Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
    requests to its parent (nexus). This allows x86 FDT devices to allocate
    both memory and IO requests and removes the last notionally MI use of
    fdtbus_bs_tag.
  - On those architectures that retain a machine/fdt.h, unused bits like
    FDT_MAP_IRQ and FDT_INTR_MAX have been removed.

Deleted:
  head/sys/powerpc/include/fdt.h
Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/include/fdt.h
  head/sys/arm/include/ofw_machdep.h
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/mv/mv_pci.c
  head/sys/dev/fdt/fdt_common.c
  head/sys/dev/fdt/fdt_common.h
  head/sys/dev/fdt/fdt_pci.c
  head/sys/dev/fdt/fdtbus.c
  head/sys/dev/fdt/simplebus.c
  head/sys/dev/uart/uart_bus_fdt.c
  head/sys/mips/include/fdt.h
  head/sys/x86/include/fdt.h
  head/sys/x86/include/ofw_machdep.h

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/arm/arm/machdep.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/cpu.h>
 #include <machine/devmap.h>
 #include <machine/frame.h>
+#include <machine/intr.h>
 #include <machine/machdep.h>
 #include <machine/md_var.h>
 #include <machine/metadata.h>

Modified: head/sys/arm/include/fdt.h
==============================================================================
--- head/sys/arm/include/fdt.h	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/arm/include/fdt.h	Sun Jan  5 18:46:58 2014	(r260327)
@@ -51,11 +51,6 @@
  */
 extern bus_space_tag_t fdtbus_bs_tag;
 
-struct mem_region {
-	vm_offset_t	mr_start;
-	vm_size_t	mr_size;
-};
-
 struct arm_devmap_entry;
 
 int fdt_localbus_devmap(phandle_t, struct arm_devmap_entry *, int, int *);

Modified: head/sys/arm/include/ofw_machdep.h
==============================================================================
--- head/sys/arm/include/ofw_machdep.h	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/arm/include/ofw_machdep.h	Sun Jan  5 18:46:58 2014	(r260327)
@@ -32,6 +32,13 @@
 #ifndef _MACHINE_OFW_MACHDEP_H_
 #define _MACHINE_OFW_MACHDEP_H_
 
+#include <vm/vm.h>
+
 typedef	uint32_t	cell_t;
 
+struct mem_region {
+	vm_offset_t	mr_start;
+	vm_size_t	mr_size;
+};
+
 #endif /* _MACHINE_OFW_MACHDEP_H_ */

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/arm/mv/mv_machdep.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 #include <machine/devmap.h>
+#include <machine/fdt.h>
 #include <machine/machdep.h>
 
 #include <arm/mv/mvreg.h>	/* XXX */

Modified: head/sys/arm/mv/mv_pci.c
==============================================================================
--- head/sys/arm/mv/mv_pci.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/arm/mv/mv_pci.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/rman.h>
 #include <sys/endian.h>
 
+#include <machine/fdt.h>
 #include <machine/intr.h>
 
 #include <vm/vm.h>

Modified: head/sys/dev/fdt/fdt_common.c
==============================================================================
--- head/sys/dev/fdt/fdt_common.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/dev/fdt/fdt_common.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/limits.h>
 
-#include <machine/fdt.h>
 #include <machine/resource.h>
 
 #include <dev/fdt/fdt_common.h>

Modified: head/sys/dev/fdt/fdt_common.h
==============================================================================
--- head/sys/dev/fdt/fdt_common.h	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/dev/fdt/fdt_common.h	Sun Jan  5 18:46:58 2014	(r260327)
@@ -35,7 +35,6 @@
 #include <sys/slicer.h>
 #include <contrib/libfdt/libfdt_env.h>
 #include <dev/ofw/ofw_bus.h>
-#include <machine/fdt.h>
 
 #define FDT_MEM_REGIONS	8
 

Modified: head/sys/dev/fdt/fdt_pci.c
==============================================================================
--- head/sys/dev/fdt/fdt_pci.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/dev/fdt/fdt_pci.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -41,9 +41,11 @@ __FBSDID("$FreeBSD$");
 #include <dev/fdt/fdt_common.h>
 #include <dev/pci/pcireg.h>
 
-#include <machine/fdt.h>
 #if defined(__arm__)
+#include <vm/vm.h>
+#include <vm/pmap.h>
 #include <machine/devmap.h>
+#include <machine/fdt.h>
 #endif
 
 #include "ofw_bus_if.h"

Modified: head/sys/dev/fdt/fdtbus.c
==============================================================================
--- head/sys/dev/fdt/fdtbus.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/dev/fdt/fdtbus.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -39,8 +39,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/rman.h>
 #include <sys/malloc.h>
 
-#include <machine/fdt.h>
-
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_nexus.h>
 
@@ -52,11 +50,6 @@ __FBSDID("$FreeBSD$");
 static void fdtbus_identify(driver_t *, device_t);
 static int fdtbus_probe(device_t);
 
-static int fdtbus_activate_resource(device_t, device_t, int, int,
-    struct resource *);
-static int fdtbus_deactivate_resource(device_t, device_t, int, int,
-    struct resource *);
-
 /*
  * Bus interface definition.
  */
@@ -66,8 +59,8 @@ static device_method_t fdtbus_methods[] 
 	DEVMETHOD(device_probe,		fdtbus_probe),
 
 	/* Bus interface */
-	DEVMETHOD(bus_activate_resource, fdtbus_activate_resource),
-	DEVMETHOD(bus_deactivate_resource, fdtbus_deactivate_resource),
+	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
+	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
 	DEVMETHOD(bus_config_intr,	bus_generic_config_intr),
 	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
 	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
@@ -96,33 +89,3 @@ fdtbus_probe(device_t dev)
 	return (BUS_PROBE_NOWILDCARD);
 }
 
-static int
-fdtbus_activate_resource(device_t bus, device_t child, int type, int rid,
-    struct resource *res)
-{
-	bus_space_handle_t p;
-	int error;
-
-	if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
-		/* XXX endianess should be set based on SOC node */
-		rman_set_bustag(res, fdtbus_bs_tag);
-		rman_set_bushandle(res, rman_get_start(res));
-
-		error = bus_space_map(rman_get_bustag(res),
-		    rman_get_bushandle(res), rman_get_size(res), 0, &p);
-		if (error)
-			return (error);
-		rman_set_bushandle(res, p);
-	}
-
-	return (rman_activate_resource(res));
-}
-
-static int
-fdtbus_deactivate_resource(device_t bus, device_t child, int type, int rid,
-    struct resource *res)
-{
-
-	return (rman_deactivate_resource(res));
-}
-

Modified: head/sys/dev/fdt/simplebus.c
==============================================================================
--- head/sys/dev/fdt/simplebus.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/dev/fdt/simplebus.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/rman.h>
 #include <sys/malloc.h>
 
-#include <machine/fdt.h>
-
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 #include <dev/ofw/openfirm.h>

Modified: head/sys/dev/uart/uart_bus_fdt.c
==============================================================================
--- head/sys/dev/uart/uart_bus_fdt.c	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/dev/uart/uart_bus_fdt.c	Sun Jan  5 18:46:58 2014	(r260327)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/module.h>
 
 #include <machine/bus.h>
-#include <machine/fdt.h>
 
 #include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>

Modified: head/sys/mips/include/fdt.h
==============================================================================
--- head/sys/mips/include/fdt.h	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/mips/include/fdt.h	Sun Jan  5 18:46:58 2014	(r260327)
@@ -33,17 +33,6 @@
 #define _MACHINE_FDT_H_
 
 #include <machine/bus.h>
-#include <machine/intr_machdep.h>
-
-/* Max interrupt number */
-#if defined(CPU_RMI) || defined(CPU_NLM)
-#define FDT_INTR_MAX	XLR_MAX_INTR
-#else
-#define FDT_INTR_MAX	(NHARD_IRQS + NSOFT_IRQS)
-#endif
-
-/* Map phandle/intpin pair to global IRQ number */ 
-#define	FDT_MAP_IRQ(node, pin)	(pin)
 
 /*
  * Bus space tag. XXX endianess info needs to be derived from the blob.

Modified: head/sys/x86/include/fdt.h
==============================================================================
--- head/sys/x86/include/fdt.h	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/x86/include/fdt.h	Sun Jan  5 18:46:58 2014	(r260327)
@@ -29,24 +29,6 @@
 #ifndef _MACHINE_FDT_H_
 #define _MACHINE_FDT_H_
 
-#include <machine/intr_machdep.h>
-#include <x86/bus.h>
-
-/* Max interrupt number. */
-#define FDT_INTR_MAX	NUM_IO_INTS
-
-/* Map phandle/intpin pair to global IRQ number */
-#define	FDT_MAP_IRQ(node, pin)	\
-	    (panic("%s: FDT_MAP_IRQ(%#x, %#x)", __func__, node, pin), -1)
-
-/* Bus space tag. XXX we only support I/O port space this way. */
-#define fdtbus_bs_tag	X86_BUS_SPACE_IO
-
-struct mem_region {
-	vm_offset_t	mr_start;
-	vm_size_t	mr_size;
-};
-
 __BEGIN_DECLS
 int x86_init_fdt(void);
 __END_DECLS

Modified: head/sys/x86/include/ofw_machdep.h
==============================================================================
--- head/sys/x86/include/ofw_machdep.h	Sun Jan  5 18:40:06 2014	(r260326)
+++ head/sys/x86/include/ofw_machdep.h	Sun Jan  5 18:46:58 2014	(r260327)
@@ -30,7 +30,13 @@
 #define _MACHINE_OFW_MACHDEP_H_
 
 #include <x86/bus.h>
+#include <vm/vm.h>
 
 typedef	uint32_t	cell_t;
 
+struct mem_region {
+	vm_offset_t	mr_start;
+	vm_size_t	mr_size;
+};
+
 #endif /* _MACHINE_OFW_MACHDEP_H_ */



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