History log of /freebsd-10.1-release/sys/pci/ncr.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 254263 12-Aug-2013 scottl

Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register. The lazy BAR allocation code in FreeBSD sometimes
disables this bit when it detects a range conflict, and will re-enable
it on demand when a driver allocates the BAR. Thus, the bit is no longer
a reliable indication of capability, and should not be checked. This
results in the elimination of a lot of code from drivers, and also gives
the opportunity to simplify a lot of drivers to use a helper API to set
the busmaster enable bit.

This changes fixes some recent reports of disk controllers and their
associated drives/enclosures disappearing during boot.

Submitted by: jhb
Reviewed by: jfv, marius, achadd, achim
MFC after: 1 day


# 249585 17-Apr-2013 gabor

- Corrrect mispellings of word useful

Submitted by: Christoph Mallon <christoph.mallon@gmx.de> (via private mail)


# 247095 21-Feb-2013 glebius

Fix build.


# 247070 21-Feb-2013 imp

Most other giant locked storage drivers in the tree don't use
splsoftclock to note the need for future locking, so remove it from
here.


# 247067 20-Feb-2013 imp

Kill now-bogus splhigh() -- it is a nop


# 246037 28-Jan-2013 jhb

Mark 'ticks', 'time_second', and 'time_uptime' as volatile to prevent the
compiler from caching their values in tight loops.

Reviewed by: bde
MFC after: 1 week


# 201758 07-Jan-2010 mbr

Remove extraneous semicolons, no functional changes.

Submitted by: Marc Balmer <marc@msys.ch>
MFC after: 1 week


# 170872 17-Jun-2007 scottl

Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now. This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.


# 170093 29-May-2007 rwatson

Where I previously removed calls to kdb_enter(), now remove include of
kdb.h.

Pointed out by: bde


# 170027 27-May-2007 rwatson

Implement assert() in ncr.c using KASSERT() rather than explicitly testing
the assertion and then calling kdb_enter().


# 168752 15-Apr-2007 scottl

Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that
SIM. Drivers that are not yet MPSAFE register Giant and operate as
usual. RIght now, no drivers are MPSAFE, though a few will be changed
in the coming week as this work settles down.

The driver API has changed, so all CAM drivers will need to be recompiled.
The userland API has not changed, so tools like camcontrol do not need to
be recompiled.


# 166920 23-Feb-2007 imp

Catchup with filters


# 163896 01-Nov-2006 mjacob

2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.


# 163816 31-Oct-2006 mjacob

The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.

This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).

After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.

This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.

Reviewed by: freebsd-scsi and specific stakeholders


# 160964 04-Aug-2006 yar

Commit the results of the typo hunt by Darren Pilgrim.
This change affects documentation and comments only,
no real code involved.

PR: misc/101245
Submitted by: Darren Pilgrim <darren pilgrim bitfreak org>
Tested by: md5(1)
MFC after: 1 week


# 158471 12-May-2006 jhb

Remove various bits of conditional Alpha code and fixup a few comments.


# 142418 25-Feb-2005 imp

Add back 'n' that went missing in last commit


# 142407 24-Feb-2005 imp

Fix style(9) issues with __P removal.

Noticed by: bde


# 142398 24-Feb-2005 imp

Return BUS_PROBE_DEFAULT instead of 0.


# 139834 07-Jan-2005 scottl

Fix typos from previous commit.


# 139825 07-Jan-2005 imp

