History log of /freebsd-head/sys/dev/ofw/openfirm.h
Revision Date Author Comments
48b94864c51253da92e4444f0074eec36ef391fb 03-Feb-2020 imp <imp@FreeBSD.org> Remove sparc64 kernel support

Remove all sparc64 specific files
Remove all sparc64 ifdefs
Removee indireeect sparc64 ifdefs
de3a5fc160836c2bd3cf0a9d8f6c25b8e8e14705 28-Dec-2019 pfg <pfg@FreeBSD.org> SPDX: update some tags with two licenses.
3308d36a5e2faea7a0284eb62ee256bf17a3c0cf 09-Apr-2018 gonzo <gonzo@FreeBSD.org> Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_alloc

Change OF_getencprop_alloc semantics to be combination of malloc and
OF_getencprop and return size of the property, not number of elements
allocated.

For the use cases where number of elements is preferred introduce
OF_getencprop_alloc_multi helper function that copies semantics
of OF_getencprop_alloc prior to this change.

This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi
function signatures consistent with OF_getencprop_alloc and
OF_getencprop_alloc_multi.

Functionality-wise this patch is mostly rename of OF_getencprop_alloc
to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo
where 1 was used as a block size.
eb86958de4eb4d7dad6c37478a58d16f00bac3e2 09-Apr-2018 gonzo <gonzo@FreeBSD.org> Make OF_searchencprop signature consistent with OF_getencprop

Use pcell_t* as a destination buffer argument instead of void
pointer to be consistent with OF_getencprop signature.
1252c9346c5d287a42e08197430f905762dae341 08-Apr-2018 gonzo <gonzo@FreeBSD.org> Clean up OF_getprop_alloc API

OF_getprop_alloc takes element size argument and returns number of
elements in the property. There are valid use cases for such behavior
but mostly API consumers pass 1 as element size to get string
properties. What API users would expect from OF_getprop_alloc is to be
a combination of malloc + OF_getprop with the same semantic of return
value. This patch modifies API signature to match these expectations.

For the valid use cases with element size != 1 and to reduce
modification scope new OF_getprop_alloc_multi function has been
introduced that behaves the same way OF_getprop_alloc behaved prior to
this patch.

Reviewed by: ian, manu
Differential Revision: https://reviews.freebsd.org/D14850
1537078d8f2e62e82de3c08bdcae0fd79dc35a4a 27-Nov-2017 pfg <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.
00d578928eca75be320b36d37543a7e2a4f9fbdb 27-May-2016 grehan <grehan@FreeBSD.org> Create branch for bhyve graphics import.
23a2d5f59362b8a60462708280c89083bb8d1b27 11-May-2016 gonzo <gonzo@FreeBSD.org> Add OF_prop_free function as a counterpart for OF_*prop_alloc

- Introduce new OF API function OF_prop_free to free memory allocated by
OF_getprop_alloc and OF_getencprop_alloc. Current code just calls free(9)
with M_OFWPROP memory class which assumes knowledge about OF_*prop_alloc
functions' internals and leads to unneccessary code coupling

- Convert some of the free(..., M_OFWPROP) instances to OF_prop_free

Files affected by this commit are the ones I was able to test on real
hardware. The rest of free(..., M_OFWPROP) instances will be handled with
idividual maintainers

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D6315
05274f8a8b8da8cd3adf7aa6d8a877992dbc44d2 16-Feb-2016 andrew <andrew@FreeBSD.org> Allow callers of OF_decode_addr to get the size of the found mapping. This
will allow for code that uses the old fdt_get_range and fdt_regsize
functions to find a range, map it, access, then unmap to replace this, up
to and including the map, with a call to OF_decode_addr.

As this function should only be used in the early boot code the unmap is
mostly do document we no longer need the mapping as it's a no-op, at least
on arm.

Reviewed by: jhibbits
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D5258
80bb89b864aea7650d39cedb4066e134533e4b18 21-Dec-2015 ian <ian@FreeBSD.org> Include machine/_bus.h so that bus_space_[tag|handle]_t will be available.

It appears that all platforms except aarch64 are getting the file via
various header pollution, and ensuring _bus.h is included before any
openfirmware headers in every consumer of ofw/fdt stuff seems like more of
a career path than a task, so I'm taking this easy way out.
f2c27d05283dc9a5c359331976911732b48ec7b6 21-Dec-2015 ian <ian@FreeBSD.org> Implement OF_decode_addr() for arm. Move most of powerpc's implementation
into a new function that other platforms can share.

