Commit Graph

322 Commits

Author SHA1 Message Date
Bruce Evans
a24a66635c Don't depend on gcc's feature of permitting labels that aren't followed
by a statement.
1997-07-01 00:22:51 +00:00
Tor Egge
7a1d27b301 Introduce an advisory exclusive lock on the scsi link structure.
Change sd_open, sd_close and sd_ioctl to use this lock to ensure
serialization of some critical operations, thus avoiding some
race conditions. Ideas picked from NetBSD (ccd and sd devices).
This fixes one of the problems noted in PR kern/3688.
Reviewed by:	"Justin T. Gibbs" <gibbs@plutotech.com>
1997-06-25 19:07:43 +00:00
Stefan Eßer
79a853b932 Add quirk "no tags" entry for HP 3724/5 hard disk drives. 1997-06-11 22:29:01 +00:00
Jean-Marc Zucconi
7344a61e7b Add 2 new ioctls: WORMIOCREADSESSIONINFO and WORMIOCWRITESESSION.
These commands are required for the "Disk-At-Once" write process:
WORMIOCREADSESSIONINFO returns the length of the lead-in and lead-out areas
and WORMIOCWRITESESSION is used to send  the table of contents of the disk.
1997-06-02 20:05:39 +00:00
Jean-Marc Zucconi
ab4fa45fb7 The correct way to combine 2 4bit values into a 8bit one is (a<<4) | b, not
(a<<8) || b.
The conical hat please!
1997-05-28 21:25:49 +00:00
Joerg Wunsch
998bb1a784 Add an entry for the Epson scanners since some of them repsond to more
than one LUN:

Submitted by:	simokawa@sat.t.u-tokyo.ac.jp (Hidetoshi Shimokawa)
1997-05-25 14:20:28 +00:00
Joerg Wunsch
eceeb60438 Initialize the buf_queue of the pt(4) driver.
PR:		kern/3629: /sys/scsi/pt.c doesn't...
Submitted by:	simokawa@sat.t.u-tokyo.ac.jp (Hidetoshi Shimokawa)

Add a catch-all record for removable SCSI devices to default them to
only one LUN.

PR:		kern/3580: Bad LUN probes on Xyratex...
1997-05-21 19:35:11 +00:00
Jean-Marc Zucconi
8d496aeec7 Set the quirks for the worm drives. 1997-05-19 17:32:10 +00:00
Jean-Marc Zucconi
1ad8b2cb84 A few improvements to the worm driver.
- remove all calls to scsi_stop_unit(). Some drives refuse commands when
  stopped. This will fix the 'device not configured' message which was
  cleared after opening/closing the tray.
- Never set the logical block address in the scsi_cmd struct when writing.
  The computation was bogus for block sizes not a multiple of DEV_BSIZE.
  (the bug is still there in the READ case)
- reset the block size to the 2048 bytes in finalize_track() track to avoid
  an error when mounting a disk after an audio write.
- remove the WORMIOCQUIRKSELECT ioctl. Quirks are now recorded at probe time
  (see scsiconf.c)
- change and expand the argument to the WORMIOCPREPTRACK ioctl. It now possible
  to select more track options (copy bits, ISRC codes, track type,
  track number)
- add an error handler to catch false errors (warnings in fact) and record
  the error type.
- add an ioctl call (WORMIOERROR) to get more information on the nature of the
  error when a command or a write failed.
- add an ioctl call (WORMIOCFINISHTRACK) to finalize a track without closing
  the device (closing the device still finalize the track if the command was
  not performed)

Approved by:	joerg
1997-05-19 17:30:50 +00:00
Joerg Wunsch
28d90c30ee Add the D_DISK flag to the cdevsw structs of various CD-ROM drivers. 1997-05-10 12:13:17 +00:00
Joerg Wunsch
5adee135aa Duplicate the TOC handling ioctls from the cd(4) driver. Duplicating
the work is silly, and all this will be a moot point with Justin's CAM
driver, and there are still many ioctls missing -- but i need these
right now.  It's silly to need to move the CD-R back to the other
drive in order to determine the session start info when burning multi-
session CD-Rs.
1997-05-05 13:35:01 +00:00
Joerg Wunsch
5a9714de76 This mega-commit brings the following:
. It makes cd9660 root f/s working again.
. It makes CD9660 a new-style option.
. It adds support to mount an ISO9660 multi-session CD-ROM as the root
  filesystem (the last session actually, but that's what is expected
  behaviour).

