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/marvell/gtvar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: gtvar.h,v 1.5 2004/03/20 01:55:00 matt Exp $   */
    2 
    3 /*
    4  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
    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. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *      This product includes software developed for the NetBSD Project by
   18  *      Allegro Networks, Inc., and Wasabi Systems, Inc.
   19  * 4. The name of Allegro Networks, Inc. may not be used to endorse
   20  *    or promote products derived from this software without specific prior
   21  *    written permission.
   22  * 5. The name of Wasabi Systems, Inc. may not be used to endorse
   23  *    or promote products derived from this software without specific prior
   24  *    written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY ALLEGRO NETWORKS, INC. AND
   27  * WASABI SYSTEMS, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
   28  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
   29  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   30  * IN NO EVENT SHALL EITHER ALLEGRO NETWORKS, INC. OR WASABI SYSTEMS, INC.
   31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 /*
   41  * gtvar.h -- placeholder for GT system controller driver
   42  */
   43 #ifndef _DISCOVERY_DEV_GTVAR_H_
   44 #define _DISCOVERY_DEV_GTVAR_H_
   45 
   46 #include <sys/systm.h>
   47 
   48 struct gt_softc {
   49         struct device gt_dev;
   50         bus_dma_tag_t gt_dmat;
   51         bus_space_tag_t gt_memt;        /* the GT itself */
   52         bus_space_tag_t gt_pci0_memt;   /* PCI0 mem space */
   53         bus_space_tag_t gt_pci0_iot;    /* PCI0 i/o space */
   54         boolean_t gt_pci0_host;         /* We're host on PCI0 if TRUE */
   55         bus_space_tag_t gt_pci1_memt;   /* PCI1 mem space */
   56         bus_space_tag_t gt_pci1_iot;    /* PCI1 i/o space */
   57         boolean_t gt_pci1_host;         /* We're host on PCI1 if TRUE */
   58 
   59         bus_space_handle_t gt_memh;     /* to access the GT registers */
   60         int gt_childmask;               /* what children are present */
   61 };
   62 
   63 #define GT_CHILDOK(gt, ga, cd, pos, max) \
   64         (((ga)->ga_unit) < (max) &&  \
   65             !((gt)->gt_childmask & (1 << (((ga)->ga_unit) + (pos)))) && \
   66             !strcmp((ga)->ga_name, (cd)->cd_name))
   67 
   68 #define GT_MPSCOK(gt, ga, cd)           GT_CHILDOK((gt), (ga), (cd), 0, 2)
   69 #define GT_PCIOK(gt, ga, cd)            GT_CHILDOK((gt), (ga), (cd), 2, 2)
   70 #define GT_ETHEROK(gt, ga, cd)          GT_CHILDOK((gt), (ga), (cd), 4, 3)
   71 #define GT_OBIOOK(gt, ga, cd)           GT_CHILDOK((gt), (ga), (cd), 7, 5)
   72 
   73 #define GT_CHILDFOUND(gt, ga, pos) \
   74         ((void)(((gt)->gt_childmask |= (1 << (((ga)->ga_unit) + (pos))))))
   75 
   76 #define GT_MPSCFOUND(gt, ga)            GT_CHILDFOUND((gt), (ga), 0)
   77 #define GT_PCIFOUND(gt, ga)             GT_CHILDFOUND((gt), (ga), 2)
   78 #define GT_ETHERFOUND(gt, ga)           GT_CHILDFOUND((gt), (ga), 4)
   79 #define GT_OBIOFOUND(gt, ga)            GT_CHILDFOUND((gt), (ga), 7)
   80 
   81 struct gt_attach_args {
   82         const char *ga_name;            /* class name of device */
   83         bus_dma_tag_t ga_dmat;          /* dma tag */
   84         bus_space_tag_t ga_memt;        /* GT bus space tag */
   85         bus_space_handle_t ga_memh;     /* GT bus space handle */
   86         int ga_unit;                    /* instance of ga_name */
   87 };
   88 
   89 struct obio_attach_args {
   90         const char *oa_name;            /* call name of device */
   91         bus_space_tag_t oa_memt;        /* bus space tag */
   92         bus_addr_t oa_offset;           /* offset (absolute) to device */
   93         bus_size_t oa_size;             /* size (strided) of device */
   94         int oa_irq;                     /* irq */
   95 };
   96 
   97 #ifdef _KERNEL
   98 #include "locators.h"
   99 
  100 #ifdef DEBUG
  101 extern int gtpci_debug;
  102 #endif
  103 
  104 /*
  105  * Locators for GT private devices, as specified to config.
  106  */
  107 #define gtcf_unit               cf_loc[GTCF_UNIT]
  108 #define GT_UNK_UNIT             GTCF_UNIT_DEFAULT       /* wcarded 'function' */
  109 
  110 #define obiocf_offset           cf_loc[OBIOCF_OFFSET]
  111 #define OBIO_UNK_OFFSET         OBIOCF_OFFSET_DEFAULT   /* wcarded 'offset' */
  112 
  113 #define obiocf_size             cf_loc[OBIOCF_SIZE]
  114 #define OBIO_UNK_SIZE           OBIOCF_SIZE_DEFAULT     /* wcarded 'size' */
  115 
  116 #define obiocf_irq              cf_loc[OBIOCF_IRQ]
  117 #define OBIO_UNK_IRQ            OBIOCF_IRQ_DEFAULT      /* wcarded 'irq' */
  118 
  119 void    gt_attach_common(struct gt_softc *);
  120 uint32_t gt_read_mpp(void);
  121 int     gt_cfprint(void *, const char *);
  122 
  123 /* int     gt_bs_extent_init(struct discovery_bus_space *, char *);  AKB */
  124 int     gt_mii_read(struct device *, struct device *, int, int);
  125 void    gt_mii_write(struct device *, struct device *, int, int, int);
  126 int     gtget_macaddr(struct gt_softc *,int, char *);
  127 void    gt_watchdog_service(void);
  128 bus_addr_t gt_dma_phys_to_bus_mem(bus_dma_tag_t, bus_addr_t);
  129 bus_addr_t gt_dma_bus_mem_to_phys(bus_dma_tag_t, bus_addr_t);
  130 
  131 #define gt_read(gt,o) \
  132         bus_space_read_4((gt)->gt_memt, (gt)->gt_memh, (o))
  133 #define gt_write(gt,o,v) \
  134         bus_space_write_4((gt)->gt_memt, (gt)->gt_memh, (o), (v))
  135 
  136 #if defined(__powerpc__)
  137 static __inline volatile int
  138 atomic_add(volatile int *p, int v)
  139 {
  140         int     rv;
  141         int     rtmp;
  142 
  143         __asm __volatile(
  144         "1:     lwarx   %0,0,%2\n"
  145         "       add     %1,%3,%0\n"
  146         "       stwcx.  %1,0,%2\n"
  147         "       bne-    1b\n"
  148         "       sync"
  149                         : "=&r"(rv), "=&r"(rtmp)
  150                         : "r"(p), "r"(v)
  151                         : "cc");
  152 
  153         return rv;
  154 }
  155 
  156 #endif /* __powerpc__ */
  157 
  158 #endif /* _KERNEL */
  159 
  160 #endif /* _DISCOVERY_DEV_GTVAR_H_ */

Cache object: c27d92ca42b35bc16c253b85a2d14289


[ 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.