Commit Graph

1191 Commits

Author SHA1 Message Date
skrll
ebb445db43 Remove the boot-from-disk hppa hack now that a real fix has been found. 2006-10-30 16:15:56 +00:00
reinoud
8b52dc54b3 Implement another class of `unit not ready' sense handling that is not
fatal.. A `long write in progress' is a retry again later command that is
issued when a device returns immediately after a write request but needs
some time before it can handle read requests.
2006-10-28 01:24:29 +00:00
christos
e1ae6bce13 - don't allocate huge arrays on the stack
- no bogus ; after }; in block statements!
2006-10-27 21:58:59 +00:00
scw
4526a898c6 Validate the sector size returned by READ CAPACITY. If it looks bogus
print a warning and fallback to a suitable default.

Fixes a problem on hp700 reported by skrll@
2006-10-20 07:11:50 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
riz
cc84101104 Also print blksize with %u - this is what I get for eyeballing
a patch instead of applying it directly.  PR#33966.
2006-10-10 23:35:29 +00:00
riz
31568e4a8e Print an unsigned parameter with %lu, not %ld. From David A. Holland
in PR#33966.
2006-10-10 23:30:23 +00:00
scw
056c6fdd05 Some removable umass(4) devices don't respond to mode sense page 6, or
simply return zero for logical block size. In either case, use the sector
length reported by READ_CAPACITY instead of defaulting to 512 bytes.

This partially addresses the problems reported in PR port-i386/34707 and
PR kern/34737. Namely the incorrectly reported drive geometry and the
'hanging' issue.

However, since the device in question reports 2048-byte physical sectors
it will remain unusable until DEV_BSIZE is banished.
2006-10-09 21:29:14 +00:00
mlelstv
e19fb1ec00 Use last track info only if it gives a sane value. Fixes PR#34688. 2006-10-08 07:50:16 +00:00
reinoud
c3af0f9a94 In gcc4 structures are differently aligned compared to gcc3. Lots of
structures can thus be misaligned for DMA when declared on stack.

The current atapi code accepts the misaligned dma's only screw's them up.
This small patch disables DMA for the rare transactions that are
misaligned. Note that all bulk-transfers are aligned due to page sizes.

See PR kern/34689
2006-10-01 20:10:31 +00:00
itohy
f87d591722 A little effort against kernel bloat....
Exclude ATA DMA support if no ATA DMA capable drivers are compiled in.
2006-09-30 15:56:17 +00:00
reinoud
d1de30eaae Fix same panic problem as with cd.c when a scsi error happends on
read/write action. It would panic on a diagnosic assertion. When a scsi
read/write command fails, the whole extent is gone bad so mark all as not
done.
2006-09-14 17:54:34 +00:00
reinoud
2b551264c1 Aparently i've misread, backing out change. 2006-09-11 19:43:55 +00:00
reinoud
5411355304 Don't add one to the capacity returned of READ CAPACITY! it results in
reporting a sd* disc that is one sector too big (!) Normally not much a
problem in FFS since its clustered but other filingsystems *do* care.
2006-09-11 17:57:07 +00:00
reinoud
25522cfb86 Oeps! I overlooked the size argument of the SCSI call. It ought to be equal
to the number of bytes we are reading: READ_DISCINFO_BIGSIZE

sorry.
2006-09-08 00:33:18 +00:00
reinoud
a5b62cb444 The size of struct scsipi_read_discinfo_data is not even due to the data[1]
pseudo array in the structure. The scsi command issued used
sizeof(scsipi_read_discinfo_data) but included thus the last byte that
wasn't going to be inspected anyway. Using the constant
READ_DISCINFO_BIGSIZE fixes the bug.

Even though SCSI adapters *should* accept odd lengths, the Sun U10
(sparc64's) crashes in bus_space_read_multi_stream_2(). That explains the
crash.

NOTE: somewhere in NetBSD/sparc64's atapibus support there is the
assumption on the even size; this needs to be fixed! (Hi Sparc64 portmaster
:-) )
2006-09-07 22:52:46 +00:00
itohy
0a30900857 Add PIOBM (busmastering transfer using ATA PIO mode) support.
The PIOBM is used by only one driver (will be added later,
stay tuned) and intruduce an attribute "ata_piobm" so that
it will be conditionally compiled in.
The "ata_dma" (busmastering transfer using ATA DMA mode) and
"ata_udma" (busmastering transfer using ATA Ultra DMA mode)
attributes are also added for consistency, but unused for now.
2006-09-07 12:34:41 +00:00
dogcow
f2d329dca0 remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP. 2006-09-07 02:40:31 +00:00
christos
b231088be0 add missing initializer 2006-09-03 21:16:09 +00:00
christos
01edefa570 comment out unreachable code 2006-09-03 06:23:27 +00:00
christos
996634386c comment out unreachable code. 2006-09-03 06:22:05 +00:00
christos
4905e82e29 add missing initializer 2006-09-03 05:30:48 +00:00
christos
4ac9cd5ebe add missing initializer 2006-09-03 05:20:21 +00:00
christos
144543fb61 add missing initializer 2006-09-03 05:18:03 +00:00
matt
49b2425f19 Use an unsigned int for the blksize on read_cd_capacity. 2006-09-01 03:29:32 +00:00
reinoud
0b228f5987 Fix panic on reading/writing to a (raw) CD device and encountering an
error. It now correctly sets bp->b_resid to the full size of the buffer.
The failed SCSI read/write command allways contains the complete buffer.

