icu.h revision 330897
1294765Simp/*- 2294765Simp * SPDX-License-Identifier: BSD-3-Clause 3294765Simp * 4294765Simp * Copyright (c) 1990 The Regents of the University of California. 5294765Simp * All rights reserved. 6294765Simp * 7294765Simp * This code is derived from software contributed to Berkeley by 8294765Simp * William Jolitz. 9294765Simp * 10294765Simp * Redistribution and use in source and binary forms, with or without 11294765Simp * modification, are permitted provided that the following conditions 12294765Simp * are met: 13294765Simp * 1. Redistributions of source code must retain the above copyright 14294765Simp * notice, this list of conditions and the following disclaimer. 15294765Simp * 2. Redistributions in binary form must reproduce the above copyright 16294765Simp * notice, this list of conditions and the following disclaimer in the 17294765Simp * documentation and/or other materials provided with the distribution. 18294765Simp * 4. Neither the name of the University nor the names of its contributors 19294765Simp * may be used to endorse or promote products derived from this software 20294765Simp * without specific prior written permission. 21294765Simp * 22294765Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23294765Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24294765Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25294765Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26294765Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27294765Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28294765Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29294765Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30294765Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31294765Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32294765Simp * SUCH DAMAGE. 33294765Simp * 34294765Simp * from: @(#)icu.h 5.6 (Berkeley) 5/9/91 35294765Simp * $FreeBSD: stable/11/sys/x86/isa/icu.h 330897 2018-03-14 03:19:51Z eadler $ 36348866Skevans */ 37294765Simp 38294765Simp/* 39294765Simp * AT/386 Interrupt Control constants 40 * W. Jolitz 8/89 41 */ 42 43#ifndef _X86_ISA_ICU_H_ 44#define _X86_ISA_ICU_H_ 45 46#ifdef PC98 47#define ICU_IMR_OFFSET 2 48#else 49#define ICU_IMR_OFFSET 1 50#endif 51 52/* 53 * PC-98 machines wire the slave 8259A to pin 7 on the master PIC, and 54 * PC-AT machines wire the slave PIC to pin 2 on the master PIC. 55 */ 56#ifdef PC98 57#define ICU_SLAVEID 7 58#else 59#define ICU_SLAVEID 2 60#endif 61 62/* 63 * Determine the base master and slave modes not including auto EOI support. 64 * All machines that FreeBSD supports use 8086 mode. 65 */ 66#ifdef PC98 67/* 68 * PC-98 machines do not support auto EOI on the second PIC. Also, it 69 * seems that PC-98 machine PICs use buffered mode, and the master PIC 70 * uses special fully nested mode. 71 */ 72#define BASE_MASTER_MODE (ICW4_SFNM | ICW4_BUF | ICW4_MS | ICW4_8086) 73#define BASE_SLAVE_MODE (ICW4_BUF | ICW4_8086) 74#else 75#define BASE_MASTER_MODE ICW4_8086 76#define BASE_SLAVE_MODE ICW4_8086 77#endif 78 79/* Enable automatic EOI if requested. */ 80#ifdef AUTO_EOI_1 81#define MASTER_MODE (BASE_MASTER_MODE | ICW4_AEOI) 82#else 83#define MASTER_MODE BASE_MASTER_MODE 84#endif 85#ifdef AUTO_EOI_2 86#define SLAVE_MODE (BASE_SLAVE_MODE | ICW4_AEOI) 87#else 88#define SLAVE_MODE BASE_SLAVE_MODE 89#endif 90 91#define IRQ_MASK(irq) (1 << (irq)) 92#define IMEN_MASK(ai) (IRQ_MASK((ai)->at_irq)) 93 94void atpic_handle_intr(u_int vector, struct trapframe *frame); 95void atpic_startup(void); 96 97#endif /* !_X86_ISA_ICU_H_ */ 98