Commit Graph

46 Commits

Author SHA1 Message Date
Pedro F. Giffuni
718cf2ccb9 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.
2017-11-27 14:52:40 +00:00
Hans Petter Selasky
a7f3dd6f72 Resolve LINT linking issue by renaming ida_init() to ida_setup(). The
ida_init() symbol name is now taken for use by the LinuxKPI.

Reported by:	emaste @
Discussed with:	mav @
2016-05-11 17:38:09 +00:00
Alexander Motin
6f954fb36b Remove MAXBSIZE use from drivers where it has nothing to do.
In some cases limits are just not needed, in others -- DFLTPHYS is the
right constant to use instead.

MFC after:	1 month
2015-03-22 16:10:28 +00:00
John Baldwin
6b5b57ae9f Rework the DMA handling in ida(4) and add locking to make this driver
MPSAFE.
- Preallocate a full set of QCBs during attach rather than allocating new
  ones on demand to avoid allocations in the I/O path.
- Remove the explicit bus space tag/handle and use bus_*() on the
  relevant 'struct resource' instead.
- Defer logical drive probing to an intrhook.
- Fix ida_detach() to detach and delete child devices (logical drives).
- Update the DMA handling to support EINPROGRESS by moving the work to
  submit a mapped request into the bus_dma callback routine as well as
  add support for freezing the queue when EINPROGRESS is encountered.

Tested by:	Marco Steinbach  coco executive-computing de
2012-08-27 17:24:07 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Matthew N. Dodd
8437ff3c79 Test for NULL before use.
Submitted by:	sam (Coverity)
2005-04-13 17:39:43 +00:00
Matthew N. Dodd
682249c035 Add KASSERT() to warn against NULL deref.
Submitted by:	sam (Coverity)
2005-04-13 17:36:18 +00:00
Matthew N. Dodd
b1a9ec048e Whitespace cleanup. 2005-04-13 05:06:57 +00:00
Matthew N. Dodd
84339b16c1 Add a callout to dump card status on command queue timeouts. 2004-12-14 17:45:30 +00:00
Matthew N. Dodd
b75ab906bc Reformat arguments bus_dma_tag_create(). 2004-12-14 17:23:01 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Matthew N. Dodd
a85ce5b61f Add a per controller IOCTL interface. 2004-01-15 06:37:52 +00:00
Matthew N. Dodd
cacc81a67c Insure values of adapter structure members are in correct byte order. 2004-01-15 02:42:20 +00:00
Matthew N. Dodd
a14b52fe81 Handle "Bad Command List" errors.
No error status is returned by the adapter so set CMD_REJECTED so that
ida_done() will DTRT.
2004-01-12 21:05:06 +00:00
Matthew N. Dodd
6f5d148559 Remove comments that no longer apply. 2004-01-12 21:01:18 +00:00
Matthew N. Dodd
68d2672d3b - Initialize qcb flags in ida_construct_qcb() with respect to DMA direction.
- Print operation type, if known in hard/soft error message in ida_done().
- NULL qcb struct bio pointer in ida_done().
2004-01-12 12:31:03 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Scott Long
f6b1c44d1f 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
2003-07-01 15:52:06 +00:00
Scott Long
7e71df9339 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)
2003-05-27 04:59:59 +00:00
Maxime Henrion
7a648f56cf I deserve a big pointy hat for having missed all those references
to bus_dmasync_op_t in my last commit.
2003-04-10 23:50:06 +00:00
Poul-Henning Kamp
891619a66d Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +00:00
Poul-Henning Kamp
b4b138c27f Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
Poul-Henning Kamp
e5dc8339ae NO_GEOM cleanup:
Move ida driver to "struct disk *" centric api.

Retire major number 109.
2003-02-23 18:45:50 +00:00
John Baldwin
482a5259ac Use [u]intmax_t and %j instead of long long and %ll to better fix warnings
I fixed earlier.

Requested by:	mux, jake
2002-11-07 22:23:46 +00:00
John Baldwin
b1e014fc3a Cast a bus_addr_t to a long long to make printf happy. 2002-11-06 22:40:01 +00:00
Warner Losh
c38b6719e5 No need to conditionalize on pci being in the kernel for this 2002-03-20 19:13:13 +00:00
Jonathan Lemon
55d782fcc3 Add crashdump support.
Tested by:	ps
2001-02-26 22:25:30 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Jonathan Lemon
1277c3bac4 The DEC version of the Smart controller has its configuration information
stored at a different location in the PCI space, so adjust accordingly.

