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.
This commit is contained in:
Stefan Eßer 1994-09-28 16:34:13 +00:00
parent 5d72c1c4ef
commit 799e5f277f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3166
13 changed files with 339 additions and 74 deletions

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci.c,v 2.0.0.12 94/09/15 20:49:23 wolf Exp $
** $Id: pci.c,v 2.1 94/09/16 08:01:20 wolf Rel $
**
** General subroutines for the PCI bus on 80*86 systems.
** pci_configure ()
@ -77,10 +77,6 @@
#include <i386/pci/pci_device.h>
#include <i386/pci/pcibios.h>
char ident_pci_c[] =
"\n$Id: pci.c,v 2.0.0.12 94/09/15 20:49:23 wolf Exp $\n";
/*
** Function prototypes missing in system headers
*/

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncr.c,v 1.4 1994/09/16 13:33:56 davidg Exp $
** $Id: ncr.c,v 1.5 1994/09/24 02:42:11 rgrimes Exp $
**
** Device driver for the NCR 53C810 PCI-SCSI-Controller.
**
@ -1173,6 +1173,7 @@ struct script {
ncrcmd data_out [MAX_SCATTER * 4 + 7];
ncrcmd aborttag [ 4];
ncrcmd abort [ 20];
ncrcmd snooptest [ 11];
};
/*==========================================================
@ -1213,6 +1214,7 @@ static void ncr_setsync (ncb_p np, ccb_p cp, u_char sxfer);
static void ncr_settags (tcb_p tp, lcb_p lp);
static void ncr_setwide (ncb_p np, ccb_p cp, u_char wide);
static int ncr_show_msg (u_char * msg);
static int ncr_snooptest (ncb_p np);
static INT32 ncr_start (struct scsi_xfer *xp);
static void ncr_timeout (ncb_p np);
static void ncr_usercmd (ncb_p np);
@ -1239,14 +1241,42 @@ static int ncr_intr (int dev);
#ifdef DIRTY
#ifdef __NetBSD__
#include <i386/include/cpufunc.h>
#ifdef __NetBSD__
#include <i386/include/pio.h>
#include <i386/isa/isareg.h>
#define DELAY(x) delay(x)
#else /* !__NetBSD__ */
#include <i386/isa/isa.h>
#ifdef ANCIENT
/*
** Doch das ist alles nur geklaut ..
** aus: 386bsd:/sys/i386/include/pio.h
**
** Mach Operating System
** Copyright (c) 1990 Carnegie-Mellon University
** All rights reserved. The CMU software License Agreement specifies
** the terms and conditions for use and redistribution.
*/
#undef inb
#define inb(port) \
({ unsigned char data; \
__asm __volatile("inb %1, %0": "=a" (data): "d" ((u_short)(port))); \
data; })
#undef outb
#define outb(port, data) \
{__asm __volatile("outb %0, %1"::"a" ((u_char)(data)), "d" ((u_short)(port)));}
#define disable_intr() \
{__asm __volatile("cli");}
#define enable_intr() \
{__asm __volatile("sti");}
#endif /* ANCIENT */
/*------------------------------------------------------------------
**
@ -1312,6 +1342,8 @@ u_long nncr=NNCR;
ncb_p ncrp [NNCR];
#endif
int ncr_cache; /* may _NOT_ be static */
/*
** SCSI cmd to get the SCSI sense data
*/
@ -1328,6 +1360,9 @@ static u_char rs_cmd [6] =
**==========================================================
*/
#define NCR_810_ID (0x00011000ul)
#define NCR_825_ID (0x00031000ul)
#ifdef __NetBSD__
struct cfdriver ncrcd = {
@ -1339,7 +1374,7 @@ struct cfdriver ncrcd = {
struct pci_driver ncr810_device = {
ncr_probe,
ncr_attach,
0x00011000ul,
NCR_810_ID,
"ncr 53c810 scsi",
ncr_intr
};
@ -1347,7 +1382,7 @@ struct pci_driver ncr810_device = {
struct pci_driver ncr825_device = {
ncr_probe,
ncr_attach,
0x00031000ul,
NCR_825_ID,
"ncr 53c825 scsi",
ncr_intr
};
@ -2909,6 +2944,30 @@ static struct script script0 = {
0,
SCR_JUMP,
PADDR (start),
}/*-------------------------< SNOOPTEST >-------------------*/,{
/*
** Read the variable.
*/
SCR_COPY (4),
(ncrcmd) &ncr_cache,
RADDR (scratcha),
/*
** Write the variable.
*/
SCR_COPY (4),
RADDR (temp),
(ncrcmd) &ncr_cache,
/*
** Read back the variable.
*/
SCR_COPY (4),
(ncrcmd) &ncr_cache,
RADDR (temp),
/*
** And stop.
*/
SCR_INT,
99,
}/*--------------------------------------------------------*/
};
@ -3177,8 +3236,9 @@ ncr_probe(parent, self, aux)
if (!pci_targmatch(cf, pa))
return 0;
if ((pa->pa_id & ~0x20000) != 0x00011000)
return 0;
if (pa->pa_id != NCR_810_ID &&
pa->pa_id != NCR_825_ID)
return 0;
return 1;
}
@ -3287,8 +3347,18 @@ static int ncr_attach (pcici_t config_id)
** Do chip dependent initialization.
*/
if (pci_conf_read (config_id, PCI_ID_REG)==0x00031000)
#ifdef __NetBSD__
switch (pa->pa_id) {
#else
switch (pci_conf_read (config_id, PCI_ID_REG)) {
#endif
case NCR_810_ID:
np->maxwide = 0;
break;
case NCR_825_ID:
np->maxwide = 1;
break;
}
/*
** Patch script to physical addresses
@ -3333,6 +3403,15 @@ static int ncr_attach (pcici_t config_id)
OUTB (nc_istat, SRST);
OUTB (nc_istat, 0 );
/*
** Now check the cache handling of the pci chipset.
*/
if (ncr_snooptest (np)) {
printf ("CACHE INCORRECTLY CONFIGURED.\n");
return (0);
};
/*
** After SCSI devices have been opened, we cannot
** reset the bus safely, so we do it here.
@ -3352,7 +3431,7 @@ static int ncr_attach (pcici_t config_id)
ncr_name (np));
DELAY (1000000);
#endif
printf ("%s scanning for targets 0..%d ($Revision: 1.4 $)\n",
printf ("%s scanning for targets 0..%d ($Revision: 1.5 $)\n",
ncr_name (np), MAX_TARGET-1);
/*
@ -3740,7 +3819,6 @@ static INT32 ncr_start (struct scsi_xfer * xp)
case M_SIMPLE_TAG:
case M_ORDERED_TAG:
cp -> scsi_smsg [msglen] = np->order;
cp -> scsi_smsg [msglen] = M_ORDERED_TAG;
};
msglen++;
cp -> scsi_smsg [msglen++] = cp -> tag;
@ -6398,6 +6476,71 @@ static int ncr_scatter
/*==========================================================
**
**
** Test the pci bus snoop logic :-(
**
** Has to be called with disabled interupts.
**
**
**==========================================================
*/
static int ncr_snooptest (struct ncb* np)
{
u_long ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc, err=0;
/*
** init
*/
pc = vtophys (&np->script->snooptest);
host_wr = 1;
ncr_wr = 2;
/*
** Set memory and register.
*/
ncr_cache = host_wr;
OUTL (nc_temp, ncr_wr);
/*
** Start script (exchange values)
*/
OUTL (nc_dsp, pc);
/*
** Wait 'til done
*/
while (!(INB(nc_istat) & (INTF|SIP|DIP)));
/*
** Read memory and register.
*/
host_rd = ncr_cache;
ncr_rd = INL (nc_scratcha);
ncr_bk = INL (nc_temp);
/*
** Reset ncr chip
*/
OUTB (nc_istat, SRST);
OUTB (nc_istat, 0 );
/*
** Show results.
*/
if (host_wr != ncr_rd) {
printf ("CACHE TEST FAILED: host wrote %d, ncr read %d.\n",
host_wr, ncr_rd);
err |= 1;
};
if (host_rd != ncr_wr) {
printf ("CACHE TEST FAILED: ncr wrote %d, host read %d.\n",
ncr_wr, host_rd);
err |= 2;
};
if (ncr_bk != ncr_wr) {
printf ("CACHE TEST FAILED: ncr wrote %d, read back %d.\n",
ncr_wr, ncr_bk);
err |= 4;
};
return (err);
}
/*==========================================================
**
**
** Profiling the drivers and targets performance.
**
**

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncr_reg.h,v 2.0.0.8 94/09/11 22:04:58 wolf Exp $
** $Id: ncr_reg.h,v 2.1 94/09/16 08:01:34 wolf Rel $
**
** Device driver for the NCR 53C810 PCI-SCSI-Controller.
**

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncrstat.c,v 2.0.0.9 94/09/11 22:12:21 wolf Exp $
** $Id: ncrstat.c,v 2.0.0.10 94/09/16 09:38:24 wolf Exp $
**
** Utility for NCR 53C810 device driver.
**
@ -55,24 +55,20 @@
#include <errno.h>
#include <paths.h>
#include <limits.h>
#include <kvm.h>
#include <i386/pci/ncr.c>
/*
** used external functions
*/
#ifdef __NetBSD__
#include <kvm.h>
#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
kvm_t *kvm;
#define KVM_NLIST(n) (kvm_nlist(kvm, (n)) >= 0)
#define KVM_READ(o, p, l) (kvm_read(kvm, (o), (p), (l)) == (l))
#define KVM_READ(o, p, l) (kvm_read(kvm, (o), (void*)(p), (l)) == (l))
#else
extern int kvm_openfiles();
extern int kvm_nlist();
extern char* kvm_geterr();
extern int kvm_read();
#define KVM_NLIST(n) (kvm_nlist((n)) >= 0)
#define KVM_READ(o, p, l) (kvm_read((o), (p), (l)) == (l))
#define KVM_READ(o, p, l) (kvm_read((void*)(o), (p), (l)) == (l))
#endif
extern void exit();
@ -143,7 +139,7 @@ read_ccb(u_long base)
{
ccb_base = base;
if (!KVM_READ (
(void*)base,
base,
&ccb,
sizeof (struct ccb))) {
fprintf (stderr, "%s: bad kvm read at %x.\n", prog, base);
@ -155,7 +151,7 @@ read_lcb(u_long base)
{
lcb_base = base;
if (!KVM_READ (
(void*)base,
base,
&lcb,
sizeof (struct lcb))) {
fprintf (stderr, "%s: bad kvm read at %x.\n", prog, base);
@ -166,7 +162,7 @@ read_lcb(u_long base)
read_ncr()
{
if (!KVM_READ (
(void*)ncr_base,
ncr_base,
&ncr,
sizeof (ncr))) {
fprintf (stderr, "%s: bad kvm read at %x.\n", prog, ncr_base);
@ -178,13 +174,13 @@ void open_kvm(int flags)
{
int i;
u_long kernel_version;
#ifdef __NetBSD__
#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
char errbuf[_POSIX2_LINE_MAX];
#endif
if (kvm_isopen) return;
#ifdef __NetBSD__
#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
kvm = kvm_openfiles(vmunix, kmemf, NULL, flags, errbuf);
if (kvm == NULL) {
fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, errbuf);
@ -211,7 +207,7 @@ void open_kvm(int flags)
}
if (!KVM_READ (
(void*)nl[N_NCR_VERSION].n_value,
nl[N_NCR_VERSION].n_value,
&kernel_version,
sizeof (kernel_version))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -227,7 +223,7 @@ void open_kvm(int flags)
#ifdef __NetBSD__
if (!KVM_READ (
(void*)nl[N_NCRCD].n_value,
nl[N_NCRCD].n_value,
&ncrcd,
sizeof (ncrcd))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -241,7 +237,7 @@ void open_kvm(int flags)
};
if (!KVM_READ (
(void*)ncrcd.cd_devs+4*ncr_unit,
ncrcd.cd_devs+4*ncr_unit,
&ncr_base,
sizeof (ncr_base))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -257,7 +253,7 @@ void open_kvm(int flags)
#else /* !__NetBSD__ */
if (!KVM_READ (
(void*)nl[N_NNCR].n_value,
nl[N_NNCR].n_value,
&ncr_units,
sizeof (ncr_units))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -271,7 +267,7 @@ void open_kvm(int flags)
};
if (!KVM_READ (
(void*)nl[N_NCRP].n_value+4*ncr_unit,
nl[N_NCRP].n_value+4*ncr_unit,
&ncr_base,
sizeof (ncr_base))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -662,7 +658,7 @@ u_char in (u_char reg)
{
u_char res;
if (!KVM_READ (
(void*)(ncr.vaddr + reg),
(ncr.vaddr + reg),
&res,
1)) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -691,7 +687,7 @@ void do_set (char * arg)
for (i=3; i; i--) {
if (!KVM_READ (
(void*)(addr),
(addr),
&user,
sizeof (user))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -1220,7 +1216,7 @@ static void dump_lcb (u_long base)
printf ("----------------------\n");
if (!KVM_READ (
(void*)base,
base,
&l,
sizeof (struct lcb))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -1241,7 +1237,7 @@ static void dump_lcb (u_long base)
cn++;
printf ("ccb #%d:\n", cn);
if (!KVM_READ (
(void*)cp,
cp,
&c,
sizeof (struct ccb))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -1321,7 +1317,7 @@ static void dump_ncr (void)
struct ncr_reg reg;
if (!KVM_READ (
(void*)ncr.vaddr,
ncr.vaddr,
&reg,
sizeof (reg))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);
@ -1357,7 +1353,7 @@ static void dump_ncr (void)
u_long startpos;
if (!KVM_READ (
(void*)((u_long)ncr.script
((u_long)ncr.script
+offsetof(struct script, startpos)),
&startpos,
sizeof (startpos))) {
@ -1457,7 +1453,7 @@ do_debug(char * arg)
if (strchr (debug_opt, 'r')) {
struct ncr_reg reg;
if (!KVM_READ (
(void*)ncr.vaddr,
ncr.vaddr,
&reg,
sizeof (reg))) {
fprintf (stderr, "%s: bad kvm read.\n", prog);

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci.c,v 2.0.0.12 94/09/15 20:49:23 wolf Exp $
** $Id: pci.c,v 2.1 94/09/16 08:01:20 wolf Rel $
**
** General subroutines for the PCI bus on 80*86 systems.
** pci_configure ()
@ -77,10 +77,6 @@
#include <i386/pci/pci_device.h>
#include <i386/pci/pcibios.h>
char ident_pci_c[] =
"\n$Id: pci.c,v 2.0.0.12 94/09/15 20:49:23 wolf Exp $\n";
/*
** Function prototypes missing in system headers
*/

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci.h,v 2.0.0.1 94/08/18 23:09:26 wolf Exp $
** $Id: pci.h,v 2.1 94/09/16 08:01:35 wolf Rel $
**
** #define for pci bus device drivers
**

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci_config.c,v 2.0.0.4 94/09/15 20:57:49 wolf Exp $
** $Id: pci_config.c,v 2.1 94/09/16 08:01:25 wolf Rel $
**
** @PCI@ this should be part of "ioconf.c".
**

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci_device.h,v 2.0.0.3 94/09/15 19:23:53 wolf Exp $
** $Id: pci_device.h,v 2.1 94/09/16 08:01:36 wolf Rel $
**
** #define for pci based device drivers
**

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci_intel.c,v 1.2 94/09/15 21:01:52 wolf Exp $
** $Id: pci_intel.c,v 2.1 94/09/16 08:02:42 wolf Rel $
**
** Device driver for INTEL PCI chipsets.
**
@ -244,7 +244,7 @@ int probe1(pcici_t config_id)
static char confread (pcici_t config_id, int port)
{
unsigned long portw = port & -3;
unsigned long portw = port & ~3;
unsigned long ports = (port - portw) << 3;
unsigned long l = pci_conf_read (config_id, portw);

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pcibios.c,v 2.0.0.2 94/08/18 23:04:11 wolf Exp $
** $Id: pcibios.c,v 2.1 94/09/16 08:01:26 wolf Rel $
**
** #define for pci-bus bios functions.
**
@ -40,26 +40,21 @@
#include "i386/isa/isa.h"
#include "i386/pci/pci.h"
#include "i386/pci/pcibios.h"
#include "i386/include/cpufunc.h"
extern int printf();
static char pci_mode;
char ident_pcibios_c[] =
"\n$Id: pcibios.c,v 2.0.0.2 94/08/18 23:04:11 wolf Exp $\n";
/*--------------------------------------------------------------------
**
** Port access
**
**--------------------------------------------------------------------
**
** @FREEBSD@ inl() and outl() functions are not defined
*/
#define DIRTY
#undef DIRTY
#ifdef DIRTY

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pcibios.h,v 2.0.0.2 94/09/15 19:55:26 wolf Exp $
** $Id: pcibios.h,v 2.1 94/09/16 08:01:37 wolf Rel $
**
** #define for pci-bus bios functions.
** #define for pci configuration space registers.

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncr.c,v 1.4 1994/09/16 13:33:56 davidg Exp $
** $Id: ncr.c,v 1.5 1994/09/24 02:42:11 rgrimes Exp $
**
** Device driver for the NCR 53C810 PCI-SCSI-Controller.
**
@ -1173,6 +1173,7 @@ struct script {
ncrcmd data_out [MAX_SCATTER * 4 + 7];
ncrcmd aborttag [ 4];
ncrcmd abort [ 20];
ncrcmd snooptest [ 11];
};
/*==========================================================
@ -1213,6 +1214,7 @@ static void ncr_setsync (ncb_p np, ccb_p cp, u_char sxfer);
static void ncr_settags (tcb_p tp, lcb_p lp);
static void ncr_setwide (ncb_p np, ccb_p cp, u_char wide);
static int ncr_show_msg (u_char * msg);
static int ncr_snooptest (ncb_p np);
static INT32 ncr_start (struct scsi_xfer *xp);
static void ncr_timeout (ncb_p np);
static void ncr_usercmd (ncb_p np);
@ -1239,14 +1241,42 @@ static int ncr_intr (int dev);
#ifdef DIRTY
#ifdef __NetBSD__
#include <i386/include/cpufunc.h>
#ifdef __NetBSD__
#include <i386/include/pio.h>
#include <i386/isa/isareg.h>
#define DELAY(x) delay(x)
#else /* !__NetBSD__ */
#include <i386/isa/isa.h>
#ifdef ANCIENT
/*
** Doch das ist alles nur geklaut ..
** aus: 386bsd:/sys/i386/include/pio.h
**
** Mach Operating System
** Copyright (c) 1990 Carnegie-Mellon University
** All rights reserved. The CMU software License Agreement specifies
** the terms and conditions for use and redistribution.
*/
#undef inb
#define inb(port) \
({ unsigned char data; \
__asm __volatile("inb %1, %0": "=a" (data): "d" ((u_short)(port))); \
data; })
#undef outb
#define outb(port, data) \
{__asm __volatile("outb %0, %1"::"a" ((u_char)(data)), "d" ((u_short)(port)));}
#define disable_intr() \
{__asm __volatile("cli");}
#define enable_intr() \
{__asm __volatile("sti");}
#endif /* ANCIENT */
/*------------------------------------------------------------------
**
@ -1312,6 +1342,8 @@ u_long nncr=NNCR;
ncb_p ncrp [NNCR];
#endif
int ncr_cache; /* may _NOT_ be static */
/*
** SCSI cmd to get the SCSI sense data
*/
@ -1328,6 +1360,9 @@ static u_char rs_cmd [6] =
**==========================================================
*/
#define NCR_810_ID (0x00011000ul)
#define NCR_825_ID (0x00031000ul)
#ifdef __NetBSD__
struct cfdriver ncrcd = {
@ -1339,7 +1374,7 @@ struct cfdriver ncrcd = {
struct pci_driver ncr810_device = {
ncr_probe,
ncr_attach,
0x00011000ul,
NCR_810_ID,
"ncr 53c810 scsi",
ncr_intr
};
@ -1347,7 +1382,7 @@ struct pci_driver ncr810_device = {
struct pci_driver ncr825_device = {
ncr_probe,
ncr_attach,
0x00031000ul,
NCR_825_ID,
"ncr 53c825 scsi",
ncr_intr
};
@ -2909,6 +2944,30 @@ static struct script script0 = {
0,
SCR_JUMP,
PADDR (start),
}/*-------------------------< SNOOPTEST >-------------------*/,{
/*
** Read the variable.
*/
SCR_COPY (4),
(ncrcmd) &ncr_cache,
RADDR (scratcha),
/*
** Write the variable.
*/
SCR_COPY (4),
RADDR (temp),
(ncrcmd) &ncr_cache,
/*
** Read back the variable.
*/
SCR_COPY (4),
(ncrcmd) &ncr_cache,
RADDR (temp),
/*
** And stop.
*/
SCR_INT,
99,
}/*--------------------------------------------------------*/
};
@ -3177,8 +3236,9 @@ ncr_probe(parent, self, aux)
if (!pci_targmatch(cf, pa))
return 0;
if ((pa->pa_id & ~0x20000) != 0x00011000)
return 0;
if (pa->pa_id != NCR_810_ID &&
pa->pa_id != NCR_825_ID)
return 0;
return 1;
}
@ -3287,8 +3347,18 @@ static int ncr_attach (pcici_t config_id)
** Do chip dependent initialization.
*/
if (pci_conf_read (config_id, PCI_ID_REG)==0x00031000)
#ifdef __NetBSD__
switch (pa->pa_id) {
#else
switch (pci_conf_read (config_id, PCI_ID_REG)) {
#endif
case NCR_810_ID:
np->maxwide = 0;
break;
case NCR_825_ID:
np->maxwide = 1;
break;
}
/*
** Patch script to physical addresses
@ -3333,6 +3403,15 @@ static int ncr_attach (pcici_t config_id)
OUTB (nc_istat, SRST);
OUTB (nc_istat, 0 );
/*
** Now check the cache handling of the pci chipset.
*/
if (ncr_snooptest (np)) {
printf ("CACHE INCORRECTLY CONFIGURED.\n");
return (0);
};
/*
** After SCSI devices have been opened, we cannot
** reset the bus safely, so we do it here.
@ -3352,7 +3431,7 @@ static int ncr_attach (pcici_t config_id)
ncr_name (np));
DELAY (1000000);
#endif
printf ("%s scanning for targets 0..%d ($Revision: 1.4 $)\n",
printf ("%s scanning for targets 0..%d ($Revision: 1.5 $)\n",
ncr_name (np), MAX_TARGET-1);
/*
@ -3740,7 +3819,6 @@ static INT32 ncr_start (struct scsi_xfer * xp)
case M_SIMPLE_TAG:
case M_ORDERED_TAG:
cp -> scsi_smsg [msglen] = np->order;
cp -> scsi_smsg [msglen] = M_ORDERED_TAG;
};
msglen++;
cp -> scsi_smsg [msglen++] = cp -> tag;
@ -6398,6 +6476,71 @@ static int ncr_scatter
/*==========================================================
**
**
** Test the pci bus snoop logic :-(
**
** Has to be called with disabled interupts.
**
**
**==========================================================
*/
static int ncr_snooptest (struct ncb* np)
{
u_long ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc, err=0;
/*
** init
*/
pc = vtophys (&np->script->snooptest);
host_wr = 1;
ncr_wr = 2;
/*
** Set memory and register.
*/
ncr_cache = host_wr;
OUTL (nc_temp, ncr_wr);
/*
** Start script (exchange values)
*/
OUTL (nc_dsp, pc);
/*
** Wait 'til done
*/
while (!(INB(nc_istat) & (INTF|SIP|DIP)));
/*
** Read memory and register.
*/
host_rd = ncr_cache;
ncr_rd = INL (nc_scratcha);
ncr_bk = INL (nc_temp);
/*
** Reset ncr chip
*/
OUTB (nc_istat, SRST);
OUTB (nc_istat, 0 );
/*
** Show results.
*/
if (host_wr != ncr_rd) {
printf ("CACHE TEST FAILED: host wrote %d, ncr read %d.\n",
host_wr, ncr_rd);
err |= 1;
};
if (host_rd != ncr_wr) {
printf ("CACHE TEST FAILED: ncr wrote %d, host read %d.\n",
ncr_wr, host_rd);
err |= 2;
};
if (ncr_bk != ncr_wr) {
printf ("CACHE TEST FAILED: ncr wrote %d, read back %d.\n",
ncr_wr, ncr_bk);
err |= 4;
};
return (err);
}
/*==========================================================
**
**
** Profiling the drivers and targets performance.
**
**

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci.c,v 2.0.0.12 94/09/15 20:49:23 wolf Exp $
** $Id: pci.c,v 2.1 94/09/16 08:01:20 wolf Rel $
**
** General subroutines for the PCI bus on 80*86 systems.
** pci_configure ()
@ -77,10 +77,6 @@
#include <i386/pci/pci_device.h>
#include <i386/pci/pcibios.h>
char ident_pci_c[] =
"\n$Id: pci.c,v 2.0.0.12 94/09/15 20:49:23 wolf Exp $\n";
/*
** Function prototypes missing in system headers
*/