summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/arm/allwinner/a10_machdep.c32
-rw-r--r--sys/arm/arm/bus_space-v6.c (renamed from sys/arm/tegra/bus_space.c)25
-rw-r--r--sys/arm/arm/bus_space_generic.c15
-rw-r--r--sys/arm/arm/devmap.c40
-rw-r--r--sys/arm/arm/machdep.c1
-rw-r--r--sys/arm/arm/trap.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_fbd.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_machdep.c25
-rw-r--r--sys/arm/conf/DOCKSTAR178
-rw-r--r--sys/arm/freescale/imx/imx51_ipuv3.c1
-rw-r--r--sys/arm/include/fdt.h7
-rw-r--r--sys/arm/include/intr.h2
-rw-r--r--sys/arm/include/ofw_machdep.h7
-rw-r--r--sys/arm/include/psl.h1
-rw-r--r--sys/arm/lpc/lpc_gpio.c10
-rw-r--r--sys/arm/lpc/lpc_machdep.c46
-rw-r--r--sys/arm/lpc/lpc_mmc.c4
-rw-r--r--sys/arm/lpc/lpcreg.h20
-rw-r--r--sys/arm/mv/mv_machdep.c9
-rw-r--r--sys/arm/mv/mv_pci.c173
-rw-r--r--sys/arm/mv/mvvar.h7
-rw-r--r--sys/arm/tegra/files.tegra22
-rw-r--r--sys/arm/tegra/tegra2_machdep.c34
-rw-r--r--sys/arm/ti/ti_machdep.c42
-rw-r--r--sys/arm/versatile/bus_space.c4
-rw-r--r--sys/arm/xilinx/zy7_bus_space.c4
-rw-r--r--sys/boot/fdt/dts/dockstar.dts2
-rw-r--r--sys/conf/files1
-rw-r--r--sys/dev/fdt/fdt_common.c1
-rw-r--r--sys/dev/fdt/fdt_common.h10
-rw-r--r--sys/dev/fdt/fdt_pci.c209
-rw-r--r--sys/dev/fdt/fdtbus.c41
-rw-r--r--sys/dev/fdt/simplebus.c2
-rw-r--r--sys/dev/uart/uart_bus_fdt.c1
-rw-r--r--sys/dev/uart/uart_dev_lpc.c21
-rw-r--r--sys/mips/include/fdt.h11
-rw-r--r--sys/powerpc/include/fdt.h41
-rw-r--r--sys/x86/include/fdt.h18
-rw-r--r--sys/x86/include/ofw_machdep.h6
39 files changed, 479 insertions, 576 deletions
diff --git a/sys/arm/allwinner/a10_machdep.c b/sys/arm/allwinner/a10_machdep.c
index c77a2a5..85cdb11 100644
--- a/sys/arm/allwinner/a10_machdep.c
+++ b/sys/arm/allwinner/a10_machdep.c
@@ -50,21 +50,16 @@ __FBSDID("$FreeBSD$");
#include <arm/allwinner/a10_wdog.h>
-/* Start of address space used for bootstrap map */
-#define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000
-
-
vm_offset_t
initarm_lastaddr(void)
{
- return (DEVMAP_BOOTSTRAP_MAP_START);
+ return (arm_devmap_lastaddr());
}
void
initarm_early_init(void)
{
-
}
void
@@ -77,28 +72,21 @@ initarm_late_init(void)
{
}
-#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1)
-static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
- { 0, 0, 0, 0, 0, }
-};
-
/*
- * Construct pmap_devmap[] with DT-derived config data.
+ * Set up static device mappings.
+ *
+ * This covers all the on-chip device with 1MB section mappings, which is good
+ * for performance (uses fewer TLB entries for device access).
+ *
+ * XXX It also covers a block of SRAM and some GPU (mali400) stuff that maybe
+ * shouldn't be device-mapped. The original code mapped a 4MB block, but
+ * perhaps a 1MB block would be more appropriate.
*/
int
initarm_devmap_init(void)
{
- int i = 0;
-
- fdt_devmap[i].pd_va = 0xE1C00000;
- fdt_devmap[i].pd_pa = 0x01C00000;
- fdt_devmap[i].pd_size = 0x00400000; /* 4 MB */
- fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- fdt_devmap[i].pd_cache = PTE_DEVICE;
-
- i++;
- arm_devmap_register_table(&fdt_devmap[0]);
+ arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */
return (0);
}
diff --git a/sys/arm/tegra/bus_space.c b/sys/arm/arm/bus_space-v6.c
index 8d21f55..d91306e 100644
--- a/sys/arm/tegra/bus_space.c
+++ b/sys/arm/arm/bus_space-v6.c
@@ -1,7 +1,9 @@
/*-
- * Copyright (c) 2012 Damjan Marion <damjan.marion@gmail.com>
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
+ * Developed by Semihalf.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -10,11 +12,14 @@
* 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.
+ * 3. Neither the name of MARVELL nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY 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
+ * ARE DISCLAIMED. IN NO EVENT SHALL 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)
@@ -90,9 +95,9 @@ static struct bus_space _base_tag = {
NULL,
/* write region */
- NULL,
- NULL,
- NULL,
+ generic_bs_wr_1,
+ generic_armv4_bs_wr_2,
+ generic_bs_wr_4,
NULL,
/* set multiple */
@@ -102,14 +107,14 @@ static struct bus_space _base_tag = {
NULL,
/* set region */
- NULL,
- NULL,
- NULL,
+ generic_bs_sr_1,
+ generic_armv4_bs_sr_2,
+ generic_bs_sr_4,
NULL,
/* copy */
NULL,
- NULL,
+ generic_armv4_bs_c_2,
NULL,
NULL,
diff --git a/sys/arm/arm/bus_space_generic.c b/sys/arm/arm/bus_space_generic.c
index 551d956..8d272c4 100644
--- a/sys/arm/arm/bus_space_generic.c
+++ b/sys/arm/arm/bus_space_generic.c
@@ -62,16 +62,12 @@ generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
void *va;
/*
- * Look up the address in the static device mappings. If it's not
- * there, establish a new dynamic mapping.
- *
* We don't even examine the passed-in flags. For ARM, the CACHEABLE
* flag doesn't make sense (we create PTE_DEVICE mappings), and the
* LINEAR flag is just implied because we use kva_alloc(size).
*/
- if ((va = arm_devmap_ptov(bpa, size)) == NULL)
- if ((va = pmap_mapdev(bpa, size)) == NULL)
- return (ENOMEM);
+ if ((va = pmap_mapdev(bpa, size)) == NULL)
+ return (ENOMEM);
*bshp = (bus_space_handle_t)va;
return (0);
}
@@ -90,12 +86,7 @@ void
generic_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
{
- /*
- * If the region is static-mapped do nothing, otherwise remove the
- * dynamic mapping.
- */
- if (arm_devmap_vtop((void*)h, size) == DEVMAP_PADDR_NOTFOUND)
- pmap_unmapdev((vm_offset_t)h, size);
+ pmap_unmapdev((vm_offset_t)h, size);
}
void
diff --git a/sys/arm/arm/devmap.c b/sys/arm/arm/devmap.c
index 42e1298..d9bdd9c 100644
--- a/sys/arm/arm/devmap.c
+++ b/sys/arm/arm/devmap.c
@@ -67,11 +67,8 @@ arm_devmap_lastaddr()
if (akva_devmap_idx > 0)
return (akva_devmap_vaddr);
- if (devmap_table == NULL)
- panic("arm_devmap_lastaddr(): No devmap table registered.");
-
lowaddr = ARM_VECTORS_HIGH;
- for (pd = devmap_table; pd->pd_size != 0; ++pd) {
+ for (pd = devmap_table; pd != NULL && pd->pd_size != 0; ++pd) {
if (lowaddr > pd->pd_va)
lowaddr = pd->pd_va;
}
@@ -145,22 +142,21 @@ arm_devmap_bootstrap(vm_offset_t l1pt, const struct arm_devmap_entry *table)
{
const struct arm_devmap_entry *pd;
+ devmap_bootstrap_done = true;
+
/*
- * If given a table pointer, use it, else ensure a table was previously
- * registered. This happens early in boot, and there's a good chance
- * the panic message won't be seen, but there's not much we can do.
+ * If given a table pointer, use it. Otherwise, if a table was
+ * previously registered, use it. Otherwise, no work to do.
*/
if (table != NULL)
devmap_table = table;
else if (devmap_table == NULL)
- panic("arm_devmap_bootstrap(): No devmap table registered");
+ return;
for (pd = devmap_table; pd->pd_size != 0; ++pd) {
pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size,
pd->pd_prot,pd->pd_cache);
}
-
- devmap_bootstrap_done = true;
}
/*
@@ -207,13 +203,23 @@ arm_devmap_vtop(void * vpva, vm_size_t size)
/*
* Map a set of physical memory pages into the kernel virtual address space.
- * Return a pointer to where it is mapped. This routine is intended to be used
- * for mapping device memory, NOT real memory.
+ * Return a pointer to where it is mapped.
+ *
+ * This uses a pre-established static mapping if one exists for the requested
+ * range, otherwise it allocates kva space and maps the physical pages into it.
+ *
+ * This routine is intended to be used for mapping device memory, NOT real
+ * memory; the mapping type is inherently PTE_DEVICE in pmap_kenter_device().
*/
void *
pmap_mapdev(vm_offset_t pa, vm_size_t size)
{
vm_offset_t va, tmpva, offset;
+ void * rva;
+
+ /* First look in the static mapping table. */
+ if ((rva = arm_devmap_ptov(pa, size)) != NULL)
+ return (rva);
offset = pa & PAGE_MASK;
pa = trunc_page(pa);
@@ -240,7 +246,13 @@ void
pmap_unmapdev(vm_offset_t va, vm_size_t size)
{
vm_offset_t tmpva, offset;
-
+ vm_size_t origsize;
+
+ /* Nothing to do if we find the mapping in the static table. */
+ if (arm_devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND)
+ return;
+
+ origsize = size;
offset = va & PAGE_MASK;
va = trunc_page(va);
size = round_page(size + offset);
@@ -251,6 +263,6 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size)
tmpva += PAGE_SIZE;
}
- kva_free(va, size);
+ kva_free(va, origsize);
}
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index 2b46656..bb4caf1 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -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>
diff --git a/sys/arm/arm/trap.c b/sys/arm/arm/trap.c
index 5021eec..eb5b36d 100644
--- a/sys/arm/arm/trap.c
+++ b/sys/arm/arm/trap.c
@@ -85,6 +85,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/kernel.h>
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_fbd.c b/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
index 60a0563..2c69b9a 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
+#include <machine/fdt.h>
#include <machine/resource.h>
#include <machine/intr.h>
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
index a203e12..0f13a79 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
@@ -59,14 +59,11 @@ __FBSDID("$FreeBSD$");
#include <arm/broadcom/bcm2835/bcm2835_wdog.h>
-/* Start of address space used for bootstrap map */
-#define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000
-
vm_offset_t
initarm_lastaddr(void)
{
- return (DEVMAP_BOOTSTRAP_MAP_START);
+ return (arm_devmap_lastaddr());
}
void
@@ -99,28 +96,16 @@ initarm_late_init(void)
}
}
-#define FDT_DEVMAP_MAX (2) // FIXME
-static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
- { 0, 0, 0, 0, 0, }
-};
-
-
/*
- * Construct pmap_devmap[] with DT-derived config data.
+ * Set up static device mappings.
+ * All on-chip peripherals exist in a 16MB range starting at 0x20000000.
+ * Map the entire range using 1MB section mappings.
*/
int
initarm_devmap_init(void)
{
- int i = 0;
-
- fdt_devmap[i].pd_va = 0xf2000000;
- fdt_devmap[i].pd_pa = 0x20000000;
- fdt_devmap[i].pd_size = 0x01000000; /* 1 MB */
- fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- fdt_devmap[i].pd_cache = PTE_DEVICE;
- i++;
- arm_devmap_register_table(&fdt_devmap[0]);
+ arm_devmap_add_entry(0x20000000, 0x01000000);
return (0);
}
diff --git a/sys/arm/conf/DOCKSTAR b/sys/arm/conf/DOCKSTAR
index 25c0121..97dc8db 100644
--- a/sys/arm/conf/DOCKSTAR
+++ b/sys/arm/conf/DOCKSTAR
@@ -3,73 +3,165 @@
#
# $FreeBSD$
#
+# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+# $FreeBSD$
+#
ident DOCKSTAR
+
include "../mv/kirkwood/std.db88f6xxx"
-options SOC_MV_KIRKWOOD
+makeoptions FDT_DTS_FILE=dockstar.dts
+
makeoptions MODULES_OVERRIDE=""
-#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
-makeoptions WERROR="-Werror"
+options SOC_MV_KIRKWOOD
options SCHED_4BSD #4BSD scheduler
options INET #InterNETworking
options INET6 #IPv6 communications protocols
+options SOFTUPDATES
+options CD9660 #ISO 9660 filesystem
options FFS #Berkeley Fast Filesystem
-options NFSCL #New Network Filesystem Client
-options NFSLOCKD #Network Lock Manager
-options NFS_ROOT #NFS usable as /, requires NFSCL
-options BOOTP
-options BOOTP_NFSROOT
-options BOOTP_NFSV3
-options BOOTP_COMPAT
-options BOOTP_WIRED_TO=mge0
-
-# Root fs on USB device
-#options ROOTDEVNAME=\"ufs:/dev/da0a\"
-
+options MSDOSFS #MS DOS File System (FAT, FAT32)
+options NULLFS #NULL filesystem
+options TMPFS #Efficient memory filesystem
options SYSVSHM #SYSV-style shared memory
options SYSVMSG #SYSV-style message queues
options SYSVSEM #SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
-options MUTEX_NOINLINE
-options RWLOCK_NOINLINE
-options NO_FFS_SNAPSHOT
-options NO_SWAPPING
+options GEOM_ELI # Disk encryption.
+options GEOM_LABEL # Providers labelization.
+options GEOM_PART_GPT # GPT partitioning
-# Debugging
-options ALT_BREAK_TO_DEBUGGER
-options DDB
-options KDB
+# Flattened Device Tree
+device fdt
+options FDT
+options FDT_DTB_STATIC
+
+# Misc pseudo devices
+device bpf #Required for DHCP
+device faith #IPv6-to-IPv4 relaying (translation)
+device firmware #firmware(9) required for USB wlan
+device gif #IPv6 and IPv4 tunneling
+device loop #Network loopback
+device md #Memory/malloc disk
+device pty #BSD-style compatibility pseudo ttys
+device random #Entropy device
+device tun #Packet tunnel.
+device ether #Required for all ethernet devices
+device vlan #802.1Q VLAN support
+device wlan #802.11 WLAN support
-# Pseudo devices
-device md
-device random
-device loop
+# cam support for umass and ahci
+device scbus
+device pass
+device da
# Serial ports
device uart
# Networking
-device ether
device mge # Marvell Gigabit Ethernet controller
device mii
-device bpf
-options HZ=1000
-options DEVICE_POLLING
-device vlan
+device e1000phy
# USB
-options USB_DEBUG # enable debug msgs
-device usb
-device ehci
-device umass
-device scbus
-device pass
-device da
+options USB_HOST_ALIGN=32 # Align DMA to cacheline
+#options USB_DEBUG # Compile in USB debug support
+device usb # Basic usb support
+device ehci # USB host controller
+device umass # Mass storage
+device uhid # Human-interface devices
+device rum # Ralink Technology RT2501USB wireless NICs
+device uath # Atheros AR5523 wireless NICs
+device ural # Ralink Technology RT2500USB wireless NICs
+device zyd # ZyDAS zb1211/zb1211b wireless NICs
+device urtw # Realtek RTL8187B/L USB
+device upgt # Conexant/Intersil PrismGT SoftMAC USB
+device u3g # USB-based 3G modems (Option, Huawei, Sierra)
+
+# I2C (TWSI)
+device iic
+device iicbus
+
+# Sound
+device sound
+device snd_uaudio
+
+#crypto
+device cesa # Marvell security engine
+device crypto
+device cryptodev
+
+# IPSec
+device enc
+options IPSEC
+options IPSEC_NAT_T
+options TCP_SIGNATURE #include support for RFC 2385
+
+# IPFW
+options IPFIREWALL
+options IPFIREWALL_DEFAULT_TO_ACCEPT
+options IPFIREWALL_VERBOSE
+options IPFIREWALL_VERBOSE_LIMIT=100
+options IPFIREWALL_NAT
+options LIBALIAS
+options DUMMYNET
+options IPDIVERT
+
+#PF
+device pf
+device pflog
+device pfsync
+
+# ALTQ, required for PF
+options ALTQ # Basic ALTQ support
+options ALTQ_CBQ # Class Based Queueing
+options ALTQ_RED # Random Early Detection
+options ALTQ_RIO # RED In/Out
+options ALTQ_HFSC # Hierarchical Packet Scheduler
+options ALTQ_CDNR # Traffic conditioner
+options ALTQ_PRIQ # Priority Queueing
+options ALTQ_NOPCC # Required if the TSC is unusable
+#options ALTQ_DEBUG
+
+# Debugging
+makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
+options BREAK_TO_DEBUGGER
+options ALT_BREAK_TO_DEBUGGER
+options DDB
+options KDB
+options DIAGNOSTIC
+options INVARIANTS #Enable calls of extra sanity checking
+options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS
+#options WITNESS #Enable checks to detect deadlocks and cycles
+#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed
+#options WITNESS_KDB
+
+# Enable these options for nfs root configured via BOOTP.
+options NFSCL #Network Filesystem Client
+options NFSLOCKD #Network Lock Manager
+#options NFS_ROOT #NFS usable as /, requires NFSCLIENT
+#options BOOTP
+#options BOOTP_NFSROOT
+#options BOOTP_NFSV3
+#options BOOTP_WIRED_TO=mge0
+
+# If not using BOOTP, use something like one of these...
+#options ROOTDEVNAME=\"ufs:/dev/da0a\"
+options ROOTDEVNAME=\"ufs:/dev/da0s1a\"
+#options ROOTDEVNAME=\"ufs:/dev/da0p10\"
+#options ROOTDEVNAME=\"nfs:192.168.0.254/dreamplug\"
-# Flattened Device Tree
-options FDT
-options FDT_DTB_STATIC
-makeoptions FDT_DTS_FILE=dockstar.dts
diff --git a/sys/arm/freescale/imx/imx51_ipuv3.c b/sys/arm/freescale/imx/imx51_ipuv3.c
index e2b05aa..a7781f3 100644
--- a/sys/arm/freescale/imx/imx51_ipuv3.c
+++ b/sys/arm/freescale/imx/imx51_ipuv3.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
+#include <machine/fdt.h>
#include <machine/resource.h>
#include <machine/intr.h>
diff --git a/sys/arm/include/fdt.h b/sys/arm/include/fdt.h
index 0be9927..9bd9332 100644
--- a/sys/arm/include/fdt.h
+++ b/sys/arm/include/fdt.h
@@ -51,15 +51,8 @@
*/
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 *);
-int fdt_pci_devmap(phandle_t, struct arm_devmap_entry *devmap, vm_offset_t,
- vm_offset_t);
#endif /* _MACHINE_FDT_H_ */
diff --git a/sys/arm/include/intr.h b/sys/arm/include/intr.h
index dedf5b2..49d6c05 100644
--- a/sys/arm/include/intr.h
+++ b/sys/arm/include/intr.h
@@ -67,8 +67,6 @@
#define NIRQ 32
#endif
-#include <machine/psl.h>
-#include <sys/bus.h>
int arm_get_next_irq(int);
void arm_mask_irq(uintptr_t);
diff --git a/sys/arm/include/ofw_machdep.h b/sys/arm/include/ofw_machdep.h
index 11797da..d6bd576 100644
--- a/sys/arm/include/ofw_machdep.h
+++ b/sys/arm/include/ofw_machdep.h
@@ -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_ */
diff --git a/sys/arm/include/psl.h b/sys/arm/include/psl.h
index c86ddb8..b300ff4 100644
--- a/sys/arm/include/psl.h
+++ b/sys/arm/include/psl.h
@@ -46,7 +46,6 @@
#ifndef _MACHINE_PSL_H_
#define _MACHINE_PSL_H_
-#include <machine/intr.h>
/*
* These are the different SPL states
diff --git a/sys/arm/lpc/lpc_gpio.c b/sys/arm/lpc/lpc_gpio.c
index 0b97b07..33b32ee 100644
--- a/sys/arm/lpc/lpc_gpio.c
+++ b/sys/arm/lpc/lpc_gpio.c
@@ -502,12 +502,18 @@ lpc_gpio_get_state(device_t dev, int pin, int *state)
void
platform_gpio_init()
{
+ bus_space_tag_t bst;
+ bus_space_handle_t bsh;
+
+ bst = fdtbus_bs_tag;
+
/* Preset SPI devices CS pins to one */
- bus_space_write_4(fdtbus_bs_tag,
- LPC_GPIO_BASE, LPC_GPIO_P3_OUTP_SET,
+ bus_space_map(bst, LPC_GPIO_PHYS_BASE, LPC_GPIO_SIZE, 0, &bsh);
+ bus_space_write_4(bst, bsh, LPC_GPIO_P3_OUTP_SET,
1 << (SSD1289_CS_PIN - LPC_GPIO_GPO_00(0)) |
1 << (SSD1289_DC_PIN - LPC_GPIO_GPO_00(0)) |
1 << (ADS7846_CS_PIN - LPC_GPIO_GPO_00(0)));
+ bus_space_unmap(bst, bsh, LPC_GPIO_SIZE);
}
static device_method_t lpc_gpio_methods[] = {
diff --git a/sys/arm/lpc/lpc_machdep.c b/sys/arm/lpc/lpc_machdep.c
index a900997..0cdfd03 100644
--- a/sys/arm/lpc/lpc_machdep.c
+++ b/sys/arm/lpc/lpc_machdep.c
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <machine/bus.h>
+#include <machine/fdt.h>
#include <machine/devmap.h>
#include <machine/machdep.h>
@@ -57,21 +58,17 @@ __FBSDID("$FreeBSD$");
#include <arm/lpc/lpcvar.h>
#include <dev/fdt/fdt_common.h>
-#include <dev/ic/ns16550.h>
vm_offset_t
initarm_lastaddr(void)
{
- return (fdt_immr_va);
+ return (arm_devmap_lastaddr());
}
void
initarm_early_init(void)
{
-
- if (fdt_immr_addr(LPC_DEV_BASE) != 0)
- while (1);
}
void
@@ -89,28 +86,16 @@ initarm_late_init(void)
{
}
-#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1)
-static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
- { 0, 0, 0, 0, 0, }
-};
-
/*
- * Construct pmap_devmap[] with DT-derived config data.
+ * Add a single static device mapping.
+ * The values used were taken from the ranges property of the SoC node in the
+ * dts file when this code was converted to arm_devmap_add_entry().
*/
int
initarm_devmap_init(void)
{
- /*
- * IMMR range.
- */
- fdt_devmap[0].pd_va = fdt_immr_va;
- fdt_devmap[0].pd_pa = fdt_immr_pa;
- fdt_devmap[0].pd_size = fdt_immr_size;
- fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- fdt_devmap[0].pd_cache = PTE_NOCACHE;
-
- arm_devmap_register_table(&fdt_devmap[0]);
+ arm_devmap_add_entry(LPC_DEV_PHYS_BASE, LPC_DEV_SIZE);
return (0);
}
@@ -131,15 +116,24 @@ bus_dma_get_range_nb(void)
void
cpu_reset(void)
{
+ bus_space_tag_t bst;
+ bus_space_handle_t bsh;
+
+ bst = fdtbus_bs_tag;
+
/* Enable WDT */
- bus_space_write_4(fdtbus_bs_tag,
- LPC_CLKPWR_BASE, LPC_CLKPWR_TIMCLK_CTRL,
+ bus_space_map(bst, LPC_CLKPWR_PHYS_BASE, LPC_CLKPWR_SIZE, 0, &bsh);
+ bus_space_write_4(bst, bsh, LPC_CLKPWR_TIMCLK_CTRL,
LPC_CLKPWR_TIMCLK_CTRL_WATCHDOG);
+ bus_space_unmap(bst, bsh, LPC_CLKPWR_SIZE);
/* Instant assert of RESETOUT_N with pulse length 1ms */
- bus_space_write_4(fdtbus_bs_tag, LPC_WDTIM_BASE, LPC_WDTIM_PULSE, 13000);
- bus_space_write_4(fdtbus_bs_tag, LPC_WDTIM_BASE, LPC_WDTIM_MCTRL, 0x70);
+ bus_space_map(bst, LPC_WDTIM_PHYS_BASE, LPC_WDTIM_SIZE, 0, &bsh);
+ bus_space_write_4(bst, bsh, LPC_WDTIM_PULSE, 13000);
+ bus_space_write_4(bst, bsh, LPC_WDTIM_MCTRL, 0x70);
+ bus_space_unmap(bst, bsh, LPC_WDTIM_SIZE);
- for (;;);
+ for (;;)
+ continue;
}
diff --git a/sys/arm/lpc/lpc_mmc.c b/sys/arm/lpc/lpc_mmc.c
index 3aa6d47..257487d 100644
--- a/sys/arm/lpc/lpc_mmc.c
+++ b/sys/arm/lpc/lpc_mmc.c
@@ -507,14 +507,14 @@ lpc_mmc_setup_xfer(struct lpc_mmc_softc *sc, struct mmc_data *data)
if (data->flags & MMC_DATA_READ) {
sc->lm_xfer_direction = DIRECTION_READ;
lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_READ,
- LPC_SD_BASE + LPC_SD_FIFO, sc->lm_buffer_phys,
+ LPC_SD_PHYS_BASE + LPC_SD_FIFO, sc->lm_buffer_phys,
data_words, 0);
}
if (data->flags & MMC_DATA_WRITE) {
sc->lm_xfer_direction = DIRECTION_WRITE;
lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_WRITE,
- sc->lm_buffer_phys, LPC_SD_BASE + LPC_SD_FIFO,
+ sc->lm_buffer_phys, LPC_SD_PHYS_BASE + LPC_SD_FIFO,
data_words, 0);
}
diff --git a/sys/arm/lpc/lpcreg.h b/sys/arm/lpc/lpcreg.h
index 557d9b7..b63dfbc 100644
--- a/sys/arm/lpc/lpcreg.h
+++ b/sys/arm/lpc/lpcreg.h
@@ -32,7 +32,6 @@
#define LPC_DEV_PHYS_BASE 0x40000000
#define LPC_DEV_P5_PHYS_BASE 0x20000000
#define LPC_DEV_P6_PHYS_BASE 0x30000000
-#define LPC_DEV_BASE 0xd0000000
#define LPC_DEV_SIZE 0x10000000
/*
@@ -88,7 +87,7 @@
/*
* Watchdog timer. (from UM10326: LPC32x0 User manual, page 572)
*/
-#define LPC_WDTIM_BASE (LPC_DEV_BASE + 0x3c000)
+#define LPC_WDTIM_PHYS_BASE (LPC_DEV_PHYS_BASE + 0x3c000)
#define LPC_WDTIM_INT 0x00
#define LPC_WDTIM_CTRL 0x04
#define LPC_WDTIM_COUNTER 0x08
@@ -97,11 +96,12 @@
#define LPC_WDTIM_EMR 0x14
#define LPC_WDTIM_PULSE 0x18
#define LPC_WDTIM_RES 0x1c
+#define LPC_WDTIM_SIZE 0x20
/*
* Clocking and power control. (from UM10326: LPC32x0 User manual, page 58)
*/
-#define LPC_CLKPWR_BASE (LPC_DEV_BASE + 0x4000)
+#define LPC_CLKPWR_PHYS_BASE (LPC_DEV_PHYS_BASE + 0x4000)
#define LPC_CLKPWR_PWR_CTRL 0x44
#define LPC_CLKPWR_OSC_CTRL 0x4c
#define LPC_CLKPWR_SYSCLK_CTRL 0x50
@@ -189,6 +189,7 @@
#define LPC_CLKPWR_UARTCLK_CTRL 0xe4
#define LPC_CLKPWR_POS0_IRAM_CTRL 0x110
#define LPC_CLKPWR_POS1_IRAM_CTRL 0x114
+#define LPC_CLKPWR_SIZE 0x118
/* Additional UART registers in CLKPWR address space. */
#define LPC_CLKPWR_UART_U3CLK 0xd0
@@ -201,9 +202,9 @@
#define LPC_CLKPWR_UART_IRDACLK 0xe0
/* Additional UART registers */
-#define LPC_UART_BASE (LPC_DEV_BASE + 0x80000)
-#define LPC_UART_CONTROL_BASE (LPC_DEV_BASE + 0x54000)
-#define LPC_UART5_BASE (LPC_DEV_BASE + 0x90000)
+#define LPC_UART_BASE 0x80000
+#define LPC_UART_CONTROL_BASE 0x54000
+#define LPC_UART5_BASE 0x90000
#define LPC_UART_CTRL 0x00
#define LPC_UART_CLKMODE 0x04
#define LPC_UART_CLKMODE_UART3(_n) (((_n) & 0x3) << 4)
@@ -211,6 +212,7 @@
#define LPC_UART_CLKMODE_UART5(_n) (((_n) & 0x3) << 8)
#define LPC_UART_CLKMODE_UART6(_n) (((_n) & 0x3) << 10)
#define LPC_UART_LOOP 0x08
+#define LPC_UART_CONTROL_SIZE 0x0c
#define LPC_UART_FIFOSIZE 64
/*
@@ -236,7 +238,7 @@
/*
* MMC/SD controller. (from UM10326: LPC32x0 User manual, page 436)
*/
-#define LPC_SD_BASE (LPC_DEV_P5_PHYS_BASE + 0x98000)
+#define LPC_SD_PHYS_BASE (LPC_DEV_P5_PHYS_BASE + 0x98000)
#define LPC_SD_CLK (13 * 1000 * 1000) // 13Mhz
#define LPC_SD_POWER 0x00
#define LPC_SD_POWER_OPENDRAIN (1 << 6)
@@ -535,7 +537,7 @@
/*
* GPIO (from UM10326: LPC32x0 User manual, page 606)
*/
-#define LPC_GPIO_BASE (LPC_DEV_BASE + 0x28000)
+#define LPC_GPIO_PHYS_BASE (LPC_DEV_PHYS_BASE + 0x28000)
#define LPC_GPIO_P0_COUNT 8
#define LPC_GPIO_P1_COUNT 24
#define LPC_GPIO_P2_COUNT 13
@@ -564,6 +566,8 @@
#define LPC_GPIO_P3_OUTP_SET 0x04
#define LPC_GPIO_P3_OUTP_CLR 0x08
#define LPC_GPIO_P3_OUTP_STATE 0x0c
+#define LPC_GPIO_SIZE 0x80
+
/* Aliases for logical pin numbers: */
#define LPC_GPIO_GPI_00(_n) (0 + _n)
#define LPC_GPIO_GPI_15(_n) (10 + _n)
diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c
index 9758cfb..a42c977 100644
--- a/sys/arm/mv/mv_machdep.c
+++ b/sys/arm/mv/mv_machdep.c
@@ -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 */
@@ -293,11 +294,11 @@ out:
}
/*
- * Supply a default do-nothing implementation of fdt_pci_devmap() via a weak
+ * Supply a default do-nothing implementation of mv_pci_devmap() via a weak
* alias. Many Marvell platforms don't support a PCI interface, but to support
* those that do, we end up with a reference to this function below, in
* platform_devmap_init(). If "device pci" appears in the kernel config, the
- * real implementation of this function in dev/fdt/fdt_pci.c overrides the weak
+ * real implementation of this function in arm/mv/mv_pci.c overrides the weak
* alias defined here.
*/
int mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap,
@@ -309,7 +310,7 @@ mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap,
return (0);
}
-__weak_reference(mv_default_fdt_pci_devmap, fdt_pci_devmap);
+__weak_reference(mv_default_fdt_pci_devmap, mv_pci_devmap);
/*
* XXX: When device entry in devmap has pd_size smaller than section size,
@@ -378,7 +379,7 @@ initarm_devmap_init(void)
* XXX this should account for PCI and multiple ranges
* of a given kind.
*/
- if (fdt_pci_devmap(child, &fdt_devmap[i], MV_PCI_VA_IO_BASE,
+ if (mv_pci_devmap(child, &fdt_devmap[i], MV_PCI_VA_IO_BASE,
MV_PCI_VA_MEM_BASE) != 0)
return (ENXIO);
i += 2;
diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c
index ff12974..4660e5c 100644
--- a/sys/arm/mv/mv_pci.c
+++ b/sys/arm/mv/mv_pci.c
@@ -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>
@@ -69,6 +70,7 @@ __FBSDID("$FreeBSD$");
#include "ofw_bus_if.h"
#include "pcib_if.h"
+#include <machine/devmap.h>
#include <machine/resource.h>
#include <machine/bus.h>
@@ -82,6 +84,172 @@ __FBSDID("$FreeBSD$");
#define debugf(fmt, args...)
#endif
+/*
+ * Code and data related to fdt-based PCI configuration.
+ *
+ * This stuff used to be in dev/fdt/fdt_pci.c and fdt_common.h, but it was
+ * always Marvell-specific so that was deleted and the code now lives here.
+ */
+
+struct mv_pci_range {
+ u_long base_pci;
+ u_long base_parent;
+ u_long len;
+};
+
+#define FDT_RANGES_CELLS ((3 + 3 + 2) * 2)
+
+static void
+mv_pci_range_dump(struct mv_pci_range *range)
+{
+#ifdef DEBUG
+ printf("\n");
+ printf(" base_pci = 0x%08lx\n", range->base_pci);
+ printf(" base_par = 0x%08lx\n", range->base_parent);
+ printf(" len = 0x%08lx\n", range->len);
+#endif
+}
+
+static int
+mv_pci_ranges_decode(phandle_t node, struct mv_pci_range *io_space,
+ struct mv_pci_range *mem_space)
+{
+ pcell_t ranges[FDT_RANGES_CELLS];
+ struct mv_pci_range *pci_space;
+ pcell_t addr_cells, size_cells, par_addr_cells;
+ pcell_t *rangesptr;
+ pcell_t cell0, cell1, cell2;
+ int tuple_size, tuples, i, rv, offset_cells, len;
+
+ /*
+ * Retrieve 'ranges' property.
+ */
+ if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0)
+ return (EINVAL);
+ if (addr_cells != 3 || size_cells != 2)
+ return (ERANGE);
+
+ par_addr_cells = fdt_parent_addr_cells(node);
+ if (par_addr_cells > 3)
+ return (ERANGE);
+
+ len = OF_getproplen(node, "ranges");
+ if (len > sizeof(ranges))
+ return (ENOMEM);
+
+ if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0)
+ return (EINVAL);
+
+ tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells +
+ size_cells);
+ tuples = len / tuple_size;
+
+ /*
+ * Initialize the ranges so that we don't have to worry about
+ * having them all defined in the FDT. In particular, it is
+ * perfectly fine not to want I/O space on PCI busses.
+ */
+ bzero(io_space, sizeof(*io_space));
+ bzero(mem_space, sizeof(*mem_space));
+
+ rangesptr = &ranges[0];
+ offset_cells = 0;
+ for (i = 0; i < tuples; i++) {
+ cell0 = fdt_data_get((void *)rangesptr, 1);
+ rangesptr++;
+ cell1 = fdt_data_get((void *)rangesptr, 1);
+ rangesptr++;
+ cell2 = fdt_data_get((void *)rangesptr, 1);
+ rangesptr++;
+
+ if (cell0 & 0x02000000) {
+ pci_space = mem_space;
+ } else if (cell0 & 0x01000000) {
+ pci_space = io_space;
+ } else {
+ rv = ERANGE;
+ goto out;
+ }
+
+ if (par_addr_cells == 3) {
+ /*
+ * This is a PCI subnode 'ranges'. Skip cell0 and
+ * cell1 of this entry and only use cell2.
+ */
+ offset_cells = 2;
+ rangesptr += offset_cells;
+ }
+
+ if (fdt_data_verify((void *)rangesptr, par_addr_cells -
+ offset_cells)) {
+ rv = ERANGE;
+ goto out;
+ }
+ pci_space->base_parent = fdt_data_get((void *)rangesptr,
+ par_addr_cells - offset_cells);
+ rangesptr += par_addr_cells - offset_cells;
+
+ if (fdt_data_verify((void *)rangesptr, size_cells)) {
+ rv = ERANGE;
+ goto out;
+ }
+ pci_space->len = fdt_data_get((void *)rangesptr, size_cells);
+ rangesptr += size_cells;
+
+ pci_space->base_pci = cell2;
+ }
+ rv = 0;
+out:
+ return (rv);
+}
+
+static int
+mv_pci_ranges(phandle_t node, struct mv_pci_range *io_space,
+ struct mv_pci_range *mem_space)
+{
+ int err;
+
+ debugf("Processing PCI node: %x\n", node);
+ if ((err = mv_pci_ranges_decode(node, io_space, mem_space)) != 0) {
+ debugf("could not decode parent PCI node 'ranges'\n");
+ return (err);
+ }
+
+ debugf("Post fixup dump:\n");
+ mv_pci_range_dump(io_space);
+ mv_pci_range_dump(mem_space);
+ return (0);
+}
+
+int
+mv_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, vm_offset_t io_va,
+ vm_offset_t mem_va)
+{
+ struct mv_pci_range io_space, mem_space;
+ int error;
+
+ if ((error = mv_pci_ranges_decode(node, &io_space, &mem_space)) != 0)
+ return (error);
+
+ devmap->pd_va = (io_va ? io_va : io_space.base_parent);
+ devmap->pd_pa = io_space.base_parent;
+ devmap->pd_size = io_space.len;
+ devmap->pd_prot = VM_PROT_READ | VM_PROT_WRITE;
+ devmap->pd_cache = PTE_NOCACHE;
+ devmap++;
+
+ devmap->pd_va = (mem_va ? mem_va : mem_space.base_parent);
+ devmap->pd_pa = mem_space.base_parent;
+ devmap->pd_size = mem_space.len;
+ devmap->pd_prot = VM_PROT_READ | VM_PROT_WRITE;
+ devmap->pd_cache = PTE_NOCACHE;
+ return (0);
+}
+
+/*
+ * Code and data related to the Marvell pcib driver.
+ */
+
#define PCI_CFG_ENA (1U << 31)
#define PCI_CFG_BUS(bus) (((bus) & 0xff) << 16)
#define PCI_CFG_DEV(dev) (((dev) & 0x1f) << 11)
@@ -911,13 +1079,13 @@ mv_pcib_route_interrupt(device_t bus, device_t dev, int pin)
static int
mv_pcib_decode_win(phandle_t node, struct mv_pcib_softc *sc)
{
- struct fdt_pci_range io_space, mem_space;
+ struct mv_pci_range io_space, mem_space;
device_t dev;
int error;
dev = sc->sc_dev;
- if ((error = fdt_pci_ranges(node, &io_space, &mem_space)) != 0) {
+ if ((error = mv_pci_ranges(node, &io_space, &mem_space)) != 0) {
device_printf(dev, "could not retrieve 'ranges' data\n");
return (error);
}
@@ -1025,3 +1193,4 @@ mv_pcib_release_msi(device_t dev, device_t child, int count, int *irqs)
return (0);
}
#endif
+
diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h
index 54abf46..0b72dcb 100644
--- a/sys/arm/mv/mvvar.h
+++ b/sys/arm/mv/mvvar.h
@@ -46,6 +46,8 @@
#include <vm/pmap.h>
#include <machine/vm.h>
+#include <dev/ofw/openfirm.h>
+
#define MV_TYPE_PCI 0
#define MV_TYPE_PCIE 1
@@ -135,4 +137,9 @@ uint32_t mv_drbl_get_msg(int mnr, int dir, int unit);
int mv_msi_data(int irq, uint64_t *addr, uint32_t *data);
+struct arm_devmap_entry;
+
+int mv_pci_devmap(phandle_t, struct arm_devmap_entry *, vm_offset_t,
+ vm_offset_t);
+
#endif /* _MVVAR_H_ */
diff --git a/sys/arm/tegra/files.tegra2 b/sys/arm/tegra/files.tegra2
index 9540979..7f6e893 100644
--- a/sys/arm/tegra/files.tegra2
+++ b/sys/arm/tegra/files.tegra2
@@ -2,6 +2,7 @@
arm/arm/bus_space_asm_generic.S standard
arm/arm/bus_space_generic.c standard
+arm/arm/bus_space-v6.c standard
arm/arm/cpufunc_asm_armv5.S standard
arm/arm/cpufunc_asm_arm11.S standard
arm/arm/cpufunc_asm_armv7.S standard
@@ -10,7 +11,6 @@ arm/arm/irq_dispatch.S standard
arm/arm/gic.c standard
arm/arm/mpcore_timer.c standard
-arm/tegra/bus_space.c standard
arm/tegra/common.c standard
arm/tegra/tegra2_machdep.c standard
diff --git a/sys/arm/tegra/tegra2_machdep.c b/sys/arm/tegra/tegra2_machdep.c
index 8904250..bd639ae 100644
--- a/sys/arm/tegra/tegra2_machdep.c
+++ b/sys/arm/tegra/tegra2_machdep.c
@@ -50,17 +50,12 @@ __FBSDID("$FreeBSD$");
#include <dev/fdt/fdt_common.h>
-/* FIXME move to tegrareg.h */
-#define TEGRA2_BASE 0xE0000000 /* KVM base for peripherials */
-#define TEGRA2_UARTA_VA_BASE 0xE0006000
-#define TEGRA2_UARTA_PA_BASE 0x70006000
-
#define TEGRA2_CLK_RST_PA_BASE 0x60006000
#define TEGRA2_CLK_RST_OSC_FREQ_DET_REG 0x58
#define TEGRA2_CLK_RST_OSC_FREQ_DET_STAT_REG 0x5C
-#define OSC_FREQ_DET_TRIG (1<<31)
-#define OSC_FREQ_DET_BUSY (1<<31)
+#define OSC_FREQ_DET_TRIG (1U<<31)
+#define OSC_FREQ_DET_BUSY (1U<<31)
#if 0
static int
@@ -107,15 +102,12 @@ vm_offset_t
initarm_lastaddr(void)
{
- return (fdt_immr_va);
+ return (arm_devmap_lastaddr());
}
void
initarm_early_init(void)
{
-
- if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */
- while (1);
}
void
@@ -128,26 +120,16 @@ initarm_late_init(void)
{
}
-#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) /* FIXME */
-static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
- { 0, 0, 0, 0, 0, }
-};
-
/*
- * Construct pmap_devmap[] with DT-derived config data.
+ * Add a static mapping for the register range that includes the debug uart.
+ * It's not clear this is needed, but the original code established this mapping
+ * before conversion to the newer arm_devmap_add_entry() routine.
*/
int
initarm_devmap_init(void)
{
- int i = 0;
- fdt_devmap[i].pd_va = 0xe0000000;
- fdt_devmap[i].pd_pa = 0x70000000;
- fdt_devmap[i].pd_size = 0x100000;
- fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- fdt_devmap[i].pd_cache = PTE_NOCACHE;
- i++;
-
- arm_devmap_register_table(&fdt_devmap[0]);
+
+ arm_devmap_add_entry(0x70000000, 0x00100000);
return (0);
}
diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c
index 2f78a48..6b8b2ff 100644
--- a/sys/arm/ti/ti_machdep.c
+++ b/sys/arm/ti/ti_machdep.c
@@ -54,23 +54,18 @@ __FBSDID("$FreeBSD$");
#include <arm/ti/omap4/omap4_reg.h>
-/* Start of address space used for bootstrap map */
-#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000
-
-void (*ti_cpu_reset)(void);
+void (*ti_cpu_reset)(void) = NULL;
vm_offset_t
initarm_lastaddr(void)
{
- return (DEVMAP_BOOTSTRAP_MAP_START);
+ return (arm_devmap_lastaddr());
}
void
initarm_early_init(void)
{
-
- ti_cpu_reset = NULL;
}
void
@@ -83,38 +78,27 @@ initarm_late_init(void)
{
}
-#define FDT_DEVMAP_MAX (2) // FIXME
-static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
- { 0, 0, 0, 0, 0, }
-};
-
-
/*
- * Construct pmap_devmap[] with DT-derived config data.
+ * Construct static devmap entries to map out the most frequently used
+ * peripherals using 1mb section mappings.
*/
int
initarm_devmap_init(void)
{
- int i = 0;
#if defined(SOC_OMAP4)
- fdt_devmap[i].pd_va = 0xF8000000;
- fdt_devmap[i].pd_pa = 0x48000000;
- fdt_devmap[i].pd_size = 0x1000000;
- fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- fdt_devmap[i].pd_cache = PTE_DEVICE;
- i++;
+ arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */
+ arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_CFG devices */
#elif defined(SOC_TI_AM335X)
- fdt_devmap[i].pd_va = 0xF4C00000;
- fdt_devmap[i].pd_pa = 0x44C00000; /* L4_WKUP */
- fdt_devmap[i].pd_size = 0x400000; /* 4 MB */
- fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- fdt_devmap[i].pd_cache = PTE_DEVICE;
- i++;
+ arm_devmap_add_entry(0x44C00000, 0x00400000); /* 4mb L4_WKUP devices*/
+ arm_devmap_add_entry(0x47400000, 0x00100000); /* 1mb USB */
+ arm_devmap_add_entry(0x47800000, 0x00100000); /* 1mb mmchs2 */
+ arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */
+ arm_devmap_add_entry(0x49000000, 0x00100000); /* 1mb edma3 */
+ arm_devmap_add_entry(0x49800000, 0x00300000); /* 3mb edma3 */
+ arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_FAST devices*/
#else
#error "Unknown SoC"
#endif
-
- arm_devmap_register_table(&fdt_devmap[0]);
return (0);
}
diff --git a/sys/arm/versatile/bus_space.c b/sys/arm/versatile/bus_space.c
index 4cce820..375c551 100644
--- a/sys/arm/versatile/bus_space.c
+++ b/sys/arm/versatile/bus_space.c
@@ -1,7 +1,9 @@
/*-
- * Copyright (C) 2012 FreeBSD Foundation
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
+ * Developed by Semihalf.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
diff --git a/sys/arm/xilinx/zy7_bus_space.c b/sys/arm/xilinx/zy7_bus_space.c
index 4cce820..375c551 100644
--- a/sys/arm/xilinx/zy7_bus_space.c
+++ b/sys/arm/xilinx/zy7_bus_space.c
@@ -1,7 +1,9 @@
/*-
- * Copyright (C) 2012 FreeBSD Foundation
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
+ * Developed by Semihalf.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
diff --git a/sys/boot/fdt/dts/dockstar.dts b/sys/boot/fdt/dts/dockstar.dts
index 578fe57..595894a 100644
--- a/sys/boot/fdt/dts/dockstar.dts
+++ b/sys/boot/fdt/dts/dockstar.dts
@@ -209,6 +209,8 @@
reg = <0x30000 0x10000>;
interrupts = <22>;
interrupt-parent = <&PIC>;
+
+ sram-handle = <&SRAM>;
};
usb@50000 {
diff --git a/sys/conf/files b/sys/conf/files
index cac3b54..5d78804 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1405,7 +1405,6 @@ dev/fb/fb_if.m standard
dev/fb/splash.c optional sc splash
dev/fdt/fdt_common.c optional fdt
dev/fdt/fdt_ic_if.m optional fdt
-dev/fdt/fdt_pci.c optional fdt pci
dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand
dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \
dependency "$S/boot/fdt/dts/${FDT_DTS_FILE}"
diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c
index 6233094..9d6840c 100644
--- a/sys/dev/fdt/fdt_common.c
+++ b/sys/dev/fdt/fdt_common.c
@@ -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>
diff --git a/sys/dev/fdt/fdt_common.h b/sys/dev/fdt/fdt_common.h
index f3f9b07..edc98fe 100644
--- a/sys/dev/fdt/fdt_common.h
+++ b/sys/dev/fdt/fdt_common.h
@@ -35,18 +35,11 @@
#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
#define DI_MAX_INTR_NUM 32
-struct fdt_pci_range {
- u_long base_pci;
- u_long base_parent;
- u_long len;
-};
-
struct fdt_sense_level {
enum intr_trigger trig;
enum intr_polarity pol;
@@ -101,9 +94,6 @@ int fdt_is_enabled(phandle_t);
int fdt_pm_is_enabled(phandle_t);
int fdt_is_type(phandle_t, const char *);
int fdt_parent_addr_cells(phandle_t);
-int fdt_pci_ranges(phandle_t, struct fdt_pci_range *, struct fdt_pci_range *);
-int fdt_pci_ranges_decode(phandle_t, struct fdt_pci_range *,
- struct fdt_pci_range *);
int fdt_ranges_verify(pcell_t *, int, int, int, int);
int fdt_reg_to_rl(phandle_t, struct resource_list *);
int fdt_pm(phandle_t);
diff --git a/sys/dev/fdt/fdt_pci.c b/sys/dev/fdt/fdt_pci.c
deleted file mode 100644
index d4f4b6c..0000000
--- a/sys/dev/fdt/fdt_pci.c
+++ /dev/null
@@ -1,209 +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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ktr.h>
-#include <sys/kernel.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-#include <sys/malloc.h>
-
-#include <dev/fdt/fdt_common.h>
-#include <dev/pci/pcireg.h>
-
-#include <machine/fdt.h>
-#if defined(__arm__)
-#include <machine/devmap.h>
-#endif
-
-#include "ofw_bus_if.h"
-#include "pcib_if.h"
-
-#ifdef DEBUG
-#define debugf(fmt, args...) do { printf("%s(): ", __func__); \
- printf(fmt,##args); } while (0)
-#else
-#define debugf(fmt, args...)
-#endif
-
-#define FDT_RANGES_CELLS ((3 + 3 + 2) * 2)
-
-static void
-fdt_pci_range_dump(struct fdt_pci_range *range)
-{
-#ifdef DEBUG
- printf("\n");
- printf(" base_pci = 0x%08lx\n", range->base_pci);
- printf(" base_par = 0x%08lx\n", range->base_parent);
- printf(" len = 0x%08lx\n", range->len);
-#endif
-}
-
-int
-fdt_pci_ranges_decode(phandle_t node, struct fdt_pci_range *io_space,
- struct fdt_pci_range *mem_space)
-{
- pcell_t ranges[FDT_RANGES_CELLS];
- struct fdt_pci_range *pci_space;
- pcell_t addr_cells, size_cells, par_addr_cells;
- pcell_t *rangesptr;
- pcell_t cell0, cell1, cell2;
- int tuple_size, tuples, i, rv, offset_cells, len;
-
- /*
- * Retrieve 'ranges' property.
- */
- if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0)
- return (EINVAL);
- if (addr_cells != 3 || size_cells != 2)
- return (ERANGE);
-
- par_addr_cells = fdt_parent_addr_cells(node);
- if (par_addr_cells > 3)
- return (ERANGE);
-
- len = OF_getproplen(node, "ranges");
- if (len > sizeof(ranges))
- return (ENOMEM);
-
- if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0)
- return (EINVAL);
-
- tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells +
- size_cells);
- tuples = len / tuple_size;
-
- /*
- * Initialize the ranges so that we don't have to worry about
- * having them all defined in the FDT. In particular, it is
- * perfectly fine not to want I/O space on PCI busses.
- */
- bzero(io_space, sizeof(*io_space));
- bzero(mem_space, sizeof(*mem_space));
-
- rangesptr = &ranges[0];
- offset_cells = 0;
- for (i = 0; i < tuples; i++) {
- cell0 = fdt_data_get((void *)rangesptr, 1);
- rangesptr++;
- cell1 = fdt_data_get((void *)rangesptr, 1);
- rangesptr++;
- cell2 = fdt_data_get((void *)rangesptr, 1);
- rangesptr++;
-
- if (cell0 & 0x02000000) {
- pci_space = mem_space;
- } else if (cell0 & 0x01000000) {
- pci_space = io_space;
- } else {
- rv = ERANGE;
- goto out;
- }
-
- if (par_addr_cells == 3) {
- /*
- * This is a PCI subnode 'ranges'. Skip cell0 and
- * cell1 of this entry and only use cell2.
- */
- offset_cells = 2;
- rangesptr += offset_cells;
- }
-
- if (fdt_data_verify((void *)rangesptr, par_addr_cells -
- offset_cells)) {
- rv = ERANGE;
- goto out;
- }
- pci_space->base_parent = fdt_data_get((void *)rangesptr,
- par_addr_cells - offset_cells);
- rangesptr += par_addr_cells - offset_cells;
-
- if (fdt_data_verify((void *)rangesptr, size_cells)) {
- rv = ERANGE;
- goto out;
- }
- pci_space->len = fdt_data_get((void *)rangesptr, size_cells);
- rangesptr += size_cells;
-
- pci_space->base_pci = cell2;
- }
- rv = 0;
-out:
- return (rv);
-}
-
-int
-fdt_pci_ranges(phandle_t node, struct fdt_pci_range *io_space,
- struct fdt_pci_range *mem_space)
-{
- int err;
-
- debugf("Processing PCI node: %x\n", node);
- if ((err = fdt_pci_ranges_decode(node, io_space, mem_space)) != 0) {
- debugf("could not decode parent PCI node 'ranges'\n");
- return (err);
- }
-
- debugf("Post fixup dump:\n");
- fdt_pci_range_dump(io_space);
- fdt_pci_range_dump(mem_space);
- return (0);
-}
-
-#if defined(__arm__)
-int
-fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, vm_offset_t io_va,
- vm_offset_t mem_va)
-{
- struct fdt_pci_range io_space, mem_space;
- int error;
-
- if ((error = fdt_pci_ranges_decode(node, &io_space, &mem_space)) != 0)
- return (error);
-
- devmap->pd_va = (io_va ? io_va : io_space.base_parent);
- devmap->pd_pa = io_space.base_parent;
- devmap->pd_size = io_space.len;
- devmap->pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- devmap->pd_cache = PTE_NOCACHE;
- devmap++;
-
- devmap->pd_va = (mem_va ? mem_va : mem_space.base_parent);
- devmap->pd_pa = mem_space.base_parent;
- devmap->pd_size = mem_space.len;
- devmap->pd_prot = VM_PROT_READ | VM_PROT_WRITE;
- devmap->pd_cache = PTE_NOCACHE;
- return (0);
-}
-#endif
-
diff --git a/sys/dev/fdt/fdtbus.c b/sys/dev/fdt/fdtbus.c
index 3a6659a..a0ebec8 100644
--- a/sys/dev/fdt/fdtbus.c
+++ b/sys/dev/fdt/fdtbus.c
@@ -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));
-}
-
diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c
index 5ed145f..b0f8fee 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -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>
diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c
index 39a6a1c..5a0ebd7 100644
--- a/sys/dev/uart/uart_bus_fdt.c
+++ b/sys/dev/uart/uart_bus_fdt.c
@@ -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>
diff --git a/sys/dev/uart/uart_dev_lpc.c b/sys/dev/uart/uart_dev_lpc.c
index ba87a17..08cebc9 100644
--- a/sys/dev/uart/uart_dev_lpc.c
+++ b/sys/dev/uart/uart_dev_lpc.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <machine/bus.h>
+#include <machine/fdt.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_cpu.h>
@@ -43,16 +44,13 @@ __FBSDID("$FreeBSD$");
#include "uart_if.h"
#define DEFAULT_RCLK (13 * 1000 * 1000)
-#define LPC_UART_NO(_bas) (((_bas->bsh) - LPC_UART_BASE) >> 15)
-#define lpc_ns8250_get_auxreg(_bas, _reg) \
- bus_space_read_4((_bas)->bst, LPC_UART_CONTROL_BASE, _reg)
-#define lpc_ns8250_set_auxreg(_bas, _reg, _val) \
- bus_space_write_4((_bas)->bst, LPC_UART_CONTROL_BASE, _reg, _val);
+static bus_space_handle_t bsh_clkpwr;
+
#define lpc_ns8250_get_clkreg(_bas, _reg) \
- bus_space_read_4((_bas)->bst, LPC_CLKPWR_BASE, (_reg))
+ bus_space_read_4(fdtbus_bs_tag, bsh_clkpwr, (_reg))
#define lpc_ns8250_set_clkreg(_bas, _reg, _val) \
- bus_space_write_4((_bas)->bst, LPC_CLKPWR_BASE, (_reg), (_val))
+ bus_space_write_4(fdtbus_bs_tag, bsh_clkpwr, (_reg), (_val))
/*
* Clear pending interrupts. THRE is cleared by reading IIR. Data
@@ -293,9 +291,12 @@ lpc_ns8250_init(struct uart_bas *bas, int baudrate, int databits, int stopbits,
u_long clkmode;
/* Enable UART clock */
- clkmode = lpc_ns8250_get_auxreg(bas, LPC_UART_CLKMODE);
- lpc_ns8250_set_auxreg(bas, LPC_UART_CLKMODE,
- clkmode | LPC_UART_CLKMODE_UART5(1));
+ bus_space_map(fdtbus_bs_tag, LPC_CLKPWR_PHYS_BASE, LPC_CLKPWR_SIZE, 0,
+ &bsh_clkpwr);
+ clkmode = lpc_ns8250_get_clkreg(bas, LPC_UART_CLKMODE);
+ lpc_ns8250_set_clkreg(bas, LPC_UART_CLKMODE, clkmode |
+ LPC_UART_CLKMODE_UART5(1));
+
#if 0
/* Work around H/W bug */
uart_setreg(bas, REG_DATA, 0x00);
diff --git a/sys/mips/include/fdt.h b/sys/mips/include/fdt.h
index 2f1fda5..72cc485 100644
--- a/sys/mips/include/fdt.h
+++ b/sys/mips/include/fdt.h
@@ -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.
diff --git a/sys/powerpc/include/fdt.h b/sys/powerpc/include/fdt.h
deleted file mode 100644
index 955e3c7..0000000
--- a/sys/powerpc/include/fdt.h
+++ /dev/null
@@ -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_ */
diff --git a/sys/x86/include/fdt.h b/sys/x86/include/fdt.h
index 77a0a2f..b25cacb 100644
--- a/sys/x86/include/fdt.h
+++ b/sys/x86/include/fdt.h
@@ -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
diff --git a/sys/x86/include/ofw_machdep.h b/sys/x86/include/ofw_machdep.h
index 13e756e..8344f56 100644
--- a/sys/x86/include/ofw_machdep.h
+++ b/sys/x86/include/ofw_machdep.h
@@ -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_ */
OpenPOWER on IntegriCloud