Commit Graph

9262 Commits

Author SHA1 Message Date
Paul Saab
20430a6b04 Something I missed in my tree.
If the media changes, poke the DSP on the 5401/5411 Broadcom PHY's.

Obtained from:	NetBSD
2003-05-04 02:03:20 +00:00
Justin T. Gibbs
d7cff4ab97 Correct spelling errors.
Switch to handling bad SCSI status as a sequencer interrupt
instead of having the kernel proccess these failures via
the completion queue.  This is done because:

 o The old scheme required us to pause the sequencer and clear
   critical sections for each SCB.  It seems that these pause
   actions, if coincident with a sequencer FIFO interrupt, would
   result in a FIFO interrupt getting lost or directing to the
   wrong FIFO.  This caused hangs when the driver was stressed
   under high "queue full" loads.
 o The completion code assumed that it was always called with
   the sequencer running.  This may not be the case in timeout
   processing where completions occur manually via
   ahd_pause_and_flushwork().
 o With this scheme, the extra expense of clearing critical
   sections is avoided since the sequencer will only self pause
   once all pending selections have cleared and it is not in
   a critical section.

  aic79xx.c
	Add code to handle the new BAD_SCB_STATUS sequencer
	interrupt code.  This just redirects the SCB through
	the already existing ahd_complete_scb() code path.
	Remove code in ahd_handle_scsi_status() that paused
	the sequencer, made sure that no selections where
	pending, and cleared critical sections.  Bad
	status SCBs are now only processed when all of these
	conditions are true.

  aic79xx.reg:
	Add the BAD_SCB_STATUS sequencer interrupt code.

  aic79xx.seq:
	When completing an SCB upload to the host, if
	we are doing this because the SCB contains non-zero
	SCSI status, defer completing the SCB until there
	are no pending selection events.  When completing
	these SCBs, use the new BAD_SCB_STATUS sequencer
	interrupt.  For all other uploaded SCBs (currently
	only for underruns), the SCB is completed via the
	normal done queue.  Additionally, keep the SCB that
	is currently being uploaded on the COMPLETE_DMA_SCB
	list until the dma is completed, not just until the
	DMA is started.  This ensures that the DMA is restarted
	properly should the host disable the DMA transfer for
	some reason.

	In our RevA workaround for Maxtor drives, guard against
	the host pausing us while trying to pause I/O until the
	first data-valid REQ by clearing the current snapshot
	so that we can tell if the transfer has completed prior
	to us noticing the REQINIT status.

	In cfg4data_intr, shave off an instruction before getting
	the data path running by adding an entrypoint to the
	overrun handler to also increment the FIFO use count.

	In the overrun handler, be sure to clear our LONGJMP
	address in both exit paths.

Perform a few sequencer optimizations.

  aic79xx.c:
	Print the full path from the SCB when a packetized
	status overrun occurs.

	Remove references to LONGJMP_SCB which is being
	removed from firmware usage.

	Print the new SCB_FIFO_USE_COUNT field in the
	per-SCB section of ahd_dump_card_state().  The
	SCB_TAG field is now re-used by the sequencer,
	so it no longer makes sense to reference this
	field in the kernel driver.

  aic79xx.h:
	Re-arrange fields in the hardware SCB from largest
	size type to smallest.  This makes it easier to
	move fields without changing field alignment.

	The hardware scb tag field is now down near the
	"spare" portion of the SCB to facilitate reuse
	by the sequencer.

  aic79xx.reg:
	Remove LONGJMP_ADDR.

	Rearrange SCB fields to match aic79xx.h.
	Add SCB_FIFO_USE_COUNT as the first byte
	of the SCB_TAG field.

  aic79xx.seq:
	Add a per-SCB "Fifos in use count" field and use
	it to determine when it is safe (all data posted)
	to deliver status back to the host.  The old method
	involved polling one or both FIFOs to verify that
	the current task did not have pending data.  This
	makes running down the GSFIFO very cheap, so we
	will empty the GSFIFO in one idle loop pass in
	all cases.

	Use this simplification of the completion process
	to prune down the data FIFO teardown sequencer for
	packetized transfers.  Much more code is now shared
	between the data residual and transfer complete cases.

	Correct some issues in the packetized status handler.
	It used to be possible to CLRCHN our FIFO before status
	had fully transferred to the host.  We also failed to
	handle NONPACKREQ phases that could occur should a CRC
	error occur during transmission of the status data packet.

