1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00
freebsd/share
John Baldwin cc981af204 Add new bus methods for mapping resources.
Add a pair of bus methods that can be used to "map" resources for direct
CPU access using bus_space(9).  bus_map_resource() creates a mapping and
bus_unmap_resource() releases a previously created mapping.  Mappings are
described by 'struct resource_map' object.  Pointers to these objects can
be passed as the first argument to the bus_space wrapper API used for bus
resources.

Drivers that wish to map all of a resource using default settings
(for example, using uncacheable memory attributes) do not need to change.
However, drivers that wish to use non-default settings can now do so
without jumping through hoops.

First, an RF_UNMAPPED flag is added to request that a resource is not
implicitly mapped with the default settings when it is activated.  This
permits other activation steps (such as enabling I/O or memory decoding
in a device's PCI command register) to be taken without creating a
mapping.  Right now the AGP drivers don't set RF_ACTIVE to avoid using
up a large amount of KVA to map the AGP aperture on 32-bit platforms.
Once RF_UNMAPPED is supported on all platforms that support AGP this
can be changed to using RF_UNMAPPED with RF_ACTIVE instead.

Second, bus_map_resource accepts an optional structure that defines
additional settings for a given mapping.

For example, a driver can now request to map only a subset of a resource
instead of the entire range.  The AGP driver could also use this to only
map the first page of the aperture (IIRC, it calls pmap_mapdev() directly
to map the first page currently).  I will also eventually change the
PCI-PCI bridge driver to request mappings of the subset of the I/O window
resource on its parent side to create mappings for child devices rather
than passing child resources directly up to nexus to be mapped.  This
also permits bridges that do address translation to request suitable
mappings from a resource on the "upper" side of the bus when mapping
resources on the "lower" side of the bus.

Another attribute that can be specified is an alternate memory attribute
for memory-mapped resources.  This can be used to request a
Write-Combining mapping of a PCI BAR in an MI fashion.  (Currently the
drivers that do this call pmap_change_attr() directly for x86 only.)

Note that this commit only adds the MI framework.  Each platform needs
to add support for handling RF_UNMAPPED and thew new
bus_map/unmap_resource methods.  Generally speaking, any drivers that
are calling rman_set_bustag() and rman_set_bushandle() need to be
updated.

Discussed on:	arch
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D5237
2016-05-20 17:57:47 +00:00
..
colldef Regenerate the Makefile so that actually the new generated collation are 2016-04-16 19:39:51 +00:00
ctypedef Regenerates locales Makefiles and locales 2016-04-16 17:55:11 +00:00
dict
doc Don't repeat the the word 'the' 2016-05-17 12:52:31 +00:00
dtrace Remove the old version of the DTraceToolkit from the source tree. 2016-05-19 19:51:39 +00:00
examples Update share/examples/* to properly install /usr/share/examples. 2016-05-10 00:51:50 +00:00
i18n Remove exists() checks so normal out-of-date handling can be used. 2016-03-11 23:45:36 +00:00
keys META MODE: Update dependencies with 'the-lot' and add missing directories. 2015-12-01 05:23:19 +00:00
locale-links Regenerates locales Makefiles and locales 2016-04-16 17:55:11 +00:00
man Add new bus methods for mapping resources. 2016-05-20 17:57:47 +00:00
me
misc Add myself to the list of src committers. I've never been added it 2016-05-12 20:04:09 +00:00
mk Make armv6 hard float abi by default. Kill armv6hf. 2016-05-18 06:01:18 +00:00
monetdef Regenerates locales Makefiles and locales 2016-04-16 17:55:11 +00:00
msgdef Regenerates locales Makefiles and locales 2016-04-16 17:55:11 +00:00
numericdef Regenerates locales Makefiles and locales 2016-04-16 17:55:11 +00:00
security META MODE: These need object directories to handle staging. 2015-11-26 01:14:27 +00:00
sendmail Update share/examples/* to properly install /usr/share/examples. 2016-05-10 00:51:50 +00:00
skel Use more appropriate ${SHAREDIR} rather than /usr/share. 2015-10-27 23:35:02 +00:00
snmp
syscons DIRDEPS_BUILD: Run the staged bootstrap-tools version of build-tools. 2016-05-09 22:21:09 +00:00
tabset
termcap Replace ln -s calls with INSTALL_SYMLINK 2015-12-04 03:17:14 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
timedef Regenerates locales Makefiles and locales 2016-04-16 17:55:11 +00:00
vt Remove uudecode make rule for vt fonts 2016-02-29 18:35:16 +00:00
zoneinfo Rework META_TARGETS so that it automatically adds META_DEPS to the targets. 2016-04-14 21:04:42 +00:00
Makefile Merge from head 2015-10-19 11:51:10 +00:00
Makefile.inc