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/pccard/pccardvarp.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  * Copyright (c) 2005, M. Warner Losh
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice unmodified, this list of conditions, and the following
   10  *    disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/9.2/sys/dev/pccard/pccardvarp.h 189318 2009-03-03 18:57:59Z imp $
   28  */
   29 
   30 #ifndef _PCCARD_PCCARDVARP_H
   31 #define _PCCARD_PCCARDVARP_H
   32 
   33 /* pccard itself */
   34 
   35 #define PCCARD_MEM_PAGE_SIZE            1024
   36 
   37 #define PCCARD_CFE_MWAIT_REQUIRED       0x0001
   38 #define PCCARD_CFE_RDYBSY_ACTIVE        0x0002
   39 #define PCCARD_CFE_WP_ACTIVE            0x0004
   40 #define PCCARD_CFE_BVD_ACTIVE           0x0008
   41 #define PCCARD_CFE_IO8                  0x0010
   42 #define PCCARD_CFE_IO16                 0x0020
   43 #define PCCARD_CFE_IRQSHARE             0x0040
   44 #define PCCARD_CFE_IRQPULSE             0x0080
   45 #define PCCARD_CFE_IRQLEVEL             0x0100
   46 #define PCCARD_CFE_POWERDOWN            0x0200
   47 #define PCCARD_CFE_READONLY             0x0400
   48 #define PCCARD_CFE_AUDIO                0x0800
   49 
   50 struct pccard_config_entry {
   51         int             number;
   52         uint32_t        flags;
   53         int             iftype;
   54         int             num_iospace;
   55 
   56         /*
   57          * The card will only decode this mask in any case, so we can
   58          * do dynamic allocation with this in mind, in case the suggestions
   59          * below are no good.
   60          */
   61         u_long          iomask;
   62         struct {
   63                 u_long  length;
   64                 u_long  start;
   65         } iospace[4];           /* XXX this could be as high as 16 */
   66         uint16_t        irqmask;
   67         int             num_memspace;
   68         struct {
   69                 u_long  length;
   70                 u_long  cardaddr;
   71                 u_long  hostaddr;
   72         } memspace[2];          /* XXX this could be as high as 8 */
   73         int             maxtwins;
   74         STAILQ_ENTRY(pccard_config_entry) cfe_list;
   75 };
   76 
   77 struct pccard_funce_disk {
   78         uint8_t pfd_interface;
   79         uint8_t pfd_power;
   80 };
   81 
   82 struct pccard_funce_lan {
   83         int pfl_nidlen;
   84         uint8_t pfl_nid[8];
   85 };
   86 
   87 union pccard_funce {
   88         struct pccard_funce_disk pfv_disk;
   89         struct pccard_funce_lan pfv_lan;
   90 };
   91 
   92 struct pccard_function {
   93         /* read off the card */
   94         int             number;
   95         int             function;
   96         int             last_config_index;
   97         uint32_t        ccr_base;       /* Offset with card's memory */
   98         uint32_t        ccr_mask;
   99         struct resource *ccr_res;
  100         int             ccr_rid;
  101         STAILQ_HEAD(, pccard_config_entry) cfe_head;
  102         STAILQ_ENTRY(pccard_function) pf_list;
  103         /* run-time state */
  104         struct pccard_softc *sc;
  105         struct pccard_config_entry *cfe;
  106         struct pccard_mem_handle pf_pcmh;
  107         device_t        dev;
  108 #define pf_ccrt         pf_pcmh.memt
  109 #define pf_ccrh         pf_pcmh.memh
  110 #define pf_ccr_realsize pf_pcmh.realsize
  111         uint32_t        pf_ccr_offset;  /* Offset from ccr_base of CIS */
  112         int             pf_ccr_window;
  113         bus_addr_t      pf_mfc_iobase;
  114         bus_addr_t      pf_mfc_iomax;
  115         int             pf_flags;
  116         driver_filter_t *intr_filter;
  117         driver_intr_t   *intr_handler;
  118         void            *intr_handler_arg;
  119         void            *intr_handler_cookie;
  120 
  121         union pccard_funce pf_funce; /* CISTPL_FUNCE */
  122 #define pf_funce_disk_interface pf_funce.pfv_disk.pfd_interface
  123 #define pf_funce_disk_power pf_funce.pfv_disk.pfd_power
  124 #define pf_funce_lan_nid pf_funce.pfv_lan.pfl_nid
  125 #define pf_funce_lan_nidlen pf_funce.pfv_lan.pfl_nidlen
  126 };
  127 
  128 /* pf_flags */
  129 #define PFF_ENABLED     0x0001          /* function is enabled */
  130 
  131 struct pccard_card {
  132         int             cis1_major;
  133         int             cis1_minor;
  134         /* XXX waste of space? */
  135         char            cis1_info_buf[256];
  136         char            *cis1_info[4];
  137         /*
  138          * Use int32_t for manufacturer and product so that they can
  139          * hold the id value found in card CIS and special value that
  140          * indicates no id was found.
  141          */
  142         int32_t         manufacturer;
  143 #define PCMCIA_VENDOR_INVALID   -1
  144         int32_t         product;
  145 #define PCMCIA_PRODUCT_INVALID          -1
  146         int16_t         prodext;
  147         uint16_t        error;
  148 #define PCMCIA_CIS_INVALID              { NULL, NULL, NULL, NULL }
  149         STAILQ_HEAD(, pccard_function) pf_head;
  150 };
  151 
  152 /* More later? */
  153 struct pccard_ivar {
  154         struct resource_list resources;
  155         struct pccard_function *pf;
  156 };
  157 
  158 struct cis_buffer
  159 {
  160         size_t  len;                    /* Actual length of the CIS */
  161         uint8_t buffer[2040];           /* small enough to be 2k */
  162 };
  163 
  164 struct pccard_softc {
  165         device_t                dev;
  166         /* this stuff is for the socket */
  167 
  168         /* this stuff is for the card */
  169         struct pccard_card card;
  170         int             sc_enabled_count;       /* num functions enabled */
  171         struct cdev *cisdev;
  172         int     cis_open;
  173         struct cis_buffer *cis;
  174 };
  175 
  176 struct pccard_cis_quirk {
  177         int32_t manufacturer;
  178         int32_t product;
  179         char *cis1_info[4];
  180         struct pccard_function *pf;
  181         struct pccard_config_entry *cfe;
  182 };
  183 
  184 void    pccard_read_cis(struct pccard_softc *);
  185 void    pccard_check_cis_quirks(device_t);
  186 void    pccard_print_cis(device_t);
  187 int     pccard_scan_cis(device_t, device_t, pccard_scan_t, void *);
  188 
  189 int     pccard_device_create(struct pccard_softc *);
  190 int     pccard_device_destroy(struct pccard_softc *);
  191 
  192 #define PCCARD_SOFTC(d) (struct pccard_softc *) device_get_softc(d)
  193 #define PCCARD_IVAR(d) (struct pccard_ivar *) device_get_ivars(d)
  194 
  195 #endif /* _PCCARD_PCCARDVARP_H */

Cache object: 06afa29d94a1ae2a82cde1aa46a4215d


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