Commit Graph

1236 Commits

Author SHA1 Message Date
pooka
4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
jmcneill
b276edd821 aprintify 2007-12-01 14:46:04 +00:00
reinoud
9c2e200bb1 Pullup fixes from UDF write development project. This patch fixes a
conceptional bug in mmc_discinfo, improves DVD+R feature detection and
prevents corruption of mmc_trackinfo readout on some devices that return
short trackinfo structures.
2007-11-27 18:06:37 +00:00
ad
a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
christos
b96c4fd9a6 PR/37108: Pauly Goyette: Compute the timeout value, before immediate is
changed for atapi tape drives.
2007-10-11 16:42:52 +00:00
ad
2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
bouyer
975e5c30a0 Move check for b_resid value to the right place. Should definitively fix
kern/36690.
2007-10-06 12:52:43 +00:00
bouyer
511e912cd0 When checking for invalid b_resid valyes, also check negative ones.
Should fix kern/36690.
2007-10-01 18:43:30 +00:00
bouyer
8d743383a3 Properly initialize xs_callout in sddump(). We're using a static scsipi_xfer
here which didn't get through scsipi_get_xs().
Pointed out by Greg Oster.
2007-10-01 18:16:05 +00:00
bouyer
adc1896a31 Properly set b_resid in an error case.
Clamp b_resid to b_bcount in case the info field is larger. Fix a KASSERT
in physio() when a media error occurs on my SDLT320 drive (maybe this drive
is bogus for not setting the highter bits to 0 in the INFO field in this
case).
2007-09-29 11:04:51 +00:00
dyoung
2cb874eb67 Remark that the data-length argument passed to se_scsipi_cmd() is
questionable.
2007-09-01 17:59:45 +00:00
dyoung
0c66a9f0cf Create a temporary, non-const copy of a sockaddr. Pass that to
se_set_multi() or se_remove_multi(), because neither is easily
constified.  Thanks jmmv@ for reporting the issue.
2007-09-01 17:57:02 +00:00
dyoung
dcd8923429 Change a bazillion occurrences of code resembling this,
error = (cmd == SIOCADDMULTI) ?
	    ether_addmulti(ifr, &sc->sc_ec) :
	    ether_delmulti(ifr, &sc->sc_ec);

	if (error == ENETRESET) {

to this,

	if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number.  This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
2007-09-01 07:32:22 +00:00
rumble
fbb550b94d Be sure not to make requests over MAXPHYS when employing bounce buffers.
It was previously possible to round up one sector length if the start block
were not properly aligned.

Resolves PR kern/36716. This may also fix the following reported issues
on port-sgimips:
    http://mail-index.netbsd.org/port-sgimips/2005/09/12/0000.html
    http://mail-index.netbsd.org/port-sgimips/2005/09/14/0000.html

While here, be sure to put back allocated bufs, which previously appear
to have been leaked. Further, remove the dead write bounce code which never
got executed anyway.

No complaints on tech-kern.
2007-08-04 02:58:59 +00:00
tsutsui
92b50ccb27 Don't allocate data buffer on stack in sd_read_capacity().
If data buffer is allocated on stack at the end of CPU cacheline,
the same cacheline region might be accessed via kernel stack even
after bus_dmamap_sync(9) against the data buffer in lower scsi drivers
so that read data via DMA could be lost.

Fixes occasional readdisklabel(9) failure at boot on ews4800mips
with osiop(4) driver and 128byte cacheline.

XXX: Other functions/drivers might have the similar problem.
2007-08-03 13:56:37 +00:00
ad
eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
ad
b5a9ff06f1 Replace some uses of lockmgr(). 2007-07-21 19:51:47 +00:00
ad
88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
tsutsui
be8757ef61 Add __attribute__((__packed__)) to all command structures. 2007-07-01 05:17:28 +00:00
dsl
716dbe1abc The cd ioctl definitions are not condusive to being called from within
the kernel (eg from withthe linux compat code).
Add CDIOCREADSUBCHANNEL_BUF and CDIOREADTOCENTRIES_BUF which are like the
  existing ioctls withoutthe _BUF, except that the data area immediately
  follows the control structure (and is fixed length).
Modify scsipi/cd.c so that it only ever has one 'struct cd_formatted_toc'
  allocated on the stack (maybe this info ought to be in the softc)
  structure since even one 800 byte on-stack buffer isn't overly friendly.
cdplay(1) still seems able to read the track-list of an ATAPI cd.
2007-06-30 22:16:38 +00:00
dsl
d60a214b3b Remove a load of unnecessary casts now that 'addr' is 'void *'. 2007-06-30 16:00:55 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
yamt
5b23251544 fix fallout from caddr_t changes. 2007-03-04 15:17:20 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
jnemeth
7cab5bde24 add support devctl properties 2007-03-03 02:44:44 +00:00
thorpej
ebd626809e TRUE -> true, FALSE -> false 2007-03-01 17:31:35 +00:00
thorpej
712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
bouyer
786853f62a The SEAGATE ST318203LSUN18G announces DT only capabilitie although it also
supports ST. Because of this the HBA doesn't initiate sync/wide negotiation,
so add PQUIRK_CAP_SYNC | PQUIRK_CAP_WIDE16 for this drive; fix
problem reported by Havard Eidnes.
2007-02-17 17:01:29 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
reinoud
e54557c432 Fix for atapi devices that have 32 bit databusses selected. The devices
won't error out but will return garbage data. Implemented by generalising
the odd-check for PIO selection to check for 4 byte alignment in offset and
size.

Note that this check could be relaxed by checking if the ATAPI/ide bus
width is 16 for the device but its unknown to me if that information is
available here.
2007-01-23 20:10:06 +00:00
martin
73ebab4e1a The previous fix for PR 34202 was wrong (some sizeof used the union, not
the command block) - but instead of fixing this, we can now revert it
completley: the real fix has been applied to ../ic/wdc.c in rev. 1.244,
removing the alignement constraints.
2007-01-14 09:29:24 +00:00
cube
4cdd8aada6 Complete initializers so those files compile. 2007-01-13 18:42:45 +00:00
martin
9be3ef677b On Christos' request, reinstantiate the packed->__packed__ part of the
backed out change.
2006-12-01 21:36:56 +00:00
martin
035130a4dd Fix PR kern/34202 differently, by aligning the variables "the traditional
way".
2006-12-01 21:23:57 +00:00
martin
d5c3b27938 Back out align(4) for all struct decls - it breaks various things all
over the tree (for example esiop on sparc64 won't boot any more).
2006-12-01 21:11:26 +00:00
christos
409998ac55 Prevent kernel crashes caused by umass devices that return bogus mode sense
data, such as the "Cooler Master". From Rhialto. While there, clean up some
debugging code and make the offset unsigned.
2006-11-30 17:59:35 +00:00
christos
d048649c18 Add a quirk for Initio drives (from Rhialto) 2006-11-30 17:39:25 +00:00
christos
d5272d5b35 PR/34202: Dave Huang: Accessing cd device on alpha causes kernel trap
From the PR:
  Since struct scsipi_read_discinfo_data is an odd number of bytes long
  (35 bytes), ti ends up being unaligned. wdc_datain_pio() uses
  bus_space_read_multi_4() to read the response from the drive, and
  since ti is unaligned, it causes an unaligned access fault.

Add __aligned__(4) to all the structures.
2006-11-30 16:23:20 +00:00
drochner
c054c36959 restore a nice little feature which got lost in some previous commit:
the d_typename field of the default disklabel is initialized with
text from the SCSI inquiry, so that one gets at least a vague idea which
disk he is dealing with
2006-11-29 21:06:49 +00:00
itohy
e73f75f98e If the block size reported by Read Capacity looks valid, just use it.
Use Request Sense only if Read Capacity succeeded and did not return
valid block size.
Discussed on tech-kern.
Fix the easier part of NetBSD PR kern/26537.
(The harder part is the device hangs on large (>= 8KB) transfer.
Possibly umass BBB problem?)

Remove scsipi_size() and scsipi_validate_secsize() from scsipi_base.c
and add their functions to sd.c since they are used only by sd.c.

Use SCSI term `block' instead of `sector' where applicable.
2006-11-26 05:01:09 +00:00
scw
79017e8016 - Call disk_blocksize(9) once we know the disk's physical block size.
- bounds_check_with_label() has been fixed, so no need to fake the
  raw partition's size in terms of DEV_BSIZE units.
2006-11-25 12:06:31 +00:00
scw
e34c588b57 - Call disk_blocksize(9) when we determine the physical block size of the
media. (Will this ever be anything other than 2048?)
- bounds_check_with_label() has been fixed, so put the correct partition
  size in the default disklabel.
2006-11-25 12:03:38 +00:00
he
e004bf7e3b This file needs to know the size of "struct device", so include
<sys/device.h> here.  This should allow the sparc GENERIC_SUN4U and
sparc64 kernels to build sata_subr.c again.
2006-11-23 08:44:42 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
reinoud
c4b555df90 Implement/add bufq strategy setting by dkctl for the CD class devices.
Though its hardly advisable to change the CD strategy setting to anything
other than `disksort' or `prioscan' it ought to be possible.
2006-11-14 14:56:55 +00:00
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