Commit Graph

188 Commits

Author SHA1 Message Date
Archie Cobbs
2127f26023 Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Mike Spengler <mks@networkcs.com>
1998-12-04 22:54:57 +00:00
Justin T. Gibbs
0a42741c4a Honor CAM_TAG_ACTION_NONE. 1998-10-15 23:17:58 +00:00
Bruce Evans
894e2bd49e FIxed printf format errors (an new one that is only detected on systems
with pointers smaller than u_longs, and 2 possibly-truncating casts in
the same printf).
1998-09-29 09:14:52 +00:00
Doug Rabson
e37c045536 Add hooks so that the alpha can detect which disk has the root partition. 1998-09-26 14:37:49 +00:00
Doug Rabson
fb44081bd0 Don't set script to vaddr2 on the alpha - it can't access scripts in device
memory using simple pointers.
1998-09-26 14:29:59 +00:00
Kenneth D. Merry
aec4b791c5 A fix from Justin for the NCR bug that caused panics on 875 (and possibly
other) chips.

The script pointer was getting set to NULL instead of the right value.

Submitted by:	gibbs
1998-09-22 21:42:46 +00:00
Justin T. Gibbs
6d21c6f373 Bring back the cleanups from revs 1.121 and rev.1.122 of ncr.c.
Noticed by: bde
1998-09-22 04:56:08 +00:00
Kenneth D. Merry
8dc6f245bc Alpha patches for the NCR driver from Doug Rabson. I've tested these on an
NCR 810a, and they seem to work fine on the i386 as well.

Reviewed by:	gibbs
Submitted by:	dfr
1998-09-20 22:54:28 +00:00
Justin T. Gibbs
0532933e60 Set QUIRK_NOMSG for all devices as was the case in the non-CAM version
of the driver.  Why this is necessary (and how identify message handling
is performed when this is set) I don't comprehend...
1998-09-18 22:41:12 +00:00
Justin T. Gibbs
761fe626ea Really correct ncr_freeze_devq now. We scan backwards from the current
insertion point into the start queue looking for entries to remove and
mark them with the 'skip' address, recording the entry furthest from the
insertion point that needs to be removed.  We then go through a second
loop starting at the furthest entry to be removed and compress the start
queue.  The old algorithm started at (old insert point + 1) and wrapped
through the whole queue which would end up moving the start position in
the queue out from under the nose of the scrip processor.
1998-09-17 22:29:02 +00:00
Justin T. Gibbs
c2921d36a9 Use %p with (void *) casts to print pointers with printf. 1998-09-17 00:08:29 +00:00
Justin T. Gibbs
fb268fece4 Fix a regression that caused the script to spam itself by copying something
of size sizeof(struct timeval) that is really of size sizeof(ticks).

Make another attempt at fixing the queue full case.
1998-09-16 22:46:04 +00:00
Justin T. Gibbs
348811e078 Fix a bug in ncr_freeze_devq() which is called when we see a queue
full condition or other error which requires us to purge the
controller's start queue of transactions for a particular device.
We were relying on the NCR CCB's program address to cause the
script engine to skip to the next entry in the queue even though
the CCB is freed (and its program address switched to the idle
loop) by this action.  We now set the address in the start queue
to be the "skip" function directly.
1998-09-16 17:11:59 +00:00
Justin T. Gibbs
5ee58402df Correct printf format bugs. 1998-09-15 22:05:44 +00:00
Justin T. Gibbs
d720e6d5de Convert ISP pci front end to CAM/bus space/dma.
Convert ncr driver to CAM.
1998-09-15 10:06:23 +00:00
Bruce Evans
c41141b002 Fixed the formatting of some tables (mainly the one produced by ps
in ddb) which I broke by changing %8[l]x to %8p.  Hacked the central
printf routine to not add an "0x" prefix for %p formats if the field
width is nonzero.  The tables are still horribly misformatted on
64-bit machines.

Use %p instead of %8p to print pointers when the field width isn't
important.
1998-08-10 14:27:34 +00:00
Bruce Evans
88472e74e8 Avoid some casts of pointers to integers (of possibly different sizes). 1998-07-14 11:19:32 +00:00
Stefan Eßer
e1b7cfe2bf Remove unused member reselet from struct tstamp. 1998-07-12 20:32:52 +00:00
Stefan Eßer
e275daef22 Fix size of time stamps (had been time_t before the variable "time" was
hidden). Now "ticks" are used, which are 4 byte, not 8 byte in size.
The size mismatch did not matter due to sufficient padding at the end
of the structure that holds time stamps (there is an unused member).