When encountering a read (or write) error, the scsipi stack sets the
xs->resid to zero since the command has been accepted by the drive. The
scsi command set does not allow a partial read or write to be performed and
will signal a success or an error.
2006-08-31 21:32:42 +00:00
reinoud
e3b1c755c2 Remove two spurious empty lines in functions 2006-08-31 20:22:34 +00:00
reinoud
055cdf5d13 Fix fencing bug on CD disk size; the comment was wrong, its the *length* of
the device and since we count from zero its equal to the number of sectors
and thus one higher than the last sector.

This fixes the read/write problems on the (raw) device where the last
sector was not readable/writable.
2006-08-31 19:46:54 +00:00
bjh21
8009229e9b The Fujitsu drive in my A540 supports sync transfers but apparently
doesn't advertise this in INQUIRY.  It makes it nice and obvious with
SDTR, though, so add it to the list.
2006-08-29 20:40:23 +00:00
christos
4e4ed26fac add missing initializer 2006-08-28 00:38:47 +00:00
christos
6ab0a579ce Add missing initializer. 2006-08-28 00:22:15 +00:00
bjh21
286856d098 QAS REQUEST is a one-byte message. Make MSG_IS1BYTE recognise this. 2006-08-26 23:32:55 +00:00
christos
f73c6e5980 Change iostat_alloc() to take the parent pointer and the name directly, so
that callers are not responsible for initializing the fields. Store the name
inside the struct instead of maintaining a pointer to external storage, or
leaked memory (nfs case).
2006-08-23 17:19:32 +00:00
reinoud
12283b1fe9 Fix incorrect `loast possible lba' reporting, remove some empty lines and
add mmc classification for some still rare HD DVD device types.
2006-08-10 14:45:51 +00:00
drochner
bf84051422 some fixes for removable media (USB floppies in particular):
-allow to open RAW_PART, even if readdisklabel() doesn't like what it sees
-fix PERIPH_MEDIA_LOADED toggling on every other open attempt
-Don't reset PERIPH_REMOVABLE if prevent/allow fails - this is normal
 for floppy drives. The flag is required for media change detection.
 Honour XS_CTL_SILENT for the "no door lock" printouts, and set that flag
 where scsipi_prevent() is called during open/close.
Tested with a USB floppy and a USB cardreader.
2006-07-09 17:12:21 +00:00
tron
9021894476 Make this build with GCC 4.x. 2006-06-27 10:34:25 +00:00
kardel
de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
nathanw
9822b848e6 Change return type of sdgetdisklabel() from void to int; return an error
if readdisklabel() returned an error.

sdopen(): Return an error if sdgetdisklabel() returns an error. This prevents
a crash in spec_open() (and possibly elsewhere) if a sd device is detached in
the middle of sdopen().
2006-06-01 15:53:09 +00:00
christos
fe6055587f void casts to functions whose return values are ignored. 2006-05-21 23:56:09 +00:00
blymn
10df330c85 Prefix iostat structure elements with io_ 2006-04-20 12:13:51 +00:00
nathanw
611b39a8f6 In scsipi_done(), bail out early if the scsipi_xfer has already been
marked as done. Works around one problem with detaching in-use sd
devices, as described on tech-kern:

http://mail-index.netbsd.org/tech-kern/2005/09/22/0002.html
2006-04-17 14:30:40 +00:00
christos
c6bb3943dd Coverity CID 1100: Avoid NULL pointer dereferences. 2006-04-14 17:36:51 +00:00
christos
30baf54001 Coverity CID 1101: Protect against address argument being NULL. 2006-04-14 17:33:10 +00:00
blymn
3c0adb7d99 Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
2006-04-14 13:09:05 +00:00
thorpej
07c30f824f Use device_private(). 2006-03-30 16:09:28 +00:00
thorpej
78ffd948be Replace device_locators() with device_locator(), and use it. 2006-03-29 06:00:46 +00:00
thorpej
39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
thorpej
dbf31290b3 Use device_parent(). 2006-03-25 23:25:24 +00:00
yamt
ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
thorpej
3ddf26777f Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
2006-02-20 16:50:36 +00:00