This creates a new ofw_reg_to_paddr() function (in a new ofw_subr.c file)
that contains most of the existing ppc implementation, mostly unchanged.
The ppc code now calls the new MI code from the MD code, then creates a
ppc-specific bus_space mapping from the results. The new arm implementation
does the same in an arm-specific way.

This also moves the declaration of OF_decode_addr() from ofw_machdep.h to
openfirm.h, except on sparc64 which uses a different function signature.

This will help all FDT platforms to set up early console access using
OF_decode_addr().
af8e847649983ec197b4c4da32127b1864f1c9dd 26-Oct-2014 ian <ian@FreeBSD.org> MFC r270953, r270958, r270960, r271190, r271199, r271202:

Create a mechanism for looking up a device_t associated with an ofw/fdt
xref handle, and for registering that association. Also use the same data
for faster translations between node and xref handles.

Add OF_xref_from_device() so that there's no need to have an intermediate
call to ofw_bus_get_node() to lookup info that's already in the xreflist.

When registering an association between a device and an xref phandle, create
an entry in the xref list if one doesn't already exist for the given handle.
1c8cde378e7386ca86f33d4ce67b360782b6abec 26-Oct-2014 ian <ian@FreeBSD.org> MFC r270945:

Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().
c8e7d833d07614a2884d4a0ca2b7fd41e93acc12 06-Sep-2014 ian <ian@FreeBSD.org> Revert rr271190, it was based on a misunderstanding. The problem of
non-existant device<->xref info needs to be handled by creating the info,
which will come in a subsequent commit.
cd70b067cc30d9b2494dffc0658705e127c96c2c 06-Sep-2014 ian <ian@FreeBSD.org> Add OF_xref_from_node_strict() which returns -1 if there is no xref handle
for the node. The default routine returns the untranslated handle, which
is sometimes useful, but sometimes you really need to know there's no
entry in the xref<->node<->device translation table.
29ba19b429e334f6eb07025de2ff4a0018e6d583 02-Sep-2014 ian <ian@FreeBSD.org> Add OF_xref_from_device() so that there's no need to have an intermediate
call to ofw_bus_get_node() to lookup info that's already in the xreflist.
c1f3eb16af7730f8b65686792a66831af9b7debd 01-Sep-2014 ian <ian@FreeBSD.org> Create a mechanism for looking up a device_t associated with an ofw/fdt
xref handle, and for registering that association. Also use the same data
for faster translations between node and xref handles.

Now when fdt properties contain &othernode references, a driver can find
the device instance that corresponds to &othernode, and thus can use
interfaces provided by that instance.

Reviewed by: nwhitehorn
b149a9e7aec5e222b7dba23fdebc5717058e1c33 01-Sep-2014 ian <ian@FreeBSD.org> Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().

Discussed with: nwhitehorn
eb1a5f8de9f7ea602c373a710f531abbf81141c4 21-Feb-2014 gjb <gjb@FreeBSD.org> Move ^/user/gjb/hacking/release-embedded up one directory, and remove
^/user/gjb/hacking since this is likely to be merged to head/ soon.

Sponsored by: The FreeBSD Foundation
6b01bbf146ab195243a8e7d43bb11f8835c76af8 27-Dec-2013 gjb <gjb@FreeBSD.org> Copy head@r259933 -> user/gjb/hacking/release-embedded for initial
inclusion of (at least) arm builds with the release.

Sponsored by: The FreeBSD Foundation
8843b343e66ad85232a61eb3687ce898616adb6f 12-Dec-2013 andreast <andreast@FreeBSD.org> MFC: r256932, r256938, r256953

r256932:
Add a new function (OF_getencprop()) that undoes the transformation applied
by encode-int. Specifically, it takes a set of 32-bit cell values and
changes them to host byte order. Most non-string instances of OF_getprop()
should be using this function, which is a no-op on big-endian platforms.

r256938:
A few other common cases for encode-int decoding: OF_getencprop_alloc()
and OF_searchencprop(). I thought about using the element size parameter
to OF_getprop_alloc() to do endian-switching automatically, but it breaks
use with structs and a *lot* of FDT code (which can hopefully be moved to
these new APIs).

