by default if it's usable, but falling back to I/O space if mem isn't usable.
If NCR_IOMAPPED is defined (default on the x86), prefer I/O space
then fall back to mem. Also, clean up the various memory consistency checks
so that they can deal with run-time determination of whether or not the
device is to be memory- or I/O-mapped.
Dave Huang <khym@bga.com>
Tested on alpha by cgd, tested on several i386 boxes. Certainly causes
no harm to the goddamned mess, but the NCR driver only works when you
perform voodoo rituals on it anyway.
This is what Dave said (in email) has been added to the driver:
----------------------------------------------------------------------
This seems to be the most significant change:
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)
----------------------------------------------------------------------
2841, plus some fixes to make the patches work on the Alpha. Seems to
improve the NCR driver a lot. We probably should try to incorporate
any updates that have happened since, too.
(This fixes problems with the printf format fixes i checked in yesterday.
ptrdiff_t is an 'int' on the i386 but a 'long' on the alpha, so the cast
really is necessary... *sigh*)
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
(1) use pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register, and bus_{io,mem}_map() to map it.
(2) use pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(5) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
- split softc size and match/attach out from cfdriver into
a new struct cfattach.
- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
assumes that pci_map_mem/pci_map_io provide interfaces which utilitize
bus_{io,mem}_handle_t's, or types which are compatible. This works on the
i386, and will change eventually anyway.)
for U_INT8, INT16, U_INT16 definitions. Convert structs and
definitions in ncr_reg.h (e.g. ncrcmd, the chip register layout, etc.)
to use these definitions.
Add INB_OFF, INL_OFF, and OUTL_OFF macros to access specified offsets into
I/O or memory space. Convert register dumps (etc.), and cache snoop
test to use these new macros, so that nothing accesses the device
I/O or memory space directly. (Register dumps now come from I/O space
if NCR_IOMAPPED. They used to bogusly use memory space.)
Add a new relocation type for script entries, RELOC_KVAR. Allow scripts
access to mono_time.tv_sec, mono_time, and ncr_cache via this
mechanism, and convert scripts to use it. An ncrcmd is only 32 bits
wide, and KVAs may be > 32 bits wide (e.g. on Alpha), leading to
linker problems. This is a safer way to do this anyway; relocation is
more deterministic this way, and doesn't rely on KVAs not looking like
other relocation types.
Panic if an unmatched relocation other than 'zero' is specified. That's
now a script bug. (This used to be used to convert KVAs of kernel
variables referenced in the script to PCI bus physical addresses,
and that is now handled by RELOC_KVAR relocations.)
Figure out and print the model of chip.