Home | History | Annotate | Line # | Download | only in pci
pciide_acer_reg.h revision 1.11
      1  1.11    perry /*	$NetBSD: pciide_acer_reg.h,v 1.11 2007/12/25 18:33:41 perry Exp $	*/
      2   1.1   bouyer 
      3   1.1   bouyer /*
      4   1.1   bouyer  * Copyright (c) 1999 Manuel Bouyer.
      5   1.1   bouyer  *
      6   1.1   bouyer  * Redistribution and use in source and binary forms, with or without
      7   1.1   bouyer  * modification, are permitted provided that the following conditions
      8   1.1   bouyer  * are met:
      9   1.1   bouyer  * 1. Redistributions of source code must retain the above copyright
     10   1.1   bouyer  *    notice, this list of conditions and the following disclaimer.
     11   1.1   bouyer  * 2. Redistributions in binary form must reproduce the above copyright
     12   1.1   bouyer  *    notice, this list of conditions and the following disclaimer in the
     13   1.1   bouyer  *    documentation and/or other materials provided with the distribution.
     14   1.1   bouyer  * 3. All advertising materials mentioning features or use of this software
     15   1.1   bouyer  *    must display the following acknowledgement:
     16   1.6   bouyer  *	This product includes software developed by Manuel Bouyer.
     17   1.7   bouyer  * 4. The name of the author may not be used to endorse or promote products
     18   1.7   bouyer  *    derived from this software without specific prior written permission.
     19   1.1   bouyer  *
     20   1.3   bouyer  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21   1.3   bouyer  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22   1.3   bouyer  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23   1.8    perry  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24   1.3   bouyer  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25   1.3   bouyer  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26   1.3   bouyer  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27   1.3   bouyer  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28   1.3   bouyer  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29   1.3   bouyer  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30   1.1   bouyer  *
     31   1.1   bouyer  */
     32   1.1   bouyer 
     33   1.1   bouyer /*  class code attribute register 1 (1 byte) */
     34   1.1   bouyer #define ACER_CCAR1	0x43
     35   1.1   bouyer #define ACER_CHANSTATUS_RO            0x40
     36   1.1   bouyer #define PCIIDE_CHAN_RO(chan)            (0x20 >> (chan))
     37   1.1   bouyer 
     38   1.4   bouyer /* from Linux, 80 pins cable detect */
     39   1.4   bouyer #define ACER_0x4A	0x4a
     40   1.4   bouyer /*
     41   1.4   bouyer  * bit 0 is 0 -> primary has 80 pin cable
     42   1.4   bouyer  * bit 1 is 0 -> secondary has 80 pin cable
     43   1.4   bouyer  */
     44   1.4   bouyer #define ACER_0x4A_80PIN(chan)	(0x1 << (chan))
     45   1.4   bouyer 
     46   1.4   bouyer /* From FreeBSD, for UDMA mode > 2 */
     47   1.4   bouyer #define ACER_0x4B	0x4b
     48   1.4   bouyer #define ACER_0x4B_UDMA66	0x01
     49   1.4   bouyer /* From Linux */
     50   1.4   bouyer #define ACER_0x4B_CDETECT	0x08
     51   1.4   bouyer 
     52   1.1   bouyer /* class code attribute register 2 (1 byte) */
     53   1.1   bouyer #define ACER_CCAR2	0x4d
     54   1.1   bouyer #define ACER_CHANSTATUSREGS_RO 0x80
     55   1.1   bouyer 
     56   1.1   bouyer /* class code attribute register 3 (1 byte) */
     57   1.1   bouyer #define ACER_CCAR3	0x50
     58   1.1   bouyer #define ACER_CCAR3_PI	0x02
     59   1.1   bouyer 
     60   1.1   bouyer /* flexible channel setting register */
     61   1.1   bouyer #define ACER_FCS	0x52
     62   1.1   bouyer #define ACER_FCS_TIMREG(chan,drv)	((0x8) >> ((drv) + (chan) * 2))
     63   1.1   bouyer 
     64   1.1   bouyer /* CD-ROM control register */
     65   1.1   bouyer #define ACER_CDRC	0x53
     66   1.1   bouyer #define ACER_CDRC_FIFO_DISABLE	0x02
     67   1.1   bouyer #define ACER_CDRC_DMA_EN	0x01
     68   1.1   bouyer 
     69   1.1   bouyer /* Fifo threshold and Ultra-DMA settings (4 bytes). */
     70   1.1   bouyer #define ACER_FTH_UDMA	0x54
     71   1.1   bouyer #define ACER_FTH_VAL(chan, drv, val) \
     72   1.1   bouyer 	(((val) & 0x3) << ((drv) * 4 + (chan) * 8))
     73   1.1   bouyer #define ACER_FTH_OPL(chan, drv, val) \
     74   1.1   bouyer 	(((val) & 0x3) << (2 + (drv) * 4 + (chan) * 8))
     75   1.1   bouyer #define ACER_UDMA_EN(chan, drv) \
     76   1.1   bouyer 	(0x8 << (16 + (drv) * 4 + (chan) * 8))
     77   1.1   bouyer #define ACER_UDMA_TIM(chan, drv, val) \
     78   1.1   bouyer 	(((val) & 0x7) << (16 + (drv) * 4 + (chan) * 8))
     79   1.1   bouyer 
     80   1.1   bouyer /* drives timings setup (1 byte) */
     81   1.1   bouyer #define ACER_IDETIM(chan, drv) (0x5a + (drv) + (chan) * 4)
     82   1.2   bouyer 
     83   1.2   bouyer /* IRQ and drive select status */
     84   1.2   bouyer #define ACER_CHIDS	0x75
     85   1.2   bouyer #define ACER_CHIDS_DRV(channel)	((0x4) << (channel))
     86   1.2   bouyer #define ACER_CHIDS_INT(channel)	((0x1) << (channel))
     87   1.1   bouyer 
     88   1.4   bouyer /* Linux: south-bridge's enable bit (m1533) */
     89   1.4   bouyer #define ACER_0x79	0x79
     90   1.4   bouyer #define ACER_0x79_REVC2_EN	0x4
     91   1.4   bouyer #define ACER_0x79_EN		0x2
     92   1.4   bouyer 
     93   1.9   bouyer /* OpenSolaris: channel enable/disable in the PCI-ISA bridge */
     94   1.9   bouyer #define ACER_PCIB_CTRL	0x58
     95   1.9   bouyer #define ACER_PCIB_CTRL_ENCHAN(chan) (0x4 << (chan))
     96   1.9   bouyer 
     97   1.1   bouyer /*
     98   1.1   bouyer  * IDE bus frequency (1 byte)
     99   1.1   bouyer  * This should be setup by the BIOS - can we rely on this ?
    100   1.1   bouyer  */
    101   1.8    perry #define ACER_IDE_CLK	0x78
    102   1.1   bouyer 
    103   1.4   bouyer /* acer UDMA3/4/5 from FreeBSD */
    104  1.11    perry static const int8_t acer_udma[] __unused =
    105   1.5  thorpej     {0x4, 0x3, 0x2, 0x1, 0x0, 0x7};
    106  1.11    perry static const int8_t acer_pio[] __unused =
    107   1.5  thorpej     {0x0c, 0x58, 0x44, 0x33, 0x31};
    108   1.1   bouyer #ifdef unused
    109  1.11    perry static const int8_t acer_dma[] __unused =
    110   1.5  thorpej     {0x08, 0x33, 0x31};
    111   1.1   bouyer #endif
    112