r256953:
Fix build.
15e1002387b7d7b3cfd66cfd2f22bbdefacbfae3 22-Oct-2013 nwhitehorn <nwhitehorn@FreeBSD.org> A few other common cases for encode-int decoding: OF_getencprop_alloc()
and OF_searchencprop(). I thought about using the element size parameter
to OF_getprop_alloc() to do endian-switching automatically, but it breaks
use with structs and a *lot* of FDT code (which can hopefully be moved to
these new APIs).

MFC after: 2 weeks
f79afef6544806637f37a77e0a14d8e2d70b0d24 22-Oct-2013 nwhitehorn <nwhitehorn@FreeBSD.org> Add a new function (OF_getencprop()) that undoes the transformation applied
by encode-int. Specifically, it takes a set of 32-bit cell values and
changes them to host byte order. Most non-string instances of OF_getprop()
should be using this function, which is a no-op on big-endian platforms.
3b7e4aa267bc7eedadb66a6fa1fac2a227969a41 15-Sep-2013 nwhitehorn <nwhitehorn@FreeBSD.org> Add a kernel interface (OF_xref_phandle()) for systems where phandles
used as cross-references in the device tree and phandles as used by the
Open Firmware client interface are in different namespaces. This include
IBM pSeries hardware as well as FDT systems. FDT certainly abuses
ihandles for this purpose and should be modified to use this API
eventually. This changes no behavior on systems where FreeBSD already
worked.

Reviewed by: marius
Approved by: re (kib)
MFC after: 2 weeks
5320d21e5403e54eded0635a6f0ac20db93b0467 18-Aug-2012 hrs <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
09f9c897d33c41618ada06fbbcf1a9b3812dee53 19-Oct-2010 jamie <jamie@FreeBSD.org> A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.
8f78316ea6a2267323b7c50d973e18e051ba2021 08-Jul-2010 nwhitehorn <nwhitehorn@FreeBSD.org> Missed a file in r209803: this header contains a definition of
OFW_STD_32BIT.

Pointy hat to: me
ef99eb110e7dc8e312597e69d22a462e881a05d0 28-May-2010 raj <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
b7a63fb85cd07072afa8e91201882f5a9c432e55 16-May-2010 nwhitehorn <nwhitehorn@FreeBSD.org> Pull OF_quiesce() out of the MI Open Firmware layer and entirely into
PPC ofw_machdep.c, in recognition of its state as a machine specific hack.

Requested by: marius
5236db452d5b06e3faf03f1827771f70170b6c71 16-May-2010 nwhitehorn <nwhitehorn@FreeBSD.org> On PowerMac11,2 and (presumably) PowerMac12,1, we need to quiesce the
firmware in order to take over control of the SMU. Without doing this,
the firmware background process doing fan control will run amok as we
take over the system and crash the management chip.

This is limited to these two machines because our kernel is heavily
dependent on firmware accesses, and so quiescing firmware can cause
nasty problems.
f1216d1f0ade038907195fc114b7e630623b402c 19-Mar-2010 delphij <delphij@FreeBSD.org> Create a custom branch where I will be able to do the merge.
3961775a2db6be3ae2d269fb4fd4bb0465075f50 14-Jun-2009 marius <marius@FreeBSD.org> Fix style.
4ca12119c31e0cd42b3cb4b28dd898b8218290dc 03-Jan-2009 nwhitehorn <nwhitehorn@FreeBSD.org> Fix the OFW interrupt map parser to use its own idea of the number of interrupt
cells in the map, instead of using a value passed to it and then panicing if it
disagrees. This fixes interrupt map parsing for PCI bridges on some Apple
Uninorth PCI controllers.

Reported by: marcel
Tested on: G4 iBook, Sun Ultra 5
3fcef6d9c20b6c3577c741e4a0fe24807fd08a66 20-Dec-2008 nwhitehorn <nwhitehorn@FreeBSD.org> Modularize the Open Firmware client interface to allow run-time switching
of OFW access semantics, in order to allow future support for real-mode
OF access and flattened device frees. OF client interface modules are
implemented using KOBJ, in a similar way to the PPC PMAP modules.

Because we need Open Firmware to be available before mutexes can be used on
sparc64, changes are also included to allow KOBJ to be used very early in
the boot process by only using the mutex once we know it has been initialized.

