1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Add support for the SDL RISCom N2pci cards. Bring in the enhancements

made to the Arnet driver.
This commit is contained in:
John Hay 1996-10-29 03:53:21 +00:00
parent 4e1ccbd25d
commit ebcdcb982a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19242
8 changed files with 6784 additions and 2529 deletions

View File

@ -307,6 +307,7 @@ pci/if_fxp.c optional fxp device-driver
pci/if_lnc_p.c optional lnc device-driver
pci/if_pdq.c optional fea device-driver
pci/if_pdq.c optional fpa device-driver
pci/if_sr_p.c optional sr device-driver
pci/if_vx.c optional vx device-driver
pci/meteor.c optional meteor device-driver
pci/ncr.c optional ncr device-driver

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

133
sys/dev/sr/if_sr_pci.c Normal file
View File

@ -0,0 +1,133 @@
/*
* Copyright (c) 1996 John Hay.
* Copyright (c) 1996 SDL Communications, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
#include "pci.h"
#if NPCI > 0
#include "sr.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>
#ifndef BUGGY
#define BUGGY 0
#endif
/*
* The must match with the real functions in if_sr.c
*/
extern void *srattach_pci(int unit,
vm_offset_t plx_vaddr,
vm_offset_t sca_vaddr);
extern void srintr_hc(void *hc);
static char *sr_pci_probe(pcici_t tag, pcidi_t type);
static void sr_pci_attach(pcici_t config_id, int unit);
static u_long src_count = NSR;
struct pci_device sr_pci_driver =
{
"src",
sr_pci_probe,
sr_pci_attach,
&src_count,
NULL};
DATA_SET (pcidevice_set, sr_pci_driver);
static char *
sr_pci_probe(pcici_t tag, pcidi_t type)
{
switch(type) {
case 0x55684778:
return ("RISCom/N2pci");
break;
case 0x55684877:
/*
* XXX This can probably be removed sometime.
*/
return ("RISCom/N2pci (old id)");
break;
default:
break;
}
return (0);
}
static void
sr_pci_attach(pcici_t config_id, int unit)
{
void *hc;
#if BUGGY > 0
u_int *fecr;
#endif
vm_offset_t plx_vaddr, plx_paddr, sca_vaddr, sca_paddr;
#if BUGGY > 0
printf("srp: ID %x\n", pci_conf_read(config_id, 0));
printf("srp: BADR0 %x\n", pci_conf_read(config_id, 0x10));
printf("srp: BADR1 %x\n", pci_conf_read(config_id, 0x18));
#endif
if(!pci_map_mem(config_id, 0x10, &plx_vaddr, &plx_paddr)) {
printf("srp: map failed.\n");
return;
}
#if BUGGY > 0
printf("srp: vaddr %x, paddr %x\n", plx_vaddr, plx_paddr);
#endif
if(!pci_map_mem(config_id, 0x18, &sca_vaddr, &sca_paddr)) {
printf("srp: map failed.\n");
return;
}
#if BUGGY > 0
printf("srp: vaddr %x, paddr %x\n", sca_vaddr, sca_paddr);
fecr = (u_int *)(sca_vaddr + 0x200);
printf("srp: FECR %x\n", *fecr);
#endif
hc = srattach_pci(unit, plx_vaddr, sca_vaddr);
if(!hc)
return;
if(!pci_map_int(config_id, srintr_hc, (void *)hc, &net_imask)) {
free(hc, M_DEVBUF);
return;
}
}
#endif /* NPCI > 0 */

View File

