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.
This commit is contained in:
Nathan Whitehorn 2014-01-05 18:46:58 +00:00
parent 51dbd04609
commit dcd08302e5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260327
15 changed files with 21 additions and 120 deletions

View File

@ -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>

View File

@ -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 *);

View File

@ -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_ */

View File

@ -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 */

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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"

View File

@ -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));
}

View File

@ -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>

View File

@ -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>

View File

@ -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.

View File

@ -1,41 +0,0 @@
/*-
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Semihalf under sponsorship from
* the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_FDT_H_
#define _MACHINE_FDT_H_
#include <machine/bus.h>
#include <machine/intr_machdep.h>
/* Map phandle/intpin pair to global IRQ number */
#define FDT_MAP_IRQ(node, pin) powerpc_get_irq(node, pin)
#endif /* _MACHINE_FDT_H_ */

View File

@ -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

View File

@ -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_ */