Commit Graph

612 Commits

Author SHA1 Message Date
dyoung 310df30dc7 Remove superfluous activation hook. 2009-11-12 19:20:08 +00:00
bouyer 6d07b400dc Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
2009-10-19 18:41:07 +00:00
pooka fbd53556dc Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
2009-09-13 18:45:10 +00:00
jakllsch 5b75384146 Further corrections for siisata.
Reset ch_status and ch_error at the beginning of any operation.

The chip only writes the RDH FIS to the SRAM when the error bit is
set in a RDH FIS (per the datasheet).  Thus, satafis_sdb_parse() is
replaced with satafis_rhd_parse().  A valid FIS type field seems to
not be written to the SRAM, so don't bother checking it for the
correct magic.

Additionally, append 2009 to copyright year set, and remove
obsolete CVS Id lines from when this was in my repository.
2009-07-04 20:57:15 +00:00
jakllsch 5ea7c61bc2 Use abstracted FIS code for ahcisata(4). Have the FIS code pre-zero the FIS. 2009-06-17 03:55:04 +00:00
jakllsch e5e3060059 ahcisata(4) and siisata(4) use similar SATA FIS functions, share them. 2009-06-17 03:07:51 +00:00
jakllsch 5aaada1bec Add atap_max_lba member to ataparams for LBA48 Maximum Address. From OpenBSD.
While here, renumber some __reserved member names to be sequential.
Also, add a member for the World Wide Name.

Use atap_max_lba in wd.c instead of offsets into a __reserved member.
2009-06-08 15:09:35 +00:00
dyoung 85d8d1fcdd On second thought, let's call disk_predetach() disk_begindetach().
Verbs are good.
2009-05-20 03:26:21 +00:00
dyoung 36ee114227 Use disk_predetach(). 2009-05-19 23:43:44 +00:00
dyoung a94204e132 Delete wdactivate() and sdactivate(). They were no-ops, but as a
side-effect of registering them, config_detach(9) cleared DVF_ACTIVE
before it called wddetach() or sddetach().  Even though sd(4)'s
detachment may have subsequently failed with EBUSY, we could not
begin new disk I/O on sd(4) because the device had been deactivated.

By analogy to sdstrategy(), test device_is_active() in wdstrategy()
and if it is false set b_errno to EIO instead of initiating new
disk I/O.

XXX We should decline more politely to start new I/O, since
XXX !device_is_active() may mean simply that the device is suspended.
XXX I suppose that EIO is safe as long as system suspension is
XXX all-or-nothing.
2009-05-19 19:56:10 +00:00
dyoung 0ee9d37122 Do not detach a wd(4) instance if it is open, but return EBUSY,
instead.  If the detach is forced, do what wdclose() does on the
last close: flush the cache, clear the flag WDF_LOADED, and delete
our reference to the ATA bus device.
2009-05-15 23:49:28 +00:00
cegger 529e91fca1 struct device * -> device_t, no functional changes intended. 2009-05-12 14:16:35 +00:00
cegger 22f40c6af4 KNF 2009-05-12 14:07:01 +00:00
cegger 32c4940900 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 12:10:29 +00:00
cegger fcd92f8a6e use device_xname() 2009-05-11 17:14:31 +00:00
dyoung 29e95e3d5f Cosmetic: flag a potential problem in ata_channel_attach():
it initializes a callout that does not appear to be destroyed
anywhere. Every callout_init() should ordinarily be matched by a
callout_destroy().
2009-04-07 18:01:20 +00:00
dyoung 211e21b653 Stop dereferencing a dangling device_t pointer and crashing: skip the
drives flagged DRIVE_ATAPI in atabus_activate(,DVACT_DEACTIVATE) just as
we skip them in atabus_detach() and in atabus_childdetched().

Make atabus_detach() parallel attachment more closely by calling
config_detach() on the child chp->ata_drives[i] instead of on
chp->ch_drive[i].drv_softc.  Assert that ata_drives[i] and
ch_drive[i].drv_softc are equal, and set them both to NULL in
atabus_childdetached().
2009-04-03 21:31:08 +00:00
dyoung 0d1ba3e899 During shutdown, detach devices in an orderly fashion.
Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks.  For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown.  Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags.  Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag.  The default for kern.detachall is 0.  SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress.  In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs.  Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
2009-04-02 00:09:32 +00:00
apb 0cc72e51ac Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
2009-02-13 22:41:00 +00:00
tron c15efe169f Backout LBA 48 quick entries which were added to fix one aspect of
PR kern/40569 because of objections by Manual Bouyer.
2009-02-10 19:45:22 +00:00
tron 56c9d6aa78 Add two more entries to the quirk table for hard disks which need the
LBA 48 work around. The first entry will watch the Seagate ST3160815AS
(and similar models), the second one HP's OEM version of the same drive.

This avoids the RAID rebuild problems described in PR kern/40569.
2009-02-09 22:34:23 +00:00
drochner 37d6396041 -in the wdc@pcmcia driver, don't try to powerup/down while cold or
shutting down -- this is only supposed to happen from the pcmcia
 kernel thread while the system is running