@ -1,5 +1,7 @@
/*
* Copyright (c) 1995 John Hay. All rights reserved.
* Copyright (c) 1995 John Hay.
* Copyright (c) 1996 SDL Communications, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -9,18 +11,14 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by [your name]
* and [any other names deserving credit ]
* 4. Neither the name of the author nor the names of any co-contributors
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -29,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: if_srregs.h,v 1.1 1996/07/05 18:49:22 jhay Exp $
*/
#ifndef _IF_SRREGS_H_
#define _IF_SRREGS_H_
@ -38,6 +36,13 @@
#define SR_BUF_SIZ 512
#define SR_TX_BLOCKS 2 /* Sepperate sets of tx buffers */
#define SR_CRD_N2 1
#define SR_CRD_N2PCI 2
/*
* RISCom/N2 ISA card.
*/
#define SRC_IO_SIZ 0x10 /* Actually a lie. It uses a lot more. */
#define SRC_WIN_SIZ 0x00004000
#define SRC_WIN_MSK (SRC_WIN_SIZ - 1)
@ -88,4 +93,31 @@
#define SR_MCR_ETC0 0x40 /* Enable Ext Clock out */
#define SR_MCR_ETC1 0x80 /* Enable Ext Clock out */
/*
* RISCom/N2 PCI card.
*/
#define SR_FECR 0x0200 /* Front End Control Register */
#define SR_FECR_ETC0 0x0001 /* Enable Ext Clock out */
#define SR_FECR_ETC1 0x0002 /* Enable Ext Clock out */
#define SR_FECR_TE0 0x0004 /* Enable RS422 TXD */
#define SR_FECR_TE1 0x0008 /* Enable RS422 TXD */
#define SR_FECR_GPO0 0x0010 /* General Purpose Output */
#define SR_FECR_GPO1 0x0020 /* General Purpose Output */
#define SR_FECR_DTR0 0x0040 /* 0 for active, 1 for inactive */
#define SR_FECR_DTR1 0x0080 /* 0 for active, 1 for inactive */
#define SR_FECR_DSR0 0x0100 /* DSR0 Status */
#define SR_FECR_ID0 0x0E00 /* ID of channel 0 */
#define SR_FECR_DSR1 0x1000 /* DSR1 Status */
#define SR_FECR_ID1 0xE000 /* ID of channel 1 */
#define SR_FE_ID_V35 0x00 /* V.35 Interface */
#define SR_FE_ID_RS232 0x01 /* RS232 Interface */
#define SR_FE_ID_TEST 0x02 /* Test Board */
#define SR_FE_ID_RS422 0x03 /* RS422 Interface */
#define SR_FE_ID_HSSI 0x05 /* HSSI Interface */
#define SR_FE_ID_X21 0x06 /* X.21 Interface */
#define SR_FE_ID_NONE 0x07 /* No card present */
#define SR_FE_ID0_SHFT 9
#define SR_FE_ID1_SHFT 13
#endif /* _IF_SRREGS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
/*
* Copyright (c) 1995 John Hay. All rights reserved.
* Copyright (c) 1995 John Hay.
* Copyright (c) 1996 SDL Communications, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -9,18 +11,14 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by [your name]
* and [any other names deserving credit ]
* 4. Neither the name of the author nor the names of any co-contributors
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@ -29,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: if_srregs.h,v 1.1 1996/07/05 18:49:22 jhay Exp $
*/
#ifndef _IF_SRREGS_H_
#define _IF_SRREGS_H_
@ -38,6 +36,13 @@
#define SR_BUF_SIZ 512
#define SR_TX_BLOCKS 2 /* Sepperate sets of tx buffers */
#define SR_CRD_N2 1
#define SR_CRD_N2PCI 2
/*
* RISCom/N2 ISA card.
*/
#define SRC_IO_SIZ 0x10 /* Actually a lie. It uses a lot more. */
#define SRC_WIN_SIZ 0x00004000
#define SRC_WIN_MSK (SRC_WIN_SIZ - 1)
@ -88,4 +93,31 @@
#define SR_MCR_ETC0 0x40 /* Enable Ext Clock out */
#define SR_MCR_ETC1 0x80 /* Enable Ext Clock out */
/*
* RISCom/N2 PCI card.
*/
#define SR_FECR 0x0200 /* Front End Control Register */
#define SR_FECR_ETC0 0x0001 /* Enable Ext Clock out */
#define SR_FECR_ETC1 0x0002 /* Enable Ext Clock out */
#define SR_FECR_TE0 0x0004 /* Enable RS422 TXD */
#define SR_FECR_TE1 0x0008 /* Enable RS422 TXD */
#define SR_FECR_GPO0 0x0010 /* General Purpose Output */
#define SR_FECR_GPO1 0x0020 /* General Purpose Output */
#define SR_FECR_DTR0 0x0040 /* 0 for active, 1 for inactive */
#define SR_FECR_DTR1 0x0080 /* 0 for active, 1 for inactive */
#define SR_FECR_DSR0 0x0100 /* DSR0 Status */
#define SR_FECR_ID0 0x0E00 /* ID of channel 0 */
#define SR_FECR_DSR1 0x1000 /* DSR1 Status */
#define SR_FECR_ID1 0xE000 /* ID of channel 1 */
#define SR_FE_ID_V35 0x00 /* V.35 Interface */
#define SR_FE_ID_RS232 0x01 /* RS232 Interface */
#define SR_FE_ID_TEST 0x02 /* Test Board */
#define SR_FE_ID_RS422 0x03 /* RS422 Interface */
#define SR_FE_ID_HSSI 0x05 /* HSSI Interface */
#define SR_FE_ID_X21 0x06 /* X.21 Interface */
#define SR_FE_ID_NONE 0x07 /* No card present */
#define SR_FE_ID0_SHFT 9
#define SR_FE_ID1_SHFT 13
#endif /* _IF_SRREGS_H_ */