The fix suggested by Bruce Evans used "sizeof (ticks_t)", but I prefer
to use "sizeof ticks", and didn't seem to object in his last mail on
this topic.

Submitted by:	bde
1998-07-12 20:26:45 +00:00
Bruce Evans
ac1e407b32 Fixed printf format errors. 1998-07-11 07:46:16 +00:00
Doug Rabson
ecbb00a262 This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
1998-06-07 17:13:14 +00:00
Dag-Erling Smørgrav
dc73342347 Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108. 1998-04-17 22:37:19 +00:00
Poul-Henning Kamp
227ee8a188 Eradicate the variable "time" from the kernel, using various measures.
"time" wasn't a atomic variable, so splfoo() protection were needed
around any access to it, unless you just wanted the seconds part.

Most uses of time.tv_sec now uses the new variable time_second instead.

gettime() changed to getmicrotime(0.

Remove a couple of unneeded splfoo() protections, the new getmicrotime()
is atomic, (until Bruce sets a breakpoint in it).

A couple of places needed random data, so use read_random() instead
of mucking about with time which isn't random.

Add a new nfs_curusec() function.

Mark a couple of bogosities involving the now disappeard time variable.

Update ffs_update() to avoid the weird "== &time" checks, by fixing the
one remaining call that passwd &time as args.

Change profiling in ncr.c to use ticks instead of time.  Resolution is
the same.

Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call
hzto() which subtracts time" sequences.

Reviewed by:	bde
1998-03-30 09:56:58 +00:00
Eivind Eklund
303b270b0a Staticize. 1998-02-09 06:11:36 +00:00
Eivind Eklund
7dff14331f Make FAILSAFE a new-style option. 1998-02-04 03:47:16 +00:00
Stefan Eßer
ea4eae1aa3 Fix size of start queue to 32 entries, independent of the default
number of tags (NCR_SCSI_DFLT_TAGS), which is 0 in the FAILSAFE case.
This should fix the incompatibility between kernel and ncrcontrol,
which is the result of FAILSAFE being defined in the kernel config
file, invisible to the build of ncrcontrol. (See kern/5133, which
should be fixed by this change.)
1997-12-02 22:37:58 +00:00
Poul-Henning Kamp
0abc78a697 Rename some local variables to avoid shadowing other local variables.
Found by: -Wshadow
1997-11-07 09:21:01 +00:00
Justin T. Gibbs
6c951b4441 Update for new callout interface. 1997-09-21 22:02:25 +00:00
Stefan Eßer
563e33ad10 Treat "reservation conflict" status similar to "busy". 1997-09-10 20:46:11 +00:00
Stefan Eßer
6779fb8201 Remove scaling of tp->period, since the value is assumed to be in
tenth of a nanoseconds by ncrcontrol
1997-09-09 21:52:31 +00:00
Stefan Eßer
2841b4feff Prepare for 64bit programming environment (e.g. Alpha):
Use "ncrcmd" or "u_int32_t" instead of "u_long", where appropriate.

Submitted by:	Gerard Roudier <groudier@club-internet.fr>
1997-08-31 19:42:31 +00:00
Stefan Eßer
7d4936dc38 Remove debug printf() that had been ommited by accident. 1997-08-31 19:36:56 +00:00
Stefan Eßer
71b8fb2a93 Fix problem with early revision 53c825a and 53c875 chips, which
could cause a solid system lockup in the driver attach:

These chips do not abort an access to the internal SRAM, when
the driver set the software reset bit in the istat register. But
the chip will never acknowledge the requested PCI bus transfer
in the situation, causing an infinite wait and a lockout of other
bus-masters.

The problem has been reported for rev 0x11 of the 53c825a and
rev 0x01 of the 53c875.
Revisions 0x13 of the 53c825a and 0x03 of the 53c875 are known
to support SRAM accesses, even in the software reset state.
1997-08-31 19:35:52 +00:00
Stefan Eßer
230847098b Some cleanup and a fix for an assumed chip bug:
- Do not malloc SCRIPTS memory for those parts of the microcode that
  are to be loaded into the on-chip SRAM of the 53c825a or 875 ...
- Modify ncr_chip_lookup to make adding new entries easier.
- Disable use of on-chip SRAM for the 53c825 rev 0x10 to 0x12, since
  there seems to be a problem with rev 0x11, while 0x13 is known to
  work. (Tested by Chuck Robey <chuckr@glue.umd.edu>).

This code will be merged into 2.2-stable after a few more days of
testing in -current.
1997-08-23 22:01:49 +00:00
Stefan Eßer
e6344dbdaa Minor corrections to the code added in rev. 1.100 and 1.101:
- fix features of 53c860
- correctly adjust data structure to cache line boundary (32 bytes)

Submitted by:	Gerard Roudier <groudier@club-internet.fr>
1997-08-23 21:53:47 +00:00
Bruce Evans
1fd0b0588f Removed unused #includes. 1997-08-02 14:33:27 +00:00
Stefan Eßer
5a6006b912 Fix problem caused by a chunk of the previous patch having been
applied to the wrong source code lines (non-fatal, since it just
made an auto variable become visible at the global level).
1997-07-29 21:50:04 +00:00
Stefan Eßer
3334aa04d9 Add support for loading the SCRIPTS microcode into the on-chip RAM
of the Symbios 53c825A, 53c875 and 53c895 SCSI chips.

Submitted by:	Gerard Roudier <groudier@club-internet.fr>
1997-07-28 21:32:05 +00:00
Stefan Eßer
c6d84f7c3e Add Ultra-SCSI support and enable more features for advanced
Symbios/NCR SCSI chips (no-flush option, large fifo, ...).

Submitted by:	Gerard Roudier <groudier@club-internet.fr>
1997-07-25 20:45:09 +00:00
Stefan Eßer
01cb2f9493 Fix "unexpected phase change" interrupt handler: Do not access the
dstat register twice, pass the value read the first time to the fixup
code instead.

Submitted by:	Gerard Roudier <groudier@club-internet.fr>
1997-07-18 19:33:56 +00:00
Stefan Eßer
9744aa88bd Add device IDs for new Symbios SCSI chips (53c875J,885,895,896), which
should work with no driver changes, though not all features are currently
used.

Remove code that was conditional on NEW_SCSICONF not being defined. This
was temporary code, that at a time got excluded correctly, until the new
scsiconf became the default, and NEW_SCSICONF was no longer specified.

Add support for quirks defined in scsiconf.c. For now only the HP3724/5
needs an entry, since that drive can't be used with tags.
1997-06-11 22:36:02 +00:00
Bruce Evans
7f10528533 Fixed the type of timeout functions and removed casts that hid the
type mismatches.  There was no problem in practice (at least on 386's).

Removed NetBSD-related TIMEOUT macro.  NetBSD uses the same BSD4.4Lite
timeout interface as FreeBSD.  As a concession to portability, declare
the timeout function without using the FreeBSD timeout_t typedef.
1997-04-20 15:48:17 +00:00
Bruce Evans
3c81694426 Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'.  Use a new function gettime().  The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
1997-03-22 06:53: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
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
Søren Schmidt
7c4eadc07b Fix typo.. 1997-01-06 13:51:15 +00:00
Stefan Eßer
4fe8838383 Fix NetBSD pr kern/3067, which also applies to FreeBSD:
NCR driver dies when "xmcd" accesses the CD-ROM drive

Restrict cacheing of INQUIRY results to LUN 0.

Thanks to Dave Huang <khym@bga.com> for reporting the problem
and suggesting a fix, though I chose a slightly different one.
1997-01-05 23:10:23 +00:00
Bruce Evans
0febc3d288 Don't redefine SCSI_NCR_DFLT_TAGS even in if FAILSAFE is defined. 1996-12-23 19:12:29 +00:00
Stefan Eßer
deb4f83f3c Improve negotiation messages:
Print MB/s instead of MHz (now takes WIDE into account).
Remove extranous "\n" from WIDE negotiation messages.
1996-12-21 12:32:34 +00:00
Stefan Eßer
7abffcc21a Fix "opt_ncr.h" changes:
- put #include into #ifdef KERNEL or ncrcontrol won't build
- rename SCSI_DEBUG_FLAGS to SCSI_NCR_DEBUG
1996-12-16 14:31:45 +00:00
Stefan Eßer
d44022652e Fix typo 1996-12-15 23:25:50 +00:00
Stefan Eßer
a56eccf52b Include "opt_ncr.h" for option settings. 1996-12-15 16:37:17 +00:00
Stefan Eßer
10cffc9fbc Do not limit to 1 LUN if FAILSAVE is set. Seems that CDROM drives
are now only probed for LUN 0, unless there is a specific entry in
scsi_conf.c.
1996-12-15 16:28:24 +00:00
Stefan Eßer
89c1d5dcd9 General cleanup and new features for 53c875 based cards, especially the
Tekram DC390W/U/F, whose config EEPROM can now be dumped, if the kernel
is built with option NCR_TEKRAM_EEPROM.

Other changes:

- add brackets to expansion of OUTB/W/L macro arguments.
- remove unused NCB structure element ns_async
- support sync. SCSI offset of 16 (instead of only 8) on 825A and 875
- correctly identify 53c810A and 53c825A chips
- preserve SCSI BIOS settings of PCI performance options
- remove (already disabled) support for NCR reset because of command timeout
- reverse order of reading of SCSI and DMA specific interrupt cause registers
- add definition of Tekram config EEPROM contents (not currently used)
1996-12-14 13:13:33 +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
Stefan Eßer
e6f6908163 Only access the specific interrupt status registers if required.
This follows more closely the suggestions in the latest NCR docs, and has
been running on my system for weeks with no problem. It does improve the
quality of diagnostic messages and does allow to better understand the
sequence of events in case of an error.

This should go into 2.2 and 2.1.6.
1996-11-08 23:46:04 +00:00
Stefan Eßer
b7ccd3dc56 Move the initialization of np->ns_sync and ns_async out of ncr_getclock(),
which does no longer get called for non-Ultra cards.
Fix suggested by Gerard Roudier, slightly modified by me.
1996-10-14 10:09:52 +00:00
Stefan Eßer
bdf9734704 Fix previous commit: The INB/OUTB macros require np->vaddr to be
initialized, or a kernel panic will occur.

Submitted by:	Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
1996-10-12 17:33:48 +00:00
Stefan Eßer
20bc4c3ac1 Improve support of SCSI cards based on the 53c860 and 53c875.
Still no support for Ultra-SCSI and other new features, but the code
should now correctly initialize the clock pre-scaler (based on freqency
measurement results, if necessary).

Fix support of 16 targets for WIDE SCSI.

Disable bus reset in case no progress is made for too long ("ncr dead"
message), which did not work too well with scanners and other slow devices.
1996-10-11 19:50:12 +00:00
Paul Traina
e0c973266d The recent change to clock.h to include opt_cpu.h (bug!!!) uncovered a
compile error in ncrcontrol.c -- ncr.c should not be including clock.h
when not compiled for the kernel.
1996-10-10 04:09:37 +00:00
Bruce Evans
ec7ada96e6 Preserve volatility in casts of np->reg. Cosmetic. 1996-09-07 21:27:24 +00:00
Poul-Henning Kamp
bfbb029d87 Remove devconf, it never grew up to be of any use. 1996-09-06 23:09:20 +00:00
Stefan Eßer
ad873e05e4 Put back the initialization of the time constants of the SCSI and Sync.
logic clock signal, which had been erroneously commented out by the
previous commit. This will re-enable support for sync. transfer negotiation,
which depends on one of those values.
1996-08-27 20:41:02 +00:00
Stefan Eßer
23da20014a Set clock prescale based on BIOS supplied value instead of trying to
calculate an optimum value from (constant) parameters.
This should set the SCNTL3 register of the 53c860 and 53c875 to twice
the divider it used to be, since cards based on those chips seem to use
an 80MHz clock instead of the Clock Doubler feature and a 40MHz clock.
1996-08-26 22:38:07 +00:00
Stefan Eßer
d8a8289c5a Send out a period of "0" if negotiating asynchronous transfers (offset = 0).
A value of "255" used to be sent, and though it should not matter, there
appear to be a few devices that want both values to be zero for asynch.
1996-08-05 19:39:51 +00:00
Gary Palmer
c23670e294 Clean up -Wunused warnings.
Reviewed by:		bde
1996-06-12 05:11:41 +00:00
Poul-Henning Kamp
aa8de40ae5 Another sweep over the pmap/vm macros, this time with more focus on
the usage.  I'm not satisfied with the naming, but now at least there is
less bogus stuff around.
1996-05-03 21:01:54 +00:00
Poul-Henning Kamp
e911eafcba removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
        ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
        NPDEPG

Major macro cleanup.
1996-05-02 14:21:14 +00:00
Bruce Evans
3157adc8af Removed now-unused #includes of <machine/cpu.h>. They were for bootverbose
being declared in the wrong place.
1996-04-07 17:32:42 +00:00
Justin T. Gibbs
09d0c1ca40 ncr.c:
Use new XS_SELTIMEOUT error code for selection timeouts.

aic7870.c:
   Move SCB walking code to aic7xxx.c and make it work for all card types.

   The flag AHC_EXTSCB is no longer needed since the SCBs are walked in
   all cases now.
1996-03-31 03:17:50 +00:00
Bruce Evans
ede8dc43a2 Fixed unsigned longs that should have been vm_offset_t.
vm_offset_t is currently unsigned long but should probably be plain
unsigned for i386's to match the choice of minimal types to represent
for fixed-width types in Lite2.  Anyway, it shouldn't be assumed
to be unsigned long.

I only fixed the type mismatches that were detected when I changed
vm_offset_t to unsigned.  Only pointer type mismatches were detected.
1996-03-19 15:03:00 +00:00
Stefan Eßer
078d5aeeed If FAILSAFE is defined, then:
- Do not enable tagged commands by default
- Probe only 1 LUN
- Do not negotiate sync. transfer with CDROM drives

Defining FAILSAFE will result in a driver that will tolerate
marginal hardware for the price of a slight loss of performance
It is intended for use in install kernels.
1996-03-11 19:36:07 +00:00
Stefan Eßer
1eb496be93 Do WIDE negotiation before sync. transfer speed negotiation,
if a drive supports both features.
Pointed out by Gerard Goudier, who knew section 5.6.23 of
the SCSI-2 standard requires this order of actions ...
1996-03-11 19:25:58 +00:00
Justin T. Gibbs
100eb37c65 aic7870.c, ncr.c:
Cleanse the SCSI subsystem of its internally defined types
	u_int32, u_int16, u_int8, int32, int16, int8.
	Use the system defined *_t types instead.

aic7870.c:
	Handle Seeprom data a little better.
1996-03-10 07:12:49 +00:00
Stefan Eßer
e14b85c5e3 Restore two lines that were erronously deleted with the removal of
the NCR_NO_DISCONNECT option in the previous patch.
1996-02-19 00:03:50 +00:00
Stefan Eßer
baf895e508 Make SIMPLE TAG messages the default.
Remove bogus NCR_NO_DISCONNECT option, which actually never was useful.
1996-02-18 23:15:19 +00:00
Stefan Eßer
218d60ad3d Slight modification of ncr_setmaxtags: set usrtags=0 for drives
that don't announce support for command queues.

SCSI_NCR_DFLT_TAGS can be specified in the kernel config file
and sets the default number of tags per disk drive.
A value of 0 means "no tags".

Minor correction in debug messages: Values from the msg_in
buffer were being printed in the msg_out trace message ...
1996-01-31 19:24:34 +00:00
Stefan Eßer
dd7610fca4 Make PCI interrupt handlers return void like everybody else does.
Reviewed by:	davidg
1996-01-23 21:48:28 +00:00
Stefan Eßer
29681c973a Change default value of MAX_LUN from 1 to 8. 1996-01-18 19:59:23 +00:00
Stefan Eßer
a294c82acc Back out patch 1.53. The problem report that had made me commit this
change turned out to have been caused by some other change, and the
patch should have had no effect at all (just made the code a little
longer).
1996-01-15 23:51:10 +00:00
Stefan Eßer
01996055ed Disable handshake timeout. Some devices don't send an ACK for several
seconds ...

Submitted by:	wolf
1996-01-15 23:16:39 +00:00
Stefan Eßer
85cf6e3f7e Make the NCR driver on the boot floppy kernel not negotiate synch. SCSI
transfers for CDROM drives.
1996-01-15 00:10:15 +00:00
Stefan Eßer
ad6ca346f2 Add back initialization of "ncrp[unit]" since ncrcontrol relies on it. 1996-01-10 21:20:57 +00:00
Stefan Eßer
020bfdcff6 Add back nncr and ncrp for now. ncrcontrol relies on them.
(To be replaced by sysctl accesses some time ...)

Remove a backward jump from the NCR script, which allowed a SCSI target
to receive any number of NOP messages it desired. If a target indeed
does such a silly thing, make it fail at the next instruction, instead
of causing a timeout a few seconds later.
1996-01-09 19:57:49 +00:00
Justin T. Gibbs
2f53429551 Write the cahesize and latency timer values back into configuration
space (whoops!).

Add a missing argument to the cachesize/lattime printf.

Set the CACHETHEN bit in DSCommand.
1996-01-07 19:26:12 +00:00
Stefan Eßer
7217e99c8f Preserve SIGP bit when clearing INTF condition.
Submitted by:	Gerard Roudier <groudier@htlm.fr>
1995-12-28 13:04:03 +00:00
Bruce Evans
6ea3e9d839 Completed function declarations and/or added prototypes and/or added
#includes to get prototypes.

pci now uses a different interrupt handler type for interrupts that it
dispatches and the isa interrupt handler type for the interrupts that
it handles.
1995-12-16 00:27:59 +00:00
Poul-Henning Kamp
f708ef1b9e Another mega commit to staticize things. 1995-12-14 09:55:16 +00:00
David Greenman
efeaf95a41 Untangled the vm.h include file spaghetti. 1995-12-07 12:48:31 +00:00
Stefan Eßer
d4a471bda0 Add preliminary support for the 53c860 and 53c875 ULTRA SCSI chips,
and for the 53c810ap, the improved version of the 53c810.
The driver should work with all those controllers, but doesn't know
about any of their advanced features.
1995-09-21 17:27:28 +00:00
Stefan Eßer
f7fe07b585 Introduce NCB_SCRIPT_PHYS and CCB_PHYS macros to find physical addresses
of NCR script labels and of command control block structure components.
This allows for easy modification of the actual virtual to physical
mapping operator used ...
Make all applicable references to physical address values use the above
macros instead of calls to vtophys().
1995-09-11 19:34:30 +00:00
Stefan Eßer
1be758653e Put back p_script component into NCR control block.
The driver currently doesn't use it, but ncrcontrol needs it
to print some script addresses relative to the script start.
1995-09-11 12:10:19 +00:00
Stefan Eßer
b564b3e73e Don't use vtophys() for constant addresses, cache the translations in
the NCR control block (ncb) and command control block (ccb) instead.
1995-09-08 19:30:11 +00:00
Stefan Eßer
ab14793833 Applied patches that make the driver compile on NetBSD again.
They shouldn't affect FreeBSD, since they are within #ifdef NETBSD
directives.
Changed the HAD_ERROR return code into COMPLETE according to a comment
in "/sys/scsi/scsiconf.h"

Submitted by:	Andreas Wrede <andreas@planix.com>
1995-09-08 14:29:48 +00:00
Stefan Eßer
3a5a6263e3 Add support for 16 targets on WIDE SCSI bus.
This seems to work fine on my 53c810, but really should be tested on
a 53c825 with at least one target set to an ID >= 8.
The script is now copied to memory mapped using vm_page_alloc_contig(),
since it has to be physically contigous. This must be changed, if the
driver is converted into a loadable module !
Two of the probe messages are suppressed, unless "bootverbose" is set.
1995-09-07 20:53:40 +00:00
Stefan Eßer
8befc21fbd The NCR script has grown beyond one page (4KB). Since malloc() returns
contiguous memory in virtual space, but doesn't guarantee any particular
physical layout of pages, the script may be not contguous in physical
memory. This made the first write command fail in very rare cases.
This has been fixed by checking the region returned by malloc() for
being contiguous, but there should be a physical memory allocate
and later mapping to virtual memory instead.

A few assertions and error messages are improved.
1995-09-05 22:37:59 +00:00
Justin T. Gibbs
07b1c6b3c9 Remove hard coded assumption that SCSI busses have 7 targets.
This change forces the controller drivers to allocate a scsibus_data struct
via a call to scsi_alloc_bus(), fill in the adapter_link field, and optionally
modify any other fields of the struct.  Scsi_alloc_bus() initializes all fields
to the default, so the changes in most drivers are very minimal.  For drivers
that support Wide controllers, the maxtarg field will have to be updated to
allow probing of all targets (for an example, look at the aic7xxx driver).

Scsi_attachdevs() now takes a scsibus_data* as its argument instead of an
sc_link*.  This allows us to expand the role of the scsibus_data struct for
other bus level configuration setings (max number of transactions, current
transaction opennings, etc for better tagged queuing support).

Reviewed by: Rodney Grimes <rgrimes>, Peter Dufault <dufault>, Julian Elischer <julian>
1995-08-23 23:03:34 +00:00
Stefan Eßer
d36d3f0e18 Print more information in case of unspecific error condition.
Do not print "in getcc reselect by" message unless DEBUG_RESTART is set.
1995-08-15 20:19:14 +00:00
Stefan Eßer
d54b39155a Return an extended status of XS_TIMEOUT (instead of XS_DRIVER_STUFFUP)
in case of an unspecific error (most likely software timeout after
SCSI bus reset).
This will make the generic SCSI code retry the failed command.
1995-08-13 14:59:38 +00:00
Stefan Eßer
e9a9607fbb Put back second case of CC handler in NCR script. 1995-07-07 12:30:39 +00:00