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/isa/isavar.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: isavar.h,v 1.41 2003/07/08 10:06:32 itojun Exp $       */
    2 
    3 /*-
    4  * Copyright (c) 1997, 2001 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe of Wasabi Systems, Inc.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the NetBSD
   21  *      Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 /*
   40  * Copyright (c) 1995 Chris G. Demetriou
   41  * Copyright (c) 1992 Berkeley Software Design, Inc.
   42  * All rights reserved.
   43  *
   44  * Redistribution and use in source and binary forms, with or without
   45  * modification, are permitted provided that the following conditions
   46  * are met:
   47  * 1. Redistributions of source code must retain the above copyright
   48  *    notice, this list of conditions and the following disclaimer.
   49  * 2. Redistributions in binary form must reproduce the above copyright
   50  *    notice, this list of conditions and the following disclaimer in the
   51  *    documentation and/or other materials provided with the distribution.
   52  * 3. All advertising materials mentioning features or use of this software
   53  *    must display the following acknowledgement:
   54  *      This product includes software developed by Berkeley Software
   55  *      Design, Inc.
   56  * 4. The name of Berkeley Software Design must not be used to endorse
   57  *    or promote products derived from this software without specific
   58  *    prior written permission.
   59  *
   60  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
   61  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   62  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   63  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
   64  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   65  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   66  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   67  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   68  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   69  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   70  * SUCH DAMAGE.
   71  *
   72  *      BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp 
   73  */
   74 
   75 #ifndef _DEV_ISA_ISAVAR_H_
   76 #define _DEV_ISA_ISAVAR_H_
   77 
   78 /*
   79  * Definitions for ISA autoconfiguration.
   80  */
   81 
   82 #include <sys/queue.h>
   83 #include <machine/bus.h>
   84 
   85 /* 
   86  * Structures and definitions needed by the machine-dependent header.
   87  */
   88 struct isabus_attach_args;
   89 
   90 #include <machine/isa_machdep.h>
   91 
   92 /*
   93  * ISA bus attach arguments
   94  */
   95 struct isabus_attach_args {
   96         char    *iba_busname;           /* XXX should be common */
   97         bus_space_tag_t iba_iot;        /* isa i/o space tag */
   98         bus_space_tag_t iba_memt;       /* isa mem space tag */
   99         bus_dma_tag_t iba_dmat;         /* isa DMA tag */
  100         isa_chipset_tag_t iba_ic;
  101 };
  102 
  103 /*
  104  * ISA bus resources.
  105  */
  106 
  107 struct isa_io {
  108         int ir_addr;
  109         int ir_size;
  110 };
  111 
  112 struct isa_iomem {
  113         int ir_addr;
  114         int ir_size;
  115 };
  116 
  117 struct isa_irq {
  118         int ir_irq;
  119 };
  120 
  121 struct isa_drq {
  122         int ir_drq;
  123 };
  124 
  125 struct isa_pnpname {
  126         struct isa_pnpname *ipn_next;
  127         char *ipn_name;
  128 };
  129 
  130 /*
  131  * Machine-dependent code provides a list of these to describe
  132  * devices on the ISA bus which should be attached via direct
  133  * configuration.
  134  *
  135  * All of this information is dynamically allocated, so that
  136  * the ISA bus driver may free all of this information if the
  137  * bus does not support dynamic attach/detach of devices (e.g.
  138  * on a docking station).
  139  *
  140  * Some info on the "ik_key" field: This is a unique number for
  141  * each knowndev node.  If, when we need to re-enumerate the
  142  * knowndevs, we discover that a node with key N is in the old
  143  * list but not in the new, the device has disappeared.  Similarly,
  144  * if a node with key M is in the new list but not in the old,
  145  * the device is new.  Note that the knowndevs list must be
  146  * sorted in ascending "key" order.
  147  */
  148 struct isa_knowndev {
  149         TAILQ_ENTRY(isa_knowndev) ik_list;
  150         uintptr_t ik_key;
  151         struct device *ik_claimed;
  152 
  153         /*
  154          * The rest of these fields correspond to isa_attach_args
  155          * fields.
  156          */
  157         char *ik_pnpname;
  158         struct isa_pnpname *ik_pnpcompatnames;
  159 
  160         struct isa_io *ik_io;
  161         int ik_nio;
  162 
  163         struct isa_iomem *ik_iomem;
  164         int ik_niomem;
  165 
  166         struct isa_irq *ik_irq;
  167         int ik_nirq;
  168 
  169         struct isa_drq *ik_drq;
  170         int ik_ndrq;
  171 };
  172 
  173 /*
  174  * ISA driver attach arguments
  175  */
  176 struct isa_attach_args {
  177         bus_space_tag_t ia_iot;         /* isa i/o space tag */
  178         bus_space_tag_t ia_memt;        /* isa mem space tag */
  179         bus_dma_tag_t ia_dmat;          /* DMA tag */
  180 
  181         isa_chipset_tag_t ia_ic;
  182 
  183         /*
  184          * PNP (or other) names to with which we can match a device
  185          * driver to a device that machine-dependent code tells us
  186          * is there (i.e. support for direct-configuration of ISA
  187          * devices).
  188          */
  189         char *ia_pnpname;
  190         struct isa_pnpname *ia_pnpcompatnames;
  191 
  192         struct isa_io *ia_io;           /* I/O resources */
  193         int ia_nio;
  194 
  195         struct isa_iomem *ia_iomem;     /* memory resources */
  196         int ia_niomem;
  197 
  198         struct isa_irq *ia_irq;         /* IRQ resources */
  199         int ia_nirq;
  200 
  201         struct isa_drq *ia_drq;         /* DRQ resources */
  202         int ia_ndrq;
  203 
  204         void    *ia_aux;                /* driver specific */
  205 };
  206 
  207 /*
  208  * Test to determine if a given call to an ISA device probe routine
  209  * is actually an attempt to do direct configuration.
  210  */
  211 #define ISA_DIRECT_CONFIG(ia)                                           \
  212         ((ia)->ia_pnpname != NULL || (ia)->ia_pnpcompatnames != NULL)
  213 
  214 #include "locators.h"
  215 
  216 /*
  217  * ISA master bus
  218  */
  219 struct isa_softc {
  220         struct  device sc_dev;          /* base device */
  221 
  222         bus_space_tag_t sc_iot;         /* isa io space tag */
  223         bus_space_tag_t sc_memt;        /* isa mem space tag */
  224         bus_dma_tag_t sc_dmat;          /* isa DMA tag */
  225 
  226         isa_chipset_tag_t sc_ic;
  227 
  228         TAILQ_HEAD(, isa_knowndev) sc_knowndevs;
  229         int sc_dynamicdevs;
  230 };
  231 
  232 #define         cf_iobase               cf_loc[ISACF_PORT]
  233 #define         cf_iosize               cf_loc[ISACF_SIZE]
  234 #define         cf_maddr                cf_loc[ISACF_IOMEM]
  235 #define         cf_msize                cf_loc[ISACF_IOSIZ]
  236 #define         cf_irq                  cf_loc[ISACF_IRQ]
  237 #define         cf_drq                  cf_loc[ISACF_DRQ]
  238 #define         cf_drq2                 cf_loc[ISACF_DRQ2]
  239 
  240 /*
  241  * ISA interrupt handler manipulation.
  242  * 
  243  * To establish an ISA interrupt handler, a driver calls isa_intr_establish()
  244  * with the interrupt number, type, level, function, and function argument of
  245  * the interrupt it wants to handle.  Isa_intr_establish() returns an opaque
  246  * handle to an event descriptor if it succeeds, and returns NULL on failure.
  247  * (XXX: some drivers can't handle this, since the former behaviour was to
  248  * invoke panic() on failure). When the system does not accept any of the
  249  * interrupt types supported by the driver, the driver should fail the attach.
  250  * Interrupt handlers should return 0 for "interrupt not for me", 1  for
  251  * "I took care of it", or -1 for "I guess it was mine, but I wasn't
  252  * expecting it."
  253  *
  254  * To remove an interrupt handler, the driver calls isa_intr_disestablish() 
  255  * with the handle returned by isa_intr_establish() for that handler.
  256  *
  257  * The event counter (struct evcnt) associated with an interrupt line
  258  * (to be used as 'parent' for an ISA device's interrupt handler's evcnt)
  259  * can be obtained with isa_intr_evcnt().
  260  */
  261 
  262 /* ISA interrupt sharing types */
  263 char    *isa_intr_typename __P((int));
  264 
  265 /*
  266  * Some ISA devices (e.g. on a VLB) can perform 32-bit DMA.  This
  267  * flag is passed to bus_dmamap_create() to indicate that fact.
  268  */
  269 #define ISABUS_DMA_32BIT        BUS_DMA_BUS1
  270 
  271 /*
  272  * This flag indicates that the DMA channel should not yet be reserved,
  273  * even if BUS_DMA_ALLOCNOW is specified.
  274  */
  275 #define ISABUS_DMA_DEFERCHAN    BUS_DMA_BUS2
  276 
  277 #endif /* _DEV_ISA_ISAVAR_H_ */

Cache object: fd640d8acff3b5d4caf0c4967372908a


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