133
sys/pci/if_sr_p.c Normal file
View File

@ -0,0 +1,133 @@
/*
* Copyright (c) 1996 John Hay.
* Copyright (c) 1996 SDL Communications, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
#include "pci.h"
#if NPCI > 0
#include "sr.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>
#ifndef BUGGY
#define BUGGY 0
#endif
/*
* The must match with the real functions in if_sr.c
*/
extern void *srattach_pci(int unit,
vm_offset_t plx_vaddr,
vm_offset_t sca_vaddr);
extern void srintr_hc(void *hc);
static char *sr_pci_probe(pcici_t tag, pcidi_t type);
static void sr_pci_attach(pcici_t config_id, int unit);
static u_long src_count = NSR;
struct pci_device sr_pci_driver =
{
"src",
sr_pci_probe,
sr_pci_attach,
&src_count,
NULL};
DATA_SET (pcidevice_set, sr_pci_driver);
static char *
sr_pci_probe(pcici_t tag, pcidi_t type)
{
switch(type) {
case 0x55684778:
return ("RISCom/N2pci");
break;
case 0x55684877:
/*
* XXX This can probably be removed sometime.
*/
return ("RISCom/N2pci (old id)");
break;
default:
break;
}
return (0);
}
static void
sr_pci_attach(pcici_t config_id, int unit)
{
void *hc;
#if BUGGY > 0
u_int *fecr;
#endif
vm_offset_t plx_vaddr, plx_paddr, sca_vaddr, sca_paddr;
#if BUGGY > 0
printf("srp: ID %x\n", pci_conf_read(config_id, 0));
printf("srp: BADR0 %x\n", pci_conf_read(config_id, 0x10));
printf("srp: BADR1 %x\n", pci_conf_read(config_id, 0x18));
#endif
if(!pci_map_mem(config_id, 0x10, &plx_vaddr, &plx_paddr)) {
printf("srp: map failed.\n");
return;
}
#if BUGGY > 0
printf("srp: vaddr %x, paddr %x\n", plx_vaddr, plx_paddr);
#endif
if(!pci_map_mem(config_id, 0x18, &sca_vaddr, &sca_paddr)) {
printf("srp: map failed.\n");
return;
}
#if BUGGY > 0
printf("srp: vaddr %x, paddr %x\n", sca_vaddr, sca_paddr);
fecr = (u_int *)(sca_vaddr + 0x200);
printf("srp: FECR %x\n", *fecr);
#endif
hc = srattach_pci(unit, plx_vaddr, sca_vaddr);
if(!hc)
return;
if(!pci_map_int(config_id, srintr_hc, (void *)hc, &net_imask)) {
free(hc, M_DEVBUF);
return;
}
}
#endif /* NPCI > 0 */