Correct a few big endian issues:

  aic79xx.c:
  aic79xx_inline.h:
  aic79xx_pci.c:
  aic79xx_osm.c:
	o Always get the SCB's tag via the SCB_GET_TAG acccessor
	o Add missing use of byte swapping macros when touching
	  hscb fields.
	o Don't double swap SEEPROM data when it is printed.
	  Correct a big-endian bug.  We cannot assign a
	o When assigning a 32bit LE variable to a 64bit LE
	  variable, we must be explict about how the words
	  of the 64bit LE variable are initialized.  Cast to
	  (uint32_t*) to do this.

aic79xx.c:
	In ahd_clear_critical_section(), hit CRLSCSIINT
	after restoring the interrupt masks to avoid what
	appears to be a glitch on SCSIINT.  Any real SCSIINT
	status will be persistent and will immidiately
	reset SCSIINT.  This clear should only get rid of
	spurious SCSIINTs.

	This glitch was the cause of the "Unexpected PKT busfree"
	status that occurred under high queue full loads

	Call ahd_fini_scbdata() after shutdown so that
	any ahd_chip_init() routine that might access
	SCB data will not access free'd memory.

	Reset the bus on an IOERR since the chip doesn't
	seem to reset to the new voltage level without
	this.

	Change offset calculation for scatter gather maps
	so that the calculation is correct if an integral
	multiple of sg lists does not fit in the allocation
	size.

	Adjust bus dma tag for data buffers based on 39BIT
	addressing flag in our softc.

	Use the QFREEZE count to simplify ahd_pause_and_flushworkd().
	We can thus rely on the sequencer eventually clearing ENSELO.

	In ahd_abort_scbs(), fix a bug that could potentially
	corrupt sequencer state.  The saved SCB was being
	restored in the SCSI mode instead of the saved mode.
	It turns out that the SCB did not need to be saved at all
	as the scbptr is already restored by all subroutines
	called during this function that modify that register.

aic79xx.c:
aic79xx.h:
aic79xx_pci.c:
	Add support for parsing the seeprom vital product
	data.  The VPD data are currently unused.

aic79xx.h:
aic79xx.seq:
aic79xx_pci.c:
	Add a firmware workaround to make the LED blink
	brighter during packetized operations on the H2A.

aic79xx_inline.h:
	The host does not use timer interrupts, so don't
	gate our decision on whether or not to unpause
	the sequencer on whether or not a timer interrupt
	is pending.
2003-05-04 00:20:07 +00:00
Paul Saab
3927098f93 Implement the write twice to send producer index workaround for
BCM5700 chips as described in the Broadcom Errata documents.

Obtained from:	NetBSD and Broadcom Errata documentation
2003-05-04 00:07:21 +00:00
Justin T. Gibbs
9bf327a70c aic7xxx.c:
aic7xxx.h:
	Split out core chip initialization into ahc_chip_init().
	This will allow us to reset the chip correctly at times
	other than initial chip setup.

aic7770.c
aic7xxx_pci.c:
	Flesh out bus chip init methods for our two
	bus attachments and use these, in addition to
	bus suspend/resume hooks to get the core in
	better shape for handling these events.

	When disabling PCI parity error checking, use FAILDIS.
	Although the chip docs indicate that clearing PERRESPEN
	should also work, it does not.

	Auto-disable pci parity error checking after informing
	the user of AHC_PCI_TARGET_PERR_THRESH number of parity
	errors observed as a target.

aic7xxx.h:
aic7xxx_pci.c
aic7770.c
aic7xxx.c
	Add the instruction_ram_size softc field.

	Remove the now unused stack_size softc field.

	Modify ahc_loadseq to return a failure code
	and to actually check the downloaded instruction
	count against the limit set in our softc.

	Modify callers of ahc_loadseq to handle load
	failures as appropriate.

	Set instruction RAM sizes for each chip type.

aic7xxx_pci.c:
	Add some delay in the aic785X termination
	control code.  This may fix problems with
	the 2930.

	Be consistent in how we access config space
	registers.  16bit registers are accessed using
	16bit ops.