Sigh.  The CDIOREADTOCENTRYS did a copyout() of its own, and thus has
been unusable for me for this work.  Too bad it didn't simply stuff
the max 100 entries into the struct ioc_read_toc_entry, but relied on
a user supplied data buffer instead. :-(  I now had to reinvent the
wheel, and created a CDIOREADTOCENTRY ioctl command that can be used
in a kernel context.

While doing this, i noticed the following bogosities in existing CD-ROM
drivers:

wcd:	This driver is likely to be totally bogus when someone tries
	two succeeding CDIOREADTOCENTRYS (or now CDIOREADTOCENTRY)
	commands with requesting MSF format, since it apparently
	operates on an internal table.

scd:	This driver apparently returns just a single TOC entry only for
	the CDIOREADTOCENTRYS command.

I have only been able to test the CDIOREADTOCENTRY command with the
cd(4) driver.  I hereby request the respective maintainers of the
other CD-ROM drivers to verify my code for their driver.  When it
comes to merging this CD-ROM multisession stuff into RELENG_2_2 i will
only consider drivers where i've got a confirmation that it actually
works.
1997-05-04 15:24:23 +00:00
Joerg Wunsch
a5e62cce18 Add the Archive 4586NP tape changer.
PR:		kern/3481
Submitted by:	bruce@zuhause.mn.org (Bruce Albrecht)
1997-05-03 22:23:13 +00:00
Søren Schmidt
19accede88 Remove old code in #if 0, leftovers from the days before != 512byte
sector support.
1997-05-01 19:15:38 +00:00
Jordan K. Hubbard
6c0a2b9722 Implement dkstats for worm devices so they show up in iostat et al.
I got tired of not seeing my worm stats show up during a burn. :)
[Joerg, I just stapled in 1MB/sec for a bogus xfer rate and left seek = 1,
 as suggested - I'm not going to dynamically calculate the xfer rate from
 a known device spectable, OK? :-)]
Reviewed by:	joerg
1997-04-04 22:12:55 +00:00
Justin T. Gibbs
92fb126230 Add a 1ms delay in the XS_BUSY case. This is the same error code returned
for the QUEUE FULL condition.  This may help avoid wedging a device by
immediately requeeuing the transaction in this case.
1997-04-04 19:37:20 +00:00
KATO Takenori
61b80893b2 Moved prototypes of scsi_data, scsi_link and proc before scsi_adapter.
If PC98 is defined, the type of the first argument of open_target_lu
is scsi_link structure.
1997-04-03 10:09:29 +00:00
John-Mark Gurney
21a69f7c65 add a cd quirk flag CD_Q_BCD_TRACKS, that will convert bcd2bin the track
id's from broken scsi cdrom drives like my Chinon... plus update the quirk
entry for it :)

Closes my own PR#2423
1997-04-02 09:05:43 +00:00
Joerg Wunsch
e49784d15d Add an entry for the newer Philips CDD26xx family CD-R drives. They
come out with PHILIPS as the vendor string, as opposed to IMS for the
older ones.

Submitted by:	"Brian N. Handy" <handy@sag.space.lockheed.com>
1997-04-01 19:28:03 +00:00
Bruce Evans
fce002fdef Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include
it when it is not used.  In most cases, the reasons for including it
went away when the special ioctl headers became self-sufficient.
1997-03-24 11:25:10 +00:00
Bruce Evans
a02b0b9694 Removed nested #includes of <scsi/scsi_debug.h> and <scsi/scsi_driver.h>
from <scsi/scsiconf.h> and fixed everything that depended on them.
(Missed this one.)
1997-03-24 04:26:46 +00:00
Justin T. Gibbs
65e5a3a9df free_xs must be called at splbio(). This is usually the case since the main
caller is scsi_done which the controller interrupt handlers call.  In the
case of a non-buffer based transaction, the xs structure is freed by the
process that initiated the transfer in scsi_scsi_cmd.  In this case, an
explicit splbio/splx pair around the call to free_xs is required.  Without
the splbio protection, the xs free list could be corrupted, and the type
driver's start routine might run without spl protection.

