summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/sbus
Commit message (Collapse)AuthorAgeFilesLines
* - Try to not leak resources in the attach functions of the esp(4) SBusmarius2005-05-193-14/+540
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | front-end and the LSI64854 and NCR53C9x code in case one of these functions fails. Add detach functions to these parts and make esp(4) detachable. - Revert rev. 1.7 of esp_sbus.c, since rev. 1.34 of sbus.c the clockfreq IVAR defaults to the per-child values. - Merge ncr53c9x.c rev. 1.111 from NetBSD (partial): On reset, clear state flags and the msgout queue. In NetBSD code to notify the upper layer (i.e. CAM in FreeBSD) on reset was also added with this revision. This is believed to be not necessary in FreeBSD and was not merged. This makes ncr53c9x.c to be in sync with NetBSD up to rev. 1.114. - Conditionalize the LSI64854 support on sbus(4) only instead of sbus(4) and esp(4) as it's also required for the 'dma', 'espdma' and 'ledma' busses/devices as well as the 'SUNW,bpp' device (printer port) which all hang off of sbus(4). - Add a driver for the 'dma', 'espdma' and 'ledma' (pseudo-)busses/ devices. These busses and devices actually represent the LSI64854 DMA engines for the ESP SCSI and LANCE Ethernet controllers found on the SBus of Ultra 1 and SBus add-on cards. With 'espdma' and 'ledma' the 'esp' and 'le' devices hang off of the respective DMA bus instead of directly from the SBus. The 'dma' devices are either also used in this manner or on some add-on cards also as a companion device to an 'esp' device which also hangs off directly from the SBus. With the latter variant it's a bit tricky to glue the DMA engine to the core logic of the respective 'esp' device. With rev. 1.35 of sbus.c we are however guaranteed that such a 'dma' device is probed before the respective 'esp' device which simplifies things a lot. [1] - In the esp(4) SBus front-end read the part-unique ID code of Fast-SCSI capable chips the right way. This fixes erroneously detecting some chips as FAS366 when in fact they are not. Add explicit checks for the FAS100A, FAS216 and FAS236 variants instead treating all of these as ESP200. That way we can correctly set the respective Fast-SCSI config bits instead of driving them out of specs. This includes adding the FAS100A and FAS236 variants to the NCR53C9x core code. We probably still subsume some chip variants as ESP200 while in fact they are another variant which however shouldn't really matter as this will only happen when these chips are driven at 25MHz or less which implies not being able to run Fast-SCSI. [3] - Add a workaround to the NCR53C9x interrupt handler which ignores the stray interrupt generated by FAS100A when doing path inquiry during boot and which otherwiese would trigger a panic. - Add support for the 'esp' devices hanging off of a 'dma' or 'espdma' busses or which are companions of 'dma' devices to esp(4). In case of the variants that hang off of a DMA device this is a bit hackish as esp(4) then directly uses the softc of the respective parent to talk to the DMA engine. It might make sense to add an interface for this in order to implement this in a cleaner way however it's not yet clear how the requirements for the LANCE Ethernet controllers are and the hack works for now. [2] This effectively adds support for the onboard SCSI controller in Ultra 1 as well as most of the ESP-based SBus add-on cards to esp(4). With this the code for supporting the Performance Technologies SBS430 SBus SCSI add-on cards is also largely in place the remaining bits were however omitted as it's unclear from the NetBSD how to couple the DMA engine and the core logic together for these cards. Obtained from: OpenBSD [1] Obtained from: NetBSD [2] Clue from: BSD/OS [3] Reviewed by: scottl (earlier version) Tested with: FSBE/S add-on card (FAS236), SSHA add-on card (ESP100A), Ultra 1 (onboard FAS100A), Ultra 2 (onboard FAS366)
* - Add an IVAR for retrieving the interrupt group number of the parent Sbusmarius2005-05-192-9/+55
| | | | | | | | | | | | | | | | | | | | | | | | | device and which also applies to the children. This is very usefull for drivers for the various subordinate busses so they don't need to fiddle with the OFW node of their parent themselves. As SBus busses hang of the nexus and we don't use the ofw_bus interface for nexus devices, yet, this would also require special knowledge about this in the drivers for the SBus children which these shouldn't need to have. This includes switching to use an unshifted IGN in the sc_ign member of the sbus(4) softc internally. - For SBus child devices where there are variants that are actually split split into two SBus devices (as opposed to the first half of the device being a SBus device and the second half hanging off of the first one) like 'auxio' and 'SUNW,fdtwo' or 'dma' and 'esp' probe the SBus device which is a prerequisite to the driver attaching to the second one with a lower order. This saves us from dealing with different probe orders in the respective device drivers which generally is more hackish. - Remove a stale comment about the 'specials' array above the attaching of the child devices. This is a remnant of the NetBSD/sparc origin of this code. There the 'specials' array is also used to probe certain devices which are prerequisites to others first. Why NetBSD soley relies on the devices having the expected order in the OFW tree on sparc64 isn't clear to me, as far as I can tell OFW doesn't guaranteed such things.
* Fix compilation when DEBUG is defined.marius2005-04-181-1/+1
|
* Style and minor changes:marius2005-04-173-121/+102
| | | | | | | | | | | | | - Merge lsi64854.c rev. 1.25 from NetBSD: nuke trailing whitespace. - Update NetBSD RCS IDs according to what was actually already merged. - Remove dv_name from the lsi64854_softc and use device_printf() instead. - Use __func__ instead of hardcoded function names in error messages. - Use ulmin() instead of min() for comparing the DMA sizes as the values involved actually are represented by 64bit unsigned instead of 32bit unsigned. As far as I can't tell this doesn't make a difference in practice though. - Some style(9) fixes (mainly indentation). - Remove unnecessary braces.
* Re-commit the following changes which were committed to these filesmarius2005-04-172-13/+13
| | | | | | | | | | | | | | at their old location in sys/dev/esp after they were repo-copied to sys/sparc64/sbus at rev. 1.1: sys/dev/esp/lsi64854.c rev. 1.2 sys/dev/esp/lsi64854var.h rev. 1.2 Add some style(9) touch ups; style(9) states that new code should follow these conventions and, well, this is a new driver. Tested on: i386, sparc64 Reviewed by: scottl
* - Split the bus probe function into a bus probe and a bus attach functionmarius2005-04-171-57/+70
| | | | | | | | | | | | | | | | | | with the attaching of the children done in the bus attach function like it's supposed to be. - In the bus probe nomatch function print the resources of the children like it's done in the other sparc64 specific bus drivers. - For the clock frequency IVAR use the per-child values and fall back to the bus default in case a child doesn't have the respective property instead of always using the bus default so a child driver doesn't need to obtain the per-child value itself (see also the commit message of sys/dev/esp/esp_sbus.c rev. 1.7). - Add support for pass-through allocations. The comment preceding sbus_alloc_resource() wasn't quite correct, we need to support pass- through allocations for the 'espdma' and 'ledma' (pseudo-)busses which hang off of the SBus in Ultra 1 machines. There can also be actual bridges like the SBus-to-PCMCIA bridge on the SBus and the XBox (SBus extension box) probably also involves one.
* Some clean-up announced in rev. 1.31:marius2005-04-171-80/+67
| | | | | | | | | | | | | | - Use auto-generated typedefs for the prototypes of the device interface functions. - Style(9) fixes (mainly don't use function calls in initializers). - Use __func__ instead of hardcoded function names in error messages. - Try to make error messages sound uniform. - Try to keep the code within 80 columns. - Correct some typos. - Correct some function declarations to match their prototypes. - Remove unused headers, macros and variables. - Remove a bzero() superfluous due to allocating with M_ZERO. - Use FBSDID.
* /* -> /*- for license, minor formatting changesimp2005-01-073-4/+4
|
* Fix paths after repocopies done by scottltrhodes2004-11-101-2/+2
| | | | | Reviewed by: marius OK'ed by: scottl
* - Introduce an ofw_bus kobj-interface for retrieving the OFW node and amarius2004-08-122-33/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subset ("compatible", "device_type", "model" and "name") of the standard properties in drivers for devices on Open Firmware supported busses. The standard properties "reg", "interrupts" und "address" are not covered by this interface because they are only of interest in the respective bridge code. There's a remaining standard property "status" which is unclear how to support properly but which also isn't used in FreeBSD at present. This ofw_bus kobj-interface allows to replace the various (ebus_get_node(), ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type() vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one. This in turn allows to simplify and remove code-duplication in drivers for devices that can hang off of more than one OFW supported bus. - Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the drivers for their children to use the ofw_bus kobj-interface. The IVAR- interfaces of the Central, EBus and FHC are entirely replaced by this. The PCI bus driver used its own kobj-interface and now also uses the ofw_bus one. The IVARs special to the SBus, e.g. for retrieving the burst size, remain. Beware: this causes an ABI-breakage for modules of drivers which used the IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be recompiled. The style-inconsistencies introduced in some of the bus drivers will be fixed by tmm@ in a generic clean-up of the respective drivers later (he requested to add the changes in the "new" style). - Convert the powerpc MacIO bus driver and the drivers for its children to use the ofw_bus kobj-interface. This invloves removing the IVARs related to the "reg" property which were unused and a leftover from the NetBSD origini of the code. There's no ABI-breakage caused by this because none of these driver are currently built as modules. There are other powerpc bus drivers which can be converted to the ofw_bus kobj-interface, e.g. the PCI bus driver, which should be done together with converting powerpc to use the OFW PCI code from sparc64. - Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take advantage of the ofw_bus kobj-interface and simplify them a bit. Reviewed by: grehan, tmm Approved by: re (scottl) Discussed with: tmm Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
* These don't need RMAN_RESOURCE_VISIBLE now that rman is visibleimp2004-07-031-1/+0
|
* These need __RMAN_RESOURCE_VISIBLE, too.marius2004-06-301-0/+2
|
* Port the NetBSD esp(4) driver. This only includes the sbus front-end, soscottl2004-06-103-0/+1041
| | | | | | | | | | | its primary use is for the FEPS/FAS366 SCSI found in Sun Ultra 1e and 2 machines. Once the pci front-end is ported, this driver can replace the amd(4) driver. The code as-is is fairly stable. I've disabled tagged-queueing until I can figure out a corruption bug related to it. I'm importing it now so that people with these machines can (finally) stop netbooting and report bugs before 5.3.
* Add missing <sys/module.h> #includesphk2004-06-041-0/+1
|
* Remove advertising clause from University of California Regent'simp2004-04-072-8/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* The compatibility specification property is named "compatible", nottmm2004-03-271-1/+1
| | | | | | "compat". Spotted by: Marius Strobl <marius@alchemy.franken.de>
* Don't confuse NULL with 0.obrien2003-12-261-3/+3
|
* s=include <ofw/=include <dev/ofw/= to reflect removal of -I$S/devimp2003-08-231-1/+1
|
* Mega busdma API commit.scottl2003-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Further cleanup of the sparc64 busdma implementation:tmm2003-06-181-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* Remove the psycho and sbus iommu function stubs, and put the pointertmm2003-06-111-125/+19
| | | | | to the iommu_state structure directly into dt_cookie. The stubs have not been needed for a long time now.
* Bring back bus_dmasync_op_t. It is now a typedef to an int, though thescottl2003-05-271-2/+3
| | | | | | | | 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)
* De-orbit bus_dmamem_alloc_size(). It's a hack and was never used anyways.scottl2003-05-261-25/+0
| | | | | | No need for it to pollute the 5.x API any further. Approved by: re (bmah)
* - Reduce the DVMA preallocation limit from 128kB to 32kB. 128kB weretmm2003-05-021-1/+1
| | | | | | | | | | | | | quite excessive, and caused the available space to be used up too easily. The new limit should be a better estimation of how much the caller will need at most. - Double the IOTSB size 64kB, for a DVMA area size of 64MB. This should fix DMA problems on e450s and other large machines due to DVMA space exhaustion, which were introduced in my last IOMMU code revision in January. Reported and tested by: fenner
* fix typo in the previous commit.simokawa2003-04-121-1/+1
|
* Change the operation parameter of bus_dmamap_sync() from anmux2003-04-101-3/+2
| | | | | | 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.
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Fix some more missing dt_ prefixes for dma tag fields.scottl2003-01-291-2/+2
|
* Implement bus_dmamem_alloc_size() and bus_dmamem_free_size() asscottl2003-01-291-0/+25
| | | | | | | | | | | | | | | | | | | | 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)
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Change the iommu code to be able to handle more than one DVMA area pertmm2003-01-061-0/+28
| | | | | | | | | | | map. Use this new feature to implement iommu_dvmamap_load_mbuf() and iommu_dvmamap_load_uio() functions in terms of a new helper function, iommu_dvmamap_load_buffer(). Reimplement the iommu_dvmamap_load() to use it, too. This requires some changes to the map format; in addition to that, remove unused or redundant members. Add SBus and Psycho wrappers for the new functions, and make them available through the respective DMA tags.
* Bump the IOMMU TSB size to 32kB, to match the default size on PCItmm2003-01-061-1/+1
| | | | systems.
* Prefix the members of struct bus_space_tag and struct bus_dma_tag withtmm2003-01-061-18/+18
| | | | a uniqifier. No functional changes.
* 1.) fix a copy-and-paste-o in a panic() messagetmm2003-01-061-14/+36
| | | | | | | | | 2.) pass the requesting child device (instead of the bus one) up when handling interrupt resources 3.) remeber to mark the resource list entry as unused in sbus_release_resource(). Reported by: scottl (3)
* Always initialize the UPA target module id in the interrupt mappingtmm2002-12-011-9/+9
| | | | | | | | | | | | register to the one of the processor doing the interrupt setup. This is required since this field is preinitialized to 0, but there exist machines which have no processor with a MID of 0 (e.g. e450s with 1 or 2 processors). Add some more macros for handle the interrupt mapping registers, and rename some existing ones for consistency. Approved by: re
* Remove some long-dead cruft in the interrupt handling code which wastmm2002-12-011-44/+31
| | | | | | never used in FreeBSD. Approved by: re
* Typo fix.mux2002-08-191-1/+1
| | | | Reviewed by: tmm
* Set interrupt clear pointer for SBus slots to point to correct spot.mjacob2002-07-251-2/+2
|
* When multiple IOMMUs are present in a system, use a single TSB for alltmm2002-07-161-14/+6
| | | | | | | | | | | of them, and couple them by always performing all operations on all present IOMMUs. This is required because with the current API there is no way to determine on which bus a busdma operation is performed. While being there, clean up the iommu code a bit. This should be a step in the direction of allow some of larger machines to work; tests have shown that there still seem to be problems left.
* Revamp the busdma implementation a bit:tmm2002-03-241-32/+40
| | | | | | | | | | | | - 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.
* Add support for the SBus, which is used in early Sun UltraSPARC machines.tmm2002-02-134-0/+1298
Ported from NetBSD.
OpenPOWER on IntegriCloud