Home | History | Annotate | Line # | Download | only in ic
i8259reg.h revision 1.1
      1  1.1  thorpej /*	$NetBSD: i8259reg.h,v 1.1 2001/06/21 03:43:43 thorpej Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*-
      4  1.1  thorpej  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  1.1  thorpej  * All rights reserved.
      6  1.1  thorpej  *
      7  1.1  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  thorpej  * by Jason R. Thorpe.
      9  1.1  thorpej  *
     10  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     11  1.1  thorpej  * modification, are permitted provided that the following conditions
     12  1.1  thorpej  * are met:
     13  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     14  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     15  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     19  1.1  thorpej  *    must display the following acknowledgement:
     20  1.1  thorpej  *	This product includes software developed by the NetBSD
     21  1.1  thorpej  *	Foundation, Inc. and its contributors.
     22  1.1  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  thorpej  *    contributors may be used to endorse or promote products derived
     24  1.1  thorpej  *    from this software without specific prior written permission.
     25  1.1  thorpej  *
     26  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  thorpej  */
     38  1.1  thorpej 
     39  1.1  thorpej #ifndef _DEV_IC_I8259REG_H_
     40  1.1  thorpej #define	_DEV_IC_I8259REG_H_
     41  1.1  thorpej 
     42  1.1  thorpej /*
     43  1.1  thorpej  * Register definitions for the Intel i8259 Programmable Interrupt
     44  1.1  thorpej  * Controller.
     45  1.1  thorpej  *
     46  1.1  thorpej  * XXX More bits should be filled in, here, as this was taken from
     47  1.1  thorpej  * XXX the Intel PIIX4 manual.  Someone with a real 8259 data sheet
     48  1.1  thorpej  * XXX should fill them in.
     49  1.1  thorpej  */
     50  1.1  thorpej 
     51  1.1  thorpej /*
     52  1.1  thorpej  * Note a write to ICW1 starts an initialization cycle, and must be
     53  1.1  thorpej  * followied by writes to ICW2, ICW3, and ICW4.
     54  1.1  thorpej  */
     55  1.1  thorpej #define	PIC_ICW1	0x00	/* Initialization Command Word 1 (w) */
     56  1.1  thorpej #define	ICW1_IC4	(1U << 0)	/* ICW4 Write Required */
     57  1.1  thorpej #define	ICW1_SNGL	(1U << 1)	/* 1 == single, 0 == cascade */
     58  1.1  thorpej #define	ICW1_ADI	(1U << 2)	/* XXX */
     59  1.1  thorpej #define	ICW1_LTIM	(1U << 3)	/* 1 == intrs are level trigger */
     60  1.1  thorpej #define	ICW_SELECT(x)	((x) << 4)	/* select ICW */
     61  1.1  thorpej 
     62  1.1  thorpej #define	PIC_ICW2	0x01	/* Initialization Command Word 2 (w) */
     63  1.1  thorpej #define	ICW2_VECTOR(x)	((x) & 0xf8)	/* vector base address */
     64  1.1  thorpej #define	ICW2_IRL(x)	((x) << 0)	/* interrupt request level */
     65  1.1  thorpej 
     66  1.1  thorpej #define	PIC_ICW3	0x01	/* Initialization Command Word 3 (w) */
     67  1.1  thorpej #define	ICW3_CASCADE	(1U << 2)	/* cascaded mode enable */
     68  1.1  thorpej #define	ICW3_SIC(x)	((x) << 0)	/* slave identifcation code */
     69  1.1  thorpej 
     70  1.1  thorpej #define	PIC_ICW4	0x01	/* Initialization Command Word 4 (w) */
     71  1.1  thorpej #define	ICW4_8086	(1U << 0)	/* 8086 mode */
     72  1.1  thorpej #define	ICW4_AEOI	(1U << 1)	/* automatic end-of-interrupt */
     73  1.1  thorpej #define	ICW4_BUFM	(1U << 2)	/* buffered mode master */
     74  1.1  thorpej #define	ICW4_BUF	(1U << 3)	/* buffered mode */
     75  1.1  thorpej #define	ICW4_SFNM	(1U << 4)	/* special fully nested mode */
     76  1.1  thorpej 
     77  1.1  thorpej /*
     78  1.1  thorpej  * After an initialization sequence, you get to access the OCWs.
     79  1.1  thorpej  */
     80  1.1  thorpej #define	PIC_OCW1	0x01	/* Operational Control Word 1 (r/w) */
     81  1.1  thorpej #define	OCW1_IRM(x)	(1U << (x))	/* interrupt request mask */
     82  1.1  thorpej 
     83  1.1  thorpej #define	PIC_OCW2	0x00	/* Operational Control Word 2 (w) */
     84  1.1  thorpej #define	OCW2_SELECT	(0)		/* select OCW2 */
     85  1.1  thorpej #define	OCW2_OP(x)	((x) << 5)	/* operation; see below */
     86  1.1  thorpej #define	OCW2_ILS(x)	((x) << 0)	/* interrupt level select */
     87  1.1  thorpej 
     88  1.1  thorpej #define	OCW2_OP_CLR_ROTATE_IN_AUTO_EOI_MODE	0
     89  1.1  thorpej #define	OCW2_OP_NON_SPECIFIC_EOI_CMD		1
     90  1.1  thorpej #define	OCW2_OP_NOOP				2
     91  1.1  thorpej #define	OCW2_OP_SPECIFIC_EOI_CMD		3
     92  1.1  thorpej #define	OCW2_OP_SET_ROTATE_IN_AUTO_EOI_MODE	4
     93  1.1  thorpej #define	OCW2_OP_ROTATE_ON_NON_SPEC_EOI_CMD	5
     94  1.1  thorpej #define	OCW2_OP_SET_PRIORITY_CMD		6
     95  1.1  thorpej #define	OCW2_OP_ROTATE_ON_SPEC_EOI_CMD		7
     96  1.1  thorpej 
     97  1.1  thorpej #define	PIC_OCW3	0x00	/* Operational Control Word 3 (r/w) */
     98  1.1  thorpej #define	OCW3_SMM	(1U << 6)	/* special mask mode */
     99  1.1  thorpej #define	OCW3_ESMM	(1U << 5)	/* enable special mask mode */
    100  1.1  thorpej #define	OCW3_SELECT	(1U << 3)	/* select OCW3 */
    101  1.1  thorpej #define	OCW3_POLL	(1U << 2)	/* poll mode command */
    102  1.1  thorpej #define	OCW3_RR_CMD(x)	((x) << 0)	/* register read command */
    103  1.1  thorpej 
    104  1.1  thorpej #define	OCW3_RR_CMD_READ_IRQ	2
    105  1.1  thorpej #define	OCW3_RR_CMD_READ_IS	3
    106  1.1  thorpej 
    107  1.1  thorpej #endif /* _DEV_IC_I8259REG_H_ */
    108