aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hfa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hfa')
-rw-r--r--sys/dev/hfa/fore.h114
-rw-r--r--sys/dev/hfa/fore_aali.h606
-rw-r--r--sys/dev/hfa/fore_buffer.c786
-rw-r--r--sys/dev/hfa/fore_command.c466
-rw-r--r--sys/dev/hfa/fore_globals.c114
-rw-r--r--sys/dev/hfa/fore_if.c228
-rw-r--r--sys/dev/hfa/fore_include.h108
-rw-r--r--sys/dev/hfa/fore_init.c380
-rw-r--r--sys/dev/hfa/fore_intr.c268
-rw-r--r--sys/dev/hfa/fore_output.c479
-rw-r--r--sys/dev/hfa/fore_receive.c595
-rw-r--r--sys/dev/hfa/fore_slave.h190
-rw-r--r--sys/dev/hfa/fore_stats.c184
-rw-r--r--sys/dev/hfa/fore_stats.h83
-rw-r--r--sys/dev/hfa/fore_timer.c116
-rw-r--r--sys/dev/hfa/fore_transmit.c383
-rw-r--r--sys/dev/hfa/fore_var.h274
-rw-r--r--sys/dev/hfa/fore_vcm.c531
-rw-r--r--sys/dev/hfa/hfa_eisa.c134
-rw-r--r--sys/dev/hfa/hfa_freebsd.c466
-rw-r--r--sys/dev/hfa/hfa_freebsd.h61
-rw-r--r--sys/dev/hfa/hfa_pci.c213
-rw-r--r--sys/dev/hfa/hfa_sbus.c133
23 files changed, 0 insertions, 6912 deletions
diff --git a/sys/dev/hfa/fore.h b/sys/dev/hfa/fore.h
deleted file mode 100644
index 8f0a17f58a9c..000000000000
--- a/sys/dev/hfa/fore.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Protocol and implementation definitions
- *
- */
-
-#ifndef _FORE_H
-#define _FORE_H
-
-#ifndef FORE_DEV_NAME
-#define FORE_DEV_NAME "hfa"
-#endif
-
-#define FORE_MAX_UNITS 8 /* Maximum number of devices we support */
-#define FORE_MIN_UCODE 0x20300 /* Minimum microcode version we support */
-
-#define FORE_IFF_MTU 9188 /* Network interface MTU */
-#define FORE_MAX_VCC 1024 /* Maximum number of open VCCs */
-#define FORE_MAX_VPI 0 /* Maximum VPI value */
-#define FORE_MAX_VCI 1023 /* Maximum VCI value */
-#define FORE_DEF_RATE 0x00000000 /* Default rate control = disabled */
-
-#define XMIT_QUELEN 32 /* Length of transmit queue */
-#define RECV_QUELEN 32 /* Length of receive queue */
-#define CMD_QUELEN 8 /* Length of command queue */
-
-#define FORE_TIME_TICK 5 /* Watchdog timer tick (seconds) */
-#define FORE_WATCHDOG 3 /* Device watchdog timeout (ticks) */
-#define FORE_RECV_RETRY 3 /* Wait for receive queue entry retry count */
-#define FORE_RECV_DELAY 10 /* Wait for receive queue entry delay (usec) */
-
-
-/*
- * Receive Buffer strategies
- */
-#define BUF_MIN_VCC 4 /* Minimum for buffer supply calculations */
-
-#define BUF_DATA_ALIGN 4 /* Fore-required data alignment */
-
-/*
- * Strategy 1 Small - mbuf
- * Strategy 1 Large - cluster mbuf
- *
- * XXX buffer controls - the RECV_MAX_SEGS calculation comes out wrong
- * using the true buffer size values if the CP really only does full-cell
- * filling of a particular buffer - we must clarify this...it also appears
- * the minimum buffer size is 64, even if the CP can only fit in 1 cell.
- */
-#define SIZEOF_Buf_handle 16 /* XXX sizeof(Buf_handle) */
-
-#undef m_ext
-typedef struct m_ext M_ext;
-#define m_ext M_dat.MH.MH_dat.MH_ext
-#define BUF1_SM_HOFF (sizeof(struct m_hdr)) /* Buffer-to-handle offset */
-#define BUF1_SM_HDR (sizeof(struct m_hdr) + sizeof(struct pkthdr))
-#define BUF1_SM_LEN (MHLEN)
-#define BUF1_LG_HOFF (sizeof(struct m_hdr) + sizeof(struct pkthdr) \
- + sizeof(M_ext)) /* Buffer-to-handle offset */
-/*
- * BUF1_SM_DOFF - CP data offset into buffer data space
- * BUF1_SM_SIZE - Buffer size
- *
- * These should be defined as follows, but we need compile-time constants:
- *
- * #define BUF1_SM_DOFF (roundup(BUF1_SM_HOFF + SIZEOF_Buf_handle,
- * BUF_DATA_ALIGN) - BUF1_SM_HDR)
- * #define BUF1_SM_SIZE MAX(BUF1_SM_LEN - BUF1_SM_DOFF, 64)
- *
- */
-#define BUF1_SM_DOFF (SIZEOF_Buf_handle)
-#define BUF1_SM_SIZE (BUF1_SM_LEN - BUF1_SM_DOFF)
-
-#define BUF1_SM_QUELEN 16 /* Entries in supply queue */
-#define BUF1_SM_CPPOOL 256 /* Buffers in CP-resident pool */
-#define BUF1_SM_ENTSIZE 8 /* Buffers in each supply queue entry */
-
-#define BUF1_LG_DOFF 0 /* CP data offset into mbuf data space */
-#define BUF1_LG_SIZE MCLBYTES /* Buffer size */
-#define BUF1_LG_QUELEN 16 /* Entries in supply queue */
-#define BUF1_LG_CPPOOL 512 /* Buffers in CP-resident pool */
-#define BUF1_LG_ENTSIZE 8 /* Buffers in each supply queue entry */
-
-#endif /* _FORE_H */
diff --git a/sys/dev/hfa/fore_aali.h b/sys/dev/hfa/fore_aali.h
deleted file mode 100644
index 93fbf5d587e2..000000000000
--- a/sys/dev/hfa/fore_aali.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * ATM Adaptation Layer Interface (AALI) definitions
- *
- */
-
-#ifndef _FORE_AALI_H
-#define _FORE_AALI_H
-
-/*
- * This file contains the definitions required by the FORE ATM Adaptation
- * Layer Interface (AALI) specification.
- */
-
-
-/*
- * Addressing/Pointer definitions
- *
- * The CP memory only supports 32-bit word accesses (read and write) - thus,
- * all memory must be defined and accessed as 32-bit words. Also, since the
- * data transfers are word-sized, we must take care of byte-swapping issues
- * from/to little-endian hosts (the CP is an i960 processor, ie big-endian).
- *
- * All pointers to CP memory areas are actually offsets from the start of
- * the adapter RAM address space.
- *
- * All CP-resident data structures are declared volatile.
- */
-typedef void * H_addr; /* Host-resident address */
-typedef unsigned long H_dma; /* Host-resident DMA address */
-typedef unsigned long CP_word; /* CP-resident word */
-typedef unsigned long CP_addr; /* CP-resident CP memory offset */
-typedef unsigned long CP_dma; /* CP-resident DMA address */
-
-
-/*
- * Structure defining the CP's shared memory interface to the mon960 program
- */
-struct mon960 {
- CP_word mon_xmitmon; /* Uart - host to mon960 (see below) */
- CP_word mon_xmithost; /* Uart - mon960 to host (see below) */
- CP_word mon_bstat; /* Boot status word (see below) */
- CP_addr mon_appl; /* Pointer to application memory area */
- CP_word mon_ver; /* Mon960 firmware version */
-};
-typedef volatile struct mon960 Mon960;
-
-/*
- * Pseudo-UART usage
- */
-#define UART_READY 0x00000000 /* UART is ready for more data */
-#define UART_VALID 0x01000000 /* UART character is valid */
-#define UART_DATAMASK 0x000000ff /* UART character data mask */
-
-/*
- * Boot Status Word
- */
-#define BOOT_COLDSTART 0xc01dc01d /* CP is performing cold start */
-#define BOOT_MONREADY 0x02201958 /* Monitor is waiting for commands */
-#define BOOT_FAILTEST 0xadbadbad /* Monitor failed self-test */
-#define BOOT_RUNNING 0xce11feed /* Microcode downloaded and running */
-
-#define BOOT_LOOPS 20 /* Loops to wait for CP to boot */
-#define BOOT_DELAY 100000 /* Delay (us) for each boot loop */
-
-
-/*
- * Supported AALs
- */
-enum fore_aal {
- FORE_AAL_0 = 0, /* Cell Service */
- FORE_AAL_4 = 4, /* AAL 3/4 */
- FORE_AAL_5 = 5 /* AAL 5 */
-};
-typedef enum fore_aal Fore_aal;
-
-
-/*
- * Buffer strategy definition
- */
-struct buf_strategy {
- CP_word bfs_quelen; /* Buffer supply queue entries */
- CP_word bfs_bufsize; /* Buffer size */
- CP_word bfs_cppool; /* Buffers in CP-resident pool */
- CP_word bfs_entsize; /* Buffers in each supply queue entry */
-};
-typedef volatile struct buf_strategy Buf_strategy;
-
-/*
- * Buffer strategy id
- */
-#define BUF_STRAT_1 0 /* Buffer strategy one */
-#define BUF_STRAT_2 1 /* Buffer strategy two */
-
-
-
-#ifdef _KERNEL
-/*
- * Common Queue Element
- *
- * Used for Transmit, Receive and Buffer Supply Queues
- */
-struct com_queue {
- CP_dma cq_descr; /* Pointer to element descriptor */
- CP_dma cq_status; /* Pointer to element status word */
-};
-typedef volatile struct com_queue Com_queue;
-
-
-/*
- * Queue element status word
- */
-typedef volatile unsigned long Q_status;
-
-#define QSTAT_PENDING 0x01 /* Operation is pending */
-#define QSTAT_COMPLETED 0x02 /* Operation successfully completed */
-#define QSTAT_FREE 0x04 /* Queue element is free/unused */
-#define QSTAT_ERROR 0x08 /* Operation encountered an error */
-
-#define QSTAT_ALIGN 4
-
-
-/*
- * PDU Transmit Queue
- */
-
-/*
- * PDU Transmit Queue Element
- */
-typedef volatile struct com_queue Xmit_queue;
-
-
-/*
- * PDU Transmit buffer segment descriptor
- */
-struct xmit_seg_descr {
- H_dma xsd_buffer; /* Buffer's DMA address */
- u_int xsd_len; /* Data length in buffer */
-};
-typedef struct xmit_seg_descr Xmit_seg_descr;
-
-#define XMIT_SEG_ALIGN 4
-
-
-/*
- * PDU Transmit descriptor header
- */
-struct xmit_descr_hdr {
- u_long xdh_cell_hdr; /* Cell header (minus HEC) */
- u_long xdh_spec; /* Transmit specification (see below) */
- u_long xdh_rate; /* Rate control (data/idle cell ratio)*/
- u_long xdh_pad; /* Pad to quad-word boundary */
-};
-typedef struct xmit_descr_hdr Xmit_descr_hdr;
-
-
-#define XMIT_BLK_BITS 5 /* Bits to encode block size */
-#define XMIT_MAX_BLK_BITS 4 /* Max bits we can use */
-#define XMIT_BLK_SIZE (1 << XMIT_BLK_BITS)
-#define XMIT_SEGS_TO_BLKS(nseg) \
- ((((nseg) * sizeof(Xmit_seg_descr)) \
- + sizeof(Xmit_descr_hdr) + (XMIT_BLK_SIZE - 1)) \
- >> XMIT_BLK_BITS)
-#define XMIT_MAX_BLKS ((1 << XMIT_MAX_BLK_BITS) - 1)
-#define XMIT_HDR_SEGS ((XMIT_BLK_SIZE - sizeof(Xmit_descr_hdr)) \
- / sizeof(Xmit_seg_descr))
-#define XMIT_BLK_SEGS (XMIT_BLK_SIZE / sizeof(Xmit_seg_descr))
-#define XMIT_EXTRA_SEGS ((XMIT_MAX_BLKS - 1) * XMIT_BLK_SEGS)
-#define XMIT_MAX_SEGS (XMIT_EXTRA_SEGS + XMIT_HDR_SEGS)
-
-
-/*
- * PDU Transmit descriptor
- */
-struct xmit_descr {
- Xmit_descr_hdr xd_hdr; /* Descriptor header */
- Xmit_seg_descr xd_seg[XMIT_MAX_SEGS]; /* PDU segments */
-};
-typedef struct xmit_descr Xmit_descr;
-
-#define xd_cell_hdr xd_hdr.xdh_cell_hdr
-#define xd_spec xd_hdr.xdh_spec
-#define xd_rate xd_hdr.xdh_rate
-
-/*
- * Transmit specification
- *
- * Bits 0-15 - Total PDU length
- * Bits 16-23 - Number of transmit segments
- * Bits 24-27 - AAL type
- * Bits 28-31 - Interrupt flag
- */
-#define XDS_SET_SPEC(i,a,n,l) (((i) << 28) | ((a) << 24) | ((n) << 16) | (l))
-#define XDS_GET_LEN(s) ((s) & 0xffff)
-#define XDS_GET_SEGS(s) (((s) >> 16) & 0xff)
-#define XDS_GET_AAL(s) (((s) >> 24) & 0xf)
-#define XDS_GET_INTR(s) (((s) >> 28) & 0xf)
-
-#define XMIT_MAX_PDULEN 65535
-#define XMIT_DESCR_ALIGN 32
-
-
-
-/*
- * PDU Receive Queue
- */
-
-/*
- * PDU Receive Queue Element
- */
-typedef volatile struct com_queue Recv_queue;
-
-
-/*
- * Receive PDU buffer segment description
- */
-struct recv_seg_descr {
- H_addr rsd_handle; /* Buffer handle (from supply) */
- u_int rsd_len; /* Data length in buffer */
-};
-typedef struct recv_seg_descr Recv_seg_descr;
-
-
-/*
- * PDU Receive descriptor header
- */
-struct recv_descr_hdr {
- u_long rdh_cell_hdr; /* Cell header (minus HEC) */
- u_long rdh_nsegs; /* Number of receive segments */
-};
-typedef struct recv_descr_hdr Recv_descr_hdr;
-
-
-#define RECV_BLK_SIZE 32
-#define RECV_HDR_SEGS ((RECV_BLK_SIZE - sizeof(Recv_descr_hdr)) \
- / sizeof(Recv_seg_descr))
-#define RECV_BLK_SEGS (RECV_BLK_SIZE / sizeof(Recv_seg_descr))
-#define RECV_MAX_LG_SEGS ((FORE_IFF_MTU - BUF1_SM_SIZE \
- + (BUF1_LG_SIZE - 1)) / BUF1_LG_SIZE)
-#define RECV_EXTRA_BLKS (((RECV_MAX_LG_SEGS + 1 - RECV_HDR_SEGS) \
- + (RECV_BLK_SEGS - 1)) / RECV_BLK_SEGS)
-#define RECV_EXTRA_SEGS (RECV_EXTRA_BLKS * RECV_BLK_SEGS)
-#define RECV_MAX_SEGS (RECV_EXTRA_SEGS + RECV_HDR_SEGS)
-
-
-/*
- * PDU Receive descriptor
- */
-struct recv_descr {
- Recv_descr_hdr rd_hdr; /* Descriptor header */
- Recv_seg_descr rd_seg[RECV_MAX_SEGS]; /* PDU segments */
-};
-typedef struct recv_descr Recv_descr;
-
-#define rd_cell_hdr rd_hdr.rdh_cell_hdr
-#define rd_nsegs rd_hdr.rdh_nsegs
-
-#define RECV_DESCR_ALIGN 32
-
-
-
-/*
- * Buffer Supply Queue
- */
-
-/*
- * Buffer Supply Queue Element
- */
-typedef volatile struct com_queue Buf_queue;
-
-
-/*
- * Buffer supply descriptor for supplying receive buffers
- */
-struct buf_descr {
- H_addr bsd_handle; /* Host-specific buffer handle */
- H_dma bsd_buffer; /* Buffer DMA address */
-};
-typedef struct buf_descr Buf_descr;
-
-#define BUF_DESCR_ALIGN 32
-
-
-
-/*
- * Command Queue
- */
-
-/*
- * Command Codes
- */
-typedef volatile unsigned long Cmd_code;
-
-#define CMD_INIT 0x01 /* Initialize microcode */
-#define CMD_ACT_VCCIN 0x02 /* Activate incoming VCC */
-#define CMD_ACT_VCCOUT 0x03 /* Activate outgoing VCC */
-#define CMD_DACT_VCCIN 0x04 /* Deactivate incoming VCC */
-#define CMD_DACT_VCCOUT 0x05 /* Deactivate outgoing VCC */
-#define CMD_GET_STATS 0x06 /* Get adapter statistics */
-#define CMD_SET_OC3_REG 0x07 /* Set SUNI OC3 registers */
-#define CMD_GET_OC3_REG 0x08 /* Get SUNI OC3 registers */
-#define CMD_GET_PROM 0x09 /* Get PROM data */
-#define CMD_ZERO_STATS4 0x09 /* FT 4 Zero stats (unimpl) */
-#define CMD_GET_PROM4 0x0a /* FT 4 Get PROM data */
-#define CMD_INTR_REQ 0x80 /* Request host interrupt */
-
-#endif /* _KERNEL */
-
-
-/*
- * Structure defining the parameters for the Initialize command
- */
-struct init_parms {
- CP_word init_cmd; /* Command code */
- CP_word init_status; /* Completion status */
- CP_word init_indisc; /* Not used */
- CP_word init_numvcc; /* Number of VCC's supported */
- CP_word init_cmd_elem; /* # of command queue elements */
- CP_word init_xmit_elem; /* # of transmit queue elements */
- CP_word init_recv_elem; /* # of receive queue elements */
- CP_word init_recv_ext; /* # of extra receive descr SEGMENTS */
- CP_word init_xmit_ext; /* # of extra transmit descr SEGMENTS */
- CP_word init_cls_vcc; /* Not used */
- CP_word init_pad[2]; /* Pad to quad-word boundary */
- Buf_strategy init_buf1s; /* Buffer strategy - 1 small */
- Buf_strategy init_buf1l; /* Buffer strategy - 1 large */
- Buf_strategy init_buf2s; /* Buffer strategy - 2 small */
- Buf_strategy init_buf2l; /* Buffer strategy - 2 large */
-};
-typedef volatile struct init_parms Init_parms;
-
-
-#ifdef _KERNEL
-/*
- * Structure defining the parameters for the Activate commands
- */
-struct activate_parms {
- CP_word act_spec; /* Command specification (see below) */
- CP_word act_vccid; /* VCC id (VPI=0,VCI=id) */
- CP_word act_batch; /* # cells in batch (AAL=NULL) */
- CP_word act_pad; /* Pad to quad-word boundary */
-};
-typedef volatile struct activate_parms Activate_parms;
-
-/*
- * Activate command specification
- *
- * Bits 0-7 - command code
- * Bits 8-15 - AAL type
- * Bits 16-23 - buffer strategy
- * Bits 24-31 - reserved
- */
-#define ACT_SET_SPEC(b,a,c) (((b) << 16) | ((a) << 8) | (c))
-#define ACT_GET_CMD(s) ((s) & 0xff)
-#define ACT_GET_AAL(s) (((s) >> 8) & 0xff)
-#define ACT_GET_STRAT(s) (((s) >> 16) & 0xff)
-
-
-/*
- * Structure defining the parameters for the Deactivate commands
- */
-struct dactivate_parms {
- CP_word dact_cmd; /* Command code */
- CP_word dact_vccid; /* VCC id (VPI=0,VCI=id) */
- CP_word dact_pad[2]; /* Pad to quad-word boundary */
-};
-typedef volatile struct dactivate_parms Dactivate_parms;
-
-
-/*
- * Structure defining the parameters for the Get Statistics command
- */
-struct stats_parms {
- CP_word stats_cmd; /* Command code */
- CP_dma stats_buffer; /* DMA address of host stats buffer */
- CP_word stats_pad[2]; /* Pad to quad-word boundary */
-};
-typedef volatile struct stats_parms Stats_parms;
-
-
-/*
- * Structure defining the parameters for the SUNI OC3 commands
- */
-struct suni_parms {
- CP_word suni_spec; /* Command specification (see below) */
- CP_dma suni_buffer; /* DMA address of host SUNI buffer */
- CP_word suni_pad[2]; /* Pad to quad-word boundary */
-};
-typedef volatile struct suni_parms Suni_parms;
-
-/*
- * SUNI OC3 command specification
- *
- * Bits 0-7 - command code
- * Bits 8-15 - SUNI register number
- * Bits 16-23 - Value(s) to set in register
- * Bits 24-31 - Mask selecting value bits
- */
-#define SUNI_SET_SPEC(m,v,r,c) (((m) << 24) | ((v) << 16) | ((r) << 8) | (c))
-#define SUNI_GET_CMD(s) ((s) & 0xff)
-#define SUNI_GET_REG(s) (((s) >> 8) & 0xff)
-#define SUNI_GET_VALUE(s) (((s) >> 16) & 0xff)
-#define SUNI_GET_MASK(s) (((s) >> 24) & 0xff)
-
-
-/*
- * Structure defining the parameters for the Get Prom command
- */
-struct prom_parms {
- CP_word prom_cmd; /* Command code */
- CP_dma prom_buffer; /* DMA address of host prom buffer */
- CP_word prom_pad[2]; /* Pad to quad-word boundary */
-};
-typedef volatile struct prom_parms Prom_parms;
-
-
-/*
- * Command Queue Element
- */
-struct cmd_queue {
- union { /* Command-specific parameters */
- Activate_parms cmdqu_act;
- Dactivate_parms cmdqu_dact;
- Stats_parms cmdqu_stats;
- Suni_parms cmdqu_suni;
- Prom_parms cmdqu_prom;
- } cmdq_u;
- CP_dma cmdq_status; /* Pointer to element status word */
- CP_word cmdq_pad[3]; /* Pad to quad-word boundary */
-};
-#define cmdq_act cmdq_u.cmdqu_act
-#define cmdq_dact cmdq_u.cmdqu_dact
-#define cmdq_stats cmdq_u.cmdqu_stats
-#define cmdq_suni cmdq_u.cmdqu_suni
-#define cmdq_prom cmdq_u.cmdqu_prom
-typedef volatile struct cmd_queue Cmd_queue;
-
-#endif /* _KERNEL */
-
-
-
-/*
- * Structure defining the CP's shared memory interface to the
- * AALI firmware program (downloaded microcode)
- */
-struct aali {
- CP_addr aali_cmd_q; /* Pointer to command queue */
- CP_addr aali_xmit_q; /* Pointer to transmit queue */
- CP_addr aali_recv_q; /* Pointer to receive queue */
- CP_addr aali_buf1s_q; /* Pointer to strategy-1 small queue */
- CP_addr aali_buf1l_q; /* Pointer to strategy-1 large queue */
- CP_addr aali_buf2s_q; /* Pointer to strategy-2 small queue */
- CP_addr aali_buf2l_q; /* Pointer to strategy-2 large queue */
- CP_word aali_intr_ena; /* Enables interrupts if non-zero */
- CP_word aali_intr_sent; /* Interrupt issued if non-zero */
- CP_addr aali_heap; /* Pointer to application heap */
- CP_word aali_heaplen; /* Length of application heap */
- CP_word aali_hostlog; /* FORE internal use */
- CP_word aali_heartbeat; /* Monitor microcode health */
- CP_word aali_ucode_ver; /* Microcode firmware version */
- CP_word aali_mon_ver; /* Mon960 version */
- CP_word aali_xmit_tput; /* FORE internal use */
-
- /* This must be on a quad-word boundary */
- Init_parms aali_init; /* Initialize command parameters */
-};
-typedef volatile struct aali Aali;
-
-
-/*
- * CP maintained statistics - DMA'd to host with CMD_GET_STATS command
- */
-struct stats_taxi {
- u_long taxi_bad_crc; /* Bad header CRC errors */
- u_long taxi_framing; /* Framing errors */
- u_long taxi_pad[2]; /* Pad to quad-word boundary */
-};
-typedef struct stats_taxi Stats_taxi;
-
-struct stats_oc3 {
- u_long oc3_sect_bip8; /* Section 8-bit intrlv parity errors */
- u_long oc3_path_bip8; /* Path 8-bit intrlv parity errors */
- u_long oc3_line_bip24; /* Line 24-bit intrlv parity errors */
- u_long oc3_line_febe; /* Line far-end block errors */
- u_long oc3_path_febe; /* Path far-end block errors */
- u_long oc3_hec_corr; /* Correctible HEC errors */
- u_long oc3_hec_uncorr; /* Uncorrectible HEC errors */
- u_long oc3_pad; /* Pad to quad-word boundary */
-};
-typedef struct stats_oc3 Stats_oc3;
-
-struct stats_atm {
- u_long atm_xmit; /* Cells transmitted */
- u_long atm_rcvd; /* Cells received */
- u_long atm_vpi_range; /* Cell drops - VPI out of range */
- u_long atm_vpi_noconn; /* Cell drops - no connect for VPI */
- u_long atm_vci_range; /* Cell drops - VCI out of range */
- u_long atm_vci_noconn; /* Cell drops - no connect for VCI */
- u_long atm_pad[2]; /* Pad to quad-word boundary */
-};
-typedef struct stats_atm Stats_atm;
-
-struct stats_aal0 {
- u_long aal0_xmit; /* Cells transmitted */
- u_long aal0_rcvd; /* Cells received */
- u_long aal0_drops; /* Cell drops */
- u_long aal0_pad; /* Pad to quad-word boundary */
-};
-typedef struct stats_aal0 Stats_aal0;
-
-struct stats_aal4 {
- u_long aal4_xmit; /* Cells transmitted */
- u_long aal4_rcvd; /* Cells received */
- u_long aal4_crc; /* Cells with payload CRC errors */
- u_long aal4_sar_cs; /* Cells with SAR/CS errors */
- u_long aal4_drops; /* Cell drops */
- u_long aal4_pdu_xmit; /* CS PDUs transmitted */
- u_long aal4_pdu_rcvd; /* CS PDUs received */
- u_long aal4_pdu_errs; /* CS layer protocol errors */
- u_long aal4_pdu_drops; /* CS PDUs dropped */
- u_long aal4_pad[3]; /* Pad to quad-word boundary */
-};
-typedef struct stats_aal4 Stats_aal4;
-
-struct stats_aal5 {
- u_long aal5_xmit; /* Cells transmitted */
- u_long aal5_rcvd; /* Cells received */
- u_long aal5_crc_len; /* Cells with CRC/length errors */
- u_long aal5_drops; /* Cell drops */
- u_long aal5_pdu_xmit; /* CS PDUs transmitted */
- u_long aal5_pdu_rcvd; /* CS PDUs received */
- u_long aal5_pdu_crc; /* CS PDUs with CRC errors */
- u_long aal5_pdu_errs; /* CS layer protocol errors */
- u_long aal5_pdu_drops; /* CS PDUs dropped */
- u_long aal5_pad[3]; /* Pad to quad-word boundary */
-};
-typedef struct stats_aal5 Stats_aal5;
-
-struct stats_misc {
- u_long buf1_sm_fail; /* Alloc fail: buffer strat 1 small */
- u_long buf1_lg_fail; /* Alloc fail: buffer strat 1 large */
- u_long buf2_sm_fail; /* Alloc fail: buffer strat 2 small */
- u_long buf2_lg_fail; /* Alloc fail: buffer strat 2 large */
- u_long rcvd_pdu_fail; /* Received PDU allocation failure */
- u_long carrier_status; /* Carrier status */
- u_long misc_pad[2]; /* Pad to quad-word boundary */
-};
-typedef struct stats_misc Stats_misc;
-
-struct fore_cp_stats {
- Stats_taxi st_cp_taxi; /* TAXI layer statistics */
- Stats_oc3 st_cp_oc3; /* OC3 layer statistics */
- Stats_atm st_cp_atm; /* ATM layer statistics */
- Stats_aal0 st_cp_aal0; /* AAL0 layer statistics */
- Stats_aal4 st_cp_aal4; /* AAL3/4 layer statistics */
- Stats_aal5 st_cp_aal5; /* AAL5 layer statistics */
- Stats_misc st_cp_misc; /* Miscellaneous statistics */
-};
-typedef struct fore_cp_stats Fore_cp_stats;
-
-#define FORE_STATS_ALIGN 32
-
-/*
- * CP PROM data - DMA'd to host with CMD_GET_PROM command
- */
-struct fore_prom {
- u_long pr_hwver; /* Hardware version number */
- u_long pr_serno; /* Serial number */
- u_char pr_mac[8]; /* MAC address */
-};
-typedef struct fore_prom Fore_prom;
-
-#define FORE_PROM_ALIGN 32
-
-#endif /* _FORE_AALI_H */
diff --git a/sys/dev/hfa/fore_buffer.c b/sys/dev/hfa/fore_buffer.c
deleted file mode 100644
index 491733af197f..000000000000
--- a/sys/dev/hfa/fore_buffer.c
+++ /dev/null
@@ -1,786 +0,0 @@
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Buffer Supply queue management
- *
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/syslog.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Local functions
- */
-static void fore_buf_drain(Fore_unit *);
-static void fore_buf_supply_1s(Fore_unit *);
-static void fore_buf_supply_1l(Fore_unit *);
-
-
-/*
- * Allocate Buffer Supply Queues Data Structures
- *
- * Here we are allocating memory for both Strategy 1 Small and Large
- * structures contiguously.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * 0 allocations successful
- * else allocation failed
- */
-int
-fore_buf_allocate(fup)
- Fore_unit *fup;
-{
- caddr_t memp;
- vm_paddr_t pmemp;
-
- /*
- * Allocate non-cacheable memory for buffer supply status words
- */
- memp = atm_dev_alloc(
- sizeof(Q_status) * (BUF1_SM_QUELEN + BUF1_LG_QUELEN),
- QSTAT_ALIGN, ATM_DEV_NONCACHE);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_buf1s_stat = (Q_status *) memp;
- fup->fu_buf1l_stat = ((Q_status *) memp) + BUF1_SM_QUELEN;
-
- pmemp = vtophys(fup->fu_buf1s_stat);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_buf1s_statd = pmemp;
-
- pmemp = vtophys(fup->fu_buf1l_stat);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_buf1l_statd = pmemp;
-
- /*
- * Allocate memory for buffer supply descriptors
- */
- memp = atm_dev_alloc(sizeof(Buf_descr) *
- ((BUF1_SM_QUELEN * BUF1_SM_ENTSIZE) +
- (BUF1_LG_QUELEN * BUF1_LG_ENTSIZE)),
- BUF_DESCR_ALIGN, 0);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_buf1s_desc = (Buf_descr *) memp;
- fup->fu_buf1l_desc = ((Buf_descr *) memp) +
- (BUF1_SM_QUELEN * BUF1_SM_ENTSIZE);
-
- pmemp = vtophys(fup->fu_buf1s_desc);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_buf1s_descd = pmemp;
-
- pmemp = vtophys(fup->fu_buf1l_desc);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_buf1l_descd = pmemp;
-
- return (0);
-}
-
-
-/*
- * Buffer Supply Queues Initialization
- *
- * Allocate and initialize the host-resident buffer supply queue structures
- * and then initialize the CP-resident queue structures.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_buf_initialize(fup)
- Fore_unit *fup;
-{
- Aali *aap = fup->fu_aali;
- Buf_queue *cqp;
- H_buf_queue *hbp;
- Buf_descr *bdp;
- vm_paddr_t bdp_dma;
- Q_status *qsp;
- vm_paddr_t qsp_dma;
- int i;
-
- /*
- * Initialize Strategy 1 Small Queues
- */
-
- /*
- * Point to CP-resident buffer supply queue
- */
- cqp = (Buf_queue *)(fup->fu_ram + CP_READ(aap->aali_buf1s_q));
-
- /*
- * Point to host-resident buffer supply queue structures
- */
- hbp = fup->fu_buf1s_q;
- qsp = fup->fu_buf1s_stat;
- qsp_dma = fup->fu_buf1s_statd;
- bdp = fup->fu_buf1s_desc;
- bdp_dma = fup->fu_buf1s_descd;
-
- /*
- * Loop thru all queue entries and do whatever needs doing
- */
- for (i = 0; i < BUF1_SM_QUELEN; i++) {
-
- /*
- * Set queue status word to free
- */
- *qsp = QSTAT_FREE;
-
- /*
- * Set up host queue entry and link into ring
- */
- hbp->hbq_cpelem = cqp;
- hbp->hbq_status = qsp;
- hbp->hbq_descr = bdp;
- hbp->hbq_descr_dma = bdp_dma;
- if (i == (BUF1_SM_QUELEN - 1))
- hbp->hbq_next = fup->fu_buf1s_q;
- else
- hbp->hbq_next = hbp + 1;
-
- /*
- * Now let the CP into the game
- */
- cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
-
- /*
- * Bump all queue pointers
- */
- hbp++;
- qsp++;
- qsp_dma += sizeof(Q_status);
- bdp += BUF1_SM_ENTSIZE;
- bdp_dma += BUF1_SM_ENTSIZE * sizeof(Buf_descr);
- cqp++;
- }
-
- /*
- * Initialize queue pointers
- */
- fup->fu_buf1s_head = fup->fu_buf1s_tail = fup->fu_buf1s_q;
-
-
- /*
- * Initialize Strategy 1 Large Queues
- */
-
- /*
- * Point to CP-resident buffer supply queue
- */
- cqp = (Buf_queue *)(fup->fu_ram + CP_READ(aap->aali_buf1l_q));
-
- /*
- * Point to host-resident buffer supply queue structures
- */
- hbp = fup->fu_buf1l_q;
- qsp = fup->fu_buf1l_stat;
- qsp_dma = fup->fu_buf1l_statd;
- bdp = fup->fu_buf1l_desc;
- bdp_dma = fup->fu_buf1l_descd;
-
- /*
- * Loop thru all queue entries and do whatever needs doing
- */
- for (i = 0; i < BUF1_LG_QUELEN; i++) {
-
- /*
- * Set queue status word to free
- */
- *qsp = QSTAT_FREE;
-
- /*
- * Set up host queue entry and link into ring
- */
- hbp->hbq_cpelem = cqp;
- hbp->hbq_status = qsp;
- hbp->hbq_descr = bdp;
- hbp->hbq_descr_dma = bdp_dma;
- if (i == (BUF1_LG_QUELEN - 1))
- hbp->hbq_next = fup->fu_buf1l_q;
- else
- hbp->hbq_next = hbp + 1;
-
- /*
- * Now let the CP into the game
- */
- cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
-
- /*
- * Bump all queue pointers
- */
- hbp++;
- qsp++;
- qsp_dma += sizeof(Q_status);
- bdp += BUF1_LG_ENTSIZE;
- bdp_dma += BUF1_LG_ENTSIZE * sizeof(Buf_descr);
- cqp++;
- }
-
- /*
- * Initialize queue pointers
- */
- fup->fu_buf1l_head = fup->fu_buf1l_tail = fup->fu_buf1l_q;
-
- return;
-}
-
-
-/*
- * Supply Buffers to CP
- *
- * This function will resupply the CP with buffers to be used to
- * store incoming data.
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_buf_supply(fup)
- Fore_unit *fup;
-{
-
- /*
- * First, clean out the supply queues
- */
- fore_buf_drain(fup);
-
- /*
- * Then, supply the buffers for each queue
- */
- fore_buf_supply_1s(fup);
- fore_buf_supply_1l(fup);
-
- return;
-}
-
-
-/*
- * Supply Strategy 1 Small Buffers to CP
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-static void
-fore_buf_supply_1s(fup)
- Fore_unit *fup;
-{
- H_buf_queue *hbp;
- Buf_queue *cqp;
- Buf_descr *bdp;
- Buf_handle *bhp;
- KBuffer *m;
- int nvcc, nbuf, i;
-
- /*
- * Figure out how many buffers we should be giving to the CP.
- * We're basing this calculation on the current number of open
- * VCCs thru this device, with certain minimum and maximum values
- * enforced. This will then allow us to figure out how many more
- * buffers we need to supply to the CP. This will be rounded up
- * to fill a supply queue entry.
- */
- nvcc = MAX(fup->fu_open_vcc, BUF_MIN_VCC);
- nbuf = nvcc * 4;
- nbuf = MIN(nbuf, BUF1_SM_CPPOOL);
- nbuf -= fup->fu_buf1s_cnt;
- nbuf = roundup(nbuf, BUF1_SM_ENTSIZE);
-
- /*
- * OK, now supply the buffers to the CP
- */
- while (nbuf > 0) {
-
- /*
- * Acquire a supply queue entry
- */
- hbp = fup->fu_buf1s_tail;
- if (!((*hbp->hbq_status) & QSTAT_FREE))
- break;
- bdp = hbp->hbq_descr;
-
- /*
- * Get a buffer for each descriptor in the queue entry
- */
- for (i = 0; i < BUF1_SM_ENTSIZE; i++, bdp++) {
- caddr_t cp;
-
- /*
- * Get a small buffer
- */
- KB_ALLOCPKT(m, BUF1_SM_SIZE, KB_F_NOWAIT, KB_T_DATA);
- if (m == 0) {
- break;
- }
- KB_HEADSET(m, BUF1_SM_DOFF);
-
- /*
- * Point to buffer handle structure
- */
- bhp = (Buf_handle *)((caddr_t)m + BUF1_SM_HOFF);
- bhp->bh_type = BHT_S1_SMALL;
-
- /*
- * Setup buffer descriptor
- */
- bdp->bsd_handle = bhp;
- KB_DATASTART(m, cp, caddr_t);
- bhp->bh_dma = bdp->bsd_buffer = vtophys(cp);
- if (bdp->bsd_buffer == 0) {
- /*
- * Unable to assign dma address - free up
- * this descriptor's buffer
- */
- fup->fu_stats->st_drv.drv_bf_segdma++;
- KB_FREEALL(m);
- break;
- }
-
- /*
- * All set, so queue buffer (handle)
- */
- ENQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1s_bq);
- }
-
- /*
- * If we we're not able to fill all the descriptors for
- * an entry, free up what's been partially built
- */
- if (i != BUF1_SM_ENTSIZE) {
- caddr_t cp;
-
- /*
- * Clean up each used descriptor
- */
- for (bdp = hbp->hbq_descr; i; i--, bdp++) {
-
- bhp = bdp->bsd_handle;
-
- DEQUEUE(bhp, Buf_handle, bh_qelem,
- fup->fu_buf1s_bq);
-
- m = (KBuffer *)
- ((caddr_t)bhp - BUF1_SM_HOFF);
- KB_DATASTART(m, cp, caddr_t);
- KB_FREEALL(m);
- }
- break;
- }
-
- /*
- * Finally, we've got an entry ready for the CP.
- * So claim the host queue entry and setup the CP-resident
- * queue entry. The CP will (potentially) grab the supplied
- * buffers when the descriptor pointer is set.
- */
- fup->fu_buf1s_tail = hbp->hbq_next;
- (*hbp->hbq_status) = QSTAT_PENDING;
- cqp = hbp->hbq_cpelem;
- cqp->cq_descr = (CP_dma) CP_WRITE((u_long)hbp->hbq_descr_dma);
-
- /*
- * Update counters, etc for supplied buffers
- */
- fup->fu_buf1s_cnt += BUF1_SM_ENTSIZE;
- nbuf -= BUF1_SM_ENTSIZE;
- }
-
- return;
-}
-
-
-/*
- * Supply Strategy 1 Large Buffers to CP
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-static void
-fore_buf_supply_1l(fup)
- Fore_unit *fup;
-{
- H_buf_queue *hbp;
- Buf_queue *cqp;
- Buf_descr *bdp;
- Buf_handle *bhp;
- KBuffer *m;
- int nvcc, nbuf, i;
-
- /*
- * Figure out how many buffers we should be giving to the CP.
- * We're basing this calculation on the current number of open
- * VCCs thru this device, with certain minimum and maximum values
- * enforced. This will then allow us to figure out how many more
- * buffers we need to supply to the CP. This will be rounded up
- * to fill a supply queue entry.
- */
- nvcc = MAX(fup->fu_open_vcc, BUF_MIN_VCC);
- nbuf = nvcc * 4 * RECV_MAX_SEGS;
- nbuf = MIN(nbuf, BUF1_LG_CPPOOL);
- nbuf -= fup->fu_buf1l_cnt;
- nbuf = roundup(nbuf, BUF1_LG_ENTSIZE);
-
- /*
- * OK, now supply the buffers to the CP
- */
- while (nbuf > 0) {
-
- /*
- * Acquire a supply queue entry
- */
- hbp = fup->fu_buf1l_tail;
- if (!((*hbp->hbq_status) & QSTAT_FREE))
- break;
- bdp = hbp->hbq_descr;
-
- /*
- * Get a buffer for each descriptor in the queue entry
- */
- for (i = 0; i < BUF1_LG_ENTSIZE; i++, bdp++) {
- caddr_t cp;
-
- /*
- * Get a cluster buffer
- */
- KB_ALLOCEXT(m, BUF1_LG_SIZE, KB_F_NOWAIT, KB_T_DATA);
- if (m == 0) {
- break;
- }
- KB_HEADSET(m, BUF1_LG_DOFF);
-
- /*
- * Point to buffer handle structure
- */
- bhp = (Buf_handle *)((caddr_t)m + BUF1_LG_HOFF);
- bhp->bh_type = BHT_S1_LARGE;
-
- /*
- * Setup buffer descriptor
- */
- bdp->bsd_handle = bhp;
- KB_DATASTART(m, cp, caddr_t);
- bhp->bh_dma = bdp->bsd_buffer = vtophys(cp);
- if (bdp->bsd_buffer == 0) {
- /*
- * Unable to assign dma address - free up
- * this descriptor's buffer
- */
- fup->fu_stats->st_drv.drv_bf_segdma++;
- KB_FREEALL(m);
- break;
- }
-
- /*
- * All set, so queue buffer (handle)
- */
- ENQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1l_bq);
- }
-
- /*
- * If we we're not able to fill all the descriptors for
- * an entry, free up what's been partially built
- */
- if (i != BUF1_LG_ENTSIZE) {
- caddr_t cp;
-
- /*
- * Clean up each used descriptor
- */
- for (bdp = hbp->hbq_descr; i; i--, bdp++) {
- bhp = bdp->bsd_handle;
-
- DEQUEUE(bhp, Buf_handle, bh_qelem,
- fup->fu_buf1l_bq);
-
- m = (KBuffer *)
- ((caddr_t)bhp - BUF1_LG_HOFF);
- KB_DATASTART(m, cp, caddr_t);
- KB_FREEALL(m);
- }
- break;
- }
-
- /*
- * Finally, we've got an entry ready for the CP.
- * So claim the host queue entry and setup the CP-resident
- * queue entry. The CP will (potentially) grab the supplied
- * buffers when the descriptor pointer is set.
- */
- fup->fu_buf1l_tail = hbp->hbq_next;
- (*hbp->hbq_status) = QSTAT_PENDING;
- cqp = hbp->hbq_cpelem;
- cqp->cq_descr = (CP_dma) CP_WRITE((u_long)hbp->hbq_descr_dma);
-
- /*
- * Update counters, etc for supplied buffers
- */
- fup->fu_buf1l_cnt += BUF1_LG_ENTSIZE;
- nbuf -= BUF1_LG_ENTSIZE;
- }
-
- return;
-}
-
-
-/*
- * Drain Buffer Supply Queues
- *
- * This function will free all completed entries at the head of each
- * buffer supply queue. Since we consider the CP to "own" the buffers
- * once we put them on a supply queue and since a completed supply queue
- * entry is only telling us that the CP has accepted the buffers that we
- * gave to it, there's not much to do here.
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-static void
-fore_buf_drain(fup)
- Fore_unit *fup;
-{
- H_buf_queue *hbp;
-
- /*
- * Drain Strategy 1 Small Queue
- */
-
- /*
- * Process each completed entry
- */
- while (*fup->fu_buf1s_head->hbq_status & QSTAT_COMPLETED) {
-
- hbp = fup->fu_buf1s_head;
-
- if (*hbp->hbq_status & QSTAT_ERROR) {
- /*
- * XXX - what does this mean???
- */
- log(LOG_ERR, "fore_buf_drain: buf1s queue error\n");
- }
-
- /*
- * Mark this entry free for use and bump head pointer
- * to the next entry in the queue
- */
- *hbp->hbq_status = QSTAT_FREE;
- fup->fu_buf1s_head = hbp->hbq_next;
- }
-
-
- /*
- * Drain Strategy 1 Large Queue
- */
-
- /*
- * Process each completed entry
- */
- while (*fup->fu_buf1l_head->hbq_status & QSTAT_COMPLETED) {
-
- hbp = fup->fu_buf1l_head;
-
- if (*hbp->hbq_status & QSTAT_ERROR) {
- /*
- * XXX - what does this mean???
- */
- log(LOG_ERR, "fore_buf_drain: buf1l queue error\n");
- }
-
- /*
- * Mark this entry free for use and bump head pointer
- * to the next entry in the queue
- */
- *hbp->hbq_status = QSTAT_FREE;
- fup->fu_buf1l_head = hbp->hbq_next;
- }
-
- return;
-}
-
-
-/*
- * Free Buffer Supply Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_buf_free(fup)
- Fore_unit *fup;
-{
- Buf_handle *bhp;
- KBuffer *m;
-
- /*
- * Free any previously supplied and not returned buffers
- */
- if (fup->fu_flags & CUF_INITED) {
-
- /*
- * Run through Strategy 1 Small queue
- */
- while ((bhp = Q_HEAD(fup->fu_buf1s_bq, Buf_handle)) != NULL) {
- caddr_t cp;
-
- /*
- * Back off to buffer
- */
- m = (KBuffer *)((caddr_t)bhp - BUF1_SM_HOFF);
-
- /*
- * Dequeue handle and free buffer
- */
- DEQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1s_bq);
-
- KB_DATASTART(m, cp, caddr_t);
- KB_FREEALL(m);
- }
-
- /*
- * Run through Strategy 1 Large queue
- */
- while ((bhp = Q_HEAD(fup->fu_buf1l_bq, Buf_handle)) != NULL) {
- caddr_t cp;
-
- /*
- * Back off to buffer
- */
- m = (KBuffer *)((caddr_t)bhp - BUF1_LG_HOFF);
-
- /*
- * Dequeue handle and free buffer
- */
- DEQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1l_bq);
-
- KB_DATASTART(m, cp, caddr_t);
- KB_FREEALL(m);
- }
- }
-
- /*
- * Free the status words
- */
- if (fup->fu_buf1s_stat) {
- atm_dev_free((volatile void *)fup->fu_buf1s_stat);
- fup->fu_buf1s_stat = NULL;
- fup->fu_buf1s_statd = 0;
- fup->fu_buf1l_stat = NULL;
- fup->fu_buf1l_statd = 0;
- }
-
- /*
- * Free the transmit descriptors
- */
- if (fup->fu_buf1s_desc) {
- atm_dev_free(fup->fu_buf1s_desc);
- fup->fu_buf1s_desc = NULL;
- fup->fu_buf1s_descd = 0;
- fup->fu_buf1l_desc = NULL;
- fup->fu_buf1l_descd = 0;
- }
-
- return;
-}
-
diff --git a/sys/dev/hfa/fore_command.c b/sys/dev/hfa/fore_command.c
deleted file mode 100644
index c7e38892e460..000000000000
--- a/sys/dev/hfa/fore_command.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Command queue management
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/syslog.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_vc.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-/*
- * Local variables
- */
-static struct t_atm_cause fore_cause = {
- T_ATM_ITU_CODING,
- T_ATM_LOC_USER,
- T_ATM_CAUSE_TEMPORARY_FAILURE,
- {0, 0, 0, 0}
-};
-
-
-/*
- * Allocate Command Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * 0 allocations successful
- * else allocation failed
- */
-int
-fore_cmd_allocate(fup)
- Fore_unit *fup;
-{
- caddr_t memp;
- vm_paddr_t pmemp;
-
- /*
- * Allocate non-cacheable memory for command status words
- */
- memp = atm_dev_alloc(sizeof(Q_status) * CMD_QUELEN,
- QSTAT_ALIGN, ATM_DEV_NONCACHE);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_cmd_stat = (Q_status *) memp;
-
- pmemp = vtophys(fup->fu_cmd_stat);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_cmd_statd = pmemp;
-
- /*
- * Allocate memory for statistics buffer
- */
- memp = atm_dev_alloc(sizeof(Fore_stats), FORE_STATS_ALIGN, 0);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_stats = (Fore_stats *) memp;
-
- /*
- * Allocate memory for PROM buffer
- */
- memp = atm_dev_alloc(sizeof(Fore_prom), FORE_PROM_ALIGN, 0);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_prom = (Fore_prom *) memp;
-
- return (0);
-}
-
-
-/*
- * Command Queue Initialization
- *
- * Allocate and initialize the host-resident command queue structures
- * and then initialize the CP-resident queue structures.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_cmd_initialize(fup)
- Fore_unit *fup;
-{
- Aali *aap = fup->fu_aali;
- Cmd_queue *cqp;
- H_cmd_queue *hcp;
- Q_status *qsp;
- vm_paddr_t qsp_dma;
- int i;
-
- /*
- * Point to CP-resident command queue
- */
- cqp = (Cmd_queue *)(fup->fu_ram + CP_READ(aap->aali_cmd_q));
-
- /*
- * Point to host-resident command queue structures
- */
- hcp = fup->fu_cmd_q;
- qsp = fup->fu_cmd_stat;
- qsp_dma = fup->fu_cmd_statd;
-
- /*
- * Loop thru all queue entries and do whatever needs doing
- */
- for (i = 0; i < CMD_QUELEN; i++) {
-
- /*
- * Set queue status word to free
- */
- *qsp = QSTAT_FREE;
-
- /*
- * Set up host queue entry and link into ring
- */
- hcp->hcq_cpelem = cqp;
- hcp->hcq_status = qsp;
- if (i == (CMD_QUELEN - 1))
- hcp->hcq_next = fup->fu_cmd_q;
- else
- hcp->hcq_next = hcp + 1;
-
- /*
- * Now let the CP into the game
- */
- cqp->cmdq_status = (CP_dma) CP_WRITE(qsp_dma);
-
- /*
- * Bump all queue pointers
- */
- hcp++;
- qsp++;
- qsp_dma += sizeof(Q_status);
- cqp++;
- }
-
- /*
- * Initialize queue pointers
- */
- fup->fu_cmd_head = fup->fu_cmd_tail = fup->fu_cmd_q;
-
- return;
-}
-
-
-/*
- * Drain Command Queue
- *
- * This function will process and free all completed entries at the head
- * of the command queue.
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_cmd_drain(fup)
- Fore_unit *fup;
-{
- H_cmd_queue *hcp;
- Fore_vcc *fvp;
-
- /*
- * Process each completed entry
- * ForeThought 4 may set QSTAT_ERROR without QSTAT_COMPLETED.
- */
- while (*fup->fu_cmd_head->hcq_status & (QSTAT_COMPLETED | QSTAT_ERROR)) {
-
- hcp = fup->fu_cmd_head;
-
- /*
- * Process command completion
- */
- switch (hcp->hcq_code) {
-
- case CMD_ACT_VCCIN:
- case CMD_ACT_VCCOUT:
- fvp = hcp->hcq_arg;
- if (*hcp->hcq_status & QSTAT_ERROR) {
- /*
- * VCC activation failed - just abort vcc
- */
- if (fvp)
- atm_cm_abort(fvp->fv_connvc,
- &fore_cause);
- fup->fu_pif.pif_cmderrors++;
- } else {
- /*
- * Successful VCC activation
- */
- if (fvp) {
- fvp->fv_state = CVS_ACTIVE;
- fup->fu_open_vcc++;
- }
- }
- break;
-
- case CMD_DACT_VCCIN:
- case CMD_DACT_VCCOUT:
- fvp = hcp->hcq_arg;
- if (*hcp->hcq_status & QSTAT_ERROR) {
- /*
- * VCC dactivation failed - whine
- */
- log(LOG_ERR,
- "fore_cmd_drain: DACT failed, vcc=(%d,%d)\n",
- fvp->fv_connvc->cvc_vcc->vc_vpi,
- fvp->fv_connvc->cvc_vcc->vc_vci);
- fup->fu_pif.pif_cmderrors++;
- } else {
- /*
- * Successful VCC dactivation - so what?
- */
- }
- break;
-
- case CMD_GET_STATS:
- if (*hcp->hcq_status & QSTAT_ERROR) {
- /*
- * Couldn't get stats
- */
- fup->fu_pif.pif_cmderrors++;
- fup->fu_stats_ret = EIO;
- } else {
- /*
- * Stats are now in unit buffer
- */
- fup->fu_stats_ret = 0;
- }
- fup->fu_flags &= ~FUF_STATCMD;
-
- /*
- * Flush received stats data
- */
-#ifdef VAC
- if (vac)
- vac_pageflush((addr_t)fup->fu_stats);
-#endif
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- /*
- * Little endian machines receives the stats in
- * wrong byte order. Instead of swapping in user
- * land, swap here so that everything going out
- * of the kernel is in correct host order.
- */
- {
- u_long *bp = (u_long *)fup->fu_stats;
- int loop;
-
- for ( loop = 0; loop < sizeof(Fore_cp_stats)/
- sizeof(long); loop++, bp++ )
- *bp = ntohl(*bp);
- }
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
-
- /*
- * Poke whoever is waiting on the stats
- */
- wakeup(&fup->fu_stats);
- break;
-
- case CMD_GET_PROM:
- if (fup->fu_ft4)
- goto unknown;
- goto prom;
-
- case CMD_GET_PROM4:
- if (!fup->fu_ft4)
- goto unknown;
- prom:
- if (*hcp->hcq_status & QSTAT_ERROR) {
- /*
- * Couldn't get PROM data
- */
- fup->fu_pif.pif_cmderrors++;
- log(LOG_ERR,
- "fore_cmd_drain: %s%d: GET_PROM failed\n",
- fup->fu_pif.pif_name,
- fup->fu_pif.pif_unit);
- } else {
- Fore_prom *fp = fup->fu_prom;
-
- /*
- * Flush received PROM data
- */
-#ifdef VAC
- if (vac)
- vac_pageflush((addr_t)fp);
-#endif
- /*
- * Copy PROM info into config areas
- */
- bcopy(&fp->pr_mac[2],
- &fup->fu_pif.pif_macaddr,
- sizeof(struct mac_addr));
- fup->fu_config.ac_macaddr =
- fup->fu_pif.pif_macaddr;
- snprintf(fup->fu_config.ac_hard_vers,
- sizeof(fup->fu_config.ac_hard_vers),
- "%ld.%ld.%ld",
- (fp->pr_hwver >> 16) & 0xff,
- (fp->pr_hwver >> 8) & 0xff,
- fp->pr_hwver & 0xff);
- fup->fu_config.ac_serial = fp->pr_serno;
- }
- break;
-
- default:
- unknown:
- log(LOG_ERR, "fore_cmd_drain: unknown command %ld\n",
- hcp->hcq_code);
- }
-
- /*
- * Mark this entry free for use and bump head pointer
- * to the next entry in the queue
- */
- *hcp->hcq_status = QSTAT_FREE;
- fup->fu_cmd_head = hcp->hcq_next;
- }
-
- return;
-}
-
-
-/*
- * Free Command Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_cmd_free(fup)
- Fore_unit *fup;
-{
- H_cmd_queue *hcp;
-
- /*
- * Deal with any commands left on the queue
- */
- if (fup->fu_flags & CUF_INITED) {
- while (*fup->fu_cmd_head->hcq_status != QSTAT_FREE) {
- hcp = fup->fu_cmd_head;
-
- switch (hcp->hcq_code) {
-
- case CMD_GET_STATS:
- /*
- * Just in case someone is sleeping on this
- */
- fup->fu_stats_ret = EIO;
- wakeup(&fup->fu_stats);
- break;
- }
-
- *hcp->hcq_status = QSTAT_FREE;
- fup->fu_cmd_head = hcp->hcq_next;
- }
- }
-
- /*
- * Free the statistics buffer
- */
- if (fup->fu_stats) {
- atm_dev_free(fup->fu_stats);
- fup->fu_stats = NULL;
- }
-
- /*
- * Free the PROM buffer
- */
- if (fup->fu_prom) {
- atm_dev_free(fup->fu_prom);
- fup->fu_prom = NULL;
- }
-
- /*
- * Free the status words
- */
- if (fup->fu_cmd_stat) {
- atm_dev_free((volatile void *)fup->fu_cmd_stat);
- fup->fu_cmd_stat = NULL;
- fup->fu_cmd_statd = 0;
- }
-
- return;
-}
-
diff --git a/sys/dev/hfa/fore_globals.c b/sys/dev/hfa/fore_globals.c
deleted file mode 100644
index 1f68f7d3e44c..000000000000
--- a/sys/dev/hfa/fore_globals.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Global variable definitions
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-
-#include <vm/uma.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-/*
- * Device unit table
- */
-Fore_unit *fore_units[FORE_MAX_UNITS] = {NULL};
-int fore_nunits = 0;
-
-
-/*
- * ATM Interface services
- */
-static struct stack_defn fore_svaal5 = {
- NULL,
- SAP_CPCS_AAL5,
- SDF_TERM,
- atm_dev_inst,
- atm_dev_lower,
- NULL,
- 0,
-};
-static struct stack_defn fore_svaal4 = {
- &fore_svaal5,
- SAP_CPCS_AAL3_4,
- SDF_TERM,
- atm_dev_inst,
- atm_dev_lower,
- NULL,
- 0,
-};
-static struct stack_defn fore_svaal0 = {
- &fore_svaal4,
- SAP_ATM,
- SDF_TERM,
- atm_dev_inst,
- atm_dev_lower,
- NULL,
- 0,
-};
-struct stack_defn *fore_services = &fore_svaal0;
-
-
-/*
- * Storage pools
- */
-uma_zone_t fore_nif_zone;
-uma_zone_t fore_vcc_zone;
-
-/*
- * Watchdog timer
- */
-struct atm_time fore_timer = {0, 0};
-
diff --git a/sys/dev/hfa/fore_if.c b/sys/dev/hfa/fore_if.c
deleted file mode 100644
index 51bbd0fb6933..000000000000
--- a/sys/dev/hfa/fore_if.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Network interface layer support
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_ioctl.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Handle netatm core service interface ioctl requests
- *
- * Called at splnet.
- *
- * Arguments:
- * code ioctl function (sub)code
- * data data to/from ioctl
- * arg optional code-specific argument
- *
- * Returns:
- * 0 request processed successfully
- * error request failed - reason code
- */
-int
-fore_atm_ioctl(code, data, arg)
- int code;
- caddr_t data;
- caddr_t arg;
-{
- struct atminfreq *aip = (struct atminfreq *)data;
- struct atm_pif *pip;
- Fore_unit *fup;
- caddr_t buf = aip->air_buf_addr;
- struct air_vinfo_rsp *avr;
- size_t count;
- size_t len;
- size_t buf_len = aip->air_buf_len;
- int err = 0;
- char ifname[2*IFNAMSIZ];
-
-
- ATM_DEBUG2("fore_atm_ioctl: code=%d, opcode=%d\n",
- code, aip->air_opcode);
-
- switch ( aip->air_opcode ) {
-
- case AIOCS_INF_VST:
- /*
- * Get vendor statistics
- */
- pip = (struct atm_pif *)arg;
- fup = (Fore_unit *)pip;
- if ( pip == NULL )
- return ( ENXIO );
- snprintf ( ifname, sizeof(ifname),
- "%s%d", pip->pif_name, pip->pif_unit );
-
- /*
- * Cast response structure onto user's buffer
- */
- avr = (struct air_vinfo_rsp *)buf;
-
- /*
- * How large is the response structure?
- */
- len = sizeof(struct air_vinfo_rsp);
-
- /*
- * Sanity check - enough room for response structure?
- */
- if ( buf_len < len )
- return ( ENOSPC );
-
- /*
- * Copy interface name into response structure
- */
- if ((err = copyout ( ifname, avr->avsp_intf, IFNAMSIZ)) != 0)
- break;
-
- /*
- * Advance the buffer address and decrement the size
- */
- buf += len;
- buf_len -= len;
-
- /*
- * Get the vendor stats from the hardware
- */
- count = 0;
- if ( ( err = fore_get_stats ( fup ) ) == 0 )
- {
- /*
- * Stick as much of it as we have room for
- * into the response
- */
- count = min ( sizeof(Fore_stats), buf_len );
-
- /*
- * Copy stats into user's buffer. Return value is
- * amount of data copied.
- */
- if ((err = copyout((caddr_t)fup->fu_stats, buf, count)) != 0)
- break;
- buf += count;
- buf_len -= count;
- if ( count < sizeof(Fore_stats) )
- err = ENOSPC;
- }
-
- /*
- * Record amount we're returning as vendor info...
- */
- if ((err = copyout(&count, &avr->avsp_len, sizeof(count))) != 0)
- break;
-
- /*
- * Update the reply pointers and lengths
- */
- aip->air_buf_addr = buf;
- aip->air_buf_len = buf_len;
- break;
-
- default:
- err = ENOSYS; /* Operation not supported */
- break;
- }
-
- return (err);
-}
-
-
-/*
- * Free Fore-specific device resources
- *
- * Frees all dynamically acquired resources for a device unit. Before
- * this function is called, the CP will have been reset and our interrupt
- * vectors removed.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- *
- */
-void
-fore_interface_free(fup)
- Fore_unit *fup;
-{
-
- /*
- * Free up all of our allocated memory
- */
- fore_xmit_free(fup);
- fore_recv_free(fup);
- fore_buf_free(fup);
- fore_cmd_free(fup);
-
- /*
- * Clear device initialized
- */
- if (fup->fu_flags & CUF_INITED) {
- fup->fu_flags &= ~CUF_INITED;
- }
-
- if (fup->fu_flags & FUF_STATCMD) {
- fup->fu_flags &= ~FUF_STATCMD;
- }
- return;
-}
-
diff --git a/sys/dev/hfa/fore_include.h b/sys/dev/hfa/fore_include.h
deleted file mode 100644
index 93062f451f63..000000000000
--- a/sys/dev/hfa/fore_include.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Local driver include files and global declarations
- *
- */
-
-#ifndef _FORE_INCLUDE_H
-#define _FORE_INCLUDE_H
-
-/*
- * Global function declarations
- */
- /* fore_buffer.c */
-int fore_buf_allocate(Fore_unit *);
-void fore_buf_initialize(Fore_unit *);
-void fore_buf_supply(Fore_unit *);
-void fore_buf_free(Fore_unit *);
-
- /* fore_command.c */
-int fore_cmd_allocate(Fore_unit *);
-void fore_cmd_initialize(Fore_unit *);
-void fore_cmd_drain(Fore_unit *);
-void fore_cmd_free(Fore_unit *);
-
- /* fore_if.c */
-int fore_atm_ioctl(int, caddr_t, caddr_t);
-void fore_interface_free(Fore_unit *);
-
- /* fore_init.c */
-void fore_initialize(Fore_unit *);
-void fore_initialize_complete(Fore_unit *);
-
- /* fore_intr.c */
-void fore_intr(void *);
-void fore_watchdog(Fore_unit *);
-
- /* fore_load.c */
-
- /* fore_output.c */
-void fore_output(Cmn_unit *, Cmn_vcc *, KBuffer *);
-
- /* fore_receive.c */
-int fore_recv_allocate(Fore_unit *);
-void fore_recv_initialize(Fore_unit *);
-void fore_recv_drain(Fore_unit *);
-void fore_recv_free(Fore_unit *);
-
- /* fore_stats.c */
-int fore_get_stats(Fore_unit *);
-
- /* fore_timer.c */
-void fore_timeout(struct atm_time *);
-
- /* fore_transmit.c */
-int fore_xmit_allocate(Fore_unit *);
-void fore_xmit_initialize(Fore_unit *);
-void fore_xmit_drain(Fore_unit *);
-void fore_xmit_free(Fore_unit *);
-
- /* fore_vcm.c */
-int fore_instvcc(Cmn_unit *, Cmn_vcc *);
-int fore_openvcc(Cmn_unit *, Cmn_vcc *);
-int fore_closevcc(Cmn_unit *, Cmn_vcc *);
-
-
-/*
- * Global variable declarations
- */
-extern Fore_device fore_devices[];
-extern Fore_unit *fore_units[];
-extern int fore_nunits;
-extern struct stack_defn *fore_services;
-extern uma_zone_t fore_nif_zone;
-extern uma_zone_t fore_vcc_zone;
-extern struct atm_time fore_timer;
-
-#endif /* _FORE_INCLUDE_H */
diff --git a/sys/dev/hfa/fore_init.c b/sys/dev/hfa/fore_init.c
deleted file mode 100644
index ccaed3f0e085..000000000000
--- a/sys/dev/hfa/fore_init.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Cell Processor (CP) initialization routines
- *
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/syslog.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Local functions
- */
-static void fore_get_prom(Fore_unit *);
-
-
-/*
- * Begin CP Initialization
- *
- * This function will poll for the successful downloading and starting of
- * the CP microcode program. After the microcode is running, we will allocate
- * any needed kernel memory (must do it in non-interrupt mode), build the CP
- * queue configurations and issue an Initialize command to the CP.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_initialize(fup)
- Fore_unit *fup;
-{
- Aali *aap;
- Init_parms *inp;
- caddr_t errmsg;
- u_long vers;
- u_int c, wait;
-#define MAX_WAIT 100
-
- /*
- * Must wait until firmware has been downloaded and is running
- */
- if (CP_READ(fup->fu_mon->mon_bstat) != BOOT_RUNNING) {
-
- /*
- * Try again later
- */
- fup->fu_thandle =
- timeout((KTimeout_ret(*)(void *))fore_initialize,
- (void *)fup, hz);
- return;
- } else
- callout_handle_init(&fup->fu_thandle);
-
- /*
- * Allocate queues and whatever else is needed
- */
- if (fore_xmit_allocate(fup)) {
- errmsg = "transmit queue allocation";
- goto failed;
- }
- if (fore_recv_allocate(fup)) {
- errmsg = "receive queue allocation";
- goto failed;
- }
- if (fore_buf_allocate(fup)) {
- errmsg = "buffer supply queue allocation";
- goto failed;
- }
- if (fore_cmd_allocate(fup)) {
- errmsg = "command queue allocation";
- goto failed;
- }
-
- /*
- * CP microcode is downloaded - locate shared memory interface
- */
- aap = (Aali *)(fup->fu_ram + CP_READ(fup->fu_mon->mon_appl));
- fup->fu_aali = aap;
-
- /*
- * Pick out any interesting info from the microcode
- */
- vers = CP_READ(aap->aali_ucode_ver);
- if (vers < FORE_MIN_UCODE) {
- errmsg = "unsupported microcode version";
- goto failed;
- }
- snprintf(fup->fu_config.ac_firm_vers,
- sizeof(fup->fu_config.ac_firm_vers), "%ld.%ld.%ld",
- (vers >> 16) & 0xff, (vers >> 8) & 0xff, vers & 0xff);
-
- if (((vers >> 16) & 0xff) == 4)
- fup->fu_ft4 = 1;
- else
- fup->fu_ft4 = 0;
-
-#ifdef notdef
- /*
- * Turn on CP debugging
- */
- aap->aali_hostlog = 1;
-#endif
-
- /*
- * Build the initialization block
- */
- inp = &aap->aali_init;
- inp->init_numvcc = CP_WRITE(FORE_MAX_VCC);
- inp->init_cmd_elem = CP_WRITE(CMD_QUELEN);
- inp->init_xmit_elem = CP_WRITE(XMIT_QUELEN);
- inp->init_recv_elem = CP_WRITE(RECV_QUELEN);
- inp->init_recv_ext = CP_WRITE(RECV_EXTRA_SEGS);
- inp->init_xmit_ext = CP_WRITE(XMIT_EXTRA_SEGS);
- inp->init_buf1s.bfs_quelen = CP_WRITE(BUF1_SM_QUELEN);
- inp->init_buf1s.bfs_bufsize = CP_WRITE(BUF1_SM_SIZE);
- inp->init_buf1s.bfs_cppool = CP_WRITE(BUF1_SM_CPPOOL);
- inp->init_buf1s.bfs_entsize = CP_WRITE(BUF1_SM_ENTSIZE);
- inp->init_buf1l.bfs_quelen = CP_WRITE(BUF1_LG_QUELEN);
- inp->init_buf1l.bfs_bufsize = CP_WRITE(BUF1_LG_SIZE);
- inp->init_buf1l.bfs_cppool = CP_WRITE(BUF1_LG_CPPOOL);
- inp->init_buf1l.bfs_entsize = CP_WRITE(BUF1_LG_ENTSIZE);
- inp->init_buf2s.bfs_quelen = CP_WRITE(0);
- inp->init_buf2s.bfs_bufsize = CP_WRITE(0);
- inp->init_buf2s.bfs_cppool = CP_WRITE(0);
- inp->init_buf2s.bfs_entsize = CP_WRITE(0);
- inp->init_buf2l.bfs_quelen = CP_WRITE(0);
- inp->init_buf2l.bfs_bufsize = CP_WRITE(0);
- inp->init_buf2l.bfs_cppool = CP_WRITE(0);
- inp->init_buf2l.bfs_entsize = CP_WRITE(0);
-
- /*
- * Enable device interrupts
- */
- aap->aali_intr_ena = CP_WRITE(1);
-
- /*
- * Issue the Initialize command to the CP and wait for
- * the CP to interrupt to signal completion
- */
- inp->init_status = CP_WRITE(QSTAT_PENDING);
-
- if (!fup->fu_ft4) {
- inp->init_cmd = CP_WRITE(CMD_INIT | CMD_INTR_REQ);
- return;
- }
- inp->init_cmd = CP_WRITE(CMD_INIT);
-
- /*
- * With the ForeThought 4.X image it appears that we need to
- * busy wait on the initializisation command to complete.
- * Otherwise the command queue address (the first word
- * of the queue structure) will be mangled.
- */
- c = 0;
- for (wait = 0; wait < MAX_WAIT; wait++) {
- c = CP_READ(inp->init_status);
- if (c & QSTAT_COMPLETED)
- break;
- DELAY(1000);
- }
- if (c & QSTAT_ERROR) {
- log(LOG_ERR, "fore initialization failed: intf=%s%d, "
- "hbeat=0x%lx\n", fup->fu_pif.pif_name,
- fup->fu_pif.pif_unit, (u_long)CP_READ(aap->aali_heartbeat));
- fore_interface_free(fup);
- return;
- }
- if (!(c & QSTAT_COMPLETED)) {
- log(LOG_ERR, "fore initialization timed out: intf=%s%d, "
- "hbeat=0x%lx\n", fup->fu_pif.pif_name, fup->fu_pif.pif_unit,
- (u_long)CP_READ(aap->aali_heartbeat));
- fore_interface_free(fup);
- return;
- }
- fore_initialize_complete(fup);
- return;
-
-failed:
- /*
- * Initialization failure
- */
- fore_interface_free(fup);
- log(LOG_ERR, "fore initialization failed: intf=%s%d, err=%s\n",
- fup->fu_pif.pif_name, fup->fu_pif.pif_unit, errmsg);
- return;
-}
-
-
-/*
- * Complete CP Initialization
- *
- * Called after the CP has successfully completed processing of the
- * Initialize command. We will now finish off our part of the
- * initialization process by setting up all the host-based queue
- * management structures.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_initialize_complete(fup)
- Fore_unit *fup;
-{
- Aali *aap = fup->fu_aali;
-
- /*
- * Log an initialization failure
- */
- if (CP_READ(aap->aali_init.init_status) & QSTAT_ERROR) {
-
- log(LOG_ERR,
- "fore initialization failed: intf=%s%d, hbeat=0x%lx\n",
- fup->fu_pif.pif_name, fup->fu_pif.pif_unit,
- (u_long)CP_READ(aap->aali_heartbeat));
- return;
- }
-
- ATM_DEBUG1("heap=0x%lx\n", aap->aali_heap);
- ATM_DEBUG1("heaplen=0x%lx\n", aap->aali_heaplen);
- ATM_DEBUG1("cmd_q=0x%lx\n", aap->aali_cmd_q);
- ATM_DEBUG1("xmit_q=0x%lx\n", aap->aali_xmit_q);
- ATM_DEBUG1("recv_q=0x%lx\n", aap->aali_recv_q);
- ATM_DEBUG1("buf1s_q=0x%lx\n", aap->aali_buf1s_q);
- ATM_DEBUG1("buf1l_q=0x%lx\n", aap->aali_buf1l_q);
- ATM_DEBUG1("buf2s_q=0x%lx\n", aap->aali_buf2s_q);
- ATM_DEBUG1("buf2l_q=0x%lx\n", aap->aali_buf2l_q);
-
- /*
- * Initialize all of our queues
- */
- fore_xmit_initialize(fup);
- fore_recv_initialize(fup);
- fore_buf_initialize(fup);
- fore_cmd_initialize(fup);
-
- /*
- * Mark device initialization completed
- */
- fup->fu_flags |= CUF_INITED;
-
- fore_get_prom(fup);
- return;
-}
-
-
-/*
- * Get device PROM values from CP
- *
- * This function will issue a GET_PROM command to the CP in order to
- * initiate the DMA transfer of the CP's PROM structure to the host.
- * This will be called after CP initialization has completed.
- * There is (currently) no retry if this fails.
- *
- * It took me some time to find out that FT3 and FT4 use different
- * operation codes for GET_PROM.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- *
- */
-static void
-fore_get_prom(fup)
- Fore_unit *fup;
-{
- H_cmd_queue *hcp;
- Cmd_queue *cqp;
-
- /*
- * Queue command at end of command queue
- */
- hcp = fup->fu_cmd_tail;
- if ((*hcp->hcq_status) & QSTAT_FREE) {
-
- /*
- * Queue entry available, so set our view of things up
- */
- if (fup->fu_ft4)
- hcp->hcq_code = CMD_GET_PROM4;
- else
- hcp->hcq_code = CMD_GET_PROM;
- hcp->hcq_arg = NULL;
- fup->fu_cmd_tail = hcp->hcq_next;
-
- /*
- * Now set the CP-resident queue entry - the CP will grab
- * the command when the op-code is set.
- */
- cqp = hcp->hcq_cpelem;
- (*hcp->hcq_status) = QSTAT_PENDING;
-
- fup->fu_promd = vtophys(fup->fu_prom);
- if (fup->fu_promd == 0) {
- fup->fu_stats->st_drv.drv_cm_nodma++;
- return;
- }
- cqp->cmdq_prom.prom_buffer = (CP_dma) CP_WRITE(fup->fu_promd);
- cqp->cmdq_prom.prom_cmd = CP_WRITE(hcp->hcq_code | CMD_INTR_REQ);
-
- } else {
- /*
- * Command queue full
- */
- fup->fu_stats->st_drv.drv_cm_full++;
- }
-
- return;
-}
-
diff --git a/sys/dev/hfa/fore_intr.c b/sys/dev/hfa/fore_intr.c
deleted file mode 100644
index 8454b93f2464..000000000000
--- a/sys/dev/hfa/fore_intr.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Interrupt processing
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-#if defined(sun)
-/*
- * Polling interrupt routine
- *
- * Polling interrupts are handled by calling all interrupt service
- * routines for a given level until someone claims to have "handled" the
- * interrupt.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * none
- *
- * Returns:
- * 1 an interrupt has been serviced
- * 0 no interrupts serviced
- *
- */
-int
-fore_poll()
-{
- int serviced = 0;
- int unit;
-
- /*
- * See if any of our devices are interrupting
- */
- for ( unit = 0; unit < fore_nunits; unit++ )
- {
- Fore_unit *fup = fore_units[unit];
-
- if (fup == NULL)
- continue;
-
- serviced += fore_intr((void *)fup);
- }
-
- /*
- * Indicate if we handled an interrupt
- */
- return (serviced ? 1 : 0);
-}
-#endif /* defined(sun) */
-
-
-/*
- * Device interrupt routine
- *
- * Called at interrupt level.
- *
- * Arguments:
- * arg pointer to device unit structure
- *
- * Returns:
- * 1 device interrupt was serviced
- * 0 no interrupts serviced
- *
- */
-#if (defined(BSD) && (BSD <= 199306))
-int
-#else
-void
-#endif
-fore_intr(arg)
- void *arg;
-{
- Fore_unit *fup = arg;
- Aali *aap;
-#if (defined(BSD) && (BSD <= 199306))
- int serviced = 0;
-#endif
-
- /*
- * Try to prevent stuff happening after we've paniced
- */
- if (panicstr) {
- goto done;
- }
-
- /*
- * Get to the microcode shared memory interface
- */
- if ((aap = fup->fu_aali) == NULL)
- goto done;
-
- /*
- * Has this card issued an interrupt??
- */
- if (*fup->fu_psr) {
-
- /*
- * Indicate that we've serviced an interrupt.
- */
-#if (defined(BSD) && (BSD <= 199306))
- serviced = 1;
-#endif
-
- /*
- * Clear the device interrupt
- */
- if (fup->fu_config.ac_device == DEV_FORE_PCA200E)
- PCA200E_HCR_SET(*fup->fu_ctlreg, PCA200E_CLR_HBUS_INT);
- aap->aali_intr_sent = CP_WRITE(0);
-
- /*
- * Reset the watchdog timer
- */
- fup->fu_timer = FORE_WATCHDOG;
-
- /*
- * Device initialization handled separately
- */
- if ((fup->fu_flags & CUF_INITED) == 0) {
-
- if (fup->fu_ft4)
- /* may not happen */
- goto done;
-
- /*
- * We're just initializing device now, so see if
- * the initialization command has completed
- */
- if (CP_READ(aap->aali_init.init_status) &
- QSTAT_COMPLETED)
- fore_initialize_complete(fup);
-
- /*
- * If we're still not inited, none of the host
- * queues are setup yet
- */
- if ((fup->fu_flags & CUF_INITED) == 0)
- goto done;
- }
-
- /*
- * Drain the queues of completed work
- */
- fore_cmd_drain(fup);
- fore_recv_drain(fup);
- fore_xmit_drain(fup);
-
- /*
- * Supply more buffers to the CP
- */
- fore_buf_supply(fup);
- }
-
-done:
-#if (defined(BSD) && (BSD <= 199306))
- return(serviced);
-#else
- return;
-#endif
-}
-
-
-/*
- * Watchdog timeout routine
- *
- * Called when we haven't heard from the card in a while. Just in case
- * we missed an interrupt, we'll drain the queues and try to resupply the
- * CP with more receive buffers. If the CP is partially wedged, hopefully
- * this will be enough to get it going again.
- *
- * Called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- *
- */
-void
-fore_watchdog(fup)
- Fore_unit *fup;
-{
- /*
- * Try to prevent stuff happening after we've paniced
- */
- if (panicstr) {
- return;
- }
-
- /*
- * Reset the watchdog timer
- */
- fup->fu_timer = FORE_WATCHDOG;
-
- /*
- * If the device is initialized, nudge it (wink, wink)
- */
- if (fup->fu_flags & CUF_INITED) {
-
- /*
- * Drain the queues of completed work
- */
- fore_cmd_drain(fup);
- fore_recv_drain(fup);
- fore_xmit_drain(fup);
-
- /*
- * Supply more buffers to the CP
- */
- fore_buf_supply(fup);
- }
-
- return;
-}
diff --git a/sys/dev/hfa/fore_output.c b/sys/dev/hfa/fore_output.c
deleted file mode 100644
index 3910186c309e..000000000000
--- a/sys/dev/hfa/fore_output.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * PDU output processing
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_vc.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Local functions
- */
-static KBuffer * fore_xmit_segment(Fore_unit *, KBuffer *,
- H_xmit_queue *, int *, int *);
-static void fore_seg_dma_free(H_xmit_queue *, KBuffer *, int);
-
-
-/*
- * Output a PDU
- *
- * This function is called via the common driver code after receiving a
- * stack *_DATA* command. The common code has already validated most of
- * the request so we just need to check a few more Fore-specific details.
- * Then we just build a transmit descriptor request for the PDU and issue
- * the command to the CP.
- *
- * Arguments:
- * cup pointer to device common unit
- * cvp pointer to common VCC entry
- * m pointer to output PDU buffer chain head
- *
- * Returns:
- * none
- *
- */
-void
-fore_output(cup, cvp, m)
- Cmn_unit *cup;
- Cmn_vcc *cvp;
- KBuffer *m;
-{
- Fore_unit *fup = (Fore_unit *)cup;
- Fore_vcc *fvp = (Fore_vcc *)cvp;
- struct vccb *vcp;
- H_xmit_queue *hxp;
- Xmit_queue *cqp;
- Xmit_descr *xdp;
- int retry, nsegs, pdulen;
- int s;
-
-#ifdef DIAGNOSTIC
- if (atm_dev_print)
- atm_dev_pdu_print(cup, cvp, m, "fore_output");
-#endif
-
- vcp = fvp->fv_connvc->cvc_vcc;
-
- /*
- * If we're still waiting for activation to finish, delay for
- * a little while before we toss the PDU
- */
- if (fvp->fv_state == CVS_INITED) {
- retry = 3;
- while (retry-- && (fvp->fv_state == CVS_INITED))
- DELAY(1000);
- if (fvp->fv_state != CVS_ACTIVE) {
- /*
- * Activation still hasn't finished, oh well....
- */
- fup->fu_stats->st_drv.drv_xm_notact++;
- vcp->vc_oerrors++;
- if (vcp->vc_nif)
- ANIF2IFP(vcp->vc_nif)->if_oerrors++;
- KB_FREEALL(m);
- return;
- }
- }
-
- /*
- * Queue PDU at end of transmit queue
- *
- * If queue is full we'll delay a bit before tossing the PDU
- */
- s = splnet();
- hxp = fup->fu_xmit_tail;
- if (!((*hxp->hxq_status) & QSTAT_FREE)) {
-
- fup->fu_stats->st_drv.drv_xm_full++;
- retry = 3;
- do {
- DELAY(1000);
-
- DEVICE_LOCK((Cmn_unit *)fup);
- fore_xmit_drain(fup);
- DEVICE_UNLOCK((Cmn_unit *)fup);
-
- } while (--retry && (!((*hxp->hxq_status) & QSTAT_FREE)));
-
- if (!((*hxp->hxq_status) & QSTAT_FREE)) {
- /*
- * Queue is still full, bye-bye PDU
- */
- fup->fu_pif.pif_oerrors++;
- vcp->vc_oerrors++;
- if (vcp->vc_nif)
- ANIF2IFP(vcp->vc_nif)->if_oerrors++;
- KB_FREEALL(m);
- (void) splx(s);
- return;
- }
- }
-
- /*
- * We've got a free transmit queue entry
- */
-
- /*
- * Now build the transmit segment descriptors for this PDU
- */
- m = fore_xmit_segment(fup, m, hxp, &nsegs, &pdulen);
- if (m == NULL) {
- /*
- * The build failed, buffer chain has been freed
- */
- vcp->vc_oerrors++;
- if (vcp->vc_nif)
- ANIF2IFP(vcp->vc_nif)->if_oerrors++;
- (void) splx(s);
- return;
- }
-
- /*
- * Set up the descriptor header
- */
- xdp = hxp->hxq_descr;
- xdp->xd_cell_hdr = ATM_HDR_SET(vcp->vc_vpi, vcp->vc_vci, 0, 0);
- xdp->xd_spec = XDS_SET_SPEC(0, fvp->fv_aal, nsegs, pdulen);
- xdp->xd_rate = fvp->rate;
-
- /*
- * Everything is ready to go, so officially claim the host queue
- * entry and setup the CP-resident queue entry. The CP will grab
- * the PDU when the descriptor pointer is set.
- */
- fup->fu_xmit_tail = hxp->hxq_next;
- hxp->hxq_buf = m;
- hxp->hxq_vcc = fvp;
- (*hxp->hxq_status) = QSTAT_PENDING;
- cqp = hxp->hxq_cpelem;
- cqp->cq_descr = (CP_dma)
- CP_WRITE((u_long)hxp->hxq_descr_dma | XMIT_SEGS_TO_BLKS(nsegs));
-
- (void) splx(s);
-
- /*
- * See if there are any completed queue entries
- */
- DEVICE_LOCK((Cmn_unit *)fup);
- fore_xmit_drain(fup);
- DEVICE_UNLOCK((Cmn_unit *)fup);
-
- return;
-}
-
-
-/*
- * Build Transmit Segment Descriptors
- *
- * This function will take a supplied buffer chain of data to be transmitted
- * and build the transmit segment descriptors for the data. This will include
- * the dreaded operation of ensuring that the data for each transmit segment
- * is full-word aligned and (except for the last segment) is an integral number
- * of words in length. If the data isn't already aligned and sized as
- * required, then the data must be shifted (copied) into place - a sure
- * performance killer. Note that we rely on the fact that all buffer data
- * areas are allocated with (at least) full-word alignments/lengths.
- *
- * If any errors are encountered, the buffer chain will be freed.
- *
- * Arguments:
- * fup pointer to device unit
- * m pointer to output PDU buffer chain head
- * hxp pointer to host transmit queue entry
- * segp pointer to return the number of transmit segments
- * lenp pointer to return the pdu length
- *
- * Returns:
- * m build successful, pointer to (possibly new) head of
- * output PDU buffer chain
- * NULL build failed, buffer chain freed
- *
- */
-static KBuffer *
-fore_xmit_segment(fup, m, hxp, segp, lenp)
- Fore_unit *fup;
- KBuffer *m;
- H_xmit_queue *hxp;
- int *segp;
- int *lenp;
-{
- Xmit_descr *xdp = hxp->hxq_descr;
- Xmit_seg_descr *xsp;
- H_dma *sdmap;
- KBuffer *m0, *m1, *mprev;
- caddr_t cp, bfr;
- vm_paddr_t dma;
- int pdulen, nsegs, len, align;
- int compressed = 0;
-
- m0 = m;
-
-retry:
- xsp = xdp->xd_seg;
- sdmap = hxp->hxq_dma;
- mprev = NULL;
- pdulen = 0;
- nsegs = 0;
-
- /*
- * Loop thru each buffer in the chain, performing the necessary
- * data positioning and then building a segment descriptor for
- * that data.
- */
- while (m) {
- /*
- * Get rid of any zero-length buffers
- */
- if (KB_LEN(m) == 0) {
- if (mprev) {
- KB_UNLINK(m, mprev, m1);
- } else {
- KB_UNLINKHEAD(m, m1);
- m0 = m1;
- }
- m = m1;
- continue;
- }
-
- /*
- * Make sure we don't try to use too many segments
- */
- if (nsegs >= XMIT_MAX_SEGS) {
- /*
- * First, free already allocated DMA addresses
- */
- fore_seg_dma_free(hxp, m0, nsegs);
-
- /*
- * Try to compress buffer chain (but only once)
- */
- if (compressed) {
- KB_FREEALL(m0);
- return (NULL);
- }
-
- fup->fu_stats->st_drv.drv_xm_maxpdu++;
-
- m = atm_dev_compress(m0);
- if (m == NULL) {
- return (NULL);
- }
-
- /*
- * Build segment descriptors for compressed chain
- */
- m0 = m;
- compressed = 1;
- goto retry;
- }
-
- /*
- * Get start of data onto full-word alignment
- */
- KB_DATASTART(m, cp, caddr_t);
- if ((align = ((uintptr_t)cp) & (XMIT_SEG_ALIGN - 1)) != 0) {
- /*
- * Gotta slide the data up
- */
- fup->fu_stats->st_drv.drv_xm_segnoal++;
- bfr = cp - align;
- bcopy(cp, bfr, KB_LEN(m));
- KB_HEADMOVE(m, -align);
- } else {
- /*
- * Data already aligned
- */
- bfr = cp;
- }
-
- /*
- * Now work on getting the data length correct
- */
- len = KB_LEN(m);
- while ((align = (len & (XMIT_SEG_ALIGN - 1))) &&
- (m1 = KB_NEXT(m))) {
-
- /*
- * Have to move some data from following buffer(s)
- * to word-fill this buffer
- */
- int ncopy = MIN(XMIT_SEG_ALIGN - align, KB_LEN(m1));
-
- if (ncopy) {
- /*
- * Move data to current buffer
- */
- caddr_t dest;
-
- fup->fu_stats->st_drv.drv_xm_seglen++;
- KB_DATASTART(m1, cp, caddr_t);
- dest = bfr + len;
- KB_HEADADJ(m1, -ncopy);
- KB_TAILADJ(m, ncopy);
- len += ncopy;
- while (ncopy--) {
- *dest++ = *cp++;
- }
- }
-
- /*
- * If we've drained the buffer, free it
- */
- if (KB_LEN(m1) == 0) {
- KBuffer *m2;
-
- KB_UNLINK(m1, m, m2);
- }
- }
-
- /*
- * Finally, build the segment descriptor
- */
-
- /*
- * Round last segment to fullword length (if needed)
- */
- if (len & (XMIT_SEG_ALIGN - 1))
- xsp->xsd_len = KB_LEN(m) =
- (len + XMIT_SEG_ALIGN) & ~(XMIT_SEG_ALIGN - 1);
- else
- xsp->xsd_len = KB_LEN(m) = len;
-
- /*
- * Get a DMA address for the data
- */
- dma = vtophys(bfr);
- if (dma == 0) {
- fup->fu_stats->st_drv.drv_xm_segdma++;
- fore_seg_dma_free(hxp, m0, nsegs);
- KB_FREEALL(m0);
- return (NULL);
- }
-
- /*
- * Now we're really ready to call it a segment
- */
- *sdmap++ = xsp->xsd_buffer = (H_dma) dma;
-
- /*
- * Bump counters and get ready for next buffer
- */
- pdulen += len;
- nsegs++;
- xsp++;
- mprev = m;
- m = KB_NEXT(m);
- }
-
- /*
- * Validate PDU length
- */
- if (pdulen > XMIT_MAX_PDULEN) {
- fup->fu_stats->st_drv.drv_xm_maxpdu++;
- fore_seg_dma_free(hxp, m0, nsegs);
- KB_FREEALL(m0);
- return (NULL);
- }
-
- /*
- * Return the good news to the caller
- */
- *segp = nsegs;
- *lenp = pdulen;
-
- return (m0);
-}
-
-
-/*
- * Free Transmit Segment Queue DMA addresses
- *
- * Arguments:
- * hxp pointer to host transmit queue entry
- * m0 pointer to output PDU buffer chain head
- * nsegs number of processed transmit segments
- *
- * Returns:
- * none
- *
- */
-static void
-fore_seg_dma_free(hxp, m0, nsegs)
- H_xmit_queue *hxp;
- KBuffer *m0;
- int nsegs;
-{
- KBuffer *m = m0;
- H_dma *sdmap = hxp->hxq_dma;
- caddr_t cp;
- int i;
-
- for (i = 0; i < nsegs; i++) {
- KB_DATASTART(m, cp, caddr_t);
- m = KB_NEXT(m);
- sdmap++;
- }
-}
-
diff --git a/sys/dev/hfa/fore_receive.c b/sys/dev/hfa/fore_receive.c
deleted file mode 100644
index 758f06911cb8..000000000000
--- a/sys/dev/hfa/fore_receive.c
+++ /dev/null
@@ -1,595 +0,0 @@
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Receive queue management
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/syslog.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <net/netisr.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_vc.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Local functions
- */
-static void fore_recv_stack(void *, KBuffer *);
-
-
-/*
- * Allocate Receive Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * 0 allocations successful
- * else allocation failed
- */
-int
-fore_recv_allocate(fup)
- Fore_unit *fup;
-{
- caddr_t memp;
- vm_paddr_t pmemp;
-
- /*
- * Allocate non-cacheable memory for receive status words
- */
- memp = atm_dev_alloc(sizeof(Q_status) * RECV_QUELEN,
- QSTAT_ALIGN, ATM_DEV_NONCACHE);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_recv_stat = (Q_status *) memp;
-
- pmemp = vtophys(fup->fu_recv_stat);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_recv_statd = pmemp;
-
- /*
- * Allocate memory for receive descriptors
- */
- memp = atm_dev_alloc(sizeof(Recv_descr) * RECV_QUELEN,
- RECV_DESCR_ALIGN, 0);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_recv_desc = (Recv_descr *) memp;
-
- pmemp = vtophys(fup->fu_recv_desc);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_recv_descd = pmemp;
-
- return (0);
-}
-
-
-/*
- * Receive Queue Initialization
- *
- * Allocate and initialize the host-resident receive queue structures
- * and then initialize the CP-resident queue structures.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_recv_initialize(fup)
- Fore_unit *fup;
-{
- Aali *aap = fup->fu_aali;
- Recv_queue *cqp;
- H_recv_queue *hrp;
- Recv_descr *rdp;
- vm_paddr_t rdp_dma;
- Q_status *qsp;
- vm_paddr_t qsp_dma;
- int i;
-
- /*
- * Point to CP-resident receive queue
- */
- cqp = (Recv_queue *)(fup->fu_ram + CP_READ(aap->aali_recv_q));
-
- /*
- * Point to host-resident receive queue structures
- */
- hrp = fup->fu_recv_q;
- qsp = fup->fu_recv_stat;
- qsp_dma = fup->fu_recv_statd;
- rdp = fup->fu_recv_desc;
- rdp_dma = fup->fu_recv_descd;
-
- /*
- * Loop thru all queue entries and do whatever needs doing
- */
- for (i = 0; i < RECV_QUELEN; i++) {
-
- /*
- * Set queue status word to free
- */
- *qsp = QSTAT_FREE;
-
- /*
- * Set up host queue entry and link into ring
- */
- hrp->hrq_cpelem = cqp;
- hrp->hrq_status = qsp;
- hrp->hrq_descr = rdp;
- hrp->hrq_descr_dma = rdp_dma;
- if (i == (RECV_QUELEN - 1))
- hrp->hrq_next = fup->fu_recv_q;
- else
- hrp->hrq_next = hrp + 1;
-
- /*
- * Now let the CP into the game
- */
- cqp->cq_descr = (CP_dma) CP_WRITE(rdp_dma);
- cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
-
- /*
- * Bump all queue pointers
- */
- hrp++;
- qsp++;
- qsp_dma += sizeof(Q_status);
- rdp++;
- rdp_dma += sizeof(Recv_descr);
- cqp++;
- }
-
- /*
- * Initialize queue pointers
- */
- fup->fu_recv_head = fup->fu_recv_q;
-
- return;
-}
-
-
-/*
- * Drain Receive Queue
- *
- * This function will process all completed entries at the head of the
- * receive queue. The received segments will be linked into a received
- * PDU buffer chain and it will then be passed up the PDU's VCC stack for
- * processing by the next higher protocol layer.
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_recv_drain(fup)
- Fore_unit *fup;
-{
- H_recv_queue *hrp = NULL;
- Recv_descr *rdp;
- Recv_seg_descr *rsp;
- Buf_handle *bhp;
- Fore_vcc *fvp;
- struct vccb *vcp;
- KBuffer *m, *mhead, *mtail;
- caddr_t cp;
- u_long hdr, nsegs;
- u_int seglen, type0;
- int i, pdulen, retries = 0, error;
-
- /* Silence the compiler */
- mtail = NULL;
- type0 = 0;
-
- /*
- * Process each completed entry
- */
-retry:
- while (*fup->fu_recv_head->hrq_status & QSTAT_COMPLETED) {
-
- /*
- * Get completed entry's receive descriptor
- */
- hrp = fup->fu_recv_head;
- rdp = hrp->hrq_descr;
-
-#ifdef VAC
- /*
- * Cache flush receive descriptor
- */
- if (vac) {
- vac_flush((addr_t)rdp, sizeof(Recv_descr));
- }
-#endif
-
- hdr = rdp->rd_cell_hdr;
- nsegs = rdp->rd_nsegs;
-
- pdulen = 0;
- error = 0;
- mhead = NULL;
-
- /*
- * Locate incoming VCC for this PDU
- */
- fvp = (Fore_vcc *) atm_dev_vcc_find((Cmn_unit *)fup,
- ATM_HDR_GET_VPI(hdr), ATM_HDR_GET_VCI(hdr), VCC_IN);
-
- /*
- * Check for a receive error
- *
- * Apparently the receive descriptor itself contains valid
- * information, but the received pdu data is probably bogus.
- * We'll arrange for the receive buffer segments to be tossed.
- */
- if (*hrp->hrq_status & QSTAT_ERROR) {
-
- fup->fu_pif.pif_ierrors++;
- if (fvp) {
- vcp = fvp->fv_connvc->cvc_vcc;
- vcp->vc_ierrors++;
- if (vcp->vc_nif)
- ANIF2IFP(vcp->vc_nif)->if_ierrors++;
- }
- ATM_DEBUG1("fore receive error: hdr=0x%lx\n", hdr);
- error = 1;
- }
-
- /*
- * Build PDU buffer chain from receive segments
- */
- for (i = 0, rsp = rdp->rd_seg; i < nsegs; i++, rsp++) {
-
- bhp = rsp->rsd_handle;
- seglen = rsp->rsd_len;
-
- /*
- * Remove buffer from our supplied queue and get
- * to the underlying buffer
- */
- switch (bhp->bh_type) {
-
- case BHT_S1_SMALL:
- DEQUEUE(bhp, Buf_handle, bh_qelem,
- fup->fu_buf1s_bq);
- fup->fu_buf1s_cnt--;
- m = (KBuffer *) ((caddr_t)bhp - BUF1_SM_HOFF);
- KB_DATASTART(m, cp, caddr_t);
- break;
-
- case BHT_S1_LARGE:
- DEQUEUE(bhp, Buf_handle, bh_qelem,
- fup->fu_buf1l_bq);
- fup->fu_buf1l_cnt--;
- m = (KBuffer *) ((caddr_t)bhp - BUF1_LG_HOFF);
- KB_DATASTART(m, cp, caddr_t);
- break;
-
- default:
- log(LOG_ERR,
- "fore_recv_drain: bhp=%p type=0x%x\n",
- bhp, bhp->bh_type);
- panic("fore_recv_drain: bad buffer type");
- }
-
- /*
- * Toss any zero-length or receive error buffers
- */
- if ((seglen == 0) || error) {
- KB_FREEALL(m);
- continue;
- }
-
- /*
- * Link buffer into chain
- */
- if (mhead == NULL) {
- type0 = bhp->bh_type;
- KB_LINKHEAD(m, mhead);
- mhead = m;
- } else {
- KB_LINK(m, mtail);
- }
- KB_LEN(m) = seglen;
- pdulen += seglen;
- mtail = m;
-
- /*
- * Flush received buffer data
- */
-#ifdef VAC
- if (vac) {
- addr_t dp;
-
- KB_DATASTART(m, dp, addr_t);
- vac_pageflush(dp);
- }
-#endif
- }
-
- /*
- * Make sure we've got a non-null PDU
- */
- if (mhead == NULL) {
- goto free_ent;
- }
-
- /*
- * We only support user data PDUs (for now)
- */
- if (hdr & ATM_HDR_SET_PT(ATM_PT_NONUSER)) {
- KB_FREEALL(mhead);
- goto free_ent;
- }
-
- /*
- * Toss the data if there's no VCC
- */
- if (fvp == NULL) {
- fup->fu_stats->st_drv.drv_rv_novcc++;
- KB_FREEALL(mhead);
- goto free_ent;
- }
-
-#ifdef DIAGNOSTIC
- if (atm_dev_print)
- atm_dev_pdu_print((Cmn_unit *)fup, (Cmn_vcc *)fvp,
- mhead, "fore_recv");
-#endif
-
- /*
- * Make sure we have our queueing headroom at the front
- * of the buffer chain
- */
- if (type0 != BHT_S1_SMALL) {
-
- /*
- * Small buffers already have headroom built-in, but
- * if CP had to use a large buffer for the first
- * buffer, then we have to allocate a buffer here to
- * contain the headroom.
- */
- fup->fu_stats->st_drv.drv_rv_nosbf++;
-
- KB_ALLOCPKT(m, BUF1_SM_SIZE, KB_F_NOWAIT, KB_T_DATA);
- if (m == NULL) {
- fup->fu_stats->st_drv.drv_rv_nomb++;
- KB_FREEALL(mhead);
- goto free_ent;
- }
-
- /*
- * Put new buffer at head of PDU chain
- */
- KB_LINKHEAD(m, mhead);
- KB_LEN(m) = 0;
- KB_HEADSET(m, BUF1_SM_DOFF);
- mhead = m;
- }
-
- /*
- * It looks like we've got a valid PDU - count it quick!!
- */
- mhead->m_pkthdr.rcvif = NULL;
- mhead->m_pkthdr.csum_flags = 0;
- SLIST_INIT(&mhead->m_pkthdr.tags);
- KB_PLENSET(mhead, pdulen);
- fup->fu_pif.pif_ipdus++;
- fup->fu_pif.pif_ibytes += pdulen;
- vcp = fvp->fv_connvc->cvc_vcc;
- vcp->vc_ipdus++;
- vcp->vc_ibytes += pdulen;
- if (vcp->vc_nif) {
- vcp->vc_nif->nif_ibytes += pdulen;
- ANIF2IFP(vcp->vc_nif)->if_ipackets++;
-#if (defined(BSD) && (BSD >= 199103))
- ANIF2IFP(vcp->vc_nif)->if_ibytes += pdulen;
-#endif
- }
-
- /*
- * The STACK_CALL needs to happen at splnet() in order
- * for the stack sequence processing to work. Schedule an
- * interrupt queue callback at splnet() since we are
- * currently at device level.
- */
-
- /*
- * Prepend callback function pointer and token value to buffer.
- * We have already guaranteed that the space is available
- * in the first buffer.
- * Don't count this extra fields in m_pkthdr.len (XXX)
- */
- mhead->m_data -= sizeof(atm_intr_func_t) + sizeof(void *);
- mhead->m_len += sizeof(atm_intr_func_t) + sizeof(void *);
- cp = mtod(mhead, caddr_t);
- *((atm_intr_func_t *)cp) = fore_recv_stack;
- cp += sizeof(atm_intr_func_t);
- *((void **)cp) = (void *)fvp;
-
- /*
- * Schedule callback
- */
- if (netisr_queue(NETISR_ATM, mhead)) { /* (0) on success. */
- fup->fu_stats->st_drv.drv_rv_ifull++;
- goto free_ent;
- }
-
-free_ent:
- /*
- * Mark this entry free for use and bump head pointer
- * to the next entry in the queue
- */
- *hrp->hrq_status = QSTAT_FREE;
- hrp->hrq_cpelem->cq_descr =
- (CP_dma) CP_WRITE((u_long)hrp->hrq_descr_dma);
- fup->fu_recv_head = hrp->hrq_next;
- }
-
- /*
- * Nearly all of the interrupts generated by the CP will be due
- * to PDU reception. However, we may receive an interrupt before
- * the CP has completed the status word DMA to host memory. Thus,
- * if we haven't processed any PDUs during this interrupt, we will
- * wait a bit for completed work on the receive queue, rather than
- * having to field an extra interrupt very soon.
- */
- if (hrp == NULL) {
- if (++retries <= FORE_RECV_RETRY) {
- DELAY(FORE_RECV_DELAY);
- goto retry;
- }
- }
-
- return;
-}
-
-
-/*
- * Pass Incoming PDU up Stack
- *
- * This function is called via the core ATM interrupt queue callback
- * set in fore_recv_drain(). It will pass the supplied incoming
- * PDU up the incoming VCC's stack.
- *
- * Called at splnet.
- *
- * Arguments:
- * tok token to identify stack instantiation
- * m pointer to incoming PDU buffer chain
- *
- * Returns:
- * none
- */
-static void
-fore_recv_stack(tok, m)
- void *tok;
- KBuffer *m;
-{
- Fore_vcc *fvp = (Fore_vcc *)tok;
- int err;
-
- /*
- * Send the data up the stack
- */
- STACK_CALL(CPCS_UNITDATA_SIG, fvp->fv_upper,
- fvp->fv_toku, fvp->fv_connvc, (intptr_t)m, 0, err);
- if (err)
- KB_FREEALL(m);
-
- return;
-}
-
-
-/*
- * Free Receive Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_recv_free(fup)
- Fore_unit *fup;
-{
- /*
- * We'll just let fore_buf_free() take care of freeing any
- * buffers sitting on the receive queue (which are also still
- * on the fu_*_bq queue).
- */
- if (fup->fu_flags & CUF_INITED) {
- }
-
- /*
- * Free the status words
- */
- if (fup->fu_recv_stat) {
- atm_dev_free((volatile void *)fup->fu_recv_stat);
- fup->fu_recv_stat = NULL;
- fup->fu_recv_statd = 0;
- }
-
- /*
- * Free the receive descriptors
- */
- if (fup->fu_recv_desc) {
- atm_dev_free(fup->fu_recv_desc);
- fup->fu_recv_desc = NULL;
- fup->fu_recv_descd = 0;
- }
-
- return;
-}
-
diff --git a/sys/dev/hfa/fore_slave.h b/sys/dev/hfa/fore_slave.h
deleted file mode 100644
index 33d73c21dced..000000000000
--- a/sys/dev/hfa/fore_slave.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Slave Interface definitions
- *
- */
-
-#ifndef _FORE_SLAVE_H
-#define _FORE_SLAVE_H
-
-/*
- * This file contains the (mostly hardware) definitions for each of the
- * supported 200-series slave interfaces.
- */
-
-
-/*
- * Structure defining the supported FORE 200-series interfaces
- */
-struct fore_device {
- char *fd_name; /* Device name (from PROM) */
- Atm_device fd_devtyp; /* Device type */
-};
-typedef struct fore_device Fore_device;
-
-
-
-/*
- * Common definitions
- * ------------------
- */
-#define MON960_BASE 0x400 /* Address offset of Mon960 */
-#define AALI_BASE 0x4d40 /* Address offset of Aali */
-
-typedef volatile unsigned int Fore_reg; /* Slave control register */
-typedef volatile unsigned char Fore_mem; /* Slave memory */
-
-
-/*
- * SBA-200E SBus Slave Interface
- * -----------------------------
- */
-
-#define SBA200E_PROM_NAME "FORE,sba-200e"
-
-/*
- * SBA-200E Host Control Register (HCR)
- */
-#define SBA200E_READ_BITS 0x1ff /* Valid read data bits */
-#define SBA200E_WRITE_BITS 0x01f /* Valid write data bits */
-#define SBA200E_STICKY_BITS 0x013 /* Sticky data bits */
-
-/* Read access */
-#define SBA200E_SBUS_INTR_RD 0x100 /* State of SBus interrupt */
-#define SBA200E_TEST_MODE 0x080 /* Device is in test-mode */
-#define SBA200E_IFIFO_FULL 0x040 /* Input FIFO almost full (when 0) */
-#define SBA200E_ESP_HOLD_RD 0x020 /* State of ESP bus hold */
-#define SBA200E_SBUS_ENA_RD 0x010 /* State of SBus interrupt enable */
-#define SBA200E_OFIFO_FULL 0x008 /* Output FIFO almost full */
-#define SBA200E_SELFTEST_FAIL 0x004 /* i960 self-test failed (when 0) */
-#define SBA200E_HOLD_LOCK_RD 0x002 /* State of i960 hold lock signal */
-#define SBA200E_RESET_RD 0x001 /* State of board reset signal */
-
-/* Write access - bit set (clear) */
-#define SBA200E_SBUS_ENA 0x010 /* Enable (disable) SBus interrupts */
-#define SBA200E_CLR_SBUS_INTR 0x008 /* Clear SBus interrupt */
-#define SBA200E_I960_INTR 0x004 /* Issue interrupt to i960 */
-#define SBA200E_HOLD_LOCK 0x002 /* Set (clear) i960 hold lock signal */
-#define SBA200E_RESET 0x001 /* Set (clear) board reset signal */
-
-#define SBA200E_HCR_INIT(hcr,bits) \
- ((hcr) = (SBA200E_WRITE_BITS & (bits)))
-#define SBA200E_HCR_SET(hcr,bits) \
- ((hcr) = (((hcr) & SBA200E_STICKY_BITS) | (bits)))
-#define SBA200E_HCR_CLR(hcr,bits) \
- ((hcr) = ((hcr) & (SBA200E_STICKY_BITS ^ (bits))))
-
-
-
-/*
- * SBA-200 SBus Slave Interface
- * ----------------------------
- */
-
-#define SBA200_PROM_NAME "FORE,sba-200"
-
-/*
- * SBA-200 Board Control Register (BCR)
- */
-/* Write access - bit set */
-#define SBA200_CLR_SBUS_INTR 0x04 /* Clear SBus interrupt */
-#define SBA200_RESET 0x01 /* Assert board reset signal */
-
-/* Write access - bit clear */
-#define SBA200_RESET_CLR 0x00 /* Clear board reset signal */
-
-
-
-/*
- * PCA-200E PCI Bus Slave Interface
- * --------------------------------
- */
-
-/*
- * PCI Identifiers
- */
-#define FORE_VENDOR_ID 0x1127
-
-/*
- * PCA-200E PCI Configuration Space
- */
-#define PCA200E_PCI_MEMBASE 0x10 /* Memory base address */
-#define PCA200E_PCI_MCTL 0x40 /* Master control */
-
-/*
- * PCA-200E Address Space
- */
-#define PCA200E_RAM_SIZE 0x100000
-#define PCA200E_HCR_OFFSET 0x100000
-#define PCA200E_IMASK_OFFSET 0x100004
-#define PCA200E_PSR_OFFSET 0x100008
-#define PCA200E_MMAP_SIZE 0x10000c
-
-/*
- * PCA-200E Master Control
- */
-#define PCA200E_MCTL_SWAP 0x4000 /* Convert Slave endianess */
-
-/*
- * PCA-200E Host Control Register (HCR)
- */
-#define PCA200E_READ_BITS 0x0ff /* Valid read data bits */
-#define PCA200E_WRITE_BITS 0x01f /* Valid write data bits */
-#define PCA200E_STICKY_BITS 0x000 /* Sticky data bits */
-
-/* Read access */
-#define PCA200E_TEST_MODE 0x080 /* Device is in test-mode */
-#define PCA200E_IFIFO_FULL 0x040 /* Input FIFO almost full */
-#define PCA200E_ESP_HOLD_RD 0x020 /* State of ESP hold bus */
-#define PCA200E_OFIFO_FULL 0x010 /* Output FIFO almost full */
-#define PCA200E_HOLD_ACK 0x008 /* State of Hold Ack */
-#define PCA200E_SELFTEST_FAIL 0x004 /* i960 self-test failed */
-#define PCA200E_HOLD_LOCK_RD 0x002 /* State of i960 hold lock signal */
-#define PCA200E_RESET_BD 0x001 /* State of board reset signal */
-
-/* Write access */
-#define PCA200E_CLR_HBUS_INT 0x010 /* Clear host bus interrupt */
-#define PCA200E_I960_INTRA 0x008 /* Set slave interrupt A */
-#define PCA200E_I960_INTRB 0x004 /* Set slave interrupt B */
-#define PCA200E_HOLD_LOCK 0x002 /* Set (clear) i960 hold lock signal */
-#define PCA200E_RESET 0x001 /* Set (clear) board reset signal */
-
-#define PCA200E_HCR_INIT(hcr,bits) \
- ((hcr) = (PCA200E_WRITE_BITS & (bits)))
-#define PCA200E_HCR_SET(hcr,bits) \
- ((hcr) = (bits))
-#define PCA200E_HCR_CLR(hcr,bits) \
- ((hcr) = 0)
-
-#endif /* _FORE_SLAVE_H */
diff --git a/sys/dev/hfa/fore_stats.c b/sys/dev/hfa/fore_stats.c
deleted file mode 100644
index 4126c1f0635c..000000000000
--- a/sys/dev/hfa/fore_stats.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Device statistics routines
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Get device statistics from CP
- *
- * This function will issue a GET_STATS command to the CP in order to
- * initiate the DMA transfer of the CP's statistics structure to the host.
- * We will then sleep pending command completion. This must only be called
- * from the ioctl system call handler.
- *
- * Called at splnet.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * 0 stats retrieval successful
- * errno stats retrieval failed - reason indicated
- *
- */
-int
-fore_get_stats(fup)
- Fore_unit *fup;
-{
- H_cmd_queue *hcp;
- Cmd_queue *cqp;
- int s, sst;
-
- ATM_DEBUG1("fore_get_stats: fup=%p\n", fup);
-
- /*
- * Make sure device has been initialized
- */
- if ((fup->fu_flags & CUF_INITED) == 0) {
- return (EIO);
- }
-
- /*
- * If someone has already initiated a stats request, we'll
- * just wait for that one to complete
- */
- s = splimp();
- if (fup->fu_flags & FUF_STATCMD) {
-
-#if (defined(BSD) && (BSD >= 199103))
- sst = tsleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH, "fore", 0);
-#else
- sst = sleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH);
- if (sst != 0)
- sst = EINTR;
-#endif
- (void) splx(s);
- return (sst ? sst : fup->fu_stats_ret);
- }
-
- /*
- * Limit stats gathering to once a second or so
- */
- if (time_second == fup->fu_stats_time) {
- (void) splx(s);
- return (0);
- } else
- fup->fu_stats_time = time_second;
-
- /*
- * Queue command at end of command queue
- */
- hcp = fup->fu_cmd_tail;
- if ((*hcp->hcq_status) & QSTAT_FREE) {
- vm_paddr_t dma;
-
- /*
- * Queue entry available, so set our view of things up
- */
- hcp->hcq_code = CMD_GET_STATS;
- hcp->hcq_arg = NULL;
- fup->fu_cmd_tail = hcp->hcq_next;
-
- /*
- * Now set the CP-resident queue entry - the CP will grab
- * the command when the op-code is set.
- */
- cqp = hcp->hcq_cpelem;
- (*hcp->hcq_status) = QSTAT_PENDING;
-
- dma = vtophys(fup->fu_stats);
- if (dma == 0) {
- fup->fu_stats->st_drv.drv_cm_nodma++;
- (void) splx(s);
- return (EIO);
- }
- fup->fu_statsd = dma;
- cqp->cmdq_stats.stats_buffer = (CP_dma) CP_WRITE(dma);
-
- fup->fu_flags |= FUF_STATCMD;
- cqp->cmdq_stats.stats_cmd =
- CP_WRITE(CMD_GET_STATS | CMD_INTR_REQ);
-
- /*
- * Now wait for command to finish
- */
-#if (defined(BSD) && (BSD >= 199103))
- sst = tsleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH, "fore", 0);
-#else
- sst = sleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH);
- if (sst != 0)
- sst = EINTR;
-#endif
- (void) splx(s);
- return (sst ? sst : fup->fu_stats_ret);
-
- } else {
- /*
- * Command queue full
- */
- fup->fu_stats->st_drv.drv_cm_full++;
- (void) splx(s);
- return (EIO);
- }
-}
-
diff --git a/sys/dev/hfa/fore_stats.h b/sys/dev/hfa/fore_stats.h
deleted file mode 100644
index 32095164d8e4..000000000000
--- a/sys/dev/hfa/fore_stats.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Driver statistics definitions
- *
- */
-
-#ifndef _FORE_STATS_H
-#define _FORE_STATS_H
-
-
-/*
- * Fore Driver Statistics
- */
-struct Stats_driver {
- u_long drv_xm_notact; /* PDU drops out - VCC not active */
- u_long drv_xm_full; /* Xmit queue full */
- u_long drv_xm_maxpdu; /* PDU drops out - max segment/size */
- u_long drv_xm_segnoal; /* Non-aligned segments */
- u_long drv_xm_seglen; /* Padded length segments */
- u_long drv_xm_segdma; /* PDU drops out - no dma address */
- u_long drv_rv_novcc; /* PDU drops in - no VCC */
- u_long drv_rv_nosbf; /* No small buffers */
- u_long drv_rv_nomb; /* PDU drops in - no buffer */
- u_long drv_rv_ifull; /* PDU drops in - intr queue full */
- u_long drv_bf_segdma; /* Buffer supply - no dma address */
- u_long drv_cm_full; /* Command queue full */
- u_long drv_cm_nodma; /* Command failed - no dma address */
-};
-typedef struct Stats_driver Stats_driver;
-
-
-/*
- * Fore Device Statistics
- *
- * This structure is used by pass all statistics (including CP maintained
- * and driver maintained) data to user space (atm command).
- */
-struct fore_stats {
- Fore_cp_stats st_cpstat; /* CP stats */
- Stats_driver st_drv; /* Driver maintained stats */
-};
-typedef struct fore_stats Fore_stats;
-
-#define st_taxi st_cpstat.st_cp_taxi
-#define st_oc3 st_cpstat.st_cp_oc3
-#define st_atm st_cpstat.st_cp_atm
-#define st_aal0 st_cpstat.st_cp_aal0
-#define st_aal4 st_cpstat.st_cp_aal4
-#define st_aal5 st_cpstat.st_cp_aal5
-#define st_misc st_cpstat.st_cp_misc
-
-#endif /* _FORE_STATS_H */
diff --git a/sys/dev/hfa/fore_timer.c b/sys/dev/hfa/fore_timer.c
deleted file mode 100644
index 51745ac9336f..000000000000
--- a/sys/dev/hfa/fore_timer.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Timer processing
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Process a Fore timer tick
- *
- * This function is called every FORE_TIME_TICK seconds in order to update
- * all of the unit watchdog timers.
- *
- * Called at splnet.
- *
- * Arguments:
- * tip pointer to fore timer control block
- *
- * Returns:
- * none
- *
- */
-void
-fore_timeout(tip)
- struct atm_time *tip;
-{
- Fore_unit *fup;
- int i;
-
-
- /*
- * Schedule next timeout
- */
- atm_timeout(&fore_timer, ATM_HZ * FORE_TIME_TICK, fore_timeout);
-
- /*
- * Run through all units, updating each active timer.
- * If an expired timer is found, notify that unit.
- */
- for (i = 0; i < fore_nunits; i++) {
-
- if ((fup = fore_units[i]) == NULL)
- continue;
-
- /*
- * Decrement timer, if it's active
- */
- if (fup->fu_timer && (--fup->fu_timer == 0)) {
-
- /*
- * Timeout occurred - go check out the queues
- */
- ATM_DEBUG0("fore_timeout\n");
- DEVICE_LOCK((Cmn_unit *)fup);
- fore_watchdog(fup);
- DEVICE_UNLOCK((Cmn_unit *)fup);
- }
- }
-}
-
diff --git a/sys/dev/hfa/fore_transmit.c b/sys/dev/hfa/fore_transmit.c
deleted file mode 100644
index e22f696a40b1..000000000000
--- a/sys/dev/hfa/fore_transmit.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Transmit queue management
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_vc.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * Allocate Transmit Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * 0 allocations successful
- * else allocation failed
- */
-int
-fore_xmit_allocate(fup)
- Fore_unit *fup;
-{
- void *memp;
- vm_paddr_t pmemp;
- H_xmit_queue *hxp;
- int i;
-
- /*
- * Allocate non-cacheable memory for transmit status words
- */
- memp = atm_dev_alloc(sizeof(Q_status) * XMIT_QUELEN,
- QSTAT_ALIGN, ATM_DEV_NONCACHE);
- if (memp == NULL) {
- return (1);
- }
- fup->fu_xmit_stat = (Q_status *) memp;
-
- pmemp = vtophys(fup->fu_xmit_stat);
- if (pmemp == 0) {
- return (1);
- }
- fup->fu_xmit_statd = pmemp;
-
- /*
- * Allocate memory for transmit descriptors
- *
- * We will allocate the transmit descriptors individually rather than
- * as a single memory block, which will often be larger than a memory
- * page. On some systems (eg. FreeBSD) the physical addresses of
- * adjacent virtual memory pages are not contiguous.
- */
- hxp = fup->fu_xmit_q;
- for (i = 0; i < XMIT_QUELEN; i++, hxp++) {
-
- /*
- * Allocate a transmit descriptor for this queue entry
- */
- hxp->hxq_descr = atm_dev_alloc(sizeof(Xmit_descr),
- XMIT_DESCR_ALIGN, 0);
- if (hxp->hxq_descr == NULL) {
- return (1);
- }
-
- hxp->hxq_descr_dma = vtophys(hxp->hxq_descr);
- if (hxp->hxq_descr_dma == 0) {
- return (1);
- }
- }
-
- return (0);
-}
-
-
-/*
- * Transmit Queue Initialization
- *
- * Allocate and initialize the host-resident transmit queue structures
- * and then initialize the CP-resident queue structures.
- *
- * Called at interrupt level.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_xmit_initialize(fup)
- Fore_unit *fup;
-{
- Aali *aap = fup->fu_aali;
- Xmit_queue *cqp;
- H_xmit_queue *hxp;
- Q_status *qsp;
- vm_paddr_t qsp_dma;
- int i;
-
- /*
- * Point to CP-resident transmit queue
- */
- cqp = (Xmit_queue *)(fup->fu_ram + CP_READ(aap->aali_xmit_q));
-
- /*
- * Point to host-resident transmit queue structures
- */
- hxp = fup->fu_xmit_q;
- qsp = fup->fu_xmit_stat;
- qsp_dma = fup->fu_xmit_statd;
-
- /*
- * Loop thru all queue entries and do whatever needs doing
- */
- for (i = 0; i < XMIT_QUELEN; i++) {
-
- /*
- * Set queue status word to free
- */
- *qsp = QSTAT_FREE;
-
- /*
- * Set up host queue entry and link into ring
- */
- hxp->hxq_cpelem = cqp;
- hxp->hxq_status = qsp;
- if (i == (XMIT_QUELEN - 1))
- hxp->hxq_next = fup->fu_xmit_q;
- else
- hxp->hxq_next = hxp + 1;
-
- /*
- * Now let the CP into the game
- */
- cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
-
- /*
- * Bump all queue pointers
- */
- hxp++;
- qsp++;
- qsp_dma += sizeof(Q_status);
- cqp++;
- }
-
- /*
- * Initialize queue pointers
- */
- fup->fu_xmit_head = fup->fu_xmit_tail = fup->fu_xmit_q;
-
- return;
-}
-
-
-/*
- * Drain Transmit Queue
- *
- * This function will free all completed entries at the head of the
- * transmit queue. Freeing the entry includes releasing the transmit
- * buffers (buffer chain) back to the kernel.
- *
- * May be called in interrupt state.
- * Must be called with interrupts locked out.
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_xmit_drain(fup)
- Fore_unit *fup;
-{
- H_xmit_queue *hxp;
- H_dma *sdmap;
- Fore_vcc *fvp;
- struct vccb *vcp;
- KBuffer *m;
-
- /*
- * Process each completed entry
- */
- while (*fup->fu_xmit_head->hxq_status & QSTAT_COMPLETED) {
-
- hxp = fup->fu_xmit_head;
-
- /*
- * Release the entry's DMA addresses and buffer chain
- */
- for (m = hxp->hxq_buf, sdmap = hxp->hxq_dma; m;
- m = KB_NEXT(m), sdmap++) {
- caddr_t cp;
-
- KB_DATASTART(m, cp, caddr_t);
- }
- KB_FREEALL(hxp->hxq_buf);
-
- /*
- * Get VCC over which data was sent (may be null if
- * VCC has been closed in the meantime)
- */
- fvp = hxp->hxq_vcc;
-
- /*
- * Now collect some statistics
- */
- if (*hxp->hxq_status & QSTAT_ERROR) {
- /*
- * CP ran into problems, not much we can do
- * other than record the event
- */
- fup->fu_pif.pif_oerrors++;
- if (fvp) {
- vcp = fvp->fv_connvc->cvc_vcc;
- vcp->vc_oerrors++;
- if (vcp->vc_nif)
- ANIF2IFP(vcp->vc_nif)->if_oerrors++;
- }
- } else {
- /*
- * Good transmission
- */
- int len = XDS_GET_LEN(hxp->hxq_descr->xd_spec);
-
- fup->fu_pif.pif_opdus++;
- fup->fu_pif.pif_obytes += len;
- if (fvp) {
- vcp = fvp->fv_connvc->cvc_vcc;
- vcp->vc_opdus++;
- vcp->vc_obytes += len;
- if (vcp->vc_nif) {
- vcp->vc_nif->nif_obytes += len;
- ANIF2IFP(vcp->vc_nif)->if_opackets++;
-#if (defined(BSD) && (BSD >= 199103))
- ANIF2IFP(vcp->vc_nif)->if_obytes += len;
-#endif
- }
- }
- }
-
- /*
- * Mark this entry free for use and bump head pointer
- * to the next entry in the queue
- */
- *hxp->hxq_status = QSTAT_FREE;
- fup->fu_xmit_head = hxp->hxq_next;
- }
-
- return;
-}
-
-
-/*
- * Free Transmit Queue Data Structures
- *
- * Arguments:
- * fup pointer to device unit structure
- *
- * Returns:
- * none
- */
-void
-fore_xmit_free(fup)
- Fore_unit *fup;
-{
- H_xmit_queue *hxp;
- H_dma *sdmap;
- KBuffer *m;
- int i;
-
- /*
- * Free any transmit buffers left on the queue
- */
- if (fup->fu_flags & CUF_INITED) {
- while (*fup->fu_xmit_head->hxq_status != QSTAT_FREE) {
-
- hxp = fup->fu_xmit_head;
-
- /*
- * Release the entry's DMA addresses and buffer chain
- */
- for (m = hxp->hxq_buf, sdmap = hxp->hxq_dma; m;
- m = KB_NEXT(m), sdmap++) {
- caddr_t cp;
-
- KB_DATASTART(m, cp, caddr_t);
- }
- KB_FREEALL(hxp->hxq_buf);
-
- *hxp->hxq_status = QSTAT_FREE;
- fup->fu_xmit_head = hxp->hxq_next;
- }
- }
-
- /*
- * Free the status words
- */
- if (fup->fu_xmit_stat) {
- atm_dev_free((volatile void *)fup->fu_xmit_stat);
- fup->fu_xmit_stat = NULL;
- fup->fu_xmit_statd = 0;
- }
-
- /*
- * Free the transmit descriptors
- */
- hxp = fup->fu_xmit_q;
- for (i = 0; i < XMIT_QUELEN; i++, hxp++) {
-
- /*
- * Free the transmit descriptor for this queue entry
- */
- if (hxp->hxq_descr_dma) {
- hxp->hxq_descr_dma = 0;
- }
-
- if (hxp->hxq_descr) {
- atm_dev_free(hxp->hxq_descr);
- hxp->hxq_descr = NULL;
- }
- }
-
- return;
-}
-
diff --git a/sys/dev/hfa/fore_var.h b/sys/dev/hfa/fore_var.h
deleted file mode 100644
index 57cedb3a761f..000000000000
--- a/sys/dev/hfa/fore_var.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Host protocol control blocks
- *
- */
-
-#ifndef _FORE_VAR_H
-#define _FORE_VAR_H
-
-/*
- * Device VCC Entry
- *
- * Contains the common and Fore-specific information for each VCC
- * which is opened through a Fore device.
- */
-struct fore_vcc {
- struct cmn_vcc fv_cmn; /* Common VCC stuff */
- Fore_aal fv_aal; /* CP version of AAL */
- uint32_t rate; /* Rate control (data/idle cell ratio) */
-};
-typedef struct fore_vcc Fore_vcc;
-
-#define fv_next fv_cmn.cv_next
-#define fv_toku fv_cmn.cv_toku
-#define fv_upper fv_cmn.cv_upper
-#define fv_connvc fv_cmn.cv_connvc
-#define fv_state fv_cmn.cv_state
-#define fv_flags fv_cmn.cv_flags
-
-/*
- * VCC Flags
- */
-#define FVF_ACTCMD 0x01 /* Activate command issued */
-
-
-/*
- * Host Transmit Queue Element
- *
- * Defines the host's view of the CP PDU Transmit Queue
- */
-struct h_xmit_queue {
- struct h_xmit_queue *hxq_next; /* Next element in queue */
- Xmit_queue *hxq_cpelem; /* CP queue element */
- Q_status *hxq_status; /* Element status word */
- Xmit_descr *hxq_descr; /* Element's transmit descriptor */
- vm_paddr_t hxq_descr_dma; /* Element's transmit descriptor */
- Fore_vcc *hxq_vcc; /* Data's VCC */
- KBuffer *hxq_buf; /* Data's buffer chain head */
- H_dma hxq_dma[XMIT_MAX_SEGS]; /* DMA addresses for segments */
-};
-typedef struct h_xmit_queue H_xmit_queue;
-
-
-
-/*
- * Host Receive Queue Element
- *
- * Defines the host's view of the CP PDU Receive Queue
- */
-struct h_recv_queue {
- struct h_recv_queue *hrq_next; /* Next element in queue */
- Recv_queue *hrq_cpelem; /* CP queue element */
- Q_status *hrq_status; /* Element status word */
- Recv_descr *hrq_descr; /* Element's receive descriptor */
- vm_paddr_t hrq_descr_dma; /* Element's receive descriptor */
-};
-typedef struct h_recv_queue H_recv_queue;
-
-
-
-/*
- * Host Buffer Supply Queue Element
- *
- * Defines the host's view of the CP Buffer Supply Queue
- */
-struct h_buf_queue {
- struct h_buf_queue *hbq_next; /* Next element in queue */
- Buf_queue *hbq_cpelem; /* CP queue element */
- Q_status *hbq_status; /* Element status word */
- Buf_descr *hbq_descr; /* Element's buffer descriptor array */
- vm_paddr_t hbq_descr_dma; /* Element's buffer descriptor array */
-};
-typedef struct h_buf_queue H_buf_queue;
-
-
-
-/*
- * Host Command Queue Element
- *
- * Defines the host's view of the CP Command Queue
- */
-struct h_cmd_queue {
- struct h_cmd_queue *hcq_next; /* Next element in queue */
- Cmd_queue *hcq_cpelem; /* CP queue element */
- Q_status *hcq_status; /* Element status word */
- Cmd_code hcq_code; /* Command code */
- void *hcq_arg; /* Command-specific argument */
-};
-typedef struct h_cmd_queue H_cmd_queue;
-
-
-
-/*
- * Host Buffer Handle
- *
- * For each buffer supplied to the CP, there will be one of these structures
- * embedded into the non-data portion of the buffer. This will allow us to
- * track which buffers are currently "controlled" by the CP. The address of
- * this structure will supplied to/returned from the CP as the buffer handle.
- */
-struct buf_handle {
- Qelem_t bh_qelem; /* Queuing element */
- u_int bh_type; /* Buffer type (see below) */
- H_dma bh_dma; /* Buffer DMA address */
-};
-typedef struct buf_handle Buf_handle;
-#define SIZEOF_Buf_handle 16
-
-/*
- * Buffer Types
- */
-#define BHT_S1_SMALL 1 /* Buffer strategy 1, small */
-#define BHT_S1_LARGE 2 /* Buffer strategy 1, large */
-#define BHT_S2_SMALL 3 /* Buffer strategy 2, small */
-#define BHT_S2_LARGE 4 /* Buffer strategy 2, large */
-
-
-
-/*
- * Device Unit Structure
- *
- * Contains all the information for a single device (adapter).
- */
-struct fore_unit {
- Cmn_unit fu_cmn; /* Common unit stuff */
- Fore_reg *fu_ctlreg; /* Device control register */
- Fore_reg *fu_imask; /* Interrupt mask register */
- Fore_reg *fu_psr; /* PCI specific register */
-#ifdef COMPAT_OLDPCI
- pcici_t fu_pcitag; /* PCI tag */
-#endif
- Fore_mem *fu_ram; /* Device RAM */
- u_int fu_ramsize; /* Size of device RAM */
- Mon960 *fu_mon; /* Monitor program interface */
- Aali *fu_aali; /* Microcode program interface */
- u_int fu_timer; /* Watchdog timer value */
-
- /* Transmit Queue */
- H_xmit_queue fu_xmit_q[XMIT_QUELEN]; /* Host queue */
- H_xmit_queue *fu_xmit_head; /* Queue head */
- H_xmit_queue *fu_xmit_tail; /* Queue tail */
- Q_status *fu_xmit_stat; /* Status array (host) */
- vm_paddr_t fu_xmit_statd; /* Status array (DMA) */
-
- /* Receive Queue */
- H_recv_queue fu_recv_q[RECV_QUELEN]; /* Host queue */
- H_recv_queue *fu_recv_head; /* Queue head */
- Q_status *fu_recv_stat; /* Status array (host) */
- vm_paddr_t fu_recv_statd; /* Status array (DMA) */
- Recv_descr *fu_recv_desc; /* Descriptor array (host) */
- vm_paddr_t fu_recv_descd; /* Descriptor array (DMA) */
-
- /* Buffer Supply Queue - Strategy 1 Small */
- H_buf_queue fu_buf1s_q[BUF1_SM_QUELEN]; /* Host queue */
- H_buf_queue *fu_buf1s_head; /* Queue head */
- H_buf_queue *fu_buf1s_tail; /* Queue tail */
- Q_status *fu_buf1s_stat; /* Status array (host) */
- vm_paddr_t fu_buf1s_statd;/* Status array (DMA) */
- Buf_descr *fu_buf1s_desc; /* Descriptor array (host) */
- vm_paddr_t fu_buf1s_descd;/* Descriptor array (DMA) */
- Queue_t fu_buf1s_bq; /* Queue of supplied buffers */
- u_int fu_buf1s_cnt; /* Count of supplied buffers */
-
- /* Buffer Supply Queue - Strategy 1 Large */
- H_buf_queue fu_buf1l_q[BUF1_LG_QUELEN]; /* Host queue */
- H_buf_queue *fu_buf1l_head; /* Queue head */
- H_buf_queue *fu_buf1l_tail; /* Queue tail */
- Q_status *fu_buf1l_stat; /* Status array (host) */
- vm_paddr_t fu_buf1l_statd;/* Status array (DMA) */
- Buf_descr *fu_buf1l_desc; /* Descriptor array (host) */
- vm_paddr_t fu_buf1l_descd;/* Descriptor array (DMA) */
- Queue_t fu_buf1l_bq; /* Queue of supplied buffers */
- u_int fu_buf1l_cnt; /* Count of supplied buffers */
-
- /* Command Queue */
- H_cmd_queue fu_cmd_q[CMD_QUELEN]; /* Host queue */
- H_cmd_queue *fu_cmd_head; /* Queue head */
- H_cmd_queue *fu_cmd_tail; /* Queue tail */
- Q_status *fu_cmd_stat; /* Status array (host) */
- vm_paddr_t fu_cmd_statd; /* Status array (DMA) */
-
- Fore_stats *fu_stats; /* Device statistics buffer */
- vm_paddr_t fu_statsd; /* Device statistics buffer (DMA) */
- time_t fu_stats_time; /* Last stats request timestamp */
- int fu_stats_ret; /* Stats request return code */
- Fore_prom *fu_prom; /* Device PROM buffer */
- vm_paddr_t fu_promd; /* Device PROM buffer (DMA) */
- struct callout_handle fu_thandle; /* Timer handle */
- int fu_ft4; /* Running ForeThought 4 firmware */
-
- /* shaping enable */
- u_int fu_shape;
- u_int fu_num_shaped; /* number of shaped VCCs */
-};
-typedef struct fore_unit Fore_unit;
-
-#define fu_pif fu_cmn.cu_pif
-#define fu_unit fu_cmn.cu_unit
-#define fu_flags fu_cmn.cu_flags
-#define fu_mtu fu_cmn.cu_mtu
-#define fu_open_vcc fu_cmn.cu_open_vcc
-#define fu_vcc fu_cmn.cu_vcc
-#define fu_intrpri fu_cmn.cu_intrpri
-#define fu_savepri fu_cmn.cu_savepri
-#define fu_vcc_zone fu_cmn.cu_vcc_zone
-#define fu_nif_zone fu_cmn.cu_nif_zone
-#define fu_ioctl fu_cmn.cu_ioctl
-#define fu_instvcc fu_cmn.cu_instvcc
-#define fu_openvcc fu_cmn.cu_openvcc
-#define fu_closevcc fu_cmn.cu_closevcc
-#define fu_output fu_cmn.cu_output
-#define fu_config fu_cmn.cu_config
-#define fu_softc fu_cmn.cu_softc
-
-/*
- * Device flags (in addition to CUF_* flags)
- */
-#define FUF_STATCMD 0x80 /* Statistics request in progress */
-
-/*
- * Shaping values
- */
-#define FUS_NO_SHAPING 0
-#define FUS_SHAPE_ONE 1
-#define FUS_SHAPE_ALL 2
-
-/*
- * Macros to access CP memory
- */
-#define CP_READ(x) ntohl((u_long)(x))
-#define CP_WRITE(x) htonl((u_long)(x))
-
-#endif /* _FORE_VAR_H */
diff --git a/sys/dev/hfa/fore_vcm.c b/sys/dev/hfa/fore_vcm.c
deleted file mode 100644
index 95bc6524be99..000000000000
--- a/sys/dev/hfa/fore_vcm.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/*-
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- * @(#) $FreeBSD$
- *
- */
-
-/*
- * FORE Systems 200-Series Adapter Support
- * ---------------------------------------
- *
- * Virtual Channel Management
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_vc.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-#include <dev/pci/pcivar.h>
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#ifndef lint
-__RCSID("@(#) $FreeBSD$");
-#endif
-
-
-/*
- * VCC Stack Instantiation
- *
- * This function is called via the common driver code during a device VCC
- * stack instantiation. The common code has already validated some of
- * the request so we just need to check a few more Fore-specific details.
- *
- * Called at splnet.
- *
- * Arguments:
- * cup pointer to device common unit
- * cvp pointer to common VCC entry
- *
- * Returns:
- * 0 instantiation successful
- * err instantiation failed - reason indicated
- *
- */
-int
-fore_instvcc(cup, cvp)
- Cmn_unit *cup;
- Cmn_vcc *cvp;
-{
- Fore_vcc *fvp = (Fore_vcc *)cvp;
- Atm_attributes *ap = &fvp->fv_connvc->cvc_attr;
-
- /*
- * Validate requested AAL
- */
- switch (ap->aal.type) {
-
- case ATM_AAL0:
- fvp->fv_aal = FORE_AAL_0;
- break;
-
- case ATM_AAL3_4:
- fvp->fv_aal = FORE_AAL_4;
- if ((ap->aal.v.aal4.forward_max_SDU_size > FORE_IFF_MTU) ||
- (ap->aal.v.aal4.backward_max_SDU_size > FORE_IFF_MTU))
- return (EINVAL);
- break;
-
- case ATM_AAL5:
- fvp->fv_aal = FORE_AAL_5;
- if ((ap->aal.v.aal5.forward_max_SDU_size > FORE_IFF_MTU) ||
- (ap->aal.v.aal5.backward_max_SDU_size > FORE_IFF_MTU))
- return (EINVAL);
- break;
-
- default:
- return (EINVAL);
- }
-
- return (0);
-}
-
-static const u_int rate_tab[255] = {
- 353207, /* 0 */
- 312501, /* 1 */ 312501, /* 2 */
- 312501, /* 3 */ 312501, /* 4 */
- 312501, /* 5 */ 312501, /* 6 */
- 312501, /* 7 */ 312501, /* 8 */
- 312501, /* 9 */ 312501, /* 10 */
- 312501, /* 11 */ 312501, /* 12 */
- 312501, /* 13 */ 312501, /* 14 */
- 312501, /* 15 */ 312501, /* 16 */
- 312501, /* 17 */ 284091, /* 18 */
- 284091, /* 19 */ 284091, /* 20 */
- 284091, /* 21 */ 284091, /* 22 */
- 284091, /* 23 */ 284091, /* 24 */
- 284091, /* 25 */ 284091, /* 26 */
- 284091, /* 27 */ 284091, /* 28 */
- 284091, /* 29 */ 284091, /* 30 */
- 284091, /* 31 */ 284091, /* 32 */
- 284091, /* 33 */ 284091, /* 34 */
- 284091, /* 35 */ 284091, /* 36 */
- 284091, /* 37 */ 284091, /* 38 */
- 260417, /* 39 */ 260417, /* 40 */
- 260417, /* 41 */ 260417, /* 42 */
- 260417, /* 43 */ 260417, /* 44 */
- 260417, /* 45 */ 260417, /* 46 */
- 260417, /* 47 */ 260417, /* 48 */
- 260417, /* 49 */ 260417, /* 50 */
- 260417, /* 51 */ 260417, /* 52 */
- 260417, /* 53 */ 260417, /* 54 */
- 260417, /* 55 */ 240385, /* 56 */
- 240385, /* 57 */ 240385, /* 58 */
- 240385, /* 59 */ 240385, /* 60 */
- 240385, /* 61 */ 240385, /* 62 */
- 240385, /* 63 */ 240385, /* 64 */
- 240385, /* 65 */ 240385, /* 66 */
- 240385, /* 67 */ 240385, /* 68 */
- 240385, /* 69 */ 240385, /* 70 */
- 223215, /* 71 */ 223215, /* 72 */
- 223215, /* 73 */ 223215, /* 74 */
- 223215, /* 75 */ 223215, /* 76 */
- 223215, /* 77 */ 223215, /* 78 */
- 223215, /* 79 */ 223215, /* 80 */
- 223215, /* 81 */ 223215, /* 82 */
- 223215, /* 83 */ 208334, /* 84 */
- 208334, /* 85 */ 208334, /* 86 */
- 208334, /* 87 */ 208334, /* 88 */
- 208334, /* 89 */ 208334, /* 90 */
- 208334, /* 91 */ 208334, /* 92 */
- 208334, /* 93 */ 208334, /* 94 */
- 195313, /* 95 */ 195313, /* 96 */
- 195313, /* 97 */ 195313, /* 98 */
- 195313, /* 101 */ 195313, /* 102 */
- 195313, /* 103 */ 183824, /* 104 */
- 183824, /* 105 */ 183824, /* 106 */
- 183824, /* 107 */ 183824, /* 108 */
- 183824, /* 109 */ 183824, /* 110 */
- 183824, /* 111 */ 183824, /* 112 */
- 173612, /* 113 */ 173612, /* 114 */
- 173612, /* 115 */ 173612, /* 116 */
- 173612, /* 117 */ 173612, /* 118 */
- 173612, /* 119 */ 173612, /* 120 */
- 164474, /* 121 */ 164474, /* 122 */
- 164474, /* 123 */ 164474, /* 124 */
- 164474, /* 125 */ 164474, /* 126 */
- 164474, /* 127 */ 156250, /* 128 */
- 156250, /* 129 */ 156250, /* 130 */
- 156250, /* 131 */ 156250, /* 132 */
- 156250, /* 133 */ 148810, /* 134 */
- 148810, /* 135 */ 148810, /* 136 */
- 148810, /* 137 */ 148810, /* 138 */
- 148810, /* 139 */ 142046, /* 140 */
- 142046, /* 141 */ 142046, /* 142 */
- 142046, /* 143 */ 142046, /* 144 */
- 135870, /* 145 */ 135870, /* 146 */
- 135870, /* 147 */ 135870, /* 148 */
- 130209, /* 149 */ 130209, /* 150 */
- 130209, /* 151 */ 130209, /* 152 */
- 130209, /* 153 */ 125000, /* 154 */
- 125000, /* 155 */ 125000, /* 156 */
- 125000, /* 157 */ 120193, /* 158 */
- 120193, /* 159 */ 120193, /* 160 */
- 115741, /* 161 */ 115741, /* 162 */
- 115741, /* 163 */ 115741, /* 164 */
- 111608, /* 165 */ 111608, /* 166 */
- 111608, /* 167 */ 107759, /* 168 */
- 107759, /* 169 */ 107759, /* 170 */
- 104167, /* 171 */ 104167, /* 172 */
- 104167, /* 173 */ 100807, /* 174 */
- 100807, /* 175 */ 97657, /* 176 */
- 97657, /* 177 */ 97657, /* 178 */
- 94697, /* 179 */ 94697, /* 180 */
- 91912, /* 181 */ 91912, /* 182 */
- 89286, /* 183 */ 89286, /* 184 */
- 86806, /* 185 */ 86806, /* 186 */
- 84460, /* 187 */ 84460, /* 188 */
- 82237, /* 189 */ 82237, /* 190 */
- 80129, /* 191 */ 78125, /* 192 */
- 78126, /* 193 */ 76220, /* 194 */
- 74405, /* 195 */ 74405, /* 196 */
- 72675, /* 197 */ 71023, /* 198 */
- 69445, /* 199 */ 69445, /* 200 */
- 67935, /* 201 */ 66490, /* 202 */
- 65105, /* 203 */ 63776, /* 204 */
- 62500, /* 205 */ 61275, /* 206 */
- 60097, /* 207 */ 58963, /* 208 */
- 57871, /* 209 */ 56819, /* 210 */
- 54825, /* 211 */ 53880, /* 212 */
- 52967, /* 213 */ 51230, /* 214 */
- 50404, /* 215 */ 48829, /* 216 */
- 47349, /* 217 */ 46642, /* 218 */
- 45290, /* 219 */ 44015, /* 220 */
- 42809, /* 221 */ 41119, /* 222 */
- 40065, /* 223 */ 39063, /* 224 */
- 37651, /* 225 */ 36338, /* 226 */
- 35113, /* 227 */ 33968, /* 228 */
- 32553, /* 229 */ 31250, /* 230 */
- 30049, /* 231 */ 28936, /* 232 */
- 27655, /* 233 */ 26261, /* 234 */
- 25000, /* 235 */ 23855, /* 236 */
- 22645, /* 237 */ 21259, /* 238 */
- 20033, /* 239 */ 18826, /* 240 */
- 17557, /* 241 */ 16277, /* 242 */
- 15025, /* 243 */ 13767, /* 244 */
- 12551, /* 245 */ 11282, /* 246 */
- 10017, /* 247 */ 8779, /* 248 */
- 7531, /* 249 */ 6263, /* 250 */
- 5017, /* 251 */ 3761, /* 252 */
- 2509, /* 253 */ 1254, /* 254 */
-};
-
-/*
- * Find the best match of the high part of the Rate Control Information
- *
- * This function is called when a VC is opened in order to help
- * in converting Fore's rate to PCR.
- * The Fore's Rate Control Information is encoded as 32-bit field
- * comprised of two 16-bit subfields.
- *
- * Arguments:
- * *pcr Peak Cell Rate, will be updated with actual value
- *
- * Returns:
- * descr the rate descriptor
- *
- */
-static uint32_t
-pcr2rate(int32_t *pcr)
-{
- u_int i;
-
- if (*pcr >= rate_tab[0]) {
- /* special case link rate */
- *pcr = rate_tab[0];
- return (0);
- }
-
- for (i = 0; i < sizeof(rate_tab) / sizeof(rate_tab[0]); i++)
- if (*pcr >= rate_tab[i])
- break;
- if (i == sizeof(rate_tab) / sizeof(rate_tab[0])) {
- /* smaller than smallest */
- i--;
- }
- /* update with the actual value */
- *pcr = rate_tab[i];
- return ((255 - i) << 16) | i;
-}
-
-/*
- * Open a VCC
- *
- * This function is called via the common driver code after receiving a
- * stack *_INIT command. The common code has already validated most of
- * the request so we just need to check a few more Fore-specific details.
- * Then we just issue the command to the CP. Note that we can't wait around
- * for the CP to process the command, so we return success for now and abort
- * the connection if the command later fails.
- *
- * Called at splimp.
- *
- * Arguments:
- * cup pointer to device common unit
- * cvp pointer to common VCC entry
- *
- * Returns:
- * 0 open successful
- * else open failed
- *
- */
-int
-fore_openvcc(cup, cvp)
- Cmn_unit *cup;
- Cmn_vcc *cvp;
-{
- Fore_unit *fup = (Fore_unit *)cup;
- Fore_vcc *fvp = (Fore_vcc *)cvp;
- H_cmd_queue *hcp;
- Cmd_queue *cqp;
- struct vccb *vcp;
-
- vcp = fvp->fv_connvc->cvc_vcc;
-
- ATM_DEBUG4("fore_openvcc: fup=%p, fvp=%p, vcc=(%d,%d)\n",
- fup, fvp, vcp->vc_vpi, vcp->vc_vci);
-
- /*
- * Validate the VPI and VCI values
- */
- if ((vcp->vc_vpi > fup->fu_pif.pif_maxvpi) ||
- (vcp->vc_vci > fup->fu_pif.pif_maxvci)) {
- return (1);
- }
-
- /*
- * Compute the PCR (but only for outgoing VCCs)
- */
- fvp->rate = FORE_DEF_RATE;
- if ((vcp->vc_type & VCC_OUT) && cvp->cv_connvc) {
- Atm_attributes *attr = &cvp->cv_connvc->cvc_attr;
-
- if (attr && attr->traffic.v.forward.PCR_all_traffic > 0 &&
- attr->traffic.v.forward.PCR_all_traffic < rate_tab[0] &&
- (fup->fu_shape == FUS_SHAPE_ALL ||
- (fup->fu_shape == FUS_SHAPE_ONE &&
- fup->fu_num_shaped == 0))) {
- fvp->rate = pcr2rate(&attr->traffic.v.forward.
- PCR_all_traffic);
- fup->fu_num_shaped++;
- }
- }
-
- /*
- * Only need to tell the CP about incoming VCCs
- */
- if ((vcp->vc_type & VCC_IN) == 0) {
- DEVICE_LOCK((Cmn_unit *)fup);
- fup->fu_open_vcc++;
- fvp->fv_state = CVS_ACTIVE;
- DEVICE_UNLOCK((Cmn_unit *)fup);
- return (0);
- }
-
- /*
- * Queue command at end of command queue
- */
- hcp = fup->fu_cmd_tail;
- if ((*hcp->hcq_status) & QSTAT_FREE) {
-
- /*
- * Queue entry available, so set our view of things up
- */
- hcp->hcq_code = CMD_ACT_VCCIN;
- hcp->hcq_arg = fvp;
- fup->fu_cmd_tail = hcp->hcq_next;
- fvp->fv_flags |= FVF_ACTCMD;
-
- /*
- * Now set the CP-resident queue entry - the CP will grab
- * the command when the op-code is set.
- */
- cqp = hcp->hcq_cpelem;
- (*hcp->hcq_status) = QSTAT_PENDING;
- cqp->cmdq_act.act_vccid = CP_WRITE(vcp->vc_vci);
- if (fvp->fv_aal == FORE_AAL_0)
- cqp->cmdq_act.act_batch = CP_WRITE(1);
- cqp->cmdq_act.act_spec = CP_WRITE(
- ACT_SET_SPEC(BUF_STRAT_1, fvp->fv_aal,
- CMD_ACT_VCCIN | CMD_INTR_REQ));
- } else {
- /*
- * Command queue full
- */
- fup->fu_stats->st_drv.drv_cm_full++;
- return (1);
- }
-
- return (0);
-}
-
-
-/*
- * Close a VCC
- *
- * This function is called via the common driver code after receiving a
- * stack *_TERM command. The common code has already validated most of
- * the request so we just need to check a few more Fore-specific details.
- * Then we just issue the command to the CP. Note that we can't wait around
- * for the CP to process the command, so we return success for now and whine
- * if the command later fails.
- *
- * Called at splimp.
- *
- * Arguments:
- * cup pointer to device common unit
- * cvp pointer to common VCC entry
- *
- * Returns:
- * 0 close successful
- * else close failed
- *
- */
-int
-fore_closevcc(cup, cvp)
- Cmn_unit *cup;
- Cmn_vcc *cvp;
-{
- Fore_unit *fup = (Fore_unit *)cup;
- Fore_vcc *fvp = (Fore_vcc *)cvp;
- H_xmit_queue *hxp;
- H_cmd_queue *hcp;
- Cmd_queue *cqp;
- struct vccb *vcp;
- int i, err = 0;
-
- vcp = fvp->fv_connvc->cvc_vcc;
-
- ATM_DEBUG4("fore_closevcc: fup=%p, fvp=%p, vcc=(%d,%d)\n",
- fup, fvp, vcp->vc_vpi, vcp->vc_vci);
-
- DEVICE_LOCK((Cmn_unit *)fup);
-
- /*
- * Clear any references to this VCC in our transmit queue
- */
- for (hxp = fup->fu_xmit_head, i = 0;
- (*hxp->hxq_status != QSTAT_FREE) && (i < XMIT_QUELEN);
- hxp = hxp->hxq_next, i++) {
- if (hxp->hxq_vcc == fvp) {
- hxp->hxq_vcc = NULL;
- }
- }
-
- /*
- * Clear any references to this VCC in our command queue
- */
- for (hcp = fup->fu_cmd_head, i = 0;
- (*hcp->hcq_status != QSTAT_FREE) && (i < CMD_QUELEN);
- hcp = hcp->hcq_next, i++) {
- switch (hcp->hcq_code) {
-
- case CMD_ACT_VCCIN:
- case CMD_ACT_VCCOUT:
- if (hcp->hcq_arg == fvp) {
- hcp->hcq_arg = NULL;
- }
- break;
- }
- }
-
- /*
- * If this VCC has been previously activated, then we need to tell
- * the CP to deactivate it.
- */
- if (fvp->fv_flags & FVF_ACTCMD) {
-
- /*
- * Queue command at end of command queue
- */
- hcp = fup->fu_cmd_tail;
- if ((*hcp->hcq_status) & QSTAT_FREE) {
-
- /*
- * Queue entry available, so set our view of things up
- */
- hcp->hcq_code = CMD_DACT_VCCIN;
- hcp->hcq_arg = fvp;
- fup->fu_cmd_tail = hcp->hcq_next;
-
- /*
- * Now set the CP-resident queue entry - the CP will
- * grab the command when the op-code is set.
- */
- cqp = hcp->hcq_cpelem;
- (*hcp->hcq_status) = QSTAT_PENDING;
- cqp->cmdq_dact.dact_vccid = CP_WRITE(vcp->vc_vci);
- cqp->cmdq_dact.dact_cmd =
- CP_WRITE(CMD_DACT_VCCIN|CMD_INTR_REQ);
- } else {
- /*
- * Command queue full
- *
- * If we get here, we'll be getting out-of-sync with
- * the CP because we can't (for now at least) do
- * anything about close errors in the common code.
- * This won't be too bad, since we'll just toss any
- * PDUs received from the VCC and the sigmgr's will
- * always get open failures when trying to use this
- * (vpi,vci)...oh, well...always gotta have that one
- * last bug to fix! XXX
- */
- fup->fu_stats->st_drv.drv_cm_full++;
- err = 1;
- }
- }
-
- /*
- * Finish up...
- */
- if (fvp->fv_state == CVS_ACTIVE)
- fup->fu_open_vcc--;
-
- if (fvp->rate != 0)
- fup->fu_num_shaped--;
-
- DEVICE_UNLOCK((Cmn_unit *)fup);
-
- return (err);
-}
-
diff --git a/sys/dev/hfa/hfa_eisa.c b/sys/dev/hfa/hfa_eisa.c
deleted file mode 100644
index 6c42fb8634e3..000000000000
--- a/sys/dev/hfa/hfa_eisa.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
- * 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.
- *
- * 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.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#include <sys/bus.h>
-#include <sys/conf.h>
-
-#include <sys/module.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-
-#include <dev/eisa/eisa_busreg.h>
-#include <dev/eisa/eisa_busvar.h>
-
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#include <dev/hfa/hfa_freebsd.h>
-
-static int hfa_eisa_probe(device_t);
-static int hfa_eisa_attach(device_t);
-
-static int
-hfa_eisa_probe (device_t dev)
-{
-
- return (ENXIO);
-}
-
-static int
-hfa_eisa_attach (device_t dev)
-{
-
- return (ENXIO);
-}
-
-static device_method_t hfa_eisa_methods[] = {
- DEVMETHOD(device_probe, hfa_eisa_probe),
- DEVMETHOD(device_attach, hfa_eisa_attach),
-
- DEVMETHOD(device_detach, hfa_detach),
-
- { 0, 0 }
-};
-
-static driver_t hfa_eisa_driver = {
- "hfa",
- hfa_eisa_methods,
- sizeof(struct hfa_softc)
-};
-
-DRIVER_MODULE(hfa, eisa, hfa_eisa_driver, hfa_devclass, 0, 0);
-MODULE_DEPEND(hfa, hfa, 1, 1, 1);
-MODULE_DEPEND(hfa, eisa, 1, 1, 1);
diff --git a/sys/dev/hfa/hfa_freebsd.c b/sys/dev/hfa/hfa_freebsd.c
deleted file mode 100644
index 9b8d69caac41..000000000000
--- a/sys/dev/hfa/hfa_freebsd.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*-
- * Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
- * 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.
- *
- * 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$
- */
-
-/*
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#include <sys/bus.h>
-#include <sys/conf.h>
-
-#include <sys/module.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#include <dev/hfa/hfa_freebsd.h>
-
-devclass_t hfa_devclass;
-
-static int hfa_modevent(module_t, int, void *);
-
-SYSCTL_DECL(_hw_atm);
-
-/*
- * Sysctl handler for the traffic shaping option
- */
-static int
-hfa_sysctl_shape(SYSCTL_HANDLER_ARGS)
-{
- struct hfa_softc *sc = arg1;
- int error;
- u_int new;
-
- error = SYSCTL_OUT(req, &sc->fup.fu_shape , sizeof(sc->fup.fu_shape));
- if (error != 0 || req->newptr == NULL) {
- return (error);
- }
-
- error = SYSCTL_IN(req, &new, sizeof(new));
- if (error != 0) {
- return (error);
- }
-
- if (new > FUS_SHAPE_ALL) {
- return (EINVAL);
- }
-
- sc->fup.fu_shape = new;
- return (0);
-}
-
-int
-hfa_alloc (device_t dev)
-{
- struct hfa_softc *sc;
- int error;
-
- sc = (struct hfa_softc *)device_get_softc(dev);
- error = 0;
-
- sc->mem = bus_alloc_resource_any(dev, sc->mem_type, &sc->mem_rid,
- RF_ACTIVE);
- if (sc->mem == NULL) {
- device_printf(dev, "Unable to allocate memory resource.\n");
- error = ENXIO;
- goto fail;
- }
-
- sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
- RF_SHAREABLE | RF_ACTIVE);
- if (sc->irq == NULL) {
- device_printf(dev, "Unable to allocate interrupt resource.\n");
- error = ENXIO;
- goto fail;
- }
-
- /*
- * Make the sysctl tree
- */
- if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
- SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO,
- device_get_nameunit(dev), CTLFLAG_RW, 0, "")) == NULL)
- goto fail;
-
- if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
- OID_AUTO, "shape", CTLFLAG_RW | CTLTYPE_UINT, sc, 0,
- hfa_sysctl_shape, "IU", "traffic shaping") == NULL)
- goto fail;
-
- mtx_init(&sc->mtx, device_get_nameunit(dev), "Interrupt lock", MTX_DEF|MTX_RECURSE);
-
-fail:
- return (error);
-}
-
-int
-hfa_free (device_t dev)
-{
- struct hfa_softc *sc;
-
- sc = (struct hfa_softc *)device_get_softc(dev);
-
- if (sc->mem)
- bus_release_resource(dev, sc->mem_type, sc->mem_rid, sc->mem);
- if (sc->irq_ih)
- bus_teardown_intr(dev, sc->irq, sc->irq_ih);
- if (sc->irq)
- bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
-
- /*
- * Destroy the mutex.
- */
- if (mtx_initialized(&sc->mtx) != 0)
- mtx_destroy(&sc->mtx);
-
- return (0);
-}
-
-int
-hfa_attach (device_t dev)
-{
- struct hfa_softc *sc;
- Fore_unit *fup;
- int error;
- int err_count;
-
- sc = (struct hfa_softc *)device_get_softc(dev);
- fup = &sc->fup;
- error = 0;
- err_count = BOOT_LOOPS;
-
- /*
- * Start initializing it
- */
- fup->fu_unit = device_get_unit(dev);
- fup->fu_mtu = FORE_IFF_MTU;
- fup->fu_vcc_zone = fore_vcc_zone;
- fup->fu_nif_zone = fore_nif_zone;
- fup->fu_ioctl = fore_atm_ioctl;
- fup->fu_instvcc = fore_instvcc;
- fup->fu_openvcc = fore_openvcc;
- fup->fu_closevcc = fore_closevcc;
- fup->fu_output = fore_output;
- fup->fu_softc = (void *)sc;
-
- callout_handle_init(&fup->fu_thandle);
-
- /*
- * Poke the hardware - boot the CP and prepare it for downloading
- */
- hfa_reset(dev);
-
- /*
- * Wait for the monitor to perform self-test
- */
- while (CP_READ(fup->fu_mon->mon_bstat) != BOOT_MONREADY) {
- if (CP_READ(fup->fu_mon->mon_bstat) == BOOT_FAILTEST) {
- device_printf(dev, "failed self-test\n");
- goto fail;
- } else if ( --err_count == 0 ) {
- device_printf(dev, "unable to boot - status=0x%lx\n",
- (u_long)CP_READ(fup->fu_mon->mon_bstat));
- goto fail;
- }
- DELAY ( BOOT_DELAY );
- }
-
- /*
- * Setup the adapter config info - at least as much as we can
- */
- fup->fu_config.ac_vendor = VENDOR_FORE;
- fup->fu_config.ac_vendapi = VENDAPI_FORE_1;
- fup->fu_config.ac_media = MEDIA_OC3C;
- fup->fu_pif.pif_pcr = ATM_PCR_OC3C;
-
- /*
- * Save device ram info for user-level programs
- */
- fup->fu_config.ac_ram = (long)fup->fu_ram;
- fup->fu_config.ac_ramsize = fup->fu_ramsize;
-
- /*
- * Set device capabilities
- */
- fup->fu_pif.pif_maxvpi = FORE_MAX_VPI;
- fup->fu_pif.pif_maxvci = FORE_MAX_VCI;
-
- /*
- * Register this interface with ATM core services
- */
- error = atm_physif_register((Cmn_unit *)fup, FORE_DEV_NAME, fore_services);
- if (error)
- goto fail;
-
- fore_units[device_get_unit(dev)] = fup;
- fore_nunits++;
-
- /*
- * Initialize the CP microcode program.
- */
- fore_initialize(fup);
-
-fail:
- return (error);
-}
-
-int
-hfa_detach (device_t dev)
-{
- struct hfa_softc *sc;
- Fore_unit *fup;
- int error;
-
- sc = (struct hfa_softc *)device_get_softc(dev);
- fup = &sc->fup;
- error = 0;
-
- /*
- * De-Register this interface with ATM core services
- */
- error = atm_physif_deregister((Cmn_unit *)fup);
-
- /*
- * Reset the board and return it to cold_start state.
- * Hopefully, this will prevent use of resources as
- * we're trying to free things up.
- */
- hfa_reset(dev);
-
- /*
- * Lock out all device interrupts
- */
- DEVICE_LOCK((Cmn_unit *)fup);
-
- /*
- * Remove any pending timeout()'s
- */
- (void)untimeout((KTimeout_ret(*)(void *))fore_initialize,
- (void *)fup, fup->fu_thandle);
-
- hfa_free(dev);
-
- DEVICE_UNLOCK((Cmn_unit *)fup);
-
- /*
- * Free any Fore-specific device resources
- */
- fore_interface_free(fup);
-
- return (error);
-}
-
-void
-hfa_intr (void * arg)
-{
- struct hfa_softc *sc;
-
- sc = (struct hfa_softc *)arg;
-
- HFA_LOCK(sc);
- fore_intr(&sc->fup);
- HFA_UNLOCK(sc);
-
- return;
-}
-
-void
-hfa_reset (device_t dev)
-{
- struct hfa_softc *sc;
- Fore_unit *fup;
-
- sc = (struct hfa_softc *)device_get_softc(dev);
- fup = &sc->fup;
- HFA_LOCK(sc);
-
- /*
- * Reset the board and return it to cold_start state
- */
- if (fup->fu_mon)
- fup->fu_mon->mon_bstat = CP_WRITE(BOOT_COLDSTART);
-
- if (fup->fu_ctlreg) {
-
- switch (fup->fu_config.ac_device) {
- case DEV_FORE_ESA200E:
-
- break;
-
- case DEV_FORE_SBA200E:
- /*
- * Reset i960 by setting and clearing RESET
- */
- SBA200E_HCR_INIT(*fup->fu_ctlreg, SBA200E_RESET);
- SBA200E_HCR_CLR(*fup->fu_ctlreg, SBA200E_RESET);
- break;
-
- case DEV_FORE_SBA200:
- /*
- * Reset i960 by setting and clearing RESET
- *
- * SBA200 will NOT reset if bit is OR'd in!
- */
- *fup->fu_ctlreg = SBA200_RESET;
- *fup->fu_ctlreg = SBA200_RESET_CLR;
- break;
-
- case DEV_FORE_PCA200E:
- /*
- * Reset i960 by setting and clearing RESET
- */
- PCA200E_HCR_INIT(*fup->fu_ctlreg, PCA200E_RESET);
- DELAY(10000);
- PCA200E_HCR_CLR(*fup->fu_ctlreg, PCA200E_RESET);
- break;
- default:
- break;
- }
- }
-
- HFA_UNLOCK(sc);
- return;
-}
-
-static int
-hfa_modevent (module_t mod, int type, void *data)
-{
- int error;
-
- error = 0;
-
- switch (type) {
- case MOD_LOAD:
- /*
- * Verify software version
- */
- if (atm_version != ATM_VERSION) {
- printf("hfa: version mismatch: fore=%d.%d kernel=%d.%d\n",
- ATM_VERS_MAJ(ATM_VERSION),
- ATM_VERS_MIN(ATM_VERSION),
- ATM_VERS_MAJ(atm_version),
- ATM_VERS_MIN(atm_version));
- error = EINVAL;
- break;
- }
-
- fore_nif_zone = uma_zcreate("fore nif", sizeof(struct atm_nif), NULL,
- NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
- if (fore_nif_zone == NULL)
- panic("hfa_modevent:uma_zcreate nif");
- uma_zone_set_max(fore_nif_zone, 52);
-
- fore_vcc_zone = uma_zcreate("fore vcc", sizeof(Fore_vcc), NULL,
- NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
- if (fore_vcc_zone == NULL)
- panic("hfa_modevent: uma_zcreate vcc");
- uma_zone_set_max(fore_vcc_zone, 100);
-
- /*
- * Start up watchdog timer
- */
- atm_timeout(&fore_timer, ATM_HZ * FORE_TIME_TICK, fore_timeout);
-
- break;
- case MOD_UNLOAD:
- /*
- * Stop watchdog timer
- */
- atm_untimeout(&fore_timer);
-
- uma_zdestroy(fore_nif_zone);
- uma_zdestroy(fore_vcc_zone);
-
- break;
- default:
- return (EOPNOTSUPP);
- break;
- }
-
- return (error);
-}
-
-static moduledata_t hfa_moduledata = {
- "hfa",
- hfa_modevent,
- NULL
-};
-DECLARE_MODULE(hfa, hfa_moduledata, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
-MODULE_VERSION(hfa, 1);
diff --git a/sys/dev/hfa/hfa_freebsd.h b/sys/dev/hfa/hfa_freebsd.h
deleted file mode 100644
index 75400162eda9..000000000000
--- a/sys/dev/hfa/hfa_freebsd.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
- * 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.
- *
- * 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$
- */
-
-struct hfa_softc {
- device_t dev;
-
- struct resource * mem;
- int mem_rid;
- int mem_type;
-
- struct resource * irq;
- int irq_rid;
- void * irq_ih;
-
- struct mtx mtx;
-
- Fore_unit fup;
-
- /* sysctl support */
- struct sysctl_ctx_list sysctl_ctx;
- struct sysctl_oid * sysctl_tree;
-};
-
-#define HFA_LOCK(_sc) mtx_lock(&(_sc)->mtx)
-#define HFA_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx)
-
-extern devclass_t hfa_devclass;
-
-int hfa_alloc (device_t);
-int hfa_free (device_t);
-
-int hfa_attach (device_t);
-int hfa_detach (device_t);
-
-void hfa_intr (void *);
-void hfa_reset (device_t);
diff --git a/sys/dev/hfa/hfa_pci.c b/sys/dev/hfa/hfa_pci.c
deleted file mode 100644
index 382f48634cec..000000000000
--- a/sys/dev/hfa/hfa_pci.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*-
- * Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
- * 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.
- *
- * 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.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- *
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#include <sys/bus.h>
-#include <sys/conf.h>
-
-#include <sys/module.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#include <dev/hfa/hfa_freebsd.h>
-
-static int hfa_pci_probe(device_t);
-static int hfa_pci_attach(device_t);
-
-#define FORE_PCA200EPC_ID 0x0300
-
-static int
-hfa_pci_probe (dev)
- device_t dev;
-{
- if ((pci_get_vendor(dev) == FORE_VENDOR_ID) &&
- (pci_get_device(dev) == FORE_PCA200EPC_ID)) {
- device_set_desc(dev, "FORE Systems PCA-200EPC ATM");
- return (BUS_PROBE_DEFAULT);
- }
-
- return (ENXIO);
-}
-
-static int
-hfa_pci_attach (dev)
- device_t dev;
-{
- struct hfa_softc *sc;
- Fore_unit *fup;
- u_int32_t command;
- vm_offset_t va;
- int error;
-
- sc = device_get_softc(dev);
- fup = &sc->fup;
- error = 0;
-
- pci_enable_busmaster(dev);
-
- sc->mem_rid = PCA200E_PCI_MEMBASE;
- sc->mem_type = SYS_RES_MEMORY;
- sc->irq_rid = 0;
-
- error = hfa_alloc(dev);
- if (error) {
- device_printf(dev, "hfa_alloc() failed.\n");
- goto fail;
- }
-
- va = (vm_offset_t) rman_get_virtual(sc->mem);
-
- fup->fu_ram = (Fore_mem *)va;
- fup->fu_ramsize = PCA200E_RAM_SIZE;
- fup->fu_mon = (Mon960 *)(fup->fu_ram + MON960_BASE);
- fup->fu_ctlreg = (Fore_reg *)(va + PCA200E_HCR_OFFSET);
- fup->fu_imask = (Fore_reg *)(va + PCA200E_IMASK_OFFSET);
- fup->fu_psr = (Fore_reg *)(va + PCA200E_PSR_OFFSET);
-
- /*
- * Convert Endianess of Slave RAM accesses
- */
- command = pci_read_config(dev, PCA200E_PCI_MCTL, 4);
- command |= PCA200E_MCTL_SWAP;
- pci_write_config(dev, PCA200E_PCI_MCTL, command, 4);
-
- /*
- * Map interrupt in
- */
- error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET,
- NULL, hfa_intr, sc, &sc->irq_ih);
- if (error) {
- device_printf(dev, "Interrupt handler setup failed.\n");
- goto fail;
- }
-
- fup->fu_config.ac_bustype = BUS_PCI;
- fup->fu_config.ac_busslot = (pci_get_bus(dev) << 8)| pci_get_slot(dev);
-
- switch (pci_get_device(dev)) {
- case FORE_PCA200EPC_ID:
- fup->fu_config.ac_device = DEV_FORE_PCA200E;
- break;
- default:
- fup->fu_config.ac_device = DEV_UNKNOWN;
- break;
- }
-
- error = hfa_attach(dev);
- if (error) {
- device_printf(dev, "hfa_attach() failed.\n");
- goto fail;
- }
-
- return (0);
-
-fail:
- hfa_detach(dev);
-
- return (error);
-}
-
-static device_method_t hfa_pci_methods[] = {
- DEVMETHOD(device_probe, hfa_pci_probe),
- DEVMETHOD(device_attach, hfa_pci_attach),
-
- DEVMETHOD(device_detach, hfa_detach),
-
- { 0, 0 }
-};
-
-static driver_t hfa_pci_driver = {
- "hfa",
- hfa_pci_methods,
- sizeof(struct hfa_softc)
-};
-
-DRIVER_MODULE(hfa, pci, hfa_pci_driver, hfa_devclass, 0, 0);
-MODULE_DEPEND(hfa, hfa, 1, 1, 1);
-MODULE_DEPEND(hfa, pci, 1, 1, 1);
diff --git a/sys/dev/hfa/hfa_sbus.c b/sys/dev/hfa/hfa_sbus.c
deleted file mode 100644
index 990803cb19d7..000000000000
--- a/sys/dev/hfa/hfa_sbus.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
- * 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.
- *
- * 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.
- */
-/*-
- * ===================================
- * HARP | Host ATM Research Platform
- * ===================================
- *
- * This Host ATM Research Platform ("HARP") file (the "Software") is
- * made available by Network Computing Services, Inc. ("NetworkCS")
- * "AS IS". NetworkCS does not provide maintenance, improvements or
- * support of any kind.
- *
- * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
- * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
- * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
- * In no event shall NetworkCS be responsible for any damages, including
- * but not limited to consequential damages, arising from or relating to
- * any use of the Software or related support.
- *
- * Copyright 1994-1998 Network Computing Services, Inc.
- *
- * Copies of this Software may be made, however, the above copyright
- * notice must be reproduced on all copies.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#include <sys/bus.h>
-#include <sys/conf.h>
-
-#include <sys/module.h>
-#include <machine/bus.h>
-#include <machine/ofw_machdep.h>
-#include <machine/resource.h>
-
-#include <sys/rman.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <sparc64/sbus/sbusreg.h>
-#include <sparc64/sbus/sbusvar.h>
-
-#include <net/if.h>
-#include <netatm/port.h>
-#include <netatm/queue.h>
-#include <netatm/atm.h>
-#include <netatm/atm_sys.h>
-#include <netatm/atm_sap.h>
-#include <netatm/atm_cm.h>
-#include <netatm/atm_if.h>
-#include <netatm/atm_stack.h>
-#include <netatm/atm_pcb.h>
-#include <netatm/atm_var.h>
-
-#include <dev/hfa/fore.h>
-#include <dev/hfa/fore_aali.h>
-#include <dev/hfa/fore_slave.h>
-#include <dev/hfa/fore_stats.h>
-#include <dev/hfa/fore_var.h>
-#include <dev/hfa/fore_include.h>
-
-#include <dev/hfa/hfa_freebsd.h>
-
-static int hfa_sbus_probe(device_t);
-static int hfa_sbus_attach(device_t);
-
-static int
-hfa_sbus_probe (device_t dev)
-{
-
- return (ENXIO);
-}
-
-static int
-hfa_sbus_attach (device_t dev)
-{
-
- return (ENXIO);
-}
-
-static device_method_t hfa_sbus_methods[] = {
- DEVMETHOD(device_probe, hfa_sbus_probe),
- DEVMETHOD(device_attach, hfa_sbus_attach),
-
- DEVMETHOD(device_detach, hfa_detach),
-
- { 0, 0 }
-};
-
-static driver_t hfa_sbus_driver = {
- "hfa",
- hfa_sbus_methods,
- sizeof(struct hfa_softc)
-};
-
-DRIVER_MODULE(hfa, sbus, hfa_sbus_driver, hfa_devclass, 0, 0);
-MODULE_DEPEND(hfa, hfa, 1, 1, 1);
-MODULE_DEPEND(hfa, sbus, 1, 1, 1);