#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
297792 |
|
10-Apr-2016 |
marius |
Since r296250 it is no longer possible for devices to use bus space addresses exceeding 32 bit, so bump BUS_SPACE_MAXADDR to 64 bit. The whole situation is sub par, though; prior to r296250 and despite what their names imply, BUS_SPACE_MAX* were primarily, even almost exclusively used for bus_dma(9). Now these macros also have a vital role for bus_space(9). However, it does not necessarily hold that both bus DMA and space addresses universally have the same limits per platform. As for sparc64, 64 bit clearly is beyond what can be addressed via the various IOMMUs. With this change in place, we now rely on the parent bus DMA tags of the host-to-foo drivers causing the child tags to be capped as necessary.
PR: 207998
|
#
257066 |
|
24-Oct-2013 |
marius |
Move the implementation of bus_space_barrier(9) to the inline function in the header. Actually, there's only one version for all types of busses, so it doesn't make sense to walk up the hierarchy.
|
#
225931 |
|
02-Oct-2011 |
marius |
Make sparc64 compatible with NEW_PCIB and enable it: - Implement bus_adjust_resource() methods as far as necessary and in non-PCI bridge drivers as far as feasible without rototilling them. - As NEW_PCIB does a layering violation by activating resources at layers above pci(4) without previously bubbling up their allocation there, move the assignment of bus tags and handles from the bus_alloc_resource() to the bus_activate_resource() methods like at least the other NEW_PCIB enabled architectures do. This is somewhat unfortunate as previously sparc64 (ab)used resource activation to indicate whether SYS_RES_MEMORY resources should be mapped into KVA, which is only necessary if their going to be accessed via the pointer returned from rman_get_virtual() but not for bus_space(9) as the later always uses physical access on sparc64. Besides wasting KVA if we always map in SYS_RES_MEMORY resources, a driver also may deliberately not map them in if the firmware already has done so, possibly in a special way. So in order to still allow a driver to decide whether a SYS_RES_MEMORY resource should be mapped into KVA we let it indicate that by calling bus_space_map(9) with BUS_SPACE_MAP_LINEAR as actually documented in the bus_space(9) page. This is implemented by allocating a separate bus tag per SYS_RES_MEMORY resource and passing the resource via the previously unused bus tag cookie so we later on can call rman_set_virtual() in sparc64_bus_mem_map(). As a side effect this now also allows to actually indicate that a SYS_RES_MEMORY resource should be mapped in as cacheable and/or read-only via BUS_SPACE_MAP_CACHEABLE and BUS_SPACE_MAP_READONLY respectively. - Do some minor cleanup like taking advantage of rman_init_from_resource(), factor out the common part of bus tag allocation into a newly added sparc64_alloc_bus_tag(), hook up some missing newbus methods and replace some homegrown versions with the generic counterparts etc. - While at it, let apb_attach() (which can't use the generic NEW_PCIB code as APB bridges just don't have the base and limit registers implemented) regarding the config space registers cached in pcib_softc and the SYSCTL reporting nodes set up.
|
#
219567 |
|
12-Mar-2011 |
marius |
Sync licenses and the corresponding RCS IDs with NetBSD, mainly switching the licenses of Matthew R. Green and the TNF to 2-clause.
Obtained from: NetBSD
|
#
216143 |
|
03-Dec-2010 |
brucec |
Revert r216134. This checkin broke platforms where bus_space are macros: they need to be a single statement, and do { } while (0) doesn't work in this situation so revert until a solution can be devised.
|
#
216134 |
|
02-Dec-2010 |
brucec |
Disallow passing in a count of zero bytes to the bus_space(9) functions.
Passing a count of zero on i386 and amd64 for [I386|AMD64]_BUS_SPACE_MEM causes a crash/hang since the 'loop' instruction decrements the counter before checking if it's zero.
PR: kern/80980 Discussed with: jhb
|
#
210334 |
|
21-Jul-2010 |
attilio |
KTR_CTx are long time aliased by existing classes so they can't serve their purpose anymore. Axe them out.
Sponsored by: Sandvine Incorporated Discussed with: jhb, emaste Possible MFC: TBD
|
#
178860 |
|
08-May-2008 |
marius |
- Remove the BUS_HANDLE_MIN checking in the __BUS_DEBUG_ACCESS macro; for UPA it should have fulfilled its purpose by now and Fireplane- and JBus-based machines are way to messy in organization to implement something equivalent. - Fix a bunch of style(9) bugs.
|
#
177565 |
|
24-Mar-2008 |
marius |
- Const'ify the bus_stream_asi and bus_type_asi arrays. - Replace hard-coded functions names missed in bus_machdep.c rev. 1.44 with __func__. - Break some long lines.
MFC after: 1 month
|
#
166096 |
|
18-Jan-2007 |
marius |
- Rename UPA_BUS_SPACE to NEXUS_BUS_SPACE; besides an UPA bus, nexus(4) may also reflect a Fireplane/Safari or JBus bus (or a virtual bus which in turn reflects a JBus bus or something like that...). - In the both the sparc64 and sun4v bus_machdep.c use __FBSDID. - Spell SBus the official way in comments. - Replace hardcoded function names (all of which were actually outdated) in panic and status strings with __func__. - Fix whitespace nits.
|
#
166092 |
|
18-Jan-2007 |
marius |
Remove the compat shims for the ISA old-stlye in{b,w,l}()/out{b,w,l}() and friends along with all hacks required to implement them. None of the drivers currently built (as part of GENERIC, LINT or modules) on sparc64 or sun4v and none of those we might want to use there in future uses them, AFAICT there actually never was a driver hooked up to the sparc64 or sun4v build that correctly used these functions (and it looks like that due to a bug read{b,w,l}()/write{b,w,l}() and the other functions working on a memory handle never actually worked on sun4v). All they ever were good for on sparc64 and sun4v was erroneously dragging in dependencies on isa(4) in drivers like f.e. dpt(4), si(4) and syscons(4) in source files that supposedly were bus-neutral and hiding issues with drivers like f.e. ng_bt3c(4) that used these functions with busses other than isa(4) and therefore couldn't work on these platforms.
|
#
159583 |
|
13-Jun-2006 |
marius |
- Complete breaking out the definition of bus_space_{tag,handle}_t by moving the typedef of bus_space_tag_t from sys/sparc64/include/bus.h to sys/sparc64/include/_bus.h. This brings sparc64 in sync with the other platforms and fixes the compilation of drivers which include <sys/rman.h> before <machine/bus.h> after sys/sys/rman.h rev. 1.34. - Remove the definition of bus_type_t from sys/sparc64/include/_bus.h as it's unused since sys/sparc64/include/bus.h rev. 1.6 and sys/sparc64/sparc64/bus_machdep.c rev. 1.3. - Remove some pointless comments.
|
#
157224 |
|
28-Mar-2006 |
marius |
Sync with the other archs and declare the memory location referenced by the address argument of the bus_space_write_multi_*() familiy as const.
Prodded by: damien
|
#
145253 |
|
18-Apr-2005 |
imp |
Break out the definition of bus_space_{tag,handle}_t and a few other types into _bus.h to help with name space polution from including all of bus.h. In a few days, I'll commit changes to the MI code to take advantage of thse sepration (after I've made sure that these changes don't break anything in the main tree, I've tested in my trees, but you never know...).
Suggested by: bde (in 2002 or 2003 I think) Reviewed in principle by: jhb
|
#
143598 |
|
14-Mar-2005 |
scottl |
Refactor the bus_dma header files so that the interface is described in sys/bus_dma.h instead of being copied in every single arch. This slightly reorders a flag that was specific to AXP and thus changes the ABI there. The interface still relies on bus_space definitions found in <machine/bus.h> so it cannot be included on its own yet, but that will be fixed at a later date. Add an MD <machine/bus_dma.h> for ever arch for consistency and to allow for future MD augmentation of the API. sparc64 makes heavy use of this right now due to its different bus_dma implemenation.
|
#
140982 |
|
29-Jan-2005 |
ru |
Hopefully unbreak modules build.
|
#
140281 |
|
15-Jan-2005 |
scottl |
Add the bus_dmamap_load_mbuf_sg() function to sparc64.
|
#
131223 |
|
28-Jun-2004 |
scottl |
Switch sparc64 busdma to use a dynamically allocated segment list rather than a a stack-limited list. This removes the artifical limit on s/g list size. cvs: ----------------------------------------------------------------------
|
#
120375 |
|
23-Sep-2003 |
nyan |
Implement the bus_space_map() function to allocate resources and initialize a bus_handle, but currently it does only initializing a bus_handle.
|
#
118081 |
|
27-Jul-2003 |
mux |
- Introduce a new busdma flag BUS_DMA_ZERO to request for zero'ed memory in bus_dmamem_alloc(). This is possible now that contigmalloc() supports the M_ZERO flag. - Remove the locking of Giant around calls to contigmalloc() since contigmalloc() now grabs Giant itself.
|
#
117390 |
|
10-Jul-2003 |
tmm |
Lock down the IOMMU bus_dma implementation to make it safe to use without Giant held.
A quick outline of the locking strategy: Since all IOMMUs are synchronized, there is a single lock, iommu_mtx, which protects the hardware registers (where needed) and the global and per-IOMMU software states. As soon as the IOMMUs are divorced, each struct iommu_state will have its own mutex (and the remaining global state will be moved into the struct). The dvma rman has its own internal mutex; the TSB slots may only be accessed by the owner of the corresponding resource, so neither needs extra protection. Since there is a second access path to maps via LRU queues, the consumer- provided locking is not sufficient; therefore, each map which is on a queue is additionally protected by iommu_mtx (in part, there is one member which only the map owner may access). Each map on a queue may be accessed and removed from or repositioned in a queue in any context as long as the lock is held; only the owner may insert a map. To reduce lock contention, some bus_dma functions remove the map from the queue temporarily (on behalf of the map owner) for some operations and reinsert it when they are done. Shorter operations and operations which are not done on behalf of the lock owner are completely covered by the lock.
To facilitate the locking, reorganize the streaming buffer handling; while being there, fix an old oversight which would cause the streaming buffer to always be flushed, regardless of whether streaming was enabled in the TSB entry. The streaming buffer is still disabled for now, since there are a number of drivers which lack critical bus_dmamp_sync() calls.
Additional testing by: jake
|
#
117126 |
|
01-Jul-2003 |
scottl |
Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg. Lockfunc allows a driver to provide a function for managing its locking semantics while using busdma. At the moment, this is used for the asynchronous busdma_swi and callback mechanism. Two lockfunc implementations are provided: busdma_lock_mutex() performs standard mutex operations on the mutex that is specified from lockfuncarg. dftl_lock() is a panic implementation and is defaulted to when NULL, NULL are passed to bus_dma_tag_create(). The only time that NULL, NULL should ever be used is when the driver ensures that bus_dmamap_load() will not be deferred. Drivers that do not provide their own locking can pass busdma_lock_mutex,&Giant args in order to preserve the former behaviour.
sparc64 and powerpc do not provide real busdma_swi functions, so this is largely a noop on those platforms. The busdma_swi on is64 is not properly locked yet, so warnings will be emitted on this platform when busdma callback deferrals happen.
If anyone gets panics or warnings from dflt_lock() being called, please let me know right away.
Reviewed by: tmm, gibbs
|
#
116659 |
|
21-Jun-2003 |
jmg |
add support for peeking at pci busses on UltraSparc systems. This prevents data access errors when trying to read/write to non-existant PCI devices.
fix the psycho bridge to use peek for probing devices. This no longer fakes it if the OFW node doesn't exist (and the reg == 0).
Reviewed by: jake, tmm
|
#
116541 |
|
18-Jun-2003 |
tmm |
Further cleanup of the sparc64 busdma implementation: - Move prototypes for sparc64-specific helper functions from bus.h to bus_private.h - Move the method pointers from struct bus_dma_tag into a separate structure; this saves some memory, and allows to use a single method table for each busdma backend, so that the bus drivers need no longer be changed if the methods tables need to be modified. - Remove the hierarchical tag method lookup. It was never really useful, since the layering is fixed, and the current implementations do not need to call into parent implementations anyway. Each tag inherits its method table pointer and cookie from the parent (or the root tag) now, and the method wrapper macros directly use the method table of the tag. - Add a method table to the non-IOMMU backend, remove unnecessary prototypes, remove the extra parent tag argument. - Rename sparc64_dmamem_alloc_map() and sparc64_dmamem_free_map() to sparc64_dma_alloc_map() and sparc64_dma_free_map(), move them to a better place and use them for all map allocations and deallocations. - Add a method table to the iommu backend, and staticize functions, remove the extra parent tag argument. - Change the psycho and sbus drivers to just set cookie and method table in the root tag. - Miscellaneous small fixes.
|
#
115416 |
|
30-May-2003 |
hmp |
Rename BUS_DMAMEM_NOSYNC to BUS_DMA_COHERENT.
The current name is confusing, because it indicates to the client that a bus_dmamap_sync() operation is not necessary when the flag is specified, which is wrong.
The main purpose of this flag is to hint the underlying architecture that DMA memory should be mapped in a coherent way, but the architecture can ignore it. But if the architecture does supports coherent mapping of memory, then it makes bus_dmamap_sync() calls cheap.
This flag is the same as the one in NetBSD's Bus DMA.
Reviewed by: gibbs, scottl, des (implicitly) Approved by: re@ (jhb)
|
#
115343 |
|
27-May-2003 |
scottl |
Bring back bus_dmasync_op_t. It is now a typedef to an int, though the BUS_DMASYNC_ definitions remain as before. The does not change the ABI, and reverts the API to be a bit more compatible and flexible. This has survived a full 'make universe'.
Approved by: re (bmah)
|
#
115316 |
|
26-May-2003 |
scottl |
De-orbit bus_dmamem_alloc_size(). It's a hack and was never used anyways. No need for it to pollute the 5.x API any further.
Approved by: re (bmah)
|
#
113347 |
|
10-Apr-2003 |
mux |
Change the operation parameter of bus_dmamap_sync() from an enum to an int and redefine the BUS_DMASYNC_* constants as flags. This allows us to specify several operations in one call to bus_dmamap_sync() as in NetBSD.
|
#
111524 |
|
26-Feb-2003 |
mux |
Correctly set BUS_SPACE_MAXSIZE in all the busdma backends. It was bogusly set to 64 * 1024 or 128 * 1024 because it was bogusly reused in the BUS_DMAMAP_NSEGS definition.
|
#
111383 |
|
23-Feb-2003 |
obrien |
Make the 'a' parameter of bus_space_write_multi_stream_*() a const pointer.
|
#
111353 |
|
23-Feb-2003 |
obrien |
The rest of our platforms make bus_space_write_multi_stream_2's 'a' a const pointer.
|
#
111347 |
|
23-Feb-2003 |
obrien |
Add an empty bus_space_unmap() like Alpha has. puc(4) uses it.
|
#
110053 |
|
29-Jan-2003 |
scottl |
Fix another mistake in the bus_dmamem_alloc_size() thing
Submitted by: tmm
|
#
110047 |
|
29-Jan-2003 |
scottl |
Fix some more missing dt_ prefixes for dma tag fields.
|
#
110030 |
|
29-Jan-2003 |
scottl |
Implement bus_dmamem_alloc_size() and bus_dmamem_free_size() as counterparts to bus_dmamem_alloc() and bus_dmamem_free(). This allows the caller to specify the size of the allocation instead of it defaulting to the max_size field of the busdma tag.
This is intended to aid in converting drivers to busdma. Lots of hardware cannot understand scatter/gather lists, which forces the driver to copy the i/o buffers to a single contiguous region before sending it to the hardware. Without these new methods, this would require a new busdma tag for each operation, or a complex internal allocator/cache for each driver.
Allocations greater than PAGE_SIZE are rounded up to the next PAGE_SIZE by contigmalloc(), so this is not suitable for multiple static allocations that would be better served by a single fixed-length subdivided allocation.
Reviewed by: jake (sparc64)
|
#
108917 |
|
08-Jan-2003 |
jake |
Implement bus_space_subregion.
|
#
108815 |
|
06-Jan-2003 |
tmm |
Prefix the members of struct bus_space_tag and struct bus_dma_tag with a uniqifier. No functional changes.
|
#
108808 |
|
06-Jan-2003 |
tmm |
Look for the correct method in sparc64_dmamap_load_mbuf() and sparc64_dmamap_load_uio().
|
#
104486 |
|
04-Oct-2002 |
sam |
New bus_dma interfaces for use by crypto device drivers:
o bus_dmamap_load_mbuf o bus_dmamap_load_uio
Test on i386. Known to compile on alpha and sparc64, but not tested. Otherwise untried.
|
#
104304 |
|
01-Oct-2002 |
jake |
Convert the bus space accessors from macros to inlines. This fixes some problems with drivers that expect functions rather than function like macros.
Reviewed by: tmm
|
#
103747 |
|
21-Sep-2002 |
mux |
Don't include opt_bus.h here, it breaks stuff trying to include machine/bus.h.
Reviewed by: tmm
|
#
102301 |
|
23-Aug-2002 |
jake |
Removed unneeded include of machine/types.h (which no longer exists).
|
#
93070 |
|
24-Mar-2002 |
tmm |
Revamp the busdma implementation a bit: - change the IOMMU support code so that it supports overcommittting the available DVMA memory, while still allocating as lazily as possible. This is achieved by limiting the preallocation, and deferring the allocation to map load time when it fails. In the latter case, the DVMA memory reserved for unloaded maps can be stolen to free up enough memory for loading a map. - allow NULL settings in the method tables, and search the parent tags until an appropriate implementation is found. This allows to remove some kluges in the old implementation.
|
#
93052 |
|
23-Mar-2002 |
tmm |
De-__P(), de-K&R, remove superfluous comments and prototypes, some style fixes. No functional changes.
|
#
90615 |
|
13-Feb-2002 |
tmm |
Clean up bus space debugging support; change sparc64_bus_mem_map() to take a bus tag and handle as argument instead of a i/o space id and a physical address, now that nexus handles device memory resource allocations.
|
#
86237 |
|
09-Nov-2001 |
tmm |
Forced commit to note that a large portion of the code in these files was ported from NetBSD, which I forgot to mention in my initial commit.
Pointy hat to: tmm
|
#
86228 |
|
09-Nov-2001 |
tmm |
Add bus_space and busdma support for sparc64.
|
#
81334 |
|
09-Aug-2001 |
obrien |
The author isn't a [UC] Regents. Correct the copyright language.
|
#
80709 |
|
31-Jul-2001 |
jake |
Flesh out the sparc64 port considerably. This contains: - mostly complete kernel pmap support, and tested but currently turned off userland pmap support - low level assembly language trap, context switching and support code - fully implemented atomic.h and supporting cpufunc.h - some support for kernel debugging with ddb - various header tweaks and filling out of machine dependent structures
|
#
80708 |
|
31-Jul-2001 |
jake |
Add skeleton machine dependent headers and c files for a port of freebsd to a new architecture. This is the base of the sparc64 port, but contains limited machine dependent code, and can be used a base for ports. Included are: - standard machine dependent headers, tweaked for a 64 bit, big endian architecture, including empty versions of all the machine dependent structures - a machine independent atomic.h, which can be used until a port has support for interrupts and the operations really need to be atomic - stub versions of all the machine dependent functions, which panic when called and print out the name of the function that needs to be implemented. functions which are normally in assembly files are not included, but this should reduce the number of different undefined references on the first few compiles from hundreds to 5 or 6 Given minimal startup code and console support it should be trivial to make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
|