/* -> /*- for license, minor formatting changes


# 135043 10-Sep-2004 se

Fix oversight reported by Norikatsu Shigemura for the "sym" driver
(which was derived from the "ncr" driver) and add a MODULE_DEPEND
on "cam".

MT5 candidate, IMHO.
MFC after: 1 week


# 131934 10-Jul-2004 marcel

Update for the KDB framework:
o Call kdb_enter() instead of Debugger().


# 129878 30-May-2004 phk

Add missing <sys/module.h> includes


# 127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 124460 13-Jan-2004 alc

Replace calls to vm_page_alloc_contig() by calls to contigmalloc().
vm_page_alloc_contig() will be removed after the three remaining drivers
that use it are also converted to contigmalloc().


# 119343 23-Aug-2003 marcel

Revert previous change for ncrreg.h. The header really lives in
sys/pci.


# 119288 22-Aug-2003 imp

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


# 118073 26-Jul-2003 robert

Changed the type of the variable `qidx' from u_int8_t to int,
mainly to quiet a warning emitted by GCC 3.3 about comparing
a variable to a value which is larger than the former can hold.

The value was checked to make sure the `np->squeue' array is
not accessed behind its boundary.
This worked due to possibly accidental truncation when
(np->squeueput + 1) was larger than or equal to MAX_START (256)
when it was assigned to `qidx'.

`qidx' is used to hold the next position in the start queue
for an insertion. The new type was chosen because some other
code in the function ncr_freeze_devq() also uses plain integers
to hold those indices.

Wrapped the line after the closing parenthesis of an `if'
condition.


# 116351 14-Jun-2003 njl

Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.

* Due to a bug, aic(4) never used extended geometry. Changes all drives
>1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.

For all other controllers in this commit, this should be a no-op.

Looked over by: scottl


# 116192 11-Jun-2003 obrien

Use __FBSDID().


# 116129 09-Jun-2003 se

Remove embededded ID string which was meant to provide information
about the driver version in case of an error report. It conflicts with
some other variable of the same name that has been added to the kernel
just recently and there haven't been any bug reports for quite some
time now, anyway ...


# 115526 31-May-2003 phk

Remove unused variable.

Found by: FlexeLint


# 113506 15-Apr-2003 mdodd

- Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
such abuse isn't really needed. (And if we do need type information
associated with a module then we should make it explicit and not
use hacks.)


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 108470 30-Dec-2002 schweikh

Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.


# 105219 16-Oct-2002 phk

Be consistent about functions being static.

Spotted by: FlexeLint.


# 102412 25-Aug-2002 charnier

Replace various spelling with FALLTHROUGH which is lint()able


# 80203 23-Jul-2001 kris

s/adress/address/

Inspired by: OpenBSD
MFC After: 1 week


# 73280 01-Mar-2001 markm

Turn on interrupt-entropy harvesting for all/any mass storage devices
I could find. I have no doubt missed a couple.

Interrupt entropy harvesting is still conditional on the
kern.random.sys.harvest_interrupt sysctl.


# 69781 08-Dec-2000 dwmalone

Convert more malloc+bzero to malloc+M_ZERO.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>


# 67708 27-Oct-2000 phk

Convert all users of fldoff() to offsetof(). fldoff() is bad
because it only takes a struct tag which makes it impossible to
use unions, typedefs etc.

Define __offsetof() in <machine/ansi.h>

Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>

Remove myriad of local offsetof() definitions.

Remove includes of <stddef.h> in kernel code.

NB: Kernelcode should *never* include from /usr/include !

Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.

Deprecate <struct.h> with a warning. The warning turns into an error on
01-12-2000 and the file gets removed entirely on 01-01-2001.

Paritials reviews by: various.
Significant brucifications by: bde


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 61001 28-May-2000 peter

ncr.c is no longer a COMPAT_OLDPCI device - remove the warning.


# 60974 27-May-2000 dfr

Update to use newbus and busspace.


# 59368 18-Apr-2000 phk

Remove unneeded <sys/buf.h> includes.

Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.


# 58701 27-Mar-2000 imp

Ahhrggg. Put the test for the compat shims AFTER the file that includes
them.

Pointed out by: bde


# 58695 27-Mar-2000 imp

Per conversations in -current, add #error to these drivers when you don't
have the right compatibility shims enabled. ISA drivers to follow later.


# 56446 23-Jan-2000 groudier

Add 53C895A and 53C1510D device description to the ncr chip table.


# 55206 29-Dec-1999 peter

Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.


# 52903 05-Nov-1999 gallatin

Remove calls to alpha_register_pci_scsi(). After Mike's recent boot
changes, it no longer exists and is preventing alpha kernels from building.

reviewed by: msmith


# 50548 29-Aug-1999 bde

Don't restrict our requests for contiguous memory to addresses >= 1MB.
This fixes, at least, panics in ncr_attach() on i386's with about 5MB
of memory. The restriction was a hack to leave some low memory for ISA
DMA, but on i386's we now allocate pages from the top down, so all the
restriction did was cause our allocations to fail when there is no free
memory above 1MB.


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48424 01-Jul-1999 peter

#include <machine/md_var.h> to get prototype for alpha_register_pci_scsi().


# 47926 15-Jun-1999 des

Kill option FAILSAFE.

PR: i386/12187
Approved by: bde


# 47529 26-May-1999 gallatin

Allow chipset drivers to specify the direct-mapped DMA window's mask in
preparation for tsunami support. Previous chipsets' direct-mapped DMA
mask was always 1024*1024*1024. The Tsunami chipset needs it to be
2*1024*1024*1024

These changes should not affect the i386 port

Reviewed by: Doug Rabson <dfr@nlsystems.com>


# 47374 21-May-1999 ken

Fix a memory leak and a double free that could happen in certain error
cases. These were unlikely to happen in normal operation.

Noticed by: "Christopher R. Bowman" <crb@ChrisBowman.com>


# 46843 09-May-1999 se

Really support Ultra-2 chips. Symbios redefined a register that
was available to the programmer to hold chip state information:

Use the SDID register instead of CTEST3. This change actually
simplifies the SCRIPTS code, but I'm not absolutely sure, that
it is OK for all variants of NCR chips around and all device
combinations. I have had this code running on several systems
with 53c810, 875 and 895 controllers for several months.

Suggested by: Gerard Roudier <groudier@club-internet.fr>


# 46813 09-May-1999 peter

Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:
#define COMPAT_PCI_DRIVER(name,data) DATA_SET(pcidevice_set,data)
.. to 2.2.x and 3.x if people think it's worth it. Driver writers can do
this if it's not defined. (The reason for this is that I'm trying to
progressively eliminate use of linker_sets where it hurts modularity and
runtime load capability, and these DATA_SET's keep getting in the way.)


# 46581 06-May-1999 ken

Add a number of interrelated CAM feature enhancements and bug fixes.

NOTE: These changes will require recompilation of any userland
applications, like cdrecord, xmcd, etc., that use the CAM passthrough
interface. A make world is recommended.

camcontrol.[c8]:
- We now support two new commands, "tags" and "negotiate".

- The tags commands allows users to view the number of tagged
openings for a device as well as a number of other related
parameters, and it allows users to set tagged openings for
a device.

- The negotiate command allows users to enable and disable
disconnection and tagged queueing, set sync rates, offsets
and bus width. Note that not all of those features are
available for all controllers. Only the adv, ahc, and ncr
drivers fully support all of the features at this point.
Some cards do not allow the setting of sync rates, offsets and
the like, and some of the drivers don't have any facilities to
do so. Some drivers, like the adw driver, only support enabling
or disabling sync negotiation, but do not support setting sync
rates.

- new description in the camcontrol man page of how to format a disk
- cleanup of the camcontrol inquiry command
- add support in the 'devlist' command for skipping unconfigured devices if
-v was not specified on the command line.
- make use of the new base_transfer_speed in the path inquiry CCB.
- fix CCB bzero cases

cam_xpt.c, cam_sim.[ch], cam_ccb.h:

- new flags on many CCB function codes to designate whether they're
non-immediate, use a user-supplied CCB, and can only be passed from
userland programs via the xpt device. Use these flags in the transport
layer and pass driver to categorize CCBs.

- new flag in the transport layer device matching code for device nodes
that indicates whether a device is unconfigured

- bump the CAM version from 0x10 to 0x11

- Change the CAM ioctls to use the version as their group code, so we can
force users to recompile code even when the CCB size doesn't change.

- add + fill in a new value in the path inquiry CCB, base_transfer_speed.
Remove a corresponding field from the cam_sim structure, and add code to
every SIM to set this field to the proper value.

- Fix the set transfer settings code in the transport layer.

scsi_cd.c:

- make some variables volatile instead of just casting them in various
places
- fix a race condition in the changer code
- attach unless we get a "logical unit not supported" error. This should
fix all of the cases where people have devices that return weird errors
when they don't have media in the drive.

scsi_da.c:

- attach unless we get a "logical unit not supported" error

scsi_pass.c:

- for immediate CCBs, just malloc a CCB to send the user request in. This
gets rid of the 'held' count problem in camcontrol tags.

scsi_pass.h:

- change the CAM ioctls to use the CAM version as their group code.

adv driver:

- Allow changing the sync rate and offset separately.

adw driver

- Allow changing the sync rate and offset separately.

aha driver:

- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.

ahc driver:

- Allow setting offset and sync rate separately

bt driver:

- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.

NCR driver:

- Fix the ultra/ultra 2 negotiation bug
- allow setting both the sync rate and offset separately

Other HBA drivers:
- Put code in to set the base_transfer_speed field for
XPT_GET_TRAN_SETTINGS CCBs.

Reviewed by: gibbs, mjacob (isp), imp (aha)


# 46024 24-Apr-1999 peter

Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn't
hurt the driver portability to 3.x too much for where drivers are shared.


# 43309 27-Jan-1999 dillon

Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile.

This commit includes significant work to proper handle const arguments
for the DDB symbol routines.


# 42155 29-Dec-1998 hoek

Silence -Wtrigraph.

Submitted by: Bradley Dunn <bradley@dunn.org> (pr: kern/8817)


# 41766 14-Dec-1998 dillon

pci_device pd_probe function changed from returning char * to returning
const char *. Originally I was going to add casts from const char * to
char * in some of the pci device drivers, but the reality is that the
pci device probes return constant quoted strings.


# 41591 07-Dec-1998 archie

The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.


# 41514 04-Dec-1998 archie

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>


# 40418 15-Oct-1998 gibbs

Honor CAM_TAG_ACTION_NONE.


# 39757 29-Sep-1998 bde

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).


# 39683 26-Sep-1998 dfr

Add hooks so that the alpha can detect which disk has the root partition.


# 39682 26-Sep-1998 dfr

Don't set script to vaddr2 on the alpha - it can't access scripts in device
memory using simple pointers.


# 39574 22-Sep-1998 ken

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


# 39554 22-Sep-1998 gibbs

Bring back the cleanups from revs 1.121 and rev.1.122 of ncr.c.

Noticed by: bde


# 39532 20-Sep-1998 ken

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


# 39467 18-Sep-1998 gibbs

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...


# 39438 17-Sep-1998 gibbs

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.


# 39390 16-Sep-1998 gibbs

Use %p with (void *) casts to print pointers with printf.


# 39386 16-Sep-1998 gibbs

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.


# 39366 16-Sep-1998 gibbs

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.


# 39310 15-Sep-1998 gibbs

Correct printf format bugs.


# 39247 15-Sep-1998 gibbs

Convert ISP pci front end to CAM/bus space/dma.

Convert ncr driver to CAM.


# 38224 10-Aug-1998 bde

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.


# 37637 14-Jul-1998 bde

Avoid some casts of pointers to integers (of possibly different sizes).


# 37607 12-Jul-1998 se

Remove unused member reselet from struct tstamp.


# 37605 12-Jul-1998 se

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


# 37555 11-Jul-1998 bde

Fixed printf format errors.


# 36735 07-Jun-1998 dfr

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.


# 35256 17-Apr-1998 des

Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.


# 34961 30-Mar-1998 phk

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


# 33181 09-Feb-1998 eivind

Staticize.


# 33068 04-Feb-1998 eivind

Make FAILSAFE a new-style option.


# 31504 02-Dec-1997 se

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.)


# 31017 07-Nov-1997 phk

Rename some local variables to avoid shadowing other local variables.

Found by: -Wshadow


# 29681 21-Sep-1997 gibbs

Update for new callout interface.


# 29292 10-Sep-1997 se

Treat "reservation conflict" status similar to "busy".


# 29253 09-Sep-1997 se

Remove scaling of tp->period, since the value is assumed to be in
tenth of a nanoseconds by ncrcontrol


# 28960 31-Aug-1997 se

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>


# 28959 31-Aug-1997 se

Remove debug printf() that had been ommited by accident.


# 28958 31-Aug-1997 se

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.


# 28636 23-Aug-1997 se

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.


# 28634 23-Aug-1997 se

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>


# 27845 02-Aug-1997 bde

Removed unused #includes.


# 27762 29-Jul-1997 se

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).


# 27744 28-Jul-1997 se

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>


# 27684 25-Jul-1997 se

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>


# 27512 18-Jul-1997 se

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>


# 26568 11-Jun-1997 se

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.


# 25048 20-Apr-1997 bde

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.


# 24101 22-Mar-1997 bde

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.


# 22975 22-Feb-1997 peter

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 21673 14-Jan-1997 jkh

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.


# 21375 06-Jan-1997 sos

Fix typo..


# 21351 05-Jan-1997 se

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.


# 20874 23-Dec-1996 bde

Don't redefine SCSI_NCR_DFLT_TAGS even in if FAILSAFE is defined.


# 20741 21-Dec-1996 se

Improve negotiation messages:

Print MB/s instead of MHz (now takes WIDE into account).
Remove extranous "\n" from WIDE negotiation messages.


# 20549 16-Dec-1996 se

Fix "opt_ncr.h" changes:
- put #include into #ifdef KERNEL or ncrcontrol won't build
- rename SCSI_DEBUG_FLAGS to SCSI_NCR_DEBUG


# 20535 15-Dec-1996 se

Fix typo


# 20517 15-Dec-1996 se

Include "opt_ncr.h" for option settings.


# 20514 15-Dec-1996 se

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.


# 20435 14-Dec-1996 se

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)


# 20390 13-Dec-1996 jkh

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>


# 19548 08-Nov-1996 se

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.


# 18919 14-Oct-1996 se

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.


# 18886 12-Oct-1996 se

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>


# 18875 11-Oct-1996 se

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.


# 18848 10-Oct-1996 pst

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.


# 18124 07-Sep-1996 bde

Preserve volatility in casts of np->reg. Cosmetic.


# 18084 06-Sep-1996 phk

Remove devconf, it never grew up to be of any use.


# 17850 27-Aug-1996 se

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.


# 17836 26-Aug-1996 se

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.


# 17449 05-Aug-1996 se

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.


# 16322 12-Jun-1996 gpalmer

Clean up -Wunused warnings.

Reviewed by: bde


# 15583 03-May-1996 phk

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.


# 15543 02-May-1996 phk

removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
NPDEPG

Major macro cleanup.


# 15116 07-Apr-1996 bde

Removed now-unused #includes of <machine/cpu.h>. They were for bootverbose
being declared in the wrong place.


# 14938 31-Mar-1996 gibbs

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.


# 14703 19-Mar-1996 bde

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.


# 14560 11-Mar-1996 se

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.


# 14556 11-Mar-1996 se

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 ...


# 14453 10-Mar-1996 gibbs

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.


# 14152 18-Feb-1996 se

Restore two lines that were erronously deleted with the removal of
the NCR_NO_DISCONNECT option in the previous patch.


# 14151 18-Feb-1996 se

Make SIMPLE TAG messages the default.
Remove bogus NCR_NO_DISCONNECT option, which actually never was useful.


# 13809 31-Jan-1996 se

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 ...


# 13597 23-Jan-1996 se

Make PCI interrupt handlers return void like everybody else does.

Reviewed by: davidg


# 13481 18-Jan-1996 se

Change default value of MAX_LUN from 1 to 8.


# 13448 15-Jan-1996 se

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).


# 13447 15-Jan-1996 se

Disable handshake timeout. Some devices don't send an ACK for several
seconds ...

Submitted by: wolf


# 13432 14-Jan-1996 se

Make the NCR driver on the boot floppy kernel not negotiate synch. SCSI
transfers for CDROM drives.


# 13377 10-Jan-1996 se

Add back initialization of "ncrp[unit]" since ncrcontrol relies on it.


# 13364 09-Jan-1996 se

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.


# 13318 07-Jan-1996 gibbs

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.


# 13075 28-Dec-1995 se

Preserve SIGP bit when clearing INTF condition.

Submitted by: Gerard Roudier <groudier@htlm.fr>


# 12879 15-Dec-1995 bde

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.


# 12820 14-Dec-1995 phk

Another mega commit to staticize things.


# 12662 07-Dec-1995 dg

Untangled the vm.h include file spaghetti.


# 10936 21-Sep-1995 se

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.


# 10677 11-Sep-1995 se

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().


# 10673 11-Sep-1995 se

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.


# 10639 08-Sep-1995 se

Don't use vtophys() for constant addresses, cache the translations in
the NCR control block (ncb) and command control block (ccb) instead.


# 10629 08-Sep-1995 se

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>


# 10605 07-Sep-1995 se

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.


# 10567 05-Sep-1995 se

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.


# 10205 23-Aug-1995 gibbs

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>


# 10072 15-Aug-1995 se

Print more information in case of unspecific error condition.
Do not print "in getcc reselect by" message unless DEBUG_RESTART is set.


# 10043 13-Aug-1995 se

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.


# 9429 07-Jul-1995 se

Put back second case of CC handler in NCR script.


# 9364 28-Jun-1995 se

Changes to support some CDROM drives and the Quantum Grand-Prix
series of hard disk drives, which don't accept any SCSI message
within an REQUEST SENSE command (i.e. even not an IDENTIFY to set
the LUN).
This patch obviates the need for QUIRK_NOMSG and thus all of the
device_tab[] entries in the NCR driver.


# 8876 30-May-1995 rgrimes

Remove trailing whitespace.


# 7505 30-Mar-1995 se

Include <stddef.h> for standard definition of offsetof() instead of
defining it explicitly in the driver.


# 7250 22-Mar-1995 se

Set request sense data size from xp->req_sense_length if != 0.

Submitted by: Wolfgang Stanglmeier <wolf@kintaro.cologne.de>


# 7245 22-Mar-1995 se

Remove use of unitialised variable xp->req_sense_length.

Submitted by: Wolfgang Stanglmeier <wolf@kintaro.cologne.de>


# 7228 21-Mar-1995 se

Major cleanup: Stylistic changes, 386BSD specific code removed.
Adaptec to new PCI code.

Submitted by: Wolfgang Stnglmeier <wolf@kintaro.cologne.de>


# 7104 17-Mar-1995 dg

Added a new field to the pci_device struct called pd_shutdown to specify
a device specific shutdown routine for devconf. Assign the value of this
to the kern_devconf struct. Implement a device shutdown routine for if_de
that disables the device. This will stop the device from corrupting memory
after a reboot.


# 7081 16-Mar-1995 se

Make ncr.c compile again (PRINT_ADDR() had been patched
into the middle of a printf() by a buggy diff ...).

Submitted by: rgrimes


# 7072 15-Mar-1995 se

Conditionalise debug message.

Submitted by: Peter Dufault <dufault@hda.com>


# 6856 03-Mar-1995 se

Reduce burst length to 4 DWORDs for now, since there seem to
be 486 chip sets that can't tolerate bursts > cache line size.
This should really made dependent on the particular buggy
chip sets, but for now we'll play safe ...


# 6766 27-Feb-1995 se

Delete bogus semicolon in macro definition.


# 6705 25-Feb-1995 se

Make people happy, who claim to better know how "interupt"
is to be spelled :).

Submitted by: <wolf@kintaro.cologne.de> Wolfgang Stanglmeier


# 6632 22-Feb-1995 se

Cleanup for compatibility with another OS.

Submitted by: wolf


# 6526 17-Feb-1995 se

Improve diagnostics:

Test for correct execution of cache test script by NCR,
and give meaningful error description if it fails.
(A cache problem was reported before.)
Don't wait forever for cache test to complete (to protect
against faulty hardware).

Submitted by: wolf


# 6460 15-Feb-1995 se

For the sake of people, who like to move pci_configure()
before isa_configure() in autoconf.c:

ncr_intr() protected by splbio()/splx()

Submitted by: wolf


# 6401 14-Feb-1995 se

ncr.c:

New config option "NCR_IOMAPPED" makes the driver use port I/O.
Put back in 53c815 defines, submitted by Mikael Hybsch <micke@dynas.se>.
These had got lost between cvs rev. 1.14 and now ...

pci.c:

Really write config space register.
Assign ports starting at 0xbc00.

Submitted by: wolf
Reviewed by: se


# 6398 14-Feb-1995 se

Verify that NCR was mapped to uncached address.

Submitted by: wolf@kintaro.cologne.de <Wolfgang Stanglmeier>


# 6363 14-Feb-1995 phk

YFfix.


# 6302 10-Feb-1995 se

Block interrupts in more places and warn about the NCR exception handler
being called at inappropriate times (should never happen !).

Reviewed by: se
Submitted by: wolf@kintaro.cologne.de (Wolfgang Stanglmeier)


# 6215 06-Feb-1995 se

Add short delay after NCR reset.

Submitted by: wolf@kintaro.cologne.de (Wolfgang Stanglmeier)


# 6179 04-Feb-1995 se

Disable I/O port accesses in case the BIOS enabled them.
Clear all output lines except ATN and ACK when waiting
for target phase change.

Submitted by: wolf (Wolfgang Stanglmeier)


# 6136 02-Feb-1995 se

Disable disconnect after drive timeouts, since these
may be the result of reselect following too fast for
the driver to notice. Not the final solution, but the
problem has been seen only with very few devices.

Reviewed by: se
Submitted by: wolf (Wolfgang Stanglmeier)


# 6132 02-Feb-1995 dg

Reapplied all of Stefan's changes. What a mess - the files were modified
and moved at the same time. This made it *very* difficult to fix the
revision log lossage that happend when the files were moved. SIGH.


# 6131 02-Feb-1995 dg

Fixed up include paths after copying these in the repository.


# 5545 12-Jan-1995 se

Submitted by: Mikael Hybsch <micke@dynas.se>

Add support for NCR 53c815 PCI SCSI chip.


# 4856 28-Nov-1994 se

Really deactivated the code that puts scsi stats into dk0.
This should have been disabled for some time, but I had screwed up ...
This made spurious values appear for fd0 in systat, when there was
NCR SCSI activity.


# 4000 29-Oct-1994 ats

Submitted by: Paul F. Werkowski
Add a quirk line for the SONY SDT-5000 like it is done for the WangDAT tapes.


# 3939 27-Oct-1994 se

Change some compile time defaults, which may be overridden from the
kernel config file by options lines.
Now the default settings are FAST SCSI, max. 4 TAGS, WIDE transfers,
if supported by the hardware ...


# 3599 14-Oct-1994 se

Submitted by: "Randall W. Dean" <rwd@osf.org>
Fixed typo in initialisation of DMODE:
PCI burst length now really 16 transfers as advertised ...


# 3552 12-Oct-1994 se

Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
Debugging option changed, getirr() removed.


# 3541 12-Oct-1994 se

Submitted by: Bruce Evans <bde@zeta.org.au>
Function getirr() could clobber interrupt controller state.


# 3533 12-Oct-1994 se

Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
Bug fixed, that caused system hang on first interrupt on some motherboards.

New version of PCI bus configuration code, now supports dynamic interrupt
configuration (using BIOS supplied values).
NCR SCSI and DEC Ethernet driver patched to use this feature.
*** Remove PCI IRQ specifications from your kernel config file ! ***


# 3166 28-Sep-1994 se

Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
New version with improved support for WIDE SCSI using the NCR 53c825.
Test for buggy secondary cache implementations.
PCI Int to IRQ mapping now specified per slot.


# 3043 24-Sep-1994 rgrimes

Add missing closing comment. I have taken the non-knf format
of this code up with the authors and they are looking at converting it,
but until then leave the format alone.


# 2826 16-Sep-1994 dg

Removed inclusion of pio.h and cpufunc.h (cpufunc.h is included from
systm.h). Merged functionality of pio.h into cpufunc.h. Cleaned up some
related code.


# 2814 15-Sep-1994 se

Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
New version with support for the NCR 53c810 and 53c825.
Support for WIDE SCSI devices.


# 2435 01-Sep-1994 se

Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
Merged in changes required for NetBSD support (by mycroft@gnu.ai.mit.edu)
and support for multiple NCR chips.


# 2433 31-Aug-1994 se

This commit was generated by cvs2svn to compensate for changes in r2432,
which included commits to RCS files with non-trunk default branches.


# 2432 31-Aug-1994 se

Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de> + Stefan Esser <se>
Directory for PCI autoconfigure and device driver code.