Home | History | Annotate | Line # | Download | only in dev
frodoreg.h revision 1.4.106.1
      1  1.4.106.1      tls /*	$NetBSD: frodoreg.h,v 1.4.106.1 2014/08/20 00:03:00 tls Exp $	*/
      2        1.1  thorpej 
      3        1.1  thorpej /*
      4        1.1  thorpej  * Copyright (c) 1997 Michael Smith.  All rights reserved.
      5        1.1  thorpej  *
      6        1.1  thorpej  * Redistribution and use in source and binary forms, with or without
      7        1.1  thorpej  * modification, are permitted provided that the following conditions
      8        1.1  thorpej  * are met:
      9        1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     10        1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     11        1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     12        1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     13        1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     14        1.1  thorpej  *
     15        1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     16        1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17        1.1  thorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18        1.1  thorpej  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     19        1.1  thorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     20        1.1  thorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     21        1.1  thorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     22        1.1  thorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     23        1.1  thorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24        1.1  thorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25        1.1  thorpej  * SUCH DAMAGE.
     26        1.1  thorpej  */
     27        1.1  thorpej 
     28        1.1  thorpej /*
     29        1.1  thorpej  * Where we find the 8250-like APCI ports, and how far apart they are.
     30        1.1  thorpej  */
     31        1.1  thorpej #define	FRODO_APCIBASE		0x0
     32        1.1  thorpej #define	FRODO_APCISPACE		0x20
     33        1.1  thorpej #define	FRODO_APCI_OFFSET(x)	(FRODO_APCIBASE + ((x) * FRODO_APCISPACE))
     34        1.1  thorpej 
     35        1.1  thorpej /*
     36        1.1  thorpej  * Other items in the Frodo part
     37        1.1  thorpej  */
     38        1.1  thorpej 
     39  1.4.106.1      tls /* An mc146818-like calendar.  Only 425e has a battery and an oscillator. */
     40        1.1  thorpej #define	FRODO_CALENDAR		0x80
     41        1.1  thorpej 
     42        1.1  thorpej #define	FRODO_TIMER		0xa0	/* 8254-like timer */
     43        1.1  thorpej #define	FRODO_T1_CTR		0xa0	/* counter 1 */
     44        1.1  thorpej #define	FRODO_T2_CTR		0xa4	/* counter 2 */
     45        1.1  thorpej #define	FRODO_T3_CTR		0xa8	/* counter 3 */
     46        1.1  thorpej #define	FRODO_T_CTRL		0xac	/* control register */
     47        1.1  thorpej #define	FRODO_T_PSCALE		0xb0	/* prescaler */
     48        1.1  thorpej #define	FRODO_T_PCOUNT		0xb4	/* precounter ? */
     49        1.1  thorpej #define	FRODO_T_OVCOUNT		0xb8	/* overflow counter (0, 1, 2) */
     50        1.1  thorpej 
     51        1.1  thorpej #define	FRODO_PIO		0xc0	/* programmable i/o registers start
     52        1.1  thorpej 					   here */
     53        1.1  thorpej #define	FRODO_IISR		0xc0	/* ISA Interrupt Status Register
     54        1.1  thorpej 					   (also PIR) */
     55        1.1  thorpej #define	FRODO_IISR_SERVICE	(1<<0)	/* service switch "on" if 0 */
     56        1.1  thorpej #define	FRODO_IISR_ILOW		(1<<1)	/* IRQ 3,4,5 or 6 on ISA if 1 */
     57        1.1  thorpej #define	FRODO_IISR_IMID		(1<<2)	/* IRQ 7,9,10 or 11 on ISA if 1 */
     58        1.1  thorpej #define	FRODO_IISR_IHI		(1<<3)	/* IRQ 12,13,14 or 15 on ISA if 1 */
     59        1.1  thorpej 		/* bits 4 and 5 are DN2500 SCSI interrupts */
     60        1.1  thorpej 		/* bit 6 is unused */
     61        1.1  thorpej #define	FRODO_IISR_IOCHK	(1<<7)	/* ISA board asserted IOCHK if low */
     62        1.1  thorpej 
     63        1.1  thorpej #define	FRODO_PIO_IPR		0xc4	/* input polarity register
     64        1.1  thorpej 					   (ints 7->0) */
     65        1.1  thorpej 
     66        1.1  thorpej #define	FRODO_PIO_IELR		0xc8	/* input edge/level register */
     67        1.1  thorpej 
     68        1.1  thorpej /* This is probably not used on the 4xx */
     69        1.1  thorpej #define	FRODO_DIAGCTL		0xd0	/* Diagnostic Control Register */
     70        1.1  thorpej 
     71        1.1  thorpej #define	FRODO_PIC_MU		0xe0	/* upper Interrupt Mask register */
     72        1.1  thorpej #define	FRODO_PIC_ML		0xe4	/* lower Interrupt Mask register */
     73        1.1  thorpej #define	FRODO_PIC_PU		0xe8	/* upper Interrupt Pending register */
     74        1.1  thorpej #define	FRODO_PIC_PL		0xec	/* lower Interrupt Pending register */
     75        1.1  thorpej #define	FRODO_PIC_IVR		0xf8	/* Interrupt Vector register */
     76        1.1  thorpej #define	FRODO_PIC_ACK		0xf8	/* Interrupt Acknowledge */
     77        1.1  thorpej 
     78        1.1  thorpej /* Shorthand for register access. */
     79        1.1  thorpej #define	FRODO_READ(sc, reg)		((sc)->sc_regs[(reg)])
     80        1.1  thorpej #define	FRODO_WRITE(sc, reg, val)	(sc)->sc_regs[(reg)] = (val)
     81        1.1  thorpej 
     82        1.1  thorpej /* manipulate interrupt registers */
     83        1.1  thorpej #define	FRODO_GETMASK(sc)						\
     84        1.1  thorpej 	((FRODO_READ((sc), FRODO_PIC_MU) << 8) | 			\
     85        1.1  thorpej 	    FRODO_READ((sc), FRODO_PIC_ML))
     86        1.1  thorpej #define	FRODO_SETMASK(sc, val) do {					\
     87        1.1  thorpej 	FRODO_WRITE((sc), FRODO_PIC_MU, ((val) >> 8) & 0xff);		\
     88        1.1  thorpej 	FRODO_WRITE((sc), FRODO_PIC_ML, (val) & 0xff); } while (0)
     89        1.1  thorpej 
     90        1.1  thorpej #define	FRODO_GETPEND(sc)						\
     91        1.1  thorpej 	((FRODO_READ((sc), FRODO_PIC_PU) << 8) |			\
     92        1.1  thorpej 	    FRODO_READ((sc), FRODO_PIC_PL))
     93        1.1  thorpej #define	FRODO_IPEND(sc)							\
     94        1.1  thorpej 	(FRODO_READ((sc), FRODO_PIC_ACK) & 0x0f)
     95        1.1  thorpej 
     96        1.1  thorpej /*
     97        1.1  thorpej  * Interrupt lines.  Use FRODO_INTR_BIT() below to get a bit
     98        1.1  thorpej  * suitable for one of the interrupt mask registers.  Yes, line
     99        1.1  thorpej  * 0 is unused.
    100        1.1  thorpej  */
    101        1.1  thorpej #define	FRODO_INTR_ILOW		1
    102        1.1  thorpej #define	FRODO_INTR_IMID		2
    103        1.1  thorpej #define	FRODO_INTR_IHI		3
    104        1.1  thorpej #define	FRODO_INTR_SCSIDMA	4	/* DN2500 only */
    105        1.1  thorpej #define	FRODO_INTR_SCSI		5	/* DN2500 only */
    106        1.1  thorpej #define	FRODO_INTR_HORIZ	6
    107        1.1  thorpej #define	FRODO_INTR_IOCHK	7
    108        1.1  thorpej #define	FRODO_INTR_CALENDAR	8
    109        1.1  thorpej #define	FRODO_INTR_TIMER0	9
    110        1.1  thorpej #define	FRODO_INTR_TIMER1	10
    111        1.1  thorpej #define	FRODO_INTR_TIMER2	11
    112        1.1  thorpej #define	FRODO_INTR_APCI0	12
    113        1.1  thorpej #define	FRODO_INTR_APCI1	13
    114        1.1  thorpej #define	FRODO_INTR_APCI2	14
    115        1.1  thorpej #define	FRODO_INTR_APCI3	15
    116        1.1  thorpej 
    117        1.1  thorpej #define	FRODO_NINTR		16
    118        1.1  thorpej 
    119        1.1  thorpej #define	FRODO_INTR_BIT(line)	(1 << (line))
    120