aic7xxx.c:
	Correct spelling errors.

	Have ahc_force_renegotiation() take a devinfo as is done
	in the U320 driver.  Use this argument to correct a bug
	in the selection timeout handler where we forced a renegotiation
	with the last device that had set SAVED_SCSIID.  SAVED_SCSIID
	is only updated once a selection is *sucessfull* and so is
	stale for any selection timeout.

	Cleanup the setup of the devinfo for busfree events.  We
	now use this devinfo for a call to ahc_force_renegotiation()
	at the bottom of the routine, so it must be initialized in
	all cases.

	In ahc_pause_and_flushwork(), adjust the loop so that it
	will exit in the hot-eject case even if the INT_PEND mask
	is something other than 0xFF (as it is in this driver).

	Correct a wrapping string constant.

	Call ahc_fini_scbdata() after shutdown so that
	any ahc_chip_init() routine that might access
	SCB data will not access free'd memory.

	Correctly setup our buffer tag to indicate that 39bit
	addressing is available if in 39bit addressing mode.

	Rearrange some variable declarations based on
	type size.

aic7xxx.c
aic7xxx.h:
aic7xxx.reg:
	Consistently use MAX_OFFSET for the user max syncrate
	set from non-volatile storage.  This ensures that the
	offset does not conflict with AHC_OFFSET_UNKNOWN.

	Change AHC_OFFSET_UNKNOWN to 0xFF.  This is
	a value that the curr->offset can never be,
	unlike '0' which we previously used.  This
	fixes code that only checks for a non-zero
	offset to determine if a sync negotiation
	is required since it will fire in the unknown
	case even if the goal is async.

	Change MAX_OFFSET to 0x7f which is the max
	offset U160 aic7xxx controllers can negotiate.
	This ensures that curr->offset will not
	match AHC_OFFSET_UNKNOWN.

aic7xxx_inline.h:
	Have our inline interrupt handler return with a value
	indicating whether we serviced a real interrupt.  This
	is required for Linux support.

	Return earlier if the interrupt is not for us.
2003-05-03 23:55:38 +00:00
Justin T. Gibbs
8270490a58 hc_eisa.c:
ahc_pci.c:
ahd_pci.c:
        Don't bogusly use the BUS_DMA_ALLOCNOW flag in our psuedo
        parent bus dma tag.
2003-05-03 23:27:57 +00:00
Paul Saab
5cba12d3bc - Change the short hand representation of the various ASIC revisions
- Implement the ONEDMA_AT_ONCE workaround as described in the
  5703/5704 eratta documents.
  Obtained from: NetBSD & Broadcom documentation
2003-05-03 22:58:45 +00:00
Paul Saab
37ceeb4d9f - Move bge_phy_hack into the phy code and implement the various DSP
patch workarounds for each phy revision.
  Obtained from: NetBSD & Broadcom Linux driver

- Disable AUTOPOLL when accessing the PHY as it may cause PCI errors.
  Obtained from: NetBSD

- Check the UPDATED bit in the status block so the driver knows
  that the status block as indeed changed since the last access.
  Broadcom documentation states drivers should unset the UPDATED/CHANGED
  bits after reading them.

- When changing media types, first loop the phy then set the media.
  Broadcom documentation and Linux drivers do this and I observed
  much better handling of link after this change.

- Broadcom documentation states that for 1000BaseT operation,
  autonegotiation must be enabled.  Fix hard coding of media so that
  the driver only advertises 1000BaseT as the supported media type
  and enable autonegotition.

- Only set Master/Slave on the 5701.
  Obtained from Broadcom Linux driver.
2003-05-03 19:06:50 +00:00
Søren Schmidt
7af89aab59 Fix locking on reinit. 2003-05-03 18:28:43 +00:00
Søren Schmidt
a23507bcff Add the pdc20268r as candidate for the TX test. 2003-05-03 18:26:00 +00:00
Shunsuke Akiyama
3dfc942fa1 Regen. 2003-05-03 10:19:43 +00:00
Shunsuke Akiyama
11e04b0528 Add RealTek RTL8150 USB to fast Ethernet controller driver.
This driver now supports the Melco LUA-KTX and the GREEN HOUSE
GH-USB100B.