Submitted by:	Tor Egge <Tor.Egge@idt.ntnu.no>
Obtained from: PR kern/2891
1997-03-24 01:46:15 +00:00
Bruce Evans
6617929964 Removed nested #includes of <scsi/scsi_debug.h> and <scsi/scsi_driver.h>
from <scsi/scsiconf.h> and fixed everything that depended on them.
1997-03-23 06:33:55 +00:00
Bruce Evans
08febfa741 Removed nested #include of <sys/conf.h> from <scsi/scsi_driver.h>
and fixed everything that depended on getting it from the wrong
place.  Most of the broken things actually only depended on getting
the declaration of their interrupt handler from "ioconf.h".
1997-03-23 04:40:00 +00:00
Bruce Evans
3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Joerg Wunsch
930bb1a4da Add a quirk entry for the HP6020i, after John has just confirmed that
it works now.

Submitted by:	jhay@zibbi.mikom.csir.co.za (John Hay)
1997-03-10 20:51:17 +00:00
Joerg Wunsch
f357773315 Merge Jason Thorpe's updated changer stuff into the actual system.
Many things have been changing in the kernel since mid-1996, so there's
quite some amount of diffs here already.  It compiles, but i cannot
test it anywhere here.

2.2 candidate?

Closes PR # 1201.
1997-03-06 15:36:45 +00:00
Peter Wemm
6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
John Dyson
996c772f58 This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>
1997-02-10 02:22:35 +00:00
Joerg Wunsch
17d9b79a9f Add an entry for the Nakamichi 4-disk changer.
Submitted by:	K.R.Marshall@ukc.ac.uk (K.R.Marshall)
1997-02-08 13:26:31 +00:00
Bill Paul
9baa6352dc Make some small tweaks to the messages to clean up some stuff
from last time. Some people have pointed out that there were some odd
side-effects in the changes I made. Two things are different:

- sc_print_addr() will print 'foodev0:' (i.e. sd0:, st0:, cd0:, etc...)
  if the device name is known. If it's not known, it'll use a longer
  notation. This shortens error messages back to a sane length.

- Added a small function called sc_print_init() to set the sc_printing
  flag so that sc_print_addr() will know that we want it to print a
  linefeed. Used this in scsi_device_attach() to restore proper carriage
  return printing behavior which I broke.

Remaining bogons: the NCR SCSI driver prints out information while the
device-specific attach routine is running with its own linefeeds. This
breaks up the individual messages emitted by the subdriver modules and
causes at least one message to appear on a line by itself without a
device spec prefix. I'm not sure of the correct way to fix this, and
I don't have any NCR SCSI hardware to test with anyway.

There's probably more, but I gather that a rewrite of the SCSI subsystem
is pending anyway, so I'll leave the rest to Those Who Know More About
This Than I (tm).
1997-02-08 03:42:22 +00:00
Joerg Wunsch
ab865e3435 After so many people have been bugging me :), finally implement
read-mode access to CD-ROM media in the worm(4) driver.  No whistles
and bells yet, like all the CDIO* commands, but at least a start.

In order to do this, i had to slightly rearrange the semantics of an
open(2) on the worm driver: now, opening it with O_NONBLOCK set means
no actual IO operations will be intended but only ioctls are to be
processed.  This mode is used by wormcontrol(8) to prepare a track
and/or session.

I have only been able to test this on a 2.2-GAMMA system by now, and
only the !DEVFS part is tested yet.  Also, i have only done a dummy
burn so far, but wouldn't expect many surprises else.  Report bugs to
me ASAP, if there's reasonable demand and i hear no objections, i
might consider merging it into the 2.2 branch as well.
1997-02-06 22:19:44 +00:00
KATO Takenori
ed39d36d27 Moved PC-98 routine in sd_get_parms() to pc98_machdep.c. 1997-02-04 22:27:09 +00:00
Joerg Wunsch
c1b822b746 Do not accidentally default a device that failed probing to T_DIRECT
(since T_DIRECT just incidentally happens to be equal 0).  This causes
more harm than it would do good.  Instead , get it at the uk driver.

