Commit Graph

310 Commits

Author SHA1 Message Date
Matt Jacob
fb75f116db Fix breakage where we never were attaching SES devices because inq_len
was not being set > 0.
2000-06-18 04:19:08 +00:00
Kenneth D. Merry
a6cb9949a7 Disable multi-lun probing on Hitachi DK31* drives.
PR:		misc/18793
Submitted by:	Paul Haddad <paul@pth.com>
2000-06-04 03:17:37 +00:00
Doug Rabson
1536418a84 Brucify the pmap_enter_temporary() changes. 2000-05-29 19:21:01 +00:00
Doug Rabson
31891bc2bd Add a new pmap entry point, pmap_enter_temporary() to be used during
dumps to create temporary page mappings. This replaces the use of CADDR1
which is fairly x86 specific.

Reviewed by: dillon
2000-05-28 15:49:55 +00:00
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder
740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Joerg Wunsch
d082442a09 Apply a `fixup' to the blocksize gathered from the device after a READ
CAPACITY operation.  SCSI-3 mandates this to be 2048, but some older
drives like my old Plasmon CD-R report weird numbers between 2048 and
up to 2352 bytes depending on the mode of the last track etc.  This in
turn confuses stuff like the slice code since it refuses to work with
devices that do not have a blocksize which is a multiple of 512 bytes.

Reviewed by:	ken
2000-05-22 17:21:50 +00:00
Kenneth D. Merry
96a93c63a8 Implement a new camcontrol function, 'camcontrol format'.
libcam/Makefile:	Add scsi_da.c to libcam for the new
			scsi_format_unit() function.

camcontrol.8:		Update the man page for the new format
			functionality, and take out the examples section
			describing how to do it with 'camcontrol cmd'.

camcontrol.c:		New format functionality.  Note that unlike the
			rest of the camcontrol subcommands, this one is
			interactive by default.  Because of the potential
			destructiveness of the format command, I thought
			it necessary to get confirmation from the user
			before spamming a disk.  You can disable the
			interactive behavior, and the status meter with
			command line arguments.

scsi_da.c:		Add the new scsi_format_unit() cdb building
			function and use #ifdef _KERNEL to make this file
			compile in both the kernel and userland.  The
			format unit function is currently only defined in
			the non-kernel case, because nothing in the kernel
			is using it.  If that changes, it should be
			un-ifdefed and compiled in both cases.

scsi_da.h:		New function declaration, CDB structure and format
			data structures.

Thanks to Nick Hibma for providing some valuable input on these changes.
2000-05-21 23:57:52 +00:00
Peter Wemm
0385347c1a Implement an optimization of the VM<->pmap API. Pass vm_page_t's directly
to various pmap_*() functions instead of looking up the physical address
and passing that.  In many cases, the first thing the pmap code was doing
was going to a lot of trouble to get back the original vm_page_t, or
it's shadow pv_table entry.

Inspired by: John Dyson's 1998 patches.

Also:
Eliminate pv_table as a seperate thing and build it into a machine
dependent part of vm_page_t.  This eliminates having a seperate set of
structions that shadow each other in a 1:1 fashion that we often went to
a lot of trouble to translate from one to the other. (see above)
This happens to save 4 bytes of physical memory for each page in the
system.  (8 bytes on the Alpha).

Eliminate the use of the phys_avail[] array to determine if a page is
managed (ie: it has pv_entries etc).  Store this information in a flag.
Things like device_pager set it because they create vm_page_t's on the
fly that do not have pv_entries.  This makes it easier to "unmanage" a
page of physical memory (this will be taken advantage of in subsequent
commits).

Add a function to add a new page to the freelist.  This could be used
for reclaiming the previously wasted pages left over from preloaded
loader(8) files.

Reviewed by:	dillon
2000-05-21 12:50:18 +00:00
Kenneth D. Merry
88f25c0840 Add support for the DVD ioctl interface. 2000-05-12 03:36:02 +00:00
Matt Jacob
15e0583c79 Some prettifying for the quirk comments.
Add a SA_QUIRK_NO_MODESEL type and use it for the OnStream real SCSI
device (not the broken one). This one is still broken in that it can't
be set to the same fixed block size it reports [ unflattering comments
about this company elided ].

If we're unable to set buffered mode on, complain, but drive on. It's
not a fatal error to not be in buffered mode.
2000-05-09 04:54:10 +00:00
Nick Hibma
9a1c8571c7 *sigh* I must have been on something that night. Make xpt_periph an
extern with the original in cam_xpt.c instead of replicating
xpt_periph in all the sources using it (and hence not initialising it)
2000-05-07 18:04:50 +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
Matt Jacob
e381b06c73 Add in include of <machine/clock.h> which defines DELAY. 2000-05-02 01:37:02 +00:00
Peter Wemm
365c5db0a7 Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
Poul-Henning Kamp
eb95c536ad Remove unneeded #include <sys/kernel.h> 2000-04-29 15:36:14 +00:00
Poul-Henning Kamp
ed6aff7387 Remove unneeded <sys/buf.h> includes.
Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.
2000-04-18 15:15:39 +00:00
Poul-Henning Kamp
650d90d2b8 Don't include <sys/buf.h> twice. 2000-04-18 13:49:35 +00:00
Poul-Henning Kamp
d3490611f2 Overlooked a s/b_act/bio_queue/ substitution due to targ not being in LINT.
Spotted by:	mjacob
2000-04-16 06:51:27 +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
Nick Hibma
540d9130cc Add a hack to cam that makes the cam_xpt available to the rest of the
kernel. Justin agress that there is no other reasonable alternative to
do automatic rescans on connect.

The problem is that when a new device attaches to a SIM (SCSI host
controller) we need to send a XPT_SCAN_BUS command to the SIM using
xpt_action. This requires however that there is a peripheral available
to take the command (otherwise xpt_done and later bomb). The RESCAN
ioctl uses the same periph.

This enables a USB mass storage drive to do an automatic rescan on
connection of the drive.

The automatic dropping of a CAM entry on disconnection was already
working (asynchronous event).

The next thing to do is find someone to commit a change to vpo to do the
same thing. Just port umass_cam_rescan and friends across to that
driver.

Approved by:   gibbs
2000-04-03 11:11:12 +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
Kenneth D. Merry
a68fce35ea Fix two problems in the ch(4) driver.
- Mike Smith discovered a panic in the changer probe code if the probe
  command (mode sense) fails.  So we need to release the CCB used in the
  probe before we unlock the peripheral.  (i.e. the same fix mjacob put in
  the CD and DA drivers)

- A newline was missing in a warning message.  (PR kern/17512)

PR:		kern/17512
Submitted by:	Louis Mamakos <louie@uu.net> (newline fix)
2000-04-02 07:49:09 +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
Justin T. Gibbs
a9e181db4a o clear the ccb_flags field before sending an accept target I/O ccb to
an HBA.  Garbage in this field confuses the driver in targdone().

o When completing a CCB on behalf of a user process, we need to
  *de-queue* the ccb from our pending ccb list, not queue it again.

o All continue target I/O operations need to have a timeout set.
  We use 5 seconds throughout this driver.

o Remove some logging printfs.

o During abort processing, remove ccbs that are on the pending queue
  from the pending queue, not the work queue.
2000-03-18 22:13:27 +00:00
Matt Jacob
39d3da3df7 Per Justin's request- remove his name from Copyright. 2000-03-18 22:03:41 +00:00
Nick Hibma
e96441b1ee Add a quirk entry for Y-E Data USB floppy drive.
Driver follows in the next few days.
2000-03-15 22:44:03 +00:00
Nick Hibma
0cdabce076 Various typo's.
One minor nit. The speed was displayed wrong when below 1Mb/s.
2000-03-15 21:55:48 +00:00
Matt Jacob
44b0af2592 Some minor fixing - final for 4.0. Debugging messages toned down a bit.
Approved: jkh
2000-02-29 05:45:50 +00:00
Kenneth D. Merry
955f7e7474 Fix 'camcontrol inquiry'. The inquiry data structure changes (increased to
256 bytes) caused it to break on many devices.

The SCSI spec says that for commands with 8-bit length fields, a value of 0
means 256 bytes.  As it turns out, many devices don't deal with that
properly.  Some interpret the 0 as 0, and return no data.  Others return
more than 256 bytes of data, and cause an overrun.

The fix is to tell the device we've only allocated SHORT_INQUIRY_LENGTH (36
bytes) of inquiry data, instead of sizeof(struct scsi_inquiry_data).

camcontrol.c:		Change inq_len in the call to scsi_inquiry() to
			SHORT_INQUIRY_LENGTH, and add a long comment
			explaining the reason for the change.

scsi_all.h:		Add a comment above the definitinon of
			SHORT_INQUIRY_LENGTH alerting people that it is
			both the initial probe inquiry length, and the
			minimum amount of data needed for scsi_print_inquiry()
			to function.

scsi_all.c:		Add a comment about SHORT_INQUIRY_LENGTH being the
			minimum amount of data needed for
			scsi_print_inquiry() to function.

Reviewed by:	gibbs
Approved by:	jkh
Reported by:	"John W. DeBoskey" <jwd@unx.sas.com>
2000-02-20 04:42:44 +00:00
Matt Jacob
0f819b8832 Add a quirk type (and one for ARCHIVE Python's) that disables the
dummy read at sa_mount that attempts to latch up density. This breaks
on at least one drive and sends it into the weeds.

Approved:	jkh
2000-02-03 18:29:25 +00:00
Matt Jacob
c7abe45ece Because we added 4 bytes to the inquiry data size, we need to
rev the CAM revision too. Tsk.
Submitted by:	ken@freebsd.org
2000-01-25 21:24:52 +00:00
Matt Jacob
c19cf05d0d Redo the SHORT INQUIRY length stuff to be a bit cleaner.
Obtained from:gibbs@freebsd.org
2000-01-25 18:25:22 +00:00
Kenneth D. Merry
56e3e24bfd When autosense fails, make sure we retry the command.
PR:		kern/15975
Submitted by:	Carl Mascott <cmascott@world.std.com>, n_hibma
2000-01-25 17:45:02 +00:00
Matt Jacob
937097d9cc Propagate sense data through from SIM (if there) and mark the CTIO
that there's sense to send with status (if the SIM does it), and
then clear any pending contingent allegiance state for this initiator
if the SIM actually did send the sense data.

Widen MAX_INITITATORS to 256- that's still not quite right, but will
accomodate the widest Fibre Channel support in FreeBSD now.

Obtained from:(partially) gibbs@freebsd.org
2000-01-25 17:42:27 +00:00
Matt Jacob
471da22662 Propagate sense data through from SIM (if there) and mark the CTIO
that there's sense to send with status (if the SIM does it).
Reviewed by:	gibbs@freebsd.org
2000-01-25 17:39:09 +00:00
Matt Jacob
366f55288e Go for the gusto and do the full 256 bytes for inquiry data.
Obtained from:gibbs@freebsd.org
2000-01-25 17:37:02 +00:00
Peter Wemm
75f51904b5 A minimal update to the device wiring code so that it looks at the
dynamic resource tables rather than relying on a duplicated cam-specific
table generated by config(8) in ioconf.c.  This was a major holdup to
getting loader / userconfig driven configuration of scsi wiring.
2000-01-23 18:03:38 +00:00
Matt Jacob
090fbb8802 Clean up some of the SAF-TE matching code. Add
a few missing newlines in printouts.
2000-01-21 21:14:42 +00:00
Matt Jacob
10b6172afb Do the minor changes needed because of change to ccb_getdev structure.
JKH Trading Stamps applied.

Reviewed by:	gibbs@freebsd.org, ken@freebsd.org
2000-01-17 06:27:37 +00:00
Matt Jacob
ab6eec3ad9 Increase size of the scsi_inquiry_data structure to it's nearly
full size. Define a SHORT_INQUIRY_LENGTH for use during initial
probing (covers the size used previously). Define some SPC-2 related
fields (and define the revision code for SPC-2) which includes some
further SPI-3 defines. Don't go all the way (256 bytes) for the structure-
stop 4 bytes short- because we haven't auditted the source base to find
any u_int8_t potential overflow issues. Add RBC (single byte device)
and OCR (Optical Character Reader) device type codes.

Approved by JKH.

Reviewed by:	gibbs@freebsd.org, ken@freebsd.org
2000-01-17 06:24:35 +00:00
Matt Jacob
9ec5d7cd35 Remove garbage collected tags from their usage in the ccb_getdev
structure. Remove usage of the (now gone) pd_type tag of same.

Add an extra probing state such that if we successfully run an
initial inquiry (36 bytes), rerun another one with a longer data
size as informed by the 'additional length' field in the first
returned inquiry data (making sure not to get bigger than the
actual scsi_inquiry_data structure- which has also been modified-
see separate checkin of scsi_all.h). This allows devices such
as SAF-TE devices (which have identifying marks in offsets 48-53
in inquiry data) to be successfully found without special case
inquiry commands. There are also a lot of other things such as
version codes that are coming in in the SPC2 specification that it
would be useful to get our hands on.

Reviewed by:	gibbs@freebsd.org, ken@freebsd.org
2000-01-17 06:20:08 +00:00
Matt Jacob
826eb7c840 Shift bits for CAM flags so that the top bit isn't set in an enum
(at request of Ken Merry). Garbage collect items out of the ccb_getdev
structure and and a length field so that consumes will know how much
of the inq_data tag is valid. Clean up a few misspellings. Add
a CAM_SEND_STATUS target mode flag.

All of this necessitated a CAM_VERSION bump.

JHK approved.

Reviewed by:	gibbs@freebsd.org, ken@freebsd.org
2000-01-17 06:15:35 +00:00
Matt Jacob
5fd6140dfa Add a CAM_SENT_STATUS for use in target mode. JHK approved.
Reviewed by:	gibbs@freebsd.org, ken@freebsd.org
2000-01-17 06:11:33 +00:00
Matt Jacob
8d9e6c80ca Do not propagate the ENCI_SVALID bit for overall enclosure status
to userland apps- they get confused.
2000-01-17 02:02:41 +00:00
Matt Jacob
6da094e967 Add in SAF-TE handling code and do some minor consistency cleanups. 2000-01-17 00:36:28 +00:00
Matt Jacob
982ab0744f buglet fix 2000-01-15 23:05:29 +00:00
Matt Jacob
c8c54c88ae Do a wad of cleanup and put into place at least *one* functional
portion of SES retrieval (native SES itself) and implement all
the appropriate ioctls. Seems to work...
2000-01-15 22:41:27 +00:00
Matt Jacob
92ebdff04b Move the kernel specific stuff into scsi_ses.c. Redo the ioctls
to be more platform independent. Add a ses_hlptxt structure definition
and retrieval ioctl for when we are able to retrieve object help text

SES Objects can have up to 64 KBytes of associated 'help' text- the
Sun A5000 uses this, for example, to give physical location information
(e.g., 'left power supply').
2000-01-15 22:40:04 +00:00
Matt Jacob
121ac7c9a2 add SEND/RECEIVE diagnostic opcodes, SEND is a Mandatory command 2000-01-15 19:05:29 +00:00
Matt Jacob
4092880e7f Remove inclusion of dkbad.h- seems like a bug, but I had a stale
dkbad.h in /usr/include/sys- the local build process shouldn't have
been happy with that, but not finding dkbad.h in ../../sys. Hmm.
2000-01-15 07:39:05 +00:00
Matt Jacob
69ad2fbe7e add functional but stub SES/SAF-TE driver 2000-01-15 07:09:12 +00:00
Justin T. Gibbs
434bbf6e63 Clean up the xpt_sim creation to mirror how HBA drivers perform this task.
Clean up node creation in the EDT so that initialization follows member
declaration.

Sort registered paths by pathid so that we probe busses in order of
ascending pathid.  This makes hardwiring of busses without wiring
individual targets do what the user expects. (submitted by tegge@FreeBSD.org)

Fix an EDT node leak.  Target nodes would never go away.

Implement xpt_bus_deregister().
(prodded by some patches from T. Ichinoseki, but implemented differently.)
2000-01-14 23:08:46 +00:00
Matt Jacob
2759b3c7c4 Widen width of tag && initiator ids to u_int
(from u_int8_t) in ccb_accept_tio structure. This
matches usage elsewhere and also allows me to
overload the tag id with the RX_ID for fibre
channel target mode.
Reviewed by:	gibbs@freebsd.org
2000-01-03 08:54:51 +00:00
Matt Jacob
b6fd7c6188 Change error message make sense and add a missing
periph_release on a failed open so that the periph
dtor for it will get called when we deallocate the
instance from targioctl.
1999-12-30 02:32:13 +00:00
Matt Jacob
72c968cec7 Restore this driver to a working state. The control device has
to be created at init time. The unit devices are created at
ctor when new instances are created and bound and destroyed
when that instance is closed. As such, there is just s single
static control dev_t for this driver (the per-unit dev_t's are
still in the softc).

When we have decommissionable periph drivers, a destroy_device
on the control device will have to called.
1999-12-29 22:55:01 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Peter Wemm
664a31e496 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 04:46:21 +00:00
Matt Jacob
b6a0d1ab0c Make sure we don't look at an edt entry that could go away when we try
and figure out whether to probe higher than logical unit 7.
Obtained from:gibbs@freebsd.org
1999-12-20 16:16:53 +00:00
David E. O'Brien
a5a299e5d7 Add FAST-80 timing to the scsi syncrates table.
Submitted by:	Gerard Roudier <groudier@club-internet.fr>
1999-12-16 16:04:54 +00:00
Matt Jacob
cda9006f07 minor comment update 1999-12-13 19:40:00 +00:00
Kenneth D. Merry
223b7a2363 Quirk all Pioneer changers as changers up front, instead of waiting for the
second LUN to show up.

mjacob's change (which is correct) in rev 1.21 of cam_periph.c to elminiate
infinite retries of the SCSI busy status bit seems to have broken probing
of Pioneer changers that aren't already quirked.

The right way to fix this is probably to change things around so we can
guarantee 100% sequential probing of LUN-based changers even if they aren't
quirked.  This should fix things for now, though.
1999-12-11 23:00:44 +00:00
Kenneth D. Merry
86b2c8466d Revamp the devstat priority system. All disks now have the same priority.
The same goes for CD drivers and tape drivers.  In systems with mixed IDE
and SCSI, devices in the same priority class will be sorted in attach
order.

Also, the 'CCD' priority is now the 'ARRAY' priority, and a number of
drivers have been modified to use that priority.

This includes the necessary changes to all drivers, except the ATA drivers.
Soren will modify those separately.

This does not include and does not require any change in the devstat
version number, since no known userland applications use the priority
enumerations.

Reviewed by:	msmith, sos, phk, jlemon, mjacob, bde
1999-12-08 04:45:23 +00:00
Kenneth D. Merry
aa11587317 Recognize the Pioneer CD-ROM DRM-6324X as a changer.
PR:		kern/15198
Submitted by:	Don Lewis <truckman@FreeBSD.org>
1999-12-07 04:14:56 +00:00
Matt Jacob
6af65c6902 Add back in a prefatory TUR when the tape is *not* mounted. This seems
to help with some older tape drives.
1999-12-04 01:13:59 +00:00
Matt Jacob
160f42cca4 Correct some botched timeout defines. Allocate only 8KB for the test read
in samount. Make things a lot quieter in samount (and other places). Fix
ridiculous and not so ridiculous bugs in compression related code in both
sagetparams and sasetparams.
1999-12-03 23:14:11 +00:00
Matt Jacob
ddc83e8523 Don't clear the SA_FLAG_TAPE_LOCKED prior to calling
saprevent when we're doing an OFFLINE ioctl- saprevent
won't unlock the door, which then causes the unload to
fail on some units.

If we've already unloaded the tape, don't try and rewind and
unload in saclose. This is a slightly riskier change because
we're now going to depend on SA_FLAG_TAPE_MOUNTED to say whether
we've really unloaded the tape. This involved changing the
setting in sadone for tape errors to SA_FLAG_TAPE_FROZEN (which
is more accurate anyway-if you get an EIO you've probably lost
tape position anyway) where it used to just clear the mounted
flag.
1999-11-21 20:23:58 +00:00
Matt Jacob
2728bfbd9e Add make_dev functions. Tested with only one changer (sigh- all my others
are broken).
Submitted by:	ken@freebsd.org
1999-11-21 19:17:47 +00:00
Matt Jacob
44198f294c Fix a couple of boo-boos in the last delta. 1999-11-17 17:11:21 +00:00
Matt Jacob
387c08f0e8 Fix for 11815 (at mount time do a throwaway read of the front of the
tape to force the drive to do a media access so it knows what media
may be inserted).

Also Ken's make_dev patches- relatively untested.
1999-11-17 06:05:09 +00:00
Kenneth D. Merry
273a1a3da7 Get rid of some trailing commas in enumerated types that cause gcc to
complain when some warnings are turned on.

Requested by:	Bertrand Petit <elrond@phoe.frmug.org>
1999-11-17 05:06:52 +00:00
Kenneth D. Merry
73d2691976 Convert the xpt, pass, pt and target drivers to use the new
make_dev()/destroy_dev() interface.
1999-11-17 04:59:09 +00:00
Kenneth D. Merry
10e1cf639d Fix Bus Device Resets from userland, and specifically from camcontrol.
camcontrol was setup to use the old scheme of going through the xpt(4)
device, which never worked properly (and has been disabled for a while).

camcontrol now sends BDRs through the pass(4) device, and XPT_RESET_DEV
CCBs are put on the device queue in the transport layer, as they should be.

Submitted by:	luoqi
Reviewed by:	ken
1999-10-31 02:39:44 +00:00
Poul-Henning Kamp
02c58685a4 Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for the
"rw" argument, rather than hijacking B_{READ|WRITE}.

Fix two bugs (physio & cam) resulting by the confusion caused by this.

Submitted by:   Tor.Egge@fast.no
Reviewed by:    alc, ken (partly)
1999-10-30 06:32:05 +00:00
Poul-Henning Kamp
923502ff91 useracc() the prequel:
Merge the contents (less some trivial bordering the silly comments)
of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>.  This puts
the #defines for the vm_inherit_t and vm_prot_t types next to their
typedefs.

This paves the road for the commit to follow shortly: change
useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE}
as argument.
1999-10-29 18:09:36 +00:00
Matt Jacob
66a9bb81f6 Mark path for deallocation only *after* you've successfully allocated it. 1999-10-27 21:49:36 +00:00
Matt Jacob
af51b059b5 Put an upper bound on the number of BUSY status retries we'll do (use the
retry count for the ccb). This is probably not quite the right thing, but it
is better than silently hanging on (possibly broken) h/w which is what we
do now.

Reviewed by:Justin/Ken: they weren't entirely happy about it but didn't say no.
1999-10-16 23:53:09 +00:00
Matt Jacob
0642b69a16 Protect xpt_run_dev_sendq in xpt_release_devq_device with splsoftcam. This
seems to handle the case of timeouts firing during probe but after a device
has gone away. It really does help.
Obtained from:gibbs@freebsd.org
1999-10-16 23:31:34 +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
Matt Jacob
f219e08f02 Another 1FM@EOD quirk (from mike@sentex.net for a Seagate STT20000),
and add a config option that allows one to default to 1FM@EOD for tapes
otherwise unquirked or unknown as to which to prefer. Note that tcopy
will be broken for these tapes until tcopy is fixed.
1999-10-02 20:17:16 +00:00
Poul-Henning Kamp
779b1b3d5b Introduce the disk mini-layer and devstat_end_transaction_buf() in cam/scsi.
Somewhat reviewed by:   ken
1999-10-01 09:34:10 +00:00
Matt Jacob
a8dafb4d99 Ooops- forgot to commit this.
PR:		14009
Submitted by:	jreynold@primenet.com
1999-09-28 05:14:52 +00:00
Poul-Henning Kamp
d6a0e38a1b Remove five now unused fields from struct cdevsw. They should never
have been there in the first place.  A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags
1999-09-25 18:24:47 +00:00
Poul-Henning Kamp
c4da3dcc64 Remove unneeded disk-related includes. 1999-09-12 08:23:21 +00:00
Poul-Henning Kamp
a35de5c8a7 Don't register a block major for tapes.
Reviewed by:	mjacob
1999-09-08 17:01:41 +00:00
Poul-Henning Kamp
10af1a2b5f We don't need to pass the diskname argument all over the diskslice/label
code, we can find the name from any convenient dev_t
1999-08-28 14:33:44 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Bruce Evans
1195ae1843 Cast pointers to uintptr_t instead of casting them to u_long. Don't
depend on gcc's feature of casting lvalues.  Cosmetic.
1999-08-24 00:04:45 +00:00
Poul-Henning Kamp
9dcbe2404a Convert DEVFS hooks in (most) drivers to make_dev().
Diskslice/label code not yet handled.

Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers)

Add the correct hook for devfs to kern_conf.c

The net result of this excercise is that a lot less files depends on DEVFS,
and devtoname() gets more sensible output in many cases.

A few drivers had minor additional cleanups performed relating to cdevsw
registration.

A few drivers don't register a cdevsw{} anymore, but only use make_dev().
1999-08-23 20:59:21 +00:00
Bruce Evans
d918320517 Use devtoname() to print dev_t's instead of casting them to long or u_long
for misprinting in %lx format.
1999-08-23 20:35:21 +00:00
Mike Smith
fcb893a801 Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by:	green
1999-08-21 06:24:40 +00:00
Kenneth D. Merry
3ece1bd296 Fix short timeout problems with the pt(4) driver:
- increase the default timeout from 10 seconds to 60 seconds
- add a new kernel option, SCSI_PT_DEFAULT_TIMEOUT, that lets users specify
  the default timeout for the pt driver to use
- add two new ioctls, one to get the timeout for a given pt device, the
  other to set the timeout for a given pt device.  The idea is that
  userland applications using the device can set the timeout to suit their
  purposes.  The ioctls are defined in a new header file, sys/ptio.h

PR:		10266
Reviewed by:	gibbs, joerg
1999-08-20 03:48:11 +00:00
Bill Fumerola
b8e49f681b Welcome devtoname(), to most likely be used when printing information
about a dev_t.

printf("%x", dev) now becomes printf("%s", devtoname(dev)) because
printing actual information about the device is much more useful then
printing a pointer to an address that would never help the developer debug.

Submitted by:	phk, bde
1999-08-17 20:25:50 +00:00
Justin T. Gibbs
e414ac576f Bump CAM version number. 1999-08-16 23:18:24 +00:00
Justin T. Gibbs
0e5f60747c Checkpoint work on handling error conditions.
Handle errors reported through immediate notify ccbs.  This includes
bus resets, BDR messages, and abort messages.

Properly setup CA conditions for errors such as uncorectable parity
in data phases, reselection failure, and IDE message received.

Add a mechanism for stalling the queue of transactions to a particular
initiator while a CA is in progress.  Since we don't yet support
tagged I/O, this is largely just for show right now.

Properly bzero our softc at init time (oops).

Add more documentation on what all of the queues in our softc do.
1999-08-16 22:39:25 +00:00
Justin T. Gibbs
e5f5a0d8b1 xpt_release_devq now takes a count. 1999-08-16 22:23:01 +00:00
Justin T. Gibbs
2cefde5ff3 Implement the guts of the XPT_ABORT function code.
Clear residuals for XPT_TARGET_IO/XPT_CONT_TARGET_IO calls just
as we do for XPT_SCSI_IO calls.

Make xpt_release_devq a proper reciprocal of xpt_freeze_devq by
allowing the caller to decrement the count more than once per call.

Change the semantics of xpt_path_cmp to return 1 for a match
with a wildcard from path1 and 2 for a match with wildcards
from path2.  This change doesn't affect most callers as they
only check for >=0 (exact match or one containing a wildcard).

When cleaning up a device node, ensure that there are no timeouts
outstanding that reference it.
1999-08-16 22:22:41 +00:00
Justin T. Gibbs
b8b98bc375 Add another flag for debugging just peripheral drivers. The whole debugging
mechanism should be completely  revamped, but this will serve for the time
being.

Take advantage of some new behavior in xpt_path_comp which allows the
caller to determine which path, if any, had wildcards in it that allowed
for a match to succeed.  We can now use this to filter out wildcard
nodes in the EDT.

Make the amount of time we pause after writing a debug message
configurable.
1999-08-16 22:18:14 +00:00
Justin T. Gibbs
bf8bb7acc0 Add another command characteristic flag for commands that are queued
on physical devices as oposed to just in the XPT.  This is used to
mark XPT_SCSI_IO, XPT_RESET_DEV, XPT_ENG_EXEC, XPT_TARGET_IO, and
XPT_CONT_TARGET_IO function codes.

Change tag_id and init_id to be u_int from u_int8_t.  Some topologies
supported by CAM support much larger ID and tag ID address spaces
than parallel SCSI.

Kill some unused fields in the IMMED_NOTIFY ccb type.
1999-08-16 22:14:47 +00:00
Matt Jacob
48f6456d82 Put in a limit (8) for lun width- do not exceed probing this unless a device
is quirked for allowing it. This will allow SCSI cards to specify their true
correct lun width (32 for Qlogic SCSI, 16 or 65536 for Qlogic Fibre Channel)
without crippling the system because of f/w breakage of a lot of drives.
Reviewed by:	gibbs@freebsd.org
1999-08-16 17:47:39 +00:00