Also, when using more than two smart controllers in one machine, the
disks were assigned the wrong drive number; fix this as well.
2000-07-27 22:24:44 +00:00
Poul-Henning Kamp
9626b608de Separate the struct bio related stuff out of <sys/buf.h> into
<sys/bio.h>.

<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.

Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.

Still a few bogus uses of struct buf to track down.

Repocopy by:    peter
2000-05-05 09:59:14 +00:00
Poul-Henning Kamp
eb95c536ad Remove unneeded #include <sys/kernel.h> 2000-04-29 15:36:14 +00:00
Matthew N. Dodd
815308668a - Fix a problem with the cdevsw struct that prevented the kernel from
booting on a RAID volume.
- Change 'id_foo' and 'idfoo' to 'idad_foo' and 'idadfoo'.  This makes
  names more consistent with the devices that the code belongs to (more
  in line with the style used in the amr/mlx driver.)

Reviewed by:	 jlemon
2000-04-22 06:28:03 +00:00
Poul-Henning Kamp
8177437d85 Complete the bio/buf divorce for all code below devfs::strategy
Exceptions:
        Vinum untouched.  This means that it cannot be compiled.
        Greg Lehey is on the case.

        CCD not converted yet, casts to struct buf (still safe)

        atapi-cd casts to struct buf to examine B_PHYS
2000-04-15 05:54:02 +00:00
Poul-Henning Kamp
c244d2de43 Move B_ERROR flag to b_ioflags and call it BIO_ERROR.
(Much of this done by script)

Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED.

Move b_pblkno and b_iodone_chain to struct bio while we transition, they
will be obsoleted once bio structs chain/stack.

Add bio_queue field for struct bio aware disksort.

Address a lot of stylistic issues brought up by bde.
2000-04-02 15:24:56 +00:00
Poul-Henning Kamp
21144e3bf1 Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd.  The b_iocmd is enforced to have
exactly one bit set.

B_WRITE was bogusly defined as zero giving rise to obvious coding
mistakes.

Also eliminate the redundant struct buf flag B_CALL, it can just
as efficiently be done by comparing b_iodone to NULL.

Should you get a panic or drop into the debugger, complaining about
"b_iocmd", don't continue.  It is likely to write on your disk
where it should have been reading.

This change is a step in the direction towards a stackable BIO capability.

A lot of this patch were machine generated (Thanks to style(9) compliance!)

Vinum users:  Greg has not had time to test this yet, be careful.
2000-03-20 10:44:49 +00:00
Jonathan Lemon
ee7eb00e05 Add support for older EISA compaq cards and newer Smart 4200 cards.
Change disk names to `idad' to avoid naming conflicts with the controller,
and enable the new disk code to pick up the drives.

Tested by:  	david.w.james@bt.com  (existing compaq support)
Reviewed by:	msmith
Approved by:	jordan
2000-03-08 16:16:31 +00:00
Matthew N. Dodd
fe0d408987 Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered().  'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t.  Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything.  I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by:	peter, dfr
1999-12-03 08:41:24 +00:00
Nick Hibma
3e2c6ca3b9 Removal of sys/device.h
- Move intrhook stuff into kernel.h
- Remove all occurrences of #device <device.h>
- Add kernel.h were necessary (nowhere)
- delete device.h

This file contained the structures for cfdata (old style config) and is no
longer used. It was included by most drivers.

It confuses the remote debugger as the definition of 'struct device' in
device.h is found before the one in bus_private.h.
1999-10-05 21:19:41 +00:00
Poul-Henning Kamp
94db13fe98 Fix various trivial warnings from LINT 1999-08-28 19:44:07 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Justin T. Gibbs
086646f7c6 Properly set the alignment argument to bus_dma_tag_create(). If we
don't care about the alignment, set it to 1, meaning single byte alignment.
1999-08-16 01:52:21 +00:00
Jonathan Lemon
db57feb70b Compaq Smart RAID driver for -current. Based on the original ida.c
driver by Mark Dawson.  This probably needs some work, but is stable
enough to boot a RAID-only configuration, and survive `make world'.
1999-06-24 03:33:30 +00:00