Commit Graph

33 Commits

Author SHA1 Message Date
Andrew Turner
c0fd148b5d Increase the number of fdt memory regions we support to 16. Some SoCs have
many excluded regions causing a buffer overflow in the early boot code if
this value is too small.

Obtained from:	ABT Systems Ltd
Sponsored by:	Turing Robotic Industries
2018-05-29 17:44:40 +00:00
Andrew Turner
1442afc1c7 Handle reserved memory with the no-map property.
We shouldn't be mapping this memory, so we need to find it so it
can be excluded from the phys_avail map.

Reviewed by:	manu
Obtained from:	ABT Systems Ltd
Sponsored by:	Turing Robotic Industries
Differential Revision:	https://reviews.freebsd.org/D15518
2018-05-22 16:03:41 +00:00
Andrew Turner
626a198305 Move fdt_is_type to be a Marvell specific function. It's not used by any
other SoCs.

Sponsored by:	DARPA, AFRL
2018-04-08 12:20:06 +00:00
Andrew Turner
9e4fa9eb4a Remove fdt_pm_is_enabled as it's Marvell specific. Replace the only call to
it with a call to the helper function fdt_pm_is_enabled would call.

Sponsored by:	DARPA, AFRL
2018-04-04 13:37:59 +00:00
Andrew Turner
12295c211a Remove fdt_is_enabled, fdt_reg_to_rl, and fdt_get_unit. These are not used
by anything in the tree.

Sponsored by:	DARPA, AFRL
2018-04-03 13:30:40 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Andrew Turner
d177f4b8f1 Make fdt_pm_mask_table internal to the Marvell code, it's unued anywhere
else.

Sponsored by:	ABT Systems Ltd
2017-01-26 13:04:14 +00:00
Andrew Turner
f74776ed75 Make fdt_is_compatible a static function. It's only used in fdt_common.c.
Sponsored by:	ABT Systems Ltd
2016-11-19 13:57:21 +00:00
Stephen J. Kiernan
a183d81dc9 Add hw.fdt sysctl node.
Make FDT blob available via opaque hw.fdt.dtb sysctl, if a DTB has been
installed by the time sysctls are registered.

Reviewed by:	andrew
Approved by:	sjg (mentor)
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D7411
2016-08-06 18:48:47 +00:00
Andrew Turner
59c3cb81c1 Rename ARM_INTRNG and MIPS_INTRNG to INTRNG. This will help with machine
independent code that needs to know about INTRNG such as PCI drivers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-04-15 16:05:41 +00:00
Michal Meloun
e64c374375 ARM: Parse command line delivered by U-Boot:
- in atags
- in DT blob (by using 'fdt chosen' U-Boot command)

The command line must start with guard's string 'FreeBSD:' and can contain
list of comma separated kenv strings. Also, boot modifier strings from
boot.h are recognised and parsed into boothowto.

The command line must be passed from U-Boot by setting of bootargs variable:
'setenv bootargs FreeBSD:boot_single=1,vfs.root.mountfrom=ufs:/dev/ada0s1a'
followed by 'fdt chosen' (only for DT based boot)
2016-03-26 06:59:01 +00:00
Andrew Turner
9636600cf2 Make the memory size returned from fdt_get_mem_regions a 64-bit type. This
is the physical memory size so may be larger than a u_long can hold, e.g.
on ARM with LPAE we could see an address space of up to 40 bits. On ARM
u_long is only 32 bits so the memory size will be truncated, possibly to
zero.

Reported by:	bz
Sponsored by:	ABT Systems Ltd
2016-03-01 11:39:07 +00:00
Wojciech Macek
e571e15cb0 Fix fdt_get_mem_regions() to work with 64-bit addresses
Use u_long instead of uint32_t variables to avoid overflow
    in case of PA space bigger than 32-bit.

Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Approved by:           cognet (mentor)
Reviewed by:           andrew, br, wma
Differential revision: https://reviews.freebsd.org/D5393
2016-02-29 09:22:39 +00:00
Andrew Turner
324636c328 Only define fdt_pic_table on arm, and when not using intrng as this is
the only place that uses it.
2016-01-22 13:09:43 +00:00
Andrew Turner
252a329b5b Remove fdt_fixup_table from architectures where it's unneeded. We only make
use of fdt_fixup_table on PowerPC and ARM. As such we can remove it from
other architectures as it's unneeded.

Reviewed by:	nwhitehorn
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5013
2016-01-21 16:48:01 +00:00
Oleksandr Tymoshenko
37c1967c5b Rename fdt_find_child to ofw_bus_find_child. There is nothing FDT-specific
in this function.

Suggested by: andrew@
2015-05-24 23:53:10 +00:00
Oleksandr Tymoshenko
2569f51471 Add helper method fdt_find_child to make access to child nodes easier.
Some FDT nodes have complex properties organized as a child sub-nodes
(e.g. timing for LCD panel) we need easy way to obtain handles for
these sub-nodes
2015-05-22 02:00:44 +00:00
Ruslan Bukin
ba2ea14a6a Eliminate fdt_data_verify(). The verification it proceed is wrong
disallowing us to encode 64-bit register numbers.