Reviewed by: marius, grehan
ad445e7d0590aaf984b9df1f4092b18739f02cb4 15-Dec-2008 nwhitehorn <nwhitehorn@FreeBSD.org> Unbreak ofwdump build by moving the pcell_t definition to after the kernel
types headers, and inside the _KERNEL ifdef.

Pointy hat to: me
f0e837432d62958c713c7e6ebbb2adc52c8fd696 15-Dec-2008 nwhitehorn <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
19b6af98ec71398e77874582eb84ec5310c7156f 22-Nov-2008 dfr <dfr@FreeBSD.org> Clone Kip's Xen on stable/6 tree so that I can work on improving FreeBSD/amd64
performance in Xen's HVM mode.
cf5320822f93810742e3d4a1ac8202db8482e633 19-Oct-2008 lulf <lulf@FreeBSD.org> - Import the HEAD csup code which is the basis for the cvsmode work.
1d8fcccf39baa1853feed8bcf07dcbbc33fb8ca8 16-Jun-2007 marius <marius@FreeBSD.org> - Restore the machine independency of sys/dev/ofw/openfirm.{c,h} by
moving OF_set_mmfsa_traptable() (SUNW,set-trap-table with the two
arguments used here is specific to sun4v) to MD code.
- In sys/dev/ofw/openfirm.h remove prototypes for unimplemented
functions and unused Solaris compatibility macros.
65e20bda0996ed88b33ac28272610e8f80624028 09-Oct-2006 kmacy <kmacy@FreeBSD.org> kernel clean up to make the sun4v kernel build

Reviewed by: jmg
Approved by: rwatson (mentor)
4b319958e7f00cc908274c4518b7a9c5ed821812 06-Jan-2005 imp <imp@FreeBSD.org> Start each of the license/copyright comments with /*-, minor shuffle of lines
24ad8a984216ddd6cda66a3325a55fe6bd74b88c 16-Aug-2004 marius <marius@FreeBSD.org> Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by: tmm
b5d362bc532139b1cd676ee21ec53643aacead85 07-Jun-2003 jake <jake@FreeBSD.org> Implement OF_interpret.

Obtained from: netbsd
c68dcf7b484e9669fe70ac5683cfee5f719e0ea4 18-Oct-2002 tmm <tmm@FreeBSD.org> Add an #ifdef _KERNEL to make it possible to include this file from
userland (to get the typedefs).
f90b466a8546d0524d6a6e155053dd4a402050e0 18-Nov-2001 tmm <tmm@FreeBSD.org> 1. Add ofw_pci.h with definitions for the OpenFirmware PCI bindings
2. Add OF_getprop_alloc(), a helper function that will malloc() a sufficient
amount of memory and then retrieve a property value into it.

Approved by: benno
Obtained from: NetBSD (1)
104745ff114499d8f2003702d56c3b969f1b064b 31-Jul-2001 jake <jake@FreeBSD.org> Make the openfirmware functions work on 64 bit architectures by using
a standard cell_t type for the fields of all argument structs. Also
make ihandle_t and phandle_t unsigned to avoid sign extension problems.

Approved by: benno
c92b4bbf4fb01530ddb811f7dc6ef6bbf0920d09 27-Jun-2001 benno <benno@FreeBSD.org> Bracket this file in the usual #ifndef/#define/#endif stuff to prevent
multiple inclusion.
10abd05c149e5b4f7506aa1677cacf87d1747ca6 16-Jun-2001 benno <benno@FreeBSD.org> OpenFirmware kernel support, as used by the PowerPC and hopefully other
ports later on.

This includes the basic MI interface routines as well as a console driver.
The MD code is kept in the MD directories.

Reviewed by: obrien
7d73a3330371286c3b3b0c935dabb9f849aef4d1 10-Nov-2000 benno <benno@FreeBSD.org> OpenFirmware/PowerPC loader, part 2.

As of this patchset, the loader builds (under NetBSD/macppc), boots, interacts
and talks to BOOTP/NFS servers.

(main.c was moved from boot/ofw/libofw to boot/ofw/common but has no revision
history)

Reviewed by: obrien
d84d862cbd66f3f9ab4ce65fe69893664689c73b 16-Oct-2000 obrien <obrien@FreeBSD.org> "Ok, my loader's now up to putting up a prompt. It probes disks partially
but can't boot from them yet."

Thanks to Stephane Potvin for the some of the code in this set.

Submitted by: Benno Rice <benno@jeamland.net>