Reviewed by:	obrien@NUXI.com (David O'Brien)
1997-02-02 20:57:12 +00:00
Joerg Wunsch
ecd20d9e4d Fix a benign type mismatch i've introduced in rev 1.40.
Pointed out by:	bde
1997-01-30 22:47:55 +00:00
Bruce Evans
0f49e57b57 Removed `Debugger("no slices")'. It's normal and harmless to have no
slices in sd_open() after a media change when the previous sd_open()
discards the previous slices and then fails.  sd_open() just handles
media changes poorly and fails too often.
1997-01-29 14:18:34 +00:00
Bill Paul
fc7c79b907 Make the SCSI probe messages more BSDish. This may raise a few eyebrows
("Hey! Who made _you_ the keeper of all things BSDish?!") but this has
bugged me for a long time, and now that I finally have the chance
to hack on it (and test the results), I'll take my chances. I can also
point to other BSD implementations for precedents if you put my back to
the wall.

The only thing that's changed is how the messages are formatted. Now,
instead of having this:

aha0 at 0x330-0x333 irq 11 drq 5 on isa
(aha0:3:0): "HP C1553A 9503" type 1 removable SCSI 2
st0(aha0:3:0): Sequential-Access density code 0x24, variable blocks, write-enabled
(aha0:3:1): "HP C1553A 9503" type 8 removable SCSI 2
ch0(aha0:3:1): Medium-Changer 6 slot(s) 1 drive(s) 0 arm(s) 0 i/e-slot(s)

We have this:

aha0 at 0x330-0x333 irq 11 drq 5 on isa
scbus0 at aha0 bus 0
st0 at scbus0 target 3 lun 0
st0: <HP C1553A 9503> type 1 removable SCSI 2
st0: Sequential-Access density code 0x24, variable blocks, write-enabled
ch0 at scbus0 target 3 lun 1
ch0: <HP C1553A 9503> type 8 removable SCSI 2
ch0: Medium-Changer 6 slot(s) 1 drive(s) 0 arm(s) 0 i/e-slot(s)

Which is (to me anyway) is a lot more pleasant to look at. (Call me
crazy -- g'head: you know you wanna -- but the previous messages remind
me of Linux. Ever see the output from the linux device probes? It's a mess
of copyright notices, version numbers/dates, author e-mail addresses and
other crap. Let's not go there, okay? Bleh.)

Notice that devices are now specified in terms of the scsi bus they
live on rather than the adapter. This better reflects the contents
of the kernel config file (if you use wired-down device specifications
anyway) and removes some ambiguity that may arise if you have a multi-
channel adapter with more than one bus.

Also, sc_print_addr() now generates messages like this:
st0 at scbus0 target 3 lun 0: NOT READY asc:3a,0 Medium not present

instead of this:
st0(aha0:3:0): NOT READY asc:3a,0 Medium not present

I also added a quirk entry for the HP Superstore 12000e 6 tape DAT
autoloader, which needs SC_MORE_LUS in order for the changer device
to be properly probed and attached. (I'm working on a chcontrol utility
to manipulate the changer on this drive which should hopefully be general
enough to work with other changers too. If you want the prototype I have
now, it's at ftp://skynet.ctr.columbia.edu/pub/freebsd/changer.c.)

Remaining bugs:

- The 'foodev0: yadda yadda yadda' bits should probably be printed entirely
  by the device-specific subdriver attach code instead of half by the
  scsi_device_attach() routine and half by the device specific attach
  routine like it is now.

- The wired-down device specifications in the kernel config file should
  be used to control bus/device probing to some extent rather than just
  for choosing names for devices we find. If the config says there's a
  device at scbus0 target 0 lun 0 called sd0, we should look there and
  check for a device that can be managed by the sd driver. If we don't
  find one, we should probably complain that there's no device there or
  that there is a device but of the wrong type. Once all the devices from
  the wired down list have been probed, the code can then autodetect and
  autoattach any devices that remain unassigned.

- Apparently some tape changers (hi Ulf!) return 'not ready/medium not
  present' when the magazine is loaded but a tape has not been put in the
  drive yet. This causes an open(/dev/ch0) to fail and prevents you from
  using the changer.c utility to load the first tape into the drive. My
  HP changer does not behave this way. The workaround is to manually load
  a tape into the drive before attempting to use the changer program, but
  you can get in trouble if you accidentally eject a tape without loading
  a new one and you're at a remote location: you won't be able to load
  any tapes anymore. I'm not sure what the correct software solution is
  for this but ideally there should be one.

- I should not be doing this: I'm the NIS guru, not the SCSI guru.
  (This is not my beautiful code. How did I get here? My god: what
  have I done?)
1997-01-25 20:27:13 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Joerg Wunsch
7b0951f009 Slightly re-order the sequence of commands issued, so try to send
the START UNIT command before testing whether the device is ready.
Maybe it should be done even earlier, i'm not 100 % sure.

Again, CD changers will most likely benefit from it.

While i was at it, also made the debugging case a little more verbose
about why the cdopen() yielded an ENXIO.  (Only in effect when
SCSIDEBUG is specified.)

Should eventually also go into 2.2.
1996-12-24 11:35:24 +00:00
Joerg Wunsch
802e82cdd2 Do something Peter Dufault long since intended to do: make a current
error code with ASC/ASCQ 4/1 (``Logical unit is in the process of
becoming ready'') non-fatal.  Retry the operation until it will
eventually either yield a real error condition, or finally succeed.

Devices like CD changers or tape drives with a freshly inserted
cartridge should benefit from this.

Should go into 2.2 after some testing in -current.  I'd like to see
this in the release if possible.
1996-12-24 11:32:41 +00:00
Joerg Wunsch
2f401e5f09 Reorder the wildcard entries to the end of the quirks list, so they
will be probed last.  It's otherwise impossible in some cases to get
SCSI type override working.

Supposed fix for PR # kern/2225.
1996-12-20 20:43:45 +00:00
Joerg Wunsch
fb2efb8992 Add an entry for Ricoh's MO drives.
Submitted by:	msmith@atrad.adelaide.edu.au (Michael Smith)
1996-12-14 09:57:04 +00:00
Jordan K. Hubbard
0b3870cb60 Close PR#2198:
I've added an installation from optical disk drive facility.
	This enables FreeBSD to be installed from an optical disk, which
	may be formatted in "super floppy" style or sliced into MSDOS-FS
	and UFS partitions.

	Note:  ncr.c should be reviewed by Stefan Esser <se@freebsd.org>
	and cd.c by Joerg Wunsch <joerg@freebsd.org> before bringing this
	into 2.2.

Submitted-By: Shunsuke Akiyama <akiyama@kme.mei.co.jp>
1996-12-13 07:55:14 +00:00
Joerg Wunsch
5a4a0aacba Slightly change the `od' driver quirk for the Matsushita LF-1000
series drives, and add the NAKAMICHI MO drive RMD-5200-S.

Closes PR # kern/2200: Change/Add new optical di...

Submitted by:	akiyama@kme.mei.co.jp (Shunsuke Akiyama)
1996-12-13 00:00:51 +00:00
Joerg Wunsch
7a9717ae8e Default the CD-ROM devices to a single LUN only. Too many of them are
broken and respond to multiple LUNs.

Reviewed by:	rv@groa.uct.ac.za (Russell Vincent)
1996-12-07 22:45:15 +00:00
Bruce Evans
4eb73cdaff Removed all references to b_cylinder (aka b_cylin). It was evil and
hasn't been used for a year or two since disksort() started sorting
on b_pblkno.
1996-12-01 16:34:41 +00:00
Søren Schmidt
7cb29d3394 This update adds the support for != 512 byte sector SCSI devices to
the sd & od drivers. There is also slight changes to fdisk & newfs
in order to comply with different sectorsizes.
Currently sectors of size 512, 1024 & 2048 are supported, the only
restriction beeing in fdisk, which hunts for the sectorsize of
the device.
This is based on patches to od.c and the other system files by
John Gumb & Barry Scott, minor changes and the sd.c patches by
me.
There also exist some patches for the msdos filesys code, but I
havn't been able to test those (yet).

	John Gumb (john@talisker.demon.co.uk)
	Barry Scott (barry@scottb.demon.co.uk)
1996-12-01 11:25:38 +00:00
Joerg Wunsch
bf65a4116b Add the Quantum DLT drives. All of them grok SC_MORE_LUS, so the tape
library devices will properly come up with all LUNs detected.

Submitted by:	dawes@Physics.usyd.edu.au (David Dawes)
1996-11-30 07:39:37 +00:00
Poul-Henning Kamp
3faaf0b64a Rogue entry for DEC DLT2700
Reviewed by:	julian & phk
Submitted by:	Andre Albsmeier <Andre.Albsmeier@mchp.siemens.de>
1996-11-28 09:51:03 +00:00
Masafumi Max NAKANE
1473a85114 Back out my previous change.
It probably broke the support for the device.

Pointed-Out by:	joerg
1996-11-09 02:44:11 +00:00