Home | History | Annotate | Line # | Download | only in pci
auichreg.h revision 1.9
      1  1.9  jmcneill /*	$NetBSD: auichreg.h,v 1.9 2005/04/11 18:25:38 jmcneill Exp $	*/
      2  1.1   thorpej 
      3  1.1   thorpej /*
      4  1.1   thorpej  * Copyright (c) 2000 Michael Shalayeff
      5  1.1   thorpej  * All rights reserved.
      6  1.1   thorpej  *
      7  1.1   thorpej  * Redistribution and use in source and binary forms, with or without
      8  1.1   thorpej  * modification, are permitted provided that the following conditions
      9  1.1   thorpej  * are met:
     10  1.1   thorpej  * 1. Redistributions of source code must retain the above copyright
     11  1.1   thorpej  *    notice, this list of conditions and the following disclaimer.
     12  1.1   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1   thorpej  *    notice, this list of conditions and the following disclaimer in the
     14  1.1   thorpej  *    documentation and/or other materials provided with the distribution.
     15  1.1   thorpej  * 3. The name of the author may not be used to endorse or promote products
     16  1.1   thorpej  *    derived from this software without specific prior written permission.
     17  1.1   thorpej  *
     18  1.1   thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19  1.1   thorpej  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20  1.1   thorpej  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21  1.1   thorpej  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
     22  1.1   thorpej  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     23  1.1   thorpej  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     24  1.1   thorpej  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25  1.1   thorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     26  1.1   thorpej  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     27  1.1   thorpej  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     28  1.1   thorpej  * THE POSSIBILITY OF SUCH DAMAGE.
     29  1.1   thorpej  *
     30  1.1   thorpej  *	from OpenBSD: ich.c,v 1.3 2000/08/11 06:17:18 mickey Exp
     31  1.1   thorpej  */
     32  1.1   thorpej 
     33  1.1   thorpej #ifndef _DEV_PCI_AUICHREG_H_
     34  1.1   thorpej #define	_DEV_PCI_AUICHREG_H_
     35  1.1   thorpej 
     36  1.1   thorpej /*
     37  1.1   thorpej  * AC'97 audio found on Intel 810/820/440MX chipsets.
     38  1.1   thorpej  *	http://developer.intel.com/design/chipsets/datashts/290655.htm
     39  1.1   thorpej  *	http://developer.intel.com/design/chipsets/manuals/298028.htm
     40  1.1   thorpej  */
     41  1.1   thorpej 
     42  1.1   thorpej /* 12.1.10 NAMBAR - native audio mixer base address register */
     43  1.1   thorpej #define	ICH_NAMBAR	0x10
     44  1.1   thorpej /* 12.1.11 NABMBAR - native audio bus mastering base address register */
     45  1.1   thorpej #define	ICH_NABMBAR	0x14
     46  1.7      kent #define ICH_MMBAR	0x18	/* ICH4/ICH5 native audio mixer BAR */
     47  1.7      kent #define ICH_MBBAR	0x1c	/* ICH4/ICH5 native bus mastering BAR */
     48  1.6      kent #define ICH_CFG		0x41
     49  1.6      kent #define		ICH_CFG_IOSE	0x01
     50  1.1   thorpej 
     51  1.1   thorpej /* table 12-3. native audio bus master control registers */
     52  1.1   thorpej #define	ICH_BDBAR	0x00	/* 8-byte aligned address */
     53  1.1   thorpej #define	ICH_CIV		0x04	/* 5 bits current index value */
     54  1.1   thorpej #define	ICH_LVI		0x05	/* 5 bits last valid index value */
     55  1.1   thorpej #define		ICH_LVI_MASK	0x1f
     56  1.1   thorpej #define	ICH_STS		0x06	/* 16 bits status */
     57  1.1   thorpej #define		ICH_FIFOE	0x10	/* fifo error */
     58  1.1   thorpej #define		ICH_BCIS	0x08	/* r- buf cmplt int sts; wr ack */
     59  1.1   thorpej #define		ICH_LVBCI	0x04	/* r- last valid bci, wr ack */
     60  1.1   thorpej #define		ICH_CELV	0x02	/* current equals last valid */
     61  1.5       wiz #define		ICH_DCH		0x01	/* DMA halted */
     62  1.1   thorpej #define		ICH_ISTS_BITS	"\020\01dch\02celv\03lvbci\04bcis\05fifoe"
     63  1.1   thorpej #define	ICH_PICB	0x08	/* 16 bits */
     64  1.1   thorpej #define	ICH_PIV		0x0a	/* 5 bits prefetched index value */
     65  1.1   thorpej #define	ICH_CTRL	0x0b	/* control */
     66  1.1   thorpej #define		ICH_IOCE	0x10	/* int on completion enable */
     67  1.1   thorpej #define		ICH_FEIE	0x08	/* fifo error int enable */
     68  1.1   thorpej #define		ICH_LVBIE	0x04	/* last valid buf int enable */
     69  1.1   thorpej #define		ICH_RR		0x02	/* 1 - reset regs */
     70  1.1   thorpej #define		ICH_RPBM	0x01	/* 1 - run, 0 - pause */
     71  1.1   thorpej 
     72  1.9  jmcneill #define	ICH_CODEC_OFFSET	0x80
     73  1.9  jmcneill 
     74  1.1   thorpej #define	ICH_PCMI	0x00
     75  1.1   thorpej #define	ICH_PCMO	0x10
     76  1.1   thorpej #define	ICH_MICI	0x20
     77  1.1   thorpej 
     78  1.1   thorpej #define	ICH_GCTRL	0x2c
     79  1.3      kent #define		ICH_SSM_78	0x40000000 /* S/PDIF slots 7 and 8 */
     80  1.3      kent #define		ICH_SSM_69	0x80000000 /* S/PDIF slots 6 and 9 */
     81  1.3      kent #define		ICH_SSM_1011	0xc0000000 /* S/PDIF slots 10 and 11 */
     82  1.3      kent #define		ICH_POM16	0x000000 /* PCM out precision 16bit */
     83  1.3      kent #define		ICH_POM20	0x400000 /* PCM out precision 20bit */
     84  1.3      kent #define		ICH_PCM246_MASK	0x300000
     85  1.3      kent #define		 ICH_PCM2	0x000000 /* 2ch output */
     86  1.3      kent #define		 ICH_PCM4	0x100000 /* 4ch output */
     87  1.3      kent #define		 ICH_PCM6	0x200000 /* 6ch output */
     88  1.3      kent #define		ICH_S2RIE	0x40	/* int when tertiary codec resume */
     89  1.1   thorpej #define		ICH_SRIE	0x20	/* int when 2ndary codec resume */
     90  1.1   thorpej #define		ICH_PRIE	0x10	/* int when primary codec resume */
     91  1.1   thorpej #define		ICH_ACLSO	0x08	/* aclink shut off */
     92  1.1   thorpej #define		ICH_WRESET	0x04	/* warm reset */
     93  1.1   thorpej #define		ICH_CRESET	0x02	/* cold reset */
     94  1.1   thorpej #define		ICH_GIE		0x01	/* gpi int enable */
     95  1.1   thorpej #define	ICH_GSTS	0x30
     96  1.3      kent #define		ICH_S2RI	0x20000000 /* tertiary resume int */
     97  1.3      kent #define		ICH_S2CR	0x10000000 /* tertiary codec ready */
     98  1.3      kent #define		ICH_BCS		0x08000000 /* bit clock stopped */
     99  1.3      kent #define		ICH_SPINT	0x04000000 /* S/PDIF int */
    100  1.3      kent #define		ICH_P2INT	0x02000000 /* PCM-In 2 int */
    101  1.3      kent #define		ICH_M2INT	0x01000000 /* mic 2 int */
    102  1.3      kent #define		ICH_SAMPLE_CAP	0x00c00000 /* sampling precision capability */
    103  1.3      kent #define		ICH_CHAN_CAP	0x00300000 /* multi-channel capability */
    104  1.1   thorpej #define		ICH_MD3		0x20000	/* pwr-dn semaphore for modem */
    105  1.1   thorpej #define		ICH_AD3		0x10000	/* pwr-dn semaphore for audio */
    106  1.1   thorpej #define		ICH_RCS		0x08000	/* read completion status */
    107  1.1   thorpej #define		ICH_B3S12	0x04000	/* bit 3 of slot 12 */
    108  1.1   thorpej #define		ICH_B2S12	0x02000	/* bit 2 of slot 12 */
    109  1.1   thorpej #define		ICH_B1S12	0x01000	/* bit 1 of slot 12 */
    110  1.1   thorpej #define		ICH_SRI		0x00800	/* secondary resume int */
    111  1.1   thorpej #define		ICH_PRI		0x00400	/* primary resume int */
    112  1.1   thorpej #define		ICH_SCR		0x00200	/* secondary codec ready */
    113  1.1   thorpej #define		ICH_PCR		0x00100	/* primary codec ready */
    114  1.1   thorpej #define		ICH_MINT	0x00080	/* mic in int */
    115  1.1   thorpej #define		ICH_POINT	0x00040	/* pcm out int */
    116  1.1   thorpej #define		ICH_PIINT	0x00020	/* pcm in int */
    117  1.1   thorpej #define		ICH_MOINT	0x00004	/* modem out int */
    118  1.1   thorpej #define		ICH_MIINT	0x00002	/* modem in int */
    119  1.1   thorpej #define		ICH_GSCI	0x00001	/* gpi status change */
    120  1.1   thorpej #define		ICH_GSTS_BITS	"\020\01gsci\02miict\03moint\06piint\07point\010mint\011pcr\012scr\013pri\014sri\015b1s12\016b2s12\017b3s12\020rcs\021ad3\022md3"
    121  1.1   thorpej #define	ICH_CAS		0x34	/* 1/8 bit */
    122  1.1   thorpej #define	ICH_SEMATIMO	1000	/* us */
    123  1.1   thorpej 
    124  1.8      cube #define	ICH_SIS_NV_CTL	0x4c	/* some SiS/nVidia register.  From Linux */
    125  1.8      cube #define		ICH_SIS_CTL_UNMUTE	0x01	/* un-mute the output */
    126  1.8      cube 
    127  1.1   thorpej /*
    128  1.1   thorpej  * according to the dev/audiovar.h AU_RING_SIZE is 2^16, what fits
    129  1.1   thorpej  * in our limits perfectly, i.e. setting it to higher value
    130  1.1   thorpej  * in your kernel config would improve perfomance, still 2^21 is the max
    131  1.1   thorpej  */
    132  1.1   thorpej #define	ICH_DMALIST_MAX	32
    133  1.1   thorpej #define	ICH_DMASEG_MAX	(65536*2)	/* 64k samples, 2x16 bit samples */
    134  1.1   thorpej struct auich_dmalist {
    135  1.1   thorpej 	u_int32_t	base;
    136  1.1   thorpej 	u_int32_t	len;
    137  1.1   thorpej #define	ICH_DMAF_IOC	0x80000000	/* 1-int on complete */
    138  1.1   thorpej #define	ICH_DMAF_BUP	0x40000000	/* 0-retrans last, 1-transmit 0 */
    139  1.1   thorpej };
    140  1.1   thorpej 
    141  1.1   thorpej #endif /* _DEV_PCI_AUICHREG_H_ */
    142