Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F96438504
D15017.id41307.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
174 KB
Referenced Files
None
Subscribers
None
D15017.id41307.diff
View Options
Index: ObsoleteFiles.inc
===================================================================
--- ObsoleteFiles.inc
+++ ObsoleteFiles.inc
@@ -38,6 +38,8 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20180409: remove FDDI support
+OLD_FILES+=usr/include/net/fddi.h
# 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays
OLD_DIRS+=boot/overlays
# 20180311: remove sys/sys/i386/include/pcaudioio.h
Index: UPDATING
===================================================================
--- UPDATING
+++ UPDATING
@@ -51,6 +51,11 @@
****************************** SPECIAL WARNING: ******************************
+201804XX:
+ Support for FDDI networks has been removed. If you have device
+ fddi or device fpa in your kernel config file they must be
+ removed.
+
20180406:
In addition to supporting RFC 3164 formatted messages, the
syslogd(8) service is now capable of parsing RFC 5424 formatted
Index: lib/libifconfig/libifconfig_media.c
===================================================================
--- lib/libifconfig/libifconfig_media.c
+++ lib/libifconfig/libifconfig_media.c
@@ -86,15 +86,6 @@
static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
-static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
- IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_fddi_aliases[] =
- IFM_SUBTYPE_FDDI_ALIASES;
-
-static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
- IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
@@ -188,24 +179,6 @@
{ NULL, 0 },
},
},
- {
- {
- { &ifm_subtype_shared_descriptions[0], 0 },
- { &ifm_subtype_shared_aliases[0], 1 },
- { &ifm_subtype_fddi_descriptions[0], 0 },
- { &ifm_subtype_fddi_aliases[0], 1 },
- { NULL, 0 },
- },
- {
- { &ifm_shared_option_descriptions[0], 0 },
- { &ifm_shared_option_aliases[0], 1 },
- { &ifm_subtype_fddi_option_descriptions[0], 0 },
- { NULL, 0 },
- },
- {
- { NULL, 0 },
- },
- },
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },
Index: sbin/etherswitchcfg/ifmedia.c
===================================================================
--- sbin/etherswitchcfg/ifmedia.c
+++ sbin/etherswitchcfg/ifmedia.c
@@ -380,15 +380,6 @@
static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
-static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
- IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_fddi_aliases[] =
- IFM_SUBTYPE_FDDI_ALIASES;
-
-static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
- IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
@@ -478,24 +469,6 @@
{ NULL, 0 },
},
},
- {
- {
- { &ifm_subtype_shared_descriptions[0], 0 },
- { &ifm_subtype_shared_aliases[0], 1 },
- { &ifm_subtype_fddi_descriptions[0], 0 },
- { &ifm_subtype_fddi_aliases[0], 1 },
- { NULL, 0 },
- },
- {
- { &ifm_shared_option_descriptions[0], 0 },
- { &ifm_shared_option_aliases[0], 1 },
- { &ifm_subtype_fddi_option_descriptions[0], 0 },
- { NULL, 0 },
- },
- {
- { NULL, 0 },
- },
- },
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },
Index: sbin/ifconfig/ifmedia.c
===================================================================
--- sbin/ifconfig/ifmedia.c
+++ sbin/ifconfig/ifmedia.c
@@ -397,15 +397,6 @@
static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
-static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
- IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_fddi_aliases[] =
- IFM_SUBTYPE_FDDI_ALIASES;
-
-static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
- IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
@@ -495,24 +486,6 @@
{ NULL, 0 },
},
},
- {
- {
- { &ifm_subtype_shared_descriptions[0], 0 },
- { &ifm_subtype_shared_aliases[0], 1 },
- { &ifm_subtype_fddi_descriptions[0], 0 },
- { &ifm_subtype_fddi_aliases[0], 1 },
- { NULL, 0 },
- },
- {
- { &ifm_shared_option_descriptions[0], 0 },
- { &ifm_shared_option_aliases[0], 1 },
- { &ifm_subtype_fddi_option_descriptions[0], 0 },
- { NULL, 0 },
- },
- {
- { NULL, 0 },
- },
- },
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },
Index: share/man/man4/Makefile
===================================================================
--- share/man/man4/Makefile
+++ share/man/man4/Makefile
@@ -170,7 +170,6 @@
ffclock.4 \
filemon.4 \
firewire.4 \
- fpa.4 \
full.4 \
fwe.4 \
fwip.4 \
Index: share/man/man4/fpa.4
===================================================================
--- share/man/man4/fpa.4
+++ /dev/null
@@ -1,44 +0,0 @@
-.\"
-.\" Copyright (c) 1995, Matt Thomas
-.\" All rights reserved.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 29, 2018
-.Dt FPA 4
-.Os
-.Sh NAME
-.Nm fpa
-.Nd device drivers for DEC FDDI controllers
-.Sh SYNOPSIS
-.Cd "device fpa"
-.Pp
-.Fx
-only:
-.Cd "device fddi"
-.Sh DEPRECATION NOTICE
-The
-.Nm
-driver is not present in
-.Fx 12.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm
-device driver provide support for the DEC DEFPA PCI FDDI Controller.
-All variants of the
-controller are supported including the DAS and SAS configurations.
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr netintro 4 ,
-.Xr ifconfig 8
-.Sh AUTHORS
-The
-.Nm
-device driver and this manual page were written by
-.An Matt Thomas .
-.Sh CAVEATS
-Normally, the device driver will not enable the reception of SMT frames.
-However if the IFF_LINK1 flag is set, the device driver will enable the
-reception of SMT frames and pass them up to the Berkeley Packet Filter for
-processing.
Index: sys/conf/NOTES
===================================================================
--- sys/conf/NOTES
+++ sys/conf/NOTES
@@ -846,9 +846,6 @@
device wlan_acl
device wlan_amrr
-# The `fddi' device provides generic code to support FDDI.
-device fddi
-
# The `arcnet' device provides generic code to support Arcnet.
device arcnet
@@ -1973,7 +1970,6 @@
# ex: Intel EtherExpress Pro/10 and other i82595-based adapters,
# Olicom Ethernet PC Card devices.
# fe: Fujitsu MB86960A/MB86965A Ethernet
-# fpa: Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed.
# fxp: Intel EtherExpress Pro/100B
# (hint of prefer_iomap can be done to prefer I/O instead of Mem mapping)
# gem: Apple GMAC/Sun ERI/Sun GEM
@@ -2151,9 +2147,6 @@
device vx # 3Com 3c590, 3c595 (``Vortex'')
device vxge # Exar/Neterion XFrame 3100 10GbE
-# PCI FDDI NICs.
-device fpa
-
# PCI WAN adapters.
device lmc
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -2642,9 +2642,6 @@
dev/pci/pcib_support.c standard
dev/pci/vga_pci.c optional pci
dev/pcn/if_pcn.c optional pcn pci
-dev/pdq/if_fpa.c optional fpa pci
-dev/pdq/pdq.c optional nowerror fpa pci
-dev/pdq/pdq_ifsubr.c optional nowerror fpa pci
dev/pms/freebsd/driver/ini/src/agtiapi.c optional pmspcv \
compile-with "${NORMAL_C} -Wunused-variable -Woverflow -Wparentheses -w"
dev/pms/RefTisa/sallsdk/spc/sadisc.c optional pmspcv \
@@ -4131,7 +4128,6 @@
net/if_enc.c optional enc inet | enc inet6
net/if_epair.c optional epair
net/if_ethersubr.c optional ether
-net/if_fddisubr.c optional fddi
net/if_fwsubr.c optional fwip
net/if_gif.c optional gif inet | gif inet6 | \
netgraph_gif inet | netgraph_gif inet6
Index: sys/dev/pdq/if_fpa.c
===================================================================
--- sys/dev/pdq/if_fpa.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$");
-
-/*
- * DEC PDQ FDDI Controller; code for BSD derived operating systems
- *
- * This module supports the DEC DEFPA PCI FDDI Controller
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_media.h>
-#include <net/fddi.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-
-#include <dev/pdq/pdq_freebsd.h>
-#include <dev/pdq/pdqreg.h>
-
-#define DEC_VENDORID 0x1011
-#define DEFPA_CHIPID 0x000F
-
-#define DEFPA_LATENCY 0x88
-
-#define PCI_CFLT 0x0C /* Configuration Latency */
-#define PCI_CBMA 0x10 /* Configuration Base Memory Address */
-#define PCI_CBIO 0x14 /* Configuration Base I/O Address */
-
-static int pdq_pci_probe (device_t);
-static int pdq_pci_attach (device_t);
-static int pdq_pci_detach (device_t);
-static int pdq_pci_shutdown (device_t);
-static void pdq_pci_ifintr (void *);
-
-static void
-pdq_pci_ifintr(void *arg)
-{
- pdq_softc_t *sc;
-
- sc = arg;
-
- PDQ_LOCK(sc);
- (void) pdq_interrupt(sc->sc_pdq);
- PDQ_UNLOCK(sc);
-
- return;
-}
-
-/*
- * This is the PCI configuration support.
- */
-static int
-pdq_pci_probe(device_t dev)
-{
- if (pci_get_vendor(dev) == DEC_VENDORID &&
- pci_get_device(dev) == DEFPA_CHIPID) {
- device_set_desc(dev, "Digital DEFPA PCI FDDI Controller");
- return (BUS_PROBE_DEFAULT);
- }
-
- return (ENXIO);
-}
-
-static int
-pdq_pci_attach(device_t dev)
-{
- pdq_softc_t *sc;
- u_int32_t command;
- int error;
-
- sc = device_get_softc(dev);
-
- sc->dev = dev;
-
- /*
- * Map control/status registers.
- */
- pci_enable_busmaster(dev);
-
- command = pci_read_config(dev, PCIR_LATTIMER, 1);
- if (command < DEFPA_LATENCY) {
- command = DEFPA_LATENCY;
- pci_write_config(dev, PCIR_LATTIMER, command, 1);
- }
-
- sc->mem_rid = PCI_CBMA;
- sc->mem_type = SYS_RES_MEMORY;
- sc->mem = bus_alloc_resource_any(dev, sc->mem_type, &sc->mem_rid,
- RF_ACTIVE);
- if (!sc->mem) {
- device_printf(dev, "Unable to allocate I/O space resource.\n");
- error = ENXIO;
- goto bad;
- }
- sc->mem_bsh = rman_get_bushandle(sc->mem);
- sc->mem_bst = rman_get_bustag(sc->mem);
-
- sc->irq_rid = 0;
- sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
- RF_SHAREABLE | RF_ACTIVE);
- if (!sc->irq) {
- device_printf(dev, "Unable to allocate interrupt resource.\n");
- error = ENXIO;
- goto bad;
- }
-
- error = pdq_ifattach(sc, sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, PDQ_DEFPA);
- if (error)
- goto bad;
-
- error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL,
- pdq_pci_ifintr, sc, &sc->irq_ih);
- if (error) {
- device_printf(dev, "Failed to setup interrupt handler.\n");
- pdq_ifdetach(sc);
- return (error);
- }
-
-
- gone_in_dev(dev, 12, "fpa(4) driver");
- return (0);
-bad:
- pdq_free(dev);
- return (error);
-}
-
-static int
-pdq_pci_detach (dev)
- device_t dev;
-{
- pdq_softc_t *sc;
-
- sc = device_get_softc(dev);
- pdq_ifdetach(sc);
-
- return (0);
-}
-
-static int
-pdq_pci_shutdown(device_t dev)
-{
- pdq_softc_t *sc;
-
- sc = device_get_softc(dev);
- PDQ_LOCK(sc);
- pdq_hwreset(sc->sc_pdq);
- PDQ_UNLOCK(sc);
-
- return (0);
-}
-
-static device_method_t pdq_pci_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, pdq_pci_probe),
- DEVMETHOD(device_attach, pdq_pci_attach),
- DEVMETHOD(device_detach, pdq_pci_detach),
- DEVMETHOD(device_shutdown, pdq_pci_shutdown),
-
- { 0, 0 }
-};
-
-static driver_t pdq_pci_driver = {
- "fpa",
- pdq_pci_methods,
- sizeof(pdq_softc_t),
-};
-
-DRIVER_MODULE(fpa, pci, pdq_pci_driver, pdq_devclass, 0, 0);
-MODULE_DEPEND(fpa, pci, 1, 1, 1);
-MODULE_DEPEND(fpa, fddi, 1, 1, 1);
Index: sys/dev/pdq/pdq.c
===================================================================
--- sys/dev/pdq/pdq.c
+++ /dev/null
@@ -1,1789 +0,0 @@
-/* $NetBSD: pdq.c,v 1.33 2001/11/13 13:14:43 lukem Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 1995,1996 Matt Thomas <matt@3am-software.com>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Id: pdq.c,v 1.32 1997/06/05 01:56:35 thomas Exp
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * DEC PDQ FDDI Controller O/S independent code
- *
- * This module should work any on PDQ based board. Note that changes for
- * MIPS and Alpha architectures (or any other architecture which requires
- * a flushing of memory or write buffers and/or has incoherent caches)
- * have yet to be made.
- *
- * However, it is expected that the PDQ_CSR_WRITE macro will cause a
- * flushing of the write buffers.
- */
-
-
-#define PDQ_HWSUPPORT /* for pdq.h */
-
-/*
- * What a botch having to specific includes for FreeBSD!
- */
-#include <dev/pdq/pdq_freebsd.h>
-#include <dev/pdq/pdqreg.h>
-
-#define PDQ_ROUNDUP(n, x) (((n) + ((x) - 1)) & ~((x) - 1))
-#define PDQ_CMD_RX_ALIGNMENT 16
-
-#if (defined(PDQTEST) && !defined(PDQ_NOPRINTF)) || defined(PDQVERBOSE)
-#define PDQ_PRINTF(x) printf x
-#else
-#define PDQ_PRINTF(x) do { } while (0)
-#endif
-
-static const char * const pdq_halt_codes[] = {
- "Selftest Timeout", "Host Bus Parity Error", "Host Directed Fault",
- "Software Fault", "Hardware Fault", "PC Trace Path Test",
- "DMA Error", "Image CRC Error", "Adapter Processor Error"
-};
-
-static const char * const pdq_adapter_states[] = {
- "Reset", "Upgrade", "DMA Unavailable", "DMA Available",
- "Link Available", "Link Unavailable", "Halted", "Ring Member"
-};
-
-/*
- * The following are used in conjunction with
- * unsolicited events
- */
-static const char * const pdq_entities[] = {
- "Station", "Link", "Phy Port"
-};
-
-static const char * const pdq_station_events[] = {
- "Unknown Event #0",
- "Trace Received"
-};
-
-static const char * const pdq_station_arguments[] = {
- "Reason"
-};
-
-static const char * const pdq_link_events[] = {
- "Transmit Underrun",
- "Transmit Failed",
- "Block Check Error (CRC)",
- "Frame Status Error",
- "PDU Length Error",
- NULL,
- NULL,
- "Receive Data Overrun",
- NULL,
- "No User Buffer",
- "Ring Initialization Initiated",
- "Ring Initialization Received",
- "Ring Beacon Initiated",
- "Duplicate Address Failure",
- "Duplicate Token Detected",
- "Ring Purger Error",
- "FCI Strip Error",
- "Trace Initiated",
- "Directed Beacon Received",
-};
-
-static const char * const pdq_link_arguments[] = {
- "Reason",
- "Data Link Header",
- "Source",
- "Upstream Neighbor"
-};
-
-static const char * const pdq_phy_events[] = {
- "LEM Error Monitor Reject",
- "Elasticy Buffer Error",
- "Link Confidence Test Reject"
-};
-
-static const char * const pdq_phy_arguments[] = {
- "Direction"
-};
-
-static const char * const * const pdq_event_arguments[] = {
- pdq_station_arguments,
- pdq_link_arguments,
- pdq_phy_arguments
-};
-
-static const char * const * const pdq_event_codes[] = {
- pdq_station_events,
- pdq_link_events,
- pdq_phy_events
-};
-
-static const char * const pdq_station_types[] = {
- "SAS", "DAC", "SAC", "NAC", "DAS"
-};
-
-static const char * const pdq_smt_versions[] = { "", "V6.2", "V7.2", "V7.3" };
-
-static const char pdq_phy_types[] = "ABSM";
-
-static const char * const pdq_pmd_types0[] = {
- "ANSI Multi-Mode", "ANSI Single-Mode Type 1", "ANSI Single-Mode Type 2",
- "ANSI Sonet"
-};
-
-static const char * const pdq_pmd_types100[] = {
- "Low Power", "Thin Wire", "Shielded Twisted Pair",
- "Unshielded Twisted Pair"
-};
-
-static const char * const * const pdq_pmd_types[] = {
- pdq_pmd_types0, pdq_pmd_types100
-};
-
-static const char * const pdq_descriptions[] = {
- "DEFPA PCI",
-};
-
-static void
-pdq_print_fddi_chars(
- pdq_t *pdq,
- const pdq_response_status_chars_get_t *rsp)
-{
- const char hexchars[] = "0123456789abcdef";
-
- printf(
- PDQ_OS_PREFIX
- "DEC %s FDDI %s Controller\n",
- PDQ_OS_PREFIX_ARGS,
- pdq_descriptions[pdq->pdq_type],
- pdq_station_types[rsp->status_chars_get.station_type]);
-
- printf(PDQ_OS_PREFIX "FDDI address %c%c:%c%c:%c%c:%c%c:%c%c:%c%c, FW=%c%c%c%c, HW=%c",
- PDQ_OS_PREFIX_ARGS,
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[0] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[0] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[1] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[1] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[2] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[2] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[3] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[3] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[4] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[4] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[5] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[5] & 0x0F],
- pdq->pdq_fwrev.fwrev_bytes[0], pdq->pdq_fwrev.fwrev_bytes[1],
- pdq->pdq_fwrev.fwrev_bytes[2], pdq->pdq_fwrev.fwrev_bytes[3],
- rsp->status_chars_get.module_rev.fwrev_bytes[0]);
-
- if (rsp->status_chars_get.smt_version_id < PDQ_ARRAY_SIZE(pdq_smt_versions)) {
- printf(", SMT %s\n", pdq_smt_versions[rsp->status_chars_get.smt_version_id]);
- }
-
- printf(PDQ_OS_PREFIX "FDDI Port%s = %c (PMD = %s)",
- PDQ_OS_PREFIX_ARGS,
- rsp->status_chars_get.station_type == PDQ_STATION_TYPE_DAS ? "[A]" : "",
- pdq_phy_types[rsp->status_chars_get.phy_type[0]],
- pdq_pmd_types[rsp->status_chars_get.pmd_type[0] / 100][rsp->status_chars_get.pmd_type[0] % 100]);
-
- if (rsp->status_chars_get.station_type == PDQ_STATION_TYPE_DAS)
- printf(", FDDI Port[B] = %c (PMD = %s)",
- pdq_phy_types[rsp->status_chars_get.phy_type[1]],
- pdq_pmd_types[rsp->status_chars_get.pmd_type[1] / 100][rsp->status_chars_get.pmd_type[1] % 100]);
-
- printf("\n");
-
- pdq_os_update_status(pdq, rsp);
-}
-
-static void
-pdq_init_csrs(
- pdq_csrs_t *csrs,
- pdq_bus_t bus,
- pdq_bus_memaddr_t csr_base,
- size_t csrsize)
-{
- csrs->csr_bus = bus;
- csrs->csr_base = csr_base;
- csrs->csr_port_reset = PDQ_CSR_OFFSET(csr_base, 0 * csrsize);
- csrs->csr_host_data = PDQ_CSR_OFFSET(csr_base, 1 * csrsize);
- csrs->csr_port_control = PDQ_CSR_OFFSET(csr_base, 2 * csrsize);
- csrs->csr_port_data_a = PDQ_CSR_OFFSET(csr_base, 3 * csrsize);
- csrs->csr_port_data_b = PDQ_CSR_OFFSET(csr_base, 4 * csrsize);
- csrs->csr_port_status = PDQ_CSR_OFFSET(csr_base, 5 * csrsize);
- csrs->csr_host_int_type_0 = PDQ_CSR_OFFSET(csr_base, 6 * csrsize);
- csrs->csr_host_int_enable = PDQ_CSR_OFFSET(csr_base, 7 * csrsize);
- csrs->csr_type_2_producer = PDQ_CSR_OFFSET(csr_base, 8 * csrsize);
- csrs->csr_cmd_response_producer = PDQ_CSR_OFFSET(csr_base, 10 * csrsize);
- csrs->csr_cmd_request_producer = PDQ_CSR_OFFSET(csr_base, 11 * csrsize);
- csrs->csr_host_smt_producer = PDQ_CSR_OFFSET(csr_base, 12 * csrsize);
- csrs->csr_unsolicited_producer = PDQ_CSR_OFFSET(csr_base, 13 * csrsize);
-}
-
-static void
-pdq_init_pci_csrs(
- pdq_pci_csrs_t *csrs,
- pdq_bus_t bus,
- pdq_bus_memaddr_t csr_base,
- size_t csrsize)
-{
- csrs->csr_bus = bus;
- csrs->csr_base = csr_base;
- csrs->csr_pfi_mode_control = PDQ_CSR_OFFSET(csr_base, 16 * csrsize);
- csrs->csr_pfi_status = PDQ_CSR_OFFSET(csr_base, 17 * csrsize);
- csrs->csr_fifo_write = PDQ_CSR_OFFSET(csr_base, 18 * csrsize);
- csrs->csr_fifo_read = PDQ_CSR_OFFSET(csr_base, 19 * csrsize);
-}
-
-static void
-pdq_flush_databuf_queue(
- pdq_t *pdq,
- pdq_databuf_queue_t *q)
-{
- PDQ_OS_DATABUF_T *pdu;
- for (;;) {
- PDQ_OS_DATABUF_DEQUEUE(q, pdu);
- if (pdu == NULL)
- return;
- PDQ_OS_DATABUF_FREE(pdq, pdu);
- }
-}
-
-static pdq_boolean_t
-pdq_do_port_control(
- const pdq_csrs_t * const csrs,
- pdq_uint32_t cmd)
-{
- int cnt = 0;
- PDQ_CSR_WRITE(csrs, csr_host_int_type_0, PDQ_HOST_INT_CSR_CMD_DONE);
- PDQ_CSR_WRITE(csrs, csr_port_control, PDQ_PCTL_CMD_ERROR | cmd);
- while ((PDQ_CSR_READ(csrs, csr_host_int_type_0) & PDQ_HOST_INT_CSR_CMD_DONE) == 0 && cnt < 33000000)
- cnt++;
- PDQ_PRINTF(("CSR cmd spun %d times\n", cnt));
- if (PDQ_CSR_READ(csrs, csr_host_int_type_0) & PDQ_HOST_INT_CSR_CMD_DONE) {
- PDQ_CSR_WRITE(csrs, csr_host_int_type_0, PDQ_HOST_INT_CSR_CMD_DONE);
- return (PDQ_CSR_READ(csrs, csr_port_control) & PDQ_PCTL_CMD_ERROR) ? PDQ_FALSE : PDQ_TRUE;
- }
- /* adapter failure */
- PDQ_ASSERT(0);
- return PDQ_FALSE;
-}
-
-static void
-pdq_read_mla(
- const pdq_csrs_t * const csrs,
- pdq_lanaddr_t *hwaddr)
-{
- pdq_uint32_t data;
-
- PDQ_CSR_WRITE(csrs, csr_port_data_a, 0);
- pdq_do_port_control(csrs, PDQ_PCTL_MLA_READ);
- data = PDQ_CSR_READ(csrs, csr_host_data);
-
- hwaddr->lanaddr_bytes[0] = (data >> 0) & 0xFF;
- hwaddr->lanaddr_bytes[1] = (data >> 8) & 0xFF;
- hwaddr->lanaddr_bytes[2] = (data >> 16) & 0xFF;
- hwaddr->lanaddr_bytes[3] = (data >> 24) & 0xFF;
-
- PDQ_CSR_WRITE(csrs, csr_port_data_a, 1);
- pdq_do_port_control(csrs, PDQ_PCTL_MLA_READ);
- data = PDQ_CSR_READ(csrs, csr_host_data);
-
- hwaddr->lanaddr_bytes[4] = (data >> 0) & 0xFF;
- hwaddr->lanaddr_bytes[5] = (data >> 8) & 0xFF;
-}
-
-static void
-pdq_read_fwrev(
- const pdq_csrs_t * const csrs,
- pdq_fwrev_t *fwrev)
-{
- pdq_uint32_t data;
-
- pdq_do_port_control(csrs, PDQ_PCTL_FW_REV_READ);
- data = PDQ_CSR_READ(csrs, csr_host_data);
-
- fwrev->fwrev_bytes[3] = (data >> 0) & 0xFF;
- fwrev->fwrev_bytes[2] = (data >> 8) & 0xFF;
- fwrev->fwrev_bytes[1] = (data >> 16) & 0xFF;
- fwrev->fwrev_bytes[0] = (data >> 24) & 0xFF;
-}
-
-static pdq_boolean_t
-pdq_read_error_log(
- pdq_t *pdq,
- pdq_response_error_log_get_t *log_entry)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_uint32_t *ptr = (pdq_uint32_t *) log_entry;
-
- pdq_do_port_control(csrs, PDQ_PCTL_ERROR_LOG_START);
-
- while (pdq_do_port_control(csrs, PDQ_PCTL_FW_REV_READ) == PDQ_TRUE) {
- *ptr++ = PDQ_CSR_READ(csrs, csr_host_data);
- if ((pdq_uint8_t *) ptr - (pdq_uint8_t *) log_entry == sizeof(*log_entry))
- break;
- }
- return (ptr == (pdq_uint32_t *) log_entry) ? PDQ_FALSE : PDQ_TRUE;
-}
-
-static pdq_chip_rev_t
-pdq_read_chiprev(
- const pdq_csrs_t * const csrs)
-{
- pdq_uint32_t data;
-
- PDQ_CSR_WRITE(csrs, csr_port_data_a, PDQ_SUB_CMD_PDQ_REV_GET);
- pdq_do_port_control(csrs, PDQ_PCTL_SUB_CMD);
- data = PDQ_CSR_READ(csrs, csr_host_data);
-
- return (pdq_chip_rev_t) data;
-}
-
-static const struct {
- size_t cmd_len;
- size_t rsp_len;
- const char *cmd_name;
-} pdq_cmd_info[] = {
- { sizeof(pdq_cmd_generic_t), /* 0 - PDQC_START */
- sizeof(pdq_response_generic_t),
- "Start"
- },
- { sizeof(pdq_cmd_filter_set_t), /* 1 - PDQC_FILTER_SET */
- sizeof(pdq_response_generic_t),
- "Filter Set"
- },
- { sizeof(pdq_cmd_generic_t), /* 2 - PDQC_FILTER_GET */
- sizeof(pdq_response_filter_get_t),
- "Filter Get"
- },
- { sizeof(pdq_cmd_chars_set_t), /* 3 - PDQC_CHARS_SET */
- sizeof(pdq_response_generic_t),
- "Chars Set"
- },
- { sizeof(pdq_cmd_generic_t), /* 4 - PDQC_STATUS_CHARS_GET */
- sizeof(pdq_response_status_chars_get_t),
- "Status Chars Get"
- },
-#if 0
- { sizeof(pdq_cmd_generic_t), /* 5 - PDQC_COUNTERS_GET */
- sizeof(pdq_response_counters_get_t),
- "Counters Get"
- },
- { sizeof(pdq_cmd_counters_set_t), /* 6 - PDQC_COUNTERS_SET */
- sizeof(pdq_response_generic_t),
- "Counters Set"
- },
-#else
- { 0, 0, "Counters Get" },
- { 0, 0, "Counters Set" },
-#endif
- { sizeof(pdq_cmd_addr_filter_set_t), /* 7 - PDQC_ADDR_FILTER_SET */
- sizeof(pdq_response_generic_t),
- "Addr Filter Set"
- },
- { sizeof(pdq_cmd_generic_t), /* 8 - PDQC_ADDR_FILTER_GET */
- sizeof(pdq_response_addr_filter_get_t),
- "Addr Filter Get"
- },
- { sizeof(pdq_cmd_generic_t), /* 9 - PDQC_ERROR_LOG_CLEAR */
- sizeof(pdq_response_generic_t),
- "Error Log Clear"
- },
- { sizeof(pdq_cmd_generic_t), /* 10 - PDQC_ERROR_LOG_SET */
- sizeof(pdq_response_generic_t),
- "Error Log Set"
- },
- { sizeof(pdq_cmd_generic_t), /* 11 - PDQC_FDDI_MIB_GET */
- sizeof(pdq_response_generic_t),
- "FDDI MIB Get"
- },
- { sizeof(pdq_cmd_generic_t), /* 12 - PDQC_DEC_EXT_MIB_GET */
- sizeof(pdq_response_generic_t),
- "DEC Ext MIB Get"
- },
- { sizeof(pdq_cmd_generic_t), /* 13 - PDQC_DEC_SPECIFIC_GET */
- sizeof(pdq_response_generic_t),
- "DEC Specific Get"
- },
- { sizeof(pdq_cmd_generic_t), /* 14 - PDQC_SNMP_SET */
- sizeof(pdq_response_generic_t),
- "SNMP Set"
- },
- { 0, 0, "N/A" },
- { sizeof(pdq_cmd_generic_t), /* 16 - PDQC_SMT_MIB_GET */
- sizeof(pdq_response_generic_t),
- "SMT MIB Get"
- },
- { sizeof(pdq_cmd_generic_t), /* 17 - PDQC_SMT_MIB_SET */
- sizeof(pdq_response_generic_t),
- "SMT MIB Set",
- },
- { 0, 0, "Bogus CMD" },
-};
-
-static void
-pdq_queue_commands(
- pdq_t *pdq)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_command_info_t * const ci = &pdq->pdq_command_info;
- pdq_descriptor_block_t * const dbp = pdq->pdq_dbp;
- pdq_txdesc_t * const txd = &dbp->pdqdb_command_requests[ci->ci_request_producer];
- pdq_cmd_code_t op;
- pdq_uint32_t cmdlen, rsplen, mask;
-
- /*
- * If there are commands or responses active or there aren't
- * any pending commands, then don't queue any more.
- */
- if (ci->ci_command_active || ci->ci_pending_commands == 0)
- return;
-
- /*
- * Determine which command needs to be queued.
- */
- op = PDQC_SMT_MIB_SET;
- for (mask = 1 << ((int) op); (mask & ci->ci_pending_commands) == 0; mask >>= 1)
- op = (pdq_cmd_code_t) ((int) op - 1);
- /*
- * Obtain the sizes needed for the command and response.
- * Round up to PDQ_CMD_RX_ALIGNMENT so the receive buffer is
- * always properly aligned.
- */
- cmdlen = PDQ_ROUNDUP(pdq_cmd_info[op].cmd_len, PDQ_CMD_RX_ALIGNMENT);
- rsplen = PDQ_ROUNDUP(pdq_cmd_info[op].rsp_len, PDQ_CMD_RX_ALIGNMENT);
- if (cmdlen < rsplen)
- cmdlen = rsplen;
- /*
- * Since only one command at a time will be queued, there will always
- * be enough space.
- */
-
- /*
- * Obtain and fill in the descriptor for the command (descriptor is
- * pre-initialized)
- */
- txd->txd_seg_len = cmdlen;
-
- /*
- * Clear the command area, set the opcode, and the command from the pending
- * mask.
- */
-
- ci->ci_queued_commands[ci->ci_request_producer] = op;
-#if defined(PDQVERBOSE)
- ((pdq_response_generic_t *) ci->ci_response_bufstart)->generic_op = PDQC_BOGUS_CMD;
-#endif
- PDQ_OS_MEMZERO(ci->ci_request_bufstart, cmdlen);
- *(pdq_cmd_code_t *) ci->ci_request_bufstart = op;
- ci->ci_pending_commands &= ~mask;
-
- /*
- * Fill in the command area, if needed.
- */
- switch (op) {
- case PDQC_FILTER_SET: {
- pdq_cmd_filter_set_t *filter_set = (pdq_cmd_filter_set_t *) ci->ci_request_bufstart;
- unsigned idx = 0;
- filter_set->filter_set_items[idx].item_code = PDQI_IND_GROUP_PROM;
- filter_set->filter_set_items[idx].filter_state = (pdq->pdq_flags & PDQ_PROMISC ? PDQ_FILTER_PASS : PDQ_FILTER_BLOCK);
- idx++;
- filter_set->filter_set_items[idx].item_code = PDQI_GROUP_PROM;
- filter_set->filter_set_items[idx].filter_state = (pdq->pdq_flags & PDQ_ALLMULTI ? PDQ_FILTER_PASS : PDQ_FILTER_BLOCK);
- idx++;
- filter_set->filter_set_items[idx].item_code = PDQI_SMT_PROM;
- filter_set->filter_set_items[idx].filter_state = ((pdq->pdq_flags & (PDQ_PROMISC|PDQ_PASS_SMT)) == (PDQ_PROMISC|PDQ_PASS_SMT) ? PDQ_FILTER_PASS : PDQ_FILTER_BLOCK);
- idx++;
- filter_set->filter_set_items[idx].item_code = PDQI_SMT_USER;
- filter_set->filter_set_items[idx].filter_state = (pdq->pdq_flags & PDQ_PASS_SMT ? PDQ_FILTER_PASS : PDQ_FILTER_BLOCK);
- idx++;
- filter_set->filter_set_items[idx].item_code = PDQI_EOL;
- break;
- }
- case PDQC_ADDR_FILTER_SET: {
- pdq_cmd_addr_filter_set_t *addr_filter_set = (pdq_cmd_addr_filter_set_t *) ci->ci_request_bufstart;
- pdq_lanaddr_t *addr = addr_filter_set->addr_filter_set_addresses;
- addr->lanaddr_bytes[0] = 0xFF;
- addr->lanaddr_bytes[1] = 0xFF;
- addr->lanaddr_bytes[2] = 0xFF;
- addr->lanaddr_bytes[3] = 0xFF;
- addr->lanaddr_bytes[4] = 0xFF;
- addr->lanaddr_bytes[5] = 0xFF;
- addr++;
- pdq_os_addr_fill(pdq, addr, 61);
- break;
- }
- case PDQC_SNMP_SET: {
- pdq_cmd_snmp_set_t *snmp_set = (pdq_cmd_snmp_set_t *) ci->ci_request_bufstart;
- unsigned idx = 0;
- snmp_set->snmp_set_items[idx].item_code = PDQSNMP_FULL_DUPLEX_ENABLE;
- snmp_set->snmp_set_items[idx].item_value = (pdq->pdq_flags & PDQ_WANT_FDX ? 1 : 2);
- snmp_set->snmp_set_items[idx].item_port = 0;
- idx++;
- snmp_set->snmp_set_items[idx].item_code = PDQSNMP_EOL;
- break;
- }
- default: { /* to make gcc happy */
- break;
- }
- }
-
-
- /*
- * Sync the command request buffer and descriptor, then advance
- * the request producer index.
- */
- PDQ_OS_CMDRQST_PRESYNC(pdq, txd->txd_seg_len);
- PDQ_OS_DESC_PRESYNC(pdq, txd, sizeof(pdq_txdesc_t));
- PDQ_ADVANCE(ci->ci_request_producer, 1, PDQ_RING_MASK(dbp->pdqdb_command_requests));
-
- /*
- * Sync the command response buffer and advance the response
- * producer index (descriptor is already pre-initialized)
- */
- PDQ_OS_CMDRSP_PRESYNC(pdq, PDQ_SIZE_COMMAND_RESPONSE);
- PDQ_ADVANCE(ci->ci_response_producer, 1, PDQ_RING_MASK(dbp->pdqdb_command_responses));
- /*
- * At this point the command is done. All that needs to be done is to
- * produce it to the PDQ.
- */
- PDQ_PRINTF(("PDQ Queue Command Request: %s queued\n",
- pdq_cmd_info[op].cmd_name));
-
- ci->ci_command_active++;
- PDQ_CSR_WRITE(csrs, csr_cmd_response_producer, ci->ci_response_producer | (ci->ci_response_completion << 8));
- PDQ_CSR_WRITE(csrs, csr_cmd_request_producer, ci->ci_request_producer | (ci->ci_request_completion << 8));
-}
-
-static void
-pdq_process_command_responses(
- pdq_t * const pdq)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_command_info_t * const ci = &pdq->pdq_command_info;
- volatile const pdq_consumer_block_t * const cbp = pdq->pdq_cbp;
- pdq_descriptor_block_t * const dbp = pdq->pdq_dbp;
- const pdq_response_generic_t *rspgen;
-
- /*
- * We have to process the command and response in tandem so
- * just wait for the response to be consumed. If it has been
- * consumed then the command must have been as well.
- */
-
- if (cbp->pdqcb_command_response == ci->ci_response_completion)
- return;
-
- PDQ_ASSERT(cbp->pdqcb_command_request != ci->ci_request_completion);
-
- PDQ_OS_CMDRSP_POSTSYNC(pdq, PDQ_SIZE_COMMAND_RESPONSE);
- rspgen = (const pdq_response_generic_t *) ci->ci_response_bufstart;
- PDQ_ASSERT(rspgen->generic_op == ci->ci_queued_commands[ci->ci_request_completion]);
- PDQ_ASSERT(rspgen->generic_status == PDQR_SUCCESS);
- PDQ_PRINTF(("PDQ Process Command Response: %s completed (status=%d [0x%x])\n",
- pdq_cmd_info[rspgen->generic_op].cmd_name,
- rspgen->generic_status, rspgen->generic_status));
-
- if (rspgen->generic_op == PDQC_STATUS_CHARS_GET && (pdq->pdq_flags & PDQ_PRINTCHARS)) {
- pdq->pdq_flags &= ~PDQ_PRINTCHARS;
- pdq_print_fddi_chars(pdq, (const pdq_response_status_chars_get_t *) rspgen);
- } else if (rspgen->generic_op == PDQC_DEC_EXT_MIB_GET) {
- pdq->pdq_flags &= ~PDQ_IS_FDX;
- if (((const pdq_response_dec_ext_mib_get_t *)rspgen)->dec_ext_mib_get.fdx_operational)
- pdq->pdq_flags |= PDQ_IS_FDX;
- }
-
- PDQ_ADVANCE(ci->ci_request_completion, 1, PDQ_RING_MASK(dbp->pdqdb_command_requests));
- PDQ_ADVANCE(ci->ci_response_completion, 1, PDQ_RING_MASK(dbp->pdqdb_command_responses));
- ci->ci_command_active = 0;
-
- if (ci->ci_pending_commands != 0) {
- pdq_queue_commands(pdq);
- } else {
- PDQ_CSR_WRITE(csrs, csr_cmd_response_producer,
- ci->ci_response_producer | (ci->ci_response_completion << 8));
- PDQ_CSR_WRITE(csrs, csr_cmd_request_producer,
- ci->ci_request_producer | (ci->ci_request_completion << 8));
- }
-}
-
-/*
- * This following routine processes unsolicited events.
- * In addition, it also fills the unsolicited queue with
- * event buffers so it can be used to initialize the queue
- * as well.
- */
-static void
-pdq_process_unsolicited_events(
- pdq_t *pdq)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_unsolicited_info_t *ui = &pdq->pdq_unsolicited_info;
- volatile const pdq_consumer_block_t *cbp = pdq->pdq_cbp;
- pdq_descriptor_block_t *dbp = pdq->pdq_dbp;
-
- /*
- * Process each unsolicited event (if any).
- */
-
- while (cbp->pdqcb_unsolicited_event != ui->ui_completion) {
- const pdq_unsolicited_event_t *event;
- event = &ui->ui_events[ui->ui_completion & (PDQ_NUM_UNSOLICITED_EVENTS-1)];
- PDQ_OS_UNSOL_EVENT_POSTSYNC(pdq, event);
-
- switch (event->event_type) {
- case PDQ_UNSOLICITED_EVENT: {
- int bad_event = 0;
- switch (event->event_entity) {
- case PDQ_ENTITY_STATION: {
- bad_event = event->event_code.value >= PDQ_STATION_EVENT_MAX;
- break;
- }
- case PDQ_ENTITY_LINK: {
- bad_event = event->event_code.value >= PDQ_LINK_EVENT_MAX;
- break;
- }
- case PDQ_ENTITY_PHY_PORT: {
- bad_event = event->event_code.value >= PDQ_PHY_EVENT_MAX;
- break;
- }
- default: {
- bad_event = 1;
- break;
- }
- }
- if (bad_event) {
- break;
- }
- printf(PDQ_OS_PREFIX "Unsolicited Event: %s: %s",
- PDQ_OS_PREFIX_ARGS,
- pdq_entities[event->event_entity],
- pdq_event_codes[event->event_entity][event->event_code.value]);
- if (event->event_entity == PDQ_ENTITY_PHY_PORT)
- printf("[%d]", event->event_index);
- printf("\n");
- break;
- }
- case PDQ_UNSOLICITED_COUNTERS: {
- break;
- }
- }
- PDQ_OS_UNSOL_EVENT_PRESYNC(pdq, event);
- PDQ_ADVANCE(ui->ui_completion, 1, PDQ_RING_MASK(dbp->pdqdb_unsolicited_events));
- ui->ui_free++;
- }
-
- /*
- * Now give back the event buffers back to the PDQ.
- */
- PDQ_ADVANCE(ui->ui_producer, ui->ui_free, PDQ_RING_MASK(dbp->pdqdb_unsolicited_events));
- ui->ui_free = 0;
-
- PDQ_CSR_WRITE(csrs, csr_unsolicited_producer,
- ui->ui_producer | (ui->ui_completion << 8));
-}
-
-static void
-pdq_process_received_data(
- pdq_t *pdq,
- pdq_rx_info_t *rx,
- pdq_rxdesc_t *receives,
- pdq_uint32_t completion_goal,
- pdq_uint32_t ring_mask)
-{
- pdq_uint32_t completion = rx->rx_completion;
- pdq_uint32_t producer = rx->rx_producer;
- PDQ_OS_DATABUF_T **buffers = (PDQ_OS_DATABUF_T **) rx->rx_buffers;
- pdq_rxdesc_t *rxd;
- pdq_uint32_t idx;
-
- while (completion != completion_goal) {
- PDQ_OS_DATABUF_T *fpdu, *lpdu, *npdu;
- pdq_uint8_t *dataptr;
- pdq_uint32_t fc, datalen, pdulen, segcnt;
- pdq_rxstatus_t status;
-
- fpdu = lpdu = buffers[completion];
- PDQ_ASSERT(fpdu != NULL);
- PDQ_OS_RXPDU_POSTSYNC(pdq, fpdu, 0, sizeof(u_int32_t));
- dataptr = PDQ_OS_DATABUF_PTR(fpdu);
- status = *(pdq_rxstatus_t *) dataptr;
- if (status.rxs_rcc_badpdu == 0) {
- datalen = status.rxs_len;
- PDQ_OS_RXPDU_POSTSYNC(pdq, fpdu, sizeof(u_int32_t),
- PDQ_RX_FC_OFFSET + 1 - sizeof(u_int32_t));
- fc = dataptr[PDQ_RX_FC_OFFSET];
- switch (fc & (PDQ_FDDIFC_C|PDQ_FDDIFC_L|PDQ_FDDIFC_F)) {
- case PDQ_FDDI_LLC_ASYNC:
- case PDQ_FDDI_LLC_SYNC:
- case PDQ_FDDI_IMP_ASYNC:
- case PDQ_FDDI_IMP_SYNC: {
- if (datalen > PDQ_FDDI_MAX || datalen < PDQ_FDDI_LLC_MIN) {
- PDQ_PRINTF(("discard: bad length %d\n", datalen));
- goto discard_frame;
- }
- break;
- }
- case PDQ_FDDI_SMT: {
- if (datalen > PDQ_FDDI_MAX || datalen < PDQ_FDDI_SMT_MIN)
- goto discard_frame;
- break;
- }
- default: {
- PDQ_PRINTF(("discard: bad fc 0x%x\n", fc));
- goto discard_frame;
- }
- }
- /*
- * Update the lengths of the data buffers now that we know
- * the real length.
- */
- pdulen = datalen + (PDQ_RX_FC_OFFSET - PDQ_OS_HDR_OFFSET) - 4 /* CRC */;
- segcnt = (pdulen + PDQ_OS_HDR_OFFSET + PDQ_OS_DATABUF_SIZE - 1) / PDQ_OS_DATABUF_SIZE;
- PDQ_OS_DATABUF_ALLOC(pdq, npdu);
- if (npdu == NULL) {
- PDQ_PRINTF(("discard: no databuf #0\n"));
- goto discard_frame;
- }
- buffers[completion] = npdu;
- for (idx = 1; idx < segcnt; idx++) {
- PDQ_OS_DATABUF_ALLOC(pdq, npdu);
- if (npdu == NULL) {
- PDQ_OS_DATABUF_NEXT_SET(lpdu, NULL);
- PDQ_OS_DATABUF_FREE(pdq, fpdu);
- goto discard_frame;
- }
- PDQ_OS_DATABUF_NEXT_SET(lpdu, buffers[(completion + idx) & ring_mask]);
- lpdu = PDQ_OS_DATABUF_NEXT(lpdu);
- buffers[(completion + idx) & ring_mask] = npdu;
- }
- PDQ_OS_DATABUF_NEXT_SET(lpdu, NULL);
- for (idx = 0; idx < PDQ_RX_SEGCNT; idx++) {
- buffers[(producer + idx) & ring_mask] =
- buffers[(completion + idx) & ring_mask];
- buffers[(completion + idx) & ring_mask] = NULL;
- }
- PDQ_OS_DATABUF_ADJ(fpdu, PDQ_OS_HDR_OFFSET);
- if (segcnt == 1) {
- PDQ_OS_DATABUF_LEN_SET(fpdu, pdulen);
- } else {
- PDQ_OS_DATABUF_LEN_SET(lpdu, pdulen + PDQ_OS_HDR_OFFSET - (segcnt - 1) * PDQ_OS_DATABUF_SIZE);
- }
- /*
- * Do not pass to protocol if packet was received promiscuously
- */
- pdq_os_receive_pdu(pdq, fpdu, pdulen,
- status.rxs_rcc_dd < PDQ_RXS_RCC_DD_CAM_MATCH);
- rx->rx_free += PDQ_RX_SEGCNT;
- PDQ_ADVANCE(producer, PDQ_RX_SEGCNT, ring_mask);
- PDQ_ADVANCE(completion, PDQ_RX_SEGCNT, ring_mask);
- continue;
- } else {
- PDQ_PRINTF(("discard: bad pdu 0x%x(%d.%d.%d.%d.%d)\n", status.rxs_status,
- status.rxs_rcc_badpdu, status.rxs_rcc_badcrc,
- status.rxs_rcc_reason, status.rxs_fsc, status.rxs_fsb_e));
- if (status.rxs_rcc_reason == 7)
- goto discard_frame;
- if (status.rxs_rcc_reason != 0) {
- /* hardware fault */
- if (status.rxs_rcc_badcrc) {
- printf(PDQ_OS_PREFIX " MAC CRC error (source=%x-%x-%x-%x-%x-%x)\n",
- PDQ_OS_PREFIX_ARGS,
- dataptr[PDQ_RX_FC_OFFSET+1],
- dataptr[PDQ_RX_FC_OFFSET+2],
- dataptr[PDQ_RX_FC_OFFSET+3],
- dataptr[PDQ_RX_FC_OFFSET+4],
- dataptr[PDQ_RX_FC_OFFSET+5],
- dataptr[PDQ_RX_FC_OFFSET+6]);
- /* rx->rx_badcrc++; */
- } else if (status.rxs_fsc == 0 || status.rxs_fsb_e == 1) {
- /* rx->rx_frame_status_errors++; */
- } else {
- /* hardware fault */
- }
- }
- }
- discard_frame:
- /*
- * Discarded frames go right back on the queue; therefore
- * ring entries were freed.
- */
- for (idx = 0; idx < PDQ_RX_SEGCNT; idx++) {
- buffers[producer] = buffers[completion];
- buffers[completion] = NULL;
- rxd = &receives[rx->rx_producer];
- if (idx == 0) {
- rxd->rxd_sop = 1; rxd->rxd_seg_cnt = PDQ_RX_SEGCNT - 1;
- } else {
- rxd->rxd_sop = 0; rxd->rxd_seg_cnt = 0;
- }
- rxd->rxd_pa_hi = 0;
- rxd->rxd_seg_len_hi = PDQ_OS_DATABUF_SIZE / 16;
- rxd->rxd_pa_lo = PDQ_OS_DATABUF_BUSPA(pdq, buffers[rx->rx_producer]);
- PDQ_OS_RXPDU_PRESYNC(pdq, buffers[rx->rx_producer], 0, PDQ_OS_DATABUF_SIZE);
- PDQ_OS_DESC_PRESYNC(pdq, rxd, sizeof(*rxd));
- PDQ_ADVANCE(rx->rx_producer, 1, ring_mask);
- PDQ_ADVANCE(producer, 1, ring_mask);
- PDQ_ADVANCE(completion, 1, ring_mask);
- }
- }
- rx->rx_completion = completion;
-
- while (rx->rx_free > PDQ_RX_SEGCNT && rx->rx_free > rx->rx_target) {
- PDQ_OS_DATABUF_T *pdu;
- /*
- * Allocate the needed number of data buffers.
- * Try to obtain them from our free queue before
- * asking the system for more.
- */
- for (idx = 0; idx < PDQ_RX_SEGCNT; idx++) {
- if ((pdu = buffers[(rx->rx_producer + idx) & ring_mask]) == NULL) {
- PDQ_OS_DATABUF_ALLOC(pdq, pdu);
- if (pdu == NULL)
- break;
- buffers[(rx->rx_producer + idx) & ring_mask] = pdu;
- }
- rxd = &receives[(rx->rx_producer + idx) & ring_mask];
- if (idx == 0) {
- rxd->rxd_sop = 1; rxd->rxd_seg_cnt = PDQ_RX_SEGCNT - 1;
- } else {
- rxd->rxd_sop = 0; rxd->rxd_seg_cnt = 0;
- }
- rxd->rxd_pa_hi = 0;
- rxd->rxd_seg_len_hi = PDQ_OS_DATABUF_SIZE / 16;
- rxd->rxd_pa_lo = PDQ_OS_DATABUF_BUSPA(pdq, pdu);
- PDQ_OS_RXPDU_PRESYNC(pdq, pdu, 0, PDQ_OS_DATABUF_SIZE);
- PDQ_OS_DESC_PRESYNC(pdq, rxd, sizeof(*rxd));
- }
- if (idx < PDQ_RX_SEGCNT) {
- /*
- * We didn't get all databufs required to complete a new
- * receive buffer. Keep the ones we got and retry a bit
- * later for the rest.
- */
- break;
- }
- PDQ_ADVANCE(rx->rx_producer, PDQ_RX_SEGCNT, ring_mask);
- rx->rx_free -= PDQ_RX_SEGCNT;
- }
-}
-
-static void pdq_process_transmitted_data(pdq_t *pdq);
-
-pdq_boolean_t
-pdq_queue_transmit_data(
- pdq_t *pdq,
- PDQ_OS_DATABUF_T *pdu)
-{
- pdq_tx_info_t * const tx = &pdq->pdq_tx_info;
- pdq_descriptor_block_t * const dbp = pdq->pdq_dbp;
- pdq_uint32_t producer = tx->tx_producer;
- pdq_txdesc_t *eop = NULL;
- PDQ_OS_DATABUF_T *pdu0;
- pdq_uint32_t freecnt;
-#if defined(PDQ_BUS_DMA)
- bus_dmamap_t map;
-#endif
-
- again:
- if (PDQ_RX_FC_OFFSET == PDQ_OS_HDR_OFFSET) {
- freecnt = tx->tx_free - 1;
- } else {
- freecnt = tx->tx_free;
- }
- /*
- * Need 2 or more descriptors to be able to send.
- */
- if (freecnt == 0) {
- pdq->pdq_intrmask |= PDQ_HOST_INT_TX_ENABLE;
- PDQ_CSR_WRITE(&pdq->pdq_csrs, csr_host_int_enable, pdq->pdq_intrmask);
- return PDQ_FALSE;
- }
-
- if (PDQ_RX_FC_OFFSET == PDQ_OS_HDR_OFFSET) {
- dbp->pdqdb_transmits[producer] = tx->tx_hdrdesc;
- PDQ_OS_DESC_PRESYNC(pdq, &dbp->pdqdb_transmits[producer], sizeof(pdq_txdesc_t));
- PDQ_ADVANCE(producer, 1, PDQ_RING_MASK(dbp->pdqdb_transmits));
- }
-
-#if defined(PDQ_BUS_DMA)
- map = M_GETCTX(pdu, bus_dmamap_t);
- if (freecnt >= map->dm_nsegs) {
- int idx;
- for (idx = 0; idx < map->dm_nsegs; idx++) {
- /*
- * Initialize the transmit descriptor
- */
- eop = &dbp->pdqdb_transmits[producer];
- eop->txd_seg_len = map->dm_segs[idx].ds_len;
- eop->txd_pa_lo = map->dm_segs[idx].ds_addr;
- eop->txd_sop = eop->txd_eop = eop->txd_pa_hi = 0;
- PDQ_OS_DESC_PRESYNC(pdq, eop, sizeof(pdq_txdesc_t));
- freecnt--;
- PDQ_ADVANCE(producer, 1, PDQ_RING_MASK(dbp->pdqdb_transmits));
- }
- pdu0 = NULL;
- } else {
- pdu0 = pdu;
- }
-#else
- for (freecnt = tx->tx_free - 1, pdu0 = pdu; pdu0 != NULL && freecnt > 0;) {
- pdq_uint32_t fraglen, datalen = PDQ_OS_DATABUF_LEN(pdu0);
- const pdq_uint8_t *dataptr = PDQ_OS_DATABUF_PTR(pdu0);
-
- /*
- * The first segment is limited to the space remaining in
- * page. All segments after that can be up to a full page
- * in size.
- */
- fraglen = PDQ_OS_PAGESIZE - ((dataptr - (pdq_uint8_t *) NULL) & (PDQ_OS_PAGESIZE-1));
- while (datalen > 0 && freecnt > 0) {
- pdq_uint32_t seglen = (fraglen < datalen ? fraglen : datalen);
-
- /*
- * Initialize the transmit descriptor
- */
- eop = &dbp->pdqdb_transmits[producer];
- eop->txd_seg_len = seglen;
- eop->txd_pa_lo = PDQ_OS_VA_TO_BUSPA(pdq, dataptr);
- eop->txd_sop = eop->txd_eop = eop->txd_pa_hi = 0;
- PDQ_OS_DESC_PRESYNC(pdq, eop, sizeof(pdq_txdesc_t));
- datalen -= seglen;
- dataptr += seglen;
- fraglen = PDQ_OS_PAGESIZE;
- freecnt--;
- PDQ_ADVANCE(producer, 1, PDQ_RING_MASK(dbp->pdqdb_transmits));
- }
- pdu0 = PDQ_OS_DATABUF_NEXT(pdu0);
- }
-#endif /* defined(PDQ_BUS_DMA) */
- if (pdu0 != NULL) {
- unsigned completion = tx->tx_completion;
- PDQ_ASSERT(freecnt == 0);
- PDQ_OS_CONSUMER_POSTSYNC(pdq);
- pdq_process_transmitted_data(pdq);
- if (completion != tx->tx_completion) {
- producer = tx->tx_producer;
- eop = NULL;
- goto again;
- }
- /*
- * If we still have data to process then the ring was too full
- * to store the PDU. Return FALSE so the caller will requeue
- * the PDU for later.
- */
- pdq->pdq_intrmask |= PDQ_HOST_INT_TX_ENABLE;
- PDQ_CSR_WRITE(&pdq->pdq_csrs, csr_host_int_enable, pdq->pdq_intrmask);
- return PDQ_FALSE;
- }
- /*
- * Everything went fine. Finish it up.
- */
- tx->tx_descriptor_count[tx->tx_producer] = tx->tx_free - freecnt;
- if (PDQ_RX_FC_OFFSET != PDQ_OS_HDR_OFFSET) {
- dbp->pdqdb_transmits[tx->tx_producer].txd_sop = 1;
- PDQ_OS_DESC_PRESYNC(pdq, &dbp->pdqdb_transmits[tx->tx_producer],
- sizeof(pdq_txdesc_t));
- }
- eop->txd_eop = 1;
- PDQ_OS_DESC_PRESYNC(pdq, eop, sizeof(pdq_txdesc_t));
- PDQ_OS_DATABUF_ENQUEUE(&tx->tx_txq, pdu);
- tx->tx_producer = producer;
- tx->tx_free = freecnt;
- PDQ_DO_TYPE2_PRODUCER(pdq);
- return PDQ_TRUE;
-}
-
-static void
-pdq_process_transmitted_data(
- pdq_t *pdq)
-{
- pdq_tx_info_t *tx = &pdq->pdq_tx_info;
- volatile const pdq_consumer_block_t *cbp = pdq->pdq_cbp;
- pdq_descriptor_block_t *dbp = pdq->pdq_dbp;
- pdq_uint32_t completion = tx->tx_completion;
- int reclaimed = 0;
-
- while (completion != cbp->pdqcb_transmits) {
- PDQ_OS_DATABUF_T *pdu;
- pdq_uint32_t descriptor_count = tx->tx_descriptor_count[completion];
- PDQ_ASSERT(dbp->pdqdb_transmits[completion].txd_sop == 1);
- PDQ_ASSERT(dbp->pdqdb_transmits[(completion + descriptor_count - 1) & PDQ_RING_MASK(dbp->pdqdb_transmits)].txd_eop == 1);
- PDQ_OS_DATABUF_DEQUEUE(&tx->tx_txq, pdu);
- pdq_os_transmit_done(pdq, pdu);
- tx->tx_free += descriptor_count;
- reclaimed = 1;
- PDQ_ADVANCE(completion, descriptor_count, PDQ_RING_MASK(dbp->pdqdb_transmits));
- }
- if (tx->tx_completion != completion) {
- tx->tx_completion = completion;
- pdq->pdq_intrmask &= ~PDQ_HOST_INT_TX_ENABLE;
- PDQ_CSR_WRITE(&pdq->pdq_csrs, csr_host_int_enable, pdq->pdq_intrmask);
- pdq_os_restart_transmitter(pdq);
- }
- if (reclaimed)
- PDQ_DO_TYPE2_PRODUCER(pdq);
-}
-
-void
-pdq_flush_transmitter(
- pdq_t *pdq)
-{
- volatile pdq_consumer_block_t *cbp = pdq->pdq_cbp;
- pdq_tx_info_t *tx = &pdq->pdq_tx_info;
-
- for (;;) {
- PDQ_OS_DATABUF_T *pdu;
- PDQ_OS_DATABUF_DEQUEUE(&tx->tx_txq, pdu);
- if (pdu == NULL)
- break;
- /*
- * Don't call transmit done since the packet never made it
- * out on the wire.
- */
- PDQ_OS_DATABUF_FREE(pdq, pdu);
- }
-
- tx->tx_free = PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_transmits);
- cbp->pdqcb_transmits = tx->tx_completion = tx->tx_producer;
- PDQ_OS_CONSUMER_PRESYNC(pdq);
-
- PDQ_DO_TYPE2_PRODUCER(pdq);
-}
-
-void
-pdq_hwreset(
- pdq_t *pdq)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_state_t state;
- int cnt;
-
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- if (state == PDQS_DMA_UNAVAILABLE)
- return;
- PDQ_CSR_WRITE(csrs, csr_port_data_a, PDQ_PRESET_SKIP_SELFTEST);
- PDQ_CSR_WRITE(csrs, csr_port_reset, 1);
- PDQ_OS_USEC_DELAY(100);
- PDQ_CSR_WRITE(csrs, csr_port_reset, 0);
- for (cnt = 100000;;cnt--) {
- PDQ_OS_USEC_DELAY(1000);
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- if (state == PDQS_DMA_UNAVAILABLE || cnt == 0)
- break;
- }
- PDQ_PRINTF(("PDQ Reset spun %d cycles\n", 100000 - cnt));
- PDQ_OS_USEC_DELAY(10000);
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- PDQ_ASSERT(state == PDQS_DMA_UNAVAILABLE);
- PDQ_ASSERT(cnt > 0);
-}
-
-/*
- * The following routine brings the PDQ from whatever state it is
- * in to DMA_UNAVAILABLE (ie. like a RESET but without doing a RESET).
- */
-pdq_state_t
-pdq_stop(
- pdq_t *pdq)
-{
- pdq_state_t state;
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- int cnt, pass = 0, idx;
- PDQ_OS_DATABUF_T **buffers;
-
- restart:
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- if (state != PDQS_DMA_UNAVAILABLE) {
- pdq_hwreset(pdq);
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- PDQ_ASSERT(state == PDQS_DMA_UNAVAILABLE);
- }
-#if 0
- switch (state) {
- case PDQS_RING_MEMBER:
- case PDQS_LINK_UNAVAILABLE:
- case PDQS_LINK_AVAILABLE: {
- PDQ_CSR_WRITE(csrs, csr_port_data_a, PDQ_SUB_CMD_LINK_UNINIT);
- PDQ_CSR_WRITE(csrs, csr_port_data_b, 0);
- pdq_do_port_control(csrs, PDQ_PCTL_SUB_CMD);
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- PDQ_ASSERT(state == PDQS_DMA_AVAILABLE);
- /* FALLTHROUGH */
- }
- case PDQS_DMA_AVAILABLE: {
- PDQ_CSR_WRITE(csrs, csr_port_data_a, 0);
- PDQ_CSR_WRITE(csrs, csr_port_data_b, 0);
- pdq_do_port_control(csrs, PDQ_PCTL_DMA_UNINIT);
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- PDQ_ASSERT(state == PDQS_DMA_UNAVAILABLE);
- /* FALLTHROUGH */
- }
- case PDQS_DMA_UNAVAILABLE: {
- break;
- }
- }
-#endif
- /*
- * Now we should be in DMA_UNAVAILABLE. So bring the PDQ into
- * DMA_AVAILABLE.
- */
-
- /*
- * Obtain the hardware address and firmware revisions
- * (MLA = my long address which is FDDI speak for hardware address)
- */
- pdq_read_mla(&pdq->pdq_csrs, &pdq->pdq_hwaddr);
- pdq_read_fwrev(&pdq->pdq_csrs, &pdq->pdq_fwrev);
- pdq->pdq_chip_rev = pdq_read_chiprev(&pdq->pdq_csrs);
-
- /*
- * Disable interrupts and DMA.
- */
- PDQ_CSR_WRITE(&pdq->pdq_pci_csrs, csr_pfi_mode_control, 0);
- PDQ_CSR_WRITE(&pdq->pdq_pci_csrs, csr_pfi_status, 0x10);
-
- /*
- * Flush all the databuf queues.
- */
- pdq_flush_databuf_queue(pdq, &pdq->pdq_tx_info.tx_txq);
- pdq->pdq_flags &= ~(PDQ_TXOK|PDQ_IS_ONRING|PDQ_IS_FDX);
- buffers = (PDQ_OS_DATABUF_T **) pdq->pdq_rx_info.rx_buffers;
- for (idx = 0; idx < PDQ_RING_SIZE(pdq->pdq_dbp->pdqdb_receives); idx++) {
- if (buffers[idx] != NULL) {
- PDQ_OS_DATABUF_FREE(pdq, buffers[idx]);
- buffers[idx] = NULL;
- }
- }
- pdq->pdq_rx_info.rx_free = PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_receives);
- buffers = (PDQ_OS_DATABUF_T **) pdq->pdq_host_smt_info.rx_buffers;
- for (idx = 0; idx < PDQ_RING_SIZE(pdq->pdq_dbp->pdqdb_host_smt); idx++) {
- if (buffers[idx] != NULL) {
- PDQ_OS_DATABUF_FREE(pdq, buffers[idx]);
- buffers[idx] = NULL;
- }
- }
- pdq->pdq_host_smt_info.rx_free = PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_host_smt);
-
- /*
- * Reset the consumer indexes to 0.
- */
- pdq->pdq_cbp->pdqcb_receives = 0;
- pdq->pdq_cbp->pdqcb_transmits = 0;
- pdq->pdq_cbp->pdqcb_host_smt = 0;
- pdq->pdq_cbp->pdqcb_unsolicited_event = 0;
- pdq->pdq_cbp->pdqcb_command_response = 0;
- pdq->pdq_cbp->pdqcb_command_request = 0;
- PDQ_OS_CONSUMER_PRESYNC(pdq);
-
- /*
- * Reset the producer and completion indexes to 0.
- */
- pdq->pdq_command_info.ci_request_producer = 0;
- pdq->pdq_command_info.ci_response_producer = 0;
- pdq->pdq_command_info.ci_request_completion = 0;
- pdq->pdq_command_info.ci_response_completion = 0;
- pdq->pdq_unsolicited_info.ui_producer = 0;
- pdq->pdq_unsolicited_info.ui_completion = 0;
- pdq->pdq_rx_info.rx_producer = 0;
- pdq->pdq_rx_info.rx_completion = 0;
- pdq->pdq_tx_info.tx_producer = 0;
- pdq->pdq_tx_info.tx_completion = 0;
- pdq->pdq_host_smt_info.rx_producer = 0;
- pdq->pdq_host_smt_info.rx_completion = 0;
-
- pdq->pdq_command_info.ci_command_active = 0;
- pdq->pdq_unsolicited_info.ui_free = PDQ_NUM_UNSOLICITED_EVENTS;
- pdq->pdq_tx_info.tx_free = PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_transmits);
-
- /*
- * Allow the DEFPA to do DMA. Then program the physical
- * addresses of the consumer and descriptor blocks.
- */
-#ifdef PDQTEST
- PDQ_CSR_WRITE(&pdq->pdq_pci_csrs, csr_pfi_mode_control,
- PDQ_PFI_MODE_DMA_ENABLE);
-#else
- PDQ_CSR_WRITE(&pdq->pdq_pci_csrs, csr_pfi_mode_control,
- PDQ_PFI_MODE_DMA_ENABLE
- /*|PDQ_PFI_MODE_PFI_PCI_INTR*/|PDQ_PFI_MODE_PDQ_PCI_INTR);
-#endif
-
- /*
- * Make sure the unsolicited queue has events ...
- */
- pdq_process_unsolicited_events(pdq);
-
- PDQ_CSR_WRITE(csrs, csr_port_data_b, PDQ_DMA_BURST_8LW);
- PDQ_CSR_WRITE(csrs, csr_port_data_a, PDQ_SUB_CMD_DMA_BURST_SIZE_SET);
- pdq_do_port_control(csrs, PDQ_PCTL_SUB_CMD);
-
- /*
- * Make sure there isn't stale information in the caches before
- * tell the adapter about the blocks it's going to use.
- */
- PDQ_OS_CONSUMER_PRESYNC(pdq);
-
- PDQ_CSR_WRITE(csrs, csr_port_data_b, 0);
- PDQ_CSR_WRITE(csrs, csr_port_data_a, pdq->pdq_pa_consumer_block);
- pdq_do_port_control(csrs, PDQ_PCTL_CONSUMER_BLOCK);
-
- PDQ_CSR_WRITE(csrs, csr_port_data_b, 0);
-#if !defined(BYTE_ORDER) || BYTE_ORDER == LITTLE_ENDIAN
- PDQ_CSR_WRITE(csrs, csr_port_data_a, pdq->pdq_pa_descriptor_block | PDQ_DMA_INIT_LW_BSWAP_DATA);
-#else
- PDQ_CSR_WRITE(csrs, csr_port_data_a, pdq->pdq_pa_descriptor_block | PDQ_DMA_INIT_LW_BSWAP_DATA | PDQ_DMA_INIT_LW_BSWAP_LITERAL);
-#endif
- pdq_do_port_control(csrs, PDQ_PCTL_DMA_INIT);
-
- for (cnt = 0; cnt < 1000; cnt++) {
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- if (state == PDQS_HALTED) {
- if (pass > 0)
- return PDQS_HALTED;
- pass = 1;
- goto restart;
- }
- if (state == PDQS_DMA_AVAILABLE) {
- PDQ_PRINTF(("Transition to DMA Available took %d spins\n", cnt));
- break;
- }
- PDQ_OS_USEC_DELAY(1000);
- }
- PDQ_ASSERT(state == PDQS_DMA_AVAILABLE);
-
- PDQ_CSR_WRITE(csrs, csr_host_int_type_0, 0xFF);
- pdq->pdq_intrmask = 0;
- /* PDQ_HOST_INT_STATE_CHANGE
- |PDQ_HOST_INT_FATAL_ERROR|PDQ_HOST_INT_CMD_RSP_ENABLE
- |PDQ_HOST_INT_UNSOL_ENABLE */
- PDQ_CSR_WRITE(csrs, csr_host_int_enable, pdq->pdq_intrmask);
-
- /*
- * Any other command but START should be valid.
- */
- pdq->pdq_command_info.ci_pending_commands &= ~(PDQ_BITMASK(PDQC_START));
- if (pdq->pdq_flags & PDQ_PRINTCHARS)
- pdq->pdq_command_info.ci_pending_commands |= PDQ_BITMASK(PDQC_STATUS_CHARS_GET);
- pdq_queue_commands(pdq);
-
- if (pdq->pdq_flags & PDQ_PRINTCHARS) {
- /*
- * Now wait (up to 100ms) for the command(s) to finish.
- */
- for (cnt = 0; cnt < 1000; cnt++) {
- PDQ_OS_CONSUMER_POSTSYNC(pdq);
- pdq_process_command_responses(pdq);
- if (pdq->pdq_command_info.ci_response_producer == pdq->pdq_command_info.ci_response_completion)
- break;
- PDQ_OS_USEC_DELAY(1000);
- }
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- }
-
- return state;
-}
-
-void
-pdq_run(
- pdq_t *pdq)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_state_t state;
-
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- PDQ_ASSERT(state != PDQS_DMA_UNAVAILABLE);
- PDQ_ASSERT(state != PDQS_RESET);
- PDQ_ASSERT(state != PDQS_HALTED);
- PDQ_ASSERT(state != PDQS_UPGRADE);
- PDQ_ASSERT(state != PDQS_RING_MEMBER);
- switch (state) {
- case PDQS_DMA_AVAILABLE: {
- /*
- * The PDQ after being reset screws up some of its state.
- * So we need to clear all the errors/interrupts so the real
- * ones will get through.
- */
- PDQ_CSR_WRITE(csrs, csr_host_int_type_0, 0xFF);
- pdq->pdq_intrmask = PDQ_HOST_INT_STATE_CHANGE
- |PDQ_HOST_INT_XMT_DATA_FLUSH|PDQ_HOST_INT_FATAL_ERROR
- |PDQ_HOST_INT_CMD_RSP_ENABLE|PDQ_HOST_INT_UNSOL_ENABLE
- |PDQ_HOST_INT_RX_ENABLE|PDQ_HOST_INT_HOST_SMT_ENABLE;
- PDQ_CSR_WRITE(csrs, csr_host_int_enable, pdq->pdq_intrmask);
- /*
- * Set the MAC and address filters and start up the PDQ.
- */
- pdq_process_unsolicited_events(pdq);
- pdq_process_received_data(pdq, &pdq->pdq_rx_info,
- pdq->pdq_dbp->pdqdb_receives,
- pdq->pdq_cbp->pdqcb_receives,
- PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_receives));
- PDQ_DO_TYPE2_PRODUCER(pdq);
- if (pdq->pdq_flags & PDQ_PASS_SMT) {
- pdq_process_received_data(pdq, &pdq->pdq_host_smt_info,
- pdq->pdq_dbp->pdqdb_host_smt,
- pdq->pdq_cbp->pdqcb_host_smt,
- PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_host_smt));
- PDQ_CSR_WRITE(csrs, csr_host_smt_producer,
- pdq->pdq_host_smt_info.rx_producer
- | (pdq->pdq_host_smt_info.rx_completion << 8));
- }
- pdq->pdq_command_info.ci_pending_commands = PDQ_BITMASK(PDQC_FILTER_SET)
- | PDQ_BITMASK(PDQC_ADDR_FILTER_SET)
- | PDQ_BITMASK(PDQC_SNMP_SET)
- | PDQ_BITMASK(PDQC_START);
- if (pdq->pdq_flags & PDQ_PRINTCHARS)
- pdq->pdq_command_info.ci_pending_commands |= PDQ_BITMASK(PDQC_STATUS_CHARS_GET);
- pdq_queue_commands(pdq);
- break;
- }
- case PDQS_LINK_UNAVAILABLE:
- case PDQS_LINK_AVAILABLE: {
- pdq->pdq_command_info.ci_pending_commands = PDQ_BITMASK(PDQC_FILTER_SET)
- | PDQ_BITMASK(PDQC_ADDR_FILTER_SET)
- | PDQ_BITMASK(PDQC_SNMP_SET);
- if (pdq->pdq_flags & PDQ_PRINTCHARS)
- pdq->pdq_command_info.ci_pending_commands |= PDQ_BITMASK(PDQC_STATUS_CHARS_GET);
- if (pdq->pdq_flags & PDQ_PASS_SMT) {
- pdq_process_received_data(pdq, &pdq->pdq_host_smt_info,
- pdq->pdq_dbp->pdqdb_host_smt,
- pdq->pdq_cbp->pdqcb_host_smt,
- PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_host_smt));
- PDQ_CSR_WRITE(csrs, csr_host_smt_producer,
- pdq->pdq_host_smt_info.rx_producer
- | (pdq->pdq_host_smt_info.rx_completion << 8));
- }
- pdq_process_unsolicited_events(pdq);
- pdq_queue_commands(pdq);
- break;
- }
- case PDQS_RING_MEMBER: {
- }
- default: { /* to make gcc happy */
- break;
- }
- }
-}
-
-int
-pdq_interrupt(
- pdq_t *pdq)
-{
- const pdq_csrs_t * const csrs = &pdq->pdq_csrs;
- pdq_uint32_t data;
- int progress = 0;
-
- PDQ_CSR_WRITE(&pdq->pdq_pci_csrs, csr_pfi_status, 0x18);
-
- while ((data = PDQ_CSR_READ(csrs, csr_port_status)) & PDQ_PSTS_INTR_PENDING) {
- progress = 1;
- PDQ_PRINTF(("PDQ Interrupt: Status = 0x%08x\n", data));
- PDQ_OS_CONSUMER_POSTSYNC(pdq);
- if (data & PDQ_PSTS_RCV_DATA_PENDING) {
- pdq_process_received_data(pdq, &pdq->pdq_rx_info,
- pdq->pdq_dbp->pdqdb_receives,
- pdq->pdq_cbp->pdqcb_receives,
- PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_receives));
- PDQ_DO_TYPE2_PRODUCER(pdq);
- }
- if (data & PDQ_PSTS_HOST_SMT_PENDING) {
- pdq_process_received_data(pdq, &pdq->pdq_host_smt_info,
- pdq->pdq_dbp->pdqdb_host_smt,
- pdq->pdq_cbp->pdqcb_host_smt,
- PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_host_smt));
- PDQ_DO_HOST_SMT_PRODUCER(pdq);
- }
- /* if (data & PDQ_PSTS_XMT_DATA_PENDING) */
- pdq_process_transmitted_data(pdq);
- if (data & PDQ_PSTS_UNSOL_PENDING)
- pdq_process_unsolicited_events(pdq);
- if (data & PDQ_PSTS_CMD_RSP_PENDING)
- pdq_process_command_responses(pdq);
- if (data & PDQ_PSTS_TYPE_0_PENDING) {
- data = PDQ_CSR_READ(csrs, csr_host_int_type_0);
- if (data & PDQ_HOST_INT_STATE_CHANGE) {
- pdq_state_t state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(csrs, csr_port_status));
- printf(PDQ_OS_PREFIX "%s", PDQ_OS_PREFIX_ARGS, pdq_adapter_states[state]);
- if (state == PDQS_LINK_UNAVAILABLE) {
- pdq->pdq_flags &= ~(PDQ_TXOK|PDQ_IS_ONRING|PDQ_IS_FDX);
- } else if (state == PDQS_LINK_AVAILABLE) {
- if (pdq->pdq_flags & PDQ_WANT_FDX) {
- pdq->pdq_command_info.ci_pending_commands |= PDQ_BITMASK(PDQC_DEC_EXT_MIB_GET);
- pdq_queue_commands(pdq);
- }
- pdq->pdq_flags |= PDQ_TXOK|PDQ_IS_ONRING;
- pdq_os_restart_transmitter(pdq);
- } else if (state == PDQS_HALTED) {
- pdq_response_error_log_get_t log_entry;
- pdq_halt_code_t halt_code = PDQ_PSTS_HALT_ID(PDQ_CSR_READ(csrs, csr_port_status));
- printf(": halt code = %d (%s)\n",
- halt_code, pdq_halt_codes[halt_code]);
- if (halt_code == PDQH_DMA_ERROR) {
- PDQ_PRINTF(("\tPFI status = 0x%x, Host 0 Fatal Interrupt = 0x%x\n",
- PDQ_CSR_READ(&pdq->pdq_pci_csrs, csr_pfi_status),
- data & PDQ_HOST_INT_FATAL_ERROR));
- }
- PDQ_OS_MEMZERO(&log_entry, sizeof(log_entry));
- if (pdq_read_error_log(pdq, &log_entry)) {
- PDQ_PRINTF((" Error log Entry:\n"));
- PDQ_PRINTF((" CMD Status = %d (0x%x)\n",
- log_entry.error_log_get_status,
- log_entry.error_log_get_status));
- PDQ_PRINTF((" Event Status = %d (0x%x)\n",
- log_entry.error_log_get_event_status,
- log_entry.error_log_get_event_status));
- PDQ_PRINTF((" Caller Id = %d (0x%x)\n",
- log_entry.error_log_get_caller_id,
- log_entry.error_log_get_caller_id));
- PDQ_PRINTF((" Write Count = %d (0x%x)\n",
- log_entry.error_log_get_write_count,
- log_entry.error_log_get_write_count));
- PDQ_PRINTF((" FRU Implication Mask = %d (0x%x)\n",
- log_entry.error_log_get_fru_implication_mask,
- log_entry.error_log_get_fru_implication_mask));
- PDQ_PRINTF((" Test ID = %d (0x%x)\n",
- log_entry.error_log_get_test_id,
- log_entry.error_log_get_test_id));
- }
- pdq_stop(pdq);
- if (pdq->pdq_flags & PDQ_RUNNING)
- pdq_run(pdq);
- return 1;
- }
- printf("\n");
- PDQ_CSR_WRITE(csrs, csr_host_int_type_0, PDQ_HOST_INT_STATE_CHANGE);
- }
- if (data & PDQ_HOST_INT_FATAL_ERROR) {
- pdq_stop(pdq);
- if (pdq->pdq_flags & PDQ_RUNNING)
- pdq_run(pdq);
- return 1;
- }
- if (data & PDQ_HOST_INT_XMT_DATA_FLUSH) {
- printf(PDQ_OS_PREFIX "Flushing transmit queue\n", PDQ_OS_PREFIX_ARGS);
- pdq->pdq_flags &= ~PDQ_TXOK;
- pdq_flush_transmitter(pdq);
- pdq_do_port_control(csrs, PDQ_PCTL_XMT_DATA_FLUSH_DONE);
- PDQ_CSR_WRITE(csrs, csr_host_int_type_0, PDQ_HOST_INT_XMT_DATA_FLUSH);
- }
- }
- PDQ_CSR_WRITE(&pdq->pdq_pci_csrs, csr_pfi_status, 0x18);
- }
- return progress;
-}
-
-pdq_t *
-pdq_initialize(
- pdq_bus_t bus,
- pdq_bus_memaddr_t csr_base,
- const char *name,
- int unit,
- void *ctx,
- pdq_type_t type)
-{
- pdq_t *pdq;
- pdq_state_t state;
- pdq_descriptor_block_t *dbp;
-#if !defined(PDQ_BUS_DMA)
- const pdq_uint32_t contig_bytes = (sizeof(pdq_descriptor_block_t) * 2) - PDQ_OS_PAGESIZE;
- pdq_uint8_t *p;
-#endif
- int idx;
-
- PDQ_ASSERT(sizeof(pdq_descriptor_block_t) == 8192);
- PDQ_ASSERT(sizeof(pdq_consumer_block_t) == 64);
- PDQ_ASSERT(sizeof(pdq_response_filter_get_t) == PDQ_SIZE_RESPONSE_FILTER_GET);
- PDQ_ASSERT(sizeof(pdq_cmd_addr_filter_set_t) == PDQ_SIZE_CMD_ADDR_FILTER_SET);
- PDQ_ASSERT(sizeof(pdq_response_addr_filter_get_t) == PDQ_SIZE_RESPONSE_ADDR_FILTER_GET);
- PDQ_ASSERT(sizeof(pdq_response_status_chars_get_t) == PDQ_SIZE_RESPONSE_STATUS_CHARS_GET);
- PDQ_ASSERT(sizeof(pdq_response_fddi_mib_get_t) == PDQ_SIZE_RESPONSE_FDDI_MIB_GET);
- PDQ_ASSERT(sizeof(pdq_response_dec_ext_mib_get_t) == PDQ_SIZE_RESPONSE_DEC_EXT_MIB_GET);
- PDQ_ASSERT(sizeof(pdq_unsolicited_event_t) == 512);
-
- pdq = (pdq_t *) PDQ_OS_MEMALLOC(sizeof(pdq_t));
- if (pdq == NULL) {
- PDQ_PRINTF(("malloc(%d) failed\n", sizeof(*pdq)));
- return NULL;
- }
- PDQ_OS_MEMZERO(pdq, sizeof(pdq_t));
- pdq->pdq_type = type;
- pdq->pdq_unit = unit;
- pdq->pdq_os_ctx = (void *) ctx;
- pdq->pdq_os_name = name;
- pdq->pdq_flags = PDQ_PRINTCHARS;
- /*
- * Allocate the additional data structures required by
- * the PDQ driver. Allocate a contiguous region of memory
- * for the descriptor block. We need to allocated enough
- * to guarantee that we will a get 8KB block of memory aligned
- * on a 8KB boundary. This turns to require that we allocate
- * (N*2 - 1 page) pages of memory. On machine with less than
- * a 8KB page size, it mean we will allocate more memory than
- * we need. The extra will be used for the unsolicited event
- * buffers (though on machines with 8KB pages we will to allocate
- * them separately since there will be nothing left overs.)
- */
-#if defined(PDQ_OS_MEMALLOC_CONTIG)
- p = (pdq_uint8_t *) PDQ_OS_MEMALLOC_CONTIG(contig_bytes);
-
- if (p == NULL)
- printf("%s() - PDQ_OS_MEMALLOC_CONTIG() failed!\n", __func__);
-
- if (p != NULL) {
- pdq_physaddr_t physaddr = PDQ_OS_VA_TO_BUSPA(pdq, 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_BUSPA(pdq, p + idx) - physaddr != idx)
- goto cleanup_and_return;
- }
- if (physaddr & 0x1FFF) {
- pdq->pdq_unsolicited_info.ui_events = (pdq_unsolicited_event_t *) p;
- pdq->pdq_unsolicited_info.ui_pa_bufstart = physaddr;
- pdq->pdq_dbp = (pdq_descriptor_block_t *) &p[0x2000 - (physaddr & 0x1FFF)];
- pdq->pdq_pa_descriptor_block = physaddr & ~0x1FFFUL;
- } else {
- pdq->pdq_dbp = (pdq_descriptor_block_t *) p;
- pdq->pdq_pa_descriptor_block = physaddr;
- pdq->pdq_unsolicited_info.ui_events = (pdq_unsolicited_event_t *) &p[0x2000];
- pdq->pdq_unsolicited_info.ui_pa_bufstart = physaddr + 0x2000;
- }
- }
- pdq->pdq_cbp = (volatile pdq_consumer_block_t *) &pdq->pdq_dbp->pdqdb_consumer;
- pdq->pdq_pa_consumer_block = PDQ_DB_BUSPA(pdq, pdq->pdq_cbp);
- if (contig_bytes == sizeof(pdq_descriptor_block_t)) {
- pdq->pdq_unsolicited_info.ui_events =
- (pdq_unsolicited_event_t *) PDQ_OS_MEMALLOC(
- PDQ_NUM_UNSOLICITED_EVENTS * sizeof(pdq_unsolicited_event_t));
- }
-#else
- if (pdq_os_memalloc_contig(pdq))
- goto cleanup_and_return;
-#endif
-
- /*
- * Make sure everything got allocated. If not, free what did
- * get allocated and return.
- */
- if (pdq->pdq_dbp == NULL || pdq->pdq_unsolicited_info.ui_events == NULL) {
- cleanup_and_return:
-#ifdef PDQ_OS_MEMFREE_CONTIG
- 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));
-#endif
- PDQ_OS_MEMFREE(pdq, sizeof(pdq_t));
- return NULL;
- }
- dbp = pdq->pdq_dbp;
-
- PDQ_PRINTF(("\nPDQ Descriptor Block = " PDQ_OS_PTR_FMT " (PA = 0x%x)\n", dbp, pdq->pdq_pa_descriptor_block));
- PDQ_PRINTF((" Receive Queue = " PDQ_OS_PTR_FMT "\n", dbp->pdqdb_receives));
- PDQ_PRINTF((" Transmit Queue = " PDQ_OS_PTR_FMT "\n", dbp->pdqdb_transmits));
- PDQ_PRINTF((" Host SMT Queue = " PDQ_OS_PTR_FMT "\n", dbp->pdqdb_host_smt));
- PDQ_PRINTF((" Command Response Queue = " PDQ_OS_PTR_FMT "\n", dbp->pdqdb_command_responses));
- PDQ_PRINTF((" Command Request Queue = " PDQ_OS_PTR_FMT "\n", dbp->pdqdb_command_requests));
- PDQ_PRINTF(("PDQ Consumer Block = " PDQ_OS_PTR_FMT "\n", pdq->pdq_cbp));
-
- /*
- * Zero out the descriptor block. Not really required but
- * it pays to be neat. This will also zero out the consumer
- * block, command pool, and buffer pointers for the receive
- * host_smt rings.
- */
- PDQ_OS_MEMZERO(dbp, sizeof(*dbp));
-
- /*
- * Initialize the CSR references.
- * the DEFAA (FutureBus+) skips a longword between registers
- */
- pdq_init_csrs(&pdq->pdq_csrs, bus, csr_base, 1);
- pdq_init_pci_csrs(&pdq->pdq_pci_csrs, bus, csr_base, 1);
-
- PDQ_PRINTF(("PDQ CSRs: BASE = " PDQ_OS_CSR_FMT "\n", pdq->pdq_csrs.csr_base));
- PDQ_PRINTF((" Port Reset = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_port_reset, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_reset)));
- PDQ_PRINTF((" Host Data = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_host_data, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_data)));
- PDQ_PRINTF((" Port Control = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_port_control, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_control)));
- PDQ_PRINTF((" Port Data A = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_port_data_a, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_data_a)));
- PDQ_PRINTF((" Port Data B = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_port_data_b, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_data_b)));
- PDQ_PRINTF((" Port Status = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_port_status, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_status)));
- PDQ_PRINTF((" Host Int Type 0 = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_host_int_type_0, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_int_type_0)));
- PDQ_PRINTF((" Host Int Enable = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_host_int_enable, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_int_enable)));
- PDQ_PRINTF((" Type 2 Producer = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_type_2_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_type_2_producer)));
- PDQ_PRINTF((" Command Response Producer = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_cmd_response_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_cmd_response_producer)));
- PDQ_PRINTF((" Command Request Producer = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_cmd_request_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_cmd_request_producer)));
- PDQ_PRINTF((" Host SMT Producer = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_host_smt_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_smt_producer)));
- PDQ_PRINTF((" Unsolicited Producer = " PDQ_OS_CSR_FMT " [0x%08x]\n",
- pdq->pdq_csrs.csr_unsolicited_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_unsolicited_producer)));
-
- /*
- * Initialize the command information block
- */
- pdq->pdq_command_info.ci_request_bufstart = dbp->pdqdb_cmd_request_buf;
- pdq->pdq_command_info.ci_pa_request_bufstart = PDQ_DB_BUSPA(pdq, pdq->pdq_command_info.ci_request_bufstart);
- pdq->pdq_command_info.ci_pa_request_descriptors = PDQ_DB_BUSPA(pdq, dbp->pdqdb_command_requests);
- PDQ_PRINTF(("PDQ Command Request Buffer = " PDQ_OS_PTR_FMT " (PA=0x%x)\n",
- pdq->pdq_command_info.ci_request_bufstart,
- pdq->pdq_command_info.ci_pa_request_bufstart));
- for (idx = 0; idx < sizeof(dbp->pdqdb_command_requests)/sizeof(dbp->pdqdb_command_requests[0]); idx++) {
- pdq_txdesc_t *txd = &dbp->pdqdb_command_requests[idx];
-
- txd->txd_pa_lo = pdq->pdq_command_info.ci_pa_request_bufstart;
- txd->txd_eop = txd->txd_sop = 1;
- txd->txd_pa_hi = 0;
- }
- PDQ_OS_DESC_PRESYNC(pdq, dbp->pdqdb_command_requests,
- sizeof(dbp->pdqdb_command_requests));
-
- pdq->pdq_command_info.ci_response_bufstart = dbp->pdqdb_cmd_response_buf;
- pdq->pdq_command_info.ci_pa_response_bufstart = PDQ_DB_BUSPA(pdq, pdq->pdq_command_info.ci_response_bufstart);
- pdq->pdq_command_info.ci_pa_response_descriptors = PDQ_DB_BUSPA(pdq, dbp->pdqdb_command_responses);
- PDQ_PRINTF(("PDQ Command Response Buffer = " PDQ_OS_PTR_FMT " (PA=0x%x)\n",
- pdq->pdq_command_info.ci_response_bufstart,
- pdq->pdq_command_info.ci_pa_response_bufstart));
- for (idx = 0; idx < sizeof(dbp->pdqdb_command_responses)/sizeof(dbp->pdqdb_command_responses[0]); idx++) {
- pdq_rxdesc_t *rxd = &dbp->pdqdb_command_responses[idx];
-
- rxd->rxd_pa_lo = pdq->pdq_command_info.ci_pa_response_bufstart;
- rxd->rxd_sop = 1;
- rxd->rxd_seg_cnt = 0;
- rxd->rxd_seg_len_lo = 0;
- rxd->rxd_seg_len_hi = PDQ_SIZE_COMMAND_RESPONSE / 16;
- }
- PDQ_OS_DESC_PRESYNC(pdq, dbp->pdqdb_command_responses,
- sizeof(dbp->pdqdb_command_responses));
-
- /*
- * Initialize the unsolicited event information block
- */
- pdq->pdq_unsolicited_info.ui_free = PDQ_NUM_UNSOLICITED_EVENTS;
- pdq->pdq_unsolicited_info.ui_pa_descriptors = PDQ_DB_BUSPA(pdq, dbp->pdqdb_unsolicited_events);
- PDQ_PRINTF(("PDQ Unsolicit Event Buffer = " PDQ_OS_PTR_FMT " (PA=0x%x)\n",
- pdq->pdq_unsolicited_info.ui_events,
- pdq->pdq_unsolicited_info.ui_pa_bufstart));
- for (idx = 0; idx < sizeof(dbp->pdqdb_unsolicited_events)/sizeof(dbp->pdqdb_unsolicited_events[0]); idx++) {
- pdq_rxdesc_t *rxd = &dbp->pdqdb_unsolicited_events[idx];
- pdq_unsolicited_event_t *event = &pdq->pdq_unsolicited_info.ui_events[idx & (PDQ_NUM_UNSOLICITED_EVENTS-1)];
-
- rxd->rxd_sop = 1;
- rxd->rxd_seg_cnt = 0;
- rxd->rxd_seg_len_hi = sizeof(pdq_unsolicited_event_t) / 16;
- rxd->rxd_pa_lo = pdq->pdq_unsolicited_info.ui_pa_bufstart + (const pdq_uint8_t *) event
- - (const pdq_uint8_t *) pdq->pdq_unsolicited_info.ui_events;
- rxd->rxd_pa_hi = 0;
- PDQ_OS_UNSOL_EVENT_PRESYNC(pdq, event);
- }
- PDQ_OS_DESC_PRESYNC(pdq, dbp->pdqdb_unsolicited_events,
- sizeof(dbp->pdqdb_unsolicited_events));
-
- /*
- * Initialize the receive information blocks (normal and SMT).
- */
- pdq->pdq_rx_info.rx_buffers = pdq->pdq_receive_buffers;
- pdq->pdq_rx_info.rx_free = PDQ_RING_MASK(dbp->pdqdb_receives);
- pdq->pdq_rx_info.rx_target = pdq->pdq_rx_info.rx_free - PDQ_RX_SEGCNT * 8;
- pdq->pdq_rx_info.rx_pa_descriptors = PDQ_DB_BUSPA(pdq, dbp->pdqdb_receives);
-
- pdq->pdq_host_smt_info.rx_buffers = pdq->pdq_host_smt_buffers;
- pdq->pdq_host_smt_info.rx_free = PDQ_RING_MASK(dbp->pdqdb_host_smt);
- pdq->pdq_host_smt_info.rx_target = pdq->pdq_host_smt_info.rx_free - PDQ_RX_SEGCNT * 3;
- pdq->pdq_host_smt_info.rx_pa_descriptors = PDQ_DB_BUSPA(pdq, dbp->pdqdb_host_smt);
-
- /*
- * Initialize the transmit information block.
- */
- dbp->pdqdb_tx_hdr[0] = PDQ_FDDI_PH0;
- dbp->pdqdb_tx_hdr[1] = PDQ_FDDI_PH1;
- dbp->pdqdb_tx_hdr[2] = PDQ_FDDI_PH2;
- pdq->pdq_tx_info.tx_free = PDQ_RING_MASK(dbp->pdqdb_transmits);
- pdq->pdq_tx_info.tx_hdrdesc.txd_seg_len = 3;
- pdq->pdq_tx_info.tx_hdrdesc.txd_sop = 1;
- pdq->pdq_tx_info.tx_hdrdesc.txd_pa_lo = PDQ_DB_BUSPA(pdq, dbp->pdqdb_tx_hdr);
- pdq->pdq_tx_info.tx_pa_descriptors = PDQ_DB_BUSPA(pdq, dbp->pdqdb_transmits);
-
- state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_status));
- PDQ_PRINTF(("PDQ Adapter State = %s\n", pdq_adapter_states[state]));
-
- /*
- * Stop the PDQ if it is running and put it into a known state.
- */
- state = pdq_stop(pdq);
-
- PDQ_PRINTF(("PDQ Adapter State = %s\n", pdq_adapter_states[state]));
- PDQ_ASSERT(state == PDQS_DMA_AVAILABLE);
- /*
- * If the adapter is not the state we expect, then the initialization
- * failed. Cleanup and exit.
- */
-#if defined(PDQVERBOSE)
- if (state == PDQS_HALTED) {
- pdq_halt_code_t halt_code = PDQ_PSTS_HALT_ID(PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_status));
- printf("Halt code = %d (%s)\n", halt_code, pdq_halt_codes[halt_code]);
- if (halt_code == PDQH_DMA_ERROR)
- PDQ_PRINTF(("PFI status = 0x%x, Host 0 Fatal Interrupt = 0x%x\n",
- PDQ_CSR_READ(&pdq->pdq_pci_csrs, csr_pfi_status),
- PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_int_type_0) & PDQ_HOST_INT_FATAL_ERROR));
- }
-#endif
- if (state == PDQS_RESET || state == PDQS_HALTED || state == PDQS_UPGRADE)
- goto cleanup_and_return;
-
- PDQ_PRINTF(("PDQ Hardware Address = %02x-%02x-%02x-%02x-%02x-%02x\n",
- pdq->pdq_hwaddr.lanaddr_bytes[0], pdq->pdq_hwaddr.lanaddr_bytes[1],
- pdq->pdq_hwaddr.lanaddr_bytes[2], pdq->pdq_hwaddr.lanaddr_bytes[3],
- pdq->pdq_hwaddr.lanaddr_bytes[4], pdq->pdq_hwaddr.lanaddr_bytes[5]));
- PDQ_PRINTF(("PDQ Firmware Revision = %c%c%c%c\n",
- pdq->pdq_fwrev.fwrev_bytes[0], pdq->pdq_fwrev.fwrev_bytes[1],
- pdq->pdq_fwrev.fwrev_bytes[2], pdq->pdq_fwrev.fwrev_bytes[3]));
- PDQ_PRINTF(("PDQ Chip Revision = "));
- switch (pdq->pdq_chip_rev) {
- case PDQ_CHIP_REV_A_B_OR_C: PDQ_PRINTF(("Rev C or below")); break;
- case PDQ_CHIP_REV_D: PDQ_PRINTF(("Rev D")); break;
- case PDQ_CHIP_REV_E: PDQ_PRINTF(("Rev E")); break;
- default: PDQ_PRINTF(("Unknown Rev %d", (int) pdq->pdq_chip_rev));
- }
- PDQ_PRINTF(("\n"));
-
- return pdq;
-}
Index: sys/dev/pdq/pdq_freebsd.h
===================================================================
--- sys/dev/pdq/pdq_freebsd.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/* $NetBSD: pdqvar.h,v 1.27 2000/05/03 19:17:54 thorpej Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Id: pdqvar.h,v 1.21 1997/03/21 21:16:04 thomas Exp
- * $FreeBSD$
- *
- */
-
-/*
- * DEC PDQ FDDI Controller; PDQ O/S dependent definitions
- *
- * Written by Matt Thomas
- *
- */
-
-#if defined(PDQ_HWSUPPORT)
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_arp.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/fddi.h>
-
-#include <net/bpf.h>
-
-#include <vm/vm.h> /* for vtophys */
-#include <vm/pmap.h> /* for vtophys */
-
-#endif /* PDQ_HWSUPPORT */
-
-typedef struct _pdq_t pdq_t;
-typedef struct _pdq_csrs_t pdq_csrs_t;
-typedef struct _pdq_pci_csrs_t pdq_pci_csrs_t;
-typedef struct _pdq_lanaddr_t pdq_lanaddr_t;
-typedef unsigned int pdq_uint32_t;
-typedef unsigned short pdq_uint16_t;
-typedef unsigned char pdq_uint8_t;
-typedef enum _pdq_boolean_t pdq_boolean_t;
-typedef enum _pdq_type_t pdq_type_t;
-typedef enum _pdq_state_t pdq_state_t;
-typedef struct mbuf PDQ_OS_DATABUF_T;
-
-typedef bus_space_tag_t pdq_bus_t;
-typedef bus_space_handle_t pdq_bus_memaddr_t;
-typedef pdq_bus_memaddr_t pdq_bus_memoffset_t;
-
-extern devclass_t pdq_devclass;
-
-enum _pdq_type_t {
- PDQ_DEFPA, /* PCI-bus */
-};
-
-#define sc_ifmedia ifmedia
-#if 0 /* ALTQ */
-#define IFQ_DEQUEUE IF_DEQUEUE
-#define IFQ_IS_EMPTY(q) ((q)->ifq_len == 0)
-#endif
-
-typedef struct _pdq_os_ctx_t {
- struct ifnet *ifp;
- struct ifmedia ifmedia;
- device_t dev;
- int debug;
-
- pdq_t * sc_pdq;
- int sc_flags;
-#define PDQIF_DOWNCALL 0x0001 /* active calling from if to pdq */
-
- struct resource * io;
- int io_rid;
- int io_type;
- bus_space_handle_t io_bsh;
- bus_space_tag_t io_bst;
-
- struct resource * mem;
- int mem_rid;
- int mem_type;
- bus_space_handle_t mem_bsh;
- bus_space_tag_t mem_bst;
-
- struct resource * irq;
- int irq_rid;
- void * irq_ih;
-
- struct mtx mtx;
- struct callout watchdog;
- int timer;
-} pdq_softc_t;
-
-#define PDQ_LOCK(_sc) mtx_lock(&(_sc)->mtx)
-#define PDQ_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx)
-#define PDQ_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
-
-#define PDQ_OS_HDR_OFFSET PDQ_RX_FC_OFFSET
-
-#define PDQ_OS_PAGESIZE PAGE_SIZE
-#define PDQ_OS_TX_TRANSMIT 5
-
-#define PDQ_OS_IORD_32(bt, bh, off) bus_space_read_4(bt, bh, off)
-#define PDQ_OS_IOWR_32(bt, bh, off, data) bus_space_write_4(bt, bh, off, data)
-#define PDQ_OS_IORD_8(bt, bh, off) bus_space_read_1(bt, bh, off)
-#define PDQ_OS_IOWR_8(bt, bh, off, data) bus_space_write_1(bt, bh, off, data)
-
-#define PDQ_CSR_OFFSET(base, offset) (0 + (offset)*sizeof(pdq_uint32_t))
-#define PDQ_CSR_WRITE(csr, name, data) PDQ_OS_IOWR_32((csr)->csr_bus, (csr)->csr_base, (csr)->name, data)
-#define PDQ_CSR_READ(csr, name) PDQ_OS_IORD_32((csr)->csr_bus, (csr)->csr_base, (csr)->name)
-
-#define PDQ_OS_DATABUF_FREE(pdq, b) (m_freem(b))
-
-#if defined(PDQ_OSSUPPORT)
-#define PDQ_OS_TX_TIMEOUT 5 /* seconds */
-
-#define PDQ_OS_IFP_TO_SOFTC(ifp) ((pdq_softc_t *) (ifp)->if_softc)
-#define PDQ_BPF_MTAP(sc, m) BPF_MTAP((sc)->ifp, m)
-#define PDQ_IFNET(sc) ((sc)->ifp)
-
-#endif /* PDQ_OSSUPPORT */
-
-#if defined(PDQ_HWSUPPORT)
-
-#define PDQ_OS_PREFIX "%s: "
-#define PDQ_OS_PREFIX_ARGS pdq->pdq_os_name
-
-#define PDQ_OS_PTR_FMT "%p"
-#define PDQ_OS_CSR_FMT "0x%x"
-
-#define PDQ_OS_USEC_DELAY(n) DELAY(n)
-#define PDQ_OS_VA_TO_BUSPA(pdq, p) vtophys(p)
-
-#define PDQ_OS_MEMALLOC(n) malloc(n, M_DEVBUF, M_NOWAIT)
-#define PDQ_OS_MEMFREE(p, n) free((void *) p, M_DEVBUF)
-#define PDQ_OS_MEMZERO(p, n) bzero((caddr_t)(p), (n))
-#define PDQ_OS_MEMALLOC_CONTIG(n) contigmalloc(n, M_DEVBUF, M_NOWAIT, 0x800000, ~0, PAGE_SIZE, 0)
-#define PDQ_OS_MEMFREE_CONTIG(p, n) contigfree(p, n, M_DEVBUF)
-
-#define PDQ_OS_DATABUF_SIZE (MCLBYTES)
-#define PDQ_OS_DATABUF_NEXT(b) ((b)->m_next)
-#define PDQ_OS_DATABUF_NEXT_SET(b, b1) ((b)->m_next = (b1))
-#define PDQ_OS_DATABUF_NEXTPKT(b) ((b)->m_nextpkt)
-#define PDQ_OS_DATABUF_NEXTPKT_SET(b, b1) ((b)->m_nextpkt = (b1))
-#define PDQ_OS_DATABUF_LEN(b) ((b)->m_len)
-#define PDQ_OS_DATABUF_LEN_SET(b, n) ((b)->m_len = (n))
-/* #define PDQ_OS_DATABUF_LEN_ADJ(b, n) ((b)->m_len += (n)) */
-#define PDQ_OS_DATABUF_PTR(b) (mtod((b), pdq_uint8_t *))
-#define PDQ_OS_DATABUF_ADJ(b, n) ((b)->m_data += (n), (b)->m_len -= (n))
-
-#define PDQ_OS_DATABUF_ALLOC(pdq, b) do { \
- PDQ_OS_DATABUF_T *x_m0; \
- MGETHDR(x_m0, M_NOWAIT, MT_DATA); \
- if (x_m0 != NULL) { \
- if (!(MCLGET(x_m0, M_NOWAIT))) { \
- m_free(x_m0); \
- (b) = NULL; \
- } else { \
- (b) = x_m0; \
- x_m0->m_len = PDQ_OS_DATABUF_SIZE; \
- } \
- } else { \
- (b) = NULL; \
- } \
-} while (0)
-
-#define PDQ_OS_DATABUF_RESET(b) ((b)->m_data = (b)->m_ext.ext_buf, (b)->m_len = MCLBYTES)
-
-#define PDQ_OS_DATABUF_ENQUEUE(q, b) do { \
- PDQ_OS_DATABUF_NEXTPKT_SET(b, NULL); \
- if ((q)->q_tail == NULL) \
- (q)->q_head = (b); \
- else \
- PDQ_OS_DATABUF_NEXTPKT_SET(((PDQ_OS_DATABUF_T *)(q)->q_tail), b); \
- (q)->q_tail = (b); \
-} while (0)
-
-#define PDQ_OS_DATABUF_DEQUEUE(q, b) do { \
- if (((b) = (PDQ_OS_DATABUF_T *) (q)->q_head) != NULL) { \
- if (((q)->q_head = PDQ_OS_DATABUF_NEXTPKT(b)) == NULL) \
- (q)->q_tail = NULL; \
- PDQ_OS_DATABUF_NEXTPKT_SET(b, NULL); \
- } \
-} while (0)
-
-#define PDQ_OS_DATABUF_BUSPA(pdq, b) PDQ_OS_VA_TO_BUSPA(pdq, PDQ_OS_DATABUF_PTR(b))
-
-#define PDQ_OS_CONSUMER_PRESYNC(pdq) do { } while(0)
-#define PDQ_OS_CONSUMER_POSTSYNC(pdq) do { } while(0)
-#define PDQ_OS_DESC_PRESYNC(pdq, d, s) do { } while(0)
-#define PDQ_OS_DESC_POSTSYNC(pdq, d, s) do { } while(0)
-#define PDQ_OS_CMDRQST_PRESYNC(pdq, s) do { } while(0)
-#define PDQ_OS_CMDRQST_POSTSYNC(pdq, s) do { } while(0)
-#define PDQ_OS_CMDRSP_PRESYNC(pdq, s) do { } while(0)
-#define PDQ_OS_CMDRSP_POSTSYNC(pdq, s) do { } while(0)
-#define PDQ_OS_RXPDU_PRESYNC(pdq, b, o, l) do { } while(0)
-#define PDQ_OS_RXPDU_POSTSYNC(pdq, b, o, l) do { } while(0)
-#define PDQ_OS_UNSOL_EVENT_PRESYNC(pdq, e) do { } while(0)
-#define PDQ_OS_UNSOL_EVENT_POSTSYNC(pdq, e) do { } while(0)
-
-#endif /* PDQ_HWSUPPORT */
-
-/*
- * OS dependent functions provided by pdq_ifsubr.c to pdq.c
- */
-void pdq_os_addr_fill (pdq_t *pdq, pdq_lanaddr_t *addrs, size_t numaddrs);
-void pdq_os_receive_pdu (pdq_t *, PDQ_OS_DATABUF_T *, size_t, int);
-void pdq_os_restart_transmitter (pdq_t *pdq);
-void pdq_os_transmit_done (pdq_t *, PDQ_OS_DATABUF_T *);
-void pdq_os_update_status (pdq_t *, const void *);
-
-/*
- * Driver interfaces functions provided by pdq.c to pdq_ifsubr.c
- */
-pdq_boolean_t pdq_queue_transmit_data (pdq_t *pdq, PDQ_OS_DATABUF_T *pdu);
-void pdq_run (pdq_t *pdq);
-pdq_state_t pdq_stop (pdq_t *pdq);
-
-/*
- * OS dependent functions provided by
- * pdq_ifsubr.c or pdq.c to the bus front ends
- */
-int pdq_ifattach (pdq_softc_t *, const pdq_uint8_t *,
- pdq_type_t type);
-void pdq_ifdetach (pdq_softc_t *);
-void pdq_free (device_t);
-int pdq_interrupt (pdq_t *pdq);
-void pdq_hwreset (pdq_t *pdq);
-pdq_t * pdq_initialize (pdq_bus_t bus, pdq_bus_memaddr_t csr_va,
- const char *name, int unit,
- void *ctx, pdq_type_t type);
-/*
- * Misc prototypes.
- */
-void pdq_flush_transmitter(pdq_t *pdq);
Index: sys/dev/pdq/pdq_ifsubr.c
===================================================================
--- sys/dev/pdq/pdq_ifsubr.c
+++ /dev/null
@@ -1,779 +0,0 @@
-/* $NetBSD: pdq_ifsubr.c,v 1.38 2001/12/21 23:21:47 matt Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- *
- * $NetBSD: pdq_ifsubr.c,v 1.12 1997/06/05 01:56:35 thomas Exp$
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * DEC PDQ FDDI Controller; code for BSD derived operating systems
- *
- * This module provide bus independent BSD specific O/S functions.
- * (ie. it provides an ifnet interface to the rest of the system)
- */
-
-
-#define PDQ_OSSUPPORT
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_arp.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/fddi.h>
-
-#include <net/bpf.h>
-
-#include <dev/pdq/pdq_freebsd.h>
-#include <dev/pdq/pdqreg.h>
-
-devclass_t pdq_devclass;
-
-static void pdq_watchdog(void *);
-
-static void
-pdq_ifstop(pdq_softc_t *sc)
-{
-
- PDQ_IFNET(sc)->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
- sc->sc_pdq->pdq_flags &= ~PDQ_RUNNING;
- pdq_stop(sc->sc_pdq);
- callout_stop(&sc->watchdog);
-}
-
-static void
-pdq_ifinit_locked(pdq_softc_t *sc)
-{
-
- PDQ_LOCK_ASSERT(sc);
- if (PDQ_IFNET(sc)->if_flags & IFF_UP) {
- PDQ_IFNET(sc)->if_drv_flags |= IFF_DRV_RUNNING;
- if (PDQ_IFNET(sc)->if_flags & IFF_PROMISC) {
- sc->sc_pdq->pdq_flags |= PDQ_PROMISC;
- } else {
- sc->sc_pdq->pdq_flags &= ~PDQ_PROMISC;
- }
- if (PDQ_IFNET(sc)->if_flags & IFF_LINK1) {
- sc->sc_pdq->pdq_flags |= PDQ_PASS_SMT;
- } else {
- sc->sc_pdq->pdq_flags &= ~PDQ_PASS_SMT;
- }
- sc->sc_pdq->pdq_flags |= PDQ_RUNNING;
- pdq_run(sc->sc_pdq);
- callout_reset(&sc->watchdog, hz, pdq_watchdog, sc);
- } else
- pdq_ifstop(sc);
-}
-
-static void
-pdq_ifinit(void *arg)
-{
- pdq_softc_t *sc;
-
- sc = arg;
- PDQ_LOCK(sc);
- pdq_ifinit_locked(sc);
- PDQ_UNLOCK(sc);
-}
-
-static void
-pdq_watchdog(void *arg)
-{
- pdq_softc_t *sc;
- struct ifnet *ifp;
-
- sc = arg;
- PDQ_LOCK_ASSERT(sc);
- callout_reset(&sc->watchdog, hz, pdq_watchdog, sc);
- if (sc->timer == 0 || --sc->timer > 0)
- return;
-
- /*
- * No progress was made on the transmit queue for PDQ_OS_TX_TRANSMIT
- * seconds. Remove all queued packets.
- */
- ifp = PDQ_IFNET(sc);
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- for (;;) {
- struct mbuf *m;
- IFQ_DEQUEUE(&ifp->if_snd, m);
- if (m == NULL)
- return;
- PDQ_OS_DATABUF_FREE(PDQ_OS_IFP_TO_SOFTC(ifp)->sc_pdq, m);
- }
-}
-
-static void
-pdq_ifstart_locked(struct ifnet *ifp)
-{
- pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
- struct mbuf *m;
- int tx = 0;
-
- PDQ_LOCK_ASSERT(sc);
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
- return;
-
- if (sc->timer == 0)
- sc->timer = PDQ_OS_TX_TIMEOUT;
-
- if ((sc->sc_pdq->pdq_flags & PDQ_TXOK) == 0) {
- PDQ_IFNET(sc)->if_drv_flags |= IFF_DRV_OACTIVE;
- return;
- }
- sc->sc_flags |= PDQIF_DOWNCALL;
- for (;; tx = 1) {
- IF_DEQUEUE(&ifp->if_snd, m);
- if (m == NULL)
- break;
-#if defined(PDQ_BUS_DMA) && !defined(PDQ_BUS_DMA_NOTX)
- if ((m->m_flags & M_HASTXDMAMAP) == 0) {
- bus_dmamap_t map;
- if (PDQ_OS_HDR_OFFSET != PDQ_RX_FC_OFFSET) {
- m->m_data[0] = PDQ_FDDI_PH0;
- m->m_data[1] = PDQ_FDDI_PH1;
- m->m_data[2] = PDQ_FDDI_PH2;
- }
- if (!bus_dmamap_create(sc->sc_dmatag, m->m_pkthdr.len, 255,
- m->m_pkthdr.len, 0, BUS_DMA_NOWAIT, &map)) {
- if (!bus_dmamap_load_mbuf(sc->sc_dmatag, map, m,
- BUS_DMA_WRITE|BUS_DMA_NOWAIT)) {
- bus_dmamap_sync(sc->sc_dmatag, map, 0, m->m_pkthdr.len,
- BUS_DMASYNC_PREWRITE);
- M_SETCTX(m, map);
- m->m_flags |= M_HASTXDMAMAP;
- }
- }
- if ((m->m_flags & M_HASTXDMAMAP) == 0)
- break;
- }
-#else
- if (PDQ_OS_HDR_OFFSET != PDQ_RX_FC_OFFSET) {
- m->m_data[0] = PDQ_FDDI_PH0;
- m->m_data[1] = PDQ_FDDI_PH1;
- m->m_data[2] = PDQ_FDDI_PH2;
- }
-#endif
-
- if (pdq_queue_transmit_data(sc->sc_pdq, m) == PDQ_FALSE)
- break;
- }
- if (m != NULL) {
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- IF_PREPEND(&ifp->if_snd, m);
- }
- if (tx)
- PDQ_DO_TYPE2_PRODUCER(sc->sc_pdq);
- sc->sc_flags &= ~PDQIF_DOWNCALL;
-}
-
-static void
-pdq_ifstart(struct ifnet *ifp)
-{
- pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
-
- PDQ_LOCK(sc);
- pdq_ifstart_locked(ifp);
- PDQ_UNLOCK(sc);
-}
-
-void
-pdq_os_receive_pdu(
- pdq_t *pdq,
- struct mbuf *m,
- size_t pktlen,
- int drop)
-{
- pdq_softc_t *sc = pdq->pdq_os_ctx;
- struct ifnet *ifp = PDQ_IFNET(sc);
- struct fddi_header *fh;
-
- if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
-#if defined(PDQ_BUS_DMA)
- {
- /*
- * Even though the first mbuf start at the first fddi header octet,
- * the dmamap starts PDQ_OS_HDR_OFFSET octets earlier. Any additional
- * mbufs will start normally.
- */
- int offset = PDQ_OS_HDR_OFFSET;
- struct mbuf *m0;
- for (m0 = m; m0 != NULL; m0 = m0->m_next, offset = 0) {
- pdq_os_databuf_sync(sc, m0, offset, m0->m_len, BUS_DMASYNC_POSTREAD);
- bus_dmamap_unload(sc->sc_dmatag, M_GETCTX(m0, bus_dmamap_t));
- bus_dmamap_destroy(sc->sc_dmatag, M_GETCTX(m0, bus_dmamap_t));
- m0->m_flags &= ~M_HASRXDMAMAP;
- M_SETCTX(m0, NULL);
- }
- }
-#endif
- m->m_pkthdr.len = pktlen;
- fh = mtod(m, struct fddi_header *);
- if (drop || (fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC) {
- if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- PDQ_OS_DATABUF_FREE(pdq, m);
- return;
- }
-
- m->m_pkthdr.rcvif = ifp;
- PDQ_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
- PDQ_LOCK(sc);
-}
-
-void
-pdq_os_restart_transmitter(
- pdq_t *pdq)
-{
- pdq_softc_t *sc = pdq->pdq_os_ctx;
- PDQ_IFNET(sc)->if_drv_flags &= ~IFF_DRV_OACTIVE;
- if (IFQ_IS_EMPTY(&PDQ_IFNET(sc)->if_snd) == 0) {
- sc->timer = PDQ_OS_TX_TIMEOUT;
- if ((sc->sc_flags & PDQIF_DOWNCALL) == 0)
- pdq_ifstart_locked(PDQ_IFNET(sc));
- } else {
- sc->timer = 0;
- }
-}
-
-void
-pdq_os_transmit_done(
- pdq_t *pdq,
- struct mbuf *m)
-{
- pdq_softc_t *sc = pdq->pdq_os_ctx;
-#if defined(NBPFILTER) && NBPFILTER > 0
- if (PQD_IFNET(sc)->if_bpf != NULL)
- PDQ_BPF_MTAP(sc, m);
-#endif
- PDQ_OS_DATABUF_FREE(pdq, m);
- if_inc_counter(PDQ_IFNET(sc), IFCOUNTER_OPACKETS, 1);
-}
-
-void
-pdq_os_addr_fill(
- pdq_t *pdq,
- pdq_lanaddr_t *addr,
- size_t num_addrs)
-{
- pdq_softc_t *sc = pdq->pdq_os_ctx;
- struct ifnet *ifp;
- struct ifmultiaddr *ifma;
-
- ifp = sc->ifp;
-
- /*
- * ADDR_FILTER_SET is always issued before FILTER_SET so
- * we can play with PDQ_ALLMULTI and not worry about
- * queueing a FILTER_SET ourselves.
- */
-
- pdq->pdq_flags &= ~PDQ_ALLMULTI;
-#if defined(IFF_ALLMULTI)
- PDQ_IFNET(sc)->if_flags &= ~IFF_ALLMULTI;
-#endif
-
- if_maddr_rlock(PDQ_IFNET(sc));
- for (ifma = TAILQ_FIRST(&PDQ_IFNET(sc)->if_multiaddrs); ifma && num_addrs > 0;
- ifma = TAILQ_NEXT(ifma, ifma_link)) {
- char *mcaddr;
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- mcaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
- ((u_short *) addr->lanaddr_bytes)[0] = ((u_short *) mcaddr)[0];
- ((u_short *) addr->lanaddr_bytes)[1] = ((u_short *) mcaddr)[1];
- ((u_short *) addr->lanaddr_bytes)[2] = ((u_short *) mcaddr)[2];
- addr++;
- num_addrs--;
- }
- if_maddr_runlock(PDQ_IFNET(sc));
- /*
- * If not all the address fit into the CAM, turn on all-multicast mode.
- */
- if (ifma != NULL) {
- pdq->pdq_flags |= PDQ_ALLMULTI;
-#if defined(IFF_ALLMULTI)
- PDQ_IFNET(sc)->if_flags |= IFF_ALLMULTI;
-#endif
- }
-}
-
-#if defined(IFM_FDDI)
-static int
-pdq_ifmedia_change(
- struct ifnet *ifp)
-{
- pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
-
- PDQ_LOCK(sc);
- if (sc->sc_ifmedia.ifm_media & IFM_FDX) {
- if ((sc->sc_pdq->pdq_flags & PDQ_WANT_FDX) == 0) {
- sc->sc_pdq->pdq_flags |= PDQ_WANT_FDX;
- if (sc->sc_pdq->pdq_flags & PDQ_RUNNING)
- pdq_run(sc->sc_pdq);
- }
- } else if (sc->sc_pdq->pdq_flags & PDQ_WANT_FDX) {
- sc->sc_pdq->pdq_flags &= ~PDQ_WANT_FDX;
- if (sc->sc_pdq->pdq_flags & PDQ_RUNNING)
- pdq_run(sc->sc_pdq);
- }
- PDQ_UNLOCK(sc);
-
- return 0;
-}
-
-static void
-pdq_ifmedia_status(
- struct ifnet *ifp,
- struct ifmediareq *ifmr)
-{
- pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
-
- PDQ_LOCK(sc);
- ifmr->ifm_status = IFM_AVALID;
- if (sc->sc_pdq->pdq_flags & PDQ_IS_ONRING)
- ifmr->ifm_status |= IFM_ACTIVE;
-
- ifmr->ifm_active = (ifmr->ifm_current & ~IFM_FDX);
- if (sc->sc_pdq->pdq_flags & PDQ_IS_FDX)
- ifmr->ifm_active |= IFM_FDX;
- PDQ_UNLOCK(sc);
-}
-
-void
-pdq_os_update_status(
- pdq_t *pdq,
- const void *arg)
-{
- pdq_softc_t * const sc = pdq->pdq_os_ctx;
- const pdq_response_status_chars_get_t *rsp = arg;
- int media = 0;
-
- switch (rsp->status_chars_get.pmd_type[0]) {
- case PDQ_PMD_TYPE_ANSI_MUTLI_MODE: media = IFM_FDDI_MMF; break;
- case PDQ_PMD_TYPE_ANSI_SINGLE_MODE_TYPE_1: media = IFM_FDDI_SMF; break;
- case PDQ_PMD_TYPE_ANSI_SIGNLE_MODE_TYPE_2: media = IFM_FDDI_SMF; break;
- case PDQ_PMD_TYPE_UNSHIELDED_TWISTED_PAIR: media = IFM_FDDI_UTP; break;
- default: media |= IFM_MANUAL;
- }
-
- if (rsp->status_chars_get.station_type == PDQ_STATION_TYPE_DAS)
- media |= IFM_FDDI_DA;
-
- sc->sc_ifmedia.ifm_media = media | IFM_FDDI;
-}
-#endif /* defined(IFM_FDDI) */
-
-static int
-pdq_ifioctl(
- struct ifnet *ifp,
- u_long cmd,
- caddr_t data)
-{
- pdq_softc_t *sc = PDQ_OS_IFP_TO_SOFTC(ifp);
- int error = 0;
-
- switch (cmd) {
- case SIOCSIFFLAGS: {
- pdq_ifinit(sc);
- break;
- }
-
- case SIOCADDMULTI:
- case SIOCDELMULTI: {
- PDQ_LOCK(sc);
- if (PDQ_IFNET(sc)->if_drv_flags & IFF_DRV_RUNNING) {
- pdq_run(sc->sc_pdq);
- error = 0;
- }
- PDQ_UNLOCK(sc);
- break;
- }
-
-#if defined(IFM_FDDI) && defined(SIOCSIFMEDIA)
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA: {
- struct ifreq *ifr = (struct ifreq *)data;
- error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd);
- break;
- }
-#endif
-
- default: {
- error = fddi_ioctl(ifp, cmd, data);
- break;
- }
- }
-
- return error;
-}
-
-#ifndef IFF_NOTRAILERS
-#define IFF_NOTRAILERS 0
-#endif
-
-int
-pdq_ifattach(pdq_softc_t *sc, const pdq_uint8_t *llc, pdq_type_t type)
-{
- struct ifnet *ifp;
-
- KASSERT(type == PDQ_DEFPA, ("We only support PCI attachment."));
-
- ifp = PDQ_IFNET(sc) = if_alloc(IFT_FDDI);
- if (ifp == NULL) {
- device_printf(sc->dev, "can not if_alloc()\n");
- return (ENOSPC);
- }
-
- mtx_init(&sc->mtx, device_get_nameunit(sc->dev), MTX_NETWORK_LOCK,
- MTX_DEF);
- callout_init_mtx(&sc->watchdog, &sc->mtx, 0);
-
- if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
- ifp->if_softc = sc;
- ifp->if_init = pdq_ifinit;
- ifp->if_snd.ifq_maxlen = ifqmaxlen;
- ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_NOTRAILERS|IFF_MULTICAST;
-
- ifp->if_ioctl = pdq_ifioctl;
- ifp->if_start = pdq_ifstart;
-
-#if defined(IFM_FDDI)
- {
- const int media = sc->sc_ifmedia.ifm_media;
- ifmedia_init(&sc->sc_ifmedia, IFM_FDX,
- pdq_ifmedia_change, pdq_ifmedia_status);
- ifmedia_add(&sc->sc_ifmedia, media, 0, 0);
- ifmedia_set(&sc->sc_ifmedia, media);
- }
-#endif
-
- sc->sc_pdq = pdq_initialize(sc->mem_bst, sc->mem_bsh, ifp->if_xname, -1,
- sc, type);
- if (sc->sc_pdq == NULL) {
- device_printf(sc->dev, "Initialization failed.\n");
- return (ENXIO);
- }
-
- fddi_ifattach(ifp, llc, FDDI_BPF_SUPPORTED);
- return (0);
-}
-
-void
-pdq_ifdetach (pdq_softc_t *sc)
-{
- struct ifnet *ifp;
-
- ifp = sc->ifp;
-
- fddi_ifdetach(ifp, FDDI_BPF_SUPPORTED);
- PDQ_LOCK(sc);
- pdq_ifstop(sc);
- PDQ_UNLOCK(sc);
- callout_drain(&sc->watchdog);
- pdq_free(sc->dev);
-
- return;
-}
-
-void
-pdq_free (device_t dev)
-{
- pdq_softc_t *sc;
-
- sc = device_get_softc(dev);
-
- if (sc->io)
- bus_release_resource(dev, sc->io_type, sc->io_rid, sc->io);
- 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);
- if (sc->ifp)
- if_free(sc->ifp);
-
- /*
- * Destroy the mutex.
- */
- if (mtx_initialized(&sc->mtx) != 0) {
- mtx_destroy(&sc->mtx);
- }
-
- return;
-}
-
-#if defined(PDQ_BUS_DMA)
-int
-pdq_os_memalloc_contig(
- pdq_t *pdq)
-{
- pdq_softc_t * const sc = pdq->pdq_os_ctx;
- bus_dma_segment_t db_segs[1], ui_segs[1], cb_segs[1];
- int db_nsegs = 0, ui_nsegs = 0;
- int steps = 0;
- int not_ok;
-
- not_ok = bus_dmamem_alloc(sc->sc_dmatag,
- sizeof(*pdq->pdq_dbp), sizeof(*pdq->pdq_dbp),
- sizeof(*pdq->pdq_dbp), db_segs, 1, &db_nsegs,
- BUS_DMA_NOWAIT);
- if (!not_ok) {
- steps = 1;
- not_ok = bus_dmamem_map(sc->sc_dmatag, db_segs, db_nsegs,
- sizeof(*pdq->pdq_dbp), (caddr_t *) &pdq->pdq_dbp,
- BUS_DMA_NOWAIT);
- }
- if (!not_ok) {
- steps = 2;
- not_ok = bus_dmamap_create(sc->sc_dmatag, db_segs[0].ds_len, 1,
- 0x2000, 0, BUS_DMA_NOWAIT, &sc->sc_dbmap);
- }
- if (!not_ok) {
- steps = 3;
- not_ok = bus_dmamap_load(sc->sc_dmatag, sc->sc_dbmap,
- pdq->pdq_dbp, sizeof(*pdq->pdq_dbp),
- NULL, BUS_DMA_NOWAIT);
- }
- if (!not_ok) {
- steps = 4;
- pdq->pdq_pa_descriptor_block = sc->sc_dbmap->dm_segs[0].ds_addr;
- not_ok = bus_dmamem_alloc(sc->sc_dmatag,
- PDQ_OS_PAGESIZE, PDQ_OS_PAGESIZE, PDQ_OS_PAGESIZE,
- ui_segs, 1, &ui_nsegs, BUS_DMA_NOWAIT);
- }
- if (!not_ok) {
- steps = 5;
- not_ok = bus_dmamem_map(sc->sc_dmatag, ui_segs, ui_nsegs,
- PDQ_OS_PAGESIZE,
- (caddr_t *) &pdq->pdq_unsolicited_info.ui_events,
- BUS_DMA_NOWAIT);
- }
- if (!not_ok) {
- steps = 6;
- not_ok = bus_dmamap_create(sc->sc_dmatag, ui_segs[0].ds_len, 1,
- PDQ_OS_PAGESIZE, 0, BUS_DMA_NOWAIT,
- &sc->sc_uimap);
- }
- if (!not_ok) {
- steps = 7;
- not_ok = bus_dmamap_load(sc->sc_dmatag, sc->sc_uimap,
- pdq->pdq_unsolicited_info.ui_events,
- PDQ_OS_PAGESIZE, NULL, BUS_DMA_NOWAIT);
- }
- if (!not_ok) {
- steps = 8;
- pdq->pdq_unsolicited_info.ui_pa_bufstart = sc->sc_uimap->dm_segs[0].ds_addr;
- cb_segs[0] = db_segs[0];
- cb_segs[0].ds_addr += offsetof(pdq_descriptor_block_t, pdqdb_consumer);
- cb_segs[0].ds_len = sizeof(pdq_consumer_block_t);
- not_ok = bus_dmamem_map(sc->sc_dmatag, cb_segs, 1,
- sizeof(*pdq->pdq_cbp), (caddr_t *) &pdq->pdq_cbp,
- BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
- }
- if (!not_ok) {
- steps = 9;
- not_ok = bus_dmamap_create(sc->sc_dmatag, cb_segs[0].ds_len, 1,
- 0x2000, 0, BUS_DMA_NOWAIT, &sc->sc_cbmap);
- }
- if (!not_ok) {
- steps = 10;
- not_ok = bus_dmamap_load(sc->sc_dmatag, sc->sc_cbmap,
- (caddr_t) pdq->pdq_cbp, sizeof(*pdq->pdq_cbp),
- NULL, BUS_DMA_NOWAIT);
- }
- if (!not_ok) {
- pdq->pdq_pa_consumer_block = sc->sc_cbmap->dm_segs[0].ds_addr;
- return not_ok;
- }
-
- switch (steps) {
- case 11: {
- bus_dmamap_unload(sc->sc_dmatag, sc->sc_cbmap);
- /* FALL THROUGH */
- }
- case 10: {
- bus_dmamap_destroy(sc->sc_dmatag, sc->sc_cbmap);
- /* FALL THROUGH */
- }
- case 9: {
- bus_dmamem_unmap(sc->sc_dmatag,
- (caddr_t) pdq->pdq_cbp, sizeof(*pdq->pdq_cbp));
- /* FALL THROUGH */
- }
- case 8: {
- bus_dmamap_unload(sc->sc_dmatag, sc->sc_uimap);
- /* FALL THROUGH */
- }
- case 7: {
- bus_dmamap_destroy(sc->sc_dmatag, sc->sc_uimap);
- /* FALL THROUGH */
- }
- case 6: {
- bus_dmamem_unmap(sc->sc_dmatag,
- (caddr_t) pdq->pdq_unsolicited_info.ui_events,
- PDQ_OS_PAGESIZE);
- /* FALL THROUGH */
- }
- case 5: {
- bus_dmamem_free(sc->sc_dmatag, ui_segs, ui_nsegs);
- /* FALL THROUGH */
- }
- case 4: {
- bus_dmamap_unload(sc->sc_dmatag, sc->sc_dbmap);
- /* FALL THROUGH */
- }
- case 3: {
- bus_dmamap_destroy(sc->sc_dmatag, sc->sc_dbmap);
- /* FALL THROUGH */
- }
- case 2: {
- bus_dmamem_unmap(sc->sc_dmatag,
- (caddr_t) pdq->pdq_dbp,
- sizeof(*pdq->pdq_dbp));
- /* FALL THROUGH */
- }
- case 1: {
- bus_dmamem_free(sc->sc_dmatag, db_segs, db_nsegs);
- /* FALL THROUGH */
- }
- }
-
- return not_ok;
-}
-
-extern void
-pdq_os_descriptor_block_sync(
- pdq_os_ctx_t *sc,
- size_t offset,
- size_t length,
- int ops)
-{
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_dbmap, offset, length, ops);
-}
-
-extern void
-pdq_os_consumer_block_sync(
- pdq_os_ctx_t *sc,
- int ops)
-{
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_cbmap, 0, sizeof(pdq_consumer_block_t), ops);
-}
-
-extern void
-pdq_os_unsolicited_event_sync(
- pdq_os_ctx_t *sc,
- size_t offset,
- size_t length,
- int ops)
-{
- bus_dmamap_sync(sc->sc_dmatag, sc->sc_uimap, offset, length, ops);
-}
-
-extern void
-pdq_os_databuf_sync(
- pdq_os_ctx_t *sc,
- struct mbuf *m,
- size_t offset,
- size_t length,
- int ops)
-{
- bus_dmamap_sync(sc->sc_dmatag, M_GETCTX(m, bus_dmamap_t), offset, length, ops);
-}
-
-extern void
-pdq_os_databuf_free(
- pdq_os_ctx_t *sc,
- struct mbuf *m)
-{
- if (m->m_flags & (M_HASRXDMAMAP|M_HASTXDMAMAP)) {
- bus_dmamap_t map = M_GETCTX(m, bus_dmamap_t);
- bus_dmamap_unload(sc->sc_dmatag, map);
- bus_dmamap_destroy(sc->sc_dmatag, map);
- m->m_flags &= ~(M_HASRXDMAMAP|M_HASTXDMAMAP);
- }
- m_freem(m);
-}
-
-extern struct mbuf *
-pdq_os_databuf_alloc(
- pdq_os_ctx_t *sc)
-{
- struct mbuf *m;
- bus_dmamap_t map;
-
- MGETHDR(m, M_NOWAIT, MT_DATA);
- if (m == NULL) {
- printf("%s: can't alloc small buf\n", sc->sc_dev.dv_xname);
- return NULL;
- }
- if (!(MCLGET(m, M_NOWAIT))) {
- printf("%s: can't alloc cluster\n", sc->sc_dev.dv_xname);
- m_free(m);
- return NULL;
- }
- m->m_pkthdr.len = m->m_len = PDQ_OS_DATABUF_SIZE;
-
- if (bus_dmamap_create(sc->sc_dmatag, PDQ_OS_DATABUF_SIZE,
- 1, PDQ_OS_DATABUF_SIZE, 0, BUS_DMA_NOWAIT, &map)) {
- printf("%s: can't create dmamap\n", sc->sc_dev.dv_xname);
- m_free(m);
- return NULL;
- }
- if (bus_dmamap_load_mbuf(sc->sc_dmatag, map, m,
- BUS_DMA_READ|BUS_DMA_NOWAIT)) {
- printf("%s: can't load dmamap\n", sc->sc_dev.dv_xname);
- bus_dmamap_destroy(sc->sc_dmatag, map);
- m_free(m);
- return NULL;
- }
- m->m_flags |= M_HASRXDMAMAP;
- M_SETCTX(m, map);
- return m;
-}
-#endif
Index: sys/dev/pdq/pdqreg.h
===================================================================
--- sys/dev/pdq/pdqreg.h
+++ /dev/null
@@ -1,1092 +0,0 @@
-/* $NetBSD: pdqreg.h,v 1.14 2001/06/13 10:46:03 wiz Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Id: pdqreg.h,v 1.11 1997/03/21 21:16:04 thomas Exp
- * $FreeBSD$
- *
- */
-
-/*
- * DEC PDQ FDDI Controller; PDQ port driver definitions
- *
- */
-
-#ifndef _PDQREG_H
-#define _PDQREG_H
-
-#if !defined(KERNEL) && !defined(_KERNEL)
-#include <stddef.h>
-#elif !defined(offsetof)
-#define offsetof(t, m) ((char *) (&((t *)0L)->m) - (char *) 0L)
-#endif
-#if defined(PDQTEST) && !defined(PDQ_NDEBUG)
-#include <assert.h>
-#define PDQ_ASSERT assert
-#else
-#define PDQ_ASSERT(x) do { } while(0)
-#endif
-
-#define PDQ_RING_SIZE(array) ((sizeof(array) / sizeof(array[0])))
-#define PDQ_ARRAY_SIZE(array) ((sizeof(array) / sizeof(array[0])))
-#define PDQ_RING_MASK(array) (PDQ_RING_SIZE(array) - 1)
-#define PDQ_BITMASK(n) (1L << (pdq_uint32_t) (n))
-
-#define PDQ_FDDI_MAX 4495
-#define PDQ_FDDI_LLC_MIN 20
-#define PDQ_FDDI_SMT_MIN 37
-
-#define PDQ_FDDI_SMT 0x40
-#define PDQ_FDDI_LLC_ASYNC 0x50
-#define PDQ_FDDI_LLC_SYNC 0xD0
-#define PDQ_FDDI_IMP_ASYNC 0x60
-#define PDQ_FDDI_IMP_SYNC 0xE0
-
-#define PDQ_FDDIFC_C 0x80
-#define PDQ_FDDIFC_L 0x40
-#define PDQ_FDDIFC_F 0x30
-#define PDQ_FDDIFC_Z 0x0F
-
-#define PDQ_FDDI_PH0 0x20
-#define PDQ_FDDI_PH1 0x38
-#define PDQ_FDDI_PH2 0x00
-
-typedef pdq_uint32_t pdq_physaddr_t;
-
-struct _pdq_lanaddr_t {
- pdq_uint8_t lanaddr_bytes[8];
-};
-
-typedef struct {
- pdq_uint8_t fwrev_bytes[4];
-} pdq_fwrev_t;
-
-enum _pdq_state_t {
- PDQS_RESET=0,
- PDQS_UPGRADE=1,
- PDQS_DMA_UNAVAILABLE=2,
- PDQS_DMA_AVAILABLE=3,
- PDQS_LINK_AVAILABLE=4,
- PDQS_LINK_UNAVAILABLE=5,
- PDQS_HALTED=6,
- PDQS_RING_MEMBER=7
-};
-
-struct _pdq_csrs_t {
- pdq_bus_memoffset_t csr_port_reset; /* 0x00 [RW] */
- pdq_bus_memoffset_t csr_host_data; /* 0x04 [R] */
- pdq_bus_memoffset_t csr_port_control; /* 0x08 [RW] */
- pdq_bus_memoffset_t csr_port_data_a; /* 0x0C [RW] */
- pdq_bus_memoffset_t csr_port_data_b; /* 0x10 [RW] */
- pdq_bus_memoffset_t csr_port_status; /* 0x14 [R] */
- pdq_bus_memoffset_t csr_host_int_type_0; /* 0x18 [RW] */
- pdq_bus_memoffset_t csr_host_int_enable; /* 0x1C [RW] */
- pdq_bus_memoffset_t csr_type_2_producer; /* 0x20 [RW] */
- pdq_bus_memoffset_t csr_cmd_response_producer; /* 0x28 [RW] */
- pdq_bus_memoffset_t csr_cmd_request_producer; /* 0x2C [RW] */
- pdq_bus_memoffset_t csr_host_smt_producer; /* 0x30 [RW] */
- pdq_bus_memoffset_t csr_unsolicited_producer; /* 0x34 [RW] */
- pdq_bus_t csr_bus;
- pdq_bus_memaddr_t csr_base;
-};
-
-struct _pdq_pci_csrs_t {
- pdq_bus_memoffset_t csr_pfi_mode_control; /* 0x40 [RW] */
- pdq_bus_memoffset_t csr_pfi_status; /* 0x44 [RW] */
- pdq_bus_memoffset_t csr_fifo_write; /* 0x48 [RW] */
- pdq_bus_memoffset_t csr_fifo_read; /* 0x4C [RW] */
- pdq_bus_t csr_bus;
- pdq_bus_memaddr_t csr_base;
-};
-
-#define PDQ_PFI_MODE_DMA_ENABLE 0x01 /* DMA Enable */
-#define PDQ_PFI_MODE_PFI_PCI_INTR 0x02 /* PFI-to-PCI Int Enable */
-#define PDQ_PFI_MODE_PDQ_PCI_INTR 0x04 /* PDQ-to-PCI Int Enable */
-
-#define PDQ_PFI_STATUS_PDQ_INTR 0x10 /* PDQ Int received */
-#define PDQ_PFI_STATUS_DMA_ABORT 0x08 /* PDQ DMA Abort asserted */
-
-#define PDQ_TC_CSR_OFFSET 0x00100000
-#define PDQ_TC_CSR_SPACE 0x0040
-#define PDQ_FBUS_CSR_OFFSET 0x00200000
-#define PDQ_FBUS_CSR_SPACE 0x0080
-
-/*
- * Port Reset Data A Definitions
- */
-#define PDQ_PRESET_SKIP_SELFTEST 0x0004
-#define PDQ_PRESET_SOFT_RESET 0x0002
-#define PDQ_PRESET_UPGRADE 0x0001
-/*
- * Port Control Register Definitions
- */
-#define PDQ_PCTL_CMD_ERROR 0x8000
-#define PDQ_PCTL_FLASH_BLAST 0x4000
-#define PDQ_PCTL_HALT 0x2000
-#define PDQ_PCTL_COPY_DATA 0x1000
-#define PDQ_PCTL_ERROR_LOG_START 0x0800
-#define PDQ_PCTL_ERROR_LOG_READ 0x0400
-#define PDQ_PCTL_XMT_DATA_FLUSH_DONE 0x0200
-#define PDQ_PCTL_DMA_INIT 0x0100
-#define PDQ_DMA_INIT_LW_BSWAP_DATA 0x02
-#define PDQ_DMA_INIT_LW_BSWAP_LITERAL 0x01
-#define PDQ_PCTL_INIT_START 0x0080
-#define PDQ_PCTL_CONSUMER_BLOCK 0x0040
-#define PDQ_PCTL_DMA_UNINIT 0x0020
-#define PDQ_PCTL_RING_MEMBER 0x0010
-#define PDQ_PCTL_MLA_READ 0x0008
-#define PDQ_PCTL_FW_REV_READ 0x0004
-#define PDQ_PCTL_DEVICE_SPECIFIC 0x0002
-#define PDQ_PCTL_SUB_CMD 0x0001
-
-typedef enum {
- PDQ_SUB_CMD_LINK_UNINIT=1,
- PDQ_SUB_CMD_DMA_BURST_SIZE_SET=2,
- PDQ_SUB_CMD_PDQ_REV_GET=4
-} pdq_sub_cmd_t;
-
-typedef enum {
- PDQ_DMA_BURST_4LW=0,
- PDQ_DMA_BURST_8LW=1,
- PDQ_DMA_BURST_16LW=2,
- PDQ_DMA_BURST_32LW=3
-} pdq_dma_burst_size_t;
-
-typedef enum {
- PDQ_CHIP_REV_A_B_OR_C=0,
- PDQ_CHIP_REV_D=2,
- PDQ_CHIP_REV_E=4
-} pdq_chip_rev_t;
-/*
- * Port Status Register Definitions
- */
-#define PDQ_PSTS_RCV_DATA_PENDING 0x80000000ul
-#define PDQ_PSTS_XMT_DATA_PENDING 0x40000000ul
-#define PDQ_PSTS_HOST_SMT_PENDING 0x20000000ul
-#define PDQ_PSTS_UNSOL_PENDING 0x10000000ul
-#define PDQ_PSTS_CMD_RSP_PENDING 0x08000000ul
-#define PDQ_PSTS_CMD_REQ_PENDING 0x04000000ul
-#define PDQ_PSTS_TYPE_0_PENDING 0x02000000ul
-#define PDQ_PSTS_INTR_PENDING 0xFE000000ul
-#define PDQ_PSTS_ADAPTER_STATE(sts) ((pdq_state_t) (((sts) >> 8) & 0x07))
-#define PDQ_PSTS_HALT_ID(sts) ((pdq_halt_code_t) ((sts) & 0xFF))
-/*
- * Host Interrupt Register Definitions
- */
-#define PDQ_HOST_INT_TX_ENABLE 0x80000000ul
-#define PDQ_HOST_INT_RX_ENABLE 0x40000000ul
-#define PDQ_HOST_INT_UNSOL_ENABLE 0x20000000ul
-#define PDQ_HOST_INT_HOST_SMT_ENABLE 0x10000000ul
-#define PDQ_HOST_INT_CMD_RSP_ENABLE 0x08000000ul
-#define PDQ_HOST_INT_CMD_RQST_ENABLE 0x04000000ul
-
-#define PDQ_HOST_INT_1MS 0x80
-#define PDQ_HOST_INT_20MS 0x40
-#define PDQ_HOST_INT_CSR_CMD_DONE 0x20
-#define PDQ_HOST_INT_STATE_CHANGE 0x10
-#define PDQ_HOST_INT_XMT_DATA_FLUSH 0x08
-#define PDQ_HOST_INT_NXM 0x04
-#define PDQ_HOST_INT_PM_PARITY_ERROR 0x02
-#define PDQ_HOST_INT_HOST_BUS_PARITY_ERROR 0x01
-#define PDQ_HOST_INT_FATAL_ERROR 0x07
-
-typedef enum {
- PDQH_SELFTEST_TIMEOUT=0,
- PDQH_HOST_BUS_PARITY_ERROR=1,
- PDQH_HOST_DIRECTED_HALT=2,
- PDQH_SOFTWARE_FAULT=3,
- PDQH_HARDWARE_FAULT=4,
- PDQH_PC_TRACE_PATH_TEST=5,
- PDQH_DMA_ERROR=6,
- PDQH_IMAGE_CRC_ERROR=7,
- PDQH_ADAPTER_PROCESSOR_ERROR=8,
- PDQH_MAX=9
-} pdq_halt_code_t;
-
-typedef struct {
- pdq_uint16_t pdqcb_receives;
- pdq_uint16_t pdqcb_transmits;
- pdq_uint32_t pdqcb__filler1;
- pdq_uint32_t pdqcb_host_smt;
- pdq_uint32_t pdqcb__filler2;
- pdq_uint32_t pdqcb_unsolicited_event;
- pdq_uint32_t pdqcb__filler3;
- pdq_uint32_t pdqcb_command_response;
- pdq_uint32_t pdqcb__filler4;
- pdq_uint32_t pdqcb_command_request;
- pdq_uint32_t pdqcb__filler5[7];
-} pdq_consumer_block_t;
-
-#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
-#define PDQ_BITFIELD2(a, b) b, a
-#define PDQ_BITFIELD3(a, b, c) c, b, a
-#define PDQ_BITFIELD4(a, b, c, d) d, c, b, a
-#define PDQ_BITFIELD5(a, b, c, d, e) e, d, c, b, a
-#define PDQ_BITFIELD12(a, b, c, d, e, f, g, h, i, j, k, l) \
- l, k, j, i, h, g, f, e, d, c, b, a
-#else
-#define PDQ_BITFIELD2(a, b) a, b
-#define PDQ_BITFIELD3(a, b, c) a, b, c
-#define PDQ_BITFIELD4(a, b, c, d) a, b, c, d
-#define PDQ_BITFIELD5(a, b, c, d, e) a, b, c, d, e
-#define PDQ_BITFIELD12(a, b, c, d, e, f, g, h, i, j, k, l) \
- a, b, c, d, e, f, g, h, i, j, k, l
-#endif
-
-typedef struct {
- pdq_uint32_t PDQ_BITFIELD5(rxd_pa_hi : 16,
- rxd_seg_cnt : 4,
- rxd_seg_len_hi : 9,
- rxd_seg_len_lo : 2,
- rxd_sop : 1);
- pdq_uint32_t rxd_pa_lo;
-} pdq_rxdesc_t;
-
-typedef union {
- pdq_uint32_t rxs_status;
- struct {
- pdq_uint32_t PDQ_BITFIELD12(st_len : 13,
- st_rcc_ss : 2,
- st_rcc_dd : 2,
- st_rcc_reason : 3,
- st_rcc_badcrc : 1,
- st_rcc_badpdu : 1,
- st_fsb__reserved : 2,
- st_fsb_c : 1,
- st_fsb_a : 1,
- st_fsb_e : 1,
- st_fsc : 3,
- st__reserved : 2);
- } rxs_st;
-} pdq_rxstatus_t;
-#define rxs_len rxs_st.st_len
-#define rxs_rcc_ss rxs_st.st_rcc_ss
-#define rxs_rcc_dd rxs_st.st_rcc_dd
-#define rxs_rcc_reason rxs_st.st_rcc_reason
-#define rxs_rcc_badcrc rxs_st.st_rcc_badcrc
-#define rxs_rcc_badpdu rxs_st.st_rcc_badpdu
-#define rxs_fsb_c rxs_st.st_fsb_c
-#define rxs_fsb_a rxs_st.st_fsb_a
-#define rxs_fsb_e rxs_st.st_fsb_e
-#define rxs_fsc rxs_st.st_fsc
-
-#define PDQ_RXS_RCC_DD_NO_MATCH 0x00
-#define PDQ_RXS_RCC_DD_PROMISC_MATCH 0x01
-#define PDQ_RXS_RCC_DD_CAM_MATCH 0x02
-#define PDQ_RXS_RCC_DD_MLA_MATCH 0x03
-
-typedef struct {
- pdq_uint32_t PDQ_BITFIELD5(txd_pa_hi : 16,
- txd_seg_len : 13,
- txd_mbz : 1,
- txd_eop : 1,
- txd_sop : 1);
- pdq_uint32_t txd_pa_lo;
-} pdq_txdesc_t;
-
-typedef struct {
- pdq_rxdesc_t pdqdb_receives[256]; /* 2048; 0x0000..0x07FF */
- pdq_txdesc_t pdqdb_transmits[256]; /* 2048; 0x0800..0x0FFF */
- pdq_rxdesc_t pdqdb_host_smt[64]; /* 512; 0x1000..0x11FF */
- pdq_rxdesc_t pdqdb_unsolicited_events[16]; /* 128; 0x1200..0x127F */
- pdq_rxdesc_t pdqdb_command_responses[16]; /* 128; 0x1280..0x12FF */
- pdq_txdesc_t pdqdb_command_requests[16]; /* 128; 0x1300..0x137F */
- /*
- * The rest of the descriptor block is unused.
- * As such we could use it for other things.
- */
- pdq_uint32_t pdqdb__filler1[16]; /* 64; 0x1380..0x13BF */
- pdq_consumer_block_t pdqdb_consumer; /* 64; 0x13C0..0x13FF */
- /*
- * The maximum command size is 512 so as long as thes
- * command is at least that long all will be fine.
- */
- pdq_uint32_t pdqdb__filler2[64]; /* 256; 0x1400..0x14FF */
- pdq_uint8_t pdqdb_cmd_request_buf[1024]; /* 1024; 0x1500..0x18FF */
- pdq_uint8_t pdqdb_cmd_response_buf[1024]; /* 1024; 0x1900..0x1CFF */
- pdq_uint32_t pdqdb__filler3[128]; /* 512; 0x1D00..0x1EFF */
- pdq_uint8_t pdqdb_tx_hdr[4]; /* 4; 0x1F00..0x1F03 */
- pdq_uint32_t pdqdb__filler4[63]; /* 252; 0x1F04..0x1FFF */
-} pdq_descriptor_block_t;
-
-#define PDQ_SIZE_COMMAND_RESPONSE 512
-
-typedef enum {
- PDQC_START=0,
- PDQC_FILTER_SET=1,
- PDQC_FILTER_GET=2,
- PDQC_CHARS_SET=3,
- PDQC_STATUS_CHARS_GET=4,
- PDQC_COUNTERS_GET=5,
- PDQC_COUNTERS_SET=6,
- PDQC_ADDR_FILTER_SET=7,
- PDQC_ADDR_FILTER_GET=8,
- PDQC_ERROR_LOG_CLEAR=9,
- PDQC_ERROR_LOG_GET=10,
- PDQC_FDDI_MIB_GET=11,
- PDQC_DEC_EXT_MIB_GET=12,
- PDQC_DEV_SPECIFIC_GET=13,
- PDQC_SNMP_SET=14,
- PDQC_SMT_MIB_GET=16,
- PDQC_SMT_MIB_SET=17,
- PDQC_BOGUS_CMD=18
-} pdq_cmd_code_t;
-
-typedef struct {
- /*
- * These value manage the available space in command/response
- * buffer area.
- */
- pdq_physaddr_t ci_pa_request_bufstart;
- pdq_uint8_t *ci_request_bufstart;
- pdq_physaddr_t ci_pa_response_bufstart;
- pdq_uint8_t *ci_response_bufstart;
- /*
- * Bitmask of commands to sent to the PDQ
- */
- pdq_uint32_t ci_pending_commands;
- /*
- * Variables to maintain the PDQ queues.
- */
- pdq_uint32_t ci_command_active;
- pdq_uint32_t ci_request_producer;
- pdq_uint32_t ci_response_producer;
- pdq_uint32_t ci_request_completion;
- pdq_uint32_t ci_response_completion;
- /*
- *
- */
- pdq_physaddr_t ci_pa_request_descriptors;
- pdq_physaddr_t ci_pa_response_descriptors;
-
- pdq_cmd_code_t ci_queued_commands[16];
-} pdq_command_info_t;
-
-#define PDQ_SIZE_UNSOLICITED_EVENT 512
-#define PDQ_NUM_UNSOLICITED_EVENTS (PDQ_OS_PAGESIZE / PDQ_SIZE_UNSOLICITED_EVENT)
-
-typedef struct _pdq_unsolicited_event_t pdq_unsolicited_event_t;
-
-typedef struct {
- pdq_physaddr_t ui_pa_bufstart;
- pdq_physaddr_t ui_pa_descriptors;
- pdq_unsolicited_event_t *ui_events;
-
- pdq_uint32_t ui_free;
- pdq_uint32_t ui_producer;
- pdq_uint32_t ui_completion;
-} pdq_unsolicited_info_t;
-
-#define PDQ_RX_FC_OFFSET (sizeof(pdq_rxstatus_t) + 3)
-#define PDQ_RX_SEGCNT ((PDQ_FDDI_MAX + PDQ_OS_DATABUF_SIZE - 1) / PDQ_OS_DATABUF_SIZE)
-#define PDQ_DO_TYPE2_PRODUCER(pdq) \
- PDQ_CSR_WRITE(&(pdq)->pdq_csrs, csr_type_2_producer, \
- ((pdq)->pdq_rx_info.rx_producer << 0) \
- | ((pdq)->pdq_tx_info.tx_producer << 8) \
- | ((pdq)->pdq_rx_info.rx_completion << 16) \
- | ((pdq)->pdq_tx_info.tx_completion << 24))
-
-#define PDQ_DO_HOST_SMT_PRODUCER(pdq) \
- PDQ_CSR_WRITE(&(pdq)->pdq_csrs, csr_host_smt_producer, \
- ((pdq)->pdq_host_smt_info.rx_producer << 0) \
- | ((pdq)->pdq_host_smt_info.rx_completion << 8))\
-
-#define PDQ_ADVANCE(n, a, m) ((n) = ((n) + (a)) & (m))
-
-typedef struct {
- void *q_head;
- void *q_tail;
-} pdq_databuf_queue_t;
-
-typedef struct {
- void *rx_buffers;
- pdq_physaddr_t rx_pa_descriptors;
-
- pdq_uint32_t rx_target;
- pdq_uint32_t rx_free;
- pdq_uint32_t rx_producer;
- pdq_uint32_t rx_completion;
-} pdq_rx_info_t;
-
-typedef struct {
- pdq_databuf_queue_t tx_txq;
- pdq_txdesc_t tx_hdrdesc;
- pdq_uint8_t tx_descriptor_count[256];
- pdq_physaddr_t tx_pa_descriptors;
-
- pdq_uint32_t tx_free;
- pdq_uint32_t tx_producer;
- pdq_uint32_t tx_completion;
-} pdq_tx_info_t;
-
-typedef struct _pdq_os_ctx_t pdq_os_ctx_t;
-struct _pdq_t {
- pdq_csrs_t pdq_csrs;
- pdq_pci_csrs_t pdq_pci_csrs;
- pdq_type_t pdq_type;
- pdq_chip_rev_t pdq_chip_rev;
- pdq_lanaddr_t pdq_hwaddr;
- pdq_fwrev_t pdq_fwrev;
- pdq_descriptor_block_t *pdq_dbp;
- volatile pdq_consumer_block_t *pdq_cbp;
- pdq_uint32_t pdq_intrmask;
- pdq_uint32_t pdq_flags;
-#define PDQ_PROMISC 0x0001
-#define PDQ_ALLMULTI 0x0002
-#define PDQ_PASS_SMT 0x0004
-#define PDQ_RUNNING 0x0008
-#define PDQ_PRINTCHARS 0x0010
-#define PDQ_TXOK 0x0020
-#define PDQ_WANT_FDX 0x0040
-#define PDQ_IS_FDX 0x0080
-#define PDQ_IS_ONRING 0x0100
- const char *pdq_os_name;
- pdq_os_ctx_t *pdq_os_ctx;
- pdq_uint32_t pdq_unit;
- pdq_command_info_t pdq_command_info;
- pdq_unsolicited_info_t pdq_unsolicited_info;
- pdq_tx_info_t pdq_tx_info;
- pdq_rx_info_t pdq_rx_info;
- pdq_rx_info_t pdq_host_smt_info;
- void *pdq_receive_buffers[256];
- void *pdq_host_smt_buffers[64];
- pdq_physaddr_t pdq_pa_consumer_block;
- pdq_physaddr_t pdq_pa_descriptor_block;
-};
-
-#define PDQ_DB_BUSPA(pdq, m) \
- ((pdq)->pdq_pa_descriptor_block + \
- ((volatile u_int8_t *) (m) - (u_int8_t *) (pdq)->pdq_dbp))
-
-
-typedef enum {
- PDQR_SUCCESS=0,
- PDQR_FAILURE=1,
- PDQR_WARNING=2,
- PDQR_LOOP_MODE_BAD=3,
- PDQR_ITEM_CODE_BAD=4,
- PDQR_TVX_BAD=5,
- PDQR_TREQ_BAD=6,
- PDQR_RESTRICTED_TOKEN_BAD=7,
- PDQR_NO_EOL=12,
- PDQR_FILTER_STATE_BAD=13,
- PDQR_CMD_TYPE_BAD=14,
- PDQR_ADAPTER_STATE_BAD=15,
- PDQR_RING_PURGER_BAD=16,
- PDQR_LEM_THRESHOLD_BAD=17,
- PDQR_LOOP_NOT_SUPPORTED=18,
- PDQR_FLUSH_TIME_BAD=19,
- PDQR_NOT_YET_IMPLEMENTED=20,
- PDQR_CONFIG_POLICY_BAD=21,
- PDQR_STATION_ACTION_BAD=22,
- PDQR_MAC_ACTION_BAD=23,
- PDQR_CON_POLICIES_BAD=24,
- PDQR_MAC_LOOP_TIME_BAD=25,
- PDQR_TB_MAX_BAD=26,
- PDQR_LER_CUTOFF_BAD=27,
- PDQR_LER_ALARM_BAD=28,
- PDQR_MAC_PATHS_REQ_BAD=29,
- PDQR_MAC_T_REQ_BAD=30,
- PDQR_EMAC_RING_PURGER_BAD=31,
- PDQR_EMAC_RTOKEN_TIMOUT_AD=32,
- PDQR_NO_SUCH_ENTRY=33,
- PDQR_T_NOTIFY_BAD=34,
- PDQR_TR_MAX_EXP_BAD=35,
- PDQR_FRAME_ERR_THRESHOLD_BAD=36,
- PDQR_MAX_TREQ_BAD=37,
- PDQR_FULL_DUPLEX_ENABLE_BAD=38,
- PDQR_ITEM_INDEX_BAD=39
-} pdq_response_code_t;
-
-typedef enum {
- PDQI_EOL=0,
- PDQI_T_REQ=1,
- PDQI_TVX=2,
- PDQI_RESTRICTED_TOKEN=3,
- PDQI_LEM_THRESHOLD=4,
- PDQI_RING_PURGER=5,
- PDQI_COUNTER_INTERVAL=6,
- PDQI_IND_GROUP_PROM=7,
- PDQI_GROUP_PROM=8,
- PDQI_BROADCAST=9,
- PDQI_SMT_PROM=10,
- PDQI_SMT_USER=11,
- PDQI_RESERVED=12,
- PDQI_IMPLEMENTOR=13,
- PDQI_LOOPBACK_MODE=14,
- PDQI_SMT_CONFIG_POLICY=16,
- PDQI_SMT_CONNECTION_POLICY=17,
- PDQI_SMT_T_NOTIFY=18,
- PDQI_SMT_STATION_ACTION=19,
- PDQI_MAC_PATHS_REQUESTED=21,
- PDQI_MAC_ACTION=23,
- PDQI_PORT_CONNECTION_POLICIES=24,
- PDQI_PORT_PATHS_REQUESTED=25,
- PDQI_PORT_MAC_LOOP_TIME=26,
- PDQI_PORT_TB_MAX=27,
- PDQI_PORT_LER_CUTOFF=28,
- PDQI_PORT_LER_ALARM=29,
- PDQI_PORT_ACTION=30,
- PDQI_FLUSH_TIME=32,
- PDQI_SMT_USER_DATA=33,
- PDQI_SMT_STATUS_REPORT_POLICY=34,
- PDQI_SMT_TRACE_MAX_EXPIRATION=35,
- PDQI_MAC_FRAME_ERR_THRESHOLD=36,
- PDQI_MAC_UNIT_DATA_ENABLE=37,
- PDQI_PATH_TVX_LOWER_BOUND=38,
- PDQI_PATH_TMAX_LOWER_BOUND=39,
- PDQI_PATH_MAX_TREQ=40,
- PDQI_MAC_TREQ=41,
- PDQI_EMAC_RING_PURGER=42,
- PDQI_EMAC_RTOKEN_TIMEOUT=43,
- PDQI_FULL_DUPLEX_ENABLE=44
-} pdq_item_code_t;
-
-typedef enum {
- PDQSNMP_EOL=0,
- PDQSNMP_FULL_DUPLEX_ENABLE=0x2F11
-} pdq_snmp_item_code_t;
-
-enum _pdq_boolean_t {
- PDQ_FALSE=0,
- PDQ_TRUE=1
-};
-
-typedef enum {
- PDQ_FILTER_BLOCK=0,
- PDQ_FILTER_PASS=1
-} pdq_filter_state_t;
-
-typedef enum {
- PDQ_STATION_TYPE_SAS=0,
- PDQ_STATION_TYPE_DAC=1,
- PDQ_STATION_TYPE_SAC=2,
- PDQ_STATION_TYPE_NAC=3,
- PDQ_STATION_TYPE_DAS=4
-} pdq_station_type_t;
-
-typedef enum {
- PDQ_STATION_STATE_OFF=0,
- PDQ_STATION_STATE_ON=1,
- PDQ_STATION_STATE_LOOPBACK=2
-} pdq_station_state_t;
-
-typedef enum {
- PDQ_LINK_STATE_OFF_READY=1,
- PDQ_LINK_STATE_OFF_FAULT_RECOVERY=2,
- PDQ_LINK_STATE_ON_RING_INIT=3,
- PDQ_LINK_STATE_ON_RING_RUN=4,
- PDQ_LINK_STATE_BROKEN=5
-} pdq_link_state_t;
-
-typedef enum {
- PDQ_DA_TEST_STATE_UNKNOWN=0,
- PDQ_DA_TEST_STATE_SUCCESS=1,
- PDQ_DA_TEST_STATE_DUPLICATE=2
-} pdq_da_test_state_t;
-
-typedef enum {
- PDQ_RING_PURGER_STATE_OFF=0,
- PDQ_RING_PURGER_STATE_CANDIDATE=1,
- PDQ_RING_PURGER_STATE_NON_PURGER=2,
- PDQ_RING_PURGER_STATE_PURGER=3
-} pdq_ring_purger_state_t;
-
-typedef enum {
- PDQ_FRAME_STRING_MODE_SA_MATCH=0,
- PDQ_FRAME_STRING_MODE_FCI_STRIP=1
-} pdq_frame_strip_mode_t;
-
-typedef enum {
- PDQ_RING_ERROR_REASON_NO_ERROR=0,
- PDQ_RING_ERROR_REASON_RING_INIT_INITIATED=5,
- PDQ_RING_ERROR_REASON_RING_INIT_RECEIVED=6,
- PDQ_RING_ERROR_REASON_RING_BEACONING_INITIATED=7,
- PDQ_RING_ERROR_REASON_DUPLICATE_ADDRESS_DETECTED=8,
- PDQ_RING_ERROR_REASON_DUPLICATE_TOKEN_DETECTED=9,
- PDQ_RING_ERROR_REASON_RING_PURGER_ERROR=10,
- PDQ_RING_ERROR_REASON_FCI_STRIP_ERROR=11,
- PDQ_RING_ERROR_REASON_RING_OP_OSCILLATION=12,
- PDQ_RING_ERROR_REASON_DIRECTED_BEACON_RECEVIED=13,
- PDQ_RING_ERROR_REASON_PC_TRACE_INITIATED=14,
- PDQ_RING_ERROR_REASON_PC_TRACE_RECEVIED=15
-} pdq_ring_error_reason_t;
-
-typedef enum {
- PDQ_STATION_MODE_NORMAL=0,
- PDQ_STATION_MODE_INTERNAL_LOOPBACK=1
-} pdq_station_mode_t;
-
-typedef enum {
- PDQ_PHY_TYPE_A=0,
- PDQ_PHY_TYPE_B=1,
- PDQ_PHY_TYPE_S=2,
- PDQ_PHY_TYPE_M=3,
- PDQ_PHY_TYPE_UNKNOWN=4
-} pdq_phy_type_t;
-
-typedef enum {
- PDQ_PMD_TYPE_ANSI_MUTLI_MODE=0,
- PDQ_PMD_TYPE_ANSI_SINGLE_MODE_TYPE_1=1,
- PDQ_PMD_TYPE_ANSI_SIGNLE_MODE_TYPE_2=2,
- PDQ_PMD_TYPE_ANSI_SONET=3,
- PDQ_PMD_TYPE_LOW_POWER=100,
- PDQ_PMD_TYPE_THINWIRE=101,
- PDQ_PMD_TYPE_SHIELDED_TWISTED_PAIR=102,
- PDQ_PMD_TYPE_UNSHIELDED_TWISTED_PAIR=103
-} pdq_pmd_type_t;
-
-typedef enum {
- PDQ_PMD_CLASS_ANSI_MULTI_MODE=0,
- PDQ_PMD_CLASS_SINGLE_MODE_TYPE_1=1,
- PDQ_PMD_CLASS_SINGLE_MODE_TYPE_2=2,
- PDQ_PMD_CLASS_SONET=3,
- PDQ_PMD_CLASS_LOW_COST_POWER_FIBER=4,
- PDQ_PMD_CLASS_TWISTED_PAIR=5,
- PDQ_PMD_CLASS_UNKNOWN=6,
- PDQ_PMD_CLASS_UNSPECIFIED=7
-} pdq_pmd_class_t;
-
-typedef enum {
- PDQ_PHY_STATE_INTERNAL_LOOPBACK=0,
- PDQ_PHY_STATE_BROKEN=1,
- PDQ_PHY_STATE_OFF_READY=2,
- PDQ_PHY_STATE_WAITING=3,
- PDQ_PHY_STATE_STARTING=4,
- PDQ_PHY_STATE_FAILED=5,
- PDQ_PHY_STATE_WATCH=6,
- PDQ_PHY_STATE_INUSE=7
-} pdq_phy_state_t;
-
-typedef enum {
- PDQ_REJECT_REASON_NONE=0,
- PDQ_REJECT_REASON_LOCAL_LCT=1,
- PDQ_REJECT_REASON_REMOTE_LCT=2,
- PDQ_REJECT_REASON_LCT_BOTH_SIDES=3,
- PDQ_REJECT_REASON_LEM_REJECT=4,
- PDQ_REJECT_REASON_TOPOLOGY_ERROR=5,
- PDQ_REJECT_REASON_NOISE_REJECT=6,
- PDQ_REJECT_REASON_REMOTE_REJECT=7,
- PDQ_REJECT_REASON_TRACE_IN_PROGRESS=8,
- PDQ_REJECT_REASON_TRACE_RECEIVED_DISABLED=9,
- PDQ_REJECT_REASON_STANDBY=10,
- PDQ_REJECT_REASON_LCT_PROTOCOL_ERROR=11
-} pdq_reject_reason_t;
-
-typedef enum {
- PDQ_BROKEN_REASON_NONE=0
-} pdq_broken_reason_t;
-
-typedef enum {
- PDQ_RI_REASON_TVX_EXPIRED=0,
- PDQ_RI_REASON_TRT_EXPIRED=1,
- PDQ_RI_REASON_RING_PURGER_ELECTION_ATTEMPT_LIMIT_EXCEEDED=2,
- PDQ_RI_REASON_PURGE_ERROR_LIMIT_EXCEEDED=3,
- PDQ_RI_REASON_RESTRICTED_TOKEN_TIMEOUT=4
-} pdq_ri_reason_t;
-
-typedef enum {
- PDQ_LCT_DIRECTION_LOCAL_LCT=0,
- PDQ_LCT_DIRECTION_REMOTE_LCT=1,
- PDQ_LCT_DIRECTION_LCT_BOTH_SIDES=2
-} pdq_lct_direction_t;
-
-typedef enum {
- PDQ_PORT_A=0,
- PDQ_PORT_B=1
-} pdq_port_type_t;
-
-typedef struct {
- pdq_uint8_t station_id_bytes[8];
-} pdq_station_id_t;
-
-typedef pdq_uint32_t pdq_fdditimer_t;
-/*
- * Command format for Start, Filter_Get, ... commands
- */
-typedef struct {
- pdq_cmd_code_t generic_op;
-} pdq_cmd_generic_t;
-
-/*
- * Response format for Start, Filter_Set, ... commands
- */
-typedef struct {
- pdq_uint32_t generic_reserved;
- pdq_cmd_code_t generic_op;
- pdq_response_code_t generic_status;
-} pdq_response_generic_t;
-
-/*
- * Command format for Filter_Set command
- */
-typedef struct {
- pdq_cmd_code_t filter_set_op;
- struct {
- pdq_item_code_t item_code;
- pdq_filter_state_t filter_state;
- } filter_set_items[7];
- pdq_item_code_t filter_set_eol_item_code;
-} pdq_cmd_filter_set_t;
-
-/*
- * Response format for Filter_Get command.
- */
-typedef struct {
- pdq_uint32_t filter_get_reserved;
- pdq_cmd_code_t filter_get_op;
- pdq_response_code_t filter_get_status;
- pdq_filter_state_t filter_get_ind_group_prom;
- pdq_filter_state_t filter_get_group_prom;
- pdq_filter_state_t filter_get_broadcast_all;
- pdq_filter_state_t filter_get_smt_prom;
- pdq_filter_state_t filter_get_smt_user;
- pdq_filter_state_t filter_get_reserved_all;
- pdq_filter_state_t filter_get_implementor_all;
-} pdq_response_filter_get_t;
-
-#define PDQ_SIZE_RESPONSE_FILTER_GET 0x28
-
-typedef struct {
- pdq_cmd_code_t chars_set_op;
- struct {
- pdq_item_code_t item_code;
- pdq_uint32_t item_value;
- pdq_port_type_t item_port;
- } chars_set_items[1];
- pdq_item_code_t chars_set_eol_item_code;
-} pdq_cmd_chars_set_t;
-
-typedef struct {
- pdq_cmd_code_t addr_filter_set_op;
- pdq_lanaddr_t addr_filter_set_addresses[62];
-} pdq_cmd_addr_filter_set_t;
-
-#define PDQ_SIZE_CMD_ADDR_FILTER_SET 0x1F4
-
-typedef struct {
- pdq_uint32_t addr_filter_get_reserved;
- pdq_cmd_code_t addr_filter_get_op;
- pdq_response_code_t addr_filter_get_status;
- pdq_lanaddr_t addr_filter_get_addresses[62];
-} pdq_response_addr_filter_get_t;
-
-#define PDQ_SIZE_RESPONSE_ADDR_FILTER_GET 0x1FC
-
-typedef struct {
- pdq_uint32_t status_chars_get_reserved;
- pdq_cmd_code_t status_chars_get_op;
- pdq_response_code_t status_chars_get_status;
- struct {
- /* Station Characteristic Attributes */
- pdq_station_id_t station_id;
- pdq_station_type_t station_type;
- pdq_uint32_t smt_version_id;
- pdq_uint32_t smt_max_version_id;
- pdq_uint32_t smt_min_version_id;
- /* Station Status Attributes */
- pdq_station_state_t station_state;
- /* Link Characteristic Attributes */
- pdq_lanaddr_t link_address;
- pdq_fdditimer_t t_req;
- pdq_fdditimer_t tvx;
- pdq_fdditimer_t restricted_token_timeout;
- pdq_boolean_t ring_purger_enable;
- pdq_link_state_t link_state;
- pdq_fdditimer_t negotiated_trt;
- pdq_da_test_state_t dup_addr_flag;
- /* Link Status Attributes */
- pdq_lanaddr_t upstream_neighbor;
- pdq_lanaddr_t old_upstream_neighbor;
- pdq_boolean_t upstream_neighbor_dup_addr_flag;
- pdq_lanaddr_t downstream_neighbor;
- pdq_lanaddr_t old_downstream_neighbor;
- pdq_ring_purger_state_t ring_purger_state;
- pdq_frame_strip_mode_t frame_strip_mode;
- pdq_ring_error_reason_t ring_error_reason;
- pdq_boolean_t loopback;
- pdq_fdditimer_t ring_latency;
- pdq_lanaddr_t last_dir_beacon_sa;
- pdq_lanaddr_t last_dir_beacon_una;
- /* Phy Characteristic Attributes */
- pdq_phy_type_t phy_type[2];
- pdq_pmd_type_t pmd_type[2];
- pdq_uint32_t lem_threshold[2];
- /* Phy Status Attributes */
- pdq_phy_state_t phy_state[2];
- pdq_phy_type_t neighbor_phy_type[2];
- pdq_uint32_t link_error_estimate[2];
- pdq_broken_reason_t broken_reason[2];
- pdq_reject_reason_t reject_reason[2];
- /* Miscellaneous */
- pdq_uint32_t counter_interval;
- pdq_fwrev_t module_rev;
- pdq_fwrev_t firmware_rev;
- pdq_uint32_t mop_device_type;
- pdq_uint32_t fddi_led[2];
- pdq_uint32_t flush;
- } status_chars_get;
-} pdq_response_status_chars_get_t;
-
-#define PDQ_SIZE_RESPONSE_STATUS_CHARS_GET 0xF0
-
-typedef struct {
- pdq_uint32_t fddi_mib_get_reserved;
- pdq_cmd_code_t fddi_mib_get_op;
- pdq_response_code_t fddi_mib_get_status;
- struct {
- /* SMT Objects */
- pdq_station_id_t smt_station_id;
- pdq_uint32_t smt_op_version_id;
- pdq_uint32_t smt_hi_version_id;
- pdq_uint32_t smt_lo_version_id;
- pdq_uint32_t smt_mac_ct;
- pdq_uint32_t smt_non_master_ct;
- pdq_uint32_t smt_master_ct;
- pdq_uint32_t smt_paths_available;
- pdq_uint32_t smt_config_capabilities;
- pdq_uint32_t smt_config_policy;
- pdq_uint32_t smt_connection_policy;
- pdq_uint32_t smt_t_notify;
- pdq_uint32_t smt_status_reporting;
- pdq_uint32_t smt_ecm_state;
- pdq_uint32_t smt_cf_state;
- pdq_uint32_t smt_hold_state;
- pdq_uint32_t smt_remote_disconnect_flag;
- pdq_uint32_t smt_station_action;
- /* MAC Objects */
- pdq_uint32_t mac_frame_status_capabilities;
- pdq_uint32_t mac_t_max_greatest_lower_bound;
- pdq_uint32_t mac_tvx_greatest_lower_bound;
- pdq_uint32_t mac_paths_available;
- pdq_uint32_t mac_current_path;
- pdq_lanaddr_t mac_upstream_neighbor;
- pdq_lanaddr_t mac_old_upstream_neighbor;
- pdq_uint32_t mac_dup_addr_test;
- pdq_uint32_t mac_paths_requested;
- pdq_uint32_t mac_downstream_port_type;
- pdq_lanaddr_t mac_smt_address;
- pdq_uint32_t mac_t_req;
- pdq_uint32_t mac_t_neg;
- pdq_uint32_t mac_t_max;
- pdq_uint32_t mac_tvx_value;
- pdq_uint32_t mac_t_min;
- pdq_uint32_t mac_current_frame_status;
- pdq_uint32_t mac_frame_error_threshold;
- pdq_uint32_t mac_frame_error_ratio;
- pdq_uint32_t mac_rmt_state;
- pdq_uint32_t mac_da_flag;
- pdq_uint32_t mac_una_da_flag;
- pdq_uint32_t mac_frame_condition;
- pdq_uint32_t mac_chip_set;
- pdq_uint32_t mac_action;
- /* Port Objects */
- pdq_uint32_t port_pc_type[2];
- pdq_uint32_t port_pc_neighbor[2];
- pdq_uint32_t port_connection_policies[2];
- pdq_uint32_t port_remote_mac_indicated[2];
- pdq_uint32_t port_ce_state[2];
- pdq_uint32_t port_paths_requested[2];
- pdq_uint32_t port_mac_placement[2];
- pdq_uint32_t port_available_paths[2];
- pdq_uint32_t port_mac_loop_time[2];
- pdq_uint32_t port_tb_max[2];
- pdq_uint32_t port_bs_flag[2];
- pdq_uint32_t port_ler_estimate[2];
- pdq_uint32_t port_ler_cutoff[2];
- pdq_uint32_t port_ler_alarm[2];
- pdq_uint32_t port_connect_state[2];
- pdq_uint32_t port_pcm_state[2];
- pdq_uint32_t port_pc_withhold[2];
- pdq_uint32_t port_ler_condition[2];
- pdq_uint32_t port_chip_set[2];
- pdq_uint32_t port_action[2];
- /* Attachment Objects */
- pdq_uint32_t attachment_class;
- pdq_uint32_t attachment_optical_bypass_present;
- pdq_uint32_t attachment_imax_expiration;
- pdq_uint32_t attachment_inserted_status;
- pdq_uint32_t attachment_insert_policy;
- } fddi_mib_get;
-} pdq_response_fddi_mib_get_t;
-
-#define PDQ_SIZE_RESPONSE_FDDI_MIB_GET 0x17C
-
-typedef enum {
- PDQ_FDX_STATE_IDLE=0,
- PDQ_FDX_STATE_REQUEST=1,
- PDQ_FDX_STATE_CONFIRM=2,
- PDQ_FDX_STATE_OPERATION=3
-} pdq_fdx_state_t;
-
-typedef struct {
- pdq_uint32_t dec_ext_mib_get_reserved;
- pdq_cmd_code_t dec_ext_mib_get_op;
- pdq_response_code_t dec_ext_mib_get_response;
- struct {
- /* SMT Objects */
- pdq_uint32_t esmt_station_type;
- /* MAC Objects */
- pdq_uint32_t emac_link_state;
- pdq_uint32_t emac_ring_purger_state;
- pdq_uint32_t emac_ring_purger_enable;
- pdq_uint32_t emac_frame_strip_mode;
- pdq_uint32_t emac_ring_error_reason;
- pdq_uint32_t emac_upstream_nbr_dupl_address_flag;
- pdq_uint32_t emac_restricted_token_timeout;
- /* Port Objects */
- pdq_uint32_t eport_pmd_type[2];
- pdq_uint32_t eport_phy_state[2];
- pdq_uint32_t eport_reject_reason[2];
- /* Full Duplex Objects */
- pdq_boolean_t fdx_enable;
- pdq_boolean_t fdx_operational;
- pdq_fdx_state_t fdx_state;
- } dec_ext_mib_get;
-} pdq_response_dec_ext_mib_get_t;
-
-#define PDQ_SIZE_RESPONSE_DEC_EXT_MIB_GET 0x50
-
-typedef struct {
- pdq_cmd_code_t snmp_set_op;
- struct {
- pdq_item_code_t item_code;
- pdq_uint32_t item_value;
- pdq_port_type_t item_port;
- } snmp_set_items[7];
- pdq_item_code_t snmp_set_eol_item_code;
-} pdq_cmd_snmp_set_t;
-
-typedef enum {
- PDQ_CALLER_ID_NONE=0,
- PDQ_CALLER_ID_SELFTEST=1,
- PDQ_CALLER_ID_MFG=2,
- PDQ_CALLER_ID_FIRMWARE=5,
- PDQ_CALLER_ID_CONSOLE=8
-} pdq_caller_id_t;
-
-typedef struct {
- pdq_uint32_t error_log_get__reserved;
- pdq_cmd_code_t error_log_get_op;
- pdq_response_code_t error_log_get_status;
- /* Error Header */
- pdq_uint32_t error_log_get_event_status;
- /* Event Information Block */
- pdq_caller_id_t error_log_get_caller_id;
- pdq_uint32_t error_log_get_timestamp[2];
- pdq_uint32_t error_log_get_write_count;
- /* Diagnostic Information */
- pdq_uint32_t error_log_get_fru_implication_mask;
- pdq_uint32_t error_log_get_test_id;
- pdq_uint32_t error_log_get_diag_reserved[6];
- /* Firmware Information */
- pdq_uint32_t error_log_get_fw_reserved[112];
-} pdq_response_error_log_get_t;
-
-
-/*
- * Definitions for the Unsolicited Event Queue.
- */
-typedef enum {
- PDQ_UNSOLICITED_EVENT=0,
- PDQ_UNSOLICITED_COUNTERS=1
-} pdq_event_t;
-
-typedef enum {
- PDQ_ENTITY_STATION=0,
- PDQ_ENTITY_LINK=1,
- PDQ_ENTITY_PHY_PORT=2,
- PDQ_ENTITY_MAX=3
-} pdq_entity_t;
-
-typedef enum {
- PDQ_STATION_EVENT_TRACE_RECEIVED=1,
- PDQ_STATION_EVENT_MAX=2
-} pdq_station_event_t;
-
-typedef enum {
- PDQ_STATION_EVENT_ARGUMENT_REASON=0, /* pdq_uint32_t */
- PDQ_STATION_EVENT_ARGUMENT_EOL=0xFF
-} pdq_station_event_argument_t;
-
-typedef enum {
- PDQ_LINK_EVENT_TRANSMIT_UNDERRUN=0,
- PDQ_LINK_EVENT_TRANSMIT_FAILED=1,
- PDQ_LINK_EVENT_BLOCK_CHECK_ERROR=2,
- PDQ_LINK_EVENT_FRAME_STATUS_ERROR=3,
- PDQ_LINK_EVENT_PDU_LENGTH_ERROR=4,
- PDQ_LINK_EVENT_RECEIVE_DATA_OVERRUN=7,
- PDQ_LINK_EVENT_NO_USER_BUFFER=9,
- PDQ_LINK_EVENT_RING_INITIALIZATION_INITIATED=10,
- PDQ_LINK_EVENT_RING_INITIALIZATION_RECEIVED=11,
- PDQ_LINK_EVENT_RING_BEACON_INITIATED=12,
- PDQ_LINK_EVENT_DUPLICATE_ADDRESS_FAILURE=13,
- PDQ_LINK_EVENT_DUPLICATE_TOKEN_DETECTED=14,
- PDQ_LINK_EVENT_RING_PURGE_ERROR=15,
- PDQ_LINK_EVENT_FCI_STRIP_ERROR=16,
- PDQ_LINK_EVENT_TRACE_INITIATED=17,
- PDQ_LINK_EVENT_DIRECTED_BEACON_RECEIVED=18,
- PDQ_LINK_EVENT_MAX=19
-} pdq_link_event_t;
-
-typedef enum {
- PDQ_LINK_EVENT_ARGUMENT_REASON=0, /* pdq_rireason_t */
- PDQ_LINK_EVENT_ARGUMENT_DATA_LINK_HEADER=1, /* pdq_dlhdr_t */
- PDQ_LINK_EVENT_ARGUMENT_SOURCE=2, /* pdq_lanaddr_t */
- PDQ_LINK_EVENT_ARGUMENT_UPSTREAM_NEIGHBOR=3,/* pdq_lanaddr_t */
- PDQ_LINK_EVENT_ARGUMENT_EOL=0xFF
-} pdq_link_event_argument_t;
-
-typedef enum {
- PDQ_PHY_EVENT_LEM_ERROR_MONITOR_REJECT=0,
- PDQ_PHY_EVENT_ELASTICITY_BUFFER_ERROR=1,
- PDQ_PHY_EVENT_LINK_CONFIDENCE_TEST_REJECT=2,
- PDQ_PHY_EVENT_MAX=3
-} pdq_phy_event_t;
-
-typedef enum {
- PDQ_PHY_EVENT_ARGUMENT_DIRECTION=0, /* pdq_lct_direction_t */
- PDQ_PHY_EVENT_ARGUMENT_EOL=0xFF
-} pdq_phy_event_arguments;
-
-struct _pdq_unsolicited_event_t {
- pdq_uint32_t rvent_reserved;
- pdq_event_t event_type;
- pdq_entity_t event_entity;
- pdq_uint32_t event_index;
- union {
- pdq_station_event_t station_event;
- pdq_link_event_t link_event;
- pdq_phy_event_t phy_event;
- pdq_uint32_t value;
- } event_code;
- /*
- * The remainder of this event is an argument list.
- */
- pdq_uint32_t event__filler[123];
-};
-
-#endif /* _PDQREG_H */
Index: sys/dev/pdq/pdqvar.h
===================================================================
--- sys/dev/pdq/pdqvar.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* $NetBSD: pdqvar.h,v 1.27 2000/05/03 19:17:54 thorpej Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Id: pdqvar.h,v 1.21 1997/03/21 21:16:04 thomas Exp
- * $FreeBSD$
- *
- */
-
-/*
- * DEC PDQ FDDI Controller; PDQ O/S dependent definitions
- *
- * Written by Matt Thomas
- *
- */
-
-#ifndef _PDQ_OS_H
-#define _PDQ_OS_H
-
-#define PDQ_OS_TX_TIMEOUT 5 /* seconds */
-
-typedef struct _pdq_t pdq_t;
-typedef struct _pdq_csrs_t pdq_csrs_t;
-typedef struct _pdq_pci_csrs_t pdq_pci_csrs_t;
-typedef struct _pdq_lanaddr_t pdq_lanaddr_t;
-typedef unsigned int pdq_uint32_t;
-typedef unsigned short pdq_uint16_t;
-typedef unsigned char pdq_uint8_t;
-typedef enum _pdq_boolean_t pdq_boolean_t;
-typedef enum _pdq_type_t pdq_type_t;
-typedef enum _pdq_state_t pdq_state_t;
-
-enum _pdq_type_t {
- PDQ_DEFPA, /* PCI-bus */
-};
-
-#if defined(PDQTEST)
-#include <pdq_os_test.h>
-#else
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#ifndef M_MCAST
-#include <sys/mbuf.h>
-#endif /* M_CAST */
-#include <sys/malloc.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#define PDQ_OS_PREFIX "%s: "
-#define PDQ_OS_PREFIX_ARGS pdq->pdq_os_name
-#define PDQ_OS_PAGESIZE PAGE_SIZE
-#define PDQ_OS_USEC_DELAY(n) DELAY(n)
-#define PDQ_OS_MEMZERO(p, n) bzero((caddr_t)(p), (n))
-#if !defined(PDQ_BUS_DMA)
-#define PDQ_OS_VA_TO_BUSPA(pdq, p) vtophys(p)
-#endif
-#define PDQ_OS_MEMALLOC(n) malloc(n, M_DEVBUF, M_NOWAIT)
-#define PDQ_OS_MEMFREE(p, n) free((void *) p, M_DEVBUF)
-#define PDQ_OS_MEMALLOC_CONTIG(n) contigmalloc(n, M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0)
-#define PDQ_OS_MEMFREE_CONTIG(p, n) contigfree((void *) p, n, M_DEVBUF)
-
-#include <vm/pmap.h>
-#include <vm/vm_extern.h>
-#include <machine/cpufunc.h>
-#define ifnet_ret_t void
-typedef int ioctl_cmd_t;
-typedef enum { PDQ_BUS_EISA, PDQ_BUS_PCI } pdq_bus_t;
-typedef u_int16_t pdq_bus_ioport_t;
-typedef volatile pdq_uint32_t *pdq_bus_memaddr_t;
-typedef pdq_bus_memaddr_t pdq_bus_memoffset_t;
-#define pdq_os_update_status(a, b) ((void) 0)
-
-
-#if !defined(PDQ_OS_SPL_RAISE)
-#define PDQ_OS_SPL_RAISE() splimp()
-#endif
-
-#if !defined(PDQ_OS_SPL_LOWER)
-#define PDQ_OS_SPL_LOWER(s) splx(s)
-#endif
-
-#if !defined(PDQ_FDDICOM)
-#define PDQ_FDDICOM(sc) (&(sc)->sc_ac)
-#endif
-
-#if !defined(PDQ_IFNET)
-#define PDQ_IFNET(sc) (PDQ_FDDICOM((sc))->ac_ifp)
-#endif
-
-#define PDQ_BPF_MTAP(sc, m) bpf_mtap(PDQ_IFNET(sc), m)
-#define PDQ_BPFATTACH(sc, t, s) bpfattach(PDQ_IFNET(sc), t, s)
-
-#if !defined(PDQ_ARP_IFINIT)
-#define PDQ_ARP_IFINIT(sc, ifa) arp_ifinit(&(sc)->sc_ac, (ifa))
-#endif
-
-#if !defined(PDQ_OS_PTR_FMT)
-#define PDQ_OS_PTR_FMT "0x%x"
-#endif
-
-#if !defined(PDQ_OS_CSR_FMT)
-#define PDQ_OS_CSR_FMT "0x%x"
-#endif
-
-#if !defined(PDQ_LANADDR)
-#define PDQ_LANADDR(sc) ((sc)->sc_ac.ac_enaddr)
-#define PDQ_LANADDR_SIZE(sc) (sizeof((sc)->sc_ac.ac_enaddr))
-#endif
-
-#if !defined(PDQ_OS_IOMEM)
-#define PDQ_OS_IORD_32(t, base, offset) inl((base) + (offset))
-#define PDQ_OS_IOWR_32(t, base, offset, data) outl((base) + (offset), data)
-#define PDQ_OS_IORD_8(t, base, offset) inb((base) + (offset))
-#define PDQ_OS_IOWR_8(t, base, offset, data) outb((base) + (offset), data)
-#define PDQ_OS_MEMRD_32(t, base, offset) (0 + *((base) + (offset)))
-#define PDQ_OS_MEMWR_32(t, base, offset, data) do *((base) + (offset)) = (data); while (0)
-#endif
-#ifndef PDQ_CSR_OFFSET
-#define PDQ_CSR_OFFSET(base, offset) (0 + (base) + (offset))
-#endif
-
-#ifndef PDQ_CSR_WRITE
-#define PDQ_CSR_WRITE(csr, name, data) PDQ_OS_MEMWR_32((csr)->csr_bus, (csr)->name, 0, data)
-#define PDQ_CSR_READ(csr, name) PDQ_OS_MEMRD_32((csr)->csr_bus, (csr)->name, 0)
-#endif
-
-#ifndef PDQ_OS_IFP_TO_SOFTC
-#define PDQ_OS_IFP_TO_SOFTC(ifp) ((pdq_softc_t *) ((caddr_t) ifp - offsetof(pdq_softc_t, sc_ac.ac_if)))
-#endif
-
-
-#if !defined(PDQ_HWSUPPORT)
-
-typedef struct _pdq_os_ctx_t {
- struct kern_devconf *sc_kdc; /* freebsd cruft */
- struct arpcom sc_ac;
-#if defined(IFM_FDDI)
- struct ifmedia sc_ifmedia;
-#endif
- pdq_t *sc_pdq;
-#if defined(__i386__)
- pdq_bus_ioport_t sc_iobase;
-#endif
-#if defined(PDQ_IOMAPPED)
-#define sc_membase sc_iobase
-#else
- pdq_bus_memaddr_t sc_membase;
-#endif
- pdq_bus_t sc_iotag;
- pdq_bus_t sc_csrtag;
- caddr_t sc_bpf;
-#if defined(PDQ_BUS_DMA)
- bus_dma_tag_t sc_dmatag;
- bus_dmamap_t sc_dbmap; /* DMA map for descriptor block */
- bus_dmamap_t sc_uimap; /* DMA map for unsolicited events */
- bus_dmamap_t sc_cbmap; /* DMA map for consumer block */
-#endif
-} pdq_softc_t;
-
-
-extern void pdq_ifreset(pdq_softc_t *sc);
-extern void pdq_ifinit(pdq_softc_t *sc);
-extern void pdq_ifwatchdog(struct ifnet *ifp);
-extern ifnet_ret_t pdq_ifstart(struct ifnet *ifp);
-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 (*ifwatchdog)(int unit));
-#endif /* !PDQ_HWSUPPORT */
-
-
-#endif
-
-
-#define PDQ_OS_DATABUF_SIZE (MCLBYTES)
-#ifndef PDQ_OS_DATABUF_FREE
-#define PDQ_OS_DATABUF_FREE(pdq, b) (m_freem(b))
-#endif
-#define PDQ_OS_DATABUF_NEXT(b) ((b)->m_next)
-#define PDQ_OS_DATABUF_NEXT_SET(b, b1) ((b)->m_next = (b1))
-#define PDQ_OS_DATABUF_NEXTPKT(b) ((b)->m_nextpkt)
-#define PDQ_OS_DATABUF_NEXTPKT_SET(b, b1) ((b)->m_nextpkt = (b1))
-#define PDQ_OS_DATABUF_LEN(b) ((b)->m_len)
-#define PDQ_OS_DATABUF_LEN_SET(b, n) ((b)->m_len = (n))
-/* #define PDQ_OS_DATABUF_LEN_ADJ(b, n) ((b)->m_len += (n)) */
-#define PDQ_OS_DATABUF_PTR(b) (mtod((b), pdq_uint8_t *))
-#define PDQ_OS_DATABUF_ADJ(b, n) ((b)->m_data += (n), (b)->m_len -= (n))
-typedef struct mbuf PDQ_OS_DATABUF_T;
-
-#ifndef PDQ_OS_DATABUF_ALLOC
-#define PDQ_OS_DATABUF_ALLOC(pdq, b) do { \
- PDQ_OS_DATABUF_T *x_m0; \
- MGETHDR(x_m0, M_NOWAIT, MT_DATA); \
- if (x_m0 != NULL) { \
- if (!(MCLGET(x_m0, M_NOWAIT))) { \
- m_free(x_m0); \
- (b) = NULL; \
- } else { \
- (b) = x_m0; \
- x_m0->m_len = PDQ_OS_DATABUF_SIZE; \
- } \
- } else { \
- (b) = NULL; \
- } \
-} while (0)
-#endif
-#define PDQ_OS_DATABUF_RESET(b) ((b)->m_data = (b)->m_ext.ext_buf, (b)->m_len = MCLBYTES)
-
-#define PDQ_OS_TX_TRANSMIT 5
-
-#define PDQ_OS_DATABUF_ENQUEUE(q, b) do { \
- PDQ_OS_DATABUF_NEXTPKT_SET(b, NULL); \
- if ((q)->q_tail == NULL) \
- (q)->q_head = (b); \
- else \
- PDQ_OS_DATABUF_NEXTPKT_SET(((PDQ_OS_DATABUF_T *)(q)->q_tail), b); \
- (q)->q_tail = (b); \
-} while (0)
-
-#define PDQ_OS_DATABUF_DEQUEUE(q, b) do { \
- if (((b) = (PDQ_OS_DATABUF_T *) (q)->q_head) != NULL) { \
- if (((q)->q_head = PDQ_OS_DATABUF_NEXTPKT(b)) == NULL) \
- (q)->q_tail = NULL; \
- PDQ_OS_DATABUF_NEXTPKT_SET(b, NULL); \
- } \
-} while (0)
-
-#if !defined(PDQ_OS_CONSUMER_PRESYNC)
-#define PDQ_OS_CONSUMER_PRESYNC(pdq) do { } while(0)
-#define PDQ_OS_CONSUMER_POSTSYNC(pdq) do { } while(0)
-#define PDQ_OS_DESC_PRESYNC(pdq, d, s) do { } while(0)
-#define PDQ_OS_DESC_POSTSYNC(pdq, d, s) do { } while(0)
-#define PDQ_OS_CMDRQST_PRESYNC(pdq, s) do { } while(0)
-#define PDQ_OS_CMDRQST_POSTSYNC(pdq, s) do { } while(0)
-#define PDQ_OS_CMDRSP_PRESYNC(pdq, s) do { } while(0)
-#define PDQ_OS_CMDRSP_POSTSYNC(pdq, s) do { } while(0)
-#define PDQ_OS_RXPDU_PRESYNC(pdq, b, o, l) do { } while(0)
-#define PDQ_OS_RXPDU_POSTSYNC(pdq, b, o, l) do { } while(0)
-#define PDQ_OS_UNSOL_EVENT_PRESYNC(pdq, e) do { } while(0)
-#define PDQ_OS_UNSOL_EVENT_POSTSYNC(pdq, e) do { } while(0)
-#endif
-
-#ifndef PDQ_OS_DATABUF_BUSPA
-#define PDQ_OS_DATABUF_BUSPA(pdq, b) PDQ_OS_VA_TO_BUSPA(pdq, PDQ_OS_DATABUF_PTR(b))
-#endif
-
-#ifndef PDQ_OS_HDR_OFFSET
-#define PDQ_OS_HDR_OFFSET PDQ_RX_FC_OFFSET
-#endif
-
-extern void pdq_os_addr_fill(pdq_t *pdq, pdq_lanaddr_t *addrs, size_t numaddrs);
-extern void pdq_os_receive_pdu(pdq_t *, PDQ_OS_DATABUF_T *pdu, size_t pdulen, int drop);
-extern void pdq_os_restart_transmitter(pdq_t *pdq);
-extern void pdq_os_transmit_done(pdq_t *pdq, PDQ_OS_DATABUF_T *pdu);
-#if !defined(pdq_os_update_status)
-extern void pdq_os_update_status(pdq_t *pdq, const void *rsp);
-#endif
-#if !defined(PDQ_OS_MEMALLOC_CONTIG)
-extern int pdq_os_memalloc_contig(pdq_t *pdq);
-#endif
-extern pdq_boolean_t pdq_queue_transmit_data(pdq_t *pdq, PDQ_OS_DATABUF_T *pdu);
-extern void pdq_flush_transmitter(pdq_t *pdq);
-
-extern void pdq_run(pdq_t *pdq);
-extern pdq_state_t pdq_stop(pdq_t *pdq);
-extern void pdq_hwreset(pdq_t *pdq);
-
-extern int pdq_interrupt(pdq_t *pdq);
-extern pdq_t *pdq_initialize(pdq_bus_t bus, pdq_bus_memaddr_t csr_va,
- const char *name, int unit,
- void *ctx, pdq_type_t type);
-#endif /* _PDQ_OS_H */
Index: sys/net/fddi.h
===================================================================
--- sys/net/fddi.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- * Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * 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.
- *
- * @(#)if_fddi.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD$
- */
-
-#ifndef _NETINET_IF_FDDI_H_
-#define _NETINET_IF_FDDI_H_
-
-#define FDDIIPMTU 4352
-#define FDDIMTU 4470
-#define FDDIMIN 3
-
-#define FDDIFC_C 0x80 /* 0b10000000 */
-#define FDDIFC_L 0x40 /* 0b01000000 */
-#define FDDIFC_F 0x30 /* 0b00110000 */
-#define FDDIFC_Z 0x0F /* 0b00001111 */
-#define FDDIFC_CLFF 0xF0 /* Class/Length/Format bits */
-#define FDDIFC_ZZZZ 0x0F /* Control bits */
-
-/*
- * FDDI Frame Control values. (48-bit addressing only).
- */
-#define FDDIFC_VOID 0x40 /* Void frame */
-#define FDDIFC_NRT 0x80 /* Nonrestricted token */
-#define FDDIFC_RT 0xc0 /* Restricted token */
-#define FDDIFC_MAC_BEACON 0xc2 /* MAC Beacon frame */
-#define FDDIFC_MAC_CLAIM 0xc3 /* MAC Claim frame */
-#define FDDIFC_LLC_ASYNC 0x50
-#define FDDIFC_LLC_PRIO0 0
-#define FDDIFC_LLC_PRIO1 1
-#define FDDIFC_LLC_PRIO2 2
-#define FDDIFC_LLC_PRIO3 3
-#define FDDIFC_LLC_PRIO4 4
-#define FDDIFC_LLC_PRIO5 5
-#define FDDIFC_LLC_PRIO6 6
-#define FDDIFC_LLC_PRIO7 7
-#define FDDIFC_LLC_SYNC 0xd0
-#define FDDIFC_IMP_ASYNC 0x60 /* Implementor Async. */
-#define FDDIFC_IMP_SYNC 0xe0 /* Implementor Synch. */
-#define FDDIFC_SMT 0x40
-#define FDDIFC_SMT_INFO 0x41 /* SMT Info */
-#define FDDIFC_SMT_NSA 0x4F /* SMT Next station adrs */
-#define FDDIFC_MAC 0xc0 /* MAC frame */
-
-#define FDDI_ADDR_LEN 6
-#define FDDI_HDR_LEN (sizeof(struct fddi_header))
-
-/*
- * Structure of an 100Mb/s FDDI header.
- */
-struct fddi_header {
- u_char fddi_fc;
- u_char fddi_dhost[FDDI_ADDR_LEN];
- u_char fddi_shost[FDDI_ADDR_LEN];
-};
-
-#if defined(_KERNEL)
-#define fddi_ipmulticast_min ether_ipmulticast_min
-#define fddi_ipmulticast_max ether_ipmulticast_max
-#define fddi_addmulti ether_addmulti
-#define fddi_delmulti ether_delmulti
-#define fddi_sprintf ether_sprintf
-
-#define FDDI_BPF_UNSUPPORTED 0
-#define FDDI_BPF_SUPPORTED 1
-
-void fddi_ifattach(struct ifnet *, const u_int8_t *, int);
-void fddi_ifdetach(struct ifnet *, int);
-int fddi_ioctl(struct ifnet *, u_long, caddr_t);
-
-#endif /* _KERNEL */
-#endif /* _NET_FDDI_H_ */
Index: sys/net/if.c
===================================================================
--- sys/net/if.c
+++ sys/net/if.c
@@ -3692,7 +3692,6 @@
}
switch (ifp->if_type) {
case IFT_ETHER:
- case IFT_FDDI:
case IFT_XETHER:
case IFT_L2VLAN:
case IFT_BRIDGE:
Index: sys/net/if_bridge.c
===================================================================
--- sys/net/if_bridge.c
+++ sys/net/if_bridge.c
@@ -72,8 +72,8 @@
*
* - Currently only supports Ethernet-like interfaces (Ethernet,
* 802.11, VLANs on Ethernet, etc.) Figure out a nice way
- * to bridge other types of interfaces (FDDI-FDDI, and maybe
- * consider heterogeneous bridges).
+ * to bridge other types of interfaces (maybe consider
+ * heterogeneous bridges).
*/
#include <sys/cdefs.h>
Index: sys/net/if_fddisubr.c
===================================================================
--- sys/net/if_fddisubr.c
+++ /dev/null
@@ -1,667 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1995, 1996
- * Matt Thomas <matt@3am-software.com>. All rights reserved.
- * Copyright (c) 1982, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * 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.
- *
- * from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp
- * $FreeBSD$
- */
-
-#include "opt_inet.h"
-#include "opt_inet6.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_dl.h>
-#include <net/if_llc.h>
-#include <net/if_types.h>
-#include <net/if_llatbl.h>
-
-#include <net/ethernet.h>
-#include <net/netisr.h>
-#include <net/route.h>
-#include <net/bpf.h>
-#include <net/fddi.h>
-
-#if defined(INET) || defined(INET6)
-#include <netinet/in.h>
-#include <netinet/in_var.h>
-#include <netinet/if_ether.h>
-#endif
-#ifdef INET6
-#include <netinet6/nd6.h>
-#endif
-
-#ifdef DECNET
-#include <netdnet/dn.h>
-#endif
-
-#include <security/mac/mac_framework.h>
-
-static const u_char fddibroadcastaddr[FDDI_ADDR_LEN] =
- { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-static int fddi_resolvemulti(struct ifnet *, struct sockaddr **,
- struct sockaddr *);
-static int fddi_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
- struct route *);
-static void fddi_input(struct ifnet *ifp, struct mbuf *m);
-
-#define senderr(e) do { error = (e); goto bad; } while (0)
-
-/*
- * FDDI output routine.
- * Encapsulate a packet of type family for the local net.
- * Use trailer local net encapsulation if enough data in first
- * packet leaves a multiple of 512 bytes of data in remainder.
- */
-static int
-fddi_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
- struct route *ro)
-{
- u_int16_t type;
- int loop_copy = 0, error = 0, hdrcmplt = 0;
- u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN];
- struct fddi_header *fh;
-#if defined(INET) || defined(INET6)
- int is_gw = 0;
-#endif
-
-#ifdef MAC
- error = mac_ifnet_check_transmit(ifp, m);
- if (error)
- senderr(error);
-#endif
-
- if (ifp->if_flags & IFF_MONITOR)
- senderr(ENETDOWN);
- if (!((ifp->if_flags & IFF_UP) &&
- (ifp->if_drv_flags & IFF_DRV_RUNNING)))
- senderr(ENETDOWN);
- getmicrotime(&ifp->if_lastchange);
-
-#if defined(INET) || defined(INET6)
- if (ro != NULL)
- is_gw = (ro->ro_flags & RT_HAS_GW) != 0;
-#endif
-
- switch (dst->sa_family) {
-#ifdef INET
- case AF_INET: {
- error = arpresolve(ifp, is_gw, m, dst, edst, NULL, NULL);
- if (error)
- return (error == EWOULDBLOCK ? 0 : error);
- type = htons(ETHERTYPE_IP);
- break;
- }
- case AF_ARP:
- {
- struct arphdr *ah;
- ah = mtod(m, struct arphdr *);
- ah->ar_hrd = htons(ARPHRD_ETHER);
-
- loop_copy = -1; /* if this is for us, don't do it */
-
- switch (ntohs(ah->ar_op)) {
- case ARPOP_REVREQUEST:
- case ARPOP_REVREPLY:
- type = htons(ETHERTYPE_REVARP);
- break;
- case ARPOP_REQUEST:
- case ARPOP_REPLY:
- default:
- type = htons(ETHERTYPE_ARP);
- break;
- }
-
- if (m->m_flags & M_BCAST)
- bcopy(ifp->if_broadcastaddr, edst, FDDI_ADDR_LEN);
- else
- bcopy(ar_tha(ah), edst, FDDI_ADDR_LEN);
-
- }
- break;
-#endif /* INET */
-#ifdef INET6
- case AF_INET6:
- error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL, NULL);
- if (error)
- return (error == EWOULDBLOCK ? 0 : error);
- type = htons(ETHERTYPE_IPV6);
- break;
-#endif /* INET6 */
- case pseudo_AF_HDRCMPLT:
- {
- const struct ether_header *eh;
-
- hdrcmplt = 1;
- eh = (const struct ether_header *)dst->sa_data;
- bcopy(eh->ether_shost, esrc, FDDI_ADDR_LEN);
- /* FALLTHROUGH */
- }
-
- case AF_UNSPEC:
- {
- const struct ether_header *eh;
-
- loop_copy = -1;
- eh = (const struct ether_header *)dst->sa_data;
- bcopy(eh->ether_dhost, edst, FDDI_ADDR_LEN);
- if (*edst & 1)
- m->m_flags |= (M_BCAST|M_MCAST);
- type = eh->ether_type;
- break;
- }
-
- case AF_IMPLINK:
- {
- fh = mtod(m, struct fddi_header *);
- error = EPROTONOSUPPORT;
- switch (fh->fddi_fc & (FDDIFC_C|FDDIFC_L|FDDIFC_F)) {
- case FDDIFC_LLC_ASYNC: {
- /* legal priorities are 0 through 7 */
- if ((fh->fddi_fc & FDDIFC_Z) > 7)
- goto bad;
- break;
- }
- case FDDIFC_LLC_SYNC: {
- /* FDDIFC_Z bits reserved, must be zero */
- if (fh->fddi_fc & FDDIFC_Z)
- goto bad;
- break;
- }
- case FDDIFC_SMT: {
- /* FDDIFC_Z bits must be non zero */
- if ((fh->fddi_fc & FDDIFC_Z) == 0)
- goto bad;
- break;
- }
- default: {
- /* anything else is too dangerous */
- goto bad;
- }
- }
- error = 0;
- if (fh->fddi_dhost[0] & 1)
- m->m_flags |= (M_BCAST|M_MCAST);
- goto queue_it;
- }
- default:
- if_printf(ifp, "can't handle af%d\n", dst->sa_family);
- senderr(EAFNOSUPPORT);
- }
-
- /*
- * Add LLC header.
- */
- if (type != 0) {
- struct llc *l;
- M_PREPEND(m, LLC_SNAPFRAMELEN, M_NOWAIT);
- if (m == NULL)
- senderr(ENOBUFS);
- l = mtod(m, struct llc *);
- l->llc_control = LLC_UI;
- l->llc_dsap = l->llc_ssap = LLC_SNAP_LSAP;
- l->llc_snap.org_code[0] =
- l->llc_snap.org_code[1] =
- l->llc_snap.org_code[2] = 0;
- l->llc_snap.ether_type = htons(type);
- }
-
- /*
- * Add local net header. If no space in first mbuf,
- * allocate another.
- */
- M_PREPEND(m, FDDI_HDR_LEN, M_NOWAIT);
- if (m == NULL)
- senderr(ENOBUFS);
- fh = mtod(m, struct fddi_header *);
- fh->fddi_fc = FDDIFC_LLC_ASYNC|FDDIFC_LLC_PRIO4;
- bcopy((caddr_t)edst, (caddr_t)fh->fddi_dhost, FDDI_ADDR_LEN);
- queue_it:
- if (hdrcmplt)
- bcopy((caddr_t)esrc, (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN);
- else
- bcopy(IF_LLADDR(ifp), (caddr_t)fh->fddi_shost,
- FDDI_ADDR_LEN);
-
- /*
- * If a simplex interface, and the packet is being sent to our
- * Ethernet address or a broadcast address, loopback a copy.
- * XXX To make a simplex device behave exactly like a duplex
- * device, we should copy in the case of sending to our own
- * ethernet address (thus letting the original actually appear
- * on the wire). However, we don't do that here for security
- * reasons and compatibility with the original behavior.
- */
- if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
- if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
- struct mbuf *n;
- n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
- (void) if_simloop(ifp, n, dst->sa_family,
- FDDI_HDR_LEN);
- } else if (bcmp(fh->fddi_dhost, fh->fddi_shost,
- FDDI_ADDR_LEN) == 0) {
- (void) if_simloop(ifp, m, dst->sa_family,
- FDDI_HDR_LEN);
- return (0); /* XXX */
- }
- }
-
- error = (ifp->if_transmit)(ifp, m);
- if (error)
- if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-
- return (error);
-
-bad:
- if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
- if (m)
- m_freem(m);
- return (error);
-}
-
-/*
- * Process a received FDDI packet.
- */
-static void
-fddi_input(ifp, m)
- struct ifnet *ifp;
- struct mbuf *m;
-{
- int isr;
- struct llc *l;
- struct fddi_header *fh;
-
- /*
- * Do consistency checks to verify assumptions
- * made by code past this point.
- */
- if ((m->m_flags & M_PKTHDR) == 0) {
- if_printf(ifp, "discard frame w/o packet header\n");
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- m_freem(m);
- return;
- }
- if (m->m_pkthdr.rcvif == NULL) {
- if_printf(ifp, "discard frame w/o interface pointer\n");
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- m_freem(m);
- return;
- }
-
- m = m_pullup(m, FDDI_HDR_LEN);
- if (m == NULL) {
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- goto dropanyway;
- }
- fh = mtod(m, struct fddi_header *);
-
- /*
- * Discard packet if interface is not up.
- */
- if (!((ifp->if_flags & IFF_UP) &&
- (ifp->if_drv_flags & IFF_DRV_RUNNING)))
- goto dropanyway;
-
- /*
- * Give bpf a chance at the packet.
- */
- BPF_MTAP(ifp, m);
-
- /*
- * Interface marked for monitoring; discard packet.
- */
- if (ifp->if_flags & IFF_MONITOR) {
- m_freem(m);
- return;
- }
-
-#ifdef MAC
- mac_ifnet_create_mbuf(ifp, m);
-#endif
-
- /*
- * Update interface statistics.
- */
- if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
- getmicrotime(&ifp->if_lastchange);
-
- /*
- * Discard non local unicast packets when interface
- * is in promiscuous mode.
- */
- if ((ifp->if_flags & IFF_PROMISC) && ((fh->fddi_dhost[0] & 1) == 0) &&
- (bcmp(IF_LLADDR(ifp), (caddr_t)fh->fddi_dhost,
- FDDI_ADDR_LEN) != 0))
- goto dropanyway;
-
- /*
- * Set mbuf flags for bcast/mcast.
- */
- if (fh->fddi_dhost[0] & 1) {
- if (bcmp(ifp->if_broadcastaddr, fh->fddi_dhost,
- FDDI_ADDR_LEN) == 0)
- m->m_flags |= M_BCAST;
- else
- m->m_flags |= M_MCAST;
- if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
- }
-
-#ifdef M_LINK0
- /*
- * If this has a LLC priority of 0, then mark it so upper
- * layers have a hint that it really came via a FDDI/Ethernet
- * bridge.
- */
- if ((fh->fddi_fc & FDDIFC_LLC_PRIO7) == FDDIFC_LLC_PRIO0)
- m->m_flags |= M_LINK0;
-#endif
-
- /* Strip off FDDI header. */
- m_adj(m, FDDI_HDR_LEN);
-
- m = m_pullup(m, LLC_SNAPFRAMELEN);
- if (m == NULL) {
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- goto dropanyway;
- }
- l = mtod(m, struct llc *);
-
- switch (l->llc_dsap) {
- case LLC_SNAP_LSAP:
- {
- u_int16_t type;
- if ((l->llc_control != LLC_UI) ||
- (l->llc_ssap != LLC_SNAP_LSAP)) {
- if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
- goto dropanyway;
- }
- if (l->llc_snap.org_code[0] != 0 ||
- l->llc_snap.org_code[1] != 0 ||
- l->llc_snap.org_code[2] != 0) {
- if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
- goto dropanyway;
- }
-
- type = ntohs(l->llc_snap.ether_type);
- m_adj(m, LLC_SNAPFRAMELEN);
-
- switch (type) {
-#ifdef INET
- case ETHERTYPE_IP:
- isr = NETISR_IP;
- break;
-
- case ETHERTYPE_ARP:
- if (ifp->if_flags & IFF_NOARP)
- goto dropanyway;
- isr = NETISR_ARP;
- break;
-#endif
-#ifdef INET6
- case ETHERTYPE_IPV6:
- isr = NETISR_IPV6;
- break;
-#endif
-#ifdef DECNET
- case ETHERTYPE_DECNET:
- isr = NETISR_DECNET;
- break;
-#endif
- default:
- /* printf("fddi_input: unknown protocol 0x%x\n", type); */
- if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
- goto dropanyway;
- }
- break;
- }
-
- default:
- /* printf("fddi_input: unknown dsap 0x%x\n", l->llc_dsap); */
- if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
- goto dropanyway;
- }
- M_SETFIB(m, ifp->if_fib);
- netisr_dispatch(isr, m);
- return;
-
-dropanyway:
- if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
- if (m)
- m_freem(m);
- return;
-}
-
-/*
- * Perform common duties while attaching to interface list
- */
-void
-fddi_ifattach(ifp, lla, bpf)
- struct ifnet *ifp;
- const u_int8_t *lla;
- int bpf;
-{
- struct ifaddr *ifa;
- struct sockaddr_dl *sdl;
-
- ifp->if_type = IFT_FDDI;
- ifp->if_addrlen = FDDI_ADDR_LEN;
- ifp->if_hdrlen = 21;
-
- if_attach(ifp); /* Must be called before additional assignments */
-
- ifp->if_mtu = FDDIMTU;
- ifp->if_output = fddi_output;
- ifp->if_input = fddi_input;
- ifp->if_resolvemulti = fddi_resolvemulti;
- ifp->if_broadcastaddr = fddibroadcastaddr;
- ifp->if_baudrate = 100000000;
-#ifdef IFF_NOTRAILERS
- ifp->if_flags |= IFF_NOTRAILERS;
-#endif
- ifa = ifp->if_addr;
- KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
-
- sdl = (struct sockaddr_dl *)ifa->ifa_addr;
- sdl->sdl_type = IFT_FDDI;
- sdl->sdl_alen = ifp->if_addrlen;
- bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
-
- if (bpf)
- bpfattach(ifp, DLT_FDDI, FDDI_HDR_LEN);
-
- return;
-}
-
-void
-fddi_ifdetach(ifp, bpf)
- struct ifnet *ifp;
- int bpf;
-{
-
- if (bpf)
- bpfdetach(ifp);
-
- if_detach(ifp);
-
- return;
-}
-
-int
-fddi_ioctl (ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct ifaddr *ifa;
- struct ifreq *ifr;
- int error;
-
- ifa = (struct ifaddr *) data;
- ifr = (struct ifreq *) data;
- error = 0;
-
- switch (command) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET: /* before arpwhohas */
- ifp->if_init(ifp->if_softc);
- arp_ifinit(ifp, ifa);
- break;
-#endif
- default:
- ifp->if_init(ifp->if_softc);
- break;
- }
- break;
- case SIOCGIFADDR:
- bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
- FDDI_ADDR_LEN);
- break;
- case SIOCSIFMTU:
- /*
- * Set the interface MTU.
- */
- if (ifr->ifr_mtu > FDDIMTU) {
- error = EINVAL;
- } else {
- ifp->if_mtu = ifr->ifr_mtu;
- }
- break;
- default:
- error = EINVAL;
- break;
- }
-
- return (error);
-}
-
-static int
-fddi_resolvemulti(ifp, llsa, sa)
- struct ifnet *ifp;
- struct sockaddr **llsa;
- struct sockaddr *sa;
-{
- struct sockaddr_dl *sdl;
-#ifdef INET
- struct sockaddr_in *sin;
-#endif
-#ifdef INET6
- struct sockaddr_in6 *sin6;
-#endif
- u_char *e_addr;
-
- switch(sa->sa_family) {
- case AF_LINK:
- /*
- * No mapping needed. Just check that it's a valid MC address.
- */
- sdl = (struct sockaddr_dl *)sa;
- e_addr = LLADDR(sdl);
- if ((e_addr[0] & 1) != 1)
- return (EADDRNOTAVAIL);
- *llsa = NULL;
- return (0);
-
-#ifdef INET
- case AF_INET:
- sin = (struct sockaddr_in *)sa;
- if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
- return (EADDRNOTAVAIL);
- sdl = link_init_sdl(ifp, *llsa, IFT_FDDI);
- sdl->sdl_nlen = 0;
- sdl->sdl_alen = FDDI_ADDR_LEN;
- sdl->sdl_slen = 0;
- e_addr = LLADDR(sdl);
- ETHER_MAP_IP_MULTICAST(&sin->sin_addr, e_addr);
- *llsa = (struct sockaddr *)sdl;
- return (0);
-#endif
-#ifdef INET6
- case AF_INET6:
- sin6 = (struct sockaddr_in6 *)sa;
- if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
- /*
- * An IP6 address of 0 means listen to all
- * of the Ethernet multicast address used for IP6.
- * (This is used for multicast routers.)
- */
- ifp->if_flags |= IFF_ALLMULTI;
- *llsa = NULL;
- return (0);
- }
- if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
- return (EADDRNOTAVAIL);
- sdl = link_init_sdl(ifp, *llsa, IFT_FDDI);
- sdl->sdl_nlen = 0;
- sdl->sdl_alen = FDDI_ADDR_LEN;
- sdl->sdl_slen = 0;
- e_addr = LLADDR(sdl);
- ETHER_MAP_IPV6_MULTICAST(&sin6->sin6_addr, e_addr);
- *llsa = (struct sockaddr *)sdl;
- return (0);
-#endif
-
- default:
- /*
- * Well, the text isn't quite right, but it's the name
- * that counts...
- */
- return (EAFNOSUPPORT);
- }
-
- return (0);
-}
-
-static moduledata_t fddi_mod = {
- "fddi", /* module name */
- NULL, /* event handler */
- 0 /* extra data */
-};
-
-DECLARE_MODULE(fddi, fddi_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
-MODULE_VERSION(fddi, 1);
Index: sys/net/if_media.c
===================================================================
--- sys/net/if_media.c
+++ sys/net/if_media.c
@@ -405,12 +405,6 @@
struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
-struct ifmedia_description ifm_subtype_fddi_descriptions[] =
- IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
- IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
@@ -450,11 +444,6 @@
&ifm_subtype_tokenring_option_descriptions[0],
NULL,
},
- {
- &ifm_subtype_fddi_descriptions[0],
- &ifm_subtype_fddi_option_descriptions[0],
- NULL,
- },
{
&ifm_subtype_ieee80211_descriptions[0],
&ifm_subtype_ieee80211_option_descriptions[0],
Index: sys/netinet/if_ether.c
===================================================================
--- sys/netinet/if_ether.c
+++ sys/netinet/if_ether.c
@@ -694,10 +694,6 @@
hlen = ETHER_ADDR_LEN; /* RFC 826 */
layer = "ethernet";
break;
- case ARPHRD_IEEE802:
- hlen = 6; /* RFC 1390, FDDI_ADDR_LEN */
- layer = "fddi";
- break;
case ARPHRD_ARCNET:
hlen = 1; /* RFC 1201, ARC_ADDR_LEN */
layer = "arcnet";
Index: sys/netinet/ip_carp.c
===================================================================
--- sys/netinet/ip_carp.c
+++ sys/netinet/ip_carp.c
@@ -55,7 +55,6 @@
#include <sys/counter.h>
#include <net/ethernet.h>
-#include <net/fddi.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_dl.h>
@@ -1526,18 +1525,6 @@
eh->ether_shost[5] = sc->sc_vhid;
}
break;
- case IFT_FDDI: {
- struct fddi_header *fh;
-
- fh = mtod(m, struct fddi_header *);
- fh->fddi_shost[0] = 0;
- fh->fddi_shost[1] = 0;
- fh->fddi_shost[2] = 0x5e;
- fh->fddi_shost[3] = 0;
- fh->fddi_shost[4] = 1;
- fh->fddi_shost[5] = sc->sc_vhid;
- }
- break;
default:
printf("%s: carp is not supported for the %d interface type\n",
ifp->if_xname, ifp->if_type);
@@ -1719,7 +1706,6 @@
case IFT_ETHER:
case IFT_L2VLAN:
case IFT_BRIDGE:
- case IFT_FDDI:
break;
default:
error = EOPNOTSUPP;
Index: sys/netinet6/in6.c
===================================================================
--- sys/netinet6/in6.c
+++ sys/netinet6/in6.c
@@ -1972,8 +1972,6 @@
case IFT_BRIDGE: /* bridge(4) only does Ethernet-like links */
case IFT_INFINIBAND:
return (64);
- case IFT_FDDI: /* RFC2467 */
- return (64);
case IFT_PPP: /* RFC2472 */
return (64);
case IFT_ARCNET: /* RFC2497 */
Index: sys/netinet6/in6_ifattach.c
===================================================================
--- sys/netinet6/in6_ifattach.c
+++ sys/netinet6/in6_ifattach.c
@@ -274,7 +274,6 @@
case IFT_BRIDGE:
case IFT_ETHER:
case IFT_L2VLAN:
- case IFT_FDDI:
case IFT_ATM:
case IFT_IEEE1394:
/* IEEE802/EUI64 cases - what others? */
Index: sys/netinet6/nd6.c
===================================================================
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -61,7 +61,6 @@
#include <net/if_arc.h>
#include <net/if_dl.h>
#include <net/if_types.h>
-#include <net/fddi.h>
#include <net/route.h>
#include <net/vnet.h>
@@ -340,9 +339,6 @@
case IFT_ARCNET:
ndi->maxmtu = MIN(ARC_PHDS_MAXMTU, ifp->if_mtu); /* RFC2497 */
break;
- case IFT_FDDI:
- ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu); /* RFC2467 */
- break;
default:
ndi->maxmtu = ifp->if_mtu;
break;
@@ -2272,7 +2268,6 @@
if (m != NULL && m->m_flags & M_MCAST) {
switch (ifp->if_type) {
case IFT_ETHER:
- case IFT_FDDI:
case IFT_L2VLAN:
case IFT_BRIDGE:
ETHER_MAP_IPV6_MULTICAST(&dst6->sin6_addr,
@@ -2524,7 +2519,7 @@
{
/*
* XXX: we currently do not make neighbor cache on any interface
- * other than ARCnet, Ethernet, FDDI and GIF.
+ * other than ARCnet, Ethernet and GIF.
*
* RFC2893 says:
* - unidirectional tunnels needs no ND
@@ -2532,7 +2527,6 @@
switch (ifp->if_type) {
case IFT_ARCNET:
case IFT_ETHER:
- case IFT_FDDI:
case IFT_IEEE1394:
case IFT_L2VLAN:
case IFT_INFINIBAND:
Index: sys/netinet6/nd6_nbr.c
===================================================================
--- sys/netinet6/nd6_nbr.c
+++ sys/netinet6/nd6_nbr.c
@@ -1092,7 +1092,6 @@
switch (ifp->if_type) {
case IFT_ARCNET:
case IFT_ETHER:
- case IFT_FDDI:
case IFT_IEEE1394:
case IFT_L2VLAN:
case IFT_INFINIBAND:
@@ -1466,7 +1465,6 @@
*/
switch (ifp->if_type) {
case IFT_ETHER:
- case IFT_FDDI:
case IFT_ATM:
case IFT_IEEE1394:
case IFT_INFINIBAND:
Index: sys/nfs/bootp_subr.c
===================================================================
--- sys/nfs/bootp_subr.c
+++ sys/nfs/bootp_subr.c
@@ -1645,7 +1645,6 @@
continue;
switch (ifp->if_alloctype) {
case IFT_ETHER:
- case IFT_FDDI:
break;
default:
continue;
@@ -1675,7 +1674,6 @@
continue;
switch (ifp->if_alloctype) {
case IFT_ETHER:
- case IFT_FDDI:
break;
default:
continue;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 25, 11:23 PM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12779879
Default Alt Text
D15017.id41307.diff (174 KB)
Attached To
Mode
D15017: Remove support for FDDI networks.
Attached
Detach File
Event Timeline
Log In to Comment