-in wd_shutdown, call ata_addref first, so that the adapter is either
 active or we know that it isn't
This fixes a hang on shutdown-p reported by Dennis den Brok per
PR kern/40531. Verified by by Dennis and me.
(reported against 5.0-Beta, so this is a pullup candidate)
2009-02-06 13:43:11 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
christos 9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
christos 64193bedec more debugging in the dump path. 2008-12-13 19:38:20 +00:00
dyoung 20baa33fe2 In wddetach(), avoid a crash by destroying the callout sc_restart_ch. 2008-12-05 18:20:19 +00:00
cegger db189eeadc SATA GEN3 speed is 6.0Gb/s 2008-11-18 09:52:10 +00:00
bouyer 99f68f2ca2 cpu_intr_p() doesn't account for software interrupts (e.g. callouts) so
we can't use it here. Rssurect ATACH_TH_RUN, backing out
src/sys/dev/ata/ata.c 1.101
src/sys/dev/ata/ata_wdc.c 1.90
src/sys/dev/ata/atavar.h 1.77
src/sys/dev/ic/wdc.c 1.255
src/sys/dev/scsipi/atapi_wdc.c 1.108
Should fix kern/39927 and kern/39725.
2008-11-16 19:31:21 +00:00
ad 0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
wrstuden fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
bouyer 2887906e27 Kill ATACH_TH_RUN and use cpu_intr_p() instead. 2008-10-02 21:05:17 +00:00
bouyer 04f65cb049 Use a separate thread to probe/attach atabus's childrens. Fixes a deadlock
where the interrupt routine wants to wake up the atabus thread to perform a
reset, while the thread is blocked in wd's attach function.
2008-10-01 18:23:55 +00:00
christos afaf958ea2 PR/46593: Patrick Welche: Compute both the original and the ~VIA_T_BOOTABLE
hacked checksums and compare against both.
2008-09-19 16:49:27 +00:00
tron 6264f47cc6 Support multiple volumes connected to Intel MatrixRAID controllers.
Code contributed by Juan RP in PR kern/39552.
2008-09-16 11:45:30 +00:00
tron 75ba997609 Only report volume names if they are non empty.
Patch provided by Juan RP in PR kern/39514.
2008-09-15 11:53:52 +00:00
tron 25f901a460 Add support for status reports via bio(4) to ataraid(4).
The code was contributed by Juan RP in PR kern/39514.
2008-09-15 11:44:50 +00:00
tron 2b3ca19215 Add support for Intel MatrixRAID to ataraid(4). It is currently limited
to one volume.

The driver was provided by Juan RP in PR kern/39511.
2008-09-11 11:08:50 +00:00
tron 79a4d38697 Don't attach RAID volumes with incomplete config blocks which would lead
to panic later. Patch provided by Juan PR in private e-mail.
2008-09-10 16:59:32 +00:00
tron 362b2f2b14 Complete device_t/softc split for the ld(4) attachments. This should
prevent crashes while attaching a drive.

Patch supplied by Juan RP in PR kern/39468.
2008-09-09 12:45:39 +00:00
tron 72c5460c24 Add JMicron RAID support to ataraid(4).
Patch provided by Juan RP in PR kern/39395.
2008-09-05 12:37:13 +00:00
hannken 982705a478 Destroy cb_buf before pool_put().
Resolves PR #38636
2008-08-24 09:19:03 +00:00
tacha df79ac9f1c Add support for nVidia MediaShield ata raid found on HP ProLiant ML115.
Tested on HEAD and netbsd-4 branch with RAID0, RAID1, SPAN with MCP55 SATA controller.
2008-08-20 15:00:34 +00:00
reinoud f6a70673ba Mark a buffer `busy` in getnewbuf() when it came from the pool_cache since
its not on a free list.

Also change buf_init() to not automatically mark buffers `busy' since this
only makes sense for bufcache buffers.

Mark all buf_init'd buffers 'busy' on the places where they ought to be
flagged as such to not confuse the buffer cache.

Fixes PR 38923.
2008-06-17 14:53:10 +00:00
cegger 17dbee905c use device_lookup_private to get softc 2008-06-12 21:46:21 +00:00
drochner 1f0a423884 use new "defpseudodev" where appropriate, and remove dummy interface
attribute definitions which were only to trick config(8)
2008-06-10 12:49:16 +00:00
tsutsui 9499107496 Use device_lookup_private() rathter than device_private(device_lookup()). 2008-06-08 18:34:06 +00:00
yamt bb127cf870 ata_raid_config_block_rw: getiobuf(vp, NULL) -> getiobuf(vp, false) 2008-05-06 11:07:24 +00:00
xtraeme efa94e2017 device_t/softc split. 2008-05-04 13:59:41 +00:00
plunky fc53820785 disk_destroy() is needed when the disk structure is no longer required,
this fixes PR kern/38131
2008-05-02 21:11:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00