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/sound/pci/hda/hdac_private.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  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2006 Stephane E. Potvin <sepotvin@videotron.ca>
    5  * Copyright (c) 2008-2012 Alexander Motin <mav@FreeBSD.org>
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * $FreeBSD$
   30  */
   31 
   32 #ifndef _HDAC_PRIVATE_H_
   33 #define _HDAC_PRIVATE_H_
   34 
   35 /****************************************************************************
   36  * Miscellaneous defines
   37  ****************************************************************************/
   38 #define HDAC_CODEC_MAX          16
   39 
   40 /****************************************************************************
   41  * Helper Macros
   42  ****************************************************************************/
   43 #define HDAC_READ_1(mem, offset)                                        \
   44         bus_space_read_1((mem)->mem_tag, (mem)->mem_handle, (offset))
   45 #define HDAC_READ_2(mem, offset)                                        \
   46         bus_space_read_2((mem)->mem_tag, (mem)->mem_handle, (offset))
   47 #define HDAC_READ_4(mem, offset)                                        \
   48         bus_space_read_4((mem)->mem_tag, (mem)->mem_handle, (offset))
   49 #define HDAC_WRITE_1(mem, offset, value)                                \
   50         bus_space_write_1((mem)->mem_tag, (mem)->mem_handle, (offset), (value))
   51 #define HDAC_WRITE_2(mem, offset, value)                                \
   52         bus_space_write_2((mem)->mem_tag, (mem)->mem_handle, (offset), (value))
   53 #define HDAC_WRITE_4(mem, offset, value)                                \
   54         bus_space_write_4((mem)->mem_tag, (mem)->mem_handle, (offset), (value))
   55 
   56 #define HDAC_ISDCTL(sc, n)      (_HDAC_ISDCTL((n), (sc)->num_iss, (sc)->num_oss))
   57 #define HDAC_ISDSTS(sc, n)      (_HDAC_ISDSTS((n), (sc)->num_iss, (sc)->num_oss))
   58 #define HDAC_ISDPICB(sc, n)     (_HDAC_ISDPICB((n), (sc)->num_iss, (sc)->num_oss))
   59 #define HDAC_ISDCBL(sc, n)      (_HDAC_ISDCBL((n), (sc)->num_iss, (sc)->num_oss))
   60 #define HDAC_ISDLVI(sc, n)      (_HDAC_ISDLVI((n), (sc)->num_iss, (sc)->num_oss))
   61 #define HDAC_ISDFIFOD(sc, n)    (_HDAC_ISDFIFOD((n), (sc)->num_iss, (sc)->num_oss))
   62 #define HDAC_ISDFMT(sc, n)      (_HDAC_ISDFMT((n), (sc)->num_iss, (sc)->num_oss))
   63 #define HDAC_ISDBDPL(sc, n)     (_HDAC_ISDBDPL((n), (sc)->num_iss, (sc)->num_oss))
   64 #define HDAC_ISDBDPU(sc, n)     (_HDAC_ISDBDPU((n), (sc)->num_iss, (sc)->num_oss))
   65 
   66 #define HDAC_OSDCTL(sc, n)      (_HDAC_OSDCTL((n), (sc)->num_iss, (sc)->num_oss))
   67 #define HDAC_OSDSTS(sc, n)      (_HDAC_OSDSTS((n), (sc)->num_iss, (sc)->num_oss))
   68 #define HDAC_OSDPICB(sc, n)     (_HDAC_OSDPICB((n), (sc)->num_iss, (sc)->num_oss))
   69 #define HDAC_OSDCBL(sc, n)      (_HDAC_OSDCBL((n), (sc)->num_iss, (sc)->num_oss))
   70 #define HDAC_OSDLVI(sc, n)      (_HDAC_OSDLVI((n), (sc)->num_iss, (sc)->num_oss))
   71 #define HDAC_OSDFIFOD(sc, n)    (_HDAC_OSDFIFOD((n), (sc)->num_iss, (sc)->num_oss))
   72 #define HDAC_OSDBDPL(sc, n)     (_HDAC_OSDBDPL((n), (sc)->num_iss, (sc)->num_oss))
   73 #define HDAC_OSDBDPU(sc, n)     (_HDAC_OSDBDPU((n), (sc)->num_iss, (sc)->num_oss))
   74 
   75 #define HDAC_BSDCTL(sc, n)      (_HDAC_BSDCTL((n), (sc)->num_iss, (sc)->num_oss))
   76 #define HDAC_BSDSTS(sc, n)      (_HDAC_BSDSTS((n), (sc)->num_iss, (sc)->num_oss))
   77 #define HDAC_BSDPICB(sc, n)     (_HDAC_BSDPICB((n), (sc)->num_iss, (sc)->num_oss))
   78 #define HDAC_BSDCBL(sc, n)      (_HDAC_BSDCBL((n), (sc)->num_iss, (sc)->num_oss))
   79 #define HDAC_BSDLVI(sc, n)      (_HDAC_BSDLVI((n), (sc)->num_iss, (sc)->num_oss))
   80 #define HDAC_BSDFIFOD(sc, n)    (_HDAC_BSDFIFOD((n), (sc)->num_iss, (sc)->num_oss))
   81 #define HDAC_BSDBDPL(sc, n)     (_HDAC_BSDBDPL((n), (sc)->num_iss, (sc)->num_oss))
   82 #define HDAC_BSDBDPU(sc, n)     (_HDAC_BSDBDPU((n), (sc)->num_iss, (sc)->num_oss))
   83 
   84 /****************************************************************************
   85  * Custom hdac malloc type
   86  ****************************************************************************/
   87 MALLOC_DECLARE(M_HDAC);
   88 
   89 /****************************************************************************
   90  * struct hdac_mem
   91  *
   92  * Holds the resources necessary to describe the physical memory associated
   93  * with the device.
   94  ****************************************************************************/
   95 struct hdac_mem {
   96         struct resource         *mem_res;
   97         int                     mem_rid;
   98         bus_space_tag_t         mem_tag;
   99         bus_space_handle_t      mem_handle;
  100 };
  101 
  102 /****************************************************************************
  103  * struct hdac_irq
  104  *
  105  * Holds the resources necessary to describe the irq associated with the
  106  * device.
  107  ****************************************************************************/
  108 struct hdac_irq {
  109         struct resource         *irq_res;
  110         int                     irq_rid;
  111         void                    *irq_handle;
  112 };
  113 
  114 /****************************************************************************
  115  * struct hdac_dma
  116  *
  117  * This structure is used to hold all the information to manage the dma
  118  * states.
  119  ****************************************************************************/
  120 struct hdac_dma {
  121         bus_dma_tag_t   dma_tag;
  122         bus_dmamap_t    dma_map;
  123         bus_addr_t      dma_paddr;
  124         bus_size_t      dma_size;
  125         caddr_t         dma_vaddr;
  126 };
  127 
  128 /****************************************************************************
  129  * struct hdac_rirb
  130  *
  131  * Hold a response from a verb sent to a codec received via the rirb.
  132  ****************************************************************************/
  133 struct hdac_rirb {
  134         uint32_t        response;
  135         uint32_t        response_ex;
  136 };
  137 
  138 #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK     0x0000000f
  139 #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET   0
  140 #define HDAC_RIRB_RESPONSE_EX_UNSOLICITED       0x00000010
  141 
  142 #define HDAC_RIRB_RESPONSE_EX_SDATA_IN(response_ex)                     \
  143     (((response_ex) & HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK) >>           \
  144     HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET)
  145 
  146 struct hdac_bdle {
  147         volatile uint32_t addrl;
  148         volatile uint32_t addrh;
  149         volatile uint32_t len;
  150         volatile uint32_t ioc;
  151 } __packed;
  152 
  153 struct hdac_stream {
  154         device_t        dev;
  155         struct hdac_dma bdl;
  156         int             dir;
  157         int             stream;
  158         int             blksz;
  159         int             running;
  160         int             bw;
  161         int             stripe;
  162         uint16_t        format;
  163 };
  164 
  165 struct hdac_softc {
  166         device_t        dev;
  167         struct mtx      *lock;
  168 
  169         struct intr_config_hook intrhook;
  170 
  171         struct hdac_mem mem;
  172         struct hdac_irq irq;
  173 
  174         uint32_t        quirks_on;
  175         uint32_t        quirks_off;
  176         uint32_t        flags;
  177 #define HDAC_F_DMA_NOCACHE      0x00000001
  178 
  179         int             num_iss;
  180         int             num_oss;
  181         int             num_bss;
  182         int             num_ss;
  183         int             num_sdo;
  184         int             support_64bit;
  185 
  186         int             corb_size;
  187         struct hdac_dma corb_dma;
  188         int             corb_wp;
  189 
  190         int             rirb_size;
  191         struct hdac_dma rirb_dma;
  192         int             rirb_rp;
  193 
  194         struct hdac_dma pos_dma;
  195 
  196         bus_dma_tag_t           chan_dmat;
  197 
  198         /* Polling */
  199         int                     polling;
  200         int                     poll_ival;
  201         struct callout          poll_callout;
  202 
  203         int                     unsol_registered;
  204         struct task             unsolq_task;
  205 #define HDAC_UNSOLQ_MAX         64
  206 #define HDAC_UNSOLQ_READY       0
  207 #define HDAC_UNSOLQ_BUSY        1
  208         int             unsolq_rp;
  209         int             unsolq_wp;
  210         int             unsolq_st;
  211         uint32_t        unsolq[HDAC_UNSOLQ_MAX];
  212 
  213         int                     sdo_bw_used;
  214 
  215         struct hdac_stream      *streams;
  216 
  217         struct {
  218                 device_t        dev;
  219                 uint16_t        vendor_id;
  220                 uint16_t        device_id;
  221                 uint8_t         revision_id;
  222                 uint8_t         stepping_id;
  223                 int             pending;
  224                 uint32_t        response;
  225                 int             sdi_bw_used;
  226         } codecs[HDAC_CODEC_MAX];
  227 };
  228 
  229 #endif

Cache object: 3c5f16d63adf00aa2b4d47444d7f046f


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