Discussed with:	nwhitehorn, andrew
2014-12-15 09:40:25 +00:00
Ian Lepore
c47d4cde39 Replace multiple nearly-identical copies of code to walk through an FDT
node's interrupts=<...> property creating resource list entries with a
single common implementation.  This change makes ofw_bus_intr_to_rl() the
one true copy of that code and removes the copies of it from other places.

This also adds handling of the interrupts-extended property, which allows
specifying multiple interrupts for a node where each interrupt can have a
separate interrupt-parent.  The bindings for this state that the property
cells contain an xref phandle to the interrupt parent followed by whatever
interrupt info that parent normally expects.  This leads to having a
variable number of icells per interrupt in the property.  For example you
could have <&intc1 1 &intc2 26 9 0 &intc3 9 4>.

Differential Revision: https://reviews.freebsd.org/D803
2014-09-25 15:02:33 +00:00
Ian Lepore
731ff010b9 Add a helper routine to depth-search the device tree for a node with a
matching 'compatible' property.  This probably has a short half-life (as
do most of the fdt_ functions), but it helps solve some near-term needs
until we work out the larger problems of device instantiation order
versus the order of things in the fdt data.
2014-02-16 03:00:59 +00:00
Ian Lepore
02c7dba919 Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs,
related to setting up static device mappings.  Since it was only used by
arm/mv/mv_pci.c, it's now just static functions within that file, plus
one public function that gets called only from arm/mv/mv_machdep.c.
2014-01-05 22:36:34 +00:00
Nathan Whitehorn
dcd08302e5 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.
2014-01-05 18:46:58 +00:00
Nathan Whitehorn
67dbd33ca8 Reimplement fdt_intr_to_rl() in terms of OFW_BUS_MAP_INTR() and
OFW_BUS_CONFIG_INTR(). This function is only used by simplebus, so will
likely be moved there in the future.
2014-01-04 21:14:33 +00:00
Nathan Whitehorn
fc54707f7d Remove dead code. Most of this was in an #if 0 block; the rest is not
used and duplicates functionality in dev/ofw.
2013-12-17 14:51:47 +00:00
Brooks Davis
1f40dbc854 MFP4: 223121 (FDT infrastructure portion)
Implement support for interrupt-parent nodes in simplebus.  The current
implementation requires that device declarations have an interrupt-parent
node and that it point to a device that has registered itself as a
interrupt controller in fdt_ic_list_head and implements the fdt_ic
interface.

Sponsored by:   DARPA/AFRL
2013-10-21 21:13:01 +00:00
Oleksandr Tymoshenko
8966173312 Bump per-device interrupt limit to more reasonable default.
Some hardware like DMA and GPIO controllers might require
more then 8 interrupts per device instance.

Submitted by:	Daisuke Aoyama <aoyama at peach.ne.jp>
Discussed with:	gber@, raj@
2013-02-23 22:58:04 +00:00
Oleksandr Tymoshenko
1d1ffd9efb Add fdt_get_reserved_regions function. API is simmilar to fdt_get_mem_regions
It returns memory regions restricted from being used by kernel. These
regions are dfined in "memreserve" property of root node in the same
format as "reg" property of /memory node
2012-11-30 03:08:49 +00:00
Grzegorz Bernacki
2c99056488 Add fdt_get_unit() function.
Obtained from:	Semihalf
2012-09-14 09:36:35 +00:00
Oleksandr Tymoshenko
8bb9363760 Merging of projects/armv6, part 4
r233822:
  Remove useless and wrong piece of code in fdt_get_range() which i
  overwrites passed phandle_t node. Modify debug printf in fdt_reg_to_rl()
  to be consistent (that is, print start and end *virtual* addresses).

r230560:
  Handle "ranges;"
  Make fdt_reg_to_rl() responsible for mapping the device memory, instead
  on just hoping that there's only one simplebus, and using fdt_immr_va as
  the base VA.

r230315
  Add a function to get the PA from range, instead of (ab)using
  fdt_immr_pa, and use it for the UART driver
2012-08-15 03:49:10 +00:00
Grzegorz Bernacki
4ffd4dfe17 Add a new geom class which allows to divide NAND Flash chip
into partitions.

Partitions are created based on data in dts file which are
extracted and interpreted by slicer.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-22 08:33:14 +00:00
Rafal Jaworowski
aa15e881bb Respect phy-handle property in Ethernet nodes of the device tree.
This lets specify whereabouts of the parent PHY for a given MAC node
(and get rid of ugly kludges in mge(4) and tsec(4)).

Obtained from:	Semihalf
MFC after:	1 week
2012-03-04 19:22:52 +00:00
Rafal Jaworowski
4f124b977c Eliminate FDT_IMMR_VA define.
This removes platform dependencies from <machine>/fdt.h for the benfit of
portability.
2010-07-19 18:47:18 +00:00
Rafal Jaworowski
58158742f2 Import the common Flattened Device Tree infrastructure.
o fdtbus(4) - the main abstract bus driver for all FDT-compliant systems. This
  is a direct replacement for the many incompatible bus drivers grouping
  integrated peripherals on embedded platforms (like obio(4), ocpbus(4) etc.)

o simplebus(4) - bus driver representing ePAPR style 'simple-bus' node, which
  is an umbrella device for most of the integrated peripherals on a typical
  system-on-chip device.

o Other components (common routines library, PCI node processing helper
  functions)

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-06-02 17:17:45 +00:00