The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/pdq/pdqvar.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: pdqvar.h,v 1.27 2000/05/03 19:17:54 thorpej Exp $      */
    2 
    3 /*-
    4  * Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. The name of the author may not be used to endorse or promote products
   13  *    derived from this software without specific prior written permission
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * Id: pdqvar.h,v 1.21 1997/03/21 21:16:04 thomas Exp
   27  * $FreeBSD: releng/8.1/sys/dev/pdq/pdqvar.h 158651 2006-05-16 14:37:58Z phk $
   28  *
   29  */
   30 
   31 /*
   32  * DEC PDQ FDDI Controller; PDQ O/S dependent definitions
   33  *
   34  * Written by Matt Thomas
   35  *
   36  */
   37 
   38 #ifndef _PDQ_OS_H
   39 #define _PDQ_OS_H
   40 
   41 #define PDQ_OS_TX_TIMEOUT               5       /* seconds */
   42 
   43 typedef struct _pdq_t pdq_t;
   44 typedef struct _pdq_csrs_t pdq_csrs_t;
   45 typedef struct _pdq_pci_csrs_t pdq_pci_csrs_t;
   46 typedef struct _pdq_lanaddr_t pdq_lanaddr_t;
   47 typedef unsigned int pdq_uint32_t;
   48 typedef unsigned short pdq_uint16_t;
   49 typedef unsigned char pdq_uint8_t;
   50 typedef enum _pdq_boolean_t pdq_boolean_t;
   51 typedef enum _pdq_type_t pdq_type_t;
   52 typedef enum _pdq_state_t pdq_state_t;
   53 
   54 enum _pdq_type_t {
   55     PDQ_DEFPA,          /* PCI-bus */
   56     PDQ_DEFEA,          /* EISA-bus */
   57     PDQ_DEFTA,          /* TurboChannel */
   58     PDQ_DEFAA,          /* FutureBus+ */
   59     PDQ_DEFQA           /* Q-bus */
   60 };
   61 
   62 #if defined(PDQTEST)
   63 #include <pdq_os_test.h>
   64 #else
   65 
   66 #include <sys/param.h>
   67 #include <sys/systm.h>
   68 #ifndef M_MCAST
   69 #include <sys/mbuf.h>
   70 #endif /* M_CAST */
   71 #include <sys/malloc.h>
   72 #include <vm/vm.h>
   73 #include <vm/vm_kern.h>
   74 
   75 #define PDQ_OS_PREFIX                   "%s: "
   76 #define PDQ_OS_PREFIX_ARGS              pdq->pdq_os_name
   77 #define PDQ_OS_PAGESIZE                 PAGE_SIZE
   78 #define PDQ_OS_USEC_DELAY(n)            DELAY(n)
   79 #define PDQ_OS_MEMZERO(p, n)            bzero((caddr_t)(p), (n))
   80 #if !defined(PDQ_BUS_DMA)
   81 #define PDQ_OS_VA_TO_BUSPA(pdq, p)              vtophys(p)
   82 #endif
   83 #define PDQ_OS_MEMALLOC(n)              malloc(n, M_DEVBUF, M_NOWAIT)
   84 #define PDQ_OS_MEMFREE(p, n)            free((void *) p, M_DEVBUF)
   85 #define PDQ_OS_MEMALLOC_CONTIG(n)       contigmalloc(n, M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0)
   86 #define PDQ_OS_MEMFREE_CONTIG(p, n)     contigfree((void *) p, n, M_DEVBUF)
   87 
   88 #include <vm/pmap.h>
   89 #include <vm/vm_extern.h>
   90 #include <machine/cpufunc.h>
   91 #define ifnet_ret_t void
   92 typedef int ioctl_cmd_t;
   93 typedef enum { PDQ_BUS_EISA, PDQ_BUS_PCI } pdq_bus_t;
   94 typedef u_int16_t pdq_bus_ioport_t;
   95 typedef volatile pdq_uint32_t *pdq_bus_memaddr_t;
   96 typedef pdq_bus_memaddr_t pdq_bus_memoffset_t;
   97 #define pdq_os_update_status(a, b)      ((void) 0)
   98 
   99 
  100 #if !defined(PDQ_OS_SPL_RAISE)
  101 #define PDQ_OS_SPL_RAISE()      splimp()
  102 #endif
  103 
  104 #if !defined(PDQ_OS_SPL_LOWER)
  105 #define PDQ_OS_SPL_LOWER(s)     splx(s)
  106 #endif
  107 
  108 #if !defined(PDQ_FDDICOM)
  109 #define PDQ_FDDICOM(sc)         (&(sc)->sc_ac)
  110 #endif
  111 
  112 #if !defined(PDQ_IFNET)
  113 #define PDQ_IFNET(sc)           (PDQ_FDDICOM((sc))->ac_ifp)
  114 #endif
  115 
  116 #define PDQ_BPF_MTAP(sc, m)     bpf_mtap(PDQ_IFNET(sc), m)
  117 #define PDQ_BPFATTACH(sc, t, s) bpfattach(PDQ_IFNET(sc), t, s)
  118 
  119 #if !defined(PDQ_ARP_IFINIT)
  120 #define PDQ_ARP_IFINIT(sc, ifa) arp_ifinit(&(sc)->sc_ac, (ifa))
  121 #endif
  122 
  123 #if !defined(PDQ_OS_PTR_FMT)
  124 #define PDQ_OS_PTR_FMT  "0x%x"
  125 #endif
  126 
  127 #if !defined(PDQ_OS_CSR_FMT)
  128 #define PDQ_OS_CSR_FMT  "0x%x"
  129 #endif
  130 
  131 #if !defined(PDQ_LANADDR)
  132 #define PDQ_LANADDR(sc)         ((sc)->sc_ac.ac_enaddr)
  133 #define PDQ_LANADDR_SIZE(sc)    (sizeof((sc)->sc_ac.ac_enaddr))
  134 #endif
  135 
  136 #if !defined(PDQ_OS_IOMEM)
  137 #define PDQ_OS_IORD_32(t, base, offset)         inl((base) + (offset))
  138 #define PDQ_OS_IOWR_32(t, base, offset, data)   outl((base) + (offset), data)
  139 #define PDQ_OS_IORD_8(t, base, offset)          inb((base) + (offset))
  140 #define PDQ_OS_IOWR_8(t, base, offset, data)    outb((base) + (offset), data)
  141 #define PDQ_OS_MEMRD_32(t, base, offset)        (0 + *((base) + (offset)))
  142 #define PDQ_OS_MEMWR_32(t, base, offset, data)  do *((base) + (offset)) = (data); while (0)
  143 #endif
  144 #ifndef PDQ_CSR_OFFSET
  145 #define PDQ_CSR_OFFSET(base, offset)            (0 + (base) + (offset))
  146 #endif
  147 
  148 #ifndef PDQ_CSR_WRITE
  149 #define PDQ_CSR_WRITE(csr, name, data)          PDQ_OS_MEMWR_32((csr)->csr_bus, (csr)->name, 0, data)
  150 #define PDQ_CSR_READ(csr, name)                 PDQ_OS_MEMRD_32((csr)->csr_bus, (csr)->name, 0)
  151 #endif
  152 
  153 #ifndef PDQ_OS_IFP_TO_SOFTC
  154 #define PDQ_OS_IFP_TO_SOFTC(ifp)        ((pdq_softc_t *) ((caddr_t) ifp - offsetof(pdq_softc_t, sc_ac.ac_if)))
  155 #endif
  156 
  157 
  158 #if !defined(PDQ_HWSUPPORT)
  159 
  160 typedef struct _pdq_os_ctx_t {
  161     struct kern_devconf *sc_kdc;        /* freebsd cruft */
  162     struct arpcom sc_ac;
  163 #if defined(IFM_FDDI)
  164     struct ifmedia sc_ifmedia;
  165 #endif
  166     pdq_t *sc_pdq;
  167 #if defined(__i386__)
  168     pdq_bus_ioport_t sc_iobase;
  169 #endif
  170 #if defined(PDQ_IOMAPPED)
  171 #define sc_membase      sc_iobase
  172 #else
  173     pdq_bus_memaddr_t sc_membase;
  174 #endif
  175     pdq_bus_t sc_iotag;
  176     pdq_bus_t sc_csrtag;
  177     caddr_t sc_bpf;
  178 #if defined(PDQ_BUS_DMA)
  179      bus_dma_tag_t sc_dmatag;
  180      bus_dmamap_t sc_dbmap;             /* DMA map for descriptor block */
  181      bus_dmamap_t sc_uimap;             /* DMA map for unsolicited events */
  182      bus_dmamap_t sc_cbmap;             /* DMA map for consumer block */
  183 #endif
  184 } pdq_softc_t;
  185 
  186 
  187 extern void pdq_ifreset(pdq_softc_t *sc);
  188 extern void pdq_ifinit(pdq_softc_t *sc);
  189 extern void pdq_ifwatchdog(struct ifnet *ifp);
  190 extern ifnet_ret_t pdq_ifstart(struct ifnet *ifp);
  191 extern int pdq_ifioctl(struct ifnet *ifp, ioctl_cmd_t cmd, caddr_t data);
  192 extern void pdq_ifattach(pdq_softc_t *sc, ifnet_ret_t (*ifwatchdog)(int unit));
  193 #endif /* !PDQ_HWSUPPORT */
  194 
  195 
  196 #endif
  197 
  198 
  199 #define PDQ_OS_DATABUF_SIZE                     (MCLBYTES)
  200 #ifndef PDQ_OS_DATABUF_FREE
  201 #define PDQ_OS_DATABUF_FREE(pdq, b)             (m_freem(b))
  202 #endif
  203 #define PDQ_OS_DATABUF_NEXT(b)                  ((b)->m_next)
  204 #define PDQ_OS_DATABUF_NEXT_SET(b, b1)          ((b)->m_next = (b1))
  205 #define PDQ_OS_DATABUF_NEXTPKT(b)               ((b)->m_nextpkt)
  206 #define PDQ_OS_DATABUF_NEXTPKT_SET(b, b1)       ((b)->m_nextpkt = (b1))
  207 #define PDQ_OS_DATABUF_LEN(b)                   ((b)->m_len)
  208 #define PDQ_OS_DATABUF_LEN_SET(b, n)            ((b)->m_len = (n))
  209 /* #define      PDQ_OS_DATABUF_LEN_ADJ(b, n)            ((b)->m_len += (n)) */
  210 #define PDQ_OS_DATABUF_PTR(b)                   (mtod((b), pdq_uint8_t *))
  211 #define PDQ_OS_DATABUF_ADJ(b, n)                ((b)->m_data += (n), (b)->m_len -= (n))
  212 typedef struct mbuf PDQ_OS_DATABUF_T;
  213 
  214 #ifndef PDQ_OS_DATABUF_ALLOC
  215 #define PDQ_OS_DATABUF_ALLOC(pdq, b) do { \
  216     PDQ_OS_DATABUF_T *x_m0; \
  217     MGETHDR(x_m0, M_DONTWAIT, MT_DATA); \
  218     if (x_m0 != NULL) { \
  219         MCLGET(x_m0, M_DONTWAIT);       \
  220         if ((x_m0->m_flags & M_EXT) == 0) { \
  221             m_free(x_m0); \
  222             (b) = NULL; \
  223         } else { \
  224             (b) = x_m0; \
  225             x_m0->m_len = PDQ_OS_DATABUF_SIZE; \
  226         } \
  227     } else { \
  228         (b) = NULL; \
  229     } \
  230 } while (0)
  231 #endif
  232 #define PDQ_OS_DATABUF_RESET(b) ((b)->m_data = (b)->m_ext.ext_buf, (b)->m_len = MCLBYTES)
  233 
  234 #define PDQ_OS_TX_TRANSMIT              5
  235 
  236 #define PDQ_OS_DATABUF_ENQUEUE(q, b)    do { \
  237     PDQ_OS_DATABUF_NEXTPKT_SET(b, NULL); \
  238     if ((q)->q_tail == NULL) \
  239         (q)->q_head = (b); \
  240     else \
  241         PDQ_OS_DATABUF_NEXTPKT_SET(((PDQ_OS_DATABUF_T *)(q)->q_tail), b); \
  242     (q)->q_tail = (b); \
  243 } while (0)
  244 
  245 #define PDQ_OS_DATABUF_DEQUEUE(q, b)    do { \
  246     if (((b) = (PDQ_OS_DATABUF_T *) (q)->q_head) != NULL) { \
  247         if (((q)->q_head = PDQ_OS_DATABUF_NEXTPKT(b)) == NULL) \
  248             (q)->q_tail = NULL; \
  249         PDQ_OS_DATABUF_NEXTPKT_SET(b, NULL); \
  250     } \
  251 } while (0)
  252 
  253 #if !defined(PDQ_OS_CONSUMER_PRESYNC)
  254 #define PDQ_OS_CONSUMER_PRESYNC(pdq)            do { } while(0)
  255 #define PDQ_OS_CONSUMER_POSTSYNC(pdq)           do { } while(0)
  256 #define PDQ_OS_DESC_PRESYNC(pdq, d, s)          do { } while(0)
  257 #define PDQ_OS_DESC_POSTSYNC(pdq, d, s)         do { } while(0)
  258 #define PDQ_OS_CMDRQST_PRESYNC(pdq, s)          do { } while(0)
  259 #define PDQ_OS_CMDRQST_POSTSYNC(pdq, s)         do { } while(0)
  260 #define PDQ_OS_CMDRSP_PRESYNC(pdq, s)           do { } while(0)
  261 #define PDQ_OS_CMDRSP_POSTSYNC(pdq, s)          do { } while(0)
  262 #define PDQ_OS_RXPDU_PRESYNC(pdq, b, o, l)      do { } while(0)
  263 #define PDQ_OS_RXPDU_POSTSYNC(pdq, b, o, l)     do { } while(0)
  264 #define PDQ_OS_UNSOL_EVENT_PRESYNC(pdq, e)      do { } while(0)
  265 #define PDQ_OS_UNSOL_EVENT_POSTSYNC(pdq, e)     do { } while(0)
  266 #endif
  267 
  268 #ifndef PDQ_OS_DATABUF_BUSPA
  269 #define PDQ_OS_DATABUF_BUSPA(pdq, b)    PDQ_OS_VA_TO_BUSPA(pdq, PDQ_OS_DATABUF_PTR(b))
  270 #endif
  271 
  272 #ifndef PDQ_OS_HDR_OFFSET
  273 #define PDQ_OS_HDR_OFFSET       PDQ_RX_FC_OFFSET
  274 #endif
  275 
  276 extern void pdq_os_addr_fill(pdq_t *pdq, pdq_lanaddr_t *addrs, size_t numaddrs);
  277 extern void pdq_os_receive_pdu(pdq_t *, PDQ_OS_DATABUF_T *pdu, size_t pdulen, int drop);
  278 extern void pdq_os_restart_transmitter(pdq_t *pdq);
  279 extern void pdq_os_transmit_done(pdq_t *pdq, PDQ_OS_DATABUF_T *pdu);
  280 #if !defined(pdq_os_update_status)
  281 extern void pdq_os_update_status(pdq_t *pdq, const void *rsp);
  282 #endif
  283 #if !defined(PDQ_OS_MEMALLOC_CONTIG)
  284 extern int pdq_os_memalloc_contig(pdq_t *pdq);
  285 #endif
  286 extern pdq_boolean_t pdq_queue_transmit_data(pdq_t *pdq, PDQ_OS_DATABUF_T *pdu);
  287 extern void pdq_flush_transmitter(pdq_t *pdq);
  288 
  289 extern void pdq_run(pdq_t *pdq);
  290 extern pdq_state_t pdq_stop(pdq_t *pdq);
  291 extern void pdq_hwreset(pdq_t *pdq);
  292 
  293 extern int pdq_interrupt(pdq_t *pdq);
  294 extern pdq_t *pdq_initialize(pdq_bus_t bus, pdq_bus_memaddr_t csr_va,
  295                              const char *name, int unit,
  296                              void *ctx, pdq_type_t type);
  297 #endif /* _PDQ_OS_H */

Cache object: ddc70b6228e46aff6ff5a5099a01f55b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.