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
This commit is contained in:
Stefan Eßer 1995-02-14 23:33:38 +00:00
parent 628e3e3401
commit 9ddf96998e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6401
3 changed files with 59 additions and 13 deletions

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci.c,v 1.12 1995/02/09 20:20:33 se Exp $
** $Id: pci.c,v 1.9 1994/11/02 23:47:13 se Exp $
**
** General subroutines for the PCI bus on 80*86 systems.
** pci_configure ()
@ -124,7 +124,7 @@ static vm_offset_t pci_paddr = PCI_PMEM_START;
*/
#ifndef PCI_PORT_START
#define PCI_PORT_START 0x0400
#define PCI_PORT_START 0xbc00
#endif
static u_short pci_ioaddr = PCI_PORT_START;
@ -483,6 +483,12 @@ int pci_map_port (pcici_t tag, u_long reg, u_short* pa)
(unsigned) reg, (unsigned) pci_ioaddr, (unsigned) size);
#endif
/*
** set device address
*/
pcibus.pb_write (tag, reg, (u_long) pci_ioaddr);
/*
** return them to the driver
*/

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncr.c,v 1.21 1995/02/14 06:20:03 phk Exp $
** $Id: ncr.c,v 1.22 1995/02/14 22:48:01 se Exp $
**
** Device driver for the NCR 53C810 PCI-SCSI-Controller.
**
@ -44,7 +44,7 @@
***************************************************************************
*/
#define NCR_PATCHLEVEL "pl12 95/02/09"
#define NCR_PATCHLEVEL "pl13 95/02/09"
#define NCR_VERSION (2)
#define MAX_UNITS (16)
@ -244,6 +244,18 @@
**==========================================================
*/
#ifdef NCR_IOMAPPED
#define INB(r) inb (np->port + offsetof(struct ncr_reg, r))
#define INW(r) inw (np->port + offsetof(struct ncr_reg, r))
#define INL(r) inl (np->port + offsetof(struct ncr_reg, r))
#define OUTB(r, val) outb (np->port+offsetof(struct ncr_reg,r),(val))
#define OUTW(r, val) outw (np->port+offsetof(struct ncr_reg,r),(val))
#define OUTL(r, val) outl (np->port+offsetof(struct ncr_reg,r),(val))
#else
#define INB(r) (np->reg->r)
#define INW(r) (np->reg->r)
#define INL(r) (np->reg->r)
@ -252,6 +264,8 @@
#define OUTW(r, val) np->reg->r = val
#define OUTL(r, val) np->reg->r = val
#endif
/*==========================================================
**
** Command control block states.
@ -1079,6 +1093,7 @@ struct ncb {
** lockout of execption handler call while starting command.
*/
u_char lock;
u_short port;
};
/*==========================================================
@ -1228,7 +1243,7 @@ static void ncr_attach (pcici_t tag, int unit);
static char ident[] =
"\n$Id: ncr.c,v 1.21 1995/02/14 06:20:03 phk Exp $\n";
"\n$Id: ncr.c,v 1.22 1995/02/14 22:48:01 se Exp $\n";
u_long ncr_version = NCR_VERSION
+ (u_long) sizeof (struct ncb)
@ -1264,6 +1279,7 @@ static u_char rs_cmd [6] =
*/
#define NCR_810_ID (0x00011000ul)
#define NCR_815_ID (0x00041000ul)
#define NCR_825_ID (0x00031000ul)
#ifdef __NetBSD__
@ -3133,6 +3149,7 @@ ncr_probe(parent, self, aux)
if (!pci_targmatch(cf, pa))
return 0;
if (pa->pa_id != NCR_810_ID &&
pa->pa_id != NCR_815_ID &&
pa->pa_id != NCR_825_ID)
return 0;
@ -3149,6 +3166,9 @@ static char* ncr_probe (pcici_t tag, pcidi_t type)
case NCR_810_ID:
return ("ncr 53c810 scsi");
case NCR_815_ID:
return ("ncr 53c815 scsi");
case NCR_825_ID:
return ("ncr 53c825 wide scsi");
}
@ -3241,12 +3261,17 @@ static void ncr_attach (pcici_t config_id, int unit)
** devices bus master ability.
**
** DISABLEs:
** response to io addresses.
** response to io addresses (unless IOMAPPED)
** usage of "Write and invalidate" cycles.
*/
#ifdef NCR_IOMAPPED
(void) pci_conf_write (config_id, PCI_COMMAND_STATUS_REG,
PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_MASTER_ENABLE);
#else
(void) pci_conf_write (config_id, PCI_COMMAND_STATUS_REG,
PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_MASTER_ENABLE);
#endif
/*
** Try to map the controller chip to
@ -3256,6 +3281,15 @@ static void ncr_attach (pcici_t config_id, int unit)
if (!pci_map_mem (config_id, 0x14, &np->vaddr, &np->paddr))
return;
#ifdef NCR_IOMAPPED
/*
** Try to map the controller chip into iospace.
*/
if (!pci_map_port (config_id, 0x10, &np->port))
return;
#endif
#endif /* !__NetBSD__ */
/*
@ -3267,12 +3301,12 @@ static void ncr_attach (pcici_t config_id, int unit)
#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;
default:
np->maxwide = 0;
break;
}
/*
@ -6396,10 +6430,10 @@ static int ncr_scatter
**==========================================================
*/
#ifndef NCR_IOMAPPED
static int ncr_regtest (struct ncb* np)
{
register volatile u_long data, *addr;
#ifndef NCR_IOMAPPED
/*
** ncr registers may NOT be cached.
** write 0xffffffff to a read only register area,
@ -6419,8 +6453,8 @@ static int ncr_regtest (struct ncb* np)
return (0x10);
};
return (0);
#endif
}
#endif
static int ncr_snooptest (struct ncb* np)
{

View file

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: pci.c,v 1.12 1995/02/09 20:20:33 se Exp $
** $Id: pci.c,v 1.9 1994/11/02 23:47:13 se Exp $
**
** General subroutines for the PCI bus on 80*86 systems.
** pci_configure ()
@ -124,7 +124,7 @@ static vm_offset_t pci_paddr = PCI_PMEM_START;
*/
#ifndef PCI_PORT_START
#define PCI_PORT_START 0x0400
#define PCI_PORT_START 0xbc00
#endif
static u_short pci_ioaddr = PCI_PORT_START;
@ -483,6 +483,12 @@ int pci_map_port (pcici_t tag, u_long reg, u_short* pa)
(unsigned) reg, (unsigned) pci_ioaddr, (unsigned) size);
#endif
/*
** set device address
*/
pcibus.pb_write (tag, reg, (u_long) pci_ioaddr);
/*
** return them to the driver
*/