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 
   12 /*-
   13  * Copyright (c) 1995 Andrew McRae.  All rights reserved.
   14  *
   15  * Redistribution and use in source and binary forms, with or without
   16  * modification, are permitted provided that the following conditions
   17  * are met:
   18  * 1. Redistributions of source code must retain the above copyright
   19  *    notice, this list of conditions and the following disclaimer.
   20  * 2. Redistributions in binary form must reproduce the above copyright
   21  *    notice, this list of conditions and the following disclaimer in the
   22  *    documentation and/or other materials provided with the distribution.
   23  * 3. The name of the author may not be used to endorse or promote products
   24  *    derived from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   27  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   28  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   29  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   31  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   35  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   36  *
   37  * $FreeBSD: releng/6.3/sys/pccard/slot.h 139825 2005-01-07 02:29:27Z imp $
   38  */
   39 
   40 #ifndef _PCCARD_SLOT_H
   41 #define _PCCARD_SLOT_H
   42 
   43 /*
   44  * Normally we shouldn't include stuff here, but we're trying to be
   45  * compatible with the long, dark hand of the past.
   46  */
   47 #include <sys/param.h>
   48 #include <sys/bus.h>
   49 #include <machine/bus.h>
   50 #include <sys/rman.h>
   51 #include <machine/resource.h>
   52 #if __FreeBSD_version >= 500000
   53 #include <sys/selinfo.h>
   54 #else
   55 #include <sys/select.h>
   56 #endif
   57 
   58 /*
   59  *      Controller data - Specific to each slot controller.
   60  */
   61 struct slot;
   62 struct slot_ctrl {
   63         void    (*mapirq)(struct slot *, int);
   64                                 /* Map irq */
   65         int     (*mapmem)(struct slot *, int);
   66                                 /* Map memory */
   67         int     (*mapio)(struct slot *, int);
   68                                 /* Map io */
   69         void    (*reset)(void *);
   70                                 /* init */
   71         void    (*disable)(struct slot *);
   72                                 /* Disable slot */
   73         int     (*power)(struct slot *);
   74                                 /* Set power values */
   75         int     (*ioctl)(struct slot *, int, caddr_t);
   76                                 /* ioctl to lower level */
   77         void    (*resume)(struct slot *);
   78                                 /* suspend/resume support */
   79         int     maxmem;         /* Number of allowed memory windows */
   80         int     maxio;          /* Number of allowed I/O windows */
   81 };
   82 
   83 /*
   84  *      Device structure for cards. Each card may have one
   85  *      or more pccard drivers attached to it; each driver is assumed
   86  *      to require at most one interrupt handler, one I/O block
   87  *      and one memory block. This structure is used to link the different
   88  *      devices together.
   89  */
   90 struct pccard_devinfo {
   91         uint8_t         name[128];
   92         int             running;        /* Current state of driver */
   93         uint8_t         misc[DEV_MISC_LEN]; /* For any random info */
   94         uint8_t         manufstr[DEV_MAX_CIS_LEN];
   95         uint8_t         versstr[DEV_MAX_CIS_LEN];
   96         uint8_t         cis3str[DEV_MAX_CIS_LEN];
   97         uint8_t         cis4str[DEV_MAX_CIS_LEN];
   98         uint32_t        manufacturer;   /* Manufacturer ID */
   99         uint32_t        product;        /* Product ID */
  100         uint32_t        prodext;        /* Product ID (extended) */
  101         struct slot     *slt;           /* Back pointer to slot */
  102         struct resource_list resources;
  103 };
  104 
  105 /*
  106  *      Per-slot structure.
  107  */
  108 struct slot {
  109         int slotnum;                    /* Slot number */
  110         int flags;                      /* Slot flags (see below) */
  111         int rwmem;                      /* Read/write flags */
  112         int irq;                        /* IRQ allocated (0 = none) */
  113 
  114         /*
  115          *      flags.
  116          */
  117         unsigned int    insert_seq;     /* Firing up under the card */
  118         struct callout_handle insert_ch;/* Insert event timeout handle */
  119         struct callout_handle poff_ch;  /* Power Off timeout handle */
  120 
  121         enum cardstate  state, laststate; /* Current/last card states */
  122         struct selinfo  selp;           /* Info for select */
  123         struct mem_desc mem[NUM_MEM_WINDOWS];   /* Memory windows */
  124         struct io_desc  io[NUM_IO_WINDOWS];     /* I/O windows */
  125         struct power    pwr;            /* Power values */
  126         struct slot_ctrl *ctrl;         /* Per-controller data */
  127         void            *cdata;         /* Controller specific data */
  128         int             pwr_off_pending;/* Power status of slot */
  129         device_t        dev;            /* Config system device. */
  130         struct cdev *d;         /* fs device */
  131 };
  132 
  133 #define PCCARD_DEVICE2SOFTC(d)  ((struct slot *) device_get_softc(d))
  134 #define PCCARD_DEV2SOFTC(d)     ((struct slot *) (d)->si_drv1)
  135 
  136 enum card_event { card_removed, card_inserted, card_deactivated };
  137 
  138 struct slot     *pccard_init_slot(device_t, struct slot_ctrl *);
  139 void             pccard_event(struct slot *, enum card_event);
  140 int              pccard_suspend(device_t);
  141 int              pccard_resume(device_t);
  142 
  143 #endif /* !_PCCARD_SLOT_H */

Cache object: 4de8d7b3320903d7ef13610254a82b8b


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