Add support for the PCI version of the Digi SYNC/570i cards.

This commit is contained in:
John Hay 1999-10-17 09:40:04 +00:00
parent 9091387f87
commit 9c21293f55
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52328
8 changed files with 1676 additions and 512 deletions

View file

@ -658,6 +658,7 @@ dev/bktr/bktr_os.c optional bktr pci
pci/cy_pci.c optional cy pci
pci/ida_pci.c optional ida pci
pci/if_al.c optional al
pci/if_ar_p.c optional ar pci
pci/if_ax.c optional ax
pci/if_de.c optional de
pci/if_dm.c optional dm

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

117
sys/dev/ar/if_ar_pci.c Normal file
View file

@ -0,0 +1,117 @@
/*
* Copyright (c) 1999 John Hay.
* 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.
*
* $FreeBSD$
*/
#include "ar.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <pci/pcivar.h>
/*
* The must match with the real functions in if_ar.c
*/
extern void *arattach_pci(int unit, vm_offset_t mem_vaddr);
extern void arintr_hc(void *hc);
static const char *ar_pci_probe(pcici_t tag, pcidi_t type);
static void ar_pci_attach(pcici_t config_id, int unit);
static u_long arc_count = NAR;
static struct pci_device ar_pci_driver =
{
"ar",
ar_pci_probe,
ar_pci_attach,
&arc_count,
NULL
};
COMPAT_PCI_DRIVER (ar_pci, ar_pci_driver);
static const char *
ar_pci_probe(pcici_t tag, pcidi_t type)
{
switch(type) {
case 0x5012114f:
return ("Digi SYNC/570i-PCI 2 port");
break;
case 0x5010114f:
printf("Digi SYNC/570i-PCI 2 port (mapped below 1M)\n");
printf("Please change the jumper to select linear mode.\n");
break;
case 0x5013114f:
return ("Digi SYNC/570i-PCI 4 port");
break;
case 0x5011114f:
printf("Digi SYNC/570i-PCI 4 port (mapped below 1M)\n");
printf("Please change the jumper to select linear mode.\n");
break;
default:
break;
}
return (0);
}
static void
ar_pci_attach(pcici_t config_id, int unit)
{
u_char *inten;
void *hc;
vm_offset_t mem_vaddr, mem_paddr;
vm_offset_t plx_vaddr, plx_paddr;
if(!pci_map_mem(config_id, 0x10, &plx_vaddr, &plx_paddr)) {
printf("arp: map failed.\n");
return;
}
if(!pci_map_mem(config_id, 0x18, &mem_vaddr, &mem_paddr)) {
printf("arp: map failed.\n");
return;
}
hc = arattach_pci(unit, mem_vaddr);
if(!hc)
return;
/* Magic to enable the card to generate interrupts. */
inten = (u_char *)plx_vaddr;
inten[0x69] = 0x09;
if(!pci_map_int(config_id, arintr_hc, (void *)hc, &net_imask)) {
free(hc, M_DEVBUF);
return;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995 John Hay. All rights reserved.
* Copyright (c) 1995, 1999 John Hay. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -9,11 +9,7 @@
* 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.
*
@ -45,6 +41,17 @@
#define ARC_WIN_MSK (ARC_WIN_SIZ - 1)
#define ARC_WIN_SHFT 14
/* Some PCI specific offsets. */
#define AR_PCI_SCA_1_OFFSET 0x00040000
#define AR_PCI_SCA_2_OFFSET 0x00040400
#define AR_PCI_ORBASE_OFFSET 0x00041000
#define AR_PCI_SCA_PCR 0x0208
#define AR_PCI_SCA_DMER 0x0309
/* PCI Legacy (below 1M) offsets. */
#define AR_PCI_L_SCA_1_OFFSET 0x00004000
#define AR_PCI_L_SCA_2_OFFSET 0x00004400
#define AR_PCI_L_ORBASE_OFFSET 0x00005000
#define AR_ID_5 0x00 /* RO, Card probe '5' */
#define AR_ID_7 0x01 /* RO, Card probe '7' */
#define AR_ID_0 0x02 /* RO, Card probe '0' */
@ -61,12 +68,19 @@
#define AR_MEM_SEL 0x0D /* RW, Memory Select */
#define AR_INT_ACK2 0x0E /* RO, Interrupt Acknowledge 2 + 3 */
#define AR_TXC_DTR2 0x0E /* WO, Tx Clock and DTR control 2 + 3 */
/* PCI only */
#define AR_PIMCTRL 0x4C /* RW, PIM and LEDs */
#define AR_INT_SCB 0x50 /* RO, Interrupt Scoreboard */
#define AR_REV_MSK 0x0F
#define AR_WSIZ_MSK 0xE0
#define AR_WSIZ_SHFT 5
/* Bus memory and interface type */
#define AR_BUS_MSK 0x03
#define AR_BUS_ISA 0x00
#define AR_BUS_MCA 0x01
#define AR_BUS_EISA 0x02
#define AR_BUS_PCI 0x03
#define AR_MEM_MSK 0x1C
#define AR_MEM_SHFT 0x02
@ -89,6 +103,9 @@
#define AR_IFACE_EIA_530 0x40
#define AR_IFACE_X_21 0x60
#define AR_IFACE_COMBO 0xC0 /* X.21 / EIA-530 */
#define AR_IFACE_PIM 0xE0 /* PIM module */
#define AR_IFACE_LOOPBACK 0xFE
#define AR_IFACE_UNKNOWN 0xFF
/* Supported Handshake signals */
#define AR_SHSK_DTR 0x01
@ -136,7 +153,18 @@
#define AR_INTS_CMA14 0x10
#define AR_INTS_CMA15 0x20
/* Memory select register */
/* Advanced PIM Control */
#define AR_PIM_STROBE 0x01
#define AR_PIM_DATA 0x02
#define AR_PIM_MODEG 0x04
#define AR_PIM_A2D_STROBE 0x04
#define AR_PIM_MODEY 0x08
#define AR_PIM_A2D_DOUT 0x08
#define AR_PIM_AUTO_LED 0x10
#define AR_PIM_INT 0x20
#define AR_PIM_RESET 0x00 /* MODEG and MODEY 0 */
#define AR_PIM_READ AR_PIM_MODEG
#define AR_PIM_WRITE AR_PIM_MODEY
#endif /* _IF_ARREGS_H_ */

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995 John Hay. All rights reserved.
* Copyright (c) 1995, 1999 John Hay. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -9,11 +9,7 @@
* 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.
*
@ -45,6 +41,17 @@
#define ARC_WIN_MSK (ARC_WIN_SIZ - 1)
#define ARC_WIN_SHFT 14
/* Some PCI specific offsets. */
#define AR_PCI_SCA_1_OFFSET 0x00040000
#define AR_PCI_SCA_2_OFFSET 0x00040400
#define AR_PCI_ORBASE_OFFSET 0x00041000
#define AR_PCI_SCA_PCR 0x0208
#define AR_PCI_SCA_DMER 0x0309
/* PCI Legacy (below 1M) offsets. */
#define AR_PCI_L_SCA_1_OFFSET 0x00004000
#define AR_PCI_L_SCA_2_OFFSET 0x00004400
#define AR_PCI_L_ORBASE_OFFSET 0x00005000
#define AR_ID_5 0x00 /* RO, Card probe '5' */
#define AR_ID_7 0x01 /* RO, Card probe '7' */
#define AR_ID_0 0x02 /* RO, Card probe '0' */
@ -61,12 +68,19 @@
#define AR_MEM_SEL 0x0D /* RW, Memory Select */
#define AR_INT_ACK2 0x0E /* RO, Interrupt Acknowledge 2 + 3 */
#define AR_TXC_DTR2 0x0E /* WO, Tx Clock and DTR control 2 + 3 */
/* PCI only */
#define AR_PIMCTRL 0x4C /* RW, PIM and LEDs */
#define AR_INT_SCB 0x50 /* RO, Interrupt Scoreboard */
#define AR_REV_MSK 0x0F
#define AR_WSIZ_MSK 0xE0
#define AR_WSIZ_SHFT 5
/* Bus memory and interface type */
#define AR_BUS_MSK 0x03
#define AR_BUS_ISA 0x00
#define AR_BUS_MCA 0x01
#define AR_BUS_EISA 0x02
#define AR_BUS_PCI 0x03
#define AR_MEM_MSK 0x1C
#define AR_MEM_SHFT 0x02
@ -89,6 +103,9 @@
#define AR_IFACE_EIA_530 0x40
#define AR_IFACE_X_21 0x60
#define AR_IFACE_COMBO 0xC0 /* X.21 / EIA-530 */
#define AR_IFACE_PIM 0xE0 /* PIM module */
#define AR_IFACE_LOOPBACK 0xFE
#define AR_IFACE_UNKNOWN 0xFF
/* Supported Handshake signals */
#define AR_SHSK_DTR 0x01
@ -136,7 +153,18 @@
#define AR_INTS_CMA14 0x10
#define AR_INTS_CMA15 0x20
/* Memory select register */
/* Advanced PIM Control */
#define AR_PIM_STROBE 0x01
#define AR_PIM_DATA 0x02
#define AR_PIM_MODEG 0x04
#define AR_PIM_A2D_STROBE 0x04
#define AR_PIM_MODEY 0x08
#define AR_PIM_A2D_DOUT 0x08
#define AR_PIM_AUTO_LED 0x10
#define AR_PIM_INT 0x20
#define AR_PIM_RESET 0x00 /* MODEG and MODEY 0 */
#define AR_PIM_READ AR_PIM_MODEG
#define AR_PIM_WRITE AR_PIM_MODEY
#endif /* _IF_ARREGS_H_ */

117
sys/pci/if_ar_p.c Normal file
View file

@ -0,0 +1,117 @@
/*
* Copyright (c) 1999 John Hay.
* 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.
*
* $FreeBSD$
*/
#include "ar.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <pci/pcivar.h>
/*
* The must match with the real functions in if_ar.c
*/
extern void *arattach_pci(int unit, vm_offset_t mem_vaddr);
extern void arintr_hc(void *hc);
static const char *ar_pci_probe(pcici_t tag, pcidi_t type);
static void ar_pci_attach(pcici_t config_id, int unit);
static u_long arc_count = NAR;
static struct pci_device ar_pci_driver =
{
"ar",
ar_pci_probe,
ar_pci_attach,
&arc_count,
NULL
};
COMPAT_PCI_DRIVER (ar_pci, ar_pci_driver);
static const char *
ar_pci_probe(pcici_t tag, pcidi_t type)
{
switch(type) {
case 0x5012114f:
return ("Digi SYNC/570i-PCI 2 port");
break;
case 0x5010114f:
printf("Digi SYNC/570i-PCI 2 port (mapped below 1M)\n");
printf("Please change the jumper to select linear mode.\n");
break;
case 0x5013114f:
return ("Digi SYNC/570i-PCI 4 port");
break;
case 0x5011114f:
printf("Digi SYNC/570i-PCI 4 port (mapped below 1M)\n");
printf("Please change the jumper to select linear mode.\n");
break;
default:
break;
}
return (0);
}
static void
ar_pci_attach(pcici_t config_id, int unit)
{
u_char *inten;
void *hc;
vm_offset_t mem_vaddr, mem_paddr;
vm_offset_t plx_vaddr, plx_paddr;
if(!pci_map_mem(config_id, 0x10, &plx_vaddr, &plx_paddr)) {
printf("arp: map failed.\n");
return;
}
if(!pci_map_mem(config_id, 0x18, &mem_vaddr, &mem_paddr)) {
printf("arp: map failed.\n");
return;
}
hc = arattach_pci(unit, mem_vaddr);
if(!hc)
return;
/* Magic to enable the card to generate interrupts. */
inten = (u_char *)plx_vaddr;
inten[0x69] = 0x09;
if(!pci_map_int(config_id, arintr_hc, (void *)hc, &net_imask)) {
free(hc, M_DEVBUF);
return;
}
}