History log of /freebsd-current/sys/dev/ofw/ofw_bus_subr.h
Revision Date Author Comments
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 7b5d62bb 18-Oct-2022 Takanori Watanabe <takawata@FreeBSD.org>

ofw: add BUS_GET_DEVICE_PATH interface to openfirm/fdt, somewhat incomplete.

This add BUS_GET_DEVICE_PATH interface,
which shows device tree of openfirm/fdt.

In qemu-system-arm64 with "virt" machine with device-tree firmware,
% devctl getpath OFW cpu0

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37031


# 0b6bacc7 06-May-2022 Ruslan Bukin <br@FreeBSD.org>

Add ofw_bus_iommu_map() that maps PCI requester ID to an IOMMU
specifier based on "iommu-map" DTS property.

Sponsored by: UKRI


# ddfc9c4c 22-Jun-2021 Warner Losh <imp@FreeBSD.org>

newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf

Now that the upper layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.

Reviewed by: jhb, bcr
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29937


# 9977bd1d 30-Nov-2019 Ian Lepore <ian@FreeBSD.org>

Add an OFWBUS_PNP_INFO() macro for devices that hang directly off the root
ofwbus. Also, apply some style(9) whitespace fixing to the
SIMPLEBUS_PNP_INFO() macro (no functional change).


# b609a553 23-May-2019 Ian Lepore <ian@FreeBSD.org>

Define macros making it easier to define bus-specific pnpinfo for FDT systems.

Pnpinfo is bus-specific and requires the bus name. The FDTCOMPAT_PNP_INFO()
macro makes it easier to define new FDT-based pnpinfo for busses other than
simplebus.

Differential Revision: https://reviews.freebsd.org/D20382


# 329e817f 26-Sep-2018 Warner Losh <imp@FreeBSD.org>

Reapply, with minor tweaks, r338025, from the original commit:

Remove unused and easy to misuse PNP macro parameter

Inspired by r338025, just remove the element size parameter to the
MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to
have correct pointer (or array) type. Since all invocations of the macro
already had this property and the emitted PNP data continues to include the
element size, there is no functional change.

Mostly done with the coccinelle 'spatch' tool:

$ cat modpnpsize0.cocci
@normaltables@
identifier b,c;
expression a,d,e;
declarer MODULE_PNP_INFO;
@@
MODULE_PNP_INFO(a,b,c,d,
-sizeof(d[0]),
e);

@singletons@
identifier b,c,d;
expression a;
declarer MODULE_PNP_INFO;
@@
MODULE_PNP_INFO(a,b,c,&d,
-sizeof(d),
1);

$ rg -l MODULE_PNP_INFO -- sys | \
xargs spatch --in-place --sp-file modpnpsize0.cocci

(Note that coccinelle invokes diff(1) via a PATH search and expects diff to
tolerate the -B flag, which BSD diff does not. So I had to link gdiff into
PATH as diff to use spatch.)

Tinderbox'd (-DMAKE_JUST_KERNELS).
Approved by: re (glen)


# b8e771e9 18-Aug-2018 Conrad Meyer <cem@FreeBSD.org>

Back out r338035 until Warner is finished churning GSoC PNP patches

I was not aware Warner was making or planning to make forward progress in
this area and have since been informed of that.

It's easy to apply/reapply when churn dies down.


# faa31943 18-Aug-2018 Conrad Meyer <cem@FreeBSD.org>

Remove unused and easy to misuse PNP macro parameter

Inspired by r338025, just remove the element size parameter to the
MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to
have correct pointer (or array) type. Since all invocations of the macro
already had this property and the emitted PNP data continues to include the
element size, there is no functional change.

Mostly done with the coccinelle 'spatch' tool:

$ cat modpnpsize0.cocci
@normaltables@
identifier b,c;
expression a,d,e;
declarer MODULE_PNP_INFO;
@@
MODULE_PNP_INFO(a,b,c,d,
-sizeof(d[0]),
e);

@singletons@
identifier b,c,d;
expression a;
declarer MODULE_PNP_INFO;
@@
MODULE_PNP_INFO(a,b,c,&d,
-sizeof(d),
1);

$ rg -l MODULE_PNP_INFO -- sys | \
xargs spatch --in-place --sp-file modpnpsize0.cocci

(Note that coccinelle invokes diff(1) via a PATH search and expects diff to
tolerate the -B flag, which BSD diff does not. So I had to link gdiff into
PATH as diff to use spatch.)

Tinderbox'd (-DMAKE_JUST_KERNELS).


# d310c9e0 03-Apr-2018 Marcin Wojtas <mw@FreeBSD.org>