Reviewed by:	imp
MFC after:	2 weeks
2003-05-03 10:16:56 +00:00
Prafulla Deuskar
bc93b4de0e - Fix breakage on PAE enabled kernel
- Don't use vtophys when you can get physical address using bus_dma API

Submitted by:	jake (Jake Burkholder)
2003-05-03 07:35:47 +00:00
Yoshihiro Takahashi
7571a866b9 Force PnP devices to set SMIT mode.
Submitted by:	chi@bd.mbn.or.jp (Chiharu Shibata)
2003-05-03 02:04:58 +00:00
Yoshihiro Takahashi
0e7902c6cd Fix off-by-one bug.
Submitted by:	chi@bd.mbn.or.jp (Chiharu Shibata)
2003-05-03 01:47:38 +00:00
Prafulla Deuskar
a9cbe07958 - Bus DMA'fy the driver
- Use htole* macros where appropriate so that the driver could work on non-x86 architectures
- Use m_getcl() instead of MGETHDR/MCLGET macros
Submitted by:	sam (Sam Leffler)
2003-05-02 21:17:08 +00:00
Paul Saab
6ac6d2c895 Add untested support for the Broadcom 5704.
Obtained from:	NetBSD
2003-05-02 19:53:40 +00:00
Jake Burkholder
eadb8f358b Fix printf format errors. 2003-05-02 17:21:07 +00:00
Søren Schmidt
93f307bbea Add flushing of devices on shutdown.
Note: this might print failure messages on some systems, unfortunatly
the info from the device, stating if flushing is supported, cannot be trusted
so the operation is always issued on all devices, just in case...
2003-05-02 13:47:44 +00:00
Søren Schmidt
31de970e72 Add ioctl to add a spare disk to a RAID array.
Fix the discovery of RAID's to not grap unused disks.
Change the probe printing of a RAID a bit.
2003-05-02 12:41:44 +00:00
Søren Schmidt
5909dab38c Dont try to call detached interrupt routine. 2003-05-02 12:37:03 +00:00
Poul-Henning Kamp
6b60a2cd57 Call g_wither_geom(), instead of just setting the flag. 2003-05-02 06:18:58 +00:00
Greg Lehey
5fb5b1b5ca check_drive: If we find an existing drive which is "up" or "down",
just return it.  Don't try to reinitialize it.  This should fix a
number of inconsistencies that some people encountered with "vinum
start".

PR:  30588
PR:  43475
2003-05-02 06:04:19 +00:00
Greg Lehey
b69195b182 White space changes. 2003-05-02 01:39:11 +00:00
Marcel Moolenaar
ae3c9aff52 Unbreak alpha and ia64 builds. The previous change made the inclusion
of <machine/pc/bios.h> specific to i386 and added a conditional define
for BIOS_PADDRTOVADDR that depends on ISA_HOLE_START. The latter is
undefined on alpha and ia64. Since the former is defined the same on
both alpha and ia64, assume the ISA_HOLE_START dependent definition
is specific to amd64 and use the identity-mapping in all other cases.

This of course is getting uglier every day...
2003-05-02 01:36:27 +00:00
John Baldwin
659be635a4 Fix a printf warning from the recent CAM changes. 2003-05-01 19:46:21 +00:00
John Baldwin
9501b60383 Catch up to reworked debugging levels in latest Intel import. 2003-05-01 18:51:43 +00:00
Orion Hodson
4f3204ef22 Fix lock order reversal when opening device and chn_reset fails.
Submitted by: Jan-Espen Pettersen <sigsegv@leakingmemory.org>
Tested by: Georg Funk <georgfunk@web.de>
2003-05-01 16:31:21 +00:00
Greg Lehey
9db2b74e40 Note when we issue a request to the disk driver, so that we can
measure the time it spends.
2003-05-01 13:06:00 +00:00
Martin Blapp
acc1bccccd Use only a 64bit hash filter table for ADM-Centaur cards like the
Accton EN2242 and the ADMtek AN985 cards.

PR:		32699
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
Reviewed by:	phk
MFC after:	2 weeks
2003-05-01 09:31:01 +00:00
Søren Schmidt
84351184a9 I'm pleased to announce that Promise is now supporting the FreeBSD
project by providing documentation (under NDA) and hardware for
testing. This commit is the first result of the cooperation, and
adds support for several of their new controllers that we didn't
support before (and probably newer would have without this arrangement).

