Resolve conflicts from merge.

This commit is contained in:
thorpej 1996-03-11 21:41:28 +00:00
parent 2e4812fa65
commit 94fc5cf4ce
5 changed files with 199 additions and 35 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdq.c,v 1.2 1995/08/19 04:35:18 cgd Exp $ */
/* $NetBSD: pdq.c,v 1.3 1996/03/11 21:41:28 thorpej Exp $ */
/*-
* Copyright (c) 1995 Matt Thomas (matt@lkg.dec.com)
@ -22,6 +22,66 @@
* 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.
*
* from Id: pdq.c,v 1.18 1995/08/20 18:59:00 thomas Exp thomas
*
* Log: pdq.c,v
* Revision 1.18 1995/08/20 18:59:00 thomas
* Changes for NetBSD
*
* Revision 1.17 1995/08/16 22:57:28 thomas
* Add support for NetBSD
*
* Revision 1.16 1995/08/04 21:54:56 thomas
* Clean IRQ processing under BSD/OS.
* A receive tweaks. (print source of MAC CRC errors, etc.)
*
* Revision 1.15 1995/06/30 23:36:21 thomas
* Optimize fix.
*
* Revision 1.14 1995/06/30 23:35:39 thomas
* Fix severe bug in transmit path (corruption of ring).
*
* Revision 1.13 1995/06/21 18:29:27 thomas
* SVR4.2 changes
*
* Revision 1.12 1995/06/05 23:49:36 thomas
* Fix bonehead error. Don't try to queue a command if there
* is a command.
*
* Revision 1.11 1995/06/03 15:43:26 thomas
* Fix the command submission logic to only submit one
* command at a time no matter what. This simplies the
* code significantly thereby allowing us to do some up
* front optimizations.
*
* Revision 1.10 1995/06/02 22:18:34 thomas
* Don't know why but on some motherboards, the PDQ just can't
* multiple outstanding commands.
*
* Revision 1.9 1995/04/20 20:17:33 thomas
* Add PCI support for BSD/OS.
* Fix BSD/OS EISA support.
* Set latency timer for DEFPA to recommended value if 0.
*
* Revision 1.8 1995/03/14 01:52:52 thomas
* Update for new FreeBSD PCI Interrupt interface
*
* Revision 1.7 1995/03/07 23:03:16 thomas
* Fix SMT queue processing
*
* Revision 1.6 1995/03/06 18:03:47 thomas
* restart trasmitter once link is available
*
* Revision 1.5 1995/03/06 17:07:56 thomas
* Add copyright/disclaimer
* Add error recovery code.
* Add BPF SMT support
*
* Revision 1.3 1995/03/03 13:48:35 thomas
* more fixes
*
*
*/
/*
@ -38,10 +98,10 @@
#define PDQ_HWSUPPORT /* for pdq.h */
#include "pdqreg.h"
#ifndef __NetBSD__
#include "pdq_os.h"
#else
#if defined(__NetBSD__)
#include "pdqvar.h"
#else
#include "pdq_os.h"
#endif
#define PDQ_ROUNDUP(n, x) (((n) + ((x) - 1)) & ~((x) - 1))
@ -1364,7 +1424,17 @@ pdq_initialize(
*/
p = (pdq_uint8_t *) PDQ_OS_MEMALLOC_CONTIG(contig_bytes);
if (p != NULL) {
pdq_physaddr_t physaddr = PDQ_OS_VA_TO_PA(p) & 0x1FFF;
pdq_physaddr_t physaddr = PDQ_OS_VA_TO_PA(p);
/*
* Assert that we really got contiguous memory. This isn't really
* needed on systems that actually have physical contiguous allocation
* routines, but on those systems that don't ...
*/
for (idx = PDQ_OS_PAGESIZE; idx < 0x2000; idx += PDQ_OS_PAGESIZE) {
if (PDQ_OS_VA_TO_PA(p + idx) - physaddr != idx)
goto cleanup_and_return;
}
physaddr &= 0x1FFF;
if (physaddr) {
pdq->pdq_unsolicited_info.ui_events = (pdq_unsolicited_event_t *) p;
pdq->pdq_dbp = (pdq_descriptor_block_t *) &p[0x2000 - physaddr];
@ -1385,8 +1455,8 @@ pdq_initialize(
*/
if (pdq->pdq_dbp == NULL || pdq->pdq_unsolicited_info.ui_events == NULL) {
cleanup_and_return:
if (pdq->pdq_dbp != NULL)
PDQ_OS_MEMFREE_CONTIG(pdq->pdq_dbp, contig_bytes);
if (p /* pdq->pdq_dbp */ != NULL)
PDQ_OS_MEMFREE_CONTIG(p /* pdq->pdq_dbp */, contig_bytes);
if (contig_bytes == sizeof(pdq_descriptor_block_t) && pdq->pdq_unsolicited_info.ui_events != NULL)
PDQ_OS_MEMFREE(pdq->pdq_unsolicited_info.ui_events,
PDQ_NUM_UNSOLICITED_EVENTS * sizeof(pdq_unsolicited_event_t));
@ -1519,7 +1589,6 @@ pdq_initialize(
*/
state = pdq_stop(pdq);
/* state = PDQ_PSTS_ADAPTER_STATE(*pdq->pdq_csrs.csr_port_status); */
PDQ_PRINTF(("PDQ Adapter State = %s\n", pdq_adapter_states[state]));
PDQ_ASSERT(state == PDQS_DMA_AVAILABLE);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdq_ifsubr.c,v 1.1.1.1 1996/03/11 21:04:02 thorpej Exp $ */
/* $NetBSD: pdq_ifsubr.c,v 1.2 1996/03/11 21:41:32 thorpej Exp $ */
/*-
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdqreg.h,v 1.2 1995/08/19 04:35:21 cgd Exp $ */
/* $NetBSD: pdqreg.h,v 1.3 1996/03/11 21:41:33 thorpej Exp $ */
/*-
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
@ -22,12 +22,34 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Id: pdqreg.h,v 1.6 1995/06/03 15:43:26 thomas Exp
*
* Log: pdqreg.h,v
* Revision 1.6 1995/06/03 15:43:26 thomas
* Fix the command submission logic to only submit one
* command at a time no matter what. This simplies the
* code significantly thereby allowing us to do some up
* front optimizations.
*
* Revision 1.5 1995/03/10 17:41:55 thomas
* Add DEFTA, DEFQA, and DEFAA
*
* Revision 1.4 1995/03/06 17:07:05 thomas
* Add copyright/disclaimer
* Add EISA register definitions
*
* Revision 1.3 1995/03/03 13:48:35 thomas
* more fixes
*
*
*/
/*
* DEC PDQ FDDI Controller; PDQ port driver definitions
*
* Written by Matt Thomas
*
*/
#ifndef _PDQREG_H

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdqvar.h,v 1.3 1996/03/09 03:46:24 thorpej Exp $ */
/* $NetBSD: pdqvar.h,v 1.4 1996/03/11 21:41:35 thorpej Exp $ */
/*-
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
@ -22,12 +22,49 @@
* 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.
*
* from Id: pdq_os.h,v 1.11 1995/08/20 18:59:00 thomas Exp
*
* Log: pdq_os.h,v
* Revision 1.11 1995/08/20 18:59:00 thomas
* Changes for NetBSD
*
* Revision 1.10 1995/08/16 22:57:28 thomas
* Add support for NetBSD
*
* Revision 1.9 1995/06/21 18:29:27 thomas
* SVR4.2 changes
*
* Revision 1.8 1995/06/12 17:49:37 thomas
* Add SVR4.2 support
*
* Revision 1.7 1995/04/20 20:17:33 thomas
* Add PCI support for BSD/OS.
* Fix BSD/OS EISA support.
* Set latency timer for DEFPA to recommended value if 0.
*
* Revision 1.6 1995/03/14 01:52:52 thomas
* Update for new FreeBSD PCI Interrupt interface
* Use inl/inb/... inline macros provided by FreeBSD and BSDI
*
* Revision 1.5 1995/03/10 17:42:24 thomas
* More changes for BSDI
*
* Revision 1.4 1995/03/06 17:08:56 thomas
* Add copyright/disclaimer
* Add inx/outx macros
*
* Revision 1.3 1995/03/03 13:48:35 thomas
* more fixes
*
*
*/
/*
* DEC PDQ FDDI Controller; PDQ O/S dependent definitions
*
* Written by Matt Thomas
*
*/
#ifndef _PDQ_OS_H
@ -65,9 +102,9 @@
#define PDQ_OS_MEMFREE_CONTIG(p, n) kmem_free(kernel_map, (vm_offset_t) p, n)
#endif /* __FreeBSD__ */
#if !defined(PDQ_HWSUPPORT)
#if defined(__FreeBSD__)
#include <machine/cpufunc.h>
#include <machine/clock.h>
typedef void ifnet_ret_t;
typedef int ioctl_cmd_t;
#elif defined(__bsdi__)
@ -78,6 +115,8 @@ typedef int ioctl_cmd_t;
typedef void ifnet_ret_t;
typedef u_long ioctl_cmd_t;
#endif
#if !defined(PDQ_HWSUPPORT)
#define PDQ_OS_IORD_32(port) inl(port)
#define PDQ_OS_IOWR_32(port, data) outl(port, data)
#define PDQ_OS_IORD_8(port) inb(port)
@ -87,15 +126,14 @@ typedef struct {
#ifdef __bsdi__
struct device sc_dev; /* base device */
struct isadev sc_id; /* ISA device */
struct intrhand sc_ih; /* intrrupt vectoring */
struct intrhand sc_ih; /* interrupt vectoring */
struct atshutdown sc_ats; /* shutdown routine */
#elif defined(__NetBSD__)
struct device sc_dev; /* base device */
void *sc_ih; /* intrrupt vectoring */
void *sc_ih; /* interrupt vectoring */
void *sc_ats; /* shutdown hook */
#endif
struct arpcom sc_ac;
void (*if_init) __P((int unit));
pdq_t *sc_pdq;
unsigned sc_iobase;
} pdq_softc_t;
@ -107,16 +145,9 @@ extern void pdq_ifreset(pdq_softc_t *sc);
extern void pdq_ifinit(pdq_softc_t *sc);
extern void pdq_ifwatchdog(pdq_softc_t *sc);
extern ifnet_ret_t pdq_ifstart(struct ifnet *ifp);
#ifdef __NetBSD__
extern int pdq_ifioctl(pdq_softc_t *sc, ioctl_cmd_t cmd, caddr_t data);
extern void pdq_ifattach(pdq_softc_t *sc, ifnet_ret_t (*ifinit)(int unit),
ifnet_ret_t (*ifwatchdog)(int unit),
int (*ifioctl)(struct ifnet *, ioctl_cmd_t, caddr_t));
#else /* ! __NetBSD__ */
extern int pdq_ifioctl(struct ifnet *ifp, ioctl_cmd_t cmd, caddr_t data);
extern void pdq_ifattach(pdq_softc_t *sc, ifnet_ret_t (*ifinit)(int unit),
ifnet_ret_t (*ifwatchdog)(int unit));
#endif /* __NetBSD__ */
#endif /* PDQ_HWSUPPORT */
#elif defined(DLPI_PDQ)
#include <sys/param.h>
@ -257,4 +288,5 @@ extern void pdq_run(pdq_t *pdq);
extern int pdq_interrupt(pdq_t *pdq);
extern pdq_t *pdq_initialize(void *csr_va, const char *name, int unit, void *ctx, pdq_type_t type);
#endif /* _PDQ_OS_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fpa.c,v 1.4 1996/03/09 03:46:33 thorpej Exp $ */
/* $NetBSD: if_fpa.c,v 1.5 1996/03/11 21:41:38 thorpej Exp $ */
/*-
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
@ -22,6 +22,58 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Id: if_fpa.c,v 1.2 1995/08/20 18:56:11 thomas Exp
*
* Log: if_fpa.c,v
* Revision 1.2 1995/08/20 18:56:11 thomas
* Misc. changes for NetBSD
*
* Revision 1.1 1995/08/16 22:57:28 thomas
* Initial revision
*
* Revision 1.13 1995/08/04 21:54:56 thomas
* Clean IRQ processing under BSD/OS.
* A receive tweaks. (print source of MAC CRC errors, etc.)
*
* Revision 1.12 1995/06/02 16:04:22 thomas
* Use correct PCI defs for BSDI now that they have fixed them.
* Increment the slot number 0x1000, not one! (*duh*)
*
* Revision 1.11 1995/04/21 13:23:55 thomas
* Fix a few pub in the DEFPA BSDI support
*
* Revision 1.10 1995/04/20 21:46:42 thomas
* Why???
* ,
*
* Revision 1.9 1995/04/20 20:17:33 thomas
* Add PCI support for BSD/OS.
* Fix BSD/OS EISA support.
* Set latency timer for DEFPA to recommended value if 0.
*
* Revision 1.8 1995/04/04 22:54:29 thomas
* Fix DEFEA support
*
* Revision 1.7 1995/03/14 01:52:52 thomas
* Update for new FreeBSD PCI Interrupt interface
*
* Revision 1.6 1995/03/10 17:06:59 thomas
* Update for latest version of FreeBSD.
* Compensate for the fast that the ifp will not be first thing
* in softc on BSDI.
*
* Revision 1.5 1995/03/07 19:59:42 thomas
* First pass at BSDI EISA support
*
* Revision 1.4 1995/03/06 17:06:03 thomas
* Add transmit timeout support.
* Add support DEFEA (untested).
*
* Revision 1.3 1995/03/03 13:48:35 thomas
* more fixes
*
*
*/
/*
@ -145,17 +197,6 @@ pdq_pci_ifwatchdog(
pdq_ifwatchdog(PDQ_PCI_UNIT_TO_SOFTC(unit));
}
#ifdef __NetBSD__
static int
pdq_pci_ifioctl(
struct ifnet *ifp,
ioctl_cmd_t cmd,
caddr_t data)
{
return (pdq_ifioctl(PDQ_PCI_UNIT_TO_SOFTC(ifp->if_unit), cmd, data));
}
#endif /* __NetBSD__ */
static int
pdq_pci_ifintr(
void *arg)
@ -398,7 +439,7 @@ pdq_pci_attach(
if (sc->sc_pdq == NULL)
return;
bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6);
pdq_ifattach(sc, pdq_pci_ifinit, pdq_pci_ifwatchdog, pdq_pci_ifioctl);
pdq_ifattach(sc, pdq_pci_ifinit, pdq_pci_ifwatchdog);
sc->sc_ih = pci_map_int(pa->pa_tag, IPL_NET, pdq_pci_ifintr, sc);
if (sc->sc_ih == NULL) {