Add api for creating resource list based on 'assigned-addresses'

According to device tree binding 'assigned-addresses' can refer to PCIE MMIO
register space. New function ofw_bus_assigned_addresses_to_rl is
provided to support it.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14750


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# 60435858 04-Oct-2017 Warner Losh <imp@FreeBSD.org>

'private' isn't a PNP string field, so instead used the reserved '#'
name for this field (it might even be possible to just drop it
entirely, since it will be ignored either way).

Sponsored by: Netflix


# e5e94d2d 25-Jan-2017 Wojciech Macek <wma@FreeBSD.org>

Expand OpenFirmware API with ofw_bus_node_status_okay
method

Method could be used before we can access device_t structure.
As per simple phandle_t handle we can access FDT to check
if specified node has been enabled.
It will be used in Marvell's common configuration code.

Submitted by: Konrad Adamczyk <ka@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: zbb, meloun-miracle-cz
Differential revision: https://reviews.freebsd.org/D9218


# 24f4202d 28-Aug-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Check all compatible strings on uart devices in powerpc

Summary:
Some device trees put "fsl,ns16650" first in the compatible list. This causes
the probe code to choke, even though the device is compatible with ns16650, and
has it listed later in the tree.

Reviewed by: nwhitehorn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D7676


# 895c8b1c 19-Aug-2016 Michal Meloun <mmel@FreeBSD.org>

INTRNG: Rework handling with resources. Partially revert r301453.
- Read interrupt properties at bus enumeration time and store
it into global mapping table.
- At bus_activate_resource() time, given mapping entry is resolved and
connected to real interrupt source. A copy of mapping entry is attached
to given resource.
- At bus_setup_intr() time, mapping entry stored in resource is used
for delivery of requested interrupt configuration.
- For MSI/MSIX interrupts, mapping entry is created within
pci_alloc_msi()/pci_alloc_msix() call.
- For legacy PCI interrupts, mapping entry must be created within
pcib_route_interrupt() by pcib driver itself.

Reviewed by: nwhitehorn, andrew
Differential Revision: https://reviews.freebsd.org/D7493


# ad5244ec 05-Jun-2016 Svatopluk Kraus <skra@FreeBSD.org>

INTRNG - change the way how an interrupt mapping data are provided
to the framework in OFW (FDT) case.

This is a follow-up to r301451.

Differential Revision: https://reviews.freebsd.org/D6634


# 4cbedf8a 26-May-2016 Ian Lepore <ian@FreeBSD.org>

Fix a typo in a comment.


# 1e43b18c 16-May-2016 Andrew Turner <andrew@FreeBSD.org>

Add a pcib interface for use by interrupt controllers that need to
translate the pci rid to a controller ID. The translation could be based
on the 'msi-map' OFW property, a similar ACPI option, or hard-coded for
hardware lacking the above options.

Reviewed by: wma
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation


# 91ef8da0 08-Feb-2016 Adrian Chadd <adrian@FreeBSD.org>

Teach ofw_bus_parse_xref_list_alloc to be able to return the length of the parsed list.

Currently, there is no easy way to know in advance how many entries a list parsed by
ofw_bus_parse_xref_list_alloc() in sys/dev/ofw/ofw_bus_subr.c has.

This patch:

* teaches the existing function about handling idx == -1 and returning how big
the set is; then renames it as _internal;
* create a new function that asserts idx != -1, so the old API is maintained;
* add a new function that returns just the list length.

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Differential Revision: https://reviews.freebsd.org/D5043


# 31c9adb7 17-Dec-2015 Warner Losh <imp@FreeBSD.org>

Create a simplebus PNP info wrapper.

Differential Review: https://reviews.freebsd.org/D4517


# 0b757c47 13-Dec-2015 Michal Meloun <mmel@FreeBSD.org>

OFW: Add helper functions for parsing xref based lists.
By using this functions, we can parse a list of tuples, each of them holds
xref and variable number of values.
This kind of list is used in DT for clocks, gpios, resets ...

Discussed with: ian, nwhitehorn
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D4316


# 821a61ef 02-Dec-2015 Michal Meloun <mmel@FreeBSD.org>

OFW: Move code for searching interrupt parent into separate function.
It can be used by interrupt controller drivers.

Approved by: kib (mentor)


# bb39ff4c 19-Jun-2015 Warner Losh <imp@FreeBSD.org>

Add ofw_bus_find_child_by_phandle, a helper routine to find a device_t
child matchig a given phandle_t.

Differential Revision: https://reviews.freebsd.org/D2871