Add support for the Promise SATA150 TX2/TX4 and the Promise TX4000
controllers. This also adds support for various motherboard fitted
Promise SATA/ATA chips.
Note that this code uses memory mapped registers to minimize overhead.
I belive FreeBSD has made another first in the Open Source world
by being able to release support for this :)
2003-05-01 06:20:50 +00:00
Søren Schmidt
3a6fb16ff1 Relax the test for when to use LBA instead of CHS size. 2003-05-01 06:17:30 +00:00
Peter Wemm
8c3765708a Add AMD64 support to dev/fb. It isn't optimized. 2003-05-01 04:21:05 +00:00
Peter Wemm
25b0a17506 Update the hardcoded bus tags for early console support for amd64. 2003-05-01 04:19:19 +00:00
Hidetoshi Shimokawa
e47276e59c Fix printf warning caused by recent CAM change. 2003-05-01 03:38:04 +00:00
Greg Lehey
03c03f6cf4 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).
2003-05-01 01:35:03 +00:00
Greg Lehey
bf7cea1cc0 For consistency's sake, on command failure, throw 1, not -1.
Rewrite minor number decoding.  Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).
2003-05-01 01:34:38 +00:00
Greg Lehey
0910419967 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

Correct formats for some error messages.  Don't cast the value to
match the format.
2003-05-01 01:34:05 +00:00
Greg Lehey
9ebe817222 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

Tidy up comments.

Check for null rqgs.  This continue to be reported, though I can't
work out why.

Correct formats for some error messages.  Don't cast the value to
match the format.

Use microtime, not getmicrotime, for timing debug entries.
2003-05-01 01:33:34 +00:00
Greg Lehey
f77547fbbb Terminate a comment. 2003-05-01 01:33:01 +00:00
Greg Lehey
9351e5dbcc Don't make definition of kw_debug dependent on VINUMDEBUG. In
userland, define the keyword even if the kernel module doesn't have
debug code.
2003-05-01 01:32:31 +00:00
Greg Lehey
25d8d1f1a9 Use strrchr, not rindex. This is for compatibility with other
systems, and requires a #define.
2003-05-01 01:32:08 +00:00
Greg Lehey
130101dd9d #ifdef VINUMDEBUG, not #if VINUMDEBUG. 2003-05-01 01:31:48 +00:00
Greg Lehey
de7d0dd0eb Don't make definition of kw_debug dependent on VINUMDEBUG. It's only
an enum value, and dropping it can lead to some spectacular surprises
in userland.
2003-05-01 01:31:20 +00:00
Greg Lehey
01fbffad0e Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

As a result of the minor number changes, split out the superdevice
handling into a separate function, vinum_super_ioctl.  This was most
of the code of vinumioctl.

attachobject: Improve error checking.
2003-05-01 01:30:59 +00:00
Greg Lehey
9488925d66 Use microtime, not getmicrotime, for timing debug entries.
init_drive: Rephrase error message text.
	    Remove dead code (inside #if 0).

Change name of find_drive_by_dev to the more descriptive
find_drive_by_name.

Tidy up comments.
2003-05-01 01:30:31 +00:00
Greg Lehey
d55f8bc42e Remove "to do" comments.
get_emppty_drive: Fix a day one bug with strcpy parameters.

Change name of find_drive_by_dev to the more descriptive
find_drive_by_name.

Rewrite minor number decoding.  Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).
2003-05-01 01:29:52 +00:00
Greg Lehey
47f9c49661 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

Remove an unnecessary goto.

vinumopen: Return EINVAL, not ENXIO, on an attempt to open a
referenced plex.
2003-05-01 01:28:42 +00:00
Maxim Sobolev
e9442e03ca Add support for IC Book Ironclad Pro/Lite 8-port cards.
Sponsired by:	IC Book Labs
MFC After:	2 weeks
2003-04-30 22:15:47 +00:00
Peter Wemm
8c027ecbba Eliminate a compiler warning with gcc3.3 on AMD64, where speed is
a 32 bit int which can never be > ULONG_MAX / 8.  Its an 'always true'
warning.
2003-04-30 21:39:28 +00:00
Mark Murray
51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00