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/pccard/slot.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 /*
    2  *      Slot structures for PC-CARD interface.
    3  *      Each slot has a controller specific structure
    4  *      attached to it. A slot number allows
    5  *      mapping from the character device to the
    6  *      slot structure. This is separate to the
    7  *      controller slot number to allow multiple controllers
    8  *      to be accessed.
    9  *-------------------------------------------------------------------------
   10  *
   11  * Copyright (c) 1995 Andrew McRae.  All rights reserved.
   12  *
   13  * Redistribution and use in source and binary forms, with or without
   14  * modification, are permitted provided that the following conditions
   15  * are met:
   16  * 1. Redistributions of source code must retain the above copyright
   17  *    notice, this list of conditions and the following disclaimer.
   18  * 2. Redistributions in binary form must reproduce the above copyright
   19  *    notice, this list of conditions and the following disclaimer in the
   20  *    documentation and/or other materials provided with the distribution.
   21  * 3. The name of the author may not be used to endorse or promote products
   22  *    derived from this software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   27  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   29  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   33  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   34  */
   35 
   36 /*
   37  *      Controller data - Specific to each slot controller.
   38  */
   39 struct slot;
   40 struct slot_ctrl {
   41         int     (*mapmem) __P((struct slot *, int));
   42                                 /* Map memory */
   43         int     (*mapio) __P((struct slot *, int));
   44                                 /* Map io */
   45         void    (*reset) __P((void *));
   46                                 /* init */
   47         void    (*disable) __P((struct slot *));
   48                                 /* Disable slot */
   49         int     (*power) __P((struct slot *));
   50                                 /* Set power values */
   51         int     (*ioctl) __P((struct slot *, int, caddr_t));
   52                                 /* ioctl to lower level */
   53         void    (*mapirq) __P((struct slot *, int));
   54                                 /* Map interrupt number */
   55         void    (*resume) __P((struct slot *));
   56                                 /* suspend/resume support */
   57         int     extra;          /* Controller specific size */
   58         int     maxmem;         /* Number of allowed memory windows */
   59         int     maxio;          /* Number of allowed I/O windows */
   60         int     irqs;           /* IRQ's that are allowed */
   61         u_int   *imask;         /* IRQ mask for the PCIC controller */
   62         char    *name;          /* controller name */
   63 
   64         /*
   65          *      The rest is maintained by the mainline PC-CARD code.
   66          */
   67         struct slot_ctrl *next; /* Allows linked list of controllers */
   68         int     slots;          /* Slots available */
   69 };
   70 
   71 /*
   72  *      Driver structure - each driver registers itself
   73  *      with the mainline PC-CARD code. These drivers are
   74  *      then available for linking to the devices.
   75  */
   76 struct pccard_devinfo;
   77 
   78 struct pccard_device {
   79         char    *name;                                  /* Driver name */
   80         int (*enable)(struct pccard_devinfo *);         /* init/enable driver */
   81         void (*disable)(struct pccard_devinfo *);       /* disable driver */
   82         int (*handler)(struct pccard_devinfo *);        /* interrupt handler */
   83         int     attr;                                   /* driver attributes */
   84         unsigned int *imask;                            /* Interrupt mask ptr */
   85 
   86         struct pccard_device *next;
   87 };
   88 
   89 int pccard_module_handler __P((module_t mod, int what, void *arg));
   90 
   91 #define PCCARD_MODULE(name, enable, disable, handler, attr, imask)      \
   92 static struct pccard_device name ## _info = {                           \
   93         #name,                                                          \
   94         enable,                                                         \
   95         disable,                                                        \
   96         handler,                                                        \
   97         attr,                                                           \
   98         &imask                                                          \
   99 };                                                                      \
  100 static moduledata_t name ## _mod = {                                    \
  101         "pccard_" #name,                                                \
  102         pccard_module_handler,                                          \
  103         &name ## _info                                                  \
  104 };                                                                      \
  105 DECLARE_MODULE(name, name ## _mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
  106 
  107 /*
  108  *      Device structure for cards. Each card may have one
  109  *      or more pccard drivers attached to it; each driver is assumed
  110  *      to require at most one interrupt handler, one I/O block
  111  *      and one memory block. This structure is used to link the different
  112  *      devices together.
  113  */
  114 struct pccard_devinfo {
  115         struct pccard_device *drv;
  116         struct isa_device isahd;        /* Device details */
  117 #if 0
  118         void *arg;                      /* Device argument */
  119 #endif
  120         int running;                    /* Current state of driver */
  121         u_char  misc[128];              /* For any random info */
  122         struct slot *slt;               /* Back pointer to slot */
  123 
  124         struct pccard_devinfo *next;    /* List of drivers */
  125 };
  126 
  127 /*
  128  *      Per-slot structure.
  129  */
  130 struct slot {
  131         int slotnum;                    /* Slot number */
  132         int flags;                      /* Slot flags (see below) */
  133         int rwmem;                      /* Read/write flags */
  134         int irq;                        /* IRQ allocated (0 = none) */
  135         int irqref;                     /* Reference count of driver IRQs */
  136         struct pccard_devinfo *devices; /* List of drivers attached */
  137         /*
  138          *      flags.
  139          */
  140         unsigned int    insert_seq;     /* Firing up under the card */
  141         struct callout_handle insert_ch;/* Insert event timeout handle */
  142         struct callout_handle poff_ch;  /* Power Off timeout handle */
  143 
  144         enum cardstate  state, laststate; /* Current/last card states */
  145         struct selinfo  selp;           /* Info for select */
  146         struct mem_desc mem[NUM_MEM_WINDOWS];   /* Memory windows */
  147         struct io_desc  io[NUM_IO_WINDOWS];     /* I/O windows */
  148         struct power    pwr;            /* Power values */
  149         struct slot_ctrl *ctrl;         /* Per-controller data */
  150         void            *cdata;         /* Controller specific data */
  151         int             pwr_off_pending;/* Power status of slot */
  152 #ifdef DEVFS
  153         void            *devfs_token;
  154 #endif /* DEVFS*/
  155 
  156         struct slot *next;              /* Master list */
  157 };
  158 
  159 enum card_event { card_removed, card_inserted };
  160 
  161 struct slot     *pccard_alloc_slot(struct slot_ctrl *);
  162 void             pccard_event(struct slot *, enum card_event);
  163 void             pccard_remove_controller(struct slot_ctrl *);

Cache object: 552eaf6c2404d5a437461c38584f6b01


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