# 37c1967c 24-May-2015 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Rename fdt_find_child to ofw_bus_find_child. There is nothing FDT-specific
in this function.

Suggested by: andrew@


# a8c5ea04 15-May-2015 Ruslan Bukin <br@FreeBSD.org>

Provide the number of interrupt resources added to the list
by using extra argument, so caller will know that.


# 8a56ddde 11-May-2015 Andrew Turner <andrew@FreeBSD.org>

Add the ofw_bus_subr.h change missed in r282770.


# 4b3d9160 12-Jan-2015 Zbigniew Bodek <zbb@FreeBSD.org>

Introduce ofw_bus_reg_to_rl() to replace part of common bus code

Instead of reusing the same reg parsing code, create one, common function
that puts reg contents to the resource list. Address cells and size cells
are passed rather than acquired here so that any bus can have different
default values.

Obtained from: Semihalf
Reviewed by: andrew, ian, nwhitehorn
Sponsored by: The FreeBSD Foundation


# c47d4cde 25-Sep-2014 Ian Lepore <ian@FreeBSD.org>

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


# e4be5a16 02-Feb-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Add a set of helpers (ofw_bus_get_status() and ofw_bus_status_okay()) to
process "status" properties of OF nodes.

I've avoided adding new KOBJ methods here so that we don't have to modify
every ofw_bus in the tree. Since 100% of implementations of ofw_bus use
only ofw_bus_gen_*(), it might be worth garbage-collecting the other
methods as well.


# 95e3bfe8 17-Dec-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf
internally instead of requiring the caller to allocate it.


# 498fa7c1 25-Oct-2013 Ian Lepore <ian@FreeBSD.org>

Add a helper routine to search for a compat string in a table that
associates compat strings with arbitrary values that mean something to
the driver. This is handy for drivers that support several variations
of similar hardware and need to know which one matched.

Reviewed by: imp, jmg, nwhitehorn


# 26ca4965 18-Aug-2012 Hiroki Sato <hrs@FreeBSD.org>

- Add OF_hasprop() and ofw_bus_has_prop(). These can be used to check
existence of the property.

- Fix ofw_bus_is_compatible{,_strict}() to prevent substring match in the
compatible string.

Reviewed by: raj


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# eaef5f0a 18-Jun-2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Provide for multiple, cascaded PICs on PowerPC systems, and extend the
OFW interrupt map interface to also return the device's interrupt parent.

MFC after: 8.1-RELEASE


# 8297758a 28-May-2010 Rafal Jaworowski <raj@FreeBSD.org>

Prepare and extend OFW layer for FDT support.

o Let OFW_INIT() and OF_init() return status value.

o Provide helper routines for 'compatible' property handling.

o Only compile OF and OFW code, which is relevant in FDT scenario.

o Other minor cosmetics

Reviewed by: imp
Sponsored by: The FreeBSD Foundation


# 481d6b54 13-Jun-2009 Marius Strobl <marius@FreeBSD.org>

Fix style.


# 94b4a038 15-Dec-2008 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Adapt parts of the sparc64 Open Firmware bus enumeration code (in particular,
the code for parsing interrupt maps) to PowerPC and reflect their new MI
status by moving them to the shared dev/ofw directory.

This commit also modifies the OFW PCI enumeration procedure on PowerPC to
allow the bus to find non-firmware-enumerated devices that Apple likes to add,
and adds some useful Open Firmware properties (compat and name) to the pnpinfo
string of children on OFW SBus, EBus, PCI, and MacIO links. Because of the
change to PCI enumeration on PowerPC, X has started working again on PPC
machines with Grackle hostbridges.

Reviewed by: marius
Obtained from: sparc64


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# bba6f0a9 22-Nov-2005 Marius Strobl <marius@FreeBSD.org>

- Add a new method ofw_bus_default_get_devinfo() that allows to retrieve
a newly introduced struct ofw_bus_devinfo which can hold the OFW info
of a device recallable via the ofw_bus KOBJ interface. Introduce a set
of functions ofw_bus_gen_get_*() which use ofw_bus_default_get_devinfo()
to provide generic subroutines for implementing the rest of the ofw_bus
KOBJ interface in a bus driver.
This is inspired by bus_get_resource_list() and bus_generic_rl_*_resource()
and allows to reduce code duplication in bus drivers as they only have
to provide an ofw_bus_default_get_devinfo() implementation in order to
provide the ofw_bus KOBJ interface via ofw_bus_gen_get_*().
- While here add a comment to ofw_bus_if.m describing the intention of
the ofw_bus KOBJ interface